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 is_prime(int n){
  int i;
  if(n==1)
    return 0;
  for(i=2;i*i<=n;i++)
    if(n%i==0)
      return 0;
  return 1;
}
int main(void){
  int n,c,i;
  while(scanf("%d",&n)!=EOF){
    c=0;
    for(i=1;i<=n;i++){
      if(is_prime(i)&&is_prime(n-i+1))
	c++;
    }
    printf("%d\n",c);
  }
  return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	is_prime
	.type	is_prime, @function
is_prime:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -20(%rbp)
	cmpl	$1, -20(%rbp)
	jne	.L2
	movl	$0, %eax
	jmp	.L3
.L2:
	movl	$2, -4(%rbp)
	jmp	.L4
.L6:
	movl	-20(%rbp), %eax
	cltd
	idivl	-4(%rbp)
	movl	%edx, %eax
	testl	%eax, %eax
	jne	.L5
	movl	$0, %eax
	jmp	.L3
.L5:
	addl	$1, -4(%rbp)
.L4:
	movl	-4(%rbp), %eax
	imull	%eax, %eax
	cmpl	%eax, -20(%rbp)
	jge	.L6
	movl	$1, %eax
.L3:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	is_prime, .-is_prime
	.section	.rodata
.LC0:
	.string	"%d\n"
.LC1:
	.string	"%d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	jmp	.L8
.L12:
	movl	$0, -16(%rbp)
	movl	$1, -12(%rbp)
	jmp	.L9
.L11:
	movl	-12(%rbp), %eax
	movl	%eax, %edi
	call	is_prime
	testl	%eax, %eax
	je	.L10
	movl	-20(%rbp), %eax
	subl	-12(%rbp), %eax
	addl	$1, %eax
	movl	%eax, %edi
	call	is_prime
	testl	%eax, %eax
	je	.L10
	addl	$1, -16(%rbp)
.L10:
	addl	$1, -12(%rbp)
.L9:
	movl	-20(%rbp), %eax
	cmpl	%eax, -12(%rbp)
	jle	.L11
	movl	-16(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L8:
	leaq	-20(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$-1, %eax
	jne	.L12
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L14
	call	__stack_chk_fail@PLT
.L14:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.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
	.p2align 4
	.globl	is_prime
	.type	is_prime, @function
is_prime:
.LFB23:
	.cfi_startproc
	endbr64
	xorl	%edx, %edx
	cmpl	$1, %edi
	je	.L1
	cmpl	$3, %edi
	jle	.L6
	testb	$1, %dil
	je	.L1
	movl	$2, %ecx
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L4:
	movl	%edi, %eax
	cltd
	idivl	%ecx
	testl	%edx, %edx
	je	.L1
.L3:
	addl	$1, %ecx
	movl	%ecx, %eax
	imull	%ecx, %eax
	cmpl	%eax, %edi
	jge	.L4
.L6:
	movl	$1, %edx
.L1:
	movl	%edx, %eax
	ret
	.cfi_endproc
.LFE23:
	.size	is_prime, .-is_prime
	.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:
.LFB24:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	leaq	.LC0(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	leaq	.LC1(%rip), %rbx
	subq	$16, %rsp
	.cfi_def_cfa_offset 48
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rbp
	.p2align 4,,10
	.p2align 3
.L14:
	xorl	%eax, %eax
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	call	__isoc99_scanf@PLT
	cmpl	$-1, %eax
	je	.L22
	movl	4(%rsp), %r8d
	testl	%r8d, %r8d
	jle	.L28
	cmpl	$1, %r8d
	je	.L28
	leal	-1(%r8), %edi
	movl	$2, %esi
	addl	$1, %r8d
	xorl	%r9d, %r9d
	.p2align 4,,10
	.p2align 3
.L21:
	cmpl	$3, %esi
	jle	.L15
	testb	$1, %sil
	je	.L16
	movl	$2, %ecx
	jmp	.L17
	.p2align 4,,10
	.p2align 3
.L18:
	movl	%esi, %eax
	cltd
	idivl	%ecx
	testl	%edx, %edx
	je	.L16
.L17:
	addl	$1, %ecx
	movl	%ecx, %eax
	imull	%ecx, %eax
	cmpl	%esi, %eax
	jle	.L18
.L15:
	cmpl	$1, %edi
	je	.L16
	cmpl	$3, %edi
	jle	.L20
	testb	$1, %dil
	je	.L16
	movl	$2, %ecx
	jmp	.L26
	.p2align 4,,10
	.p2align 3
.L19:
	movl	%edi, %eax
	cltd
	idivl	%ecx
	testl	%edx, %edx
	je	.L16
.L26:
	addl	$1, %ecx
	movl	%ecx, %eax
	imull	%ecx, %eax
	cmpl	%eax, %edi
	jge	.L19
.L20:
	addl	$1, %r9d
.L16:
	addl	$1, %esi
	subl	$1, %edi
	cmpl	%r8d, %esi
	jne	.L21
.L23:
	movl	%r9d, %edx
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L14
.L28:
	xorl	%r9d, %r9d
	jmp	.L23
.L22:
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L47
	addq	$16, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L47:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE24:
	.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
	.p2align 4
	.globl	is_prime
	.type	is_prime, @function
is_prime:
.LFB23:
	.cfi_startproc
	endbr64
	xorl	%edx, %edx
	cmpl	$1, %edi
	je	.L1
	cmpl	$3, %edi
	jle	.L6
	testb	$1, %dil
	je	.L1
	movl	$2, %ecx
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L4:
	movl	%edi, %eax
	cltd
	idivl	%ecx
	testl	%edx, %edx
	je	.L1
.L3:
	addl	$1, %ecx
	movl	%ecx, %eax
	imull	%ecx, %eax
	cmpl	%eax, %edi
	jge	.L4
.L6:
	movl	$1, %edx
.L1:
	movl	%edx, %eax
	ret
	.cfi_endproc
.LFE23:
	.size	is_prime, .-is_prime
	.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:
.LFB24:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	leaq	.LC0(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	leaq	.LC1(%rip), %rbx
	subq	$16, %rsp
	.cfi_def_cfa_offset 48
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rbp
	.p2align 4,,10
	.p2align 3
.L14:
	xorl	%eax, %eax
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	call	__isoc99_scanf@PLT
	cmpl	$-1, %eax
	je	.L22
	movl	4(%rsp), %r8d
	testl	%r8d, %r8d
	jle	.L28
	cmpl	$1, %r8d
	je	.L28
	leal	-1(%r8), %edi
	movl	$2, %esi
	addl	$1, %r8d
	xorl	%r9d, %r9d
	.p2align 4,,10
	.p2align 3
.L21:
	cmpl	$3, %esi
	jle	.L15
	testb	$1, %sil
	je	.L16
	movl	$2, %ecx
	jmp	.L17
	.p2align 4,,10
	.p2align 3
.L18:
	movl	%esi, %eax
	cltd
	idivl	%ecx
	testl	%edx, %edx
	je	.L16
.L17:
	addl	$1, %ecx
	movl	%ecx, %eax
	imull	%ecx, %eax
	cmpl	%esi, %eax
	jle	.L18
.L15:
	cmpl	$1, %edi
	je	.L16
	cmpl	$3, %edi
	jle	.L20
	testb	$1, %dil
	je	.L16
	movl	$2, %ecx
	jmp	.L26
	.p2align 4,,10
	.p2align 3
.L19:
	movl	%edi, %eax
	cltd
	idivl	%ecx
	testl	%edx, %edx
	je	.L16
.L26:
	addl	$1, %ecx
	movl	%ecx, %eax
	imull	%ecx, %eax
	cmpl	%eax, %edi
	jge	.L19
.L20:
	addl	$1, %r9d
.L16:
	addl	$1, %esi
	subl	$1, %edi
	cmpl	%r8d, %esi
	jne	.L21
.L23:
	movl	%r9d, %edx
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L14
.L28:
	xorl	%r9d, %r9d
	jmp	.L23
.L22:
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L47
	addq	$16, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L47:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE24:
	.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>
int is_prime(int n){
  int i;
  if(n==1)
    return 0;
  for(i=2;i*i<=n;i++)
    if(n%i==0)
      return 0;
  return 1;
}
int main(void){
  int n,c,i;
  while(scanf("%d",&n)!=EOF){
    c=0;
    for(i=1;i<=n;i++){
      if(is_prime(i)&&is_prime(n-i+1))
	c++;
    }
    printf("%d\n",c);
  }
  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>
int is_prime(int n){
  int i;
  if(n==1)
    return 0;
  for(i=2;i*i<=n;i++)
    if(n%i==0)
      return 0;
  return 1;
}
int main(void){
  int n,c,i;
  while(scanf("%d",&n)!=EOF){
    c=0;
    for(i=1;i<=n;i++){
      if(is_prime(i)&&is_prime(n-i+1))
	c++;
    }
    printf("%d\n",c);
  }
  return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	is_prime
	.type	is_prime, @function
is_prime:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -20(%rbp)
	cmpl	$1, -20(%rbp)
	jne	.L2
	movl	$0, %eax
	jmp	.L3
.L2:
	movl	$2, -4(%rbp)
	jmp	.L4
.L6:
	movl	-20(%rbp), %eax
	cltd
	idivl	-4(%rbp)
	movl	%edx, %eax
	testl	%eax, %eax
	jne	.L5
	movl	$0, %eax
	jmp	.L3
.L5:
	addl	$1, -4(%rbp)
.L4:
	movl	-4(%rbp), %eax
	imull	%eax, %eax
	cmpl	%eax, -20(%rbp)
	jge	.L6
	movl	$1, %eax
.L3:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	is_prime, .-is_prime
	.section	.rodata
.LC0:
	.string	"%d\n"
.LC1:
	.string	"%d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	jmp	.L8
.L12:
	movl	$0, -16(%rbp)
	movl	$1, -12(%rbp)
	jmp	.L9
.L11:
	movl	-12(%rbp), %eax
	movl	%eax, %edi
	call	is_prime
	testl	%eax, %eax
	je	.L10
	movl	-20(%rbp), %eax
	subl	-12(%rbp), %eax
	addl	$1, %eax
	movl	%eax, %edi
	call	is_prime
	testl	%eax, %eax
	je	.L10
	addl	$1, -16(%rbp)
.L10:
	addl	$1, -12(%rbp)
.L9:
	movl	-20(%rbp), %eax
	cmpl	%eax, -12(%rbp)
	jle	.L11
	movl	-16(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L8:
	leaq	-20(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$-1, %eax
	jne	.L12
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L14
	call	__stack_chk_fail@PLT
.L14:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.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	is_prime
	.type	is_prime, @function
is_prime:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -20(%rbp)
	cmpl	$1, -20(%rbp)
	jne	.L2
	movl	$0, %eax
	jmp	.L3
.L2:
	movl	$2, -4(%rbp)
	jmp	.L4
.L6:
	movl	-20(%rbp), %eax
	cltd
	idivl	-4(%rbp)
	movl	%edx, %eax
	testl	%eax, %eax
	jne	.L5
	movl	$0, %eax
	jmp	.L3
.L5:
	addl	$1, -4(%rbp)
.L4:
	movl	-4(%rbp), %eax
	imull	%eax, %eax
	cmpl	%eax, -20(%rbp)
	jge	.L6
	movl	$1, %eax
.L3:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	is_prime, .-is_prime
	.section	.rodata
.LC0:
	.string	"%d\n"
.LC1:
	.string	"%d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	jmp	.L8
.L12:
	movl	$0, -16(%rbp)
	movl	$1, -12(%rbp)
	jmp	.L9
.L11:
	movl	-12(%rbp), %eax
	movl	%eax, %edi
	call	is_prime
	testl	%eax, %eax
	je	.L10
	movl	-20(%rbp), %eax
	subl	-12(%rbp), %eax
	addl	$1, %eax
	movl	%eax, %edi
	call	is_prime
	testl	%eax, %eax
	je	.L10
	addl	$1, -16(%rbp)
.L10:
	addl	$1, -12(%rbp)
.L9:
	movl	-20(%rbp), %eax
	cmpl	%eax, -12(%rbp)
	jle	.L11
	movl	-16(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L8:
	leaq	-20(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$-1, %eax
	jne	.L12
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L14
	call	__stack_chk_fail@PLT
.L14:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.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:
