Given the following C code and unoptimized assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
struct B{int w,s,v;}A[1111];n,i;long p[22222],s;c(a,b)struct B*a,*b;{s=a->w+a->s-b->w-b->s;}main(j){for(scanf("%*d");~scanf("%d%d%d",A+n,&A[n].s,&A[n].v);n++);for(qsort(A,n,12,c);i<n;i++)for(j=A[i].s;~j;)s=fmax(s,p[j+A[i].w]=fmax(p[j--+A[i].w],p[j]+A[i].v));printf("%ld",s);}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	A
	.bss
	.align 32
	.type	A, @object
	.size	A, 13332
A:
	.zero	13332
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	p
	.align 32
	.type	p, @object
	.size	p, 177776
p:
	.zero	177776
	.globl	s
	.align 8
	.type	s, @object
	.size	s, 8
s:
	.zero	8
	.text
	.globl	c
	.type	c, @function
c:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-8(%rbp), %rax
	movl	(%rax), %edx
	movq	-8(%rbp), %rax
	movl	4(%rax), %eax
	addl	%eax, %edx
	movq	-16(%rbp), %rax
	movl	(%rax), %eax
	subl	%eax, %edx
	movq	-16(%rbp), %rax
	movl	4(%rax), %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	cltq
	movq	%rax, s(%rip)
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	c, .-c
	.section	.rodata
.LC0:
	.string	"%*d"
.LC1:
	.string	"%d%d%d"
.LC2:
	.string	"%ld"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	%edi, -4(%rbp)
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	jmp	.L3
.L4:
	movl	n(%rip), %eax
	addl	$1, %eax
	movl	%eax, n(%rip)
.L3:
	movl	n(%rip), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	leaq	A(%rip), %rdx
	addq	%rdx, %rax
	leaq	8(%rax), %rcx
	movl	n(%rip), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	leaq	A(%rip), %rdx
	addq	%rdx, %rax
	leaq	4(%rax), %rdx
	movl	n(%rip), %eax
	movslq	%eax, %rsi
	movq	%rsi, %rax
	addq	%rax, %rax
	addq	%rsi, %rax
	salq	$2, %rax
	movq	%rax, %rsi
	leaq	A(%rip), %rax
	addq	%rsi, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	cmpl	$-1, %eax
	jne	.L4
	movl	n(%rip), %eax
	leaq	c(%rip), %rdx
	movq	%rdx, %rcx
	movl	$12, %edx
	movl	%eax, %esi
	leaq	A(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	qsort@PLT
	jmp	.L5
.L8:
	movl	i(%rip), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	4+A(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -4(%rbp)
	jmp	.L6
.L7:
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	p(%rip), %rax
	movq	(%rdx,%rax), %rcx
	movl	i(%rip), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	8+A(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	addq	%rcx, %rax
	pxor	%xmm0, %xmm0
	cvtsi2sdq	%rax, %xmm0
	movl	-4(%rbp), %edx
	leal	-1(%rdx), %eax
	movl	%eax, -4(%rbp)
	movl	i(%rip), %eax
	movslq	%eax, %rcx
	movq	%rcx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	salq	$2, %rax
	movq	%rax, %rcx
	leaq	A(%rip), %rax
	movl	(%rcx,%rax), %eax
	addl	%edx, %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	p(%rip), %rax
	movq	(%rdx,%rax), %rax
	pxor	%xmm2, %xmm2
	cvtsi2sdq	%rax, %xmm2
	movq	%xmm2, %rax
	movapd	%xmm0, %xmm1
	movq	%rax, %xmm0
	call	fmax@PLT
	movl	i(%rip), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	A(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-4(%rbp), %eax
	addl	%edx, %eax
	cvttsd2siq	%xmm0, %rdx
	movslq	%eax, %rcx
	leaq	0(,%rcx,8), %rsi
	leaq	p(%rip), %rcx
	movq	%rdx, (%rsi,%rcx)
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	p(%rip), %rax
	movq	(%rdx,%rax), %rax
	pxor	%xmm0, %xmm0
	cvtsi2sdq	%rax, %xmm0
	movq	s(%rip), %rax
	pxor	%xmm3, %xmm3
	cvtsi2sdq	%rax, %xmm3
	movq	%xmm3, %rax
	movapd	%xmm0, %xmm1
	movq	%rax, %xmm0
	call	fmax@PLT
	cvttsd2siq	%xmm0, %rax
	movq	%rax, s(%rip)
.L6:
	cmpl	$-1, -4(%rbp)
	jne	.L7
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L5:
	movl	i(%rip), %edx
	movl	n(%rip), %eax
	cmpl	%eax, %edx
	jl	.L8
	movq	s(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
user
	.file	"temp.c"
	.text
	.p2align 4
	.globl	c
	.type	c, @function
c:
.LFB0:
	.cfi_startproc
	endbr64
	movl	(%rdi), %eax
	addl	4(%rdi), %eax
	subl	(%rsi), %eax
	subl	4(%rsi), %eax
	cltq
	movq	%rax, s(%rip)
	ret
	.cfi_endproc
.LFE0:
	.size	c, .-c
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%*d"
.LC1:
	.string	"%d%d%d"
.LC2:
	.string	"%ld"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	leaq	A(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	.LC1(%rip), %rbx
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	call	scanf@PLT
	movl	n(%rip), %eax
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L5:
	movl	n(%rip), %eax
	addl	$1, %eax
	movl	%eax, n(%rip)
.L4:
	cltq
	movq	%rbx, %rdi
	leaq	(%rax,%rax,2), %rsi
	xorl	%eax, %eax
	salq	$2, %rsi
	leaq	8(%rbp,%rsi), %rcx
	leaq	4(%rbp,%rsi), %rdx
	addq	%rbp, %rsi
	call	scanf@PLT
	cmpl	$-1, %eax
	jne	.L5
	movl	n(%rip), %esi
	movl	$12, %edx
	xorl	%eax, %eax
	movq	%rbp, %rdi
	leaq	c(%rip), %rcx
	call	qsort@PLT
	movl	n(%rip), %eax
	movl	i(%rip), %edx
	movl	%eax, 20(%rsp)
	cmpl	%eax, %edx
	movq	s(%rip), %rax
	movq	%rax, 24(%rsp)
	jge	.L7
	movslq	%edx, %rsi
	movq	%rax, %r15
	leaq	(%rsi,%rsi,2), %rax
	leaq	0(%rbp,%rax,4), %r13
	movl	20(%rsp), %eax
	subl	$1, %eax
	subl	%edx, %eax
	addq	%rsi, %rax
	leaq	(%rax,%rax,2), %rdx
	leaq	12+A(%rip), %rax
	leaq	(%rax,%rdx,4), %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L10:
	movl	4(%r13), %edx
	cmpl	$-1, %edx
	je	.L8
	movslq	0(%r13), %rdi
	movslq	%edx, %rsi
	pxor	%xmm2, %xmm2
	movl	%edx, %r10d
	leaq	p(%rip), %rax
	movq	%rsi, %r9
	movslq	8(%r13), %r12
	movq	%rdi, %r8
	addq	%rsi, %rdi
	leaq	-8(%rax), %rcx
	subq	%r10, %r9
	cvtsi2sdq	(%rax,%rdi,8), %xmm2
	leal	-1(%r8,%rdx), %ebx
	movslq	%ebx, %rbx
	leaq	(%rax,%rsi,8), %r14
	leaq	(%rcx,%r9,8), %rbp
	subq	%rsi, %rbx
	.p2align 4,,10
	.p2align 3
.L9:
	movq	(%r14), %rdx
	pxor	%xmm1, %xmm1
	movapd	%xmm2, %xmm0
	addq	%r12, %rdx
	cvtsi2sdq	%rdx, %xmm1
	call	fmax@PLT
	pxor	%xmm2, %xmm2
	cvttsd2siq	%xmm0, %rdx
	pxor	%xmm0, %xmm0
	cvtsi2sdq	%r15, %xmm0
	cvtsi2sdq	%rdx, %xmm2
	movq	%rdx, (%r14,%rbx,8)
	subq	$8, %r14
	movapd	%xmm2, %xmm1
	movsd	%xmm2, (%rsp)
	call	fmax@PLT
	cmpq	%r14, %rbp
	movsd	(%rsp), %xmm2
	cvttsd2siq	%xmm0, %r15
	jne	.L9
	movl	$1, %eax
.L8:
	addq	$12, %r13
	cmpq	%r13, 8(%rsp)
	jne	.L10
	movl	20(%rsp), %edi
	movl	%edi, i(%rip)
	testb	%al, %al
	je	.L7
	movq	%r15, s(%rip)
	movq	%r15, 24(%rsp)
.L7:
	movq	24(%rsp), %rsi
	leaq	.LC2(%rip), %rdi
	xorl	%eax, %eax
	call	printf@PLT
	addq	$40, %rsp
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE1:
	.size	main, .-main
	.globl	s
	.bss
	.align 8
	.type	s, @object
	.size	s, 8
s:
	.zero	8
	.globl	p
	.align 32
	.type	p, @object
	.size	p, 177776
p:
	.zero	177776
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	A
	.align 32
	.type	A, @object
	.size	A, 13332
A:
	.zero	13332
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

rule
	.file	"temp.c"
	.text
	.p2align 4
	.globl	c
	.type	c, @function
c:
.LFB0:
	.cfi_startproc
	endbr64
	movl	(%rdi), %eax
	addl	4(%rdi), %eax
	subl	(%rsi), %eax
	subl	4(%rsi), %eax
	cltq
	movq	%rax, s(%rip)
	ret
	.cfi_endproc
.LFE0:
	.size	c, .-c
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%*d"
.LC1:
	.string	"%d%d%d"
.LC2:
	.string	"%ld"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	leaq	A(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	.LC1(%rip), %rbx
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	call	scanf@PLT
	movl	n(%rip), %eax
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L5:
	movl	n(%rip), %eax
	addl	$1, %eax
	movl	%eax, n(%rip)
.L4:
	cltq
	movq	%rbx, %rdi
	leaq	(%rax,%rax,2), %rsi
	xorl	%eax, %eax
	salq	$2, %rsi
	leaq	8(%rbp,%rsi), %rcx
	leaq	4(%rbp,%rsi), %rdx
	addq	%rbp, %rsi
	call	scanf@PLT
	cmpl	$-1, %eax
	jne	.L5
	movl	n(%rip), %esi
	movl	$12, %edx
	xorl	%eax, %eax
	movq	%rbp, %rdi
	leaq	c(%rip), %rcx
	call	qsort@PLT
	movl	n(%rip), %eax
	movl	i(%rip), %edx
	movl	%eax, 20(%rsp)
	cmpl	%eax, %edx
	movq	s(%rip), %rax
	movq	%rax, 24(%rsp)
	jge	.L7
	movslq	%edx, %rsi
	movq	%rax, %r15
	leaq	(%rsi,%rsi,2), %rax
	leaq	0(%rbp,%rax,4), %r13
	movl	20(%rsp), %eax
	subl	$1, %eax
	subl	%edx, %eax
	addq	%rsi, %rax
	leaq	(%rax,%rax,2), %rdx
	leaq	12+A(%rip), %rax
	leaq	(%rax,%rdx,4), %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L10:
	movl	4(%r13), %edx
	cmpl	$-1, %edx
	je	.L8
	movslq	0(%r13), %rdi
	movslq	%edx, %rsi
	pxor	%xmm2, %xmm2
	movl	%edx, %r10d
	leaq	p(%rip), %rax
	movq	%rsi, %r9
	movslq	8(%r13), %r12
	movq	%rdi, %r8
	addq	%rsi, %rdi
	leaq	-8(%rax), %rcx
	subq	%r10, %r9
	cvtsi2sdq	(%rax,%rdi,8), %xmm2
	leal	-1(%r8,%rdx), %ebx
	movslq	%ebx, %rbx
	leaq	(%rax,%rsi,8), %r14
	leaq	(%rcx,%r9,8), %rbp
	subq	%rsi, %rbx
	.p2align 4,,10
	.p2align 3
.L9:
	movq	(%r14), %rdx
	pxor	%xmm1, %xmm1
	movapd	%xmm2, %xmm0
	addq	%r12, %rdx
	cvtsi2sdq	%rdx, %xmm1
	call	fmax@PLT
	pxor	%xmm2, %xmm2
	cvttsd2siq	%xmm0, %rdx
	pxor	%xmm0, %xmm0
	cvtsi2sdq	%r15, %xmm0
	cvtsi2sdq	%rdx, %xmm2
	movq	%rdx, (%r14,%rbx,8)
	subq	$8, %r14
	movapd	%xmm2, %xmm1
	movsd	%xmm2, (%rsp)
	call	fmax@PLT
	cmpq	%r14, %rbp
	movsd	(%rsp), %xmm2
	cvttsd2siq	%xmm0, %r15
	jne	.L9
	movl	$1, %eax
.L8:
	addq	$12, %r13
	cmpq	%r13, 8(%rsp)
	jne	.L10
	movl	20(%rsp), %edi
	movl	%edi, i(%rip)
	testb	%al, %al
	je	.L7
	movq	%r15, s(%rip)
	movq	%r15, 24(%rsp)
.L7:
	movq	24(%rsp), %rsi
	leaq	.LC2(%rip), %rdi
	xorl	%eax, %eax
	call	printf@PLT
	addq	$40, %rsp
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE1:
	.size	main, .-main
	.globl	s
	.bss
	.align 8
	.type	s, @object
	.size	s, 8
s:
	.zero	8
	.globl	p
	.align 32
	.type	p, @object
	.size	p, 177776
p:
	.zero	177776
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	A
	.align 32
	.type	A, @object
	.size	A, 13332
A:
	.zero	13332
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

struct B{int w,s,v;}A[1111];n,i;long p[22222],s;c(a,b)struct B*a,*b;{s=a->w+a->s-b->w-b->s;}main(j){for(scanf("%*d");~scanf("%d%d%d",A+n,&A[n].s,&A[n].v);n++);for(qsort(A,n,12,c);i<n;i++)for(j=A[i].s;~j;)s=fmax(s,p[j+A[i].w]=fmax(p[j--+A[i].w],p[j]+A[i].v));printf("%ld",s);}
5
1 10000 1000000001
1 10000 1000000000
1 10000 1000000000
1 10000 1000000000
1 10000 1000000000
 3
2 2 20
2 1 30
3 1 47
 4
1 2 10
3 1 10
2 4 15
1 6 10
 8
9 5 7
6 2 7
5 7 3
7 8 8
1 8 6
3 3 3
4 1 7
4 5 5
 4
1 2 10
3 1 10
2 4 29
1 6 10
 4
1 2 10
3 1 10
2 4 3
1 6 10
 8
9 5 7
0 2 7
5 7 3
7 8 8
1 8 6
3 2 3
4 1 7
4 8 5
 5
1 11000 1000000001
1 10100 1000000000
1 10000 1000000000
1 00000 1000000000
1 00000 1000000000
 4
2 2 10
3 2 10
2 4 3
1 6 10
 8
4 5 7
0 2 7
5 7 3
5 8 8
1 8 6
3 2 3
4 1 7
4 8 5

5000000001 97 45 46 59 33 21 5000000001 33 21
Given the following C code and unoptimized assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
struct B{int w,s,v;}A[1111];n,i;long p[22222],s;c(a,b)struct B*a,*b;{s=a->w+a->s-b->w-b->s;}main(j){for(scanf("%*d");~scanf("%d%d%d",A+n,&A[n].s,&A[n].v);n++);for(qsort(A,n,12,c);i<n;i++)for(j=A[i].s;~j;)s=fmax(s,p[j+A[i].w]=fmax(p[j--+A[i].w],p[j]+A[i].v));printf("%ld",s);}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	A
	.bss
	.align 32
	.type	A, @object
	.size	A, 13332
A:
	.zero	13332
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	p
	.align 32
	.type	p, @object
	.size	p, 177776
p:
	.zero	177776
	.globl	s
	.align 8
	.type	s, @object
	.size	s, 8
s:
	.zero	8
	.text
	.globl	c
	.type	c, @function
c:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-8(%rbp), %rax
	movl	(%rax), %edx
	movq	-8(%rbp), %rax
	movl	4(%rax), %eax
	addl	%eax, %edx
	movq	-16(%rbp), %rax
	movl	(%rax), %eax
	subl	%eax, %edx
	movq	-16(%rbp), %rax
	movl	4(%rax), %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	cltq
	movq	%rax, s(%rip)
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	c, .-c
	.section	.rodata
.LC0:
	.string	"%*d"
.LC1:
	.string	"%d%d%d"
.LC2:
	.string	"%ld"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	%edi, -4(%rbp)
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	jmp	.L3
.L4:
	movl	n(%rip), %eax
	addl	$1, %eax
	movl	%eax, n(%rip)
.L3:
	movl	n(%rip), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	leaq	A(%rip), %rdx
	addq	%rdx, %rax
	leaq	8(%rax), %rcx
	movl	n(%rip), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	leaq	A(%rip), %rdx
	addq	%rdx, %rax
	leaq	4(%rax), %rdx
	movl	n(%rip), %eax
	movslq	%eax, %rsi
	movq	%rsi, %rax
	addq	%rax, %rax
	addq	%rsi, %rax
	salq	$2, %rax
	movq	%rax, %rsi
	leaq	A(%rip), %rax
	addq	%rsi, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	cmpl	$-1, %eax
	jne	.L4
	movl	n(%rip), %eax
	leaq	c(%rip), %rdx
	movq	%rdx, %rcx
	movl	$12, %edx
	movl	%eax, %esi
	leaq	A(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	qsort@PLT
	jmp	.L5
.L8:
	movl	i(%rip), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	4+A(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -4(%rbp)
	jmp	.L6
.L7:
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	p(%rip), %rax
	movq	(%rdx,%rax), %rcx
	movl	i(%rip), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	8+A(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	addq	%rcx, %rax
	pxor	%xmm0, %xmm0
	cvtsi2sdq	%rax, %xmm0
	movl	-4(%rbp), %edx
	leal	-1(%rdx), %eax
	movl	%eax, -4(%rbp)
	movl	i(%rip), %eax
	movslq	%eax, %rcx
	movq	%rcx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	salq	$2, %rax
	movq	%rax, %rcx
	leaq	A(%rip), %rax
	movl	(%rcx,%rax), %eax
	addl	%edx, %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	p(%rip), %rax
	movq	(%rdx,%rax), %rax
	pxor	%xmm2, %xmm2
	cvtsi2sdq	%rax, %xmm2
	movq	%xmm2, %rax
	movapd	%xmm0, %xmm1
	movq	%rax, %xmm0
	call	fmax@PLT
	movl	i(%rip), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	A(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-4(%rbp), %eax
	addl	%edx, %eax
	cvttsd2siq	%xmm0, %rdx
	movslq	%eax, %rcx
	leaq	0(,%rcx,8), %rsi
	leaq	p(%rip), %rcx
	movq	%rdx, (%rsi,%rcx)
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	p(%rip), %rax
	movq	(%rdx,%rax), %rax
	pxor	%xmm0, %xmm0
	cvtsi2sdq	%rax, %xmm0
	movq	s(%rip), %rax
	pxor	%xmm3, %xmm3
	cvtsi2sdq	%rax, %xmm3
	movq	%xmm3, %rax
	movapd	%xmm0, %xmm1
	movq	%rax, %xmm0
	call	fmax@PLT
	cvttsd2siq	%xmm0, %rax
	movq	%rax, s(%rip)
.L6:
	cmpl	$-1, -4(%rbp)
	jne	.L7
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L5:
	movl	i(%rip), %edx
	movl	n(%rip), %eax
	cmpl	%eax, %edx
	jl	.L8
	movq	s(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
train
	.file	"temp.c"
	.text
	.globl	A
	.bss
	.align 32
	.type	A, @object
	.size	A, 13332
A:
	.zero	13332
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	p
	.align 32
	.type	p, @object
	.size	p, 177776
p:
	.zero	177776
	.globl	s
	.align 8
	.type	s, @object
	.size	s, 8
s:
	.zero	8
	.text
	.globl	c
	.type	c, @function
c:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-8(%rbp), %rax
	movl	(%rax), %edx
	movq	-8(%rbp), %rax
	movl	4(%rax), %eax
	addl	%eax, %edx
	movq	-16(%rbp), %rax
	movl	(%rax), %eax
	subl	%eax, %edx
	movq	-16(%rbp), %rax
	movl	4(%rax), %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	cltq
	movq	%rax, s(%rip)
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	c, .-c
	.section	.rodata
.LC0:
	.string	"%*d"
.LC1:
	.string	"%d%d%d"
.LC2:
	.string	"%ld"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	%edi, -4(%rbp)
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	jmp	.L3
.L4:
	movl	n(%rip), %eax
	addl	$1, %eax
	movl	%eax, n(%rip)
.L3:
	movl	n(%rip), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	leaq	A(%rip), %rdx
	addq	%rdx, %rax
	leaq	8(%rax), %rcx
	movl	n(%rip), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	leaq	A(%rip), %rdx
	addq	%rdx, %rax
	leaq	4(%rax), %rdx
	movl	n(%rip), %eax
	movslq	%eax, %rsi
	movq	%rsi, %rax
	addq	%rax, %rax
	addq	%rsi, %rax
	salq	$2, %rax
	movq	%rax, %rsi
	leaq	A(%rip), %rax
	addq	%rsi, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	cmpl	$-1, %eax
	jne	.L4
	movl	n(%rip), %eax
	leaq	c(%rip), %rdx
	movq	%rdx, %rcx
	movl	$12, %edx
	movl	%eax, %esi
	leaq	A(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	qsort@PLT
	jmp	.L5
.L8:
	movl	i(%rip), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	4+A(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -4(%rbp)
	jmp	.L6
.L7:
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	p(%rip), %rax
	movq	(%rdx,%rax), %rcx
	movl	i(%rip), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	8+A(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	addq	%rcx, %rax
	pxor	%xmm0, %xmm0
	cvtsi2sdq	%rax, %xmm0
	movl	-4(%rbp), %edx
	leal	-1(%rdx), %eax
	movl	%eax, -4(%rbp)
	movl	i(%rip), %eax
	movslq	%eax, %rcx
	movq	%rcx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	salq	$2, %rax
	movq	%rax, %rcx
	leaq	A(%rip), %rax
	movl	(%rcx,%rax), %eax
	addl	%edx, %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	p(%rip), %rax
	movq	(%rdx,%rax), %rax
	pxor	%xmm2, %xmm2
	cvtsi2sdq	%rax, %xmm2
	movq	%xmm2, %rax
	movapd	%xmm0, %xmm1
	movq	%rax, %xmm0
	call	fmax@PLT
	movl	i(%rip), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdx
	leaq	A(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-4(%rbp), %eax
	addl	%edx, %eax
	cvttsd2siq	%xmm0, %rdx
	movslq	%eax, %rcx
	leaq	0(,%rcx,8), %rsi
	leaq	p(%rip), %rcx
	movq	%rdx, (%rsi,%rcx)
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	p(%rip), %rax
	movq	(%rdx,%rax), %rax
	pxor	%xmm0, %xmm0
	cvtsi2sdq	%rax, %xmm0
	movq	s(%rip), %rax
	pxor	%xmm3, %xmm3
	cvtsi2sdq	%rax, %xmm3
	movq	%xmm3, %rax
	movapd	%xmm0, %xmm1
	movq	%rax, %xmm0
	call	fmax@PLT
	cvttsd2siq	%xmm0, %rax
	movq	%rax, s(%rip)
.L6:
	cmpl	$-1, -4(%rbp)
	jne	.L7
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L5:
	movl	i(%rip), %edx
	movl	n(%rip), %eax
	cmpl	%eax, %edx
	jl	.L8
	movq	s(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
