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

```c
//2001年アジアA Starship Hakodate-maru

#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int Max(int n1,int n2);

int main(){
	int f1[54]={0},f2[96]={0};
	for(int i=0;i<54;i++) f1[i] = i*i*i;
	for(int i=0;i<96;i++) f2[i] = i*(i+1)*(i+2)/6;
	int num;
  while(scanf("%d",&num),num){
		int max=0;
		for(int i=0;i<54;i++){
			for(int j=0;j<96;j++){
				if(f1[i]+f2[j]<=num) max=Max(max,f1[i]+f2[j]);
			}
		}
		printf("%d\n",max );
  }
  exit(0);
}

int Max(int n1,int n2){
  if(n1>n2)return n1;
  else return n2;
}

```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d\n"
.LC1:
	.string	"%d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$656, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-624(%rbp), %rdx
	movl	$0, %eax
	movl	$27, %ecx
	movq	%rdx, %rdi
	rep stosq
	leaq	-400(%rbp), %rdx
	movl	$0, %eax
	movl	$48, %ecx
	movq	%rdx, %rdi
	rep stosq
	movl	$0, -644(%rbp)
	jmp	.L2
.L3:
	movl	-644(%rbp), %eax
	imull	%eax, %eax
	imull	-644(%rbp), %eax
	movl	%eax, %edx
	movl	-644(%rbp), %eax
	cltq
	movl	%edx, -624(%rbp,%rax,4)
	addl	$1, -644(%rbp)
.L2:
	cmpl	$53, -644(%rbp)
	jle	.L3
	movl	$0, -640(%rbp)
	jmp	.L4
.L5:
	movl	-640(%rbp), %eax
	addl	$1, %eax
	imull	-640(%rbp), %eax
	movl	-640(%rbp), %edx
	addl	$2, %edx
	imull	%edx, %eax
	movslq	%eax, %rdx
	imulq	$715827883, %rdx, %rdx
	shrq	$32, %rdx
	sarl	$31, %eax
	subl	%eax, %edx
	movl	-640(%rbp), %eax
	cltq
	movl	%edx, -400(%rbp,%rax,4)
	addl	$1, -640(%rbp)
.L4:
	cmpl	$95, -640(%rbp)
	jle	.L5
	jmp	.L6
.L12:
	movl	$0, -636(%rbp)
	movl	$0, -632(%rbp)
	jmp	.L7
.L11:
	movl	$0, -628(%rbp)
	jmp	.L8
.L10:
	movl	-632(%rbp), %eax
	cltq
	movl	-624(%rbp,%rax,4), %edx
	movl	-628(%rbp), %eax
	cltq
	movl	-400(%rbp,%rax,4), %eax
	addl	%eax, %edx
	movl	-648(%rbp), %eax
	cmpl	%eax, %edx
	jg	.L9
	movl	-632(%rbp), %eax
	cltq
	movl	-624(%rbp,%rax,4), %edx
	movl	-628(%rbp), %eax
	cltq
	movl	-400(%rbp,%rax,4), %eax
	addl	%eax, %edx
	movl	-636(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	Max
	movl	%eax, -636(%rbp)
.L9:
	addl	$1, -628(%rbp)
.L8:
	cmpl	$95, -628(%rbp)
	jle	.L10
	addl	$1, -632(%rbp)
.L7:
	cmpl	$53, -632(%rbp)
	jle	.L11
	movl	-636(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L6:
	leaq	-648(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-648(%rbp), %eax
	testl	%eax, %eax
	jne	.L12
	movl	$0, %edi
	call	exit@PLT
	.cfi_endproc
.LFE6:
	.size	main, .-main
	.globl	Max
	.type	Max, @function
Max:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	-4(%rbp), %eax
	cmpl	-8(%rbp), %eax
	jle	.L15
	movl	-4(%rbp), %eax
	jmp	.L16
.L15:
	movl	-8(%rbp), %eax
.L16:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	Max, .-Max
	.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
.LC19:
	.string	"%d\n"
.LC20:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	movl	$48, %ecx
	pxor	%xmm3, %xmm3
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	movdqa	%xmm3, %xmm5
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	subq	$640, %rsp
	.cfi_def_cfa_offset 688
	movdqa	.LC1(%rip), %xmm0
	movq	%fs:40, %rax
	movq	%rax, 632(%rsp)
	xorl	%eax, %eax
	leaq	240(%rsp), %rdi
	leaq	240(%rsp), %r14
	movaps	%xmm0, 16(%rsp)
	movdqa	.LC2(%rip), %xmm0
	leaq	624(%rsp), %r13
	movaps	%xmm0, 32(%rsp)
	movdqa	.LC3(%rip), %xmm0
	movaps	%xmm0, 48(%rsp)
	movdqa	.LC4(%rip), %xmm0
	rep stosq
	movaps	%xmm0, 64(%rsp)
	movdqa	.LC5(%rip), %xmm0
	movaps	%xmm0, 80(%rsp)
	movdqa	.LC6(%rip), %xmm0
	movaps	%xmm0, 96(%rsp)
	movdqa	.LC7(%rip), %xmm0
	movaps	%xmm0, 112(%rsp)
	movdqa	.LC8(%rip), %xmm0
	movaps	%xmm0, 128(%rsp)
	movdqa	.LC9(%rip), %xmm0
	movaps	%xmm0, 144(%rsp)
	movdqa	.LC10(%rip), %xmm0
	movaps	%xmm0, 160(%rsp)
	movdqa	.LC11(%rip), %xmm0
	movaps	%xmm0, 176(%rsp)
	movdqa	.LC12(%rip), %xmm0
	movaps	%xmm0, 192(%rsp)
	movdqa	.LC18(%rip), %xmm2
	movq	.LC14(%rip), %rax
	movdqa	.LC13(%rip), %xmm0
	movdqa	.LC0(%rip), %xmm4
	pcmpgtd	%xmm2, %xmm5
	movdqa	.LC16(%rip), %xmm7
	movdqa	.LC15(%rip), %xmm8
	movq	%rax, 224(%rsp)
	movdqa	.LC17(%rip), %xmm6
	movaps	%xmm0, 208(%rsp)
	movq	%r14, %rax
.L2:
	movdqa	%xmm4, %xmm0
	addq	$16, %rax
	paddd	%xmm8, %xmm4
	movdqa	%xmm0, %xmm9
	movdqa	%xmm0, %xmm10
	paddd	%xmm7, %xmm9
	psrlq	$32, %xmm10
	movdqa	%xmm9, %xmm1
	psrlq	$32, %xmm9
	pmuludq	%xmm0, %xmm1
	pmuludq	%xmm10, %xmm9
	paddd	%xmm6, %xmm0
	movdqa	%xmm5, %xmm10
	pshufd	$8, %xmm9, %xmm9
	pshufd	$8, %xmm1, %xmm1
	punpckldq	%xmm9, %xmm1
	movdqa	%xmm0, %xmm9
	movdqa	%xmm1, %xmm0
	psrlq	$32, %xmm1
	pmuludq	%xmm9, %xmm0
	psrlq	$32, %xmm9
	pmuludq	%xmm9, %xmm1
	movdqa	%xmm3, %xmm9
	pshufd	$8, %xmm0, %xmm0
	pshufd	$8, %xmm1, %xmm1
	punpckldq	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	punpckldq	%xmm0, %xmm1
	punpckhdq	%xmm0, %xmm0
	pcmpgtd	%xmm1, %xmm9
	pmuludq	%xmm1, %xmm10
	pmuludq	%xmm2, %xmm1
	pmuludq	%xmm2, %xmm9
	paddq	%xmm10, %xmm9
	movdqa	%xmm5, %xmm10
	psllq	$32, %xmm9
	pmuludq	%xmm0, %xmm10
	paddq	%xmm9, %xmm1
	movdqa	%xmm3, %xmm9
	pcmpgtd	%xmm0, %xmm9
	pmuludq	%xmm2, %xmm0
	pmuludq	%xmm2, %xmm9
	paddq	%xmm10, %xmm9
	psllq	$32, %xmm9
	paddq	%xmm9, %xmm0
	shufps	$221, %xmm0, %xmm1
	movaps	%xmm1, -16(%rax)
	cmpq	%r13, %rax
	jne	.L2
	leaq	12(%rsp), %r12
	leaq	.LC20(%rip), %rbp
	leaq	.LC19(%rip), %rbx
.L3:
	movq	%r12, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %r8d
	testl	%r8d, %r8d
	je	.L7
	leaq	16(%rsp), %r9
	leaq	232(%rsp), %r10
	xorl	%edx, %edx
	.p2align 4,,10
	.p2align 3
.L6:
	movl	(%r9), %edi
	movq	%r14, %rax
	.p2align 4,,10
	.p2align 3
.L5:
	movl	(%rax), %ecx
	addl	%edi, %ecx
	cmpl	%ecx, %edx
	movl	%ecx, %esi
	cmovge	%edx, %esi
	cmpl	%ecx, %r8d
	cmovge	%esi, %edx
	addq	$4, %rax
	cmpq	%r13, %rax
	jne	.L5
	addq	$4, %r9
	cmpq	%r9, %r10
	jne	.L6
	movq	%rbx, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L3
.L7:
	xorl	%edi, %edi
	call	exit@PLT
	.cfi_endproc
.LFE39:
	.size	main, .-main
	.text
	.p2align 4
	.globl	Max
	.type	Max, @function
Max:
.LFB40:
	.cfi_startproc
	endbr64
	cmpl	%esi, %edi
	movl	%esi, %eax
	cmovge	%edi, %eax
	ret
	.cfi_endproc
.LFE40:
	.size	Max, .-Max
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.long	0
	.long	1
	.long	2
	.long	3
	.align 16
.LC1:
	.long	0
	.long	1
	.long	8
	.long	27
	.align 16
.LC2:
	.long	64
	.long	125
	.long	216
	.long	343
	.align 16
.LC3:
	.long	512
	.long	729
	.long	1000
	.long	1331
	.align 16
.LC4:
	.long	1728
	.long	2197
	.long	2744
	.long	3375
	.align 16
.LC5:
	.long	4096
	.long	4913
	.long	5832
	.long	6859
	.align 16
.LC6:
	.long	8000
	.long	9261
	.long	10648
	.long	12167
	.align 16
.LC7:
	.long	13824
	.long	15625
	.long	17576
	.long	19683
	.align 16
.LC8:
	.long	21952
	.long	24389
	.long	27000
	.long	29791
	.align 16
.LC9:
	.long	32768
	.long	35937
	.long	39304
	.long	42875
	.align 16
.LC10:
	.long	46656
	.long	50653
	.long	54872
	.long	59319
	.align 16
.LC11:
	.long	64000
	.long	68921
	.long	74088
	.long	79507
	.align 16
.LC12:
	.long	85184
	.long	91125
	.long	97336
	.long	103823
	.align 16
.LC13:
	.long	110592
	.long	117649
	.long	125000
	.long	132651
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC14:
	.long	140608
	.long	148877
	.section	.rodata.cst16
	.align 16
.LC15:
	.long	4
	.long	4
	.long	4
	.long	4
	.align 16
.LC16:
	.long	1
	.long	1
	.long	1
	.long	1
	.align 16
.LC17:
	.long	2
	.long	2
	.long	2
	.long	2
	.align 16
.LC18:
	.long	715827883
	.long	715827883
	.long	715827883
	.long	715827883
	.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
.LC19:
	.string	"%d\n"
.LC20:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	movl	$48, %ecx
	pxor	%xmm3, %xmm3
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	movdqa	%xmm3, %xmm5
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	subq	$640, %rsp
	.cfi_def_cfa_offset 688
	movdqa	.LC1(%rip), %xmm0
	movq	%fs:40, %rax
	movq	%rax, 632(%rsp)
	xorl	%eax, %eax
	leaq	240(%rsp), %rdi
	leaq	240(%rsp), %r14
	movaps	%xmm0, 16(%rsp)
	movdqa	.LC2(%rip), %xmm0
	leaq	624(%rsp), %r13
	movaps	%xmm0, 32(%rsp)
	movdqa	.LC3(%rip), %xmm0
	movaps	%xmm0, 48(%rsp)
	movdqa	.LC4(%rip), %xmm0
	rep stosq
	movaps	%xmm0, 64(%rsp)
	movdqa	.LC5(%rip), %xmm0
	movaps	%xmm0, 80(%rsp)
	movdqa	.LC6(%rip), %xmm0
	movaps	%xmm0, 96(%rsp)
	movdqa	.LC7(%rip), %xmm0
	movaps	%xmm0, 112(%rsp)
	movdqa	.LC8(%rip), %xmm0
	movaps	%xmm0, 128(%rsp)
	movdqa	.LC9(%rip), %xmm0
	movaps	%xmm0, 144(%rsp)
	movdqa	.LC10(%rip), %xmm0
	movaps	%xmm0, 160(%rsp)
	movdqa	.LC11(%rip), %xmm0
	movaps	%xmm0, 176(%rsp)
	movdqa	.LC12(%rip), %xmm0
	movaps	%xmm0, 192(%rsp)
	movdqa	.LC18(%rip), %xmm2
	movq	.LC14(%rip), %rax
	movdqa	.LC13(%rip), %xmm0
	movdqa	.LC0(%rip), %xmm4
	pcmpgtd	%xmm2, %xmm5
	movdqa	.LC16(%rip), %xmm7
	movdqa	.LC15(%rip), %xmm8
	movq	%rax, 224(%rsp)
	movdqa	.LC17(%rip), %xmm6
	movaps	%xmm0, 208(%rsp)
	movq	%r14, %rax
.L2:
	movdqa	%xmm4, %xmm0
	addq	$16, %rax
	paddd	%xmm8, %xmm4
	movdqa	%xmm0, %xmm9
	movdqa	%xmm0, %xmm10
	paddd	%xmm7, %xmm9
	psrlq	$32, %xmm10
	movdqa	%xmm9, %xmm1
	psrlq	$32, %xmm9
	pmuludq	%xmm0, %xmm1
	pmuludq	%xmm10, %xmm9
	paddd	%xmm6, %xmm0
	movdqa	%xmm5, %xmm10
	pshufd	$8, %xmm9, %xmm9
	pshufd	$8, %xmm1, %xmm1
	punpckldq	%xmm9, %xmm1
	movdqa	%xmm0, %xmm9
	movdqa	%xmm1, %xmm0
	psrlq	$32, %xmm1
	pmuludq	%xmm9, %xmm0
	psrlq	$32, %xmm9
	pmuludq	%xmm9, %xmm1
	movdqa	%xmm3, %xmm9
	pshufd	$8, %xmm0, %xmm0
	pshufd	$8, %xmm1, %xmm1
	punpckldq	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	punpckldq	%xmm0, %xmm1
	punpckhdq	%xmm0, %xmm0
	pcmpgtd	%xmm1, %xmm9
	pmuludq	%xmm1, %xmm10
	pmuludq	%xmm2, %xmm1
	pmuludq	%xmm2, %xmm9
	paddq	%xmm10, %xmm9
	movdqa	%xmm5, %xmm10
	psllq	$32, %xmm9
	pmuludq	%xmm0, %xmm10
	paddq	%xmm9, %xmm1
	movdqa	%xmm3, %xmm9
	pcmpgtd	%xmm0, %xmm9
	pmuludq	%xmm2, %xmm0
	pmuludq	%xmm2, %xmm9
	paddq	%xmm10, %xmm9
	psllq	$32, %xmm9
	paddq	%xmm9, %xmm0
	shufps	$221, %xmm0, %xmm1
	movaps	%xmm1, -16(%rax)
	cmpq	%r13, %rax
	jne	.L2
	leaq	12(%rsp), %r12
	leaq	.LC20(%rip), %rbp
	leaq	.LC19(%rip), %rbx
.L3:
	movq	%r12, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %r8d
	testl	%r8d, %r8d
	je	.L7
	leaq	16(%rsp), %r9
	leaq	232(%rsp), %r10
	xorl	%edx, %edx
	.p2align 4,,10
	.p2align 3
.L6:
	movl	(%r9), %edi
	movq	%r14, %rax
	.p2align 4,,10
	.p2align 3
.L5:
	movl	(%rax), %ecx
	addl	%edi, %ecx
	cmpl	%ecx, %edx
	movl	%ecx, %esi
	cmovge	%edx, %esi
	cmpl	%ecx, %r8d
	cmovge	%esi, %edx
	addq	$4, %rax
	cmpq	%r13, %rax
	jne	.L5
	addq	$4, %r9
	cmpq	%r9, %r10
	jne	.L6
	movq	%rbx, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L3
.L7:
	xorl	%edi, %edi
	call	exit@PLT
	.cfi_endproc
.LFE39:
	.size	main, .-main
	.text
	.p2align 4
	.globl	Max
	.type	Max, @function
Max:
.LFB40:
	.cfi_startproc
	endbr64
	cmpl	%esi, %edi
	movl	%esi, %eax
	cmovge	%edi, %eax
	ret
	.cfi_endproc
.LFE40:
	.size	Max, .-Max
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.long	0
	.long	1
	.long	2
	.long	3
	.align 16
.LC1:
	.long	0
	.long	1
	.long	8
	.long	27
	.align 16
.LC2:
	.long	64
	.long	125
	.long	216
	.long	343
	.align 16
.LC3:
	.long	512
	.long	729
	.long	1000
	.long	1331
	.align 16
.LC4:
	.long	1728
	.long	2197
	.long	2744
	.long	3375
	.align 16
.LC5:
	.long	4096
	.long	4913
	.long	5832
	.long	6859
	.align 16
.LC6:
	.long	8000
	.long	9261
	.long	10648
	.long	12167
	.align 16
.LC7:
	.long	13824
	.long	15625
	.long	17576
	.long	19683
	.align 16
.LC8:
	.long	21952
	.long	24389
	.long	27000
	.long	29791
	.align 16
.LC9:
	.long	32768
	.long	35937
	.long	39304
	.long	42875
	.align 16
.LC10:
	.long	46656
	.long	50653
	.long	54872
	.long	59319
	.align 16
.LC11:
	.long	64000
	.long	68921
	.long	74088
	.long	79507
	.align 16
.LC12:
	.long	85184
	.long	91125
	.long	97336
	.long	103823
	.align 16
.LC13:
	.long	110592
	.long	117649
	.long	125000
	.long	132651
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC14:
	.long	140608
	.long	148877
	.section	.rodata.cst16
	.align 16
.LC15:
	.long	4
	.long	4
	.long	4
	.long	4
	.align 16
.LC16:
	.long	1
	.long	1
	.long	1
	.long	1
	.align 16
.LC17:
	.long	2
	.long	2
	.long	2
	.long	2
	.align 16
.LC18:
	.long	715827883
	.long	715827883
	.long	715827883
	.long	715827883
	.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:

//2001年アジアA Starship Hakodate-maru

#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int Max(int n1,int n2);

int main(){
	int f1[54]={0},f2[96]={0};
	for(int i=0;i<54;i++) f1[i] = i*i*i;
	for(int i=0;i<96;i++) f2[i] = i*(i+1)*(i+2)/6;
	int num;
  while(scanf("%d",&num),num){
		int max=0;
		for(int i=0;i<54;i++){
			for(int j=0;j<96;j++){
				if(f1[i]+f2[j]<=num) max=Max(max,f1[i]+f2[j]);
			}
		}
		printf("%d\n",max );
  }
  exit(0);
}

int Max(int n1,int n2){
  if(n1>n2)return n1;
  else return n2;
}


100
84
50
20
151200
0
 100
84
50
20
150323
0
 100
160
50
20
150323
0
 100
64
50
17
151200
0
 100
50
50
20
151200
0
 100
63
50
20
150323
0
 100
5
50
17
151200
0
 100
50
74
20
151200
0
 100
69
50
20
150323
0
 100
5
50
6
151200
0

99
84
47
20
151200
 99
84
47
20
150303
 99
160
47
20
150303
 99
64
47
12
151200
 99
47
47
20
151200
 99
62
47
20
150303
 99
5
47
12
151200
 99
47
74
20
151200
 99
68
47
20
150303
 99
5
47
5
151200

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

```c
//2001年アジアA Starship Hakodate-maru

#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int Max(int n1,int n2);

int main(){
	int f1[54]={0},f2[96]={0};
	for(int i=0;i<54;i++) f1[i] = i*i*i;
	for(int i=0;i<96;i++) f2[i] = i*(i+1)*(i+2)/6;
	int num;
  while(scanf("%d",&num),num){
		int max=0;
		for(int i=0;i<54;i++){
			for(int j=0;j<96;j++){
				if(f1[i]+f2[j]<=num) max=Max(max,f1[i]+f2[j]);
			}
		}
		printf("%d\n",max );
  }
  exit(0);
}

int Max(int n1,int n2){
  if(n1>n2)return n1;
  else return n2;
}

```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d\n"
.LC1:
	.string	"%d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$656, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-624(%rbp), %rdx
	movl	$0, %eax
	movl	$27, %ecx
	movq	%rdx, %rdi
	rep stosq
	leaq	-400(%rbp), %rdx
	movl	$0, %eax
	movl	$48, %ecx
	movq	%rdx, %rdi
	rep stosq
	movl	$0, -644(%rbp)
	jmp	.L2
.L3:
	movl	-644(%rbp), %eax
	imull	%eax, %eax
	imull	-644(%rbp), %eax
	movl	%eax, %edx
	movl	-644(%rbp), %eax
	cltq
	movl	%edx, -624(%rbp,%rax,4)
	addl	$1, -644(%rbp)
.L2:
	cmpl	$53, -644(%rbp)
	jle	.L3
	movl	$0, -640(%rbp)
	jmp	.L4
.L5:
	movl	-640(%rbp), %eax
	addl	$1, %eax
	imull	-640(%rbp), %eax
	movl	-640(%rbp), %edx
	addl	$2, %edx
	imull	%edx, %eax
	movslq	%eax, %rdx
	imulq	$715827883, %rdx, %rdx
	shrq	$32, %rdx
	sarl	$31, %eax
	subl	%eax, %edx
	movl	-640(%rbp), %eax
	cltq
	movl	%edx, -400(%rbp,%rax,4)
	addl	$1, -640(%rbp)
.L4:
	cmpl	$95, -640(%rbp)
	jle	.L5
	jmp	.L6
.L12:
	movl	$0, -636(%rbp)
	movl	$0, -632(%rbp)
	jmp	.L7
.L11:
	movl	$0, -628(%rbp)
	jmp	.L8
.L10:
	movl	-632(%rbp), %eax
	cltq
	movl	-624(%rbp,%rax,4), %edx
	movl	-628(%rbp), %eax
	cltq
	movl	-400(%rbp,%rax,4), %eax
	addl	%eax, %edx
	movl	-648(%rbp), %eax
	cmpl	%eax, %edx
	jg	.L9
	movl	-632(%rbp), %eax
	cltq
	movl	-624(%rbp,%rax,4), %edx
	movl	-628(%rbp), %eax
	cltq
	movl	-400(%rbp,%rax,4), %eax
	addl	%eax, %edx
	movl	-636(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	Max
	movl	%eax, -636(%rbp)
.L9:
	addl	$1, -628(%rbp)
.L8:
	cmpl	$95, -628(%rbp)
	jle	.L10
	addl	$1, -632(%rbp)
.L7:
	cmpl	$53, -632(%rbp)
	jle	.L11
	movl	-636(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L6:
	leaq	-648(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-648(%rbp), %eax
	testl	%eax, %eax
	jne	.L12
	movl	$0, %edi
	call	exit@PLT
	.cfi_endproc
.LFE6:
	.size	main, .-main
	.globl	Max
	.type	Max, @function
Max:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	-4(%rbp), %eax
	cmpl	-8(%rbp), %eax
	jle	.L15
	movl	-4(%rbp), %eax
	jmp	.L16
.L15:
	movl	-8(%rbp), %eax
.L16:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	Max, .-Max
	.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:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$656, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-624(%rbp), %rdx
	movl	$0, %eax
	movl	$27, %ecx
	movq	%rdx, %rdi
	rep stosq
	leaq	-400(%rbp), %rdx
	movl	$0, %eax
	movl	$48, %ecx
	movq	%rdx, %rdi
	rep stosq
	movl	$0, -644(%rbp)
	jmp	.L2
.L3:
	movl	-644(%rbp), %eax
	imull	%eax, %eax
	imull	-644(%rbp), %eax
	movl	%eax, %edx
	movl	-644(%rbp), %eax
	cltq
	movl	%edx, -624(%rbp,%rax,4)
	addl	$1, -644(%rbp)
.L2:
	cmpl	$53, -644(%rbp)
	jle	.L3
	movl	$0, -640(%rbp)
	jmp	.L4
.L5:
	movl	-640(%rbp), %eax
	addl	$1, %eax
	imull	-640(%rbp), %eax
	movl	-640(%rbp), %edx
	addl	$2, %edx
	imull	%edx, %eax
	movslq	%eax, %rdx
	imulq	$715827883, %rdx, %rdx
	shrq	$32, %rdx
	sarl	$31, %eax
	subl	%eax, %edx
	movl	-640(%rbp), %eax
	cltq
	movl	%edx, -400(%rbp,%rax,4)
	addl	$1, -640(%rbp)
.L4:
	cmpl	$95, -640(%rbp)
	jle	.L5
	jmp	.L6
.L12:
	movl	$0, -636(%rbp)
	movl	$0, -632(%rbp)
	jmp	.L7
.L11:
	movl	$0, -628(%rbp)
	jmp	.L8
.L10:
	movl	-632(%rbp), %eax
	cltq
	movl	-624(%rbp,%rax,4), %edx
	movl	-628(%rbp), %eax
	cltq
	movl	-400(%rbp,%rax,4), %eax
	addl	%eax, %edx
	movl	-648(%rbp), %eax
	cmpl	%eax, %edx
	jg	.L9
	movl	-632(%rbp), %eax
	cltq
	movl	-624(%rbp,%rax,4), %edx
	movl	-628(%rbp), %eax
	cltq
	movl	-400(%rbp,%rax,4), %eax
	addl	%eax, %edx
	movl	-636(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	Max
	movl	%eax, -636(%rbp)
.L9:
	addl	$1, -628(%rbp)
.L8:
	cmpl	$95, -628(%rbp)
	jle	.L10
	addl	$1, -632(%rbp)
.L7:
	cmpl	$53, -632(%rbp)
	jle	.L11
	movl	-636(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L6:
	leaq	-648(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-648(%rbp), %eax
	testl	%eax, %eax
	jne	.L12
	movl	$0, %edi
	call	exit@PLT
	.cfi_endproc
.LFE6:
	.size	main, .-main
	.globl	Max
	.type	Max, @function
Max:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	-4(%rbp), %eax
	cmpl	-8(%rbp), %eax
	jle	.L15
	movl	-4(%rbp), %eax
	jmp	.L16
.L15:
	movl	-8(%rbp), %eax
.L16:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	Max, .-Max
	.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:
