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 fib(int);
int f[45];

int main()
{
  int a,n;

  scanf("%d",&n);

  a = fib(n);
  printf("%d\n",a);

  return 0;
}

int fib(int n){

  int a;

  if(a = f[n])
    return a;
  
  if(n==0 || n==1){
    a = 1;
  }
  else
    a = fib(n-1)+fib(n-2);

  f[n] = a;
  return a;
}

```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	f
	.bss
	.align 32
	.type	f, @object
	.size	f, 180
f:
	.zero	180
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
	.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	$16, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-16(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-16(%rbp), %eax
	movl	%eax, %edi
	call	fib
	movl	%eax, -12(%rbp)
	movl	-12(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L3
	call	__stack_chk_fail@PLT
.L3:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	fib
	.type	fib, @function
fib:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%rbx
	subq	$40, %rsp
	.cfi_offset 3, -24
	movl	%edi, -36(%rbp)
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	f(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -20(%rbp)
	cmpl	$0, -20(%rbp)
	je	.L5
	movl	-20(%rbp), %eax
	jmp	.L6
.L5:
	cmpl	$0, -36(%rbp)
	je	.L7
	cmpl	$1, -36(%rbp)
	jne	.L8
.L7:
	movl	$1, -20(%rbp)
	jmp	.L9
.L8:
	movl	-36(%rbp), %eax
	subl	$1, %eax
	movl	%eax, %edi
	call	fib
	movl	%eax, %ebx
	movl	-36(%rbp), %eax
	subl	$2, %eax
	movl	%eax, %edi
	call	fib
	addl	%ebx, %eax
	movl	%eax, -20(%rbp)
.L9:
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	f(%rip), %rdx
	movl	-20(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-20(%rbp), %eax
.L6:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	fib, .-fib
	.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	fib
	.type	fib, @function
fib:
.LFB24:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movslq	%edi, %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	leaq	f(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$8, %rsp
	.cfi_def_cfa_offset 64
	movl	(%r12,%r13,4), %eax
	testl	%eax, %eax
	jne	.L1
	movq	%r13, %rbp
	movl	$1, %eax
	cmpl	$1, %r13d
	ja	.L13
.L3:
	movl	%eax, (%r12,%r13,4)
.L1:
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L13:
	.cfi_restore_state
	leal	-1(%r13), %eax
	leal	-2(%r13), %ebx
	movslq	%eax, %r15
	movl	(%r12,%r15,4), %r14d
	testl	%r14d, %r14d
	jne	.L4
	movl	$1, %r14d
	cmpl	$1, %eax
	jbe	.L5
	movl	%ebx, %edi
	call	fib
	leal	-3(%r13), %edi
	movl	%eax, %r14d
	call	fib
	addl	%eax, %r14d
.L5:
	movl	%r14d, (%r12,%r15,4)
.L4:
	movslq	%ebx, %r15
	movl	(%r12,%r15,4), %eax
	testl	%eax, %eax
	jne	.L6
	movl	$1, %eax
	cmpl	$1, %ebx
	jbe	.L7
	leal	-3(%rbp), %edi
	call	fib
	leal	-4(%rbp), %edi
	movl	%eax, %ebx
	call	fib
	addl	%ebx, %eax
.L7:
	movl	%eax, (%r12,%r15,4)
.L6:
	addl	%r14d, %eax
	jmp	.L3
	.cfi_endproc
.LFE24:
	.size	fib, .-fib
	.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:
.LFB23:
	.cfi_startproc
	endbr64
	subq	$24, %rsp
	.cfi_def_cfa_offset 32
	leaq	.LC0(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movslq	4(%rsp), %r8
	leaq	f(%rip), %rsi
	movl	(%rsi,%r8,4), %edx
	testl	%edx, %edx
	jne	.L15
	movl	$1, %edx
	cmpl	$1, %r8d
	ja	.L23
.L16:
	movl	%edx, (%rsi,%r8,4)
.L15:
	xorl	%eax, %eax
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L24
	xorl	%eax, %eax
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
.L23:
	.cfi_restore_state
	leal	-1(%r8), %eax
	leal	-2(%r8), %r10d
	movslq	%eax, %r9
	movl	(%rsi,%r9,4), %edx
	testl	%edx, %edx
	jne	.L17
	movl	$1, %edx
	cmpl	$1, %eax
	jbe	.L18
	movl	%r10d, %edi
	call	fib
	leal	-3(%r8), %edi
	movl	%eax, %edx
	call	fib
	addl	%eax, %edx
.L18:
	movl	%edx, (%rsi,%r9,4)
.L17:
	movl	%r10d, %edi
	call	fib
	addl	%eax, %edx
	jmp	.L16
.L24:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	f
	.bss
	.align 32
	.type	f, @object
	.size	f, 180
f:
	.zero	180
	.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	fib
	.type	fib, @function
fib:
.LFB24:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movslq	%edi, %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	leaq	f(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$8, %rsp
	.cfi_def_cfa_offset 64
	movl	(%r12,%r13,4), %eax
	testl	%eax, %eax
	jne	.L1
	movq	%r13, %rbp
	movl	$1, %eax
	cmpl	$1, %r13d
	ja	.L13
.L3:
	movl	%eax, (%r12,%r13,4)
.L1:
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L13:
	.cfi_restore_state
	leal	-1(%r13), %eax
	leal	-2(%r13), %ebx
	movslq	%eax, %r15
	movl	(%r12,%r15,4), %r14d
	testl	%r14d, %r14d
	jne	.L4
	movl	$1, %r14d
	cmpl	$1, %eax
	jbe	.L5
	movl	%ebx, %edi
	call	fib
	leal	-3(%r13), %edi
	movl	%eax, %r14d
	call	fib
	addl	%eax, %r14d
.L5:
	movl	%r14d, (%r12,%r15,4)
.L4:
	movslq	%ebx, %r15
	movl	(%r12,%r15,4), %eax
	testl	%eax, %eax
	jne	.L6
	movl	$1, %eax
	cmpl	$1, %ebx
	jbe	.L7
	leal	-3(%rbp), %edi
	call	fib
	leal	-4(%rbp), %edi
	movl	%eax, %ebx
	call	fib
	addl	%ebx, %eax
.L7:
	movl	%eax, (%r12,%r15,4)
.L6:
	addl	%r14d, %eax
	jmp	.L3
	.cfi_endproc
.LFE24:
	.size	fib, .-fib
	.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:
.LFB23:
	.cfi_startproc
	endbr64
	subq	$24, %rsp
	.cfi_def_cfa_offset 32
	leaq	.LC0(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movslq	4(%rsp), %r8
	leaq	f(%rip), %rsi
	movl	(%rsi,%r8,4), %edx
	testl	%edx, %edx
	jne	.L15
	movl	$1, %edx
	cmpl	$1, %r8d
	ja	.L23
.L16:
	movl	%edx, (%rsi,%r8,4)
.L15:
	xorl	%eax, %eax
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L24
	xorl	%eax, %eax
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
.L23:
	.cfi_restore_state
	leal	-1(%r8), %eax
	leal	-2(%r8), %r10d
	movslq	%eax, %r9
	movl	(%rsi,%r9,4), %edx
	testl	%edx, %edx
	jne	.L17
	movl	$1, %edx
	cmpl	$1, %eax
	jbe	.L18
	movl	%r10d, %edi
	call	fib
	leal	-3(%r8), %edi
	movl	%eax, %edx
	call	fib
	addl	%eax, %edx
.L18:
	movl	%edx, (%rsi,%r9,4)
.L17:
	movl	%r10d, %edi
	call	fib
	addl	%eax, %edx
	jmp	.L16
.L24:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	f
	.bss
	.align 32
	.type	f, @object
	.size	f, 180
f:
	.zero	180
	.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 fib(int);
int f[45];

int main()
{
  int a,n;

  scanf("%d",&n);

  a = fib(n);
  printf("%d\n",a);

  return 0;
}

int fib(int n){

  int a;

  if(a = f[n])
    return a;
  
  if(n==0 || n==1){
    a = 1;
  }
  else
    a = fib(n-1)+fib(n-2);

  f[n] = a;
  return a;
}


1
 2
 4
 8
 6
 15
 7
 24
 14
 5

1
 2
 5
 34
 13
 987
 21
 75025
 610
 8

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 fib(int);
int f[45];

int main()
{
  int a,n;

  scanf("%d",&n);

  a = fib(n);
  printf("%d\n",a);

  return 0;
}

int fib(int n){

  int a;

  if(a = f[n])
    return a;
  
  if(n==0 || n==1){
    a = 1;
  }
  else
    a = fib(n-1)+fib(n-2);

  f[n] = a;
  return a;
}

```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	f
	.bss
	.align 32
	.type	f, @object
	.size	f, 180
f:
	.zero	180
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
	.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	$16, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-16(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-16(%rbp), %eax
	movl	%eax, %edi
	call	fib
	movl	%eax, -12(%rbp)
	movl	-12(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L3
	call	__stack_chk_fail@PLT
.L3:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	fib
	.type	fib, @function
fib:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%rbx
	subq	$40, %rsp
	.cfi_offset 3, -24
	movl	%edi, -36(%rbp)
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	f(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -20(%rbp)
	cmpl	$0, -20(%rbp)
	je	.L5
	movl	-20(%rbp), %eax
	jmp	.L6
.L5:
	cmpl	$0, -36(%rbp)
	je	.L7
	cmpl	$1, -36(%rbp)
	jne	.L8
.L7:
	movl	$1, -20(%rbp)
	jmp	.L9
.L8:
	movl	-36(%rbp), %eax
	subl	$1, %eax
	movl	%eax, %edi
	call	fib
	movl	%eax, %ebx
	movl	-36(%rbp), %eax
	subl	$2, %eax
	movl	%eax, %edi
	call	fib
	addl	%ebx, %eax
	movl	%eax, -20(%rbp)
.L9:
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	f(%rip), %rdx
	movl	-20(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-20(%rbp), %eax
.L6:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	fib, .-fib
	.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	f
	.bss
	.align 32
	.type	f, @object
	.size	f, 180
f:
	.zero	180
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
	.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	$16, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-16(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-16(%rbp), %eax
	movl	%eax, %edi
	call	fib
	movl	%eax, -12(%rbp)
	movl	-12(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L3
	call	__stack_chk_fail@PLT
.L3:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	fib
	.type	fib, @function
fib:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%rbx
	subq	$40, %rsp
	.cfi_offset 3, -24
	movl	%edi, -36(%rbp)
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	f(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -20(%rbp)
	cmpl	$0, -20(%rbp)
	je	.L5
	movl	-20(%rbp), %eax
	jmp	.L6
.L5:
	cmpl	$0, -36(%rbp)
	je	.L7
	cmpl	$1, -36(%rbp)
	jne	.L8
.L7:
	movl	$1, -20(%rbp)
	jmp	.L9
.L8:
	movl	-36(%rbp), %eax
	subl	$1, %eax
	movl	%eax, %edi
	call	fib
	movl	%eax, %ebx
	movl	-36(%rbp), %eax
	subl	$2, %eax
	movl	%eax, %edi
	call	fib
	addl	%ebx, %eax
	movl	%eax, -20(%rbp)
.L9:
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	f(%rip), %rdx
	movl	-20(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-20(%rbp), %eax
.L6:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	fib, .-fib
	.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:
