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

```c
#define IN_MAX 10000
char primes[IN_MAX+1];
int prime[300];
int table[IN_MAX+1];

void createtable(){
  int i=2,j,n=0;
  primes[1]=1;
  for(;i<=IN_MAX;i++)
    if(!primes[i])
      for(j=i*2;j<=IN_MAX;j+=i)
        primes[j]=1;

  for(i=2;i<=IN_MAX;i++)
    if(!primes[i])prime[n++]=i;
    
  for(i=0;i<n;i++){
    int x=prime[i];
    table[x]++;
    for(j=i+1;;j++){
      x+=prime[j];
      if(x>IN_MAX)break;
      table[x]++;
    }
  }
}

int main(){
  int n;
  createtable();
  while(1){
    scanf("%d",&n);
    if(!n)return 0;
    printf("%d\n",table[n]);
  }
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	primes
	.bss
	.align 32
	.type	primes, @object
	.size	primes, 10001
primes:
	.zero	10001
	.globl	prime
	.align 32
	.type	prime, @object
	.size	prime, 1200
prime:
	.zero	1200
	.globl	table
	.align 32
	.type	table, @object
	.size	table, 40004
table:
	.zero	40004
	.text
	.globl	createtable
	.type	createtable, @function
createtable:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	$2, -16(%rbp)
	movl	$0, -8(%rbp)
	movb	$1, 1+primes(%rip)
	jmp	.L2
.L6:
	movl	-16(%rbp), %eax
	cltq
	leaq	primes(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	testb	%al, %al
	jne	.L3
	movl	-16(%rbp), %eax
	addl	%eax, %eax
	movl	%eax, -12(%rbp)
	jmp	.L4
.L5:
	movl	-12(%rbp), %eax
	cltq
	leaq	primes(%rip), %rdx
	movb	$1, (%rax,%rdx)
	movl	-16(%rbp), %eax
	addl	%eax, -12(%rbp)
.L4:
	cmpl	$10000, -12(%rbp)
	jle	.L5
.L3:
	addl	$1, -16(%rbp)
.L2:
	cmpl	$10000, -16(%rbp)
	jle	.L6
	movl	$2, -16(%rbp)
	jmp	.L7
.L9:
	movl	-16(%rbp), %eax
	cltq
	leaq	primes(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	testb	%al, %al
	jne	.L8
	movl	-8(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -8(%rbp)
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	prime(%rip), %rdx
	movl	-16(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
.L8:
	addl	$1, -16(%rbp)
.L7:
	cmpl	$10000, -16(%rbp)
	jle	.L9
	movl	$0, -16(%rbp)
	jmp	.L10
.L14:
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	prime(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -4(%rbp)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	table(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	1(%rax), %ecx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	table(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-16(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -12(%rbp)
.L13:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	prime(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, -4(%rbp)
	cmpl	$10000, -4(%rbp)
	jg	.L16
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	table(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	1(%rax), %ecx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	table(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	addl	$1, -12(%rbp)
	jmp	.L13
.L16:
	nop
	addl	$1, -16(%rbp)
.L10:
	movl	-16(%rbp), %eax
	cmpl	-8(%rbp), %eax
	jl	.L14
	nop
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	createtable, .-createtable
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
	.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	$16, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, %eax
	call	createtable
.L20:
	leaq	-12(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	-12(%rbp), %eax
	testl	%eax, %eax
	jne	.L18
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L21
	jmp	.L22
.L18:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	table(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L20
.L22:
	call	__stack_chk_fail@PLT
.L21:
	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	createtable
	.type	createtable, @function
createtable:
.LFB0:
	.cfi_startproc
	endbr64
	movb	$1, 1+primes(%rip)
	movl	$4, %esi
	movl	$2, %edx
	leaq	primes(%rip), %rcx
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L2:
	addq	$1, %rdx
	addq	$2, %rsi
	cmpq	$10001, %rdx
	je	.L22
.L4:
	cmpb	$0, (%rcx,%rdx)
	jne	.L2
	cmpq	$10000, %rsi
	ja	.L2
	movq	%rsi, %rax
	.p2align 4,,10
	.p2align 3
.L3:
	movb	$1, (%rcx,%rax)
	addq	%rdx, %rax
	cmpl	$10000, %eax
	jle	.L3
	jmp	.L2
.L22:
	movl	$2, %eax
	xorl	%esi, %esi
	leaq	prime(%rip), %rdi
	.p2align 4,,10
	.p2align 3
.L6:
	cmpb	$0, (%rcx,%rax)
	jne	.L5
	movslq	%esi, %rdx
	addl	$1, %esi
	movl	%eax, (%rdi,%rdx,4)
.L5:
	addq	$1, %rax
	cmpq	$10001, %rax
	jne	.L6
	leaq	prime(%rip), %r8
	xorl	%r9d, %r9d
	leaq	table(%rip), %rdi
	testl	%esi, %esi
	je	.L23
	.p2align 4,,10
	.p2align 3
.L9:
	movslq	(%r8), %rdx
	addl	$1, %r9d
	movq	%rdx, %rax
	addl	4(%r8), %eax
	addl	$1, (%rdi,%rdx,4)
	movq	%r8, %rdx
	cmpl	$10000, %eax
	jg	.L10
	.p2align 4,,10
	.p2align 3
.L8:
	movslq	%eax, %rcx
	addl	8(%rdx), %eax
	addq	$4, %rdx
	addl	$1, (%rdi,%rcx,4)
	cmpl	$10000, %eax
	jle	.L8
.L10:
	addq	$4, %r8
	cmpl	%r9d, %esi
	jne	.L9
	ret
.L23:
	ret
	.cfi_endproc
.LFE0:
	.size	createtable, .-createtable
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	table(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	leaq	.LC1(%rip), %r12
	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
	subq	$24, %rsp
	.cfi_def_cfa_offset 64
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rbp
	call	createtable
	jmp	.L26
	.p2align 4,,10
	.p2align 3
.L25:
	movl	0(%r13,%rax,4), %esi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	printf@PLT
.L26:
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	scanf@PLT
	movslq	4(%rsp), %rax
	testl	%eax, %eax
	jne	.L25
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L30
	addq	$24, %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
.L30:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE1:
	.size	main, .-main
	.globl	table
	.bss
	.align 32
	.type	table, @object
	.size	table, 40004
table:
	.zero	40004
	.globl	prime
	.align 32
	.type	prime, @object
	.size	prime, 1200
prime:
	.zero	1200
	.globl	primes
	.align 32
	.type	primes, @object
	.size	primes, 10001
primes:
	.zero	10001
	.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	createtable
	.type	createtable, @function
createtable:
.LFB0:
	.cfi_startproc
	endbr64
	movb	$1, 1+primes(%rip)
	movl	$4, %esi
	movl	$2, %edx
	leaq	primes(%rip), %rcx
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L2:
	addq	$1, %rdx
	addq	$2, %rsi
	cmpq	$10001, %rdx
	je	.L22
.L4:
	cmpb	$0, (%rcx,%rdx)
	jne	.L2
	cmpq	$10000, %rsi
	ja	.L2
	movq	%rsi, %rax
	.p2align 4,,10
	.p2align 3
.L3:
	movb	$1, (%rcx,%rax)
	addq	%rdx, %rax
	cmpl	$10000, %eax
	jle	.L3
	jmp	.L2
.L22:
	movl	$2, %eax
	xorl	%esi, %esi
	leaq	prime(%rip), %rdi
	.p2align 4,,10
	.p2align 3
.L6:
	cmpb	$0, (%rcx,%rax)
	jne	.L5
	movslq	%esi, %rdx
	addl	$1, %esi
	movl	%eax, (%rdi,%rdx,4)
.L5:
	addq	$1, %rax
	cmpq	$10001, %rax
	jne	.L6
	leaq	prime(%rip), %r8
	xorl	%r9d, %r9d
	leaq	table(%rip), %rdi
	testl	%esi, %esi
	je	.L23
	.p2align 4,,10
	.p2align 3
.L9:
	movslq	(%r8), %rdx
	addl	$1, %r9d
	movq	%rdx, %rax
	addl	4(%r8), %eax
	addl	$1, (%rdi,%rdx,4)
	movq	%r8, %rdx
	cmpl	$10000, %eax
	jg	.L10
	.p2align 4,,10
	.p2align 3
.L8:
	movslq	%eax, %rcx
	addl	8(%rdx), %eax
	addq	$4, %rdx
	addl	$1, (%rdi,%rcx,4)
	cmpl	$10000, %eax
	jle	.L8
.L10:
	addq	$4, %r8
	cmpl	%r9d, %esi
	jne	.L9
	ret
.L23:
	ret
	.cfi_endproc
.LFE0:
	.size	createtable, .-createtable
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	table(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	leaq	.LC1(%rip), %r12
	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
	subq	$24, %rsp
	.cfi_def_cfa_offset 64
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rbp
	call	createtable
	jmp	.L26
	.p2align 4,,10
	.p2align 3
.L25:
	movl	0(%r13,%rax,4), %esi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	printf@PLT
.L26:
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	scanf@PLT
	movslq	4(%rsp), %rax
	testl	%eax, %eax
	jne	.L25
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L30
	addq	$24, %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
.L30:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE1:
	.size	main, .-main
	.globl	table
	.bss
	.align 32
	.type	table, @object
	.size	table, 40004
table:
	.zero	40004
	.globl	prime
	.align 32
	.type	prime, @object
	.size	prime, 1200
prime:
	.zero	1200
	.globl	primes
	.align 32
	.type	primes, @object
	.size	primes, 10001
primes:
	.zero	10001
	.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:

#define IN_MAX 10000
char primes[IN_MAX+1];
int prime[300];
int table[IN_MAX+1];

void createtable(){
  int i=2,j,n=0;
  primes[1]=1;
  for(;i<=IN_MAX;i++)
    if(!primes[i])
      for(j=i*2;j<=IN_MAX;j+=i)
        primes[j]=1;

  for(i=2;i<=IN_MAX;i++)
    if(!primes[i])prime[n++]=i;
    
  for(i=0;i<n;i++){
    int x=prime[i];
    table[x]++;
    for(j=i+1;;j++){
      x+=prime[j];
      if(x>IN_MAX)break;
      table[x]++;
    }
  }
}

int main(){
  int n;
  createtable();
  while(1){
    scanf("%d",&n);
    if(!n)return 0;
    printf("%d\n",table[n]);
  }
}
2
3
17
41
20
666
24
53
0
 2
3
17
41
20
666
24
56
0
 2
3
17
41
20
666
24
20
0
 2
3
17
41
20
666
46
53
0
 2
3
17
70
20
666
24
56
0
 2
3
17
34
20
666
24
20
0
 2
6
17
34
20
666
24
20
0
 2
3
2
41
20
666
46
53
0
 2
6
17
34
20
666
24
17
0
 2
3
2
41
20
1171
46
53
0

2028
2030
2139
2342
2153
7649
2208
2413
 2028
2030
2139
2342
2153
7649
2208
2438
 2028
2030
2139
2342
2153
7649
2208
2153
 2028
2030
2139
2342
2153
7649
2371
2413
 2028
2030
2139
2557
2153
7649
2208
2438
 2028
2030
2139
2281
2153
7649
2208
2153
 2028
2063
2139
2281
2153
7649
2208
2153
 2028
2030
2028
2342
2153
7649
2371
2413
 2028
2063
2139
2281
2153
7649
2208
2139
 2028
2030
2028
2342
2153
2
2371
2413

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

```c
#define IN_MAX 10000
char primes[IN_MAX+1];
int prime[300];
int table[IN_MAX+1];

void createtable(){
  int i=2,j,n=0;
  primes[1]=1;
  for(;i<=IN_MAX;i++)
    if(!primes[i])
      for(j=i*2;j<=IN_MAX;j+=i)
        primes[j]=1;

  for(i=2;i<=IN_MAX;i++)
    if(!primes[i])prime[n++]=i;
    
  for(i=0;i<n;i++){
    int x=prime[i];
    table[x]++;
    for(j=i+1;;j++){
      x+=prime[j];
      if(x>IN_MAX)break;
      table[x]++;
    }
  }
}

int main(){
  int n;
  createtable();
  while(1){
    scanf("%d",&n);
    if(!n)return 0;
    printf("%d\n",table[n]);
  }
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	primes
	.bss
	.align 32
	.type	primes, @object
	.size	primes, 10001
primes:
	.zero	10001
	.globl	prime
	.align 32
	.type	prime, @object
	.size	prime, 1200
prime:
	.zero	1200
	.globl	table
	.align 32
	.type	table, @object
	.size	table, 40004
table:
	.zero	40004
	.text
	.globl	createtable
	.type	createtable, @function
createtable:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	$2, -16(%rbp)
	movl	$0, -8(%rbp)
	movb	$1, 1+primes(%rip)
	jmp	.L2
.L6:
	movl	-16(%rbp), %eax
	cltq
	leaq	primes(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	testb	%al, %al
	jne	.L3
	movl	-16(%rbp), %eax
	addl	%eax, %eax
	movl	%eax, -12(%rbp)
	jmp	.L4
.L5:
	movl	-12(%rbp), %eax
	cltq
	leaq	primes(%rip), %rdx
	movb	$1, (%rax,%rdx)
	movl	-16(%rbp), %eax
	addl	%eax, -12(%rbp)
.L4:
	cmpl	$10000, -12(%rbp)
	jle	.L5
.L3:
	addl	$1, -16(%rbp)
.L2:
	cmpl	$10000, -16(%rbp)
	jle	.L6
	movl	$2, -16(%rbp)
	jmp	.L7
.L9:
	movl	-16(%rbp), %eax
	cltq
	leaq	primes(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	testb	%al, %al
	jne	.L8
	movl	-8(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -8(%rbp)
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	prime(%rip), %rdx
	movl	-16(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
.L8:
	addl	$1, -16(%rbp)
.L7:
	cmpl	$10000, -16(%rbp)
	jle	.L9
	movl	$0, -16(%rbp)
	jmp	.L10
.L14:
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	prime(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -4(%rbp)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	table(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	1(%rax), %ecx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	table(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-16(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -12(%rbp)
.L13:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	prime(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, -4(%rbp)
	cmpl	$10000, -4(%rbp)
	jg	.L16
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	table(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	1(%rax), %ecx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	table(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	addl	$1, -12(%rbp)
	jmp	.L13
.L16:
	nop
	addl	$1, -16(%rbp)
.L10:
	movl	-16(%rbp), %eax
	cmpl	-8(%rbp), %eax
	jl	.L14
	nop
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	createtable, .-createtable
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
	.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	$16, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, %eax
	call	createtable
.L20:
	leaq	-12(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	-12(%rbp), %eax
	testl	%eax, %eax
	jne	.L18
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L21
	jmp	.L22
.L18:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	table(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L20
.L22:
	call	__stack_chk_fail@PLT
.L21:
	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	primes
	.bss
	.align 32
	.type	primes, @object
	.size	primes, 10001
primes:
	.zero	10001
	.globl	prime
	.align 32
	.type	prime, @object
	.size	prime, 1200
prime:
	.zero	1200
	.globl	table
	.align 32
	.type	table, @object
	.size	table, 40004
table:
	.zero	40004
	.text
	.globl	createtable
	.type	createtable, @function
createtable:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	$2, -16(%rbp)
	movl	$0, -8(%rbp)
	movb	$1, 1+primes(%rip)
	jmp	.L2
.L6:
	movl	-16(%rbp), %eax
	cltq
	leaq	primes(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	testb	%al, %al
	jne	.L3
	movl	-16(%rbp), %eax
	addl	%eax, %eax
	movl	%eax, -12(%rbp)
	jmp	.L4
.L5:
	movl	-12(%rbp), %eax
	cltq
	leaq	primes(%rip), %rdx
	movb	$1, (%rax,%rdx)
	movl	-16(%rbp), %eax
	addl	%eax, -12(%rbp)
.L4:
	cmpl	$10000, -12(%rbp)
	jle	.L5
.L3:
	addl	$1, -16(%rbp)
.L2:
	cmpl	$10000, -16(%rbp)
	jle	.L6
	movl	$2, -16(%rbp)
	jmp	.L7
.L9:
	movl	-16(%rbp), %eax
	cltq
	leaq	primes(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	testb	%al, %al
	jne	.L8
	movl	-8(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -8(%rbp)
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	prime(%rip), %rdx
	movl	-16(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
.L8:
	addl	$1, -16(%rbp)
.L7:
	cmpl	$10000, -16(%rbp)
	jle	.L9
	movl	$0, -16(%rbp)
	jmp	.L10
.L14:
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	prime(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -4(%rbp)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	table(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	1(%rax), %ecx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	table(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-16(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -12(%rbp)
.L13:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	prime(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, -4(%rbp)
	cmpl	$10000, -4(%rbp)
	jg	.L16
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	table(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	1(%rax), %ecx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	table(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	addl	$1, -12(%rbp)
	jmp	.L13
.L16:
	nop
	addl	$1, -16(%rbp)
.L10:
	movl	-16(%rbp), %eax
	cmpl	-8(%rbp), %eax
	jl	.L14
	nop
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	createtable, .-createtable
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
	.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	$16, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, %eax
	call	createtable
.L20:
	leaq	-12(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	-12(%rbp), %eax
	testl	%eax, %eax
	jne	.L18
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L21
	jmp	.L22
.L18:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	table(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L20
.L22:
	call	__stack_chk_fail@PLT
.L21:
	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:
