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 <math.h>
#define N_MAX 10001 /* ツ妥ィツ暗督つゥツづァa[10001]ツづ慊づ参ツ湘つウツづェツつ、ツづゥ */

int main(void){
	char a[N_MAX+1]; int i, j, N, count;
	
	/* eratosthenes */
	a[0]=0, a[1]=0;
	for(i=2; i<=N_MAX; i++) a[i]=1;
	
	for(i=2; i<=(int)sqrt(N_MAX); i++)
		if(a[i])
			for(j=2*i; j<=N_MAX; j+=i) a[j]=0;
	
	/* main */
	while(~scanf("%d",&N)){
		count=0;
	
		for(i=1; i<=N; i++)
			if(a[i]==1 && a[N-i+1]) count++;
		
		printf("%d\n",count);
	}
	
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d\n"
.LC1:
	.string	"%d"
	.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	$4096, %rsp
	orq	$0, (%rsp)
	subq	$4096, %rsp
	orq	$0, (%rsp)
	subq	$1840, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movb	$0, -10016(%rbp)
	movb	$0, -10015(%rbp)
	movl	$2, -10028(%rbp)
	jmp	.L2
.L3:
	movl	-10028(%rbp), %eax
	cltq
	movb	$1, -10016(%rbp,%rax)
	addl	$1, -10028(%rbp)
.L2:
	cmpl	$10001, -10028(%rbp)
	jle	.L3
	movl	$2, -10028(%rbp)
	jmp	.L4
.L8:
	movl	-10028(%rbp), %eax
	cltq
	movzbl	-10016(%rbp,%rax), %eax
	testb	%al, %al
	je	.L5
	movl	-10028(%rbp), %eax
	addl	%eax, %eax
	movl	%eax, -10024(%rbp)
	jmp	.L6
.L7:
	movl	-10024(%rbp), %eax
	cltq
	movb	$0, -10016(%rbp,%rax)
	movl	-10028(%rbp), %eax
	addl	%eax, -10024(%rbp)
.L6:
	cmpl	$10001, -10024(%rbp)
	jle	.L7
.L5:
	addl	$1, -10028(%rbp)
.L4:
	cmpl	$100, -10028(%rbp)
	jle	.L8
	jmp	.L9
.L13:
	movl	$0, -10020(%rbp)
	movl	$1, -10028(%rbp)
	jmp	.L10
.L12:
	movl	-10028(%rbp), %eax
	cltq
	movzbl	-10016(%rbp,%rax), %eax
	cmpb	$1, %al
	jne	.L11
	movl	-10032(%rbp), %eax
	subl	-10028(%rbp), %eax
	addl	$1, %eax
	cltq
	movzbl	-10016(%rbp,%rax), %eax
	testb	%al, %al
	je	.L11
	addl	$1, -10020(%rbp)
.L11:
	addl	$1, -10028(%rbp)
.L10:
	movl	-10032(%rbp), %eax
	cmpl	%eax, -10028(%rbp)
	jle	.L12
	movl	-10020(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L9:
	leaq	-10032(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$-1, %eax
	jne	.L13
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L15
	call	__stack_chk_fail@PLT
.L15:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.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\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
	subq	$4096, %rsp
	.cfi_def_cfa_offset 4136
	orq	$0, (%rsp)
	subq	$4096, %rsp
	.cfi_def_cfa_offset 8232
	orq	$0, (%rsp)
	subq	$1848, %rsp
	.cfi_def_cfa_offset 10080
	movl	$10000, %edx
	movl	$1, %esi
	movq	%fs:40, %rax
	movq	%rax, 10024(%rsp)
	xorl	%eax, %eax
	leaq	18(%rsp), %rbx
	xorl	%eax, %eax
	movq	%rbx, %rdi
	movw	%ax, 16(%rsp)
	call	memset@PLT
	movl	$4, %esi
	movl	$2, %edx
	leaq	16(%rsp), %rcx
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L2:
	addq	$1, %rdx
	addq	$2, %rsi
	cmpq	$101, %rdx
	je	.L20
.L4:
	cmpb	$0, (%rcx,%rdx)
	je	.L2
	movq	%rsi, %rax
	.p2align 4,,10
	.p2align 3
.L3:
	movb	$0, (%rcx,%rax)
	addq	%rdx, %rax
	cmpl	$10001, %eax
	jle	.L3
	addq	$1, %rdx
	addq	$2, %rsi
	cmpq	$101, %rdx
	jne	.L4
.L20:
	leaq	12(%rsp), %r12
	leaq	.LC1(%rip), %rbp
	leaq	.LC0(%rip), %r13
	.p2align 4,,10
	.p2align 3
.L5:
	xorl	%eax, %eax
	movq	%r12, %rsi
	movq	%rbp, %rdi
	call	__isoc99_scanf@PLT
	cmpl	$-1, %eax
	je	.L8
	movl	12(%rsp), %ecx
	testl	%ecx, %ecx
	jle	.L13
	movq	%rbx, %rdx
	leal	-1(%rcx), %eax
	xorl	%r8d, %r8d
	cmpl	$1, %ecx
	je	.L9
	.p2align 4,,10
	.p2align 3
.L7:
	cmpb	$1, (%rdx)
	jne	.L6
	movslq	%eax, %rcx
	cmpb	$1, 16(%rsp,%rcx)
	sbbl	$-1, %r8d
.L6:
	addq	$1, %rdx
	subl	$1, %eax
	jne	.L7
.L9:
	movl	%r8d, %edx
	movq	%r13, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L5
.L8:
	movq	10024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L21
	addq	$10040, %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
.L13:
	.cfi_restore_state
	xorl	%r8d, %r8d
	jmp	.L9
.L21:
	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\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
	subq	$4096, %rsp
	.cfi_def_cfa_offset 4136
	orq	$0, (%rsp)
	subq	$4096, %rsp
	.cfi_def_cfa_offset 8232
	orq	$0, (%rsp)
	subq	$1848, %rsp
	.cfi_def_cfa_offset 10080
	movl	$10000, %edx
	movl	$1, %esi
	movq	%fs:40, %rax
	movq	%rax, 10024(%rsp)
	xorl	%eax, %eax
	leaq	18(%rsp), %rbx
	xorl	%eax, %eax
	movq	%rbx, %rdi
	movw	%ax, 16(%rsp)
	call	memset@PLT
	movl	$4, %esi
	movl	$2, %edx
	leaq	16(%rsp), %rcx
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L2:
	addq	$1, %rdx
	addq	$2, %rsi
	cmpq	$101, %rdx
	je	.L20
.L4:
	cmpb	$0, (%rcx,%rdx)
	je	.L2
	movq	%rsi, %rax
	.p2align 4,,10
	.p2align 3
.L3:
	movb	$0, (%rcx,%rax)
	addq	%rdx, %rax
	cmpl	$10001, %eax
	jle	.L3
	addq	$1, %rdx
	addq	$2, %rsi
	cmpq	$101, %rdx
	jne	.L4
.L20:
	leaq	12(%rsp), %r12
	leaq	.LC1(%rip), %rbp
	leaq	.LC0(%rip), %r13
	.p2align 4,,10
	.p2align 3
.L5:
	xorl	%eax, %eax
	movq	%r12, %rsi
	movq	%rbp, %rdi
	call	__isoc99_scanf@PLT
	cmpl	$-1, %eax
	je	.L8
	movl	12(%rsp), %ecx
	testl	%ecx, %ecx
	jle	.L13
	movq	%rbx, %rdx
	leal	-1(%rcx), %eax
	xorl	%r8d, %r8d
	cmpl	$1, %ecx
	je	.L9
	.p2align 4,,10
	.p2align 3
.L7:
	cmpb	$1, (%rdx)
	jne	.L6
	movslq	%eax, %rcx
	cmpb	$1, 16(%rsp,%rcx)
	sbbl	$-1, %r8d
.L6:
	addq	$1, %rdx
	subl	$1, %eax
	jne	.L7
.L9:
	movl	%r8d, %edx
	movq	%r13, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L5
.L8:
	movq	10024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L21
	addq	$10040, %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
.L13:
	.cfi_restore_state
	xorl	%r8d, %r8d
	jmp	.L9
.L21:
	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>
#include <math.h>
#define N_MAX 10001 /* ツ妥ィツ暗督つゥツづァa[10001]ツづ慊づ参ツ湘つウツづェツつ、ツづゥ */

int main(void){
	char a[N_MAX+1]; int i, j, N, count;
	
	/* eratosthenes */
	a[0]=0, a[1]=0;
	for(i=2; i<=N_MAX; i++) a[i]=1;
	
	for(i=2; i<=(int)sqrt(N_MAX); i++)
		if(a[i])
			for(j=2*i; j<=N_MAX; j+=i) a[j]=0;
	
	/* main */
	while(~scanf("%d",&N)){
		count=0;
	
		for(i=1; i<=N; i++)
			if(a[i]==1 && a[N-i+1]) count++;
		
		printf("%d\n",count);
	}
	
	return 0;
}
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 unoptimized assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include <stdio.h>
#include <math.h>
#define N_MAX 10001 /* ツ妥ィツ暗督つゥツづァa[10001]ツづ慊づ参ツ湘つウツづェツつ、ツづゥ */

int main(void){
	char a[N_MAX+1]; int i, j, N, count;
	
	/* eratosthenes */
	a[0]=0, a[1]=0;
	for(i=2; i<=N_MAX; i++) a[i]=1;
	
	for(i=2; i<=(int)sqrt(N_MAX); i++)
		if(a[i])
			for(j=2*i; j<=N_MAX; j+=i) a[j]=0;
	
	/* main */
	while(~scanf("%d",&N)){
		count=0;
	
		for(i=1; i<=N; i++)
			if(a[i]==1 && a[N-i+1]) count++;
		
		printf("%d\n",count);
	}
	
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d\n"
.LC1:
	.string	"%d"
	.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	$4096, %rsp
	orq	$0, (%rsp)
	subq	$4096, %rsp
	orq	$0, (%rsp)
	subq	$1840, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movb	$0, -10016(%rbp)
	movb	$0, -10015(%rbp)
	movl	$2, -10028(%rbp)
	jmp	.L2
.L3:
	movl	-10028(%rbp), %eax
	cltq
	movb	$1, -10016(%rbp,%rax)
	addl	$1, -10028(%rbp)
.L2:
	cmpl	$10001, -10028(%rbp)
	jle	.L3
	movl	$2, -10028(%rbp)
	jmp	.L4
.L8:
	movl	-10028(%rbp), %eax
	cltq
	movzbl	-10016(%rbp,%rax), %eax
	testb	%al, %al
	je	.L5
	movl	-10028(%rbp), %eax
	addl	%eax, %eax
	movl	%eax, -10024(%rbp)
	jmp	.L6
.L7:
	movl	-10024(%rbp), %eax
	cltq
	movb	$0, -10016(%rbp,%rax)
	movl	-10028(%rbp), %eax
	addl	%eax, -10024(%rbp)
.L6:
	cmpl	$10001, -10024(%rbp)
	jle	.L7
.L5:
	addl	$1, -10028(%rbp)
.L4:
	cmpl	$100, -10028(%rbp)
	jle	.L8
	jmp	.L9
.L13:
	movl	$0, -10020(%rbp)
	movl	$1, -10028(%rbp)
	jmp	.L10
.L12:
	movl	-10028(%rbp), %eax
	cltq
	movzbl	-10016(%rbp,%rax), %eax
	cmpb	$1, %al
	jne	.L11
	movl	-10032(%rbp), %eax
	subl	-10028(%rbp), %eax
	addl	$1, %eax
	cltq
	movzbl	-10016(%rbp,%rax), %eax
	testb	%al, %al
	je	.L11
	addl	$1, -10020(%rbp)
.L11:
	addl	$1, -10028(%rbp)
.L10:
	movl	-10032(%rbp), %eax
	cmpl	%eax, -10028(%rbp)
	jle	.L12
	movl	-10020(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L9:
	leaq	-10032(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$-1, %eax
	jne	.L13
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L15
	call	__stack_chk_fail@PLT
.L15:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.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\n"
.LC1:
	.string	"%d"
	.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	$4096, %rsp
	orq	$0, (%rsp)
	subq	$4096, %rsp
	orq	$0, (%rsp)
	subq	$1840, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movb	$0, -10016(%rbp)
	movb	$0, -10015(%rbp)
	movl	$2, -10028(%rbp)
	jmp	.L2
.L3:
	movl	-10028(%rbp), %eax
	cltq
	movb	$1, -10016(%rbp,%rax)
	addl	$1, -10028(%rbp)
.L2:
	cmpl	$10001, -10028(%rbp)
	jle	.L3
	movl	$2, -10028(%rbp)
	jmp	.L4
.L8:
	movl	-10028(%rbp), %eax
	cltq
	movzbl	-10016(%rbp,%rax), %eax
	testb	%al, %al
	je	.L5
	movl	-10028(%rbp), %eax
	addl	%eax, %eax
	movl	%eax, -10024(%rbp)
	jmp	.L6
.L7:
	movl	-10024(%rbp), %eax
	cltq
	movb	$0, -10016(%rbp,%rax)
	movl	-10028(%rbp), %eax
	addl	%eax, -10024(%rbp)
.L6:
	cmpl	$10001, -10024(%rbp)
	jle	.L7
.L5:
	addl	$1, -10028(%rbp)
.L4:
	cmpl	$100, -10028(%rbp)
	jle	.L8
	jmp	.L9
.L13:
	movl	$0, -10020(%rbp)
	movl	$1, -10028(%rbp)
	jmp	.L10
.L12:
	movl	-10028(%rbp), %eax
	cltq
	movzbl	-10016(%rbp,%rax), %eax
	cmpb	$1, %al
	jne	.L11
	movl	-10032(%rbp), %eax
	subl	-10028(%rbp), %eax
	addl	$1, %eax
	cltq
	movzbl	-10016(%rbp,%rax), %eax
	testb	%al, %al
	je	.L11
	addl	$1, -10020(%rbp)
.L11:
	addl	$1, -10028(%rbp)
.L10:
	movl	-10032(%rbp), %eax
	cmpl	%eax, -10028(%rbp)
	jle	.L12
	movl	-10020(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L9:
	leaq	-10032(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$-1, %eax
	jne	.L13
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L15
	call	__stack_chk_fail@PLT
.L15:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.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:
