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>
#include<stdlib.h>

int main(void)
{
    int n,m,query,l[200000],r[200000],p[100000],q[100000],arr[501][501]={0},i,j,k,ans;

    scanf("%d %d %d",&n,&m,&query);
    for ( i = 0; i < m; i++)
    {
        scanf("%d %d",l+i,r+i);
        arr[l[i]][r[i]]++;
    }
    for ( j = 0; j < query; j++)
    {
        scanf("%d %d",p+j,q+j);
    }

    for ( i = 0; i <= 500; i++)
    {
        for ( j = 1; j <= 500 ; j++)
        {
            arr[i][j]+=arr[i][j-1];
        }
    }

    for ( k = 0; k < query; k++)
    {
        ans=0;
        for ( i = p[k]; i <= q[k]; i++)
        {
            ans+=arr[i][q[k]]-arr[i][p[k]-1];
        }
        printf("%d\n",ans);
    }

    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d %d %d"
.LC1:
	.string	"%d %d"
.LC2:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	leaq	-3403776(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$272, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-1004016(%rbp), %rax
	movl	$1004004, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	leaq	-3404036(%rbp), %rcx
	leaq	-3404040(%rbp), %rdx
	leaq	-3404044(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -3404032(%rbp)
	jmp	.L2
.L3:
	movl	-3404032(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	-1804016(%rbp), %rax
	addq	%rax, %rdx
	movl	-3404032(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	-2604016(%rbp), %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-3404032(%rbp), %eax
	cltq
	movl	-2604016(%rbp,%rax,4), %eax
	movl	-3404032(%rbp), %edx
	movslq	%edx, %rdx
	movl	-1804016(%rbp,%rdx,4), %edx
	movslq	%edx, %rsi
	movslq	%eax, %rcx
	imulq	$501, %rcx, %rcx
	addq	%rsi, %rcx
	movl	-1004016(%rbp,%rcx,4), %ecx
	addl	$1, %ecx
	movslq	%edx, %rdx
	cltq
	imulq	$501, %rax, %rax
	addq	%rdx, %rax
	movl	%ecx, -1004016(%rbp,%rax,4)
	addl	$1, -3404032(%rbp)
.L2:
	movl	-3404040(%rbp), %eax
	cmpl	%eax, -3404032(%rbp)
	jl	.L3
	movl	$0, -3404028(%rbp)
	jmp	.L4
.L5:
	movl	-3404028(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	-3004016(%rbp), %rax
	addq	%rax, %rdx
	movl	-3404028(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	-3404016(%rbp), %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -3404028(%rbp)
.L4:
	movl	-3404036(%rbp), %eax
	cmpl	%eax, -3404028(%rbp)
	jl	.L5
	movl	$0, -3404032(%rbp)
	jmp	.L6
.L9:
	movl	$1, -3404028(%rbp)
	jmp	.L7
.L8:
	movl	-3404028(%rbp), %eax
	movslq	%eax, %rdx
	movl	-3404032(%rbp), %eax
	cltq
	imulq	$501, %rax, %rax
	addq	%rdx, %rax
	movl	-1004016(%rbp,%rax,4), %edx
	movl	-3404028(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rcx
	movl	-3404032(%rbp), %eax
	cltq
	imulq	$501, %rax, %rax
	addq	%rcx, %rax
	movl	-1004016(%rbp,%rax,4), %eax
	addl	%eax, %edx
	movl	-3404028(%rbp), %eax
	movslq	%eax, %rcx
	movl	-3404032(%rbp), %eax
	cltq
	imulq	$501, %rax, %rax
	addq	%rcx, %rax
	movl	%edx, -1004016(%rbp,%rax,4)
	addl	$1, -3404028(%rbp)
.L7:
	cmpl	$500, -3404028(%rbp)
	jle	.L8
	addl	$1, -3404032(%rbp)
.L6:
	cmpl	$500, -3404032(%rbp)
	jle	.L9
	movl	$0, -3404024(%rbp)
	jmp	.L10
.L13:
	movl	$0, -3404020(%rbp)
	movl	-3404024(%rbp), %eax
	cltq
	movl	-3404016(%rbp,%rax,4), %eax
	movl	%eax, -3404032(%rbp)
	jmp	.L11
.L12:
	movl	-3404024(%rbp), %eax
	cltq
	movl	-3004016(%rbp,%rax,4), %eax
	movslq	%eax, %rdx
	movl	-3404032(%rbp), %eax
	cltq
	imulq	$501, %rax, %rax
	addq	%rdx, %rax
	movl	-1004016(%rbp,%rax,4), %edx
	movl	-3404024(%rbp), %eax
	cltq
	movl	-3404016(%rbp,%rax,4), %eax
	subl	$1, %eax
	movslq	%eax, %rcx
	movl	-3404032(%rbp), %eax
	cltq
	imulq	$501, %rax, %rax
	addq	%rcx, %rax
	movl	-1004016(%rbp,%rax,4), %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	addl	%eax, -3404020(%rbp)
	addl	$1, -3404032(%rbp)
.L11:
	movl	-3404024(%rbp), %eax
	cltq
	movl	-3004016(%rbp,%rax,4), %eax
	cmpl	%eax, -3404032(%rbp)
	jle	.L12
	movl	-3404020(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -3404024(%rbp)
.L10:
	movl	-3404036(%rbp), %eax
	cmpl	%eax, -3404024(%rbp)
	jl	.L13
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L15
	call	__stack_chk_fail@PLT
.L15:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.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	"%d %d %d"
.LC1:
	.string	"%d %d"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	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
	leaq	-3403776(%rsp), %r11
	.cfi_def_cfa 11, 3403832
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$264, %rsp
	.cfi_def_cfa_offset 3404096
	movl	$1004004, %edx
	xorl	%esi, %esi
	movq	%fs:40, %rax
	movq	%rax, 3404024(%rsp)
	xorl	%eax, %eax
	leaq	2400016(%rsp), %rbx
	movq	%rbx, %rdi
	call	memset@PLT
	leaq	12(%rsp), %rcx
	xorl	%eax, %eax
	leaq	8(%rsp), %rdx
	leaq	4(%rsp), %rsi
	leaq	.LC0(%rip), %rdi
	call	__isoc99_scanf@PLT
	movl	8(%rsp), %eax
	testl	%eax, %eax
	jle	.L6
	leaq	800016(%rsp), %r12
	xorl	%ebp, %ebp
	leaq	1600016(%rsp), %r13
	leaq	.LC1(%rip), %r14
.L5:
	leaq	0(%r13,%rbp,4), %rdx
	movq	%r12, %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	(%r12), %rax
	movslq	0(%r13,%rbp,4), %rdx
	addq	$4, %r12
	addq	$1, %rbp
	imulq	$501, %rax, %rax
	addq	%rdx, %rax
	addl	$1, 2400016(%rsp,%rax,4)
	cmpl	%ebp, 8(%rsp)
	jg	.L5
.L6:
	movl	12(%rsp), %edi
	testl	%edi, %edi
	jle	.L4
	leaq	16(%rsp), %r12
	xorl	%ebp, %ebp
	leaq	.LC1(%rip), %r14
	leaq	400016(%rsp), %r13
.L7:
	leaq	0(%r13,%rbp,4), %rdx
	movq	%r12, %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %edi
	addq	$1, %rbp
	addq	$4, %r12
	cmpl	%ebp, %edi
	jg	.L7
.L4:
	leaq	2402020(%rsp), %rbp
	leaq	3406024(%rsp), %rsi
	movq	%rbp, %rcx
.L9:
	movl	-2004(%rcx), %edx
	leaq	-2000(%rcx), %rax
	.p2align 4,,10
	.p2align 3
.L8:
	addl	(%rax), %edx
	addq	$4, %rax
	movl	%edx, -4(%rax)
	cmpq	%rcx, %rax
	jne	.L8
	leaq	2004(%rax), %rcx
	cmpq	%rsi, %rcx
	jne	.L9
	testl	%edi, %edi
	jle	.L13
	xorl	%r12d, %r12d
	leaq	16(%rsp), %r14
	leaq	400016(%rsp), %r13
	leaq	.LC2(%rip), %r15
.L10:
	movl	(%r14,%r12,4), %edi
	movl	0(%r13,%r12,4), %edx
	cmpl	%edi, %edx
	jl	.L16
	movslq	%edx, %rsi
	movslq	%edi, %r8
	leal	-1(%rdi), %ecx
	subl	%edi, %edx
	addq	%r8, %rdx
	imulq	$501, %r8, %rax
	movslq	%ecx, %rcx
	imulq	$501, %rdx, %rdx
	subq	%rsi, %rcx
	addq	%rsi, %rax
	addq	%rsi, %rdx
	leaq	(%rbx,%rax,4), %rax
	leaq	0(%rbp,%rdx,4), %rdi
	xorl	%edx, %edx
.L12:
	addl	(%rax), %edx
	subl	(%rax,%rcx,4), %edx
	addq	$2004, %rax
	cmpq	%rax, %rdi
	jne	.L12
.L11:
	movq	%r15, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addq	$1, %r12
	call	__printf_chk@PLT
	cmpl	%r12d, 12(%rsp)
	jg	.L10
.L13:
	movq	3404024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L26
	addq	$3404040, %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
.L16:
	.cfi_restore_state
	xorl	%edx, %edx
	jmp	.L11
.L26:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE39:
	.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	"%d %d %d"
.LC1:
	.string	"%d %d"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	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
	leaq	-3403776(%rsp), %r11
	.cfi_def_cfa 11, 3403832
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$264, %rsp
	.cfi_def_cfa_offset 3404096
	movl	$1004004, %edx
	xorl	%esi, %esi
	movq	%fs:40, %rax
	movq	%rax, 3404024(%rsp)
	xorl	%eax, %eax
	leaq	2400016(%rsp), %rbx
	movq	%rbx, %rdi
	call	memset@PLT
	leaq	12(%rsp), %rcx
	xorl	%eax, %eax
	leaq	8(%rsp), %rdx
	leaq	4(%rsp), %rsi
	leaq	.LC0(%rip), %rdi
	call	__isoc99_scanf@PLT
	movl	8(%rsp), %eax
	testl	%eax, %eax
	jle	.L6
	leaq	800016(%rsp), %r12
	xorl	%ebp, %ebp
	leaq	1600016(%rsp), %r13
	leaq	.LC1(%rip), %r14
.L5:
	leaq	0(%r13,%rbp,4), %rdx
	movq	%r12, %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	(%r12), %rax
	movslq	0(%r13,%rbp,4), %rdx
	addq	$4, %r12
	addq	$1, %rbp
	imulq	$501, %rax, %rax
	addq	%rdx, %rax
	addl	$1, 2400016(%rsp,%rax,4)
	cmpl	%ebp, 8(%rsp)
	jg	.L5
.L6:
	movl	12(%rsp), %edi
	testl	%edi, %edi
	jle	.L4
	leaq	16(%rsp), %r12
	xorl	%ebp, %ebp
	leaq	.LC1(%rip), %r14
	leaq	400016(%rsp), %r13
.L7:
	leaq	0(%r13,%rbp,4), %rdx
	movq	%r12, %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %edi
	addq	$1, %rbp
	addq	$4, %r12
	cmpl	%ebp, %edi
	jg	.L7
.L4:
	leaq	2402020(%rsp), %rbp
	leaq	3406024(%rsp), %rsi
	movq	%rbp, %rcx
.L9:
	movl	-2004(%rcx), %edx
	leaq	-2000(%rcx), %rax
	.p2align 4,,10
	.p2align 3
.L8:
	addl	(%rax), %edx
	addq	$4, %rax
	movl	%edx, -4(%rax)
	cmpq	%rcx, %rax
	jne	.L8
	leaq	2004(%rax), %rcx
	cmpq	%rsi, %rcx
	jne	.L9
	testl	%edi, %edi
	jle	.L13
	xorl	%r12d, %r12d
	leaq	16(%rsp), %r14
	leaq	400016(%rsp), %r13
	leaq	.LC2(%rip), %r15
.L10:
	movl	(%r14,%r12,4), %edi
	movl	0(%r13,%r12,4), %edx
	cmpl	%edi, %edx
	jl	.L16
	movslq	%edx, %rsi
	movslq	%edi, %r8
	leal	-1(%rdi), %ecx
	subl	%edi, %edx
	addq	%r8, %rdx
	imulq	$501, %r8, %rax
	movslq	%ecx, %rcx
	imulq	$501, %rdx, %rdx
	subq	%rsi, %rcx
	addq	%rsi, %rax
	addq	%rsi, %rdx
	leaq	(%rbx,%rax,4), %rax
	leaq	0(%rbp,%rdx,4), %rdi
	xorl	%edx, %edx
.L12:
	addl	(%rax), %edx
	subl	(%rax,%rcx,4), %edx
	addq	$2004, %rax
	cmpq	%rax, %rdi
	jne	.L12
.L11:
	movq	%r15, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addq	$1, %r12
	call	__printf_chk@PLT
	cmpl	%r12d, 12(%rsp)
	jg	.L10
.L13:
	movq	3404024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L26
	addq	$3404040, %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
.L16:
	.cfi_restore_state
	xorl	%edx, %edx
	jmp	.L11
.L26:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE39:
	.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>
#include<stdlib.h>

int main(void)
{
    int n,m,query,l[200000],r[200000],p[100000],q[100000],arr[501][501]={0},i,j,k,ans;

    scanf("%d %d %d",&n,&m,&query);
    for ( i = 0; i < m; i++)
    {
        scanf("%d %d",l+i,r+i);
        arr[l[i]][r[i]]++;
    }
    for ( j = 0; j < query; j++)
    {
        scanf("%d %d",p+j,q+j);
    }

    for ( i = 0; i <= 500; i++)
    {
        for ( j = 1; j <= 500 ; j++)
        {
            arr[i][j]+=arr[i][j-1];
        }
    }

    for ( k = 0; k < query; k++)
    {
        ans=0;
        for ( i = p[k]; i <= q[k]; i++)
        {
            ans+=arr[i][q[k]]-arr[i][p[k]-1];
        }
        printf("%d\n",ans);
    }

    return 0;
}
10 3 2
1 5
2 8
7 10
1 7
3 3
 10 3 2
1 10
2 8
7 10
1 7
3 10
 10 10 10
1 6
2 9
4 5
4 7
4 7
5 8
6 6
6 7
7 9
10 10
1 8
1 9
1 10
2 8
2 7
2 10
3 8
3 9
3 10
1 10
 10 3 2
1 5
2 8
7 10
1 2
3 3
 10 3 2
1 10
3 8
7 10
1 7
3 10
 10 3 2
1 10
5 8
7 10
1 10
3 10
 10 3 2
1 5
2 8
7 10
1 7
5 10
 10 10 10
1 6
2 9
4 5
4 7
4 7
5 8
6 6
6 7
7 9
10 10
1 8
1 9
1 10
2 8
2 7
2 10
3 8
3 9
3 10
2 10
 10 10 10
1 6
2 9
4 5
1 7
4 7
5 8
6 6
6 7
7 9
10 10
1 8
1 9
1 10
2 8
2 7
2 10
3 8
3 9
3 10
2 10
 10 3 1
1 5
2 8
0 10
1 2
3 3

1
0
 0
1
 7
9
10
6
5
9
6
7
8
10
 0
0
 0
2
 3
2
 1
1
 7
9
10
6
5
9
6
7
8
9
 7
9
10
5
4
8
5
6
7
8
 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>
#include<stdlib.h>

int main(void)
{
    int n,m,query,l[200000],r[200000],p[100000],q[100000],arr[501][501]={0},i,j,k,ans;

    scanf("%d %d %d",&n,&m,&query);
    for ( i = 0; i < m; i++)
    {
        scanf("%d %d",l+i,r+i);
        arr[l[i]][r[i]]++;
    }
    for ( j = 0; j < query; j++)
    {
        scanf("%d %d",p+j,q+j);
    }

    for ( i = 0; i <= 500; i++)
    {
        for ( j = 1; j <= 500 ; j++)
        {
            arr[i][j]+=arr[i][j-1];
        }
    }

    for ( k = 0; k < query; k++)
    {
        ans=0;
        for ( i = p[k]; i <= q[k]; i++)
        {
            ans+=arr[i][q[k]]-arr[i][p[k]-1];
        }
        printf("%d\n",ans);
    }

    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d %d %d"
.LC1:
	.string	"%d %d"
.LC2:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	leaq	-3403776(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$272, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-1004016(%rbp), %rax
	movl	$1004004, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	leaq	-3404036(%rbp), %rcx
	leaq	-3404040(%rbp), %rdx
	leaq	-3404044(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -3404032(%rbp)
	jmp	.L2
.L3:
	movl	-3404032(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	-1804016(%rbp), %rax
	addq	%rax, %rdx
	movl	-3404032(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	-2604016(%rbp), %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-3404032(%rbp), %eax
	cltq
	movl	-2604016(%rbp,%rax,4), %eax
	movl	-3404032(%rbp), %edx
	movslq	%edx, %rdx
	movl	-1804016(%rbp,%rdx,4), %edx
	movslq	%edx, %rsi
	movslq	%eax, %rcx
	imulq	$501, %rcx, %rcx
	addq	%rsi, %rcx
	movl	-1004016(%rbp,%rcx,4), %ecx
	addl	$1, %ecx
	movslq	%edx, %rdx
	cltq
	imulq	$501, %rax, %rax
	addq	%rdx, %rax
	movl	%ecx, -1004016(%rbp,%rax,4)
	addl	$1, -3404032(%rbp)
.L2:
	movl	-3404040(%rbp), %eax
	cmpl	%eax, -3404032(%rbp)
	jl	.L3
	movl	$0, -3404028(%rbp)
	jmp	.L4
.L5:
	movl	-3404028(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	-3004016(%rbp), %rax
	addq	%rax, %rdx
	movl	-3404028(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	-3404016(%rbp), %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -3404028(%rbp)
.L4:
	movl	-3404036(%rbp), %eax
	cmpl	%eax, -3404028(%rbp)
	jl	.L5
	movl	$0, -3404032(%rbp)
	jmp	.L6
.L9:
	movl	$1, -3404028(%rbp)
	jmp	.L7
.L8:
	movl	-3404028(%rbp), %eax
	movslq	%eax, %rdx
	movl	-3404032(%rbp), %eax
	cltq
	imulq	$501, %rax, %rax
	addq	%rdx, %rax
	movl	-1004016(%rbp,%rax,4), %edx
	movl	-3404028(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rcx
	movl	-3404032(%rbp), %eax
	cltq
	imulq	$501, %rax, %rax
	addq	%rcx, %rax
	movl	-1004016(%rbp,%rax,4), %eax
	addl	%eax, %edx
	movl	-3404028(%rbp), %eax
	movslq	%eax, %rcx
	movl	-3404032(%rbp), %eax
	cltq
	imulq	$501, %rax, %rax
	addq	%rcx, %rax
	movl	%edx, -1004016(%rbp,%rax,4)
	addl	$1, -3404028(%rbp)
.L7:
	cmpl	$500, -3404028(%rbp)
	jle	.L8
	addl	$1, -3404032(%rbp)
.L6:
	cmpl	$500, -3404032(%rbp)
	jle	.L9
	movl	$0, -3404024(%rbp)
	jmp	.L10
.L13:
	movl	$0, -3404020(%rbp)
	movl	-3404024(%rbp), %eax
	cltq
	movl	-3404016(%rbp,%rax,4), %eax
	movl	%eax, -3404032(%rbp)
	jmp	.L11
.L12:
	movl	-3404024(%rbp), %eax
	cltq
	movl	-3004016(%rbp,%rax,4), %eax
	movslq	%eax, %rdx
	movl	-3404032(%rbp), %eax
	cltq
	imulq	$501, %rax, %rax
	addq	%rdx, %rax
	movl	-1004016(%rbp,%rax,4), %edx
	movl	-3404024(%rbp), %eax
	cltq
	movl	-3404016(%rbp,%rax,4), %eax
	subl	$1, %eax
	movslq	%eax, %rcx
	movl	-3404032(%rbp), %eax
	cltq
	imulq	$501, %rax, %rax
	addq	%rcx, %rax
	movl	-1004016(%rbp,%rax,4), %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	addl	%eax, -3404020(%rbp)
	addl	$1, -3404032(%rbp)
.L11:
	movl	-3404024(%rbp), %eax
	cltq
	movl	-3004016(%rbp,%rax,4), %eax
	cmpl	%eax, -3404032(%rbp)
	jle	.L12
	movl	-3404020(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -3404024(%rbp)
.L10:
	movl	-3404036(%rbp), %eax
	cmpl	%eax, -3404024(%rbp)
	jl	.L13
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L15
	call	__stack_chk_fail@PLT
.L15:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.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 %d %d"
.LC1:
	.string	"%d %d"
.LC2:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	leaq	-3403776(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$272, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-1004016(%rbp), %rax
	movl	$1004004, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	leaq	-3404036(%rbp), %rcx
	leaq	-3404040(%rbp), %rdx
	leaq	-3404044(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -3404032(%rbp)
	jmp	.L2
.L3:
	movl	-3404032(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	-1804016(%rbp), %rax
	addq	%rax, %rdx
	movl	-3404032(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	-2604016(%rbp), %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-3404032(%rbp), %eax
	cltq
	movl	-2604016(%rbp,%rax,4), %eax
	movl	-3404032(%rbp), %edx
	movslq	%edx, %rdx
	movl	-1804016(%rbp,%rdx,4), %edx
	movslq	%edx, %rsi
	movslq	%eax, %rcx
	imulq	$501, %rcx, %rcx
	addq	%rsi, %rcx
	movl	-1004016(%rbp,%rcx,4), %ecx
	addl	$1, %ecx
	movslq	%edx, %rdx
	cltq
	imulq	$501, %rax, %rax
	addq	%rdx, %rax
	movl	%ecx, -1004016(%rbp,%rax,4)
	addl	$1, -3404032(%rbp)
.L2:
	movl	-3404040(%rbp), %eax
	cmpl	%eax, -3404032(%rbp)
	jl	.L3
	movl	$0, -3404028(%rbp)
	jmp	.L4
.L5:
	movl	-3404028(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	-3004016(%rbp), %rax
	addq	%rax, %rdx
	movl	-3404028(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	-3404016(%rbp), %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -3404028(%rbp)
.L4:
	movl	-3404036(%rbp), %eax
	cmpl	%eax, -3404028(%rbp)
	jl	.L5
	movl	$0, -3404032(%rbp)
	jmp	.L6
.L9:
	movl	$1, -3404028(%rbp)
	jmp	.L7
.L8:
	movl	-3404028(%rbp), %eax
	movslq	%eax, %rdx
	movl	-3404032(%rbp), %eax
	cltq
	imulq	$501, %rax, %rax
	addq	%rdx, %rax
	movl	-1004016(%rbp,%rax,4), %edx
	movl	-3404028(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rcx
	movl	-3404032(%rbp), %eax
	cltq
	imulq	$501, %rax, %rax
	addq	%rcx, %rax
	movl	-1004016(%rbp,%rax,4), %eax
	addl	%eax, %edx
	movl	-3404028(%rbp), %eax
	movslq	%eax, %rcx
	movl	-3404032(%rbp), %eax
	cltq
	imulq	$501, %rax, %rax
	addq	%rcx, %rax
	movl	%edx, -1004016(%rbp,%rax,4)
	addl	$1, -3404028(%rbp)
.L7:
	cmpl	$500, -3404028(%rbp)
	jle	.L8
	addl	$1, -3404032(%rbp)
.L6:
	cmpl	$500, -3404032(%rbp)
	jle	.L9
	movl	$0, -3404024(%rbp)
	jmp	.L10
.L13:
	movl	$0, -3404020(%rbp)
	movl	-3404024(%rbp), %eax
	cltq
	movl	-3404016(%rbp,%rax,4), %eax
	movl	%eax, -3404032(%rbp)
	jmp	.L11
.L12:
	movl	-3404024(%rbp), %eax
	cltq
	movl	-3004016(%rbp,%rax,4), %eax
	movslq	%eax, %rdx
	movl	-3404032(%rbp), %eax
	cltq
	imulq	$501, %rax, %rax
	addq	%rdx, %rax
	movl	-1004016(%rbp,%rax,4), %edx
	movl	-3404024(%rbp), %eax
	cltq
	movl	-3404016(%rbp,%rax,4), %eax
	subl	$1, %eax
	movslq	%eax, %rcx
	movl	-3404032(%rbp), %eax
	cltq
	imulq	$501, %rax, %rax
	addq	%rcx, %rax
	movl	-1004016(%rbp,%rax,4), %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	addl	%eax, -3404020(%rbp)
	addl	$1, -3404032(%rbp)
.L11:
	movl	-3404024(%rbp), %eax
	cltq
	movl	-3004016(%rbp,%rax,4), %eax
	cmpl	%eax, -3404032(%rbp)
	jle	.L12
	movl	-3404020(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -3404024(%rbp)
.L10:
	movl	-3404036(%rbp), %eax
	cmpl	%eax, -3404024(%rbp)
	jl	.L13
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L15
	call	__stack_chk_fail@PLT
.L15:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.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:
