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<string.h>
int main(){
	int n,h,cnt[3][2],out[3][2],i,j,k,l,list[100],a,b,sum=0;
	scanf("%d %d",&n,&h);
	for(i=0;i<n;i++){
		list[i]=-1;
	}
	for(i=0;i<h;i++){
		scanf("%d %d",&a,&b);
		a--;
		b--;
		list[a]=b;
	}
	memset(cnt,0,sizeof(cnt));
	for(i=0;i<n;i++){
		memset(out,0,sizeof(out));
		if(i==0){
			if(list[i]>=0){
				out[list[i]][0]=1;
			}
			else{
				for(j=0;j<3;j++){
					out[j][0]=1;
				}
			}
		}
		else{
			if(list[i]>=0){
				for(j=0;j<3;j++){
					for(k=0;k<2;k++){
						if(list[i]!=j){
							out[list[i]][0]+=cnt[j][k];
						}
					}
				}
				out[list[i]][1]=cnt[list[i]][0];
			}
			else{
				for(l=0;l<3;l++){
					for(j=0;j<3;j++){
						for(k=0;k<2;k++){
							if(l!=j){
								out[l][0]+=cnt[j][k];
							}
						}
					}
					out[l][1]=cnt[l][0];
				}
			}
		}
		for(j=0;j<3;j++){
			for(k=0;k<2;k++){
				if(out[j][k]>=10000){
					out[j][k]%=10000;
				}
				cnt[j][k]=out[j][k];
			}
		}
		
	}
	for(i=0;i<3;i++){
		for(j=0;j<2;j++){
			sum+=out[i][j];
			if(sum>=10000){
				sum%=10000;
			}
		}
	}
	printf("%d\n",sum);
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d %d"
.LC1:
	.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	$528, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -484(%rbp)
	leaq	-512(%rbp), %rdx
	leaq	-516(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -500(%rbp)
	jmp	.L2
.L3:
	movl	-500(%rbp), %eax
	cltq
	movl	$-1, -416(%rbp,%rax,4)
	addl	$1, -500(%rbp)
.L2:
	movl	-516(%rbp), %eax
	cmpl	%eax, -500(%rbp)
	jl	.L3
	movl	$0, -500(%rbp)
	jmp	.L4
.L5:
	leaq	-504(%rbp), %rdx
	leaq	-508(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-508(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -508(%rbp)
	movl	-504(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -504(%rbp)
	movl	-508(%rbp), %eax
	movl	-504(%rbp), %edx
	cltq
	movl	%edx, -416(%rbp,%rax,4)
	addl	$1, -500(%rbp)
.L4:
	movl	-512(%rbp), %eax
	cmpl	%eax, -500(%rbp)
	jl	.L5
	leaq	-480(%rbp), %rax
	movl	$24, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, -500(%rbp)
	jmp	.L6
.L30:
	leaq	-448(%rbp), %rax
	movl	$24, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	cmpl	$0, -500(%rbp)
	jne	.L7
	movl	-500(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	testl	%eax, %eax
	js	.L8
	movl	-500(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	cltq
	movl	$1, -448(%rbp,%rax,8)
	jmp	.L9
.L8:
	movl	$0, -496(%rbp)
	jmp	.L10
.L11:
	movl	-496(%rbp), %eax
	cltq
	movl	$1, -448(%rbp,%rax,8)
	addl	$1, -496(%rbp)
.L10:
	cmpl	$2, -496(%rbp)
	jle	.L11
	jmp	.L9
.L7:
	movl	-500(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	testl	%eax, %eax
	js	.L12
	movl	$0, -496(%rbp)
	jmp	.L13
.L17:
	movl	$0, -492(%rbp)
	jmp	.L14
.L16:
	movl	-500(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	cmpl	%eax, -496(%rbp)
	je	.L15
	movl	-500(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	cltq
	movl	-448(%rbp,%rax,8), %ecx
	movl	-492(%rbp), %eax
	movslq	%eax, %rdx
	movl	-496(%rbp), %eax
	cltq
	addq	%rax, %rax
	addq	%rdx, %rax
	movl	-480(%rbp,%rax,4), %edx
	movl	-500(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	addl	%ecx, %edx
	cltq
	movl	%edx, -448(%rbp,%rax,8)
.L15:
	addl	$1, -492(%rbp)
.L14:
	cmpl	$1, -492(%rbp)
	jle	.L16
	addl	$1, -496(%rbp)
.L13:
	cmpl	$2, -496(%rbp)
	jle	.L17
	movl	-500(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %edx
	movl	-500(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %ecx
	movslq	%edx, %rax
	movl	-480(%rbp,%rax,8), %edx
	movslq	%ecx, %rax
	movl	%edx, -444(%rbp,%rax,8)
	jmp	.L9
.L12:
	movl	$0, -488(%rbp)
	jmp	.L18
.L24:
	movl	$0, -496(%rbp)
	jmp	.L19
.L23:
	movl	$0, -492(%rbp)
	jmp	.L20
.L22:
	movl	-488(%rbp), %eax
	cmpl	-496(%rbp), %eax
	je	.L21
	movl	-488(%rbp), %eax
	cltq
	movl	-448(%rbp,%rax,8), %edx
	movl	-492(%rbp), %eax
	movslq	%eax, %rcx
	movl	-496(%rbp), %eax
	cltq
	addq	%rax, %rax
	addq	%rcx, %rax
	movl	-480(%rbp,%rax,4), %eax
	addl	%eax, %edx
	movl	-488(%rbp), %eax
	cltq
	movl	%edx, -448(%rbp,%rax,8)
.L21:
	addl	$1, -492(%rbp)
.L20:
	cmpl	$1, -492(%rbp)
	jle	.L22
	addl	$1, -496(%rbp)
.L19:
	cmpl	$2, -496(%rbp)
	jle	.L23
	movl	-488(%rbp), %eax
	cltq
	movl	-480(%rbp,%rax,8), %edx
	movl	-488(%rbp), %eax
	cltq
	movl	%edx, -444(%rbp,%rax,8)
	addl	$1, -488(%rbp)
.L18:
	cmpl	$2, -488(%rbp)
	jle	.L24
.L9:
	movl	$0, -496(%rbp)
	jmp	.L25
.L29:
	movl	$0, -492(%rbp)
	jmp	.L26
.L28:
	movl	-492(%rbp), %eax
	movslq	%eax, %rdx
	movl	-496(%rbp), %eax
	cltq
	addq	%rax, %rax
	addq	%rdx, %rax
	movl	-448(%rbp,%rax,4), %eax
	cmpl	$9999, %eax
	jle	.L27
	movl	-492(%rbp), %eax
	movslq	%eax, %rdx
	movl	-496(%rbp), %eax
	cltq
	addq	%rax, %rax
	addq	%rdx, %rax
	movl	-448(%rbp,%rax,4), %edx
	movslq	%edx, %rax
	imulq	$1759218605, %rax, %rax
	shrq	$32, %rax
	sarl	$12, %eax
	movl	%edx, %ecx
	sarl	$31, %ecx
	subl	%ecx, %eax
	imull	$10000, %eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	movl	-492(%rbp), %edx
	movslq	%edx, %rcx
	movl	-496(%rbp), %edx
	movslq	%edx, %rdx
	addq	%rdx, %rdx
	addq	%rcx, %rdx
	movl	%eax, -448(%rbp,%rdx,4)
.L27:
	movl	-492(%rbp), %eax
	movslq	%eax, %rdx
	movl	-496(%rbp), %eax
	cltq
	addq	%rax, %rax
	addq	%rdx, %rax
	movl	-448(%rbp,%rax,4), %eax
	movl	-492(%rbp), %edx
	movslq	%edx, %rcx
	movl	-496(%rbp), %edx
	movslq	%edx, %rdx
	addq	%rdx, %rdx
	addq	%rcx, %rdx
	movl	%eax, -480(%rbp,%rdx,4)
	addl	$1, -492(%rbp)
.L26:
	cmpl	$1, -492(%rbp)
	jle	.L28
	addl	$1, -496(%rbp)
.L25:
	cmpl	$2, -496(%rbp)
	jle	.L29
	addl	$1, -500(%rbp)
.L6:
	movl	-516(%rbp), %eax
	cmpl	%eax, -500(%rbp)
	jl	.L30
	movl	$0, -500(%rbp)
	jmp	.L31
.L35:
	movl	$0, -496(%rbp)
	jmp	.L32
.L34:
	movl	-496(%rbp), %eax
	movslq	%eax, %rdx
	movl	-500(%rbp), %eax
	cltq
	addq	%rax, %rax
	addq	%rdx, %rax
	movl	-448(%rbp,%rax,4), %eax
	addl	%eax, -484(%rbp)
	cmpl	$9999, -484(%rbp)
	jle	.L33
	movl	-484(%rbp), %eax
	movslq	%eax, %rdx
	imulq	$1759218605, %rdx, %rdx
	shrq	$32, %rdx
	sarl	$12, %edx
	movl	%eax, %ecx
	sarl	$31, %ecx
	subl	%ecx, %edx
	imull	$10000, %edx, %edx
	subl	%edx, %eax
	movl	%eax, -484(%rbp)
.L33:
	addl	$1, -496(%rbp)
.L32:
	cmpl	$1, -496(%rbp)
	jle	.L34
	addl	$1, -500(%rbp)
.L31:
	cmpl	$2, -500(%rbp)
	jle	.L35
	movl	-484(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L37
	call	__stack_chk_fail@PLT
.L37:
	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 %d"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB35:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	leaq	.LC0(%rip), %rbx
	movq	%rbx, %rdi
	subq	$504, %rsp
	.cfi_def_cfa_offset 544
	movq	%fs:40, %rax
	movq	%rax, 488(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rdx
	movq	%rsp, %rsi
	call	__isoc99_scanf@PLT
	movslq	(%rsp), %rax
	testl	%eax, %eax
	jle	.L5
	leaq	0(,%rax,4), %rdx
	leaq	80(%rsp), %rdi
	movl	$255, %esi
	call	memset@PLT
.L5:
	movl	4(%rsp), %eax
	xorl	%r13d, %r13d
	leaq	12(%rsp), %r12
	leaq	8(%rsp), %rbp
	testl	%eax, %eax
	jle	.L4
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r12, %rdx
	movq	%rbx, %rdi
	movq	%rbp, %rsi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	8(%rsp), %eax
	movl	12(%rsp), %edi
	addl	$1, %r13d
	subl	$1, %eax
	leal	-1(%rdi), %edx
	movl	%eax, 8(%rsp)
	cltq
	movl	%edx, 12(%rsp)
	movl	%edx, 80(%rsp,%rax,4)
	cmpl	%r13d, 4(%rsp)
	jg	.L3
.L4:
	movslq	(%rsp), %rbx
	pxor	%xmm0, %xmm0
	movq	$0, 32(%rsp)
	movaps	%xmm0, 16(%rsp)
	testl	%ebx, %ebx
	jle	.L7
	xorl	%r10d, %r10d
	xorl	%edx, %edx
	xorl	%eax, %eax
	xorl	%esi, %esi
	xorl	%ecx, %ecx
	xorl	%r8d, %r8d
	leaq	48(%rsp), %r11
	xorl	%edi, %edi
	.p2align 4,,10
	.p2align 3
.L20:
	pxor	%xmm0, %xmm0
	movq	$0, 16(%r11)
	movaps	%xmm0, (%r11)
	testq	%r10, %r10
	jne	.L8
	movslq	80(%rsp), %rax
	testl	%eax, %eax
	js	.L46
	movl	$1, 48(%rsp,%rax,8)
	movl	48(%rsp), %eax
.L22:
	cmpl	$9999, %eax
	jle	.L44
	movslq	%eax, %rdx
	movl	%eax, %ecx
	imulq	$1759218605, %rdx, %rdx
	sarl	$31, %ecx
	sarq	$44, %rdx
	subl	%ecx, %edx
	imull	$10000, %edx, %edx
	subl	%edx, %eax
	movl	%eax, 48(%rsp)
.L44:
	movl	52(%rsp), %edx
	movl	56(%rsp), %edi
	movl	%eax, 16(%rsp)
	movl	60(%rsp), %r8d
	movl	64(%rsp), %ecx
	movl	68(%rsp), %esi
	cmpl	$9999, %edx
	jle	.L13
	movslq	%edx, %r9
	movl	%edx, %ebp
	imulq	$1759218605, %r9, %r9
	sarl	$31, %ebp
	sarq	$44, %r9
	subl	%ebp, %r9d
	imull	$10000, %r9d, %r9d
	subl	%r9d, %edx
	movl	%edx, 52(%rsp)
.L13:
	movl	%edx, 20(%rsp)
	cmpl	$9999, %edi
	jle	.L14
	movslq	%edi, %r9
	movl	%edi, %ebp
	imulq	$1759218605, %r9, %r9
	sarl	$31, %ebp
	sarq	$44, %r9
	subl	%ebp, %r9d
	imull	$10000, %r9d, %r9d
	subl	%r9d, %edi
	movl	%edi, 56(%rsp)
.L14:
	movl	%edi, 24(%rsp)
	cmpl	$9999, %r8d
	jle	.L15
	movslq	%r8d, %r9
	movl	%r8d, %ebp
	imulq	$1759218605, %r9, %r9
	sarl	$31, %ebp
	sarq	$44, %r9
	subl	%ebp, %r9d
	imull	$10000, %r9d, %r9d
	subl	%r9d, %r8d
	movl	%r8d, 60(%rsp)
.L15:
	movl	%r8d, 28(%rsp)
	cmpl	$9999, %ecx
	jle	.L17
	movslq	%ecx, %r9
	movl	%ecx, %ebp
	imulq	$1759218605, %r9, %r9
	sarl	$31, %ebp
	sarq	$44, %r9
	subl	%ebp, %r9d
	imull	$10000, %r9d, %r9d
	subl	%r9d, %ecx
	movl	%ecx, 64(%rsp)
.L17:
	movl	%ecx, 32(%rsp)
	cmpl	$9999, %esi
	jle	.L18
	movslq	%esi, %r9
	movl	%esi, %ebp
	addq	$1, %r10
	imulq	$1759218605, %r9, %r9
	sarl	$31, %ebp
	sarq	$44, %r9
	subl	%ebp, %r9d
	imull	$10000, %r9d, %r9d
	subl	%r9d, %esi
	movl	%esi, 68(%rsp)
	movl	%esi, 36(%rsp)
	cmpq	%rbx, %r10
	jne	.L20
.L7:
	movl	48(%rsp), %edx
	cmpl	$9999, %edx
	jle	.L26
	movl	%edx, %eax
	movl	$10000, %ecx
	cltd
	idivl	%ecx
.L26:
	addl	52(%rsp), %edx
	cmpl	$9999, %edx
	jle	.L27
	movl	%edx, %eax
	movl	$10000, %ecx
	cltd
	idivl	%ecx
.L27:
	addl	56(%rsp), %edx
	cmpl	$9999, %edx
	jle	.L28
	movl	%edx, %eax
	movl	$10000, %ecx
	cltd
	idivl	%ecx
.L28:
	addl	60(%rsp), %edx
	cmpl	$9999, %edx
	jle	.L29
	movl	%edx, %eax
	movl	$10000, %ecx
	cltd
	idivl	%ecx
.L29:
	addl	64(%rsp), %edx
	cmpl	$9999, %edx
	jle	.L30
	movl	%edx, %eax
	movl	$10000, %ecx
	cltd
	idivl	%ecx
.L30:
	addl	68(%rsp), %edx
	cmpl	$9999, %edx
	jle	.L31
	movl	%edx, %eax
	movl	$10000, %ecx
	cltd
	idivl	%ecx
.L31:
	xorl	%eax, %eax
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	488(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L47
	addq	$504, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L18:
	.cfi_restore_state
	addq	$1, %r10
	movl	%esi, 36(%rsp)
	cmpq	%rbx, %r10
	jne	.L20
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L8:
	movl	80(%rsp,%r10,4), %r9d
	testl	%r9d, %r9d
	js	.L48
	je	.L23
	addl	%edx, %eax
	movslq	%r9d, %rdx
	movl	%eax, 48(%rsp,%rdx,8)
	cmpl	$1, %r9d
	je	.L24
	addl	%edi, %eax
	addl	%r8d, %eax
	movl	%eax, 48(%rsp,%rdx,8)
	cmpl	$2, %r9d
	je	.L25
.L24:
	addl	%ecx, %eax
	addl	%esi, %eax
	movl	%eax, 48(%rsp,%rdx,8)
.L25:
	movl	16(%rsp,%rdx,8), %eax
	movl	%eax, 52(%rsp,%rdx,8)
	movl	48(%rsp), %eax
	jmp	.L22
	.p2align 4,,10
	.p2align 3
.L48:
	leal	(%rdi,%r8), %r9d
	movd	%eax, %xmm3
	movd	%edi, %xmm2
	addl	%eax, %edx
	leal	(%rdx,%rcx), %ebp
	addl	%ecx, %r9d
	movd	%ecx, %xmm4
	addl	%edi, %edx
	addl	%esi, %r9d
	addl	%ebp, %esi
	leal	(%rdx,%r8), %eax
	movd	%esi, %xmm0
	movd	%r9d, %xmm1
	punpckldq	%xmm2, %xmm0
	punpckldq	%xmm3, %xmm1
	punpcklqdq	%xmm0, %xmm1
	movd	%eax, %xmm0
	movl	%r9d, %eax
	punpckldq	%xmm4, %xmm0
	movaps	%xmm1, 48(%rsp)
	movq	%xmm0, 64(%rsp)
	jmp	.L22
	.p2align 4,,10
	.p2align 3
.L46:
	movl	$1, 48(%rsp)
	xorl	%r8d, %r8d
	xorl	%edx, %edx
	xorl	%esi, %esi
	movl	$1, 56(%rsp)
	movl	$1, %eax
	movl	$1, %edi
	movl	$1, %ecx
	movl	$1, 64(%rsp)
	movq	$1, 16(%rsp)
	movq	$1, 24(%rsp)
	jmp	.L17
.L23:
	leal	(%rdi,%r8), %eax
	xorl	%edx, %edx
	movl	%eax, 48(%rsp)
	jmp	.L24
.L47:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE35:
	.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"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB35:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	leaq	.LC0(%rip), %rbx
	movq	%rbx, %rdi
	subq	$504, %rsp
	.cfi_def_cfa_offset 544
	movq	%fs:40, %rax
	movq	%rax, 488(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rdx
	movq	%rsp, %rsi
	call	__isoc99_scanf@PLT
	movslq	(%rsp), %rax
	testl	%eax, %eax
	jle	.L5
	leaq	0(,%rax,4), %rdx
	leaq	80(%rsp), %rdi
	movl	$255, %esi
	call	memset@PLT
.L5:
	movl	4(%rsp), %eax
	xorl	%r13d, %r13d
	leaq	12(%rsp), %r12
	leaq	8(%rsp), %rbp
	testl	%eax, %eax
	jle	.L4
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r12, %rdx
	movq	%rbx, %rdi
	movq	%rbp, %rsi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	8(%rsp), %eax
	movl	12(%rsp), %edi
	addl	$1, %r13d
	subl	$1, %eax
	leal	-1(%rdi), %edx
	movl	%eax, 8(%rsp)
	cltq
	movl	%edx, 12(%rsp)
	movl	%edx, 80(%rsp,%rax,4)
	cmpl	%r13d, 4(%rsp)
	jg	.L3
.L4:
	movslq	(%rsp), %rbx
	pxor	%xmm0, %xmm0
	movq	$0, 32(%rsp)
	movaps	%xmm0, 16(%rsp)
	testl	%ebx, %ebx
	jle	.L7
	xorl	%r10d, %r10d
	xorl	%edx, %edx
	xorl	%eax, %eax
	xorl	%esi, %esi
	xorl	%ecx, %ecx
	xorl	%r8d, %r8d
	leaq	48(%rsp), %r11
	xorl	%edi, %edi
	.p2align 4,,10
	.p2align 3
.L20:
	pxor	%xmm0, %xmm0
	movq	$0, 16(%r11)
	movaps	%xmm0, (%r11)
	testq	%r10, %r10
	jne	.L8
	movslq	80(%rsp), %rax
	testl	%eax, %eax
	js	.L46
	movl	$1, 48(%rsp,%rax,8)
	movl	48(%rsp), %eax
.L22:
	cmpl	$9999, %eax
	jle	.L44
	movslq	%eax, %rdx
	movl	%eax, %ecx
	imulq	$1759218605, %rdx, %rdx
	sarl	$31, %ecx
	sarq	$44, %rdx
	subl	%ecx, %edx
	imull	$10000, %edx, %edx
	subl	%edx, %eax
	movl	%eax, 48(%rsp)
.L44:
	movl	52(%rsp), %edx
	movl	56(%rsp), %edi
	movl	%eax, 16(%rsp)
	movl	60(%rsp), %r8d
	movl	64(%rsp), %ecx
	movl	68(%rsp), %esi
	cmpl	$9999, %edx
	jle	.L13
	movslq	%edx, %r9
	movl	%edx, %ebp
	imulq	$1759218605, %r9, %r9
	sarl	$31, %ebp
	sarq	$44, %r9
	subl	%ebp, %r9d
	imull	$10000, %r9d, %r9d
	subl	%r9d, %edx
	movl	%edx, 52(%rsp)
.L13:
	movl	%edx, 20(%rsp)
	cmpl	$9999, %edi
	jle	.L14
	movslq	%edi, %r9
	movl	%edi, %ebp
	imulq	$1759218605, %r9, %r9
	sarl	$31, %ebp
	sarq	$44, %r9
	subl	%ebp, %r9d
	imull	$10000, %r9d, %r9d
	subl	%r9d, %edi
	movl	%edi, 56(%rsp)
.L14:
	movl	%edi, 24(%rsp)
	cmpl	$9999, %r8d
	jle	.L15
	movslq	%r8d, %r9
	movl	%r8d, %ebp
	imulq	$1759218605, %r9, %r9
	sarl	$31, %ebp
	sarq	$44, %r9
	subl	%ebp, %r9d
	imull	$10000, %r9d, %r9d
	subl	%r9d, %r8d
	movl	%r8d, 60(%rsp)
.L15:
	movl	%r8d, 28(%rsp)
	cmpl	$9999, %ecx
	jle	.L17
	movslq	%ecx, %r9
	movl	%ecx, %ebp
	imulq	$1759218605, %r9, %r9
	sarl	$31, %ebp
	sarq	$44, %r9
	subl	%ebp, %r9d
	imull	$10000, %r9d, %r9d
	subl	%r9d, %ecx
	movl	%ecx, 64(%rsp)
.L17:
	movl	%ecx, 32(%rsp)
	cmpl	$9999, %esi
	jle	.L18
	movslq	%esi, %r9
	movl	%esi, %ebp
	addq	$1, %r10
	imulq	$1759218605, %r9, %r9
	sarl	$31, %ebp
	sarq	$44, %r9
	subl	%ebp, %r9d
	imull	$10000, %r9d, %r9d
	subl	%r9d, %esi
	movl	%esi, 68(%rsp)
	movl	%esi, 36(%rsp)
	cmpq	%rbx, %r10
	jne	.L20
.L7:
	movl	48(%rsp), %edx
	cmpl	$9999, %edx
	jle	.L26
	movl	%edx, %eax
	movl	$10000, %ecx
	cltd
	idivl	%ecx
.L26:
	addl	52(%rsp), %edx
	cmpl	$9999, %edx
	jle	.L27
	movl	%edx, %eax
	movl	$10000, %ecx
	cltd
	idivl	%ecx
.L27:
	addl	56(%rsp), %edx
	cmpl	$9999, %edx
	jle	.L28
	movl	%edx, %eax
	movl	$10000, %ecx
	cltd
	idivl	%ecx
.L28:
	addl	60(%rsp), %edx
	cmpl	$9999, %edx
	jle	.L29
	movl	%edx, %eax
	movl	$10000, %ecx
	cltd
	idivl	%ecx
.L29:
	addl	64(%rsp), %edx
	cmpl	$9999, %edx
	jle	.L30
	movl	%edx, %eax
	movl	$10000, %ecx
	cltd
	idivl	%ecx
.L30:
	addl	68(%rsp), %edx
	cmpl	$9999, %edx
	jle	.L31
	movl	%edx, %eax
	movl	$10000, %ecx
	cltd
	idivl	%ecx
.L31:
	xorl	%eax, %eax
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	488(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L47
	addq	$504, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L18:
	.cfi_restore_state
	addq	$1, %r10
	movl	%esi, 36(%rsp)
	cmpq	%rbx, %r10
	jne	.L20
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L8:
	movl	80(%rsp,%r10,4), %r9d
	testl	%r9d, %r9d
	js	.L48
	je	.L23
	addl	%edx, %eax
	movslq	%r9d, %rdx
	movl	%eax, 48(%rsp,%rdx,8)
	cmpl	$1, %r9d
	je	.L24
	addl	%edi, %eax
	addl	%r8d, %eax
	movl	%eax, 48(%rsp,%rdx,8)
	cmpl	$2, %r9d
	je	.L25
.L24:
	addl	%ecx, %eax
	addl	%esi, %eax
	movl	%eax, 48(%rsp,%rdx,8)
.L25:
	movl	16(%rsp,%rdx,8), %eax
	movl	%eax, 52(%rsp,%rdx,8)
	movl	48(%rsp), %eax
	jmp	.L22
	.p2align 4,,10
	.p2align 3
.L48:
	leal	(%rdi,%r8), %r9d
	movd	%eax, %xmm3
	movd	%edi, %xmm2
	addl	%eax, %edx
	leal	(%rdx,%rcx), %ebp
	addl	%ecx, %r9d
	movd	%ecx, %xmm4
	addl	%edi, %edx
	addl	%esi, %r9d
	addl	%ebp, %esi
	leal	(%rdx,%r8), %eax
	movd	%esi, %xmm0
	movd	%r9d, %xmm1
	punpckldq	%xmm2, %xmm0
	punpckldq	%xmm3, %xmm1
	punpcklqdq	%xmm0, %xmm1
	movd	%eax, %xmm0
	movl	%r9d, %eax
	punpckldq	%xmm4, %xmm0
	movaps	%xmm1, 48(%rsp)
	movq	%xmm0, 64(%rsp)
	jmp	.L22
	.p2align 4,,10
	.p2align 3
.L46:
	movl	$1, 48(%rsp)
	xorl	%r8d, %r8d
	xorl	%edx, %edx
	xorl	%esi, %esi
	movl	$1, 56(%rsp)
	movl	$1, %eax
	movl	$1, %edi
	movl	$1, %ecx
	movl	$1, 64(%rsp)
	movq	$1, 16(%rsp)
	movq	$1, 24(%rsp)
	jmp	.L17
.L23:
	leal	(%rdi,%r8), %eax
	xorl	%edx, %edx
	movl	%eax, 48(%rsp)
	jmp	.L24
.L47:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE35:
	.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<string.h>
int main(){
	int n,h,cnt[3][2],out[3][2],i,j,k,l,list[100],a,b,sum=0;
	scanf("%d %d",&n,&h);
	for(i=0;i<n;i++){
		list[i]=-1;
	}
	for(i=0;i<h;i++){
		scanf("%d %d",&a,&b);
		a--;
		b--;
		list[a]=b;
	}
	memset(cnt,0,sizeof(cnt));
	for(i=0;i<n;i++){
		memset(out,0,sizeof(out));
		if(i==0){
			if(list[i]>=0){
				out[list[i]][0]=1;
			}
			else{
				for(j=0;j<3;j++){
					out[j][0]=1;
				}
			}
		}
		else{
			if(list[i]>=0){
				for(j=0;j<3;j++){
					for(k=0;k<2;k++){
						if(list[i]!=j){
							out[list[i]][0]+=cnt[j][k];
						}
					}
				}
				out[list[i]][1]=cnt[list[i]][0];
			}
			else{
				for(l=0;l<3;l++){
					for(j=0;j<3;j++){
						for(k=0;k<2;k++){
							if(l!=j){
								out[l][0]+=cnt[j][k];
							}
						}
					}
					out[l][1]=cnt[l][0];
				}
			}
		}
		for(j=0;j<3;j++){
			for(k=0;k<2;k++){
				if(out[j][k]>=10000){
					out[j][k]%=10000;
				}
				cnt[j][k]=out[j][k];
			}
		}
		
	}
	for(i=0;i<3;i++){
		for(j=0;j<2;j++){
			sum+=out[i][j];
			if(sum>=10000){
				sum%=10000;
			}
		}
	}
	printf("%d\n",sum);
	return 0;
}
5 3
3 1
1 1
4 1
 5 3
5 1
1 1
4 1
 5 3
3 2
1 1
4 1
 5 2
3 1
1 1
4 1
 9 3
5 1
1 1
4 1
 5 1
3 1
1 1
4 1
 9 3
5 1
1 1
4 2
 5 3
4 1
1 1
4 1
 9 3
5 1
1 2
4 2
 5 3
5 2
1 1
4 2

4
 6
 9
 16
 264
 60
 420
 22
 480
 5

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<string.h>
int main(){
	int n,h,cnt[3][2],out[3][2],i,j,k,l,list[100],a,b,sum=0;
	scanf("%d %d",&n,&h);
	for(i=0;i<n;i++){
		list[i]=-1;
	}
	for(i=0;i<h;i++){
		scanf("%d %d",&a,&b);
		a--;
		b--;
		list[a]=b;
	}
	memset(cnt,0,sizeof(cnt));
	for(i=0;i<n;i++){
		memset(out,0,sizeof(out));
		if(i==0){
			if(list[i]>=0){
				out[list[i]][0]=1;
			}
			else{
				for(j=0;j<3;j++){
					out[j][0]=1;
				}
			}
		}
		else{
			if(list[i]>=0){
				for(j=0;j<3;j++){
					for(k=0;k<2;k++){
						if(list[i]!=j){
							out[list[i]][0]+=cnt[j][k];
						}
					}
				}
				out[list[i]][1]=cnt[list[i]][0];
			}
			else{
				for(l=0;l<3;l++){
					for(j=0;j<3;j++){
						for(k=0;k<2;k++){
							if(l!=j){
								out[l][0]+=cnt[j][k];
							}
						}
					}
					out[l][1]=cnt[l][0];
				}
			}
		}
		for(j=0;j<3;j++){
			for(k=0;k<2;k++){
				if(out[j][k]>=10000){
					out[j][k]%=10000;
				}
				cnt[j][k]=out[j][k];
			}
		}
		
	}
	for(i=0;i<3;i++){
		for(j=0;j<2;j++){
			sum+=out[i][j];
			if(sum>=10000){
				sum%=10000;
			}
		}
	}
	printf("%d\n",sum);
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d %d"
.LC1:
	.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	$528, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -484(%rbp)
	leaq	-512(%rbp), %rdx
	leaq	-516(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -500(%rbp)
	jmp	.L2
.L3:
	movl	-500(%rbp), %eax
	cltq
	movl	$-1, -416(%rbp,%rax,4)
	addl	$1, -500(%rbp)
.L2:
	movl	-516(%rbp), %eax
	cmpl	%eax, -500(%rbp)
	jl	.L3
	movl	$0, -500(%rbp)
	jmp	.L4
.L5:
	leaq	-504(%rbp), %rdx
	leaq	-508(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-508(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -508(%rbp)
	movl	-504(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -504(%rbp)
	movl	-508(%rbp), %eax
	movl	-504(%rbp), %edx
	cltq
	movl	%edx, -416(%rbp,%rax,4)
	addl	$1, -500(%rbp)
.L4:
	movl	-512(%rbp), %eax
	cmpl	%eax, -500(%rbp)
	jl	.L5
	leaq	-480(%rbp), %rax
	movl	$24, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, -500(%rbp)
	jmp	.L6
.L30:
	leaq	-448(%rbp), %rax
	movl	$24, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	cmpl	$0, -500(%rbp)
	jne	.L7
	movl	-500(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	testl	%eax, %eax
	js	.L8
	movl	-500(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	cltq
	movl	$1, -448(%rbp,%rax,8)
	jmp	.L9
.L8:
	movl	$0, -496(%rbp)
	jmp	.L10
.L11:
	movl	-496(%rbp), %eax
	cltq
	movl	$1, -448(%rbp,%rax,8)
	addl	$1, -496(%rbp)
.L10:
	cmpl	$2, -496(%rbp)
	jle	.L11
	jmp	.L9
.L7:
	movl	-500(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	testl	%eax, %eax
	js	.L12
	movl	$0, -496(%rbp)
	jmp	.L13
.L17:
	movl	$0, -492(%rbp)
	jmp	.L14
.L16:
	movl	-500(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	cmpl	%eax, -496(%rbp)
	je	.L15
	movl	-500(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	cltq
	movl	-448(%rbp,%rax,8), %ecx
	movl	-492(%rbp), %eax
	movslq	%eax, %rdx
	movl	-496(%rbp), %eax
	cltq
	addq	%rax, %rax
	addq	%rdx, %rax
	movl	-480(%rbp,%rax,4), %edx
	movl	-500(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	addl	%ecx, %edx
	cltq
	movl	%edx, -448(%rbp,%rax,8)
.L15:
	addl	$1, -492(%rbp)
.L14:
	cmpl	$1, -492(%rbp)
	jle	.L16
	addl	$1, -496(%rbp)
.L13:
	cmpl	$2, -496(%rbp)
	jle	.L17
	movl	-500(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %edx
	movl	-500(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %ecx
	movslq	%edx, %rax
	movl	-480(%rbp,%rax,8), %edx
	movslq	%ecx, %rax
	movl	%edx, -444(%rbp,%rax,8)
	jmp	.L9
.L12:
	movl	$0, -488(%rbp)
	jmp	.L18
.L24:
	movl	$0, -496(%rbp)
	jmp	.L19
.L23:
	movl	$0, -492(%rbp)
	jmp	.L20
.L22:
	movl	-488(%rbp), %eax
	cmpl	-496(%rbp), %eax
	je	.L21
	movl	-488(%rbp), %eax
	cltq
	movl	-448(%rbp,%rax,8), %edx
	movl	-492(%rbp), %eax
	movslq	%eax, %rcx
	movl	-496(%rbp), %eax
	cltq
	addq	%rax, %rax
	addq	%rcx, %rax
	movl	-480(%rbp,%rax,4), %eax
	addl	%eax, %edx
	movl	-488(%rbp), %eax
	cltq
	movl	%edx, -448(%rbp,%rax,8)
.L21:
	addl	$1, -492(%rbp)
.L20:
	cmpl	$1, -492(%rbp)
	jle	.L22
	addl	$1, -496(%rbp)
.L19:
	cmpl	$2, -496(%rbp)
	jle	.L23
	movl	-488(%rbp), %eax
	cltq
	movl	-480(%rbp,%rax,8), %edx
	movl	-488(%rbp), %eax
	cltq
	movl	%edx, -444(%rbp,%rax,8)
	addl	$1, -488(%rbp)
.L18:
	cmpl	$2, -488(%rbp)
	jle	.L24
.L9:
	movl	$0, -496(%rbp)
	jmp	.L25
.L29:
	movl	$0, -492(%rbp)
	jmp	.L26
.L28:
	movl	-492(%rbp), %eax
	movslq	%eax, %rdx
	movl	-496(%rbp), %eax
	cltq
	addq	%rax, %rax
	addq	%rdx, %rax
	movl	-448(%rbp,%rax,4), %eax
	cmpl	$9999, %eax
	jle	.L27
	movl	-492(%rbp), %eax
	movslq	%eax, %rdx
	movl	-496(%rbp), %eax
	cltq
	addq	%rax, %rax
	addq	%rdx, %rax
	movl	-448(%rbp,%rax,4), %edx
	movslq	%edx, %rax
	imulq	$1759218605, %rax, %rax
	shrq	$32, %rax
	sarl	$12, %eax
	movl	%edx, %ecx
	sarl	$31, %ecx
	subl	%ecx, %eax
	imull	$10000, %eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	movl	-492(%rbp), %edx
	movslq	%edx, %rcx
	movl	-496(%rbp), %edx
	movslq	%edx, %rdx
	addq	%rdx, %rdx
	addq	%rcx, %rdx
	movl	%eax, -448(%rbp,%rdx,4)
.L27:
	movl	-492(%rbp), %eax
	movslq	%eax, %rdx
	movl	-496(%rbp), %eax
	cltq
	addq	%rax, %rax
	addq	%rdx, %rax
	movl	-448(%rbp,%rax,4), %eax
	movl	-492(%rbp), %edx
	movslq	%edx, %rcx
	movl	-496(%rbp), %edx
	movslq	%edx, %rdx
	addq	%rdx, %rdx
	addq	%rcx, %rdx
	movl	%eax, -480(%rbp,%rdx,4)
	addl	$1, -492(%rbp)
.L26:
	cmpl	$1, -492(%rbp)
	jle	.L28
	addl	$1, -496(%rbp)
.L25:
	cmpl	$2, -496(%rbp)
	jle	.L29
	addl	$1, -500(%rbp)
.L6:
	movl	-516(%rbp), %eax
	cmpl	%eax, -500(%rbp)
	jl	.L30
	movl	$0, -500(%rbp)
	jmp	.L31
.L35:
	movl	$0, -496(%rbp)
	jmp	.L32
.L34:
	movl	-496(%rbp), %eax
	movslq	%eax, %rdx
	movl	-500(%rbp), %eax
	cltq
	addq	%rax, %rax
	addq	%rdx, %rax
	movl	-448(%rbp,%rax,4), %eax
	addl	%eax, -484(%rbp)
	cmpl	$9999, -484(%rbp)
	jle	.L33
	movl	-484(%rbp), %eax
	movslq	%eax, %rdx
	imulq	$1759218605, %rdx, %rdx
	shrq	$32, %rdx
	sarl	$12, %edx
	movl	%eax, %ecx
	sarl	$31, %ecx
	subl	%ecx, %edx
	imull	$10000, %edx, %edx
	subl	%edx, %eax
	movl	%eax, -484(%rbp)
.L33:
	addl	$1, -496(%rbp)
.L32:
	cmpl	$1, -496(%rbp)
	jle	.L34
	addl	$1, -500(%rbp)
.L31:
	cmpl	$2, -500(%rbp)
	jle	.L35
	movl	-484(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L37
	call	__stack_chk_fail@PLT
.L37:
	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 %d"
.LC1:
	.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	$528, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -484(%rbp)
	leaq	-512(%rbp), %rdx
	leaq	-516(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -500(%rbp)
	jmp	.L2
.L3:
	movl	-500(%rbp), %eax
	cltq
	movl	$-1, -416(%rbp,%rax,4)
	addl	$1, -500(%rbp)
.L2:
	movl	-516(%rbp), %eax
	cmpl	%eax, -500(%rbp)
	jl	.L3
	movl	$0, -500(%rbp)
	jmp	.L4
.L5:
	leaq	-504(%rbp), %rdx
	leaq	-508(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-508(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -508(%rbp)
	movl	-504(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -504(%rbp)
	movl	-508(%rbp), %eax
	movl	-504(%rbp), %edx
	cltq
	movl	%edx, -416(%rbp,%rax,4)
	addl	$1, -500(%rbp)
.L4:
	movl	-512(%rbp), %eax
	cmpl	%eax, -500(%rbp)
	jl	.L5
	leaq	-480(%rbp), %rax
	movl	$24, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, -500(%rbp)
	jmp	.L6
.L30:
	leaq	-448(%rbp), %rax
	movl	$24, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	cmpl	$0, -500(%rbp)
	jne	.L7
	movl	-500(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	testl	%eax, %eax
	js	.L8
	movl	-500(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	cltq
	movl	$1, -448(%rbp,%rax,8)
	jmp	.L9
.L8:
	movl	$0, -496(%rbp)
	jmp	.L10
.L11:
	movl	-496(%rbp), %eax
	cltq
	movl	$1, -448(%rbp,%rax,8)
	addl	$1, -496(%rbp)
.L10:
	cmpl	$2, -496(%rbp)
	jle	.L11
	jmp	.L9
.L7:
	movl	-500(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	testl	%eax, %eax
	js	.L12
	movl	$0, -496(%rbp)
	jmp	.L13
.L17:
	movl	$0, -492(%rbp)
	jmp	.L14
.L16:
	movl	-500(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	cmpl	%eax, -496(%rbp)
	je	.L15
	movl	-500(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	cltq
	movl	-448(%rbp,%rax,8), %ecx
	movl	-492(%rbp), %eax
	movslq	%eax, %rdx
	movl	-496(%rbp), %eax
	cltq
	addq	%rax, %rax
	addq	%rdx, %rax
	movl	-480(%rbp,%rax,4), %edx
	movl	-500(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	addl	%ecx, %edx
	cltq
	movl	%edx, -448(%rbp,%rax,8)
.L15:
	addl	$1, -492(%rbp)
.L14:
	cmpl	$1, -492(%rbp)
	jle	.L16
	addl	$1, -496(%rbp)
.L13:
	cmpl	$2, -496(%rbp)
	jle	.L17
	movl	-500(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %edx
	movl	-500(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %ecx
	movslq	%edx, %rax
	movl	-480(%rbp,%rax,8), %edx
	movslq	%ecx, %rax
	movl	%edx, -444(%rbp,%rax,8)
	jmp	.L9
.L12:
	movl	$0, -488(%rbp)
	jmp	.L18
.L24:
	movl	$0, -496(%rbp)
	jmp	.L19
.L23:
	movl	$0, -492(%rbp)
	jmp	.L20
.L22:
	movl	-488(%rbp), %eax
	cmpl	-496(%rbp), %eax
	je	.L21
	movl	-488(%rbp), %eax
	cltq
	movl	-448(%rbp,%rax,8), %edx
	movl	-492(%rbp), %eax
	movslq	%eax, %rcx
	movl	-496(%rbp), %eax
	cltq
	addq	%rax, %rax
	addq	%rcx, %rax
	movl	-480(%rbp,%rax,4), %eax
	addl	%eax, %edx
	movl	-488(%rbp), %eax
	cltq
	movl	%edx, -448(%rbp,%rax,8)
.L21:
	addl	$1, -492(%rbp)
.L20:
	cmpl	$1, -492(%rbp)
	jle	.L22
	addl	$1, -496(%rbp)
.L19:
	cmpl	$2, -496(%rbp)
	jle	.L23
	movl	-488(%rbp), %eax
	cltq
	movl	-480(%rbp,%rax,8), %edx
	movl	-488(%rbp), %eax
	cltq
	movl	%edx, -444(%rbp,%rax,8)
	addl	$1, -488(%rbp)
.L18:
	cmpl	$2, -488(%rbp)
	jle	.L24
.L9:
	movl	$0, -496(%rbp)
	jmp	.L25
.L29:
	movl	$0, -492(%rbp)
	jmp	.L26
.L28:
	movl	-492(%rbp), %eax
	movslq	%eax, %rdx
	movl	-496(%rbp), %eax
	cltq
	addq	%rax, %rax
	addq	%rdx, %rax
	movl	-448(%rbp,%rax,4), %eax
	cmpl	$9999, %eax
	jle	.L27
	movl	-492(%rbp), %eax
	movslq	%eax, %rdx
	movl	-496(%rbp), %eax
	cltq
	addq	%rax, %rax
	addq	%rdx, %rax
	movl	-448(%rbp,%rax,4), %edx
	movslq	%edx, %rax
	imulq	$1759218605, %rax, %rax
	shrq	$32, %rax
	sarl	$12, %eax
	movl	%edx, %ecx
	sarl	$31, %ecx
	subl	%ecx, %eax
	imull	$10000, %eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	movl	-492(%rbp), %edx
	movslq	%edx, %rcx
	movl	-496(%rbp), %edx
	movslq	%edx, %rdx
	addq	%rdx, %rdx
	addq	%rcx, %rdx
	movl	%eax, -448(%rbp,%rdx,4)
.L27:
	movl	-492(%rbp), %eax
	movslq	%eax, %rdx
	movl	-496(%rbp), %eax
	cltq
	addq	%rax, %rax
	addq	%rdx, %rax
	movl	-448(%rbp,%rax,4), %eax
	movl	-492(%rbp), %edx
	movslq	%edx, %rcx
	movl	-496(%rbp), %edx
	movslq	%edx, %rdx
	addq	%rdx, %rdx
	addq	%rcx, %rdx
	movl	%eax, -480(%rbp,%rdx,4)
	addl	$1, -492(%rbp)
.L26:
	cmpl	$1, -492(%rbp)
	jle	.L28
	addl	$1, -496(%rbp)
.L25:
	cmpl	$2, -496(%rbp)
	jle	.L29
	addl	$1, -500(%rbp)
.L6:
	movl	-516(%rbp), %eax
	cmpl	%eax, -500(%rbp)
	jl	.L30
	movl	$0, -500(%rbp)
	jmp	.L31
.L35:
	movl	$0, -496(%rbp)
	jmp	.L32
.L34:
	movl	-496(%rbp), %eax
	movslq	%eax, %rdx
	movl	-500(%rbp), %eax
	cltq
	addq	%rax, %rax
	addq	%rdx, %rax
	movl	-448(%rbp,%rax,4), %eax
	addl	%eax, -484(%rbp)
	cmpl	$9999, -484(%rbp)
	jle	.L33
	movl	-484(%rbp), %eax
	movslq	%eax, %rdx
	imulq	$1759218605, %rdx, %rdx
	shrq	$32, %rdx
	sarl	$12, %edx
	movl	%eax, %ecx
	sarl	$31, %ecx
	subl	%ecx, %edx
	imull	$10000, %edx, %edx
	subl	%edx, %eax
	movl	%eax, -484(%rbp)
.L33:
	addl	$1, -496(%rbp)
.L32:
	cmpl	$1, -496(%rbp)
	jle	.L34
	addl	$1, -500(%rbp)
.L31:
	cmpl	$2, -500(%rbp)
	jle	.L35
	movl	-484(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L37
	call	__stack_chk_fail@PLT
.L37:
	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:
