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

```c
#include<stdio.h>

long long s[100000];

typedef struct{
	long long a;
	long id;
} stone;
stone a[100000];

int cmp(const void *a, const void *b){
	if(((stone*)a)->a==((stone*)b)->a){
		return ((stone*)a)->id-((stone*)b)->id;
	}
	return ((stone*)b)->a-((stone*)a)->a;
}

int main(int argc, char const *argv[]) {
	long n,i;
	long long max;
	scanf("%ld",&n);
	for(i=0;i<n;i++){
		scanf("%lld",&a[i].a);
		a[i].id=i;
	}
	qsort(a,n,sizeof(stone),cmp);
	max=a[0].a;
	for(i=0;i<n;i++){
		if(max!=a[i].a){
			s[a[0].id]+=i*(max-a[i].a);
			if(a[0].id>a[i].id) a[0].id=a[i].id;
			max=a[i].a;
		}
	}
	s[0]+=((long long)n)*max;
	for(i=0;i<n;i++){
		printf("%lld\n",s[i]);
	}
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	s
	.bss
	.align 32
	.type	s, @object
	.size	s, 800000
s:
	.zero	800000
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 1600000
a:
	.zero	1600000
	.text
	.globl	cmp
	.type	cmp, @function
cmp:
.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
	movq	(%rax), %rdx
	movq	-16(%rbp), %rax
	movq	(%rax), %rax
	cmpq	%rax, %rdx
	jne	.L2
	movq	-8(%rbp), %rax
	movq	8(%rax), %rax
	movl	%eax, %edx
	movq	-16(%rbp), %rax
	movq	8(%rax), %rax
	movl	%eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	jmp	.L3
.L2:
	movq	-16(%rbp), %rax
	movq	(%rax), %rax
	movl	%eax, %edx
	movq	-8(%rbp), %rax
	movq	(%rax), %rax
	movl	%eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
.L3:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	cmp, .-cmp
	.section	.rodata
.LC0:
	.string	"%ld"
.LC1:
	.string	"%lld"
.LC2:
	.string	"%lld\n"
	.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	$48, %rsp
	movl	%edi, -36(%rbp)
	movq	%rsi, -48(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-32(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	$0, -24(%rbp)
	jmp	.L5
.L6:
	movq	-24(%rbp), %rax
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	a(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-24(%rbp), %rax
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	8+a(%rip), %rdx
	movq	-24(%rbp), %rax
	movq	%rax, (%rcx,%rdx)
	addq	$1, -24(%rbp)
.L5:
	movq	-32(%rbp), %rax
	cmpq	%rax, -24(%rbp)
	jl	.L6
	movq	-32(%rbp), %rax
	leaq	cmp(%rip), %rdx
	movq	%rdx, %rcx
	movl	$16, %edx
	movq	%rax, %rsi
	leaq	a(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	qsort@PLT
	movq	a(%rip), %rax
	movq	%rax, -16(%rbp)
	movq	$0, -24(%rbp)
	jmp	.L7
.L10:
	movq	-24(%rbp), %rax
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rax
	cmpq	%rax, -16(%rbp)
	je	.L8
	movq	8+a(%rip), %rax
	leaq	0(,%rax,8), %rdx
	leaq	s(%rip), %rax
	movq	(%rdx,%rax), %rcx
	movq	-24(%rbp), %rax
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movq	-16(%rbp), %rax
	subq	%rdx, %rax
	imulq	-24(%rbp), %rax
	movq	%rax, %rdx
	movq	8+a(%rip), %rax
	addq	%rdx, %rcx
	leaq	0(,%rax,8), %rdx
	leaq	s(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	movq	8+a(%rip), %rdx
	movq	-24(%rbp), %rax
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	8+a(%rip), %rax
	movq	(%rcx,%rax), %rax
	cmpq	%rax, %rdx
	jle	.L9
	movq	-24(%rbp), %rax
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	8+a(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	%rax, 8+a(%rip)
.L9:
	movq	-24(%rbp), %rax
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	%rax, -16(%rbp)
.L8:
	addq	$1, -24(%rbp)
.L7:
	movq	-32(%rbp), %rax
	cmpq	%rax, -24(%rbp)
	jl	.L10
	movq	s(%rip), %rdx
	movq	-32(%rbp), %rax
	imulq	-16(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, s(%rip)
	movq	$0, -24(%rbp)
	jmp	.L11
.L12:
	movq	-24(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	s(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addq	$1, -24(%rbp)
.L11:
	movq	-32(%rbp), %rax
	cmpq	%rax, -24(%rbp)
	jl	.L12
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L14
	call	__stack_chk_fail@PLT
.L14:
	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	cmp
	.type	cmp, @function
cmp:
.LFB23:
	.cfi_startproc
	endbr64
	movq	(%rsi), %rdx
	movq	(%rdi), %rcx
	movl	%edx, %eax
	subl	%ecx, %eax
	cmpq	%rdx, %rcx
	je	.L5
	ret
	.p2align 4,,10
	.p2align 3
.L5:
	movq	8(%rdi), %rax
	subl	8(%rsi), %eax
	ret
	.cfi_endproc
.LFE23:
	.size	cmp, .-cmp
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%ld"
.LC1:
	.string	"%lld"
.LC2:
	.string	"%lld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB24:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	.LC0(%rip), %rdi
	leaq	a(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$24, %rsp
	.cfi_def_cfa_offset 64
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rsi
	call	__isoc99_scanf@PLT
	movq	(%rsp), %rsi
	testq	%rsi, %rsi
	jle	.L7
	movq	%r13, %rbp
	xorl	%ebx, %ebx
	leaq	.LC1(%rip), %r12
	.p2align 4,,10
	.p2align 3
.L8:
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addq	$16, %rbp
	call	__isoc99_scanf@PLT
	movq	(%rsp), %rsi
	movq	%rbx, -8(%rbp)
	addq	$1, %rbx
	cmpq	%rbx, %rsi
	jg	.L8
.L7:
	leaq	cmp(%rip), %rcx
	movl	$16, %edx
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	qsort@PLT
	movq	(%rsp), %r9
	movq	a(%rip), %rax
	testq	%r9, %r9
	jle	.L9
	movq	8+a(%rip), %rdi
	leaq	s(%rip), %rbp
	cmpq	$1, %r9
	je	.L10
	leaq	16+a(%rip), %rcx
	movl	$1, %edx
	xorl	%r10d, %r10d
	.p2align 4,,10
	.p2align 3
.L12:
	movq	(%rcx), %rsi
	cmpq	%rax, %rsi
	je	.L11
	movq	8(%rcx), %r8
	subq	%rsi, %rax
	imulq	%rdx, %rax
	addq	%rax, 0(%rbp,%rdi,8)
	movq	%rsi, %rax
	cmpq	%rdi, %r8
	jge	.L11
	movq	%r8, %rdi
	movl	$1, %r10d
.L11:
	addq	$1, %rdx
	addq	$16, %rcx
	cmpq	%r9, %rdx
	jne	.L12
	testb	%r10b, %r10b
	je	.L10
	movq	%rdi, 8+a(%rip)
.L10:
	imulq	%rax, %r9
	addq	%r9, s(%rip)
	xorl	%ebx, %ebx
	leaq	.LC2(%rip), %r12
	.p2align 4,,10
	.p2align 3
.L14:
	movq	0(%rbp,%rbx,8), %rdx
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addq	$1, %rbx
	call	__printf_chk@PLT
	cmpq	%rbx, (%rsp)
	jg	.L14
.L15:
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L31
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
.L9:
	.cfi_restore_state
	imulq	%r9, %rax
	addq	%rax, s(%rip)
	jmp	.L15
.L31:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE24:
	.size	main, .-main
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 1600000
a:
	.zero	1600000
	.globl	s
	.align 32
	.type	s, @object
	.size	s, 800000
s:
	.zero	800000
	.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	cmp
	.type	cmp, @function
cmp:
.LFB23:
	.cfi_startproc
	endbr64
	movq	(%rsi), %rdx
	movq	(%rdi), %rcx
	movl	%edx, %eax
	subl	%ecx, %eax
	cmpq	%rdx, %rcx
	je	.L5
	ret
	.p2align 4,,10
	.p2align 3
.L5:
	movq	8(%rdi), %rax
	subl	8(%rsi), %eax
	ret
	.cfi_endproc
.LFE23:
	.size	cmp, .-cmp
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%ld"
.LC1:
	.string	"%lld"
.LC2:
	.string	"%lld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB24:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	.LC0(%rip), %rdi
	leaq	a(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$24, %rsp
	.cfi_def_cfa_offset 64
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rsi
	call	__isoc99_scanf@PLT
	movq	(%rsp), %rsi
	testq	%rsi, %rsi
	jle	.L7
	movq	%r13, %rbp
	xorl	%ebx, %ebx
	leaq	.LC1(%rip), %r12
	.p2align 4,,10
	.p2align 3
.L8:
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addq	$16, %rbp
	call	__isoc99_scanf@PLT
	movq	(%rsp), %rsi
	movq	%rbx, -8(%rbp)
	addq	$1, %rbx
	cmpq	%rbx, %rsi
	jg	.L8
.L7:
	leaq	cmp(%rip), %rcx
	movl	$16, %edx
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	qsort@PLT
	movq	(%rsp), %r9
	movq	a(%rip), %rax
	testq	%r9, %r9
	jle	.L9
	movq	8+a(%rip), %rdi
	leaq	s(%rip), %rbp
	cmpq	$1, %r9
	je	.L10
	leaq	16+a(%rip), %rcx
	movl	$1, %edx
	xorl	%r10d, %r10d
	.p2align 4,,10
	.p2align 3
.L12:
	movq	(%rcx), %rsi
	cmpq	%rax, %rsi
	je	.L11
	movq	8(%rcx), %r8
	subq	%rsi, %rax
	imulq	%rdx, %rax
	addq	%rax, 0(%rbp,%rdi,8)
	movq	%rsi, %rax
	cmpq	%rdi, %r8
	jge	.L11
	movq	%r8, %rdi
	movl	$1, %r10d
.L11:
	addq	$1, %rdx
	addq	$16, %rcx
	cmpq	%r9, %rdx
	jne	.L12
	testb	%r10b, %r10b
	je	.L10
	movq	%rdi, 8+a(%rip)
.L10:
	imulq	%rax, %r9
	addq	%r9, s(%rip)
	xorl	%ebx, %ebx
	leaq	.LC2(%rip), %r12
	.p2align 4,,10
	.p2align 3
.L14:
	movq	0(%rbp,%rbx,8), %rdx
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addq	$1, %rbx
	call	__printf_chk@PLT
	cmpq	%rbx, (%rsp)
	jg	.L14
.L15:
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L31
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
.L9:
	.cfi_restore_state
	imulq	%r9, %rax
	addq	%rax, s(%rip)
	jmp	.L15
.L31:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE24:
	.size	main, .-main
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 1600000
a:
	.zero	1600000
	.globl	s
	.align 32
	.type	s, @object
	.size	s, 800000
s:
	.zero	800000
	.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:

#include<stdio.h>

long long s[100000];

typedef struct{
	long long a;
	long id;
} stone;
stone a[100000];

int cmp(const void *a, const void *b){
	if(((stone*)a)->a==((stone*)b)->a){
		return ((stone*)a)->id-((stone*)b)->id;
	}
	return ((stone*)b)->a-((stone*)a)->a;
}

int main(int argc, char const *argv[]) {
	long n,i;
	long long max;
	scanf("%ld",&n);
	for(i=0;i<n;i++){
		scanf("%lld",&a[i].a);
		a[i].id=i;
	}
	qsort(a,n,sizeof(stone),cmp);
	max=a[0].a;
	for(i=0;i<n;i++){
		if(max!=a[i].a){
			s[a[0].id]+=i*(max-a[i].a);
			if(a[0].id>a[i].id) a[0].id=a[i].id;
			max=a[i].a;
		}
	}
	s[0]+=((long long)n)*max;
	for(i=0;i<n;i++){
		printf("%lld\n",s[i]);
	}
	return 0;
}
10
1 2 2 3 2 4 2 5 8 1
 10
1 3 2 3 2 4 2 5 8 1
 10
1 3 2 3 2 4 4 5 8 1
 2
1 0
 10
1 2 1 3 2 4 1 5 8 1
 10
1 2 1 3 2 4 2 5 8 0
 10
1 3 2 4 2 4 2 5 8 1
 10
1 3 2 6 2 4 4 5 8 1
 2
1 1
 10
1 2 1 3 2 4 1 5 8 0

10
8
0
4
0
3
0
2
3
0
 10
13
0
0
0
3
0
2
3
0
 10
14
0
0
0
4
0
2
3
0
 1
0
 10
6
0
4
0
3
0
2
3
0
 9
7
0
4
0
3
0
2
3
0
 10
13
0
4
0
0
0
2
3
0
 10
14
0
10
0
0
0
0
2
0
 2
0
 9
6
0
4
0
3
0
2
3
0

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

```c
#include<stdio.h>

long long s[100000];

typedef struct{
	long long a;
	long id;
} stone;
stone a[100000];

int cmp(const void *a, const void *b){
	if(((stone*)a)->a==((stone*)b)->a){
		return ((stone*)a)->id-((stone*)b)->id;
	}
	return ((stone*)b)->a-((stone*)a)->a;
}

int main(int argc, char const *argv[]) {
	long n,i;
	long long max;
	scanf("%ld",&n);
	for(i=0;i<n;i++){
		scanf("%lld",&a[i].a);
		a[i].id=i;
	}
	qsort(a,n,sizeof(stone),cmp);
	max=a[0].a;
	for(i=0;i<n;i++){
		if(max!=a[i].a){
			s[a[0].id]+=i*(max-a[i].a);
			if(a[0].id>a[i].id) a[0].id=a[i].id;
			max=a[i].a;
		}
	}
	s[0]+=((long long)n)*max;
	for(i=0;i<n;i++){
		printf("%lld\n",s[i]);
	}
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	s
	.bss
	.align 32
	.type	s, @object
	.size	s, 800000
s:
	.zero	800000
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 1600000
a:
	.zero	1600000
	.text
	.globl	cmp
	.type	cmp, @function
cmp:
.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
	movq	(%rax), %rdx
	movq	-16(%rbp), %rax
	movq	(%rax), %rax
	cmpq	%rax, %rdx
	jne	.L2
	movq	-8(%rbp), %rax
	movq	8(%rax), %rax
	movl	%eax, %edx
	movq	-16(%rbp), %rax
	movq	8(%rax), %rax
	movl	%eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	jmp	.L3
.L2:
	movq	-16(%rbp), %rax
	movq	(%rax), %rax
	movl	%eax, %edx
	movq	-8(%rbp), %rax
	movq	(%rax), %rax
	movl	%eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
.L3:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	cmp, .-cmp
	.section	.rodata
.LC0:
	.string	"%ld"
.LC1:
	.string	"%lld"
.LC2:
	.string	"%lld\n"
	.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	$48, %rsp
	movl	%edi, -36(%rbp)
	movq	%rsi, -48(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-32(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	$0, -24(%rbp)
	jmp	.L5
.L6:
	movq	-24(%rbp), %rax
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	a(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-24(%rbp), %rax
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	8+a(%rip), %rdx
	movq	-24(%rbp), %rax
	movq	%rax, (%rcx,%rdx)
	addq	$1, -24(%rbp)
.L5:
	movq	-32(%rbp), %rax
	cmpq	%rax, -24(%rbp)
	jl	.L6
	movq	-32(%rbp), %rax
	leaq	cmp(%rip), %rdx
	movq	%rdx, %rcx
	movl	$16, %edx
	movq	%rax, %rsi
	leaq	a(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	qsort@PLT
	movq	a(%rip), %rax
	movq	%rax, -16(%rbp)
	movq	$0, -24(%rbp)
	jmp	.L7
.L10:
	movq	-24(%rbp), %rax
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rax
	cmpq	%rax, -16(%rbp)
	je	.L8
	movq	8+a(%rip), %rax
	leaq	0(,%rax,8), %rdx
	leaq	s(%rip), %rax
	movq	(%rdx,%rax), %rcx
	movq	-24(%rbp), %rax
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movq	-16(%rbp), %rax
	subq	%rdx, %rax
	imulq	-24(%rbp), %rax
	movq	%rax, %rdx
	movq	8+a(%rip), %rax
	addq	%rdx, %rcx
	leaq	0(,%rax,8), %rdx
	leaq	s(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	movq	8+a(%rip), %rdx
	movq	-24(%rbp), %rax
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	8+a(%rip), %rax
	movq	(%rcx,%rax), %rax
	cmpq	%rax, %rdx
	jle	.L9
	movq	-24(%rbp), %rax
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	8+a(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	%rax, 8+a(%rip)
.L9:
	movq	-24(%rbp), %rax
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	%rax, -16(%rbp)
.L8:
	addq	$1, -24(%rbp)
.L7:
	movq	-32(%rbp), %rax
	cmpq	%rax, -24(%rbp)
	jl	.L10
	movq	s(%rip), %rdx
	movq	-32(%rbp), %rax
	imulq	-16(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, s(%rip)
	movq	$0, -24(%rbp)
	jmp	.L11
.L12:
	movq	-24(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	s(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addq	$1, -24(%rbp)
.L11:
	movq	-32(%rbp), %rax
	cmpq	%rax, -24(%rbp)
	jl	.L12
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L14
	call	__stack_chk_fail@PLT
.L14:
	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	s
	.bss
	.align 32
	.type	s, @object
	.size	s, 800000
s:
	.zero	800000
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 1600000
a:
	.zero	1600000
	.text
	.globl	cmp
	.type	cmp, @function
cmp:
.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
	movq	(%rax), %rdx
	movq	-16(%rbp), %rax
	movq	(%rax), %rax
	cmpq	%rax, %rdx
	jne	.L2
	movq	-8(%rbp), %rax
	movq	8(%rax), %rax
	movl	%eax, %edx
	movq	-16(%rbp), %rax
	movq	8(%rax), %rax
	movl	%eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	jmp	.L3
.L2:
	movq	-16(%rbp), %rax
	movq	(%rax), %rax
	movl	%eax, %edx
	movq	-8(%rbp), %rax
	movq	(%rax), %rax
	movl	%eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
.L3:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	cmp, .-cmp
	.section	.rodata
.LC0:
	.string	"%ld"
.LC1:
	.string	"%lld"
.LC2:
	.string	"%lld\n"
	.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	$48, %rsp
	movl	%edi, -36(%rbp)
	movq	%rsi, -48(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-32(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	$0, -24(%rbp)
	jmp	.L5
.L6:
	movq	-24(%rbp), %rax
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	a(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-24(%rbp), %rax
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	8+a(%rip), %rdx
	movq	-24(%rbp), %rax
	movq	%rax, (%rcx,%rdx)
	addq	$1, -24(%rbp)
.L5:
	movq	-32(%rbp), %rax
	cmpq	%rax, -24(%rbp)
	jl	.L6
	movq	-32(%rbp), %rax
	leaq	cmp(%rip), %rdx
	movq	%rdx, %rcx
	movl	$16, %edx
	movq	%rax, %rsi
	leaq	a(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	qsort@PLT
	movq	a(%rip), %rax
	movq	%rax, -16(%rbp)
	movq	$0, -24(%rbp)
	jmp	.L7
.L10:
	movq	-24(%rbp), %rax
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rax
	cmpq	%rax, -16(%rbp)
	je	.L8
	movq	8+a(%rip), %rax
	leaq	0(,%rax,8), %rdx
	leaq	s(%rip), %rax
	movq	(%rdx,%rax), %rcx
	movq	-24(%rbp), %rax
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movq	-16(%rbp), %rax
	subq	%rdx, %rax
	imulq	-24(%rbp), %rax
	movq	%rax, %rdx
	movq	8+a(%rip), %rax
	addq	%rdx, %rcx
	leaq	0(,%rax,8), %rdx
	leaq	s(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	movq	8+a(%rip), %rdx
	movq	-24(%rbp), %rax
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	8+a(%rip), %rax
	movq	(%rcx,%rax), %rax
	cmpq	%rax, %rdx
	jle	.L9
	movq	-24(%rbp), %rax
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	8+a(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	%rax, 8+a(%rip)
.L9:
	movq	-24(%rbp), %rax
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	%rax, -16(%rbp)
.L8:
	addq	$1, -24(%rbp)
.L7:
	movq	-32(%rbp), %rax
	cmpq	%rax, -24(%rbp)
	jl	.L10
	movq	s(%rip), %rdx
	movq	-32(%rbp), %rax
	imulq	-16(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, s(%rip)
	movq	$0, -24(%rbp)
	jmp	.L11
.L12:
	movq	-24(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	s(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addq	$1, -24(%rbp)
.L11:
	movq	-32(%rbp), %rax
	cmpq	%rax, -24(%rbp)
	jl	.L12
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L14
	call	__stack_chk_fail@PLT
.L14:
	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:
