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 rep(i,n,m) for((i)=(int)(n);(i)<=(int)(m);(i)++)

int memo[301];

int main(void){
  int i,j,n,coin[18];

  rep(i,0,16)coin[i]=(i+1)*(i+1);
  memo[0]=1;

  rep(i,0,16)rep(j,1,300)
    if(j>=coin[i])memo[j]+=memo[j-coin[i]];
  
  while(scanf("%d",&n),n)
    printf("%d\n",memo[n]);
  
  return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	memo
	.bss
	.align 32
	.type	memo, @object
	.size	memo, 1204
memo:
	.zero	1204
	.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	$96, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -88(%rbp)
	jmp	.L2
.L3:
	movl	-88(%rbp), %eax
	leal	1(%rax), %edx
	movl	-88(%rbp), %eax
	addl	$1, %eax
	imull	%eax, %edx
	movl	-88(%rbp), %eax
	cltq
	movl	%edx, -80(%rbp,%rax,4)
	addl	$1, -88(%rbp)
.L2:
	cmpl	$16, -88(%rbp)
	jle	.L3
	movl	$1, memo(%rip)
	movl	$0, -88(%rbp)
	jmp	.L4
.L8:
	movl	$1, -84(%rbp)
	jmp	.L5
.L7:
	movl	-88(%rbp), %eax
	cltq
	movl	-80(%rbp,%rax,4), %eax
	cmpl	%eax, -84(%rbp)
	jl	.L6
	movl	-84(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	memo(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-88(%rbp), %eax
	cltq
	movl	-80(%rbp,%rax,4), %edx
	movl	-84(%rbp), %eax
	subl	%edx, %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	memo(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, %ecx
	movl	-84(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	memo(%rip), %rax
	movl	%ecx, (%rdx,%rax)
.L6:
	addl	$1, -84(%rbp)
.L5:
	cmpl	$300, -84(%rbp)
	jle	.L7
	addl	$1, -88(%rbp)
.L4:
	cmpl	$16, -88(%rbp)
	jle	.L8
	jmp	.L9
.L10:
	movl	-92(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	memo(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L9:
	leaq	-92(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-92(%rbp), %eax
	testl	%eax, %eax
	jne	.L10
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L12
	call	__stack_chk_fail@PLT
.L12:
	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
.LC4:
	.string	"%d\n"
.LC5:
	.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
	movl	$1, %r11d
	movl	$301, %r10d
	leaq	memo(%rip), %r8
	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	$104, %rsp
	.cfi_def_cfa_offset 144
	movdqa	.LC0(%rip), %xmm0
	movq	%fs:40, %rax
	movq	%rax, 88(%rsp)
	xorl	%eax, %eax
	movl	$289, 80(%rsp)
	leaq	16(%rsp), %r9
	leaq	84(%rsp), %rbx
	movaps	%xmm0, 16(%rsp)
	movdqa	.LC1(%rip), %xmm0
	movl	$1, memo(%rip)
	movaps	%xmm0, 32(%rsp)
	movdqa	.LC2(%rip), %xmm0
	movaps	%xmm0, 48(%rsp)
	movdqa	.LC3(%rip), %xmm0
	movaps	%xmm0, 64(%rsp)
.L2:
	movl	(%r9), %ecx
	movl	%r11d, %eax
	movl	%r10d, %edi
	leaq	4+memo(%rip), %rdx
	subl	%ecx, %eax
	subl	%ecx, %edi
	.p2align 4,,10
	.p2align 3
.L4:
	leal	(%rax,%rcx), %esi
	cmpl	%esi, %ecx
	jg	.L3
	movslq	%eax, %rsi
	movl	(%r8,%rsi,4), %esi
	addl	%esi, (%rdx)
.L3:
	addl	$1, %eax
	addq	$4, %rdx
	cmpl	%edi, %eax
	jne	.L4
	addq	$4, %r9
	cmpq	%r9, %rbx
	jne	.L2
	leaq	12(%rsp), %rbp
	leaq	.LC5(%rip), %rbx
	leaq	memo(%rip), %r13
	leaq	.LC4(%rip), %r12
	jmp	.L5
.L6:
	movl	0(%r13,%rax,4), %edx
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L5:
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	12(%rsp), %rax
	testl	%eax, %eax
	jne	.L6
	movq	88(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L12
	addq	$104, %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
.L12:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	memo
	.bss
	.align 32
	.type	memo, @object
	.size	memo, 1204
memo:
	.zero	1204
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.long	1
	.long	4
	.long	9
	.long	16
	.align 16
.LC1:
	.long	25
	.long	36
	.long	49
	.long	64
	.align 16
.LC2:
	.long	81
	.long	100
	.long	121
	.long	144
	.align 16
.LC3:
	.long	169
	.long	196
	.long	225
	.long	256
	.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
.LC4:
	.string	"%d\n"
.LC5:
	.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
	movl	$1, %r11d
	movl	$301, %r10d
	leaq	memo(%rip), %r8
	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	$104, %rsp
	.cfi_def_cfa_offset 144
	movdqa	.LC0(%rip), %xmm0
	movq	%fs:40, %rax
	movq	%rax, 88(%rsp)
	xorl	%eax, %eax
	movl	$289, 80(%rsp)
	leaq	16(%rsp), %r9
	leaq	84(%rsp), %rbx
	movaps	%xmm0, 16(%rsp)
	movdqa	.LC1(%rip), %xmm0
	movl	$1, memo(%rip)
	movaps	%xmm0, 32(%rsp)
	movdqa	.LC2(%rip), %xmm0
	movaps	%xmm0, 48(%rsp)
	movdqa	.LC3(%rip), %xmm0
	movaps	%xmm0, 64(%rsp)
.L2:
	movl	(%r9), %ecx
	movl	%r11d, %eax
	movl	%r10d, %edi
	leaq	4+memo(%rip), %rdx
	subl	%ecx, %eax
	subl	%ecx, %edi
	.p2align 4,,10
	.p2align 3
.L4:
	leal	(%rax,%rcx), %esi
	cmpl	%esi, %ecx
	jg	.L3
	movslq	%eax, %rsi
	movl	(%r8,%rsi,4), %esi
	addl	%esi, (%rdx)
.L3:
	addl	$1, %eax
	addq	$4, %rdx
	cmpl	%edi, %eax
	jne	.L4
	addq	$4, %r9
	cmpq	%r9, %rbx
	jne	.L2
	leaq	12(%rsp), %rbp
	leaq	.LC5(%rip), %rbx
	leaq	memo(%rip), %r13
	leaq	.LC4(%rip), %r12
	jmp	.L5
.L6:
	movl	0(%r13,%rax,4), %edx
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L5:
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	12(%rsp), %rax
	testl	%eax, %eax
	jne	.L6
	movq	88(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L12
	addq	$104, %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
.L12:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	memo
	.bss
	.align 32
	.type	memo, @object
	.size	memo, 1204
memo:
	.zero	1204
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.long	1
	.long	4
	.long	9
	.long	16
	.align 16
.LC1:
	.long	25
	.long	36
	.long	49
	.long	64
	.align 16
.LC2:
	.long	81
	.long	100
	.long	121
	.long	144
	.align 16
.LC3:
	.long	169
	.long	196
	.long	225
	.long	256
	.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 rep(i,n,m) for((i)=(int)(n);(i)<=(int)(m);(i)++)

int memo[301];

int main(void){
  int i,j,n,coin[18];

  rep(i,0,16)coin[i]=(i+1)*(i+1);
  memo[0]=1;

  rep(i,0,16)rep(j,1,300)
    if(j>=coin[i])memo[j]+=memo[j-coin[i]];
  
  while(scanf("%d",&n),n)
    printf("%d\n",memo[n]);
  
  return 0;
}
2
10
12
0
 2
11
3
0
 2
16
3
0
 2
14
3
0
 2
10
39
0
 2
11
6
0
 2
17
39
0
 2
4
1
0
 2
2
6
0
 2
17
37
0

1
4
5
 1
4
1
 1
8
1
 1
6
1
 1
4
50
 1
4
2
 1
9
50
 1
2
1
 1
1
2
 1
9
46

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 rep(i,n,m) for((i)=(int)(n);(i)<=(int)(m);(i)++)

int memo[301];

int main(void){
  int i,j,n,coin[18];

  rep(i,0,16)coin[i]=(i+1)*(i+1);
  memo[0]=1;

  rep(i,0,16)rep(j,1,300)
    if(j>=coin[i])memo[j]+=memo[j-coin[i]];
  
  while(scanf("%d",&n),n)
    printf("%d\n",memo[n]);
  
  return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	memo
	.bss
	.align 32
	.type	memo, @object
	.size	memo, 1204
memo:
	.zero	1204
	.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	$96, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -88(%rbp)
	jmp	.L2
.L3:
	movl	-88(%rbp), %eax
	leal	1(%rax), %edx
	movl	-88(%rbp), %eax
	addl	$1, %eax
	imull	%eax, %edx
	movl	-88(%rbp), %eax
	cltq
	movl	%edx, -80(%rbp,%rax,4)
	addl	$1, -88(%rbp)
.L2:
	cmpl	$16, -88(%rbp)
	jle	.L3
	movl	$1, memo(%rip)
	movl	$0, -88(%rbp)
	jmp	.L4
.L8:
	movl	$1, -84(%rbp)
	jmp	.L5
.L7:
	movl	-88(%rbp), %eax
	cltq
	movl	-80(%rbp,%rax,4), %eax
	cmpl	%eax, -84(%rbp)
	jl	.L6
	movl	-84(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	memo(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-88(%rbp), %eax
	cltq
	movl	-80(%rbp,%rax,4), %edx
	movl	-84(%rbp), %eax
	subl	%edx, %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	memo(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, %ecx
	movl	-84(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	memo(%rip), %rax
	movl	%ecx, (%rdx,%rax)
.L6:
	addl	$1, -84(%rbp)
.L5:
	cmpl	$300, -84(%rbp)
	jle	.L7
	addl	$1, -88(%rbp)
.L4:
	cmpl	$16, -88(%rbp)
	jle	.L8
	jmp	.L9
.L10:
	movl	-92(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	memo(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L9:
	leaq	-92(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-92(%rbp), %eax
	testl	%eax, %eax
	jne	.L10
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L12
	call	__stack_chk_fail@PLT
.L12:
	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
	.globl	memo
	.bss
	.align 32
	.type	memo, @object
	.size	memo, 1204
memo:
	.zero	1204
	.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	$96, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -88(%rbp)
	jmp	.L2
.L3:
	movl	-88(%rbp), %eax
	leal	1(%rax), %edx
	movl	-88(%rbp), %eax
	addl	$1, %eax
	imull	%eax, %edx
	movl	-88(%rbp), %eax
	cltq
	movl	%edx, -80(%rbp,%rax,4)
	addl	$1, -88(%rbp)
.L2:
	cmpl	$16, -88(%rbp)
	jle	.L3
	movl	$1, memo(%rip)
	movl	$0, -88(%rbp)
	jmp	.L4
.L8:
	movl	$1, -84(%rbp)
	jmp	.L5
.L7:
	movl	-88(%rbp), %eax
	cltq
	movl	-80(%rbp,%rax,4), %eax
	cmpl	%eax, -84(%rbp)
	jl	.L6
	movl	-84(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	memo(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-88(%rbp), %eax
	cltq
	movl	-80(%rbp,%rax,4), %edx
	movl	-84(%rbp), %eax
	subl	%edx, %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	memo(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, %ecx
	movl	-84(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	memo(%rip), %rax
	movl	%ecx, (%rdx,%rax)
.L6:
	addl	$1, -84(%rbp)
.L5:
	cmpl	$300, -84(%rbp)
	jle	.L7
	addl	$1, -88(%rbp)
.L4:
	cmpl	$16, -88(%rbp)
	jle	.L8
	jmp	.L9
.L10:
	movl	-92(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	memo(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L9:
	leaq	-92(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-92(%rbp), %eax
	testl	%eax, %eax
	jne	.L10
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L12
	call	__stack_chk_fail@PLT
.L12:
	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:
