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()
{
	int a[1001] = {0}, b[2001] = { 0 }, c[3001] = { 0 }, d[4001] = { 0 }, n,i,j;


	
		for (i = 0; i < 1001; i++)
		{
			++a[i];
		}

		for (i = 0; i < 1001; i++)
		{
			for (j = 0; j < 1001; j++)
			{
				b[i + j] += a[i];
			}
		}

		for (i = 0; i < 2001; i++)
		{
			for (j = 0; j < 1001; j++)
			{
				c[i + j] += b[i];
			}
		}

		for (i = 0; i < 3001; i++)
		{
			for (j = 0; j < 1001; j++)
			{
				d[i + j] += c[i];
			}
		}

		while (scanf("%d", &n) != EOF)
		{
			printf("%d\n", d[n]);
		}


	return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d\n"
.LC1:
	.string	"%d"
	.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
	leaq	-36864(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$3216, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-40064(%rbp), %rdx
	movl	$0, %eax
	movl	$500, %ecx
	movq	%rdx, %rdi
	rep stosq
	movq	%rdi, %rdx
	movl	%eax, (%rdx)
	addq	$4, %rdx
	leaq	-36048(%rbp), %rdx
	movl	$0, %eax
	movl	$1000, %ecx
	movq	%rdx, %rdi
	rep stosq
	movq	%rdi, %rdx
	movl	%eax, (%rdx)
	addq	$4, %rdx
	leaq	-28032(%rbp), %rax
	movl	$12004, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	leaq	-16016(%rbp), %rax
	movl	$16004, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, -40072(%rbp)
	jmp	.L2
.L3:
	movl	-40072(%rbp), %eax
	cltq
	movl	-40064(%rbp,%rax,4), %eax
	leal	1(%rax), %edx
	movl	-40072(%rbp), %eax
	cltq
	movl	%edx, -40064(%rbp,%rax,4)
	addl	$1, -40072(%rbp)
.L2:
	cmpl	$1000, -40072(%rbp)
	jle	.L3
	movl	$0, -40072(%rbp)
	jmp	.L4
.L7:
	movl	$0, -40068(%rbp)
	jmp	.L5
.L6:
	movl	-40072(%rbp), %edx
	movl	-40068(%rbp), %eax
	addl	%edx, %eax
	cltq
	movl	-36048(%rbp,%rax,4), %ecx
	movl	-40072(%rbp), %eax
	cltq
	movl	-40064(%rbp,%rax,4), %edx
	movl	-40072(%rbp), %esi
	movl	-40068(%rbp), %eax
	addl	%esi, %eax
	addl	%ecx, %edx
	cltq
	movl	%edx, -36048(%rbp,%rax,4)
	addl	$1, -40068(%rbp)
.L5:
	cmpl	$1000, -40068(%rbp)
	jle	.L6
	addl	$1, -40072(%rbp)
.L4:
	cmpl	$1000, -40072(%rbp)
	jle	.L7
	movl	$0, -40072(%rbp)
	jmp	.L8
.L11:
	movl	$0, -40068(%rbp)
	jmp	.L9
.L10:
	movl	-40072(%rbp), %edx
	movl	-40068(%rbp), %eax
	addl	%edx, %eax
	cltq
	movl	-28032(%rbp,%rax,4), %ecx
	movl	-40072(%rbp), %eax
	cltq
	movl	-36048(%rbp,%rax,4), %edx
	movl	-40072(%rbp), %esi
	movl	-40068(%rbp), %eax
	addl	%esi, %eax
	addl	%ecx, %edx
	cltq
	movl	%edx, -28032(%rbp,%rax,4)
	addl	$1, -40068(%rbp)
.L9:
	cmpl	$1000, -40068(%rbp)
	jle	.L10
	addl	$1, -40072(%rbp)
.L8:
	cmpl	$2000, -40072(%rbp)
	jle	.L11
	movl	$0, -40072(%rbp)
	jmp	.L12
.L15:
	movl	$0, -40068(%rbp)
	jmp	.L13
.L14:
	movl	-40072(%rbp), %edx
	movl	-40068(%rbp), %eax
	addl	%edx, %eax
	cltq
	movl	-16016(%rbp,%rax,4), %ecx
	movl	-40072(%rbp), %eax
	cltq
	movl	-28032(%rbp,%rax,4), %edx
	movl	-40072(%rbp), %esi
	movl	-40068(%rbp), %eax
	addl	%esi, %eax
	addl	%ecx, %edx
	cltq
	movl	%edx, -16016(%rbp,%rax,4)
	addl	$1, -40068(%rbp)
.L13:
	cmpl	$1000, -40068(%rbp)
	jle	.L14
	addl	$1, -40072(%rbp)
.L12:
	cmpl	$3000, -40072(%rbp)
	jle	.L15
	jmp	.L16
.L17:
	movl	-40076(%rbp), %eax
	cltq
	movl	-16016(%rbp,%rax,4), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L16:
	leaq	-40076(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$-1, %eax
	jne	.L17
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L19
	call	__stack_chk_fail@PLT
.L19:
	leave
	.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
.LC1:
	.string	"%d\n"
.LC2:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	leaq	-36864(%rsp), %r11
	.cfi_def_cfa 11, 36896
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$3216, %rsp
	.cfi_def_cfa_offset 40112
	movl	$500, %ecx
	movl	$12004, %edx
	xorl	%esi, %esi
	movq	%fs:40, %rax
	movq	%rax, 40072(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %rdi
	leaq	4032(%rsp), %rbx
	leaq	12048(%rsp), %rbp
	rep stosq
	movl	$1000, %ecx
	movl	$0, (%rdi)
	movq	%rbx, %rdi
	rep stosq
	movl	$0, (%rdi)
	movq	%rbp, %rdi
	call	memset@PLT
	leaq	24064(%rsp), %r8
	movl	$16004, %edx
	xorl	%esi, %esi
	movq	%r8, %rdi
	call	memset@PLT
	leaq	16(%rsp), %rsi
	movdqa	.LC0(%rip), %xmm1
	leaq	4016(%rsp), %rdx
	movq	%rax, %r8
	movq	%rsi, %rax
.L2:
	movdqa	(%rax), %xmm0
	addq	$16, %rax
	paddd	%xmm1, %xmm0
	movaps	%xmm0, -16(%rax)
	cmpq	%rdx, %rax
	jne	.L2
	addl	$1, 4016(%rsp)
	movq	%rbx, %rdi
	movq	%rbx, %rcx
	leaq	8032(%rsp), %rdx
	leaq	12036(%rsp), %r10
	.p2align 4,,10
	.p2align 3
.L3:
	movl	(%rsi), %r9d
	movq	%rcx, %rax
	movd	%r9d, %xmm2
	pshufd	$0, %xmm2, %xmm1
	.p2align 4,,10
	.p2align 3
.L5:
	movdqu	(%rax), %xmm0
	addq	$16, %rax
	paddd	%xmm1, %xmm0
	movups	%xmm0, -16(%rax)
	cmpq	%rdx, %rax
	jne	.L5
	leaq	4(%rax), %rdx
	addl	%r9d, (%rax)
	addq	$4, %rsi
	addq	$4, %rcx
	cmpq	%r10, %rdx
	jne	.L3
	leaq	16048(%rsp), %rdx
	movq	%rbp, %rcx
	leaq	24052(%rsp), %r10
	movq	%rbp, %rsi
	.p2align 4,,10
	.p2align 3
.L7:
	movl	(%rdi), %r9d
	movq	%rsi, %rax
	movd	%r9d, %xmm3
	pshufd	$0, %xmm3, %xmm1
	.p2align 4,,10
	.p2align 3
.L9:
	movdqu	(%rax), %xmm0
	addq	$16, %rax
	paddd	%xmm1, %xmm0
	movups	%xmm0, -16(%rax)
	cmpq	%rdx, %rax
	jne	.L9
	leaq	4(%rax), %rdx
	addl	%r9d, (%rax)
	addq	$4, %rdi
	addq	$4, %rsi
	cmpq	%rdx, %r10
	jne	.L7
	movq	%r8, %rdx
	leaq	28064(%rsp), %rax
	leaq	40068(%rsp), %r8
	.p2align 4,,10
	.p2align 3
.L11:
	movl	(%rcx), %edi
	movq	%rdx, %rsi
	movd	%edi, %xmm4
	pshufd	$0, %xmm4, %xmm1
	.p2align 4,,10
	.p2align 3
.L13:
	movdqu	(%rsi), %xmm0
	addq	$16, %rsi
	paddd	%xmm1, %xmm0
	movups	%xmm0, -16(%rsi)
	cmpq	%rsi, %rax
	jne	.L13
	addl	%edi, (%rax)
	addq	$4, %rax
	addq	$4, %rcx
	addq	$4, %rdx
	cmpq	%r8, %rax
	jne	.L11
	leaq	12(%rsp), %r12
	leaq	.LC2(%rip), %rbp
	leaq	.LC1(%rip), %rbx
	jmp	.L12
.L15:
	movslq	12(%rsp), %rax
	movq	%rbx, %rsi
	movl	$1, %edi
	movl	24064(%rsp,%rax,4), %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	.p2align 4,,10
	.p2align 3
.L12:
	xorl	%eax, %eax
	movq	%r12, %rsi
	movq	%rbp, %rdi
	call	__isoc99_scanf@PLT
	cmpl	$-1, %eax
	jne	.L15
	movq	40072(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L31
	addq	$40080, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L31:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.long	1
	.long	1
	.long	1
	.long	1
	.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
.LC1:
	.string	"%d\n"
.LC2:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	leaq	-36864(%rsp), %r11
	.cfi_def_cfa 11, 36896
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$3216, %rsp
	.cfi_def_cfa_offset 40112
	movl	$500, %ecx
	movl	$12004, %edx
	xorl	%esi, %esi
	movq	%fs:40, %rax
	movq	%rax, 40072(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %rdi
	leaq	4032(%rsp), %rbx
	leaq	12048(%rsp), %rbp
	rep stosq
	movl	$1000, %ecx
	movl	$0, (%rdi)
	movq	%rbx, %rdi
	rep stosq
	movl	$0, (%rdi)
	movq	%rbp, %rdi
	call	memset@PLT
	leaq	24064(%rsp), %r8
	movl	$16004, %edx
	xorl	%esi, %esi
	movq	%r8, %rdi
	call	memset@PLT
	leaq	16(%rsp), %rsi
	movdqa	.LC0(%rip), %xmm1
	leaq	4016(%rsp), %rdx
	movq	%rax, %r8
	movq	%rsi, %rax
.L2:
	movdqa	(%rax), %xmm0
	addq	$16, %rax
	paddd	%xmm1, %xmm0
	movaps	%xmm0, -16(%rax)
	cmpq	%rdx, %rax
	jne	.L2
	addl	$1, 4016(%rsp)
	movq	%rbx, %rdi
	movq	%rbx, %rcx
	leaq	8032(%rsp), %rdx
	leaq	12036(%rsp), %r10
	.p2align 4,,10
	.p2align 3
.L3:
	movl	(%rsi), %r9d
	movq	%rcx, %rax
	movd	%r9d, %xmm2
	pshufd	$0, %xmm2, %xmm1
	.p2align 4,,10
	.p2align 3
.L5:
	movdqu	(%rax), %xmm0
	addq	$16, %rax
	paddd	%xmm1, %xmm0
	movups	%xmm0, -16(%rax)
	cmpq	%rdx, %rax
	jne	.L5
	leaq	4(%rax), %rdx
	addl	%r9d, (%rax)
	addq	$4, %rsi
	addq	$4, %rcx
	cmpq	%r10, %rdx
	jne	.L3
	leaq	16048(%rsp), %rdx
	movq	%rbp, %rcx
	leaq	24052(%rsp), %r10
	movq	%rbp, %rsi
	.p2align 4,,10
	.p2align 3
.L7:
	movl	(%rdi), %r9d
	movq	%rsi, %rax
	movd	%r9d, %xmm3
	pshufd	$0, %xmm3, %xmm1
	.p2align 4,,10
	.p2align 3
.L9:
	movdqu	(%rax), %xmm0
	addq	$16, %rax
	paddd	%xmm1, %xmm0
	movups	%xmm0, -16(%rax)
	cmpq	%rdx, %rax
	jne	.L9
	leaq	4(%rax), %rdx
	addl	%r9d, (%rax)
	addq	$4, %rdi
	addq	$4, %rsi
	cmpq	%rdx, %r10
	jne	.L7
	movq	%r8, %rdx
	leaq	28064(%rsp), %rax
	leaq	40068(%rsp), %r8
	.p2align 4,,10
	.p2align 3
.L11:
	movl	(%rcx), %edi
	movq	%rdx, %rsi
	movd	%edi, %xmm4
	pshufd	$0, %xmm4, %xmm1
	.p2align 4,,10
	.p2align 3
.L13:
	movdqu	(%rsi), %xmm0
	addq	$16, %rsi
	paddd	%xmm1, %xmm0
	movups	%xmm0, -16(%rsi)
	cmpq	%rsi, %rax
	jne	.L13
	addl	%edi, (%rax)
	addq	$4, %rax
	addq	$4, %rcx
	addq	$4, %rdx
	cmpq	%r8, %rax
	jne	.L11
	leaq	12(%rsp), %r12
	leaq	.LC2(%rip), %rbp
	leaq	.LC1(%rip), %rbx
	jmp	.L12
.L15:
	movslq	12(%rsp), %rax
	movq	%rbx, %rsi
	movl	$1, %edi
	movl	24064(%rsp,%rax,4), %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	.p2align 4,,10
	.p2align 3
.L12:
	xorl	%eax, %eax
	movq	%r12, %rsi
	movq	%rbp, %rdi
	call	__isoc99_scanf@PLT
	cmpl	$-1, %eax
	jne	.L15
	movq	40072(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L31
	addq	$40080, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L31:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.long	1
	.long	1
	.long	1
	.long	1
	.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()
{
	int a[1001] = {0}, b[2001] = { 0 }, c[3001] = { 0 }, d[4001] = { 0 }, n,i,j;


	
		for (i = 0; i < 1001; i++)
		{
			++a[i];
		}

		for (i = 0; i < 1001; i++)
		{
			for (j = 0; j < 1001; j++)
			{
				b[i + j] += a[i];
			}
		}

		for (i = 0; i < 2001; i++)
		{
			for (j = 0; j < 1001; j++)
			{
				c[i + j] += b[i];
			}
		}

		for (i = 0; i < 3001; i++)
		{
			for (j = 0; j < 1001; j++)
			{
				d[i + j] += c[i];
			}
		}

		while (scanf("%d", &n) != EOF)
		{
			printf("%d\n", d[n]);
		}


	return 0;
}

2
0
35
 2
-1
35
 2
-1
24
 2
-1
43
 2
-1
72
 2
-1
81
 2
-1
61
 2
-1
82
 2
0
82
 2
-1
59

10
1
8436
 10
0
8436
 10
0
2925
 10
0
15180
 10
0
67525
 10
0
95284
 10
0
41664
 10
0
98770
 10
1
98770
 10
0
37820

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()
{
	int a[1001] = {0}, b[2001] = { 0 }, c[3001] = { 0 }, d[4001] = { 0 }, n,i,j;


	
		for (i = 0; i < 1001; i++)
		{
			++a[i];
		}

		for (i = 0; i < 1001; i++)
		{
			for (j = 0; j < 1001; j++)
			{
				b[i + j] += a[i];
			}
		}

		for (i = 0; i < 2001; i++)
		{
			for (j = 0; j < 1001; j++)
			{
				c[i + j] += b[i];
			}
		}

		for (i = 0; i < 3001; i++)
		{
			for (j = 0; j < 1001; j++)
			{
				d[i + j] += c[i];
			}
		}

		while (scanf("%d", &n) != EOF)
		{
			printf("%d\n", d[n]);
		}


	return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d\n"
.LC1:
	.string	"%d"
	.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
	leaq	-36864(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$3216, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-40064(%rbp), %rdx
	movl	$0, %eax
	movl	$500, %ecx
	movq	%rdx, %rdi
	rep stosq
	movq	%rdi, %rdx
	movl	%eax, (%rdx)
	addq	$4, %rdx
	leaq	-36048(%rbp), %rdx
	movl	$0, %eax
	movl	$1000, %ecx
	movq	%rdx, %rdi
	rep stosq
	movq	%rdi, %rdx
	movl	%eax, (%rdx)
	addq	$4, %rdx
	leaq	-28032(%rbp), %rax
	movl	$12004, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	leaq	-16016(%rbp), %rax
	movl	$16004, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, -40072(%rbp)
	jmp	.L2
.L3:
	movl	-40072(%rbp), %eax
	cltq
	movl	-40064(%rbp,%rax,4), %eax
	leal	1(%rax), %edx
	movl	-40072(%rbp), %eax
	cltq
	movl	%edx, -40064(%rbp,%rax,4)
	addl	$1, -40072(%rbp)
.L2:
	cmpl	$1000, -40072(%rbp)
	jle	.L3
	movl	$0, -40072(%rbp)
	jmp	.L4
.L7:
	movl	$0, -40068(%rbp)
	jmp	.L5
.L6:
	movl	-40072(%rbp), %edx
	movl	-40068(%rbp), %eax
	addl	%edx, %eax
	cltq
	movl	-36048(%rbp,%rax,4), %ecx
	movl	-40072(%rbp), %eax
	cltq
	movl	-40064(%rbp,%rax,4), %edx
	movl	-40072(%rbp), %esi
	movl	-40068(%rbp), %eax
	addl	%esi, %eax
	addl	%ecx, %edx
	cltq
	movl	%edx, -36048(%rbp,%rax,4)
	addl	$1, -40068(%rbp)
.L5:
	cmpl	$1000, -40068(%rbp)
	jle	.L6
	addl	$1, -40072(%rbp)
.L4:
	cmpl	$1000, -40072(%rbp)
	jle	.L7
	movl	$0, -40072(%rbp)
	jmp	.L8
.L11:
	movl	$0, -40068(%rbp)
	jmp	.L9
.L10:
	movl	-40072(%rbp), %edx
	movl	-40068(%rbp), %eax
	addl	%edx, %eax
	cltq
	movl	-28032(%rbp,%rax,4), %ecx
	movl	-40072(%rbp), %eax
	cltq
	movl	-36048(%rbp,%rax,4), %edx
	movl	-40072(%rbp), %esi
	movl	-40068(%rbp), %eax
	addl	%esi, %eax
	addl	%ecx, %edx
	cltq
	movl	%edx, -28032(%rbp,%rax,4)
	addl	$1, -40068(%rbp)
.L9:
	cmpl	$1000, -40068(%rbp)
	jle	.L10
	addl	$1, -40072(%rbp)
.L8:
	cmpl	$2000, -40072(%rbp)
	jle	.L11
	movl	$0, -40072(%rbp)
	jmp	.L12
.L15:
	movl	$0, -40068(%rbp)
	jmp	.L13
.L14:
	movl	-40072(%rbp), %edx
	movl	-40068(%rbp), %eax
	addl	%edx, %eax
	cltq
	movl	-16016(%rbp,%rax,4), %ecx
	movl	-40072(%rbp), %eax
	cltq
	movl	-28032(%rbp,%rax,4), %edx
	movl	-40072(%rbp), %esi
	movl	-40068(%rbp), %eax
	addl	%esi, %eax
	addl	%ecx, %edx
	cltq
	movl	%edx, -16016(%rbp,%rax,4)
	addl	$1, -40068(%rbp)
.L13:
	cmpl	$1000, -40068(%rbp)
	jle	.L14
	addl	$1, -40072(%rbp)
.L12:
	cmpl	$3000, -40072(%rbp)
	jle	.L15
	jmp	.L16
.L17:
	movl	-40076(%rbp), %eax
	cltq
	movl	-16016(%rbp,%rax,4), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L16:
	leaq	-40076(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$-1, %eax
	jne	.L17
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L19
	call	__stack_chk_fail@PLT
.L19:
	leave
	.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	"%d\n"
.LC1:
	.string	"%d"
	.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
	leaq	-36864(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$3216, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-40064(%rbp), %rdx
	movl	$0, %eax
	movl	$500, %ecx
	movq	%rdx, %rdi
	rep stosq
	movq	%rdi, %rdx
	movl	%eax, (%rdx)
	addq	$4, %rdx
	leaq	-36048(%rbp), %rdx
	movl	$0, %eax
	movl	$1000, %ecx
	movq	%rdx, %rdi
	rep stosq
	movq	%rdi, %rdx
	movl	%eax, (%rdx)
	addq	$4, %rdx
	leaq	-28032(%rbp), %rax
	movl	$12004, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	leaq	-16016(%rbp), %rax
	movl	$16004, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, -40072(%rbp)
	jmp	.L2
.L3:
	movl	-40072(%rbp), %eax
	cltq
	movl	-40064(%rbp,%rax,4), %eax
	leal	1(%rax), %edx
	movl	-40072(%rbp), %eax
	cltq
	movl	%edx, -40064(%rbp,%rax,4)
	addl	$1, -40072(%rbp)
.L2:
	cmpl	$1000, -40072(%rbp)
	jle	.L3
	movl	$0, -40072(%rbp)
	jmp	.L4
.L7:
	movl	$0, -40068(%rbp)
	jmp	.L5
.L6:
	movl	-40072(%rbp), %edx
	movl	-40068(%rbp), %eax
	addl	%edx, %eax
	cltq
	movl	-36048(%rbp,%rax,4), %ecx
	movl	-40072(%rbp), %eax
	cltq
	movl	-40064(%rbp,%rax,4), %edx
	movl	-40072(%rbp), %esi
	movl	-40068(%rbp), %eax
	addl	%esi, %eax
	addl	%ecx, %edx
	cltq
	movl	%edx, -36048(%rbp,%rax,4)
	addl	$1, -40068(%rbp)
.L5:
	cmpl	$1000, -40068(%rbp)
	jle	.L6
	addl	$1, -40072(%rbp)
.L4:
	cmpl	$1000, -40072(%rbp)
	jle	.L7
	movl	$0, -40072(%rbp)
	jmp	.L8
.L11:
	movl	$0, -40068(%rbp)
	jmp	.L9
.L10:
	movl	-40072(%rbp), %edx
	movl	-40068(%rbp), %eax
	addl	%edx, %eax
	cltq
	movl	-28032(%rbp,%rax,4), %ecx
	movl	-40072(%rbp), %eax
	cltq
	movl	-36048(%rbp,%rax,4), %edx
	movl	-40072(%rbp), %esi
	movl	-40068(%rbp), %eax
	addl	%esi, %eax
	addl	%ecx, %edx
	cltq
	movl	%edx, -28032(%rbp,%rax,4)
	addl	$1, -40068(%rbp)
.L9:
	cmpl	$1000, -40068(%rbp)
	jle	.L10
	addl	$1, -40072(%rbp)
.L8:
	cmpl	$2000, -40072(%rbp)
	jle	.L11
	movl	$0, -40072(%rbp)
	jmp	.L12
.L15:
	movl	$0, -40068(%rbp)
	jmp	.L13
.L14:
	movl	-40072(%rbp), %edx
	movl	-40068(%rbp), %eax
	addl	%edx, %eax
	cltq
	movl	-16016(%rbp,%rax,4), %ecx
	movl	-40072(%rbp), %eax
	cltq
	movl	-28032(%rbp,%rax,4), %edx
	movl	-40072(%rbp), %esi
	movl	-40068(%rbp), %eax
	addl	%esi, %eax
	addl	%ecx, %edx
	cltq
	movl	%edx, -16016(%rbp,%rax,4)
	addl	$1, -40068(%rbp)
.L13:
	cmpl	$1000, -40068(%rbp)
	jle	.L14
	addl	$1, -40072(%rbp)
.L12:
	cmpl	$3000, -40072(%rbp)
	jle	.L15
	jmp	.L16
.L17:
	movl	-40076(%rbp), %eax
	cltq
	movl	-16016(%rbp,%rax,4), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L16:
	leaq	-40076(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$-1, %eax
	jne	.L17
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L19
	call	__stack_chk_fail@PLT
.L19:
	leave
	.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:
