Given the following C code and assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include <stdio.h>
#define MAX 10000
int main(void){
        int i,j;
        int a[MAX+1];
        int counter = 0;
	int cp_counter;
        int n;
	a[1] = 1;
	for(i = 2; i <= MAX; i++){
		a[i] = 0;
	}
	for(i = 2; i <= MAX; i++){
		if(a[i]){continue;}
		for(j = i; j <= MAX; j += i){
			if(j == i){a[i] = 0;}
			else{a[j] = 1;}
		}
	}

        while(scanf("%d",&n) != EOF){
		cp_counter = 0;
		for(i = 1; i <= n/2; i++){
			if(!a[i] && !a[n-i+1]){
				cp_counter++;
			}
		}
		cp_counter *= 2;
		if(n % 2 == 1){
			if(!a[n/2 + 1]){
				cp_counter++;
			}
		}
		printf("%d\n",cp_counter);
        }
        return 0;
}```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d\n"
.LC1:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.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	-36864(%rsp), %r11
	.cfi_def_cfa 11, 36904
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$3176, %rsp
	.cfi_def_cfa_offset 40080
	movl	$39996, %edx
	xorl	%esi, %esi
	movq	%fs:40, %rax
	movq	%rax, 40024(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rbx
	movl	$1, 20(%rsp)
	movq	%rbx, %rdi
	call	memset@PLT
	movl	$2, %edx
	leaq	16(%rsp), %rcx
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L7:
	addq	$1, %rdx
	cmpq	$10001, %rdx
	je	.L23
.L3:
	movl	(%rcx,%rdx,4), %r8d
	testl	%r8d, %r8d
	jne	.L7
	movq	%rdx, %rax
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L5:
	movl	$1, (%rcx,%rax,4)
.L6:
	addq	%rdx, %rax
	cmpl	$10000, %eax
	jg	.L7
.L2:
	cmpl	%eax, %edx
	jne	.L5
	movl	$0, (%rcx,%rdx,4)
	jmp	.L6
.L23:
	leaq	12(%rsp), %r12
	leaq	.LC1(%rip), %rbp
	leaq	.LC0(%rip), %r13
	.p2align 4,,10
	.p2align 3
.L4:
	xorl	%eax, %eax
	movq	%r12, %rsi
	movq	%rbp, %rdi
	call	__isoc99_scanf@PLT
	cmpl	$-1, %eax
	je	.L11
	movl	12(%rsp), %esi
	movl	%esi, %r9d
	shrl	$31, %r9d
	addl	%esi, %r9d
	sarl	%r9d
	cmpl	$1, %esi
	jle	.L17
	xorl	%edx, %edx
	cmpl	$3, %esi
	jle	.L14
	movl	%esi, %r8d
	movq	%rbx, %rcx
	leal	-1(%rsi), %eax
	xorl	%edx, %edx
	subl	%r9d, %r8d
	.p2align 4,,10
	.p2align 3
.L9:
	movl	(%rcx), %edi
	testl	%edi, %edi
	jne	.L8
	movslq	%eax, %rdi
	cmpl	$1, 16(%rsp,%rdi,4)
	adcl	$0, %edx
.L8:
	subl	$1, %eax
	addq	$4, %rcx
	cmpl	%r8d, %eax
	jne	.L9
.L14:
	addl	%edx, %edx
.L12:
	movl	%esi, %eax
	shrl	$31, %eax
	addl	%eax, %esi
	andl	$1, %esi
	subl	%eax, %esi
	cmpl	$1, %esi
	jne	.L10
	leal	1(%r9), %eax
	cltq
	cmpl	$1, 16(%rsp,%rax,4)
	adcl	$0, %edx
.L10:
	movq	%r13, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L4
.L11:
	movq	40024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L24
	addq	$40040, %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
.L17:
	.cfi_restore_state
	xorl	%edx, %edx
	jmp	.L12
.L24:
	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:
```

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.
Optimized Assembly Code:

user
```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d\n"
.LC1:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.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	-36864(%rsp), %r11
	.cfi_def_cfa 11, 36904
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$3176, %rsp
	.cfi_def_cfa_offset 40080
	movl	$39996, %edx
	xorl	%esi, %esi
	movq	%fs:40, %rax
	movq	%rax, 40024(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rbx
	movl	$1, 20(%rsp)
	movq	%rbx, %rdi
	call	memset@PLT
	movl	$2, %edx
	leaq	16(%rsp), %rcx
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L7:
	addq	$1, %rdx
	cmpq	$10001, %rdx
	je	.L23
.L3:
	movl	(%rcx,%rdx,4), %r8d
	testl	%r8d, %r8d
	jne	.L7
	movq	%rdx, %rax
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L5:
	movl	$1, (%rcx,%rax,4)
.L6:
	addq	%rdx, %rax
	cmpl	$10000, %eax
	jg	.L7
.L2:
	cmpl	%eax, %edx
	jne	.L5
	movl	$0, (%rcx,%rdx,4)
	jmp	.L6
.L23:
	leaq	12(%rsp), %r12
	leaq	.LC1(%rip), %rbp
	leaq	.LC0(%rip), %r13
	.p2align 4,,10
	.p2align 3
.L4:
	xorl	%eax, %eax
	movq	%r12, %rsi
	movq	%rbp, %rdi
	call	__isoc99_scanf@PLT
	cmpl	$-1, %eax
	je	.L11
	movl	12(%rsp), %esi
	movl	%esi, %r9d
	shrl	$31, %r9d
	addl	%esi, %r9d
	sarl	%r9d
	cmpl	$1, %esi
	jle	.L17
	xorl	%edx, %edx
	cmpl	$3, %esi
	jle	.L14
	movl	%esi, %r8d
	movq	%rbx, %rcx
	leal	-1(%rsi), %eax
	xorl	%edx, %edx
	subl	%r9d, %r8d
	.p2align 4,,10
	.p2align 3
.L9:
	movl	(%rcx), %edi
	testl	%edi, %edi
	jne	.L8
	movslq	%eax, %rdi
	cmpl	$1, 16(%rsp,%rdi,4)
	adcl	$0, %edx
.L8:
	subl	$1, %eax
	addq	$4, %rcx
	cmpl	%r8d, %eax
	jne	.L9
.L14:
	addl	%edx, %edx
.L12:
	movl	%esi, %eax
	shrl	$31, %eax
	addl	%eax, %esi
	andl	$1, %esi
	subl	%eax, %esi
	cmpl	$1, %esi
	jne	.L10
	leal	1(%r9), %eax
	cltq
	cmpl	$1, 16(%rsp,%rax,4)
	adcl	$0, %edx
.L10:
	movq	%r13, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L4
.L11:
	movq	40024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L24
	addq	$40040, %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
.L17:
	.cfi_restore_state
	xorl	%edx, %edx
	jmp	.L12
.L24:
	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
```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d\n"
.LC1:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.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	-36864(%rsp), %r11
	.cfi_def_cfa 11, 36904
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$3176, %rsp
	.cfi_def_cfa_offset 40080
	movl	$39996, %edx
	xorl	%esi, %esi
	movq	%fs:40, %rax
	movq	%rax, 40024(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rbx
	movl	$1, 20(%rsp)
	movq	%rbx, %rdi
	call	memset@PLT
	movl	$2, %edx
	leaq	16(%rsp), %rcx
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L7:
	addq	$1, %rdx
	cmpq	$10001, %rdx
	je	.L23
.L3:
	movl	(%rcx,%rdx,4), %r8d
	testl	%r8d, %r8d
	jne	.L7
	movq	%rdx, %rax
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L5:
	movl	$1, (%rcx,%rax,4)
.L6:
	addq	%rdx, %rax
	cmpl	$10000, %eax
	jg	.L7
.L2:
	cmpl	%eax, %edx
	jne	.L5
	movl	$0, (%rcx,%rdx,4)
	jmp	.L6
.L23:
	leaq	12(%rsp), %r12
	leaq	.LC1(%rip), %rbp
	leaq	.LC0(%rip), %r13
	.p2align 4,,10
	.p2align 3
.L4:
	xorl	%eax, %eax
	movq	%r12, %rsi
	movq	%rbp, %rdi
	call	__isoc99_scanf@PLT
	cmpl	$-1, %eax
	je	.L11
	movl	12(%rsp), %esi
	movl	%esi, %r9d
	shrl	$31, %r9d
	addl	%esi, %r9d
	sarl	%r9d
	cmpl	$1, %esi
	jle	.L17
	xorl	%edx, %edx
	cmpl	$3, %esi
	jle	.L14
	movl	%esi, %r8d
	movq	%rbx, %rcx
	leal	-1(%rsi), %eax
	xorl	%edx, %edx
	subl	%r9d, %r8d
	.p2align 4,,10
	.p2align 3
.L9:
	movl	(%rcx), %edi
	testl	%edi, %edi
	jne	.L8
	movslq	%eax, %rdi
	cmpl	$1, 16(%rsp,%rdi,4)
	adcl	$0, %edx
.L8:
	subl	$1, %eax
	addq	$4, %rcx
	cmpl	%r8d, %eax
	jne	.L9
.L14:
	addl	%edx, %edx
.L12:
	movl	%esi, %eax
	shrl	$31, %eax
	addl	%eax, %esi
	andl	$1, %esi
	subl	%eax, %esi
	cmpl	$1, %esi
	jne	.L10
	leal	1(%r9), %eax
	cltq
	cmpl	$1, 16(%rsp,%rax,4)
	adcl	$0, %edx
.L10:
	movq	%r13, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L4
.L11:
	movq	40024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L24
	addq	$40040, %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
.L17:
	.cfi_restore_state
	xorl	%edx, %edx
	jmp	.L12
.L24:
	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:
```
```c
#include <stdio.h>
#define MAX 10000
int main(void){
        int i,j;
        int a[MAX+1];
        int counter = 0;
	int cp_counter;
        int n;
	a[1] = 1;
	for(i = 2; i <= MAX; i++){
		a[i] = 0;
	}
	for(i = 2; i <= MAX; i++){
		if(a[i]){continue;}
		for(j = i; j <= MAX; j += i){
			if(j == i){a[i] = 0;}
			else{a[j] = 1;}
		}
	}

        while(scanf("%d",&n) != EOF){
		cp_counter = 0;
		for(i = 1; i <= n/2; i++){
			if(!a[i] && !a[n-i+1]){
				cp_counter++;
			}
		}
		cp_counter *= 2;
		if(n % 2 == 1){
			if(!a[n/2 + 1]){
				cp_counter++;
			}
		}
		printf("%d\n",cp_counter);
        }
        return 0;
}```
Given the following C code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include <stdio.h>
#define MAX 10000
int main(void){
        int i,j;
        int a[MAX+1];
        int counter = 0;
	int cp_counter;
        int n;
	a[1] = 1;
	for(i = 2; i <= MAX; i++){
		a[i] = 0;
	}
	for(i = 2; i <= MAX; i++){
		if(a[i]){continue;}
		for(j = i; j <= MAX; j += i){
			if(j == i){a[i] = 0;}
			else{a[j] = 1;}
		}
	}

        while(scanf("%d",&n) != EOF){
		cp_counter = 0;
		for(i = 1; i <= n/2; i++){
			if(!a[i] && !a[n-i+1]){
				cp_counter++;
			}
		}
		cp_counter *= 2;
		if(n % 2 == 1){
			if(!a[n/2 + 1]){
				cp_counter++;
			}
		}
		printf("%d\n",cp_counter);
        }
        return 0;
}```

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.
Optimized Assembly Code:

1
8
7
51
 1
10
7
51
 1
10
7
65
 1
12
7
115
 1
12
9
115
 1
12
9
15
 1
26
9
15
 1
26
11
15
 1
26
11
20
 1
27
11
20

0
2
2
6
 0
0
2
6
 0
0
2
12
 0
2
2
12
 0
2
3
12
 0
2
3
4
 0
0
3
4
 0
0
2
4
 0
0
2
2
 0
4
2
2

Given the following C code and assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include <stdio.h>
#define MAX 10000
int main(void){
        int i,j;
        int a[MAX+1];
        int counter = 0;
	int cp_counter;
        int n;
	a[1] = 1;
	for(i = 2; i <= MAX; i++){
		a[i] = 0;
	}
	for(i = 2; i <= MAX; i++){
		if(a[i]){continue;}
		for(j = i; j <= MAX; j += i){
			if(j == i){a[i] = 0;}
			else{a[j] = 1;}
		}
	}

        while(scanf("%d",&n) != EOF){
		cp_counter = 0;
		for(i = 1; i <= n/2; i++){
			if(!a[i] && !a[n-i+1]){
				cp_counter++;
			}
		}
		cp_counter *= 2;
		if(n % 2 == 1){
			if(!a[n/2 + 1]){
				cp_counter++;
			}
		}
		printf("%d\n",cp_counter);
        }
        return 0;
}```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d\n"
.LC1:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.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	-36864(%rsp), %r11
	.cfi_def_cfa 11, 36904
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$3176, %rsp
	.cfi_def_cfa_offset 40080
	movl	$39996, %edx
	xorl	%esi, %esi
	movq	%fs:40, %rax
	movq	%rax, 40024(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rbx
	movl	$1, 20(%rsp)
	movq	%rbx, %rdi
	call	memset@PLT
	movl	$2, %edx
	leaq	16(%rsp), %rcx
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L7:
	addq	$1, %rdx
	cmpq	$10001, %rdx
	je	.L23
.L3:
	movl	(%rcx,%rdx,4), %r8d
	testl	%r8d, %r8d
	jne	.L7
	movq	%rdx, %rax
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L5:
	movl	$1, (%rcx,%rax,4)
.L6:
	addq	%rdx, %rax
	cmpl	$10000, %eax
	jg	.L7
.L2:
	cmpl	%eax, %edx
	jne	.L5
	movl	$0, (%rcx,%rdx,4)
	jmp	.L6
.L23:
	leaq	12(%rsp), %r12
	leaq	.LC1(%rip), %rbp
	leaq	.LC0(%rip), %r13
	.p2align 4,,10
	.p2align 3
.L4:
	xorl	%eax, %eax
	movq	%r12, %rsi
	movq	%rbp, %rdi
	call	__isoc99_scanf@PLT
	cmpl	$-1, %eax
	je	.L11
	movl	12(%rsp), %esi
	movl	%esi, %r9d
	shrl	$31, %r9d
	addl	%esi, %r9d
	sarl	%r9d
	cmpl	$1, %esi
	jle	.L17
	xorl	%edx, %edx
	cmpl	$3, %esi
	jle	.L14
	movl	%esi, %r8d
	movq	%rbx, %rcx
	leal	-1(%rsi), %eax
	xorl	%edx, %edx
	subl	%r9d, %r8d
	.p2align 4,,10
	.p2align 3
.L9:
	movl	(%rcx), %edi
	testl	%edi, %edi
	jne	.L8
	movslq	%eax, %rdi
	cmpl	$1, 16(%rsp,%rdi,4)
	adcl	$0, %edx
.L8:
	subl	$1, %eax
	addq	$4, %rcx
	cmpl	%r8d, %eax
	jne	.L9
.L14:
	addl	%edx, %edx
.L12:
	movl	%esi, %eax
	shrl	$31, %eax
	addl	%eax, %esi
	andl	$1, %esi
	subl	%eax, %esi
	cmpl	$1, %esi
	jne	.L10
	leal	1(%r9), %eax
	cltq
	cmpl	$1, 16(%rsp,%rax,4)
	adcl	$0, %edx
.L10:
	movq	%r13, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L4
.L11:
	movq	40024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L24
	addq	$40040, %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
.L17:
	.cfi_restore_state
	xorl	%edx, %edx
	jmp	.L12
.L24:
	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:
```

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.
Optimized Assembly Code:

train
```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d\n"
.LC1:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.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	-36864(%rsp), %r11
	.cfi_def_cfa 11, 36904
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$3176, %rsp
	.cfi_def_cfa_offset 40080
	movl	$39996, %edx
	xorl	%esi, %esi
	movq	%fs:40, %rax
	movq	%rax, 40024(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rbx
	movl	$1, 20(%rsp)
	movq	%rbx, %rdi
	call	memset@PLT
	movl	$2, %edx
	leaq	16(%rsp), %rcx
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L7:
	addq	$1, %rdx
	cmpq	$10001, %rdx
	je	.L23
.L3:
	movl	(%rcx,%rdx,4), %r8d
	testl	%r8d, %r8d
	jne	.L7
	movq	%rdx, %rax
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L5:
	movl	$1, (%rcx,%rax,4)
.L6:
	addq	%rdx, %rax
	cmpl	$10000, %eax
	jg	.L7
.L2:
	cmpl	%eax, %edx
	jne	.L5
	movl	$0, (%rcx,%rdx,4)
	jmp	.L6
.L23:
	leaq	12(%rsp), %r12
	leaq	.LC1(%rip), %rbp
	leaq	.LC0(%rip), %r13
	.p2align 4,,10
	.p2align 3
.L4:
	xorl	%eax, %eax
	movq	%r12, %rsi
	movq	%rbp, %rdi
	call	__isoc99_scanf@PLT
	cmpl	$-1, %eax
	je	.L11
	movl	12(%rsp), %esi
	movl	%esi, %r9d
	shrl	$31, %r9d
	addl	%esi, %r9d
	sarl	%r9d
	cmpl	$1, %esi
	jle	.L17
	xorl	%edx, %edx
	cmpl	$3, %esi
	jle	.L14
	movl	%esi, %r8d
	movq	%rbx, %rcx
	leal	-1(%rsi), %eax
	xorl	%edx, %edx
	subl	%r9d, %r8d
	.p2align 4,,10
	.p2align 3
.L9:
	movl	(%rcx), %edi
	testl	%edi, %edi
	jne	.L8
	movslq	%eax, %rdi
	cmpl	$1, 16(%rsp,%rdi,4)
	adcl	$0, %edx
.L8:
	subl	$1, %eax
	addq	$4, %rcx
	cmpl	%r8d, %eax
	jne	.L9
.L14:
	addl	%edx, %edx
.L12:
	movl	%esi, %eax
	shrl	$31, %eax
	addl	%eax, %esi
	andl	$1, %esi
	subl	%eax, %esi
	cmpl	$1, %esi
	jne	.L10
	leal	1(%r9), %eax
	cltq
	cmpl	$1, 16(%rsp,%rax,4)
	adcl	$0, %edx
.L10:
	movq	%r13, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L4
.L11:
	movq	40024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L24
	addq	$40040, %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
.L17:
	.cfi_restore_state
	xorl	%edx, %edx
	jmp	.L12
.L24:
	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:
```