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>

#define MAX_N 100001

int main(void){

    int N,i,A[MAX_N],mem[MAX_N];
    long int ans = 1;

    scanf("%d",&N);
    for(i = 0;i < N;i++){
        scanf("%d",&A[i]);
        mem[i] = 0;
    }

    for(i = 0;i < N;i++){
        mem[A[i]]++;
    }

    if(N % 2 == 1){
        //for(i = 0;i < N;i += 2) printf("mem[%d]:%d\n",i,mem[i]);
    
        for(i = 0;i < N;i += 2){
            if((i != 0 && mem[i] != 2)){
                printf("0\n");
                return 0;
            }
        }
    }else{
        //printf("mem[0]:%d\n",mem[0]);
        //for(i = 1;i < N;i += 2) printf("mem[%d]:%d\n",i,mem[i]);

        for(i = 1;i < N;i += 2){
            if((i != 0 && mem[i] != 2) || mem[0] == 2){
                printf("0\n");
                return 0;
            }
        }
    }

    for(i = 1;i <= N/2;i++){
        ans *= 2;
        ans %= 1000000000+7;
    }

    printf("%ld\n",ans);
    return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"0"
.LC2:
	.string	"%ld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	leaq	-798720(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$1328, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movq	$1, -800040(%rbp)
	leaq	-800048(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -800044(%rbp)
	jmp	.L2
.L3:
	leaq	-800032(%rbp), %rdx
	movl	-800044(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-800044(%rbp), %eax
	cltq
	movl	$0, -400016(%rbp,%rax,4)
	addl	$1, -800044(%rbp)
.L2:
	movl	-800048(%rbp), %eax
	cmpl	%eax, -800044(%rbp)
	jl	.L3
	movl	$0, -800044(%rbp)
	jmp	.L4
.L5:
	movl	-800044(%rbp), %eax
	cltq
	movl	-800032(%rbp,%rax,4), %eax
	movslq	%eax, %rdx
	movl	-400016(%rbp,%rdx,4), %edx
	addl	$1, %edx
	cltq
	movl	%edx, -400016(%rbp,%rax,4)
	addl	$1, -800044(%rbp)
.L4:
	movl	-800048(%rbp), %eax
	cmpl	%eax, -800044(%rbp)
	jl	.L5
	movl	-800048(%rbp), %eax
	cltd
	shrl	$31, %edx
	addl	%edx, %eax
	andl	$1, %eax
	subl	%edx, %eax
	cmpl	$1, %eax
	jne	.L6
	movl	$0, -800044(%rbp)
	jmp	.L7
.L10:
	cmpl	$0, -800044(%rbp)
	je	.L8
	movl	-800044(%rbp), %eax
	cltq
	movl	-400016(%rbp,%rax,4), %eax
	cmpl	$2, %eax
	je	.L8
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$0, %eax
	jmp	.L19
.L8:
	addl	$2, -800044(%rbp)
.L7:
	movl	-800048(%rbp), %eax
	cmpl	%eax, -800044(%rbp)
	jl	.L10
	jmp	.L11
.L6:
	movl	$1, -800044(%rbp)
	jmp	.L12
.L16:
	cmpl	$0, -800044(%rbp)
	je	.L13
	movl	-800044(%rbp), %eax
	cltq
	movl	-400016(%rbp,%rax,4), %eax
	cmpl	$2, %eax
	jne	.L14
.L13:
	movl	-400016(%rbp), %eax
	cmpl	$2, %eax
	jne	.L15
.L14:
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$0, %eax
	jmp	.L19
.L15:
	addl	$2, -800044(%rbp)
.L12:
	movl	-800048(%rbp), %eax
	cmpl	%eax, -800044(%rbp)
	jl	.L16
.L11:
	movl	$1, -800044(%rbp)
	jmp	.L17
.L18:
	salq	-800040(%rbp)
	movq	-800040(%rbp), %rcx
	movabsq	$-8543223828751151131, %rdx
	movq	%rcx, %rax
	imulq	%rdx
	leaq	(%rdx,%rcx), %rax
	sarq	$29, %rax
	movq	%rcx, %rdx
	sarq	$63, %rdx
	subq	%rdx, %rax
	imulq	$1000000007, %rax, %rdx
	movq	%rcx, %rax
	subq	%rdx, %rax
	movq	%rax, -800040(%rbp)
	addl	$1, -800044(%rbp)
.L17:
	movl	-800048(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	cmpl	%eax, -800044(%rbp)
	jle	.L18
	movq	-800040(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
.L19:
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L20
	call	__stack_chk_fail@PLT
.L20:
	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	"0"
.LC2:
	.string	"%ld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	leaq	-798720(%rsp), %r11
	.cfi_def_cfa 11, 798768
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$1328, %rsp
	.cfi_def_cfa_offset 800096
	leaq	.LC0(%rip), %r14
	movq	%r14, %rdi
	movq	%fs:40, %rax
	movq	%rax, 800040(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	jle	.L19
	leaq	16(%rsp), %r13
	xorl	%ebx, %ebx
	leaq	400032(%rsp), %r12
	movq	%r13, %rbp
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%rbp, %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	addq	$4, %rbp
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %ecx
	movl	$0, (%r12,%rbx,4)
	addq	$1, %rbx
	cmpl	%ebx, %ecx
	jg	.L3
	testl	%ecx, %ecx
	jle	.L19
	leal	-1(%rcx), %edx
	leaq	4(%r13), %rax
	movq	%rdx, %rdi
	leaq	(%rax,%rdx,4), %rsi
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L32:
	addq	$4, %rax
.L4:
	movslq	0(%r13), %rdx
	movq	%rax, %r13
	addl	$1, 400032(%rsp,%rdx,4)
	cmpq	%rsi, %rax
	jne	.L32
	testb	$1, %cl
	jne	.L5
	cmpl	$1, %ecx
	jle	.L19
	cmpl	$2, 400032(%rsp)
	je	.L12
	leal	-2(%rcx), %edx
	leaq	400036(%rsp), %rax
	shrl	%edx
	leaq	400044(%rsp,%rdx,8), %rdx
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L34:
	addq	$8, %rax
	cmpq	%rdx, %rax
	je	.L33
.L13:
	cmpl	$2, (%rax)
	je	.L34
.L12:
	leaq	.LC1(%rip), %rdi
	call	puts@PLT
.L9:
	movq	800040(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L35
	addq	$800048, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
.L5:
	.cfi_restore_state
	shrl	%edi
	movq	%r12, %rax
	leaq	(%r12,%rdi,8), %rdx
	cmpq	%rax, %rdx
	je	.L36
	.p2align 4,,10
	.p2align 3
.L10:
	addq	$8, %rax
	cmpl	$2, (%rax)
	jne	.L12
	cmpq	%rax, %rdx
	jne	.L10
.L36:
	movl	%ecx, %edi
	sarl	%edi
	subl	$1, %ecx
	jne	.L17
.L19:
	movl	$1, %edx
.L15:
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L9
.L33:
	movl	%ecx, %edi
	sarl	%edi
.L17:
	movl	$1, %edx
	movl	$1, %esi
	movabsq	$-8543223828751151131, %r8
	.p2align 4,,10
	.p2align 3
.L16:
	leaq	(%rdx,%rdx), %rcx
	addl	$1, %esi
	movq	%rcx, %rax
	imulq	%r8
	movq	%rcx, %rax
	sarq	$63, %rax
	addq	%rcx, %rdx
	sarq	$29, %rdx
	subq	%rax, %rdx
	imulq	$1000000007, %rdx, %rax
	subq	%rax, %rcx
	movq	%rcx, %rdx
	cmpl	%edi, %esi
	jle	.L16
	jmp	.L15
.L35:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

rule
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"0"
.LC2:
	.string	"%ld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	leaq	-798720(%rsp), %r11
	.cfi_def_cfa 11, 798768
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$1328, %rsp
	.cfi_def_cfa_offset 800096
	leaq	.LC0(%rip), %r14
	movq	%r14, %rdi
	movq	%fs:40, %rax
	movq	%rax, 800040(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	jle	.L19
	leaq	16(%rsp), %r13
	xorl	%ebx, %ebx
	leaq	400032(%rsp), %r12
	movq	%r13, %rbp
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%rbp, %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	addq	$4, %rbp
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %ecx
	movl	$0, (%r12,%rbx,4)
	addq	$1, %rbx
	cmpl	%ebx, %ecx
	jg	.L3
	testl	%ecx, %ecx
	jle	.L19
	leal	-1(%rcx), %edx
	leaq	4(%r13), %rax
	movq	%rdx, %rdi
	leaq	(%rax,%rdx,4), %rsi
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L32:
	addq	$4, %rax
.L4:
	movslq	0(%r13), %rdx
	movq	%rax, %r13
	addl	$1, 400032(%rsp,%rdx,4)
	cmpq	%rsi, %rax
	jne	.L32
	testb	$1, %cl
	jne	.L5
	cmpl	$1, %ecx
	jle	.L19
	cmpl	$2, 400032(%rsp)
	je	.L12
	leal	-2(%rcx), %edx
	leaq	400036(%rsp), %rax
	shrl	%edx
	leaq	400044(%rsp,%rdx,8), %rdx
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L34:
	addq	$8, %rax
	cmpq	%rdx, %rax
	je	.L33
.L13:
	cmpl	$2, (%rax)
	je	.L34
.L12:
	leaq	.LC1(%rip), %rdi
	call	puts@PLT
.L9:
	movq	800040(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L35
	addq	$800048, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
.L5:
	.cfi_restore_state
	shrl	%edi
	movq	%r12, %rax
	leaq	(%r12,%rdi,8), %rdx
	cmpq	%rax, %rdx
	je	.L36
	.p2align 4,,10
	.p2align 3
.L10:
	addq	$8, %rax
	cmpl	$2, (%rax)
	jne	.L12
	cmpq	%rax, %rdx
	jne	.L10
.L36:
	movl	%ecx, %edi
	sarl	%edi
	subl	$1, %ecx
	jne	.L17
.L19:
	movl	$1, %edx
.L15:
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L9
.L33:
	movl	%ecx, %edi
	sarl	%edi
.L17:
	movl	$1, %edx
	movl	$1, %esi
	movabsq	$-8543223828751151131, %r8
	.p2align 4,,10
	.p2align 3
.L16:
	leaq	(%rdx,%rdx), %rcx
	addl	$1, %esi
	movq	%rcx, %rax
	imulq	%r8
	movq	%rcx, %rax
	sarq	$63, %rax
	addq	%rcx, %rdx
	sarq	$29, %rdx
	subq	%rax, %rdx
	imulq	$1000000007, %rdx, %rax
	subq	%rax, %rcx
	movq	%rcx, %rdx
	cmpl	%edi, %esi
	jle	.L16
	jmp	.L15
.L35:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

#include<stdio.h>

#define MAX_N 100001

int main(void){

    int N,i,A[MAX_N],mem[MAX_N];
    long int ans = 1;

    scanf("%d",&N);
    for(i = 0;i < N;i++){
        scanf("%d",&A[i]);
        mem[i] = 0;
    }

    for(i = 0;i < N;i++){
        mem[A[i]]++;
    }

    if(N % 2 == 1){
        //for(i = 0;i < N;i += 2) printf("mem[%d]:%d\n",i,mem[i]);
    
        for(i = 0;i < N;i += 2){
            if((i != 0 && mem[i] != 2)){
                printf("0\n");
                return 0;
            }
        }
    }else{
        //printf("mem[0]:%d\n",mem[0]);
        //for(i = 1;i < N;i += 2) printf("mem[%d]:%d\n",i,mem[i]);

        for(i = 1;i < N;i += 2){
            if((i != 0 && mem[i] != 2) || mem[0] == 2){
                printf("0\n");
                return 0;
            }
        }
    }

    for(i = 1;i <= N/2;i++){
        ans *= 2;
        ans %= 1000000000+7;
    }

    printf("%ld\n",ans);
    return 0;
}

8
7 5 1 2 7 3 5 3
 7
6 4 0 2 4 0 4
 5
0 4 4 0 2
 7
6 4 0 2 4 -1 4
 5
0 4 4 0 1
 7
6 4 0 2 8 -1 4
 5
0 4 1 0 1
 7
6 4 0 2 8 0 4
 5
0 4 0 0 1
 7
6 4 1 2 8 0 4

0
 0
 0
 0
 0
 0
 0
 0
 0
 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>

#define MAX_N 100001

int main(void){

    int N,i,A[MAX_N],mem[MAX_N];
    long int ans = 1;

    scanf("%d",&N);
    for(i = 0;i < N;i++){
        scanf("%d",&A[i]);
        mem[i] = 0;
    }

    for(i = 0;i < N;i++){
        mem[A[i]]++;
    }

    if(N % 2 == 1){
        //for(i = 0;i < N;i += 2) printf("mem[%d]:%d\n",i,mem[i]);
    
        for(i = 0;i < N;i += 2){
            if((i != 0 && mem[i] != 2)){
                printf("0\n");
                return 0;
            }
        }
    }else{
        //printf("mem[0]:%d\n",mem[0]);
        //for(i = 1;i < N;i += 2) printf("mem[%d]:%d\n",i,mem[i]);

        for(i = 1;i < N;i += 2){
            if((i != 0 && mem[i] != 2) || mem[0] == 2){
                printf("0\n");
                return 0;
            }
        }
    }

    for(i = 1;i <= N/2;i++){
        ans *= 2;
        ans %= 1000000000+7;
    }

    printf("%ld\n",ans);
    return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"0"
.LC2:
	.string	"%ld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	leaq	-798720(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$1328, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movq	$1, -800040(%rbp)
	leaq	-800048(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -800044(%rbp)
	jmp	.L2
.L3:
	leaq	-800032(%rbp), %rdx
	movl	-800044(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-800044(%rbp), %eax
	cltq
	movl	$0, -400016(%rbp,%rax,4)
	addl	$1, -800044(%rbp)
.L2:
	movl	-800048(%rbp), %eax
	cmpl	%eax, -800044(%rbp)
	jl	.L3
	movl	$0, -800044(%rbp)
	jmp	.L4
.L5:
	movl	-800044(%rbp), %eax
	cltq
	movl	-800032(%rbp,%rax,4), %eax
	movslq	%eax, %rdx
	movl	-400016(%rbp,%rdx,4), %edx
	addl	$1, %edx
	cltq
	movl	%edx, -400016(%rbp,%rax,4)
	addl	$1, -800044(%rbp)
.L4:
	movl	-800048(%rbp), %eax
	cmpl	%eax, -800044(%rbp)
	jl	.L5
	movl	-800048(%rbp), %eax
	cltd
	shrl	$31, %edx
	addl	%edx, %eax
	andl	$1, %eax
	subl	%edx, %eax
	cmpl	$1, %eax
	jne	.L6
	movl	$0, -800044(%rbp)
	jmp	.L7
.L10:
	cmpl	$0, -800044(%rbp)
	je	.L8
	movl	-800044(%rbp), %eax
	cltq
	movl	-400016(%rbp,%rax,4), %eax
	cmpl	$2, %eax
	je	.L8
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$0, %eax
	jmp	.L19
.L8:
	addl	$2, -800044(%rbp)
.L7:
	movl	-800048(%rbp), %eax
	cmpl	%eax, -800044(%rbp)
	jl	.L10
	jmp	.L11
.L6:
	movl	$1, -800044(%rbp)
	jmp	.L12
.L16:
	cmpl	$0, -800044(%rbp)
	je	.L13
	movl	-800044(%rbp), %eax
	cltq
	movl	-400016(%rbp,%rax,4), %eax
	cmpl	$2, %eax
	jne	.L14
.L13:
	movl	-400016(%rbp), %eax
	cmpl	$2, %eax
	jne	.L15
.L14:
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$0, %eax
	jmp	.L19
.L15:
	addl	$2, -800044(%rbp)
.L12:
	movl	-800048(%rbp), %eax
	cmpl	%eax, -800044(%rbp)
	jl	.L16
.L11:
	movl	$1, -800044(%rbp)
	jmp	.L17
.L18:
	salq	-800040(%rbp)
	movq	-800040(%rbp), %rcx
	movabsq	$-8543223828751151131, %rdx
	movq	%rcx, %rax
	imulq	%rdx
	leaq	(%rdx,%rcx), %rax
	sarq	$29, %rax
	movq	%rcx, %rdx
	sarq	$63, %rdx
	subq	%rdx, %rax
	imulq	$1000000007, %rax, %rdx
	movq	%rcx, %rax
	subq	%rdx, %rax
	movq	%rax, -800040(%rbp)
	addl	$1, -800044(%rbp)
.L17:
	movl	-800048(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	cmpl	%eax, -800044(%rbp)
	jle	.L18
	movq	-800040(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
.L19:
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L20
	call	__stack_chk_fail@PLT
.L20:
	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"
.LC1:
	.string	"0"
.LC2:
	.string	"%ld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	leaq	-798720(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$1328, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movq	$1, -800040(%rbp)
	leaq	-800048(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -800044(%rbp)
	jmp	.L2
.L3:
	leaq	-800032(%rbp), %rdx
	movl	-800044(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-800044(%rbp), %eax
	cltq
	movl	$0, -400016(%rbp,%rax,4)
	addl	$1, -800044(%rbp)
.L2:
	movl	-800048(%rbp), %eax
	cmpl	%eax, -800044(%rbp)
	jl	.L3
	movl	$0, -800044(%rbp)
	jmp	.L4
.L5:
	movl	-800044(%rbp), %eax
	cltq
	movl	-800032(%rbp,%rax,4), %eax
	movslq	%eax, %rdx
	movl	-400016(%rbp,%rdx,4), %edx
	addl	$1, %edx
	cltq
	movl	%edx, -400016(%rbp,%rax,4)
	addl	$1, -800044(%rbp)
.L4:
	movl	-800048(%rbp), %eax
	cmpl	%eax, -800044(%rbp)
	jl	.L5
	movl	-800048(%rbp), %eax
	cltd
	shrl	$31, %edx
	addl	%edx, %eax
	andl	$1, %eax
	subl	%edx, %eax
	cmpl	$1, %eax
	jne	.L6
	movl	$0, -800044(%rbp)
	jmp	.L7
.L10:
	cmpl	$0, -800044(%rbp)
	je	.L8
	movl	-800044(%rbp), %eax
	cltq
	movl	-400016(%rbp,%rax,4), %eax
	cmpl	$2, %eax
	je	.L8
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$0, %eax
	jmp	.L19
.L8:
	addl	$2, -800044(%rbp)
.L7:
	movl	-800048(%rbp), %eax
	cmpl	%eax, -800044(%rbp)
	jl	.L10
	jmp	.L11
.L6:
	movl	$1, -800044(%rbp)
	jmp	.L12
.L16:
	cmpl	$0, -800044(%rbp)
	je	.L13
	movl	-800044(%rbp), %eax
	cltq
	movl	-400016(%rbp,%rax,4), %eax
	cmpl	$2, %eax
	jne	.L14
.L13:
	movl	-400016(%rbp), %eax
	cmpl	$2, %eax
	jne	.L15
.L14:
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$0, %eax
	jmp	.L19
.L15:
	addl	$2, -800044(%rbp)
.L12:
	movl	-800048(%rbp), %eax
	cmpl	%eax, -800044(%rbp)
	jl	.L16
.L11:
	movl	$1, -800044(%rbp)
	jmp	.L17
.L18:
	salq	-800040(%rbp)
	movq	-800040(%rbp), %rcx
	movabsq	$-8543223828751151131, %rdx
	movq	%rcx, %rax
	imulq	%rdx
	leaq	(%rdx,%rcx), %rax
	sarq	$29, %rax
	movq	%rcx, %rdx
	sarq	$63, %rdx
	subq	%rdx, %rax
	imulq	$1000000007, %rax, %rdx
	movq	%rcx, %rax
	subq	%rdx, %rax
	movq	%rax, -800040(%rbp)
	addl	$1, -800044(%rbp)
.L17:
	movl	-800048(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	cmpl	%eax, -800044(%rbp)
	jle	.L18
	movq	-800040(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
.L19:
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L20
	call	__stack_chk_fail@PLT
.L20:
	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:
