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>
int n;
long a[500000];
int main(){
	scanf("%d",&n);
	long long sum=0;
	for (int i=1;i<=n;i++){
		scanf("%li",&a[i]);
		a[i]=a[i]-i;	
	}
	sort(1,n);
	a[0]=a[1];
	for (int i=1;i<=n;i++){
		a[i]=a[i]-a[0];
		sum=sum+a[i];
	}
	long long ans=sum;
	for (int i=2;i<=n;i++){
		sum=sum-(a[i]-a[i-1])*(n-i+1)+(a[i]-a[i-1])*(i-1);
		if (sum<ans)ans=sum;
	}
	printf("%lli",ans);
	return(0);
}
int sort(int x,int y){
	int l=x;
	int r=y;
	long m=a[(x+y)/2];
	while (l<r){
		while (a[l]<m)l++;
		while (a[r]>m)r--;
		if (l<=r){
			long z=a[l];
			a[l]=a[r];	
			a[r]=z;
			l++;
			r--;
		}
	}
	if (l<y)sort(l,y);
	if (r>x)sort(x,r);
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	n
	.bss
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 4000000
a:
	.zero	4000000
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%li"
.LC2:
	.string	"%lli"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	$0, -16(%rbp)
	movl	$1, -28(%rbp)
	jmp	.L2
.L3:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %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
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rax
	movl	-28(%rbp), %edx
	movslq	%edx, %rdx
	subq	%rdx, %rax
	movq	%rax, %rcx
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	addl	$1, -28(%rbp)
.L2:
	movl	n(%rip), %eax
	cmpl	%eax, -28(%rbp)
	jle	.L3
	movl	n(%rip), %eax
	movl	%eax, %esi
	movl	$1, %edi
	movl	$0, %eax
	call	sort
	movq	8+a(%rip), %rax
	movq	%rax, a(%rip)
	movl	$1, -24(%rbp)
	jmp	.L4
.L5:
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	a(%rip), %rdx
	subq	%rdx, %rax
	movq	%rax, %rcx
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rax
	addq	%rax, -16(%rbp)
	addl	$1, -24(%rbp)
.L4:
	movl	n(%rip), %eax
	cmpl	%eax, -24(%rbp)
	jle	.L5
	movq	-16(%rbp), %rax
	movq	%rax, -8(%rbp)
	movl	$2, -20(%rbp)
	jmp	.L6
.L8:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rax
	movl	-20(%rbp), %edx
	subl	$1, %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	a(%rip), %rdx
	movq	(%rcx,%rdx), %rcx
	subq	%rcx, %rax
	movq	%rax, %rdx
	movl	n(%rip), %eax
	subl	-20(%rbp), %eax
	addl	$1, %eax
	cltq
	imulq	%rax, %rdx
	movq	-16(%rbp), %rax
	subq	%rdx, %rax
	movq	%rax, %rsi
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rax
	movl	-20(%rbp), %edx
	subl	$1, %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	a(%rip), %rdx
	movq	(%rcx,%rdx), %rcx
	subq	%rcx, %rax
	movq	%rax, %rdx
	movl	-20(%rbp), %eax
	subl	$1, %eax
	cltq
	imulq	%rdx, %rax
	addq	%rsi, %rax
	movq	%rax, -16(%rbp)
	movq	-16(%rbp), %rax
	cmpq	-8(%rbp), %rax
	jge	.L7
	movq	-16(%rbp), %rax
	movq	%rax, -8(%rbp)
.L7:
	addl	$1, -20(%rbp)
.L6:
	movl	n(%rip), %eax
	cmpl	%eax, -20(%rbp)
	jle	.L8
	movq	-8(%rbp), %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
.LFE0:
	.size	main, .-main
	.globl	sort
	.type	sort, @function
sort:
.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)
	movl	%esi, -40(%rbp)
	movl	-36(%rbp), %eax
	movl	%eax, -24(%rbp)
	movl	-40(%rbp), %eax
	movl	%eax, -20(%rbp)
	movl	-36(%rbp), %edx
	movl	-40(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	%rax, -16(%rbp)
	jmp	.L11
.L13:
	addl	$1, -24(%rbp)
.L12:
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rax
	cmpq	%rax, -16(%rbp)
	jg	.L13
	jmp	.L14
.L15:
	subl	$1, -20(%rbp)
.L14:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rax
	cmpq	%rax, -16(%rbp)
	jl	.L15
	movl	-24(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jg	.L11
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	%rax, -8(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rax
	movl	-24(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	a(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	a(%rip), %rdx
	movq	-8(%rbp), %rax
	movq	%rax, (%rcx,%rdx)
	addl	$1, -24(%rbp)
	subl	$1, -20(%rbp)
.L11:
	movl	-24(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jl	.L12
	movl	-24(%rbp), %eax
	cmpl	-40(%rbp), %eax
	jge	.L17
	movl	-40(%rbp), %edx
	movl	-24(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	sort
.L17:
	movl	-20(%rbp), %eax
	cmpl	-36(%rbp), %eax
	jle	.L18
	movl	-20(%rbp), %edx
	movl	-36(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	sort
.L18:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	sort, .-sort
	.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	sort
	.type	sort, @function
sort:
.LFB24:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	a(%rip), %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	leaq	-8(%r15), %r10
	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
	movl	%esi, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movl	%edi, %ebx
	subq	$72, %rsp
	.cfi_def_cfa_offset 128
	movl	%edi, 56(%rsp)
.L11:
	movl	%ebx, %edx
	movl	%ebp, %r8d
	leaq	8+a(%rip), %rdi
	movl	%ebx, %r9d
	addl	%ebp, %edx
	movl	%edx, %eax
	shrl	$31, %eax
	addl	%edx, %eax
	sarl	%eax
	cltq
	movq	(%r15,%rax,8), %rdx
.L6:
	cmpl	%r8d, %r9d
	jge	.L7
.L187:
	movslq	%r9d, %r11
	movslq	%r8d, %rbx
	leal	1(%r9), %eax
	movq	(%r15,%r11,8), %rsi
	movq	(%r15,%rbx,8), %rcx
	cltq
	cmpq	%rsi, %rdx
	jle	.L186
	.p2align 4,,10
	.p2align 3
.L3:
	movl	%eax, %r9d
	addq	$1, %rax
	movq	(%r10,%rax,8), %rsi
	cmpq	%rdx, %rsi
	jl	.L3
	cmpq	%rcx, %rdx
	jge	.L4
.L93:
	subl	$1, %r8d
	movslq	%r8d, %rax
	.p2align 4,,10
	.p2align 3
.L5:
	movl	%eax, %r8d
	subq	$1, %rax
	movq	(%rdi,%rax,8), %rcx
	cmpq	%rdx, %rcx
	jg	.L5
.L4:
	cmpl	%r9d, %r8d
	jl	.L6
	movslq	%r9d, %r11
	movslq	%r8d, %rbx
.L94:
	addl	$1, %r9d
	subl	$1, %r8d
	movq	%rcx, (%r15,%r11,8)
	movq	%rsi, (%r15,%rbx,8)
	cmpl	%r8d, %r9d
	jl	.L187
.L7:
	movl	%r9d, 12(%rsp)
	movl	%r8d, 16(%rsp)
	cmpl	%ebp, %r9d
	jl	.L10
.L22:
	movl	56(%rsp), %ebx
	cmpl	%ebx, 16(%rsp)
	jle	.L188
	movl	16(%rsp), %ebp
	jmp	.L11
.L186:
	cmpq	%rcx, %rdx
	jl	.L93
	jmp	.L94
.L18:
	movl	%r8d, 20(%rsp)
	movl	%r9d, 24(%rsp)
	cmpl	%r9d, %ebp
	jg	.L21
.L32:
	movl	20(%rsp), %ebx
	cmpl	%ebx, 12(%rsp)
	jge	.L22
	movl	%ebx, %ebp
.L10:
	movl	12(%rsp), %ebx
	movl	%ebp, %r8d
	leaq	8+a(%rip), %rdi
	movl	%ebx, %edx
	movl	%ebx, %r9d
	addl	%ebp, %edx
	movl	%edx, %eax
	shrl	$31, %eax
	addl	%edx, %eax
	sarl	%eax
	cltq
	movq	(%r15,%rax,8), %rdx
.L17:
	cmpl	%r8d, %r9d
	jge	.L18
	movslq	%r9d, %rbx
	movslq	%r8d, %r11
	leal	1(%r9), %eax
	movq	(%r15,%rbx,8), %rsi
	movq	(%r15,%r11,8), %rcx
	cltq
	cmpq	%rsi, %rdx
	jle	.L189
	.p2align 4,,10
	.p2align 3
.L14:
	movl	%eax, %r9d
	addq	$1, %rax
	movq	(%r10,%rax,8), %rsi
	cmpq	%rsi, %rdx
	jg	.L14
	cmpq	%rcx, %rdx
	jge	.L15
.L95:
	subl	$1, %r8d
	movslq	%r8d, %rax
	.p2align 4,,10
	.p2align 3
.L16:
	movl	%eax, %r8d
	subq	$1, %rax
	movq	(%rdi,%rax,8), %rcx
	cmpq	%rcx, %rdx
	jl	.L16
.L15:
	cmpl	%r9d, %r8d
	jl	.L17
	movslq	%r9d, %rbx
	movslq	%r8d, %r11
.L96:
	movq	%rcx, (%r15,%rbx,8)
	addl	$1, %r9d
	subl	$1, %r8d
	movq	%rsi, (%r15,%r11,8)
	jmp	.L17
.L189:
	cmpq	%rcx, %rdx
	jl	.L95
	jmp	.L96
.L28:
	movl	%ecx, 28(%rsp)
	movl	%r9d, 32(%rsp)
	cmpl	%r9d, %ebp
	jg	.L31
.L42:
	movl	28(%rsp), %ebx
	cmpl	%ebx, 24(%rsp)
	jge	.L32
	movl	%ebx, %ebp
.L21:
	movl	24(%rsp), %ebx
	movl	%ebp, %ecx
	leaq	8+a(%rip), %rdi
	movl	%ebx, %edx
	movl	%ebx, %r9d
	addl	%ebp, %edx
	movl	%edx, %eax
	shrl	$31, %eax
	addl	%edx, %eax
	sarl	%eax
	cltq
	movq	(%r15,%rax,8), %rdx
	.p2align 4,,10
	.p2align 3
.L27:
	cmpl	%ecx, %r9d
	jge	.L28
	movslq	%r9d, %rbx
	movslq	%ecx, %r11
	leal	1(%r9), %eax
	movq	(%r15,%rbx,8), %r8
	movq	(%r15,%r11,8), %rsi
	cltq
	cmpq	%r8, %rdx
	jle	.L190
	.p2align 4,,10
	.p2align 3
.L24:
	movl	%eax, %r9d
	addq	$1, %rax
	movq	(%r10,%rax,8), %r8
	cmpq	%r8, %rdx
	jg	.L24
	cmpq	%rsi, %rdx
	jge	.L25
.L97:
	leal	-1(%rcx), %eax
	cltq
	.p2align 4,,10
	.p2align 3
.L26:
	movl	%eax, %ecx
	subq	$1, %rax
	movq	(%rdi,%rax,8), %rsi
	cmpq	%rsi, %rdx
	jl	.L26
.L25:
	cmpl	%r9d, %ecx
	jl	.L27
	movslq	%r9d, %rbx
	movslq	%ecx, %r11
.L98:
	movq	%rsi, (%r15,%rbx,8)
	addl	$1, %r9d
	subl	$1, %ecx
	movq	%r8, (%r15,%r11,8)
	jmp	.L27
.L190:
	cmpq	%rsi, %rdx
	jl	.L97
	jmp	.L98
.L38:
	movl	%r9d, 36(%rsp)
	movl	%edx, 40(%rsp)
	cmpl	%r9d, %ebp
	jg	.L41
.L52:
	movl	40(%rsp), %ebx
	cmpl	%ebx, 32(%rsp)
	jge	.L42
	movl	%ebx, %ebp
.L31:
	movl	32(%rsp), %ebx
	leaq	8+a(%rip), %rdi
	movl	%ebx, %edx
	movl	%ebx, %r9d
	addl	%ebp, %edx
	movl	%edx, %eax
	shrl	$31, %eax
	addl	%edx, %eax
	movl	%ebp, %edx
	sarl	%eax
	cltq
	movq	(%r15,%rax,8), %rcx
	.p2align 4,,10
	.p2align 3
.L37:
	cmpl	%edx, %r9d
	jge	.L38
	movslq	%r9d, %r11
	movslq	%edx, %rbx
	leal	1(%r9), %eax
	movq	(%r15,%r11,8), %rsi
	movq	(%r15,%rbx,8), %r8
	cltq
	cmpq	%rcx, %rsi
	jge	.L191
	.p2align 4,,10
	.p2align 3
.L34:
	movl	%eax, %r9d
	addq	$1, %rax
	movq	(%r10,%rax,8), %rsi
	cmpq	%rsi, %rcx
	jg	.L34
	cmpq	%r8, %rcx
	jge	.L35
.L99:
	leal	-1(%rdx), %eax
	cltq
	.p2align 4,,10
	.p2align 3
.L36:
	movl	%eax, %edx
	subq	$1, %rax
	movq	(%rdi,%rax,8), %r8
	cmpq	%r8, %rcx
	jl	.L36
.L35:
	cmpl	%r9d, %edx
	jl	.L37
	movslq	%r9d, %r11
	movslq	%edx, %rbx
.L100:
	movq	%r8, (%r15,%r11,8)
	addl	$1, %r9d
	subl	$1, %edx
	movq	%rsi, (%r15,%rbx,8)
	jmp	.L37
.L191:
	cmpq	%r8, %rcx
	jl	.L99
	jmp	.L100
.L48:
	movl	%ecx, 44(%rsp)
	movl	%r9d, 48(%rsp)
	cmpl	%r9d, %ebp
	jg	.L51
.L62:
	movl	44(%rsp), %ebx
	cmpl	%ebx, 36(%rsp)
	jge	.L52
	movl	%ebx, %ebp
.L41:
	movl	36(%rsp), %ebx
	movl	%ebp, %ecx
	leaq	8+a(%rip), %rdi
	movl	%ebx, %edx
	movl	%ebx, %r9d
	addl	%ebp, %edx
	movl	%edx, %eax
	shrl	$31, %eax
	addl	%edx, %eax
	sarl	%eax
	cltq
	movq	(%r15,%rax,8), %rdx
	.p2align 4,,10
	.p2align 3
.L47:
	cmpl	%ecx, %r9d
	jge	.L48
	movslq	%r9d, %rbx
	movslq	%ecx, %r11
	leal	1(%r9), %eax
	movq	(%r15,%rbx,8), %r8
	movq	(%r15,%r11,8), %rsi
	cltq
	cmpq	%rdx, %r8
	jge	.L192
	.p2align 4,,10
	.p2align 3
.L44:
	movl	%eax, %r9d
	addq	$1, %rax
	movq	(%r10,%rax,8), %r8
	cmpq	%r8, %rdx
	jg	.L44
	cmpq	%rsi, %rdx
	jge	.L45
.L101:
	leal	-1(%rcx), %eax
	cltq
	.p2align 4,,10
	.p2align 3
.L46:
	movl	%eax, %ecx
	subq	$1, %rax
	movq	(%rdi,%rax,8), %rsi
	cmpq	%rsi, %rdx
	jl	.L46
.L45:
	cmpl	%r9d, %ecx
	jl	.L47
	movslq	%r9d, %rbx
	movslq	%ecx, %r11
.L102:
	movq	%rsi, (%r15,%rbx,8)
	addl	$1, %r9d
	subl	$1, %ecx
	movq	%r8, (%r15,%r11,8)
	jmp	.L47
.L192:
	cmpq	%rsi, %rdx
	jl	.L101
	jmp	.L102
.L58:
	movl	%ecx, 52(%rsp)
	cmpl	%r11d, %ebp
	jg	.L179
.L72:
	movl	52(%rsp), %ebx
	cmpl	%ebx, 48(%rsp)
	jge	.L62
	movl	%ebx, %ebp
.L51:
	movl	48(%rsp), %r11d
	leaq	8+a(%rip), %rdi
	movl	%ebp, %ecx
	movl	%r11d, %edx
	addl	%ebp, %edx
	movl	%edx, %eax
	shrl	$31, %eax
	addl	%edx, %eax
	sarl	%eax
	cltq
	movq	(%r15,%rax,8), %rdx
	.p2align 4,,10
	.p2align 3
.L57:
	cmpl	%ecx, %r11d
	jge	.L58
	movslq	%r11d, %r9
	movslq	%ecx, %rbx
	leal	1(%r11), %eax
	movq	(%r15,%r9,8), %r8
	movq	(%r15,%rbx,8), %rsi
	cltq
	cmpq	%rdx, %r8
	jge	.L193
	.p2align 4,,10
	.p2align 3
.L54:
	movl	%eax, %r11d
	addq	$1, %rax
	movq	(%r10,%rax,8), %r8
	cmpq	%r8, %rdx
	jg	.L54
	cmpq	%rsi, %rdx
	jge	.L55
.L103:
	leal	-1(%rcx), %eax
	cltq
	.p2align 4,,10
	.p2align 3
.L56:
	movl	%eax, %ecx
	subq	$1, %rax
	movq	(%rdi,%rax,8), %rsi
	cmpq	%rsi, %rdx
	jl	.L56
.L55:
	cmpl	%r11d, %ecx
	jl	.L57
	movslq	%r11d, %r9
	movslq	%ecx, %rbx
.L104:
	movq	%rsi, (%r15,%r9,8)
	addl	$1, %r11d
	subl	$1, %ecx
	movq	%r8, (%r15,%rbx,8)
	jmp	.L57
.L193:
	cmpq	%rsi, %rdx
	jl	.L103
	jmp	.L104
.L179:
	movl	%r11d, 8(%rsp)
.L61:
	movl	8(%rsp), %r8d
	movl	%ebp, %r12d
	leaq	8+a(%rip), %rdi
	movl	%r8d, %edx
	addl	%ebp, %edx
	movl	%edx, %eax
	shrl	$31, %eax
	addl	%edx, %eax
	sarl	%eax
	cltq
	movq	(%r15,%rax,8), %rdx
	.p2align 4,,10
	.p2align 3
.L67:
	cmpl	%r12d, %r8d
	jge	.L68
.L195:
	movslq	%r8d, %r9
	movslq	%r12d, %r11
	leal	1(%r8), %eax
	movq	(%r15,%r9,8), %rsi
	movq	(%r15,%r11,8), %rcx
	cltq
	cmpq	%rsi, %rdx
	jle	.L194
	.p2align 4,,10
	.p2align 3
.L64:
	movl	%eax, %r8d
	addq	$1, %rax
	movq	(%r10,%rax,8), %rsi
	cmpq	%rsi, %rdx
	jg	.L64
	cmpq	%rcx, %rdx
	jge	.L65
.L105:
	leal	-1(%r12), %eax
	cltq
	.p2align 4,,10
	.p2align 3
.L66:
	movl	%eax, %r12d
	subq	$1, %rax
	movq	(%rdi,%rax,8), %rcx
	cmpq	%rcx, %rdx
	jl	.L66
.L65:
	cmpl	%r8d, %r12d
	jl	.L67
	movslq	%r8d, %r9
	movslq	%r12d, %r11
.L106:
	addl	$1, %r8d
	subl	$1, %r12d
	movq	%rcx, (%r15,%r9,8)
	movq	%rsi, (%r15,%r11,8)
	cmpl	%r12d, %r8d
	jl	.L195
.L68:
	cmpl	%r8d, %ebp
	jg	.L196
.L82:
	cmpl	%r12d, 8(%rsp)
	jge	.L72
	movl	%r12d, %ebp
	jmp	.L61
.L194:
	cmpq	%rcx, %rdx
	jl	.L105
	jmp	.L106
.L196:
	movl	%r12d, 60(%rsp)
	leaq	8+a(%rip), %r13
	movl	%r8d, %r14d
	movl	%ebp, %r11d
.L71:
	leal	(%r14,%r11), %edx
	movl	%r11d, %ebp
	movl	%r14d, %r12d
	movl	%edx, %eax
	shrl	$31, %eax
	addl	%edx, %eax
	sarl	%eax
	cltq
	movq	(%r15,%rax,8), %rdx
	.p2align 4,,10
	.p2align 3
.L77:
	cmpl	%ebp, %r12d
	jge	.L78
.L198:
	movslq	%r12d, %r8
	movslq	%ebp, %rdi
	leal	1(%r12), %eax
	movq	(%r15,%r8,8), %rsi
	movq	(%r15,%rdi,8), %rcx
	cltq
	cmpq	%rdx, %rsi
	jge	.L197
	.p2align 4,,10
	.p2align 3
.L74:
	movl	%eax, %r12d
	addq	$1, %rax
	movq	(%r10,%rax,8), %rsi
	cmpq	%rsi, %rdx
	jg	.L74
	cmpq	%rcx, %rdx
	jge	.L75
.L107:
	leal	-1(%rbp), %eax
	cltq
	.p2align 4,,10
	.p2align 3
.L76:
	movl	%eax, %ebp
	subq	$1, %rax
	movq	0(%r13,%rax,8), %rcx
	cmpq	%rcx, %rdx
	jl	.L76
.L75:
	cmpl	%r12d, %ebp
	jl	.L77
	movslq	%r12d, %r8
	movslq	%ebp, %rdi
.L108:
	addl	$1, %r12d
	subl	$1, %ebp
	movq	%rcx, (%r15,%r8,8)
	movq	%rsi, (%r15,%rdi,8)
	cmpl	%ebp, %r12d
	jl	.L198
.L78:
	cmpl	%r12d, %r11d
	jg	.L81
.L92:
	cmpl	%ebp, %r14d
	jge	.L199
	movl	%ebp, %r11d
	jmp	.L71
.L197:
	cmpq	%rcx, %rdx
	jl	.L107
	jmp	.L108
.L88:
	cmpl	%edi, %r11d
	jg	.L200
.L91:
	cmpl	%ebx, %r12d
	jge	.L92
	movl	%ebx, %r11d
.L81:
	leal	(%r12,%r11), %edx
	movl	%r11d, %ebx
	movl	%r12d, %edi
	movl	%edx, %eax
	shrl	$31, %eax
	addl	%edx, %eax
	sarl	%eax
	cltq
	movq	(%r15,%rax,8), %rcx
	.p2align 4,,10
	.p2align 3
.L87:
	cmpl	%ebx, %edi
	jge	.L88
	movslq	%edi, %r9
	movslq	%ebx, %r8
	leal	1(%rdi), %eax
	movq	(%r15,%r9,8), %rdx
	movq	(%r15,%r8,8), %rsi
	cltq
	cmpq	%rdx, %rcx
	jle	.L201
	.p2align 4,,10
	.p2align 3
.L84:
	movl	%eax, %edi
	addq	$1, %rax
	movq	(%r10,%rax,8), %rdx
	cmpq	%rdx, %rcx
	jg	.L84
	cmpq	%rsi, %rcx
	jge	.L85
.L109:
	subl	$1, %ebx
	movslq	%ebx, %rax
	.p2align 4,,10
	.p2align 3
.L86:
	movl	%eax, %ebx
	subq	$1, %rax
	movq	0(%r13,%rax,8), %rsi
	cmpq	%rsi, %rcx
	jl	.L86
.L85:
	cmpl	%edi, %ebx
	jl	.L87
	movslq	%edi, %r9
	movslq	%ebx, %r8
.L110:
	movq	%rsi, (%r15,%r9,8)
	addl	$1, %edi
	subl	$1, %ebx
	movq	%rdx, (%r15,%r8,8)
	jmp	.L87
	.p2align 4,,10
	.p2align 3
.L201:
	cmpq	%rsi, %rcx
	jl	.L109
	jmp	.L110
.L199:
	movl	60(%rsp), %r12d
	jmp	.L82
.L188:
	addq	$72, %rsp
	.cfi_remember_state
	.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
.L200:
	.cfi_restore_state
	movl	%r11d, %esi
	call	sort
	leaq	-8+a(%rip), %r10
	jmp	.L91
	.cfi_endproc
.LFE24:
	.size	sort, .-sort
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%li"
.LC2:
	.string	"%lli"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	n(%rip), %rsi
	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
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$8, %rsp
	.cfi_def_cfa_offset 64
	call	__isoc99_scanf@PLT
	movl	n(%rip), %esi
	testl	%esi, %esi
	jle	.L203
	leaq	8+a(%rip), %r14
	movl	$1, %ebp
	leaq	.LC1(%rip), %r15
	movq	%r14, %r13
	movq	%r14, %rbx
	.p2align 4,,10
	.p2align 3
.L204:
	movq	%rbx, %rsi
	movq	%r15, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	n(%rip), %r12d
	subq	%rbp, (%rbx)
	addq	$1, %rbp
	addq	$8, %rbx
	cmpl	%ebp, %r12d
	jge	.L204
	movl	%r12d, %esi
	movl	$1, %edi
	xorl	%eax, %eax
	call	sort
	movq	8+a(%rip), %rsi
	movq	%rsi, a(%rip)
	testl	%r12d, %r12d
	jle	.L224
	cmpl	$1, %r12d
	je	.L215
	movl	%r12d, %eax
	movq	%rsi, %xmm2
	leaq	24+a(%rip), %rdx
	shrl	%eax
	punpcklqdq	%xmm2, %xmm2
	pxor	%xmm1, %xmm1
	subl	$1, %eax
	salq	$4, %rax
	addq	%rdx, %rax
	.p2align 4,,10
	.p2align 3
.L207:
	movdqu	(%r14), %xmm0
	addq	$16, %r14
	psubq	%xmm2, %xmm0
	movups	%xmm0, -16(%r14)
	paddq	%xmm0, %xmm1
	cmpq	%rax, %r14
	jne	.L207
	movdqa	%xmm1, %xmm0
	movl	%r12d, %ecx
	psrldq	$8, %xmm0
	orl	$1, %ecx
	paddq	%xmm0, %xmm1
	movq	%xmm1, %rdx
	testb	$1, %r12b
	je	.L210
.L206:
	leaq	a(%rip), %r8
	movslq	%ecx, %rcx
	movq	(%r8,%rcx,8), %rax
	subq	%rsi, %rax
	movq	%rax, (%r8,%rcx,8)
	addq	%rax, %rdx
.L210:
	cmpl	$1, %r12d
	jle	.L205
	cmpl	$3, %r12d
	jle	.L216
	leal	-4(%r12), %eax
	movslq	%r12d, %r11
	movq	%rdx, %rsi
	movl	$2, %ecx
	shrl	%eax
	movq	8+a(%rip), %r9
	leaq	a(%rip), %r8
	leaq	1(%r11), %rbx
	leal	2(%rax), %edi
	addq	%rdi, %rdi
.L212:
	movq	(%r8,%rcx,8), %r10
	movq	%rbx, %rax
	subq	%rcx, %rax
	movq	%r10, %rbp
	subq	%r9, %rbp
	movq	0(%r13,%rcx,8), %r9
	imulq	%rbp, %rax
	subq	%rax, %rdx
	leaq	-1(%rcx), %rax
	imulq	%rbp, %rax
	addq	%rdx, %rax
	movq	%r9, %rdx
	subq	%r10, %rdx
	movq	%r11, %r10
	movq	%rax, %rbp
	subq	%rcx, %r10
	imulq	%rdx, %r10
	imulq	%rcx, %rdx
	subq	%r10, %rbp
	addq	%rbp, %rdx
	cmpq	%rdx, %rax
	cmovg	%rdx, %rax
	cmpq	%rax, %rsi
	cmovg	%rax, %rsi
	leal	2(%rcx), %eax
	addq	$2, %rcx
	cmpq	%rdi, %rcx
	jne	.L212
.L211:
	leal	1(%r12), %r9d
	movq	%rdx, %rcx
	cltq
	movq	%rsi, %rdx
	leaq	-8+a(%rip), %r10
	movslq	%r9d, %r9
	.p2align 4,,10
	.p2align 3
.L213:
	movq	%r9, %rdi
	movq	(%r8,%rax,8), %rsi
	subq	(%r10,%rax,8), %rsi
	subq	%rax, %rdi
	imulq	%rsi, %rdi
	subq	%rdi, %rcx
	leaq	-1(%rax), %rdi
	imulq	%rdi, %rsi
	addq	%rsi, %rcx
	cmpq	%rcx, %rdx
	cmovg	%rcx, %rdx
	addq	$1, %rax
	cmpl	%eax, %r12d
	jge	.L213
.L205:
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	addq	$8, %rsp
	.cfi_remember_state
	.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
.L203:
	.cfi_restore_state
	movl	$1, %edi
	xorl	%eax, %eax
	call	sort
	movq	8+a(%rip), %rax
	movq	%rax, a(%rip)
.L224:
	xorl	%edx, %edx
	jmp	.L205
.L215:
	movl	$1, %ecx
	xorl	%edx, %edx
	jmp	.L206
.L216:
	movq	%rdx, %rsi
	movl	$2, %eax
	leaq	a(%rip), %r8
	jmp	.L211
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 4000000
a:
	.zero	4000000
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.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	sort
	.type	sort, @function
sort:
.LFB24:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	a(%rip), %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	leaq	-8(%r15), %r10
	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
	movl	%esi, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movl	%edi, %ebx
	subq	$72, %rsp
	.cfi_def_cfa_offset 128
	movl	%edi, 56(%rsp)
.L11:
	movl	%ebx, %edx
	movl	%ebp, %r8d
	leaq	8+a(%rip), %rdi
	movl	%ebx, %r9d
	addl	%ebp, %edx
	movl	%edx, %eax
	shrl	$31, %eax
	addl	%edx, %eax
	sarl	%eax
	cltq
	movq	(%r15,%rax,8), %rdx
.L6:
	cmpl	%r8d, %r9d
	jge	.L7
.L187:
	movslq	%r9d, %r11
	movslq	%r8d, %rbx
	leal	1(%r9), %eax
	movq	(%r15,%r11,8), %rsi
	movq	(%r15,%rbx,8), %rcx
	cltq
	cmpq	%rsi, %rdx
	jle	.L186
	.p2align 4,,10
	.p2align 3
.L3:
	movl	%eax, %r9d
	addq	$1, %rax
	movq	(%r10,%rax,8), %rsi
	cmpq	%rdx, %rsi
	jl	.L3
	cmpq	%rcx, %rdx
	jge	.L4
.L93:
	subl	$1, %r8d
	movslq	%r8d, %rax
	.p2align 4,,10
	.p2align 3
.L5:
	movl	%eax, %r8d
	subq	$1, %rax
	movq	(%rdi,%rax,8), %rcx
	cmpq	%rdx, %rcx
	jg	.L5
.L4:
	cmpl	%r9d, %r8d
	jl	.L6
	movslq	%r9d, %r11
	movslq	%r8d, %rbx
.L94:
	addl	$1, %r9d
	subl	$1, %r8d
	movq	%rcx, (%r15,%r11,8)
	movq	%rsi, (%r15,%rbx,8)
	cmpl	%r8d, %r9d
	jl	.L187
.L7:
	movl	%r9d, 12(%rsp)
	movl	%r8d, 16(%rsp)
	cmpl	%ebp, %r9d
	jl	.L10
.L22:
	movl	56(%rsp), %ebx
	cmpl	%ebx, 16(%rsp)
	jle	.L188
	movl	16(%rsp), %ebp
	jmp	.L11
.L186:
	cmpq	%rcx, %rdx
	jl	.L93
	jmp	.L94
.L18:
	movl	%r8d, 20(%rsp)
	movl	%r9d, 24(%rsp)
	cmpl	%r9d, %ebp
	jg	.L21
.L32:
	movl	20(%rsp), %ebx
	cmpl	%ebx, 12(%rsp)
	jge	.L22
	movl	%ebx, %ebp
.L10:
	movl	12(%rsp), %ebx
	movl	%ebp, %r8d
	leaq	8+a(%rip), %rdi
	movl	%ebx, %edx
	movl	%ebx, %r9d
	addl	%ebp, %edx
	movl	%edx, %eax
	shrl	$31, %eax
	addl	%edx, %eax
	sarl	%eax
	cltq
	movq	(%r15,%rax,8), %rdx
.L17:
	cmpl	%r8d, %r9d
	jge	.L18
	movslq	%r9d, %rbx
	movslq	%r8d, %r11
	leal	1(%r9), %eax
	movq	(%r15,%rbx,8), %rsi
	movq	(%r15,%r11,8), %rcx
	cltq
	cmpq	%rsi, %rdx
	jle	.L189
	.p2align 4,,10
	.p2align 3
.L14:
	movl	%eax, %r9d
	addq	$1, %rax
	movq	(%r10,%rax,8), %rsi
	cmpq	%rsi, %rdx
	jg	.L14
	cmpq	%rcx, %rdx
	jge	.L15
.L95:
	subl	$1, %r8d
	movslq	%r8d, %rax
	.p2align 4,,10
	.p2align 3
.L16:
	movl	%eax, %r8d
	subq	$1, %rax
	movq	(%rdi,%rax,8), %rcx
	cmpq	%rcx, %rdx
	jl	.L16
.L15:
	cmpl	%r9d, %r8d
	jl	.L17
	movslq	%r9d, %rbx
	movslq	%r8d, %r11
.L96:
	movq	%rcx, (%r15,%rbx,8)
	addl	$1, %r9d
	subl	$1, %r8d
	movq	%rsi, (%r15,%r11,8)
	jmp	.L17
.L189:
	cmpq	%rcx, %rdx
	jl	.L95
	jmp	.L96
.L28:
	movl	%ecx, 28(%rsp)
	movl	%r9d, 32(%rsp)
	cmpl	%r9d, %ebp
	jg	.L31
.L42:
	movl	28(%rsp), %ebx
	cmpl	%ebx, 24(%rsp)
	jge	.L32
	movl	%ebx, %ebp
.L21:
	movl	24(%rsp), %ebx
	movl	%ebp, %ecx
	leaq	8+a(%rip), %rdi
	movl	%ebx, %edx
	movl	%ebx, %r9d
	addl	%ebp, %edx
	movl	%edx, %eax
	shrl	$31, %eax
	addl	%edx, %eax
	sarl	%eax
	cltq
	movq	(%r15,%rax,8), %rdx
	.p2align 4,,10
	.p2align 3
.L27:
	cmpl	%ecx, %r9d
	jge	.L28
	movslq	%r9d, %rbx
	movslq	%ecx, %r11
	leal	1(%r9), %eax
	movq	(%r15,%rbx,8), %r8
	movq	(%r15,%r11,8), %rsi
	cltq
	cmpq	%r8, %rdx
	jle	.L190
	.p2align 4,,10
	.p2align 3
.L24:
	movl	%eax, %r9d
	addq	$1, %rax
	movq	(%r10,%rax,8), %r8
	cmpq	%r8, %rdx
	jg	.L24
	cmpq	%rsi, %rdx
	jge	.L25
.L97:
	leal	-1(%rcx), %eax
	cltq
	.p2align 4,,10
	.p2align 3
.L26:
	movl	%eax, %ecx
	subq	$1, %rax
	movq	(%rdi,%rax,8), %rsi
	cmpq	%rsi, %rdx
	jl	.L26
.L25:
	cmpl	%r9d, %ecx
	jl	.L27
	movslq	%r9d, %rbx
	movslq	%ecx, %r11
.L98:
	movq	%rsi, (%r15,%rbx,8)
	addl	$1, %r9d
	subl	$1, %ecx
	movq	%r8, (%r15,%r11,8)
	jmp	.L27
.L190:
	cmpq	%rsi, %rdx
	jl	.L97
	jmp	.L98
.L38:
	movl	%r9d, 36(%rsp)
	movl	%edx, 40(%rsp)
	cmpl	%r9d, %ebp
	jg	.L41
.L52:
	movl	40(%rsp), %ebx
	cmpl	%ebx, 32(%rsp)
	jge	.L42
	movl	%ebx, %ebp
.L31:
	movl	32(%rsp), %ebx
	leaq	8+a(%rip), %rdi
	movl	%ebx, %edx
	movl	%ebx, %r9d
	addl	%ebp, %edx
	movl	%edx, %eax
	shrl	$31, %eax
	addl	%edx, %eax
	movl	%ebp, %edx
	sarl	%eax
	cltq
	movq	(%r15,%rax,8), %rcx
	.p2align 4,,10
	.p2align 3
.L37:
	cmpl	%edx, %r9d
	jge	.L38
	movslq	%r9d, %r11
	movslq	%edx, %rbx
	leal	1(%r9), %eax
	movq	(%r15,%r11,8), %rsi
	movq	(%r15,%rbx,8), %r8
	cltq
	cmpq	%rcx, %rsi
	jge	.L191
	.p2align 4,,10
	.p2align 3
.L34:
	movl	%eax, %r9d
	addq	$1, %rax
	movq	(%r10,%rax,8), %rsi
	cmpq	%rsi, %rcx
	jg	.L34
	cmpq	%r8, %rcx
	jge	.L35
.L99:
	leal	-1(%rdx), %eax
	cltq
	.p2align 4,,10
	.p2align 3
.L36:
	movl	%eax, %edx
	subq	$1, %rax
	movq	(%rdi,%rax,8), %r8
	cmpq	%r8, %rcx
	jl	.L36
.L35:
	cmpl	%r9d, %edx
	jl	.L37
	movslq	%r9d, %r11
	movslq	%edx, %rbx
.L100:
	movq	%r8, (%r15,%r11,8)
	addl	$1, %r9d
	subl	$1, %edx
	movq	%rsi, (%r15,%rbx,8)
	jmp	.L37
.L191:
	cmpq	%r8, %rcx
	jl	.L99
	jmp	.L100
.L48:
	movl	%ecx, 44(%rsp)
	movl	%r9d, 48(%rsp)
	cmpl	%r9d, %ebp
	jg	.L51
.L62:
	movl	44(%rsp), %ebx
	cmpl	%ebx, 36(%rsp)
	jge	.L52
	movl	%ebx, %ebp
.L41:
	movl	36(%rsp), %ebx
	movl	%ebp, %ecx
	leaq	8+a(%rip), %rdi
	movl	%ebx, %edx
	movl	%ebx, %r9d
	addl	%ebp, %edx
	movl	%edx, %eax
	shrl	$31, %eax
	addl	%edx, %eax
	sarl	%eax
	cltq
	movq	(%r15,%rax,8), %rdx
	.p2align 4,,10
	.p2align 3
.L47:
	cmpl	%ecx, %r9d
	jge	.L48
	movslq	%r9d, %rbx
	movslq	%ecx, %r11
	leal	1(%r9), %eax
	movq	(%r15,%rbx,8), %r8
	movq	(%r15,%r11,8), %rsi
	cltq
	cmpq	%rdx, %r8
	jge	.L192
	.p2align 4,,10
	.p2align 3
.L44:
	movl	%eax, %r9d
	addq	$1, %rax
	movq	(%r10,%rax,8), %r8
	cmpq	%r8, %rdx
	jg	.L44
	cmpq	%rsi, %rdx
	jge	.L45
.L101:
	leal	-1(%rcx), %eax
	cltq
	.p2align 4,,10
	.p2align 3
.L46:
	movl	%eax, %ecx
	subq	$1, %rax
	movq	(%rdi,%rax,8), %rsi
	cmpq	%rsi, %rdx
	jl	.L46
.L45:
	cmpl	%r9d, %ecx
	jl	.L47
	movslq	%r9d, %rbx
	movslq	%ecx, %r11
.L102:
	movq	%rsi, (%r15,%rbx,8)
	addl	$1, %r9d
	subl	$1, %ecx
	movq	%r8, (%r15,%r11,8)
	jmp	.L47
.L192:
	cmpq	%rsi, %rdx
	jl	.L101
	jmp	.L102
.L58:
	movl	%ecx, 52(%rsp)
	cmpl	%r11d, %ebp
	jg	.L179
.L72:
	movl	52(%rsp), %ebx
	cmpl	%ebx, 48(%rsp)
	jge	.L62
	movl	%ebx, %ebp
.L51:
	movl	48(%rsp), %r11d
	leaq	8+a(%rip), %rdi
	movl	%ebp, %ecx
	movl	%r11d, %edx
	addl	%ebp, %edx
	movl	%edx, %eax
	shrl	$31, %eax
	addl	%edx, %eax
	sarl	%eax
	cltq
	movq	(%r15,%rax,8), %rdx
	.p2align 4,,10
	.p2align 3
.L57:
	cmpl	%ecx, %r11d
	jge	.L58
	movslq	%r11d, %r9
	movslq	%ecx, %rbx
	leal	1(%r11), %eax
	movq	(%r15,%r9,8), %r8
	movq	(%r15,%rbx,8), %rsi
	cltq
	cmpq	%rdx, %r8
	jge	.L193
	.p2align 4,,10
	.p2align 3
.L54:
	movl	%eax, %r11d
	addq	$1, %rax
	movq	(%r10,%rax,8), %r8
	cmpq	%r8, %rdx
	jg	.L54
	cmpq	%rsi, %rdx
	jge	.L55
.L103:
	leal	-1(%rcx), %eax
	cltq
	.p2align 4,,10
	.p2align 3
.L56:
	movl	%eax, %ecx
	subq	$1, %rax
	movq	(%rdi,%rax,8), %rsi
	cmpq	%rsi, %rdx
	jl	.L56
.L55:
	cmpl	%r11d, %ecx
	jl	.L57
	movslq	%r11d, %r9
	movslq	%ecx, %rbx
.L104:
	movq	%rsi, (%r15,%r9,8)
	addl	$1, %r11d
	subl	$1, %ecx
	movq	%r8, (%r15,%rbx,8)
	jmp	.L57
.L193:
	cmpq	%rsi, %rdx
	jl	.L103
	jmp	.L104
.L179:
	movl	%r11d, 8(%rsp)
.L61:
	movl	8(%rsp), %r8d
	movl	%ebp, %r12d
	leaq	8+a(%rip), %rdi
	movl	%r8d, %edx
	addl	%ebp, %edx
	movl	%edx, %eax
	shrl	$31, %eax
	addl	%edx, %eax
	sarl	%eax
	cltq
	movq	(%r15,%rax,8), %rdx
	.p2align 4,,10
	.p2align 3
.L67:
	cmpl	%r12d, %r8d
	jge	.L68
.L195:
	movslq	%r8d, %r9
	movslq	%r12d, %r11
	leal	1(%r8), %eax
	movq	(%r15,%r9,8), %rsi
	movq	(%r15,%r11,8), %rcx
	cltq
	cmpq	%rsi, %rdx
	jle	.L194
	.p2align 4,,10
	.p2align 3
.L64:
	movl	%eax, %r8d
	addq	$1, %rax
	movq	(%r10,%rax,8), %rsi
	cmpq	%rsi, %rdx
	jg	.L64
	cmpq	%rcx, %rdx
	jge	.L65
.L105:
	leal	-1(%r12), %eax
	cltq
	.p2align 4,,10
	.p2align 3
.L66:
	movl	%eax, %r12d
	subq	$1, %rax
	movq	(%rdi,%rax,8), %rcx
	cmpq	%rcx, %rdx
	jl	.L66
.L65:
	cmpl	%r8d, %r12d
	jl	.L67
	movslq	%r8d, %r9
	movslq	%r12d, %r11
.L106:
	addl	$1, %r8d
	subl	$1, %r12d
	movq	%rcx, (%r15,%r9,8)
	movq	%rsi, (%r15,%r11,8)
	cmpl	%r12d, %r8d
	jl	.L195
.L68:
	cmpl	%r8d, %ebp
	jg	.L196
.L82:
	cmpl	%r12d, 8(%rsp)
	jge	.L72
	movl	%r12d, %ebp
	jmp	.L61
.L194:
	cmpq	%rcx, %rdx
	jl	.L105
	jmp	.L106
.L196:
	movl	%r12d, 60(%rsp)
	leaq	8+a(%rip), %r13
	movl	%r8d, %r14d
	movl	%ebp, %r11d
.L71:
	leal	(%r14,%r11), %edx
	movl	%r11d, %ebp
	movl	%r14d, %r12d
	movl	%edx, %eax
	shrl	$31, %eax
	addl	%edx, %eax
	sarl	%eax
	cltq
	movq	(%r15,%rax,8), %rdx
	.p2align 4,,10
	.p2align 3
.L77:
	cmpl	%ebp, %r12d
	jge	.L78
.L198:
	movslq	%r12d, %r8
	movslq	%ebp, %rdi
	leal	1(%r12), %eax
	movq	(%r15,%r8,8), %rsi
	movq	(%r15,%rdi,8), %rcx
	cltq
	cmpq	%rdx, %rsi
	jge	.L197
	.p2align 4,,10
	.p2align 3
.L74:
	movl	%eax, %r12d
	addq	$1, %rax
	movq	(%r10,%rax,8), %rsi
	cmpq	%rsi, %rdx
	jg	.L74
	cmpq	%rcx, %rdx
	jge	.L75
.L107:
	leal	-1(%rbp), %eax
	cltq
	.p2align 4,,10
	.p2align 3
.L76:
	movl	%eax, %ebp
	subq	$1, %rax
	movq	0(%r13,%rax,8), %rcx
	cmpq	%rcx, %rdx
	jl	.L76
.L75:
	cmpl	%r12d, %ebp
	jl	.L77
	movslq	%r12d, %r8
	movslq	%ebp, %rdi
.L108:
	addl	$1, %r12d
	subl	$1, %ebp
	movq	%rcx, (%r15,%r8,8)
	movq	%rsi, (%r15,%rdi,8)
	cmpl	%ebp, %r12d
	jl	.L198
.L78:
	cmpl	%r12d, %r11d
	jg	.L81
.L92:
	cmpl	%ebp, %r14d
	jge	.L199
	movl	%ebp, %r11d
	jmp	.L71
.L197:
	cmpq	%rcx, %rdx
	jl	.L107
	jmp	.L108
.L88:
	cmpl	%edi, %r11d
	jg	.L200
.L91:
	cmpl	%ebx, %r12d
	jge	.L92
	movl	%ebx, %r11d
.L81:
	leal	(%r12,%r11), %edx
	movl	%r11d, %ebx
	movl	%r12d, %edi
	movl	%edx, %eax
	shrl	$31, %eax
	addl	%edx, %eax
	sarl	%eax
	cltq
	movq	(%r15,%rax,8), %rcx
	.p2align 4,,10
	.p2align 3
.L87:
	cmpl	%ebx, %edi
	jge	.L88
	movslq	%edi, %r9
	movslq	%ebx, %r8
	leal	1(%rdi), %eax
	movq	(%r15,%r9,8), %rdx
	movq	(%r15,%r8,8), %rsi
	cltq
	cmpq	%rdx, %rcx
	jle	.L201
	.p2align 4,,10
	.p2align 3
.L84:
	movl	%eax, %edi
	addq	$1, %rax
	movq	(%r10,%rax,8), %rdx
	cmpq	%rdx, %rcx
	jg	.L84
	cmpq	%rsi, %rcx
	jge	.L85
.L109:
	subl	$1, %ebx
	movslq	%ebx, %rax
	.p2align 4,,10
	.p2align 3
.L86:
	movl	%eax, %ebx
	subq	$1, %rax
	movq	0(%r13,%rax,8), %rsi
	cmpq	%rsi, %rcx
	jl	.L86
.L85:
	cmpl	%edi, %ebx
	jl	.L87
	movslq	%edi, %r9
	movslq	%ebx, %r8
.L110:
	movq	%rsi, (%r15,%r9,8)
	addl	$1, %edi
	subl	$1, %ebx
	movq	%rdx, (%r15,%r8,8)
	jmp	.L87
	.p2align 4,,10
	.p2align 3
.L201:
	cmpq	%rsi, %rcx
	jl	.L109
	jmp	.L110
.L199:
	movl	60(%rsp), %r12d
	jmp	.L82
.L188:
	addq	$72, %rsp
	.cfi_remember_state
	.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
.L200:
	.cfi_restore_state
	movl	%r11d, %esi
	call	sort
	leaq	-8+a(%rip), %r10
	jmp	.L91
	.cfi_endproc
.LFE24:
	.size	sort, .-sort
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%li"
.LC2:
	.string	"%lli"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	n(%rip), %rsi
	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
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$8, %rsp
	.cfi_def_cfa_offset 64
	call	__isoc99_scanf@PLT
	movl	n(%rip), %esi
	testl	%esi, %esi
	jle	.L203
	leaq	8+a(%rip), %r14
	movl	$1, %ebp
	leaq	.LC1(%rip), %r15
	movq	%r14, %r13
	movq	%r14, %rbx
	.p2align 4,,10
	.p2align 3
.L204:
	movq	%rbx, %rsi
	movq	%r15, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	n(%rip), %r12d
	subq	%rbp, (%rbx)
	addq	$1, %rbp
	addq	$8, %rbx
	cmpl	%ebp, %r12d
	jge	.L204
	movl	%r12d, %esi
	movl	$1, %edi
	xorl	%eax, %eax
	call	sort
	movq	8+a(%rip), %rsi
	movq	%rsi, a(%rip)
	testl	%r12d, %r12d
	jle	.L224
	cmpl	$1, %r12d
	je	.L215
	movl	%r12d, %eax
	movq	%rsi, %xmm2
	leaq	24+a(%rip), %rdx
	shrl	%eax
	punpcklqdq	%xmm2, %xmm2
	pxor	%xmm1, %xmm1
	subl	$1, %eax
	salq	$4, %rax
	addq	%rdx, %rax
	.p2align 4,,10
	.p2align 3
.L207:
	movdqu	(%r14), %xmm0
	addq	$16, %r14
	psubq	%xmm2, %xmm0
	movups	%xmm0, -16(%r14)
	paddq	%xmm0, %xmm1
	cmpq	%rax, %r14
	jne	.L207
	movdqa	%xmm1, %xmm0
	movl	%r12d, %ecx
	psrldq	$8, %xmm0
	orl	$1, %ecx
	paddq	%xmm0, %xmm1
	movq	%xmm1, %rdx
	testb	$1, %r12b
	je	.L210
.L206:
	leaq	a(%rip), %r8
	movslq	%ecx, %rcx
	movq	(%r8,%rcx,8), %rax
	subq	%rsi, %rax
	movq	%rax, (%r8,%rcx,8)
	addq	%rax, %rdx
.L210:
	cmpl	$1, %r12d
	jle	.L205
	cmpl	$3, %r12d
	jle	.L216
	leal	-4(%r12), %eax
	movslq	%r12d, %r11
	movq	%rdx, %rsi
	movl	$2, %ecx
	shrl	%eax
	movq	8+a(%rip), %r9
	leaq	a(%rip), %r8
	leaq	1(%r11), %rbx
	leal	2(%rax), %edi
	addq	%rdi, %rdi
.L212:
	movq	(%r8,%rcx,8), %r10
	movq	%rbx, %rax
	subq	%rcx, %rax
	movq	%r10, %rbp
	subq	%r9, %rbp
	movq	0(%r13,%rcx,8), %r9
	imulq	%rbp, %rax
	subq	%rax, %rdx
	leaq	-1(%rcx), %rax
	imulq	%rbp, %rax
	addq	%rdx, %rax
	movq	%r9, %rdx
	subq	%r10, %rdx
	movq	%r11, %r10
	movq	%rax, %rbp
	subq	%rcx, %r10
	imulq	%rdx, %r10
	imulq	%rcx, %rdx
	subq	%r10, %rbp
	addq	%rbp, %rdx
	cmpq	%rdx, %rax
	cmovg	%rdx, %rax
	cmpq	%rax, %rsi
	cmovg	%rax, %rsi
	leal	2(%rcx), %eax
	addq	$2, %rcx
	cmpq	%rdi, %rcx
	jne	.L212
.L211:
	leal	1(%r12), %r9d
	movq	%rdx, %rcx
	cltq
	movq	%rsi, %rdx
	leaq	-8+a(%rip), %r10
	movslq	%r9d, %r9
	.p2align 4,,10
	.p2align 3
.L213:
	movq	%r9, %rdi
	movq	(%r8,%rax,8), %rsi
	subq	(%r10,%rax,8), %rsi
	subq	%rax, %rdi
	imulq	%rsi, %rdi
	subq	%rdi, %rcx
	leaq	-1(%rax), %rdi
	imulq	%rdi, %rsi
	addq	%rsi, %rcx
	cmpq	%rcx, %rdx
	cmovg	%rcx, %rdx
	addq	$1, %rax
	cmpl	%eax, %r12d
	jge	.L213
.L205:
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	addq	$8, %rsp
	.cfi_remember_state
	.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
.L203:
	.cfi_restore_state
	movl	$1, %edi
	xorl	%eax, %eax
	call	sort
	movq	8+a(%rip), %rax
	movq	%rax, a(%rip)
.L224:
	xorl	%edx, %edx
	jmp	.L205
.L215:
	movl	$1, %ecx
	xorl	%edx, %edx
	jmp	.L206
.L216:
	movq	%rdx, %rsi
	movl	$2, %eax
	leaq	a(%rip), %r8
	jmp	.L211
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 4000000
a:
	.zero	4000000
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.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>
int n;
long a[500000];
int main(){
	scanf("%d",&n);
	long long sum=0;
	for (int i=1;i<=n;i++){
		scanf("%li",&a[i]);
		a[i]=a[i]-i;	
	}
	sort(1,n);
	a[0]=a[1];
	for (int i=1;i<=n;i++){
		a[i]=a[i]-a[0];
		sum=sum+a[i];
	}
	long long ans=sum;
	for (int i=2;i<=n;i++){
		sum=sum-(a[i]-a[i-1])*(n-i+1)+(a[i]-a[i-1])*(i-1);
		if (sum<ans)ans=sum;
	}
	printf("%lli",ans);
	return(0);
}
int sort(int x,int y){
	int l=x;
	int r=y;
	long m=a[(x+y)/2];
	while (l<r){
		while (a[l]<m)l++;
		while (a[r]>m)r--;
		if (l<=r){
			long z=a[l];
			a[l]=a[r];	
			a[r]=z;
			l++;
			r--;
		}
	}
	if (l<y)sort(l,y);
	if (r>x)sort(x,r);
}
5
2 2 3 5 10
 7
1 2 1 1 2 3 4
 9
1 2 3 4 5 6 7 8 1
 6
6 0 4 3 2 1
 7
1 0 1 1 2 3 4
 9
1 2 3 4 5 4 7 8 1
 6
6 0 4 3 2 2
 9
1 2 3 4 5 2 7 8 1
 6
6 0 4 6 2 2
 7
1 0 1 1 0 1 4

6 7 8 15 5 10 14 12 17 9
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>
int n;
long a[500000];
int main(){
	scanf("%d",&n);
	long long sum=0;
	for (int i=1;i<=n;i++){
		scanf("%li",&a[i]);
		a[i]=a[i]-i;	
	}
	sort(1,n);
	a[0]=a[1];
	for (int i=1;i<=n;i++){
		a[i]=a[i]-a[0];
		sum=sum+a[i];
	}
	long long ans=sum;
	for (int i=2;i<=n;i++){
		sum=sum-(a[i]-a[i-1])*(n-i+1)+(a[i]-a[i-1])*(i-1);
		if (sum<ans)ans=sum;
	}
	printf("%lli",ans);
	return(0);
}
int sort(int x,int y){
	int l=x;
	int r=y;
	long m=a[(x+y)/2];
	while (l<r){
		while (a[l]<m)l++;
		while (a[r]>m)r--;
		if (l<=r){
			long z=a[l];
			a[l]=a[r];	
			a[r]=z;
			l++;
			r--;
		}
	}
	if (l<y)sort(l,y);
	if (r>x)sort(x,r);
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	n
	.bss
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 4000000
a:
	.zero	4000000
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%li"
.LC2:
	.string	"%lli"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	$0, -16(%rbp)
	movl	$1, -28(%rbp)
	jmp	.L2
.L3:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %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
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rax
	movl	-28(%rbp), %edx
	movslq	%edx, %rdx
	subq	%rdx, %rax
	movq	%rax, %rcx
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	addl	$1, -28(%rbp)
.L2:
	movl	n(%rip), %eax
	cmpl	%eax, -28(%rbp)
	jle	.L3
	movl	n(%rip), %eax
	movl	%eax, %esi
	movl	$1, %edi
	movl	$0, %eax
	call	sort
	movq	8+a(%rip), %rax
	movq	%rax, a(%rip)
	movl	$1, -24(%rbp)
	jmp	.L4
.L5:
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	a(%rip), %rdx
	subq	%rdx, %rax
	movq	%rax, %rcx
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rax
	addq	%rax, -16(%rbp)
	addl	$1, -24(%rbp)
.L4:
	movl	n(%rip), %eax
	cmpl	%eax, -24(%rbp)
	jle	.L5
	movq	-16(%rbp), %rax
	movq	%rax, -8(%rbp)
	movl	$2, -20(%rbp)
	jmp	.L6
.L8:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rax
	movl	-20(%rbp), %edx
	subl	$1, %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	a(%rip), %rdx
	movq	(%rcx,%rdx), %rcx
	subq	%rcx, %rax
	movq	%rax, %rdx
	movl	n(%rip), %eax
	subl	-20(%rbp), %eax
	addl	$1, %eax
	cltq
	imulq	%rax, %rdx
	movq	-16(%rbp), %rax
	subq	%rdx, %rax
	movq	%rax, %rsi
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rax
	movl	-20(%rbp), %edx
	subl	$1, %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	a(%rip), %rdx
	movq	(%rcx,%rdx), %rcx
	subq	%rcx, %rax
	movq	%rax, %rdx
	movl	-20(%rbp), %eax
	subl	$1, %eax
	cltq
	imulq	%rdx, %rax
	addq	%rsi, %rax
	movq	%rax, -16(%rbp)
	movq	-16(%rbp), %rax
	cmpq	-8(%rbp), %rax
	jge	.L7
	movq	-16(%rbp), %rax
	movq	%rax, -8(%rbp)
.L7:
	addl	$1, -20(%rbp)
.L6:
	movl	n(%rip), %eax
	cmpl	%eax, -20(%rbp)
	jle	.L8
	movq	-8(%rbp), %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
.LFE0:
	.size	main, .-main
	.globl	sort
	.type	sort, @function
sort:
.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)
	movl	%esi, -40(%rbp)
	movl	-36(%rbp), %eax
	movl	%eax, -24(%rbp)
	movl	-40(%rbp), %eax
	movl	%eax, -20(%rbp)
	movl	-36(%rbp), %edx
	movl	-40(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	%rax, -16(%rbp)
	jmp	.L11
.L13:
	addl	$1, -24(%rbp)
.L12:
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rax
	cmpq	%rax, -16(%rbp)
	jg	.L13
	jmp	.L14
.L15:
	subl	$1, -20(%rbp)
.L14:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rax
	cmpq	%rax, -16(%rbp)
	jl	.L15
	movl	-24(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jg	.L11
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	%rax, -8(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rax
	movl	-24(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	a(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	a(%rip), %rdx
	movq	-8(%rbp), %rax
	movq	%rax, (%rcx,%rdx)
	addl	$1, -24(%rbp)
	subl	$1, -20(%rbp)
.L11:
	movl	-24(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jl	.L12
	movl	-24(%rbp), %eax
	cmpl	-40(%rbp), %eax
	jge	.L17
	movl	-40(%rbp), %edx
	movl	-24(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	sort
.L17:
	movl	-20(%rbp), %eax
	cmpl	-36(%rbp), %eax
	jle	.L18
	movl	-20(%rbp), %edx
	movl	-36(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	sort
.L18:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	sort, .-sort
	.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	n
	.bss
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 4000000
a:
	.zero	4000000
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%li"
.LC2:
	.string	"%lli"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	$0, -16(%rbp)
	movl	$1, -28(%rbp)
	jmp	.L2
.L3:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %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
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rax
	movl	-28(%rbp), %edx
	movslq	%edx, %rdx
	subq	%rdx, %rax
	movq	%rax, %rcx
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	addl	$1, -28(%rbp)
.L2:
	movl	n(%rip), %eax
	cmpl	%eax, -28(%rbp)
	jle	.L3
	movl	n(%rip), %eax
	movl	%eax, %esi
	movl	$1, %edi
	movl	$0, %eax
	call	sort
	movq	8+a(%rip), %rax
	movq	%rax, a(%rip)
	movl	$1, -24(%rbp)
	jmp	.L4
.L5:
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	a(%rip), %rdx
	subq	%rdx, %rax
	movq	%rax, %rcx
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rax
	addq	%rax, -16(%rbp)
	addl	$1, -24(%rbp)
.L4:
	movl	n(%rip), %eax
	cmpl	%eax, -24(%rbp)
	jle	.L5
	movq	-16(%rbp), %rax
	movq	%rax, -8(%rbp)
	movl	$2, -20(%rbp)
	jmp	.L6
.L8:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rax
	movl	-20(%rbp), %edx
	subl	$1, %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	a(%rip), %rdx
	movq	(%rcx,%rdx), %rcx
	subq	%rcx, %rax
	movq	%rax, %rdx
	movl	n(%rip), %eax
	subl	-20(%rbp), %eax
	addl	$1, %eax
	cltq
	imulq	%rax, %rdx
	movq	-16(%rbp), %rax
	subq	%rdx, %rax
	movq	%rax, %rsi
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rax
	movl	-20(%rbp), %edx
	subl	$1, %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	a(%rip), %rdx
	movq	(%rcx,%rdx), %rcx
	subq	%rcx, %rax
	movq	%rax, %rdx
	movl	-20(%rbp), %eax
	subl	$1, %eax
	cltq
	imulq	%rdx, %rax
	addq	%rsi, %rax
	movq	%rax, -16(%rbp)
	movq	-16(%rbp), %rax
	cmpq	-8(%rbp), %rax
	jge	.L7
	movq	-16(%rbp), %rax
	movq	%rax, -8(%rbp)
.L7:
	addl	$1, -20(%rbp)
.L6:
	movl	n(%rip), %eax
	cmpl	%eax, -20(%rbp)
	jle	.L8
	movq	-8(%rbp), %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
.LFE0:
	.size	main, .-main
	.globl	sort
	.type	sort, @function
sort:
.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)
	movl	%esi, -40(%rbp)
	movl	-36(%rbp), %eax
	movl	%eax, -24(%rbp)
	movl	-40(%rbp), %eax
	movl	%eax, -20(%rbp)
	movl	-36(%rbp), %edx
	movl	-40(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	%rax, -16(%rbp)
	jmp	.L11
.L13:
	addl	$1, -24(%rbp)
.L12:
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rax
	cmpq	%rax, -16(%rbp)
	jg	.L13
	jmp	.L14
.L15:
	subl	$1, -20(%rbp)
.L14:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rax
	cmpq	%rax, -16(%rbp)
	jl	.L15
	movl	-24(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jg	.L11
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	%rax, -8(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rax
	movl	-24(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	a(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	a(%rip), %rdx
	movq	-8(%rbp), %rax
	movq	%rax, (%rcx,%rdx)
	addl	$1, -24(%rbp)
	subl	$1, -20(%rbp)
.L11:
	movl	-24(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jl	.L12
	movl	-24(%rbp), %eax
	cmpl	-40(%rbp), %eax
	jge	.L17
	movl	-40(%rbp), %edx
	movl	-24(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	sort
.L17:
	movl	-20(%rbp), %eax
	cmpl	-36(%rbp), %eax
	jle	.L18
	movl	-20(%rbp), %edx
	movl	-36(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	sort
.L18:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	sort, .-sort
	.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:
