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 a[10000],b[10000];
int main(void)
{
	int n,m,f[501]={0},z,i;
	scanf("%d",&n);
	scanf("%d",&m);
        while(n!=0&&m!=0){
	for(i=0;i<501;i++){
        f[i]=0;
        z=0;
	}
	for(i=0;i<m;i++){
		scanf("%d %d",&a[i],&b[i]);
	}
	for(i=0;i<m;i++){
	if(1==a[i]){
		f[b[i]]=1;
		f[a[i]]=1;
		z=z+1;
	}
	}
	for(i=0;i<m;i++){
	if(f[a[i]]==1 && f[b[i]]==0){
		f[b[i]]=2;
		z=z+1;
	}
	if(f[a[i]]==0 && f[b[i]]==1){
		f[a[i]]=2;
		z=z+1;
	}
	}
	printf("%d\n",z);
scanf("%d %d",&n,&m);
}
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 40000
a:
	.zero	40000
	.globl	b
	.align 32
	.type	b, @object
	.size	b, 40000
b:
	.zero	40000
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d %d"
.LC2:
	.string	"%d\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
	subq	$2032, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-2016(%rbp), %rdx
	movl	$0, %eax
	movl	$250, %ecx
	movq	%rdx, %rdi
	rep stosq
	movq	%rdi, %rdx
	movl	%eax, (%rdx)
	addq	$4, %rdx
	leaq	-2032(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-2028(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	jmp	.L2
.L15:
	movl	$0, -2020(%rbp)
	jmp	.L3
.L4:
	movl	-2020(%rbp), %eax
	cltq
	movl	$0, -2016(%rbp,%rax,4)
	movl	$0, -2024(%rbp)
	addl	$1, -2020(%rbp)
.L3:
	cmpl	$500, -2020(%rbp)
	jle	.L4
	movl	$0, -2020(%rbp)
	jmp	.L5
.L6:
	movl	-2020(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	b(%rip), %rax
	addq	%rax, %rdx
	movl	-2020(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	a(%rip), %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -2020(%rbp)
.L5:
	movl	-2028(%rbp), %eax
	cmpl	%eax, -2020(%rbp)
	jl	.L6
	movl	$0, -2020(%rbp)
	jmp	.L7
.L9:
	movl	-2020(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$1, %eax
	jne	.L8
	movl	-2020(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	b(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	movl	$1, -2016(%rbp,%rax,4)
	movl	-2020(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	movl	$1, -2016(%rbp,%rax,4)
	addl	$1, -2024(%rbp)
.L8:
	addl	$1, -2020(%rbp)
.L7:
	movl	-2028(%rbp), %eax
	cmpl	%eax, -2020(%rbp)
	jl	.L9
	movl	$0, -2020(%rbp)
	jmp	.L10
.L13:
	movl	-2020(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	movl	-2016(%rbp,%rax,4), %eax
	cmpl	$1, %eax
	jne	.L11
	movl	-2020(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	b(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	movl	-2016(%rbp,%rax,4), %eax
	testl	%eax, %eax
	jne	.L11
	movl	-2020(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	b(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	movl	$2, -2016(%rbp,%rax,4)
	addl	$1, -2024(%rbp)
.L11:
	movl	-2020(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	movl	-2016(%rbp,%rax,4), %eax
	testl	%eax, %eax
	jne	.L12
	movl	-2020(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	b(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	movl	-2016(%rbp,%rax,4), %eax
	cmpl	$1, %eax
	jne	.L12
	movl	-2020(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	movl	$2, -2016(%rbp,%rax,4)
	addl	$1, -2024(%rbp)
.L12:
	addl	$1, -2020(%rbp)
.L10:
	movl	-2028(%rbp), %eax
	cmpl	%eax, -2020(%rbp)
	jl	.L13
	movl	-2024(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	leaq	-2028(%rbp), %rdx
	leaq	-2032(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
.L2:
	movl	-2032(%rbp), %eax
	testl	%eax, %eax
	je	.L14
	movl	-2028(%rbp), %eax
	testl	%eax, %eax
	jne	.L15
.L14:
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L17
	call	__stack_chk_fail@PLT
.L17:
	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
.LC0:
	.string	"%d"
.LC1:
	.string	"%d %d"
.LC2:
	.string	"%d\n"
	.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
	movl	$250, %ecx
	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
	leaq	.LC0(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	b(%rip), %rbx
	subq	$2072, %rsp
	.cfi_def_cfa_offset 2128
	movq	%fs:40, %rax
	movq	%rax, 2056(%rsp)
	xorl	%eax, %eax
	leaq	48(%rsp), %rdi
	movq	%rdi, 24(%rsp)
	rep stosq
	leaq	40(%rsp), %rax
	movq	%rax, %rsi
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	movl	$0, (%rdi)
	movq	%rbp, %rdi
	call	__isoc99_scanf@PLT
	leaq	44(%rsp), %rax
	movq	%rbp, %rdi
	leaq	.LC1(%rip), %rbp
	movq	%rax, %rsi
	movq	%rax, 16(%rsp)
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	40(%rsp), %esi
	testl	%esi, %esi
	je	.L10
	.p2align 4,,10
	.p2align 3
.L2:
	movl	44(%rsp), %eax
	testl	%eax, %eax
	je	.L10
	movq	24(%rsp), %rdi
	movl	$250, %ecx
	movl	$0, %eax
	rep stosq
	movl	$0, (%rdi)
	jle	.L3
	leaq	a(%rip), %r14
	xorl	%r15d, %r15d
	movq	%r14, %r12
	.p2align 4,,10
	.p2align 3
.L4:
	leaq	(%rbx,%r15,4), %rdx
	movq	%r12, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	44(%rsp), %eax
	addq	$1, %r15
	addq	$4, %r12
	leaq	b(%rip), %r13
	cmpl	%r15d, %eax
	jg	.L4
	testl	%eax, %eax
	jle	.L3
	leal	-1(%rax), %edi
	movl	%eax, %edx
	xorl	%r8d, %r8d
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L6:
	leaq	a(%rip), %rcx
	cmpl	$1, (%rcx,%rax,4)
	jne	.L5
	movslq	(%rbx,%rax,4), %rcx
	addl	$1, %r8d
	movl	$1, 48(%rsp,%rcx,4)
	movl	$1, 52(%rsp)
.L5:
	addq	$1, %rax
	cmpq	%rdx, %rax
	jne	.L6
	leaq	4+a(%rip), %rax
	leaq	(%rax,%rdi,4), %rsi
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L7:
	testl	%eax, %eax
	jne	.L8
	movslq	0(%r13), %rax
	cmpl	$1, 48(%rsp,%rax,4)
	jne	.L8
	movl	$2, 48(%rsp,%rdx,4)
	addl	$1, %r8d
.L8:
	addq	$4, %r14
	addq	$4, %r13
	cmpq	%r14, %rsi
	je	.L12
.L9:
	movslq	(%r14), %rdx
	movl	48(%rsp,%rdx,4), %eax
	cmpl	$1, %eax
	jne	.L7
	movslq	0(%r13), %rax
	movl	48(%rsp,%rax,4), %ecx
	testl	%ecx, %ecx
	jne	.L8
	addq	$4, %r14
	movl	$2, 48(%rsp,%rax,4)
	addl	$1, %r8d
	addq	$4, %r13
	cmpq	%r14, %rsi
	jne	.L9
.L12:
	movl	%r8d, %edx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	16(%rsp), %rdx
	movq	%rbp, %rdi
	xorl	%eax, %eax
	movq	8(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	40(%rsp), %edx
	testl	%edx, %edx
	jne	.L2
.L10:
	movq	2056(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L23
	addq	$2072, %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
.L3:
	.cfi_restore_state
	xorl	%r8d, %r8d
	jmp	.L12
.L23:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	b
	.bss
	.align 32
	.type	b, @object
	.size	b, 40000
b:
	.zero	40000
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 40000
a:
	.zero	40000
	.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"
.LC1:
	.string	"%d %d"
.LC2:
	.string	"%d\n"
	.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
	movl	$250, %ecx
	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
	leaq	.LC0(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	b(%rip), %rbx
	subq	$2072, %rsp
	.cfi_def_cfa_offset 2128
	movq	%fs:40, %rax
	movq	%rax, 2056(%rsp)
	xorl	%eax, %eax
	leaq	48(%rsp), %rdi
	movq	%rdi, 24(%rsp)
	rep stosq
	leaq	40(%rsp), %rax
	movq	%rax, %rsi
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	movl	$0, (%rdi)
	movq	%rbp, %rdi
	call	__isoc99_scanf@PLT
	leaq	44(%rsp), %rax
	movq	%rbp, %rdi
	leaq	.LC1(%rip), %rbp
	movq	%rax, %rsi
	movq	%rax, 16(%rsp)
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	40(%rsp), %esi
	testl	%esi, %esi
	je	.L10
	.p2align 4,,10
	.p2align 3
.L2:
	movl	44(%rsp), %eax
	testl	%eax, %eax
	je	.L10
	movq	24(%rsp), %rdi
	movl	$250, %ecx
	movl	$0, %eax
	rep stosq
	movl	$0, (%rdi)
	jle	.L3
	leaq	a(%rip), %r14
	xorl	%r15d, %r15d
	movq	%r14, %r12
	.p2align 4,,10
	.p2align 3
.L4:
	leaq	(%rbx,%r15,4), %rdx
	movq	%r12, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	44(%rsp), %eax
	addq	$1, %r15
	addq	$4, %r12
	leaq	b(%rip), %r13
	cmpl	%r15d, %eax
	jg	.L4
	testl	%eax, %eax
	jle	.L3
	leal	-1(%rax), %edi
	movl	%eax, %edx
	xorl	%r8d, %r8d
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L6:
	leaq	a(%rip), %rcx
	cmpl	$1, (%rcx,%rax,4)
	jne	.L5
	movslq	(%rbx,%rax,4), %rcx
	addl	$1, %r8d
	movl	$1, 48(%rsp,%rcx,4)
	movl	$1, 52(%rsp)
.L5:
	addq	$1, %rax
	cmpq	%rdx, %rax
	jne	.L6
	leaq	4+a(%rip), %rax
	leaq	(%rax,%rdi,4), %rsi
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L7:
	testl	%eax, %eax
	jne	.L8
	movslq	0(%r13), %rax
	cmpl	$1, 48(%rsp,%rax,4)
	jne	.L8
	movl	$2, 48(%rsp,%rdx,4)
	addl	$1, %r8d
.L8:
	addq	$4, %r14
	addq	$4, %r13
	cmpq	%r14, %rsi
	je	.L12
.L9:
	movslq	(%r14), %rdx
	movl	48(%rsp,%rdx,4), %eax
	cmpl	$1, %eax
	jne	.L7
	movslq	0(%r13), %rax
	movl	48(%rsp,%rax,4), %ecx
	testl	%ecx, %ecx
	jne	.L8
	addq	$4, %r14
	movl	$2, 48(%rsp,%rax,4)
	addl	$1, %r8d
	addq	$4, %r13
	cmpq	%r14, %rsi
	jne	.L9
.L12:
	movl	%r8d, %edx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	16(%rsp), %rdx
	movq	%rbp, %rdi
	xorl	%eax, %eax
	movq	8(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	40(%rsp), %edx
	testl	%edx, %edx
	jne	.L2
.L10:
	movq	2056(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L23
	addq	$2072, %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
.L3:
	.cfi_restore_state
	xorl	%r8d, %r8d
	jmp	.L12
.L23:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	b
	.bss
	.align 32
	.type	b, @object
	.size	b, 40000
b:
	.zero	40000
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 40000
a:
	.zero	40000
	.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 a[10000],b[10000];
int main(void)
{
	int n,m,f[501]={0},z,i;
	scanf("%d",&n);
	scanf("%d",&m);
        while(n!=0&&m!=0){
	for(i=0;i<501;i++){
        f[i]=0;
        z=0;
	}
	for(i=0;i<m;i++){
		scanf("%d %d",&a[i],&b[i]);
	}
	for(i=0;i<m;i++){
	if(1==a[i]){
		f[b[i]]=1;
		f[a[i]]=1;
		z=z+1;
	}
	}
	for(i=0;i<m;i++){
	if(f[a[i]]==1 && f[b[i]]==0){
		f[b[i]]=2;
		z=z+1;
	}
	if(f[a[i]]==0 && f[b[i]]==1){
		f[a[i]]=2;
		z=z+1;
	}
	}
	printf("%d\n",z);
scanf("%d %d",&n,&m);
}
	return 0;
}
6
5
1 2
1 3
3 4
2 3
4 5
6
5
2 3
3 4
4 5
5 6
2 6
0
0
 6
5
1 2
1 3
3 4
2 3
4 5
6
5
2 3
3 4
1 5
5 6
2 6
0
0
 6
5
1 2
1 3
3 5
2 3
4 5
6
5
2 3
3 4
1 5
6 6
2 6
0
0
 6
5
1 2
1 3
3 5
2 3
4 5
6
5
2 3
3 4
1 5
1 6
2 6
0
0
 6
5
1 2
1 3
2 4
2 3
3 5
6
5
2 3
4 4
4 5
5 6
2 5
0
0
 6
5
1 2
1 4
3 4
2 3
4 5
6
5
2 3
3 4
4 3
5 6
1 6
0
0
 6
5
1 2
1 3
3 2
3 3
4 5
6
5
2 3
3 4
4 4
5 6
1 6
0
0
 6
5
1 2
1 3
3 2
3 3
4 5
6
5
2 3
3 4
4 4
5 5
1 6
0
0
 6
5
1 4
1 3
3 2
3 3
3 5
6
5
2 3
3 4
4 3
5 5
1 6
0
0
 6
5
1 2
1 3
3 5
3 4
4 5
6
5
2 3
3 4
1 5
1 6
2 6
0
0

3
0
 3
2
 3
1
 3
3
 4
0
 4
2
 2
2
 2
1
 4
1
 4
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 a[10000],b[10000];
int main(void)
{
	int n,m,f[501]={0},z,i;
	scanf("%d",&n);
	scanf("%d",&m);
        while(n!=0&&m!=0){
	for(i=0;i<501;i++){
        f[i]=0;
        z=0;
	}
	for(i=0;i<m;i++){
		scanf("%d %d",&a[i],&b[i]);
	}
	for(i=0;i<m;i++){
	if(1==a[i]){
		f[b[i]]=1;
		f[a[i]]=1;
		z=z+1;
	}
	}
	for(i=0;i<m;i++){
	if(f[a[i]]==1 && f[b[i]]==0){
		f[b[i]]=2;
		z=z+1;
	}
	if(f[a[i]]==0 && f[b[i]]==1){
		f[a[i]]=2;
		z=z+1;
	}
	}
	printf("%d\n",z);
scanf("%d %d",&n,&m);
}
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 40000
a:
	.zero	40000
	.globl	b
	.align 32
	.type	b, @object
	.size	b, 40000
b:
	.zero	40000
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d %d"
.LC2:
	.string	"%d\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
	subq	$2032, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-2016(%rbp), %rdx
	movl	$0, %eax
	movl	$250, %ecx
	movq	%rdx, %rdi
	rep stosq
	movq	%rdi, %rdx
	movl	%eax, (%rdx)
	addq	$4, %rdx
	leaq	-2032(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-2028(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	jmp	.L2
.L15:
	movl	$0, -2020(%rbp)
	jmp	.L3
.L4:
	movl	-2020(%rbp), %eax
	cltq
	movl	$0, -2016(%rbp,%rax,4)
	movl	$0, -2024(%rbp)
	addl	$1, -2020(%rbp)
.L3:
	cmpl	$500, -2020(%rbp)
	jle	.L4
	movl	$0, -2020(%rbp)
	jmp	.L5
.L6:
	movl	-2020(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	b(%rip), %rax
	addq	%rax, %rdx
	movl	-2020(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	a(%rip), %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -2020(%rbp)
.L5:
	movl	-2028(%rbp), %eax
	cmpl	%eax, -2020(%rbp)
	jl	.L6
	movl	$0, -2020(%rbp)
	jmp	.L7
.L9:
	movl	-2020(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$1, %eax
	jne	.L8
	movl	-2020(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	b(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	movl	$1, -2016(%rbp,%rax,4)
	movl	-2020(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	movl	$1, -2016(%rbp,%rax,4)
	addl	$1, -2024(%rbp)
.L8:
	addl	$1, -2020(%rbp)
.L7:
	movl	-2028(%rbp), %eax
	cmpl	%eax, -2020(%rbp)
	jl	.L9
	movl	$0, -2020(%rbp)
	jmp	.L10
.L13:
	movl	-2020(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	movl	-2016(%rbp,%rax,4), %eax
	cmpl	$1, %eax
	jne	.L11
	movl	-2020(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	b(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	movl	-2016(%rbp,%rax,4), %eax
	testl	%eax, %eax
	jne	.L11
	movl	-2020(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	b(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	movl	$2, -2016(%rbp,%rax,4)
	addl	$1, -2024(%rbp)
.L11:
	movl	-2020(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	movl	-2016(%rbp,%rax,4), %eax
	testl	%eax, %eax
	jne	.L12
	movl	-2020(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	b(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	movl	-2016(%rbp,%rax,4), %eax
	cmpl	$1, %eax
	jne	.L12
	movl	-2020(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	movl	$2, -2016(%rbp,%rax,4)
	addl	$1, -2024(%rbp)
.L12:
	addl	$1, -2020(%rbp)
.L10:
	movl	-2028(%rbp), %eax
	cmpl	%eax, -2020(%rbp)
	jl	.L13
	movl	-2024(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	leaq	-2028(%rbp), %rdx
	leaq	-2032(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
.L2:
	movl	-2032(%rbp), %eax
	testl	%eax, %eax
	je	.L14
	movl	-2028(%rbp), %eax
	testl	%eax, %eax
	jne	.L15
.L14:
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L17
	call	__stack_chk_fail@PLT
.L17:
	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
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 40000
a:
	.zero	40000
	.globl	b
	.align 32
	.type	b, @object
	.size	b, 40000
b:
	.zero	40000
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d %d"
.LC2:
	.string	"%d\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
	subq	$2032, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-2016(%rbp), %rdx
	movl	$0, %eax
	movl	$250, %ecx
	movq	%rdx, %rdi
	rep stosq
	movq	%rdi, %rdx
	movl	%eax, (%rdx)
	addq	$4, %rdx
	leaq	-2032(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-2028(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	jmp	.L2
.L15:
	movl	$0, -2020(%rbp)
	jmp	.L3
.L4:
	movl	-2020(%rbp), %eax
	cltq
	movl	$0, -2016(%rbp,%rax,4)
	movl	$0, -2024(%rbp)
	addl	$1, -2020(%rbp)
.L3:
	cmpl	$500, -2020(%rbp)
	jle	.L4
	movl	$0, -2020(%rbp)
	jmp	.L5
.L6:
	movl	-2020(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	b(%rip), %rax
	addq	%rax, %rdx
	movl	-2020(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	a(%rip), %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -2020(%rbp)
.L5:
	movl	-2028(%rbp), %eax
	cmpl	%eax, -2020(%rbp)
	jl	.L6
	movl	$0, -2020(%rbp)
	jmp	.L7
.L9:
	movl	-2020(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	$1, %eax
	jne	.L8
	movl	-2020(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	b(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	movl	$1, -2016(%rbp,%rax,4)
	movl	-2020(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	movl	$1, -2016(%rbp,%rax,4)
	addl	$1, -2024(%rbp)
.L8:
	addl	$1, -2020(%rbp)
.L7:
	movl	-2028(%rbp), %eax
	cmpl	%eax, -2020(%rbp)
	jl	.L9
	movl	$0, -2020(%rbp)
	jmp	.L10
.L13:
	movl	-2020(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	movl	-2016(%rbp,%rax,4), %eax
	cmpl	$1, %eax
	jne	.L11
	movl	-2020(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	b(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	movl	-2016(%rbp,%rax,4), %eax
	testl	%eax, %eax
	jne	.L11
	movl	-2020(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	b(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	movl	$2, -2016(%rbp,%rax,4)
	addl	$1, -2024(%rbp)
.L11:
	movl	-2020(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	movl	-2016(%rbp,%rax,4), %eax
	testl	%eax, %eax
	jne	.L12
	movl	-2020(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	b(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	movl	-2016(%rbp,%rax,4), %eax
	cmpl	$1, %eax
	jne	.L12
	movl	-2020(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	movl	$2, -2016(%rbp,%rax,4)
	addl	$1, -2024(%rbp)
.L12:
	addl	$1, -2020(%rbp)
.L10:
	movl	-2028(%rbp), %eax
	cmpl	%eax, -2020(%rbp)
	jl	.L13
	movl	-2024(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	leaq	-2028(%rbp), %rdx
	leaq	-2032(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
.L2:
	movl	-2032(%rbp), %eax
	testl	%eax, %eax
	je	.L14
	movl	-2028(%rbp), %eax
	testl	%eax, %eax
	jne	.L15
.L14:
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L17
	call	__stack_chk_fail@PLT
.L17:
	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:
