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 main(){
	long int n_balls;
	scanf("%ld", &n_balls);
	long int value_for[n_balls+1];
	//各ballのvalueはn_ballsを超えない
	long int n_value[n_balls+1];
	for(int value_i = 1; value_i <= n_balls; value_i++)
		n_value[value_i] = 0;

	for(int ball_i = 1; ball_i <= n_balls; ball_i++){
		scanf("%ld", &value_for[ball_i]);
		n_value[value_for[ball_i]]++;
	}

	long int total_pairs = 0;
	for(int value_i = 1; value_i <= n_balls; value_i++)
		//nC2 == n*(n-1)/2
		total_pairs += n_value[value_i] * (n_value[value_i] - 1) / 2;
	for(int ball_i = 1; ball_i <= n_balls; ball_i++){
		int ex_count = (n_value[value_for[ball_i]] > 0 ? 
						n_value[value_for[ball_i]] - 1 : 0);
		printf("%ld\n", total_pairs - ex_count);
	}

	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%ld"
.LC1:
	.string	"%ld\n"
	.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
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$120, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	movq	%rsp, %rax
	movq	%rax, %rbx
	leaq	-104(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-104(%rbp), %rax
	addq	$1, %rax
	leaq	-1(%rax), %rdx
	movq	%rdx, -88(%rbp)
	movq	%rax, %rdx
	movq	%rdx, -144(%rbp)
	movq	$0, -136(%rbp)
	movq	%rax, %rdx
	movq	%rdx, -160(%rbp)
	movq	$0, -152(%rbp)
	leaq	0(,%rax,8), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %esi
	movl	$0, %edx
	divq	%rsi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L2:
	cmpq	%rdx, %rsp
	je	.L3
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L2
.L3:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L4
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L4:
	movq	%rsp, %rax
	addq	$7, %rax
	shrq	$3, %rax
	salq	$3, %rax
	movq	%rax, -80(%rbp)
	movq	-104(%rbp), %rax
	addq	$1, %rax
	leaq	-1(%rax), %rdx
	movq	%rdx, -72(%rbp)
	movq	%rax, %rdx
	movq	%rdx, %r14
	movl	$0, %r15d
	movq	%rax, %rdx
	movq	%rdx, %r12
	movl	$0, %r13d
	leaq	0(,%rax,8), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L5:
	cmpq	%rdx, %rsp
	je	.L6
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L5
.L6:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L7
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L7:
	movq	%rsp, %rax
	addq	$7, %rax
	shrq	$3, %rax
	salq	$3, %rax
	movq	%rax, -64(%rbp)
	movl	$1, -124(%rbp)
	jmp	.L8
.L9:
	movq	-64(%rbp), %rax
	movl	-124(%rbp), %edx
	movslq	%edx, %rdx
	movq	$0, (%rax,%rdx,8)
	addl	$1, -124(%rbp)
.L8:
	movl	-124(%rbp), %eax
	movslq	%eax, %rdx
	movq	-104(%rbp), %rax
	cmpq	%rax, %rdx
	jle	.L9
	movl	$1, -120(%rbp)
	jmp	.L10
.L11:
	movl	-120(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-80(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-80(%rbp), %rax
	movl	-120(%rbp), %edx
	movslq	%edx, %rdx
	movq	(%rax,%rdx,8), %rax
	movq	-64(%rbp), %rdx
	movq	(%rdx,%rax,8), %rdx
	leaq	1(%rdx), %rcx
	movq	-64(%rbp), %rdx
	movq	%rcx, (%rdx,%rax,8)
	addl	$1, -120(%rbp)
.L10:
	movl	-120(%rbp), %eax
	movslq	%eax, %rdx
	movq	-104(%rbp), %rax
	cmpq	%rax, %rdx
	jle	.L11
	movq	$0, -96(%rbp)
	movl	$1, -116(%rbp)
	jmp	.L12
.L13:
	movq	-64(%rbp), %rax
	movl	-116(%rbp), %edx
	movslq	%edx, %rdx
	movq	(%rax,%rdx,8), %rcx
	movq	-64(%rbp), %rax
	movl	-116(%rbp), %edx
	movslq	%edx, %rdx
	movq	(%rax,%rdx,8), %rax
	subq	$1, %rax
	imulq	%rcx, %rax
	movq	%rax, %rdx
	shrq	$63, %rdx
	addq	%rdx, %rax
	sarq	%rax
	addq	%rax, -96(%rbp)
	addl	$1, -116(%rbp)
.L12:
	movl	-116(%rbp), %eax
	movslq	%eax, %rdx
	movq	-104(%rbp), %rax
	cmpq	%rax, %rdx
	jle	.L13
	movl	$1, -112(%rbp)
	jmp	.L14
.L15:
	movq	-80(%rbp), %rax
	movl	-112(%rbp), %edx
	movslq	%edx, %rdx
	movq	(%rax,%rdx,8), %rdx
	movq	-64(%rbp), %rax
	movq	(%rax,%rdx,8), %rax
	movl	$1, %edx
	testq	%rax, %rax
	cmovle	%rdx, %rax
	subl	$1, %eax
	movl	%eax, -108(%rbp)
	movl	-108(%rbp), %eax
	movslq	%eax, %rdx
	movq	-96(%rbp), %rax
	subq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -112(%rbp)
.L14:
	movl	-112(%rbp), %eax
	movslq	%eax, %rdx
	movq	-104(%rbp), %rax
	cmpq	%rax, %rdx
	jle	.L15
	movl	$0, %eax
	movq	%rbx, %rsp
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L17
	call	__stack_chk_fail@PLT
.L17:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.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
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%ld"
.LC1:
	.string	"%ld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r15
	.cfi_offset 15, -24
	leaq	.LC0(%rip), %r15
	pushq	%r14
	leaq	-64(%rbp), %rsi
	movq	%r15, %rdi
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$40, %rsp
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	-64(%rbp), %rsi
	movq	%rsp, %rdi
	leaq	8(,%rsi,8), %rdx
	leaq	15(%rdx), %rax
	movq	%rax, %r8
	movq	%rax, %rcx
	andq	$-4096, %r8
	andq	$-16, %rcx
	subq	%r8, %rdi
	cmpq	%rdi, %rsp
	je	.L3
.L26:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rdi, %rsp
	jne	.L26
.L3:
	andl	$4095, %ecx
	subq	%rcx, %rsp
	testq	%rcx, %rcx
	jne	.L27
.L4:
	movq	%rax, %rcx
	movq	%rsp, %rdi
	andq	$-4096, %rax
	movq	%rsp, %r12
	andq	$-16, %rcx
	subq	%rax, %rdi
.L5:
	cmpq	%rdi, %rsp
	je	.L6
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L5
.L27:
	orq	$0, -8(%rsp,%rcx)
	jmp	.L4
.L6:
	andl	$4095, %ecx
	subq	%rcx, %rsp
	testq	%rcx, %rcx
	jne	.L28
.L7:
	movq	%rsp, %rbx
	testq	%rsi, %rsi
	jle	.L12
	leaq	8(%rbx), %rdi
	subq	$8, %rdx
	xorl	%esi, %esi
	movl	$1, %r13d
	movq	%rdi, -72(%rbp)
	leaq	8(%r12), %r14
	call	memset@PLT
	.p2align 4,,10
	.p2align 3
.L9:
	movq	%r14, %rsi
	movq	%r15, %rdi
	xorl	%eax, %eax
	addq	$1, %r13
	call	__isoc99_scanf@PLT
	movq	(%r14), %rax
	addq	$8, %r14
	addq	$1, (%rbx,%rax,8)
	movq	-64(%rbp), %rax
	cmpq	%r13, %rax
	jge	.L9
	testq	%rax, %rax
	jle	.L12
	movq	-72(%rbp), %rcx
	leaq	8(%rbx,%rax,8), %rsi
	xorl	%r14d, %r14d
	.p2align 4,,10
	.p2align 3
.L10:
	movq	(%rcx), %rax
	addq	$8, %rcx
	leaq	-1(%rax), %rdx
	imulq	%rax, %rdx
	movq	%rdx, %rax
	shrq	$63, %rax
	addq	%rdx, %rax
	sarq	%rax
	addq	%rax, %r14
	cmpq	%rsi, %rcx
	jne	.L10
	movl	$1, %r15d
	leaq	.LC1(%rip), %r13
	.p2align 4,,10
	.p2align 3
.L11:
	movq	(%r12,%r15,8), %rax
	movl	$1, %edx
	movq	%r13, %rsi
	movl	$1, %edi
	movq	(%rbx,%rax,8), %rax
	testq	%rax, %rax
	cmovle	%rdx, %rax
	movq	%r14, %rdx
	addq	$1, %r15
	subl	$1, %eax
	cltq
	subq	%rax, %rdx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	cmpq	%r15, -64(%rbp)
	jge	.L11
.L12:
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L29
	leaq	-40(%rbp), %rsp
	xorl	%eax, %eax
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_remember_state
	.cfi_def_cfa 7, 8
	ret
.L28:
	.cfi_restore_state
	orq	$0, -8(%rsp,%rcx)
	jmp	.L7
.L29:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.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:

rule
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%ld"
.LC1:
	.string	"%ld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r15
	.cfi_offset 15, -24
	leaq	.LC0(%rip), %r15
	pushq	%r14
	leaq	-64(%rbp), %rsi
	movq	%r15, %rdi
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$40, %rsp
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	-64(%rbp), %rsi
	movq	%rsp, %rdi
	leaq	8(,%rsi,8), %rdx
	leaq	15(%rdx), %rax
	movq	%rax, %r8
	movq	%rax, %rcx
	andq	$-4096, %r8
	andq	$-16, %rcx
	subq	%r8, %rdi
	cmpq	%rdi, %rsp
	je	.L3
.L26:
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	cmpq	%rdi, %rsp
	jne	.L26
.L3:
	andl	$4095, %ecx
	subq	%rcx, %rsp
	testq	%rcx, %rcx
	jne	.L27
.L4:
	movq	%rax, %rcx
	movq	%rsp, %rdi
	andq	$-4096, %rax
	movq	%rsp, %r12
	andq	$-16, %rcx
	subq	%rax, %rdi
.L5:
	cmpq	%rdi, %rsp
	je	.L6
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L5
.L27:
	orq	$0, -8(%rsp,%rcx)
	jmp	.L4
.L6:
	andl	$4095, %ecx
	subq	%rcx, %rsp
	testq	%rcx, %rcx
	jne	.L28
.L7:
	movq	%rsp, %rbx
	testq	%rsi, %rsi
	jle	.L12
	leaq	8(%rbx), %rdi
	subq	$8, %rdx
	xorl	%esi, %esi
	movl	$1, %r13d
	movq	%rdi, -72(%rbp)
	leaq	8(%r12), %r14
	call	memset@PLT
	.p2align 4,,10
	.p2align 3
.L9:
	movq	%r14, %rsi
	movq	%r15, %rdi
	xorl	%eax, %eax
	addq	$1, %r13
	call	__isoc99_scanf@PLT
	movq	(%r14), %rax
	addq	$8, %r14
	addq	$1, (%rbx,%rax,8)
	movq	-64(%rbp), %rax
	cmpq	%r13, %rax
	jge	.L9
	testq	%rax, %rax
	jle	.L12
	movq	-72(%rbp), %rcx
	leaq	8(%rbx,%rax,8), %rsi
	xorl	%r14d, %r14d
	.p2align 4,,10
	.p2align 3
.L10:
	movq	(%rcx), %rax
	addq	$8, %rcx
	leaq	-1(%rax), %rdx
	imulq	%rax, %rdx
	movq	%rdx, %rax
	shrq	$63, %rax
	addq	%rdx, %rax
	sarq	%rax
	addq	%rax, %r14
	cmpq	%rsi, %rcx
	jne	.L10
	movl	$1, %r15d
	leaq	.LC1(%rip), %r13
	.p2align 4,,10
	.p2align 3
.L11:
	movq	(%r12,%r15,8), %rax
	movl	$1, %edx
	movq	%r13, %rsi
	movl	$1, %edi
	movq	(%rbx,%rax,8), %rax
	testq	%rax, %rax
	cmovle	%rdx, %rax
	movq	%r14, %rdx
	addq	$1, %r15
	subl	$1, %eax
	cltq
	subq	%rax, %rdx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	cmpq	%r15, -64(%rbp)
	jge	.L11
.L12:
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L29
	leaq	-40(%rbp), %rsp
	xorl	%eax, %eax
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_remember_state
	.cfi_def_cfa 7, 8
	ret
.L28:
	.cfi_restore_state
	orq	$0, -8(%rsp,%rcx)
	jmp	.L7
.L29:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.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:

#include<stdio.h>
int main(){
	long int n_balls;
	scanf("%ld", &n_balls);
	long int value_for[n_balls+1];
	//各ballのvalueはn_ballsを超えない
	long int n_value[n_balls+1];
	for(int value_i = 1; value_i <= n_balls; value_i++)
		n_value[value_i] = 0;

	for(int ball_i = 1; ball_i <= n_balls; ball_i++){
		scanf("%ld", &value_for[ball_i]);
		n_value[value_for[ball_i]]++;
	}

	long int total_pairs = 0;
	for(int value_i = 1; value_i <= n_balls; value_i++)
		//nC2 == n*(n-1)/2
		total_pairs += n_value[value_i] * (n_value[value_i] - 1) / 2;
	for(int ball_i = 1; ball_i <= n_balls; ball_i++){
		int ex_count = (n_value[value_for[ball_i]] > 0 ? 
						n_value[value_for[ball_i]] - 1 : 0);
		printf("%ld\n", total_pairs - ex_count);
	}

	return 0;
}
8
1 2 1 6 2 1 4 1
 5
0 1 2 1 2
 4
2 2 3 4
 5
3 3 2 3 3
 8
1 3 1 6 2 1 4 1
 5
0 1 2 1 0
 5
0 3 2 3 3
 8
1 3 1 6 2 0 4 1
 8
1 2 1 6 2 0 4 1
 8
1 1 1 6 2 0 4 1

4
6
4
7
6
4
7
4
 -62
1
1
1
1
 0
0
1
1
 3
3
6
3
3
 3
6
3
6
6
3
6
3
 -64
0
1
0
-64
 -61
1
3
1
1
 1
3
1
3
3
1372639475
3
1
 2
3
2
4
3
-2132602636
4
2
 3
3
3
6
6
890130678
6
3

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 main(){
	long int n_balls;
	scanf("%ld", &n_balls);
	long int value_for[n_balls+1];
	//各ballのvalueはn_ballsを超えない
	long int n_value[n_balls+1];
	for(int value_i = 1; value_i <= n_balls; value_i++)
		n_value[value_i] = 0;

	for(int ball_i = 1; ball_i <= n_balls; ball_i++){
		scanf("%ld", &value_for[ball_i]);
		n_value[value_for[ball_i]]++;
	}

	long int total_pairs = 0;
	for(int value_i = 1; value_i <= n_balls; value_i++)
		//nC2 == n*(n-1)/2
		total_pairs += n_value[value_i] * (n_value[value_i] - 1) / 2;
	for(int ball_i = 1; ball_i <= n_balls; ball_i++){
		int ex_count = (n_value[value_for[ball_i]] > 0 ? 
						n_value[value_for[ball_i]] - 1 : 0);
		printf("%ld\n", total_pairs - ex_count);
	}

	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%ld"
.LC1:
	.string	"%ld\n"
	.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
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$120, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	movq	%rsp, %rax
	movq	%rax, %rbx
	leaq	-104(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-104(%rbp), %rax
	addq	$1, %rax
	leaq	-1(%rax), %rdx
	movq	%rdx, -88(%rbp)
	movq	%rax, %rdx
	movq	%rdx, -144(%rbp)
	movq	$0, -136(%rbp)
	movq	%rax, %rdx
	movq	%rdx, -160(%rbp)
	movq	$0, -152(%rbp)
	leaq	0(,%rax,8), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %esi
	movl	$0, %edx
	divq	%rsi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L2:
	cmpq	%rdx, %rsp
	je	.L3
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L2
.L3:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L4
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L4:
	movq	%rsp, %rax
	addq	$7, %rax
	shrq	$3, %rax
	salq	$3, %rax
	movq	%rax, -80(%rbp)
	movq	-104(%rbp), %rax
	addq	$1, %rax
	leaq	-1(%rax), %rdx
	movq	%rdx, -72(%rbp)
	movq	%rax, %rdx
	movq	%rdx, %r14
	movl	$0, %r15d
	movq	%rax, %rdx
	movq	%rdx, %r12
	movl	$0, %r13d
	leaq	0(,%rax,8), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L5:
	cmpq	%rdx, %rsp
	je	.L6
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L5
.L6:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L7
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L7:
	movq	%rsp, %rax
	addq	$7, %rax
	shrq	$3, %rax
	salq	$3, %rax
	movq	%rax, -64(%rbp)
	movl	$1, -124(%rbp)
	jmp	.L8
.L9:
	movq	-64(%rbp), %rax
	movl	-124(%rbp), %edx
	movslq	%edx, %rdx
	movq	$0, (%rax,%rdx,8)
	addl	$1, -124(%rbp)
.L8:
	movl	-124(%rbp), %eax
	movslq	%eax, %rdx
	movq	-104(%rbp), %rax
	cmpq	%rax, %rdx
	jle	.L9
	movl	$1, -120(%rbp)
	jmp	.L10
.L11:
	movl	-120(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-80(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-80(%rbp), %rax
	movl	-120(%rbp), %edx
	movslq	%edx, %rdx
	movq	(%rax,%rdx,8), %rax
	movq	-64(%rbp), %rdx
	movq	(%rdx,%rax,8), %rdx
	leaq	1(%rdx), %rcx
	movq	-64(%rbp), %rdx
	movq	%rcx, (%rdx,%rax,8)
	addl	$1, -120(%rbp)
.L10:
	movl	-120(%rbp), %eax
	movslq	%eax, %rdx
	movq	-104(%rbp), %rax
	cmpq	%rax, %rdx
	jle	.L11
	movq	$0, -96(%rbp)
	movl	$1, -116(%rbp)
	jmp	.L12
.L13:
	movq	-64(%rbp), %rax
	movl	-116(%rbp), %edx
	movslq	%edx, %rdx
	movq	(%rax,%rdx,8), %rcx
	movq	-64(%rbp), %rax
	movl	-116(%rbp), %edx
	movslq	%edx, %rdx
	movq	(%rax,%rdx,8), %rax
	subq	$1, %rax
	imulq	%rcx, %rax
	movq	%rax, %rdx
	shrq	$63, %rdx
	addq	%rdx, %rax
	sarq	%rax
	addq	%rax, -96(%rbp)
	addl	$1, -116(%rbp)
.L12:
	movl	-116(%rbp), %eax
	movslq	%eax, %rdx
	movq	-104(%rbp), %rax
	cmpq	%rax, %rdx
	jle	.L13
	movl	$1, -112(%rbp)
	jmp	.L14
.L15:
	movq	-80(%rbp), %rax
	movl	-112(%rbp), %edx
	movslq	%edx, %rdx
	movq	(%rax,%rdx,8), %rdx
	movq	-64(%rbp), %rax
	movq	(%rax,%rdx,8), %rax
	movl	$1, %edx
	testq	%rax, %rax
	cmovle	%rdx, %rax
	subl	$1, %eax
	movl	%eax, -108(%rbp)
	movl	-108(%rbp), %eax
	movslq	%eax, %rdx
	movq	-96(%rbp), %rax
	subq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -112(%rbp)
.L14:
	movl	-112(%rbp), %eax
	movslq	%eax, %rdx
	movq	-104(%rbp), %rax
	cmpq	%rax, %rdx
	jle	.L15
	movl	$0, %eax
	movq	%rbx, %rsp
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L17
	call	__stack_chk_fail@PLT
.L17:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.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
	.section	.rodata
.LC0:
	.string	"%ld"
.LC1:
	.string	"%ld\n"
	.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
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$120, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	movq	%rsp, %rax
	movq	%rax, %rbx
	leaq	-104(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-104(%rbp), %rax
	addq	$1, %rax
	leaq	-1(%rax), %rdx
	movq	%rdx, -88(%rbp)
	movq	%rax, %rdx
	movq	%rdx, -144(%rbp)
	movq	$0, -136(%rbp)
	movq	%rax, %rdx
	movq	%rdx, -160(%rbp)
	movq	$0, -152(%rbp)
	leaq	0(,%rax,8), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %esi
	movl	$0, %edx
	divq	%rsi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L2:
	cmpq	%rdx, %rsp
	je	.L3
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L2
.L3:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L4
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L4:
	movq	%rsp, %rax
	addq	$7, %rax
	shrq	$3, %rax
	salq	$3, %rax
	movq	%rax, -80(%rbp)
	movq	-104(%rbp), %rax
	addq	$1, %rax
	leaq	-1(%rax), %rdx
	movq	%rdx, -72(%rbp)
	movq	%rax, %rdx
	movq	%rdx, %r14
	movl	$0, %r15d
	movq	%rax, %rdx
	movq	%rdx, %r12
	movl	$0, %r13d
	leaq	0(,%rax,8), %rdx
	movl	$16, %eax
	subq	$1, %rax
	addq	%rdx, %rax
	movl	$16, %edi
	movl	$0, %edx
	divq	%rdi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L5:
	cmpq	%rdx, %rsp
	je	.L6
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L5
.L6:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L7
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L7:
	movq	%rsp, %rax
	addq	$7, %rax
	shrq	$3, %rax
	salq	$3, %rax
	movq	%rax, -64(%rbp)
	movl	$1, -124(%rbp)
	jmp	.L8
.L9:
	movq	-64(%rbp), %rax
	movl	-124(%rbp), %edx
	movslq	%edx, %rdx
	movq	$0, (%rax,%rdx,8)
	addl	$1, -124(%rbp)
.L8:
	movl	-124(%rbp), %eax
	movslq	%eax, %rdx
	movq	-104(%rbp), %rax
	cmpq	%rax, %rdx
	jle	.L9
	movl	$1, -120(%rbp)
	jmp	.L10
.L11:
	movl	-120(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-80(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-80(%rbp), %rax
	movl	-120(%rbp), %edx
	movslq	%edx, %rdx
	movq	(%rax,%rdx,8), %rax
	movq	-64(%rbp), %rdx
	movq	(%rdx,%rax,8), %rdx
	leaq	1(%rdx), %rcx
	movq	-64(%rbp), %rdx
	movq	%rcx, (%rdx,%rax,8)
	addl	$1, -120(%rbp)
.L10:
	movl	-120(%rbp), %eax
	movslq	%eax, %rdx
	movq	-104(%rbp), %rax
	cmpq	%rax, %rdx
	jle	.L11
	movq	$0, -96(%rbp)
	movl	$1, -116(%rbp)
	jmp	.L12
.L13:
	movq	-64(%rbp), %rax
	movl	-116(%rbp), %edx
	movslq	%edx, %rdx
	movq	(%rax,%rdx,8), %rcx
	movq	-64(%rbp), %rax
	movl	-116(%rbp), %edx
	movslq	%edx, %rdx
	movq	(%rax,%rdx,8), %rax
	subq	$1, %rax
	imulq	%rcx, %rax
	movq	%rax, %rdx
	shrq	$63, %rdx
	addq	%rdx, %rax
	sarq	%rax
	addq	%rax, -96(%rbp)
	addl	$1, -116(%rbp)
.L12:
	movl	-116(%rbp), %eax
	movslq	%eax, %rdx
	movq	-104(%rbp), %rax
	cmpq	%rax, %rdx
	jle	.L13
	movl	$1, -112(%rbp)
	jmp	.L14
.L15:
	movq	-80(%rbp), %rax
	movl	-112(%rbp), %edx
	movslq	%edx, %rdx
	movq	(%rax,%rdx,8), %rdx
	movq	-64(%rbp), %rax
	movq	(%rax,%rdx,8), %rax
	movl	$1, %edx
	testq	%rax, %rax
	cmovle	%rdx, %rax
	subl	$1, %eax
	movl	%eax, -108(%rbp)
	movl	-108(%rbp), %eax
	movslq	%eax, %rdx
	movq	-96(%rbp), %rax
	subq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -112(%rbp)
.L14:
	movl	-112(%rbp), %eax
	movslq	%eax, %rdx
	movq	-104(%rbp), %rax
	cmpq	%rax, %rdx
	jle	.L15
	movl	$0, %eax
	movq	%rbx, %rsp
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L17
	call	__stack_chk_fail@PLT
.L17:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.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:
