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

```c
// AOJ 1224: Starship Hakodate-maru
// 2017.10.15

#include <stdio.h>
#include <string.h>

int cubic[56];
int tetrahedral[98];
char f[153000];  // 152096 = 96*97*98/6

int main()
{
	int n, i, j;

	for (i = 1; i < 55; i++) cubic[i] = i*i*i;
	for (i = 1; i < 97; i++) tetrahedral[i] = i*(i+1)*(i+2)/6;
	for (i = 0; i < 55; i++) for (j = 0; j < 97; j++) {
		n = cubic[i]+tetrahedral[j];
		if (n < 152000) f[n] = 1;
	}

	while (scanf("%d", &n) && n > 0) {
		while (1) {
			if (f[n]) break;
			n--;
		}
		printf("%d\n", n);
	}
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	cubic
	.bss
	.align 32
	.type	cubic, @object
	.size	cubic, 224
cubic:
	.zero	224
	.globl	tetrahedral
	.align 32
	.type	tetrahedral, @object
	.size	tetrahedral, 392
tetrahedral:
	.zero	392
	.globl	f
	.align 32
	.type	f, @object
	.size	f, 153000
f:
	.zero	153000
	.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	$32, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$1, -16(%rbp)
	jmp	.L2
.L3:
	movl	-16(%rbp), %eax
	imull	%eax, %eax
	imull	-16(%rbp), %eax
	movl	-16(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	cubic(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	addl	$1, -16(%rbp)
.L2:
	cmpl	$54, -16(%rbp)
	jle	.L3
	movl	$1, -16(%rbp)
	jmp	.L4
.L5:
	movl	-16(%rbp), %eax
	addl	$1, %eax
	imull	-16(%rbp), %eax
	movl	-16(%rbp), %edx
	addl	$2, %edx
	imull	%edx, %eax
	movslq	%eax, %rdx
	imulq	$715827883, %rdx, %rdx
	shrq	$32, %rdx
	sarl	$31, %eax
	movl	%edx, %ecx
	subl	%eax, %ecx
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	tetrahedral(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	addl	$1, -16(%rbp)
.L4:
	cmpl	$96, -16(%rbp)
	jle	.L5
	movl	$0, -16(%rbp)
	jmp	.L6
.L10:
	movl	$0, -12(%rbp)
	jmp	.L7
.L9:
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cubic(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	tetrahedral(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%ecx, %eax
	movl	%eax, -20(%rbp)
	movl	-20(%rbp), %eax
	cmpl	$151999, %eax
	jg	.L8
	movl	-20(%rbp), %eax
	cltq
	leaq	f(%rip), %rdx
	movb	$1, (%rax,%rdx)
.L8:
	addl	$1, -12(%rbp)
.L7:
	cmpl	$96, -12(%rbp)
	jle	.L9
	addl	$1, -16(%rbp)
.L6:
	cmpl	$54, -16(%rbp)
	jle	.L10
	jmp	.L11
.L14:
	movl	-20(%rbp), %eax
	cltq
	leaq	f(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	testb	%al, %al
	jne	.L19
	movl	-20(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -20(%rbp)
	jmp	.L14
.L19:
	nop
	movl	-20(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L11:
	leaq	-20(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	testl	%eax, %eax
	je	.L15
	movl	-20(%rbp), %eax
	testl	%eax, %eax
	jg	.L14
.L15:
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L17
	call	__stack_chk_fail@PLT
.L17:
	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
.LC19:
	.string	"%d\n"
.LC20:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB35:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	pxor	%xmm4, %xmm4
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	movdqa	%xmm4, %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	$16, %rsp
	.cfi_def_cfa_offset 64
	movdqa	.LC1(%rip), %xmm0
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	movups	%xmm0, 4+cubic(%rip)
	movdqa	.LC2(%rip), %xmm0
	movups	%xmm0, 20+cubic(%rip)
	movdqa	.LC3(%rip), %xmm0
	movups	%xmm0, 36+cubic(%rip)
	movdqa	.LC4(%rip), %xmm0
	movups	%xmm0, 52+cubic(%rip)
	movdqa	.LC5(%rip), %xmm0
	movups	%xmm0, 68+cubic(%rip)
	movdqa	.LC6(%rip), %xmm0
	movups	%xmm0, 84+cubic(%rip)
	movdqa	.LC7(%rip), %xmm0
	movups	%xmm0, 100+cubic(%rip)
	movdqa	.LC8(%rip), %xmm0
	movups	%xmm0, 116+cubic(%rip)
	movdqa	.LC9(%rip), %xmm0
	movups	%xmm0, 132+cubic(%rip)
	movdqa	.LC10(%rip), %xmm0
	movups	%xmm0, 148+cubic(%rip)
	movdqa	.LC11(%rip), %xmm0
	movups	%xmm0, 164+cubic(%rip)
	movdqa	.LC12(%rip), %xmm0
	movups	%xmm0, 180+cubic(%rip)
	movdqa	.LC13(%rip), %xmm0
	movdqa	.LC18(%rip), %xmm2
	movq	.LC14(%rip), %rax
	movdqa	.LC0(%rip), %xmm3
	pcmpgtd	%xmm2, %xmm5
	movdqa	.LC16(%rip), %xmm7
	movdqa	.LC15(%rip), %xmm8
	movups	%xmm0, 196+cubic(%rip)
	movq	%rax, 212+cubic(%rip)
	movdqa	.LC17(%rip), %xmm6
	leaq	4+tetrahedral(%rip), %rax
	leaq	-4(%rax), %r11
	leaq	384(%rax), %rsi
.L2:
	movdqa	%xmm3, %xmm0
	addq	$16, %rax
	paddd	%xmm8, %xmm3
	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	%xmm4, %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	%xmm4, %xmm9
	pcmpgtd	%xmm0, %xmm9
	pmuludq	%xmm2, %xmm0
	pmuludq	%xmm2, %xmm9
	paddq	%xmm10, %xmm9
	psllq	$32, %xmm9
	paddq	%xmm9, %xmm0
	shufps	$221, %xmm0, %xmm1
	movups	%xmm1, -16(%rax)
	cmpq	%rsi, %rax
	jne	.L2
	leaq	cubic(%rip), %r9
	leaq	f(%rip), %r8
	leaq	220(%r9), %r10
	.p2align 4,,10
	.p2align 3
.L6:
	movl	(%r9), %ecx
	movq	%r11, %rax
	.p2align 4,,10
	.p2align 3
.L5:
	movl	(%rax), %edx
	addl	%ecx, %edx
	cmpl	$151999, %edx
	jg	.L4
	movslq	%edx, %rdi
	movb	$1, (%r8,%rdi)
.L4:
	addq	$4, %rax
	cmpq	%rsi, %rax
	jne	.L5
	addq	$4, %r9
	cmpq	%r10, %r9
	jne	.L6
	movl	%edx, 4(%rsp)
	leaq	f(%rip), %rbp
	leaq	4(%rsp), %r13
	leaq	.LC20(%rip), %r12
	leaq	1(%rbp), %r14
	leaq	.LC19(%rip), %rbx
.L7:
	xorl	%eax, %eax
	movq	%r13, %rsi
	movq	%r12, %rdi
	call	__isoc99_scanf@PLT
	testl	%eax, %eax
	je	.L10
	movl	4(%rsp), %edx
	testl	%edx, %edx
	jle	.L10
	movslq	%edx, %rax
	cmpb	$0, 0(%rbp,%rax)
	jne	.L8
	subl	$1, %edx
	movslq	%edx, %rax
	.p2align 4,,10
	.p2align 3
.L9:
	movl	%eax, %edx
	subq	$1, %rax
	cmpb	$0, (%r14,%rax)
	je	.L9
	movl	%edx, 4(%rsp)
.L8:
	movq	%rbx, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L7
.L10:
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L23
	addq	$16, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
.L23:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE35:
	.size	main, .-main
	.globl	f
	.bss
	.align 32
	.type	f, @object
	.size	f, 153000
f:
	.zero	153000
	.globl	tetrahedral
	.align 32
	.type	tetrahedral, @object
	.size	tetrahedral, 392
tetrahedral:
	.zero	392
	.globl	cubic
	.align 32
	.type	cubic, @object
	.size	cubic, 224
cubic:
	.zero	224
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.long	1
	.long	2
	.long	3
	.long	4
	.align 16
.LC1:
	.long	1
	.long	8
	.long	27
	.long	64
	.align 16
.LC2:
	.long	125
	.long	216
	.long	343
	.long	512
	.align 16
.LC3:
	.long	729
	.long	1000
	.long	1331
	.long	1728
	.align 16
.LC4:
	.long	2197
	.long	2744
	.long	3375
	.long	4096
	.align 16
.LC5:
	.long	4913
	.long	5832
	.long	6859
	.long	8000
	.align 16
.LC6:
	.long	9261
	.long	10648
	.long	12167
	.long	13824
	.align 16
.LC7:
	.long	15625
	.long	17576
	.long	19683
	.long	21952
	.align 16
.LC8:
	.long	24389
	.long	27000
	.long	29791
	.long	32768
	.align 16
.LC9:
	.long	35937
	.long	39304
	.long	42875
	.long	46656
	.align 16
.LC10:
	.long	50653
	.long	54872
	.long	59319
	.long	64000
	.align 16
.LC11:
	.long	68921
	.long	74088
	.long	79507
	.long	85184
	.align 16
.LC12:
	.long	91125
	.long	97336
	.long	103823
	.long	110592
	.align 16
.LC13:
	.long	117649
	.long	125000
	.long	132651
	.long	140608
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC14:
	.long	148877
	.long	157464
	.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:
.LFB35:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	pxor	%xmm4, %xmm4
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	movdqa	%xmm4, %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	$16, %rsp
	.cfi_def_cfa_offset 64
	movdqa	.LC1(%rip), %xmm0
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	movups	%xmm0, 4+cubic(%rip)
	movdqa	.LC2(%rip), %xmm0
	movups	%xmm0, 20+cubic(%rip)
	movdqa	.LC3(%rip), %xmm0
	movups	%xmm0, 36+cubic(%rip)
	movdqa	.LC4(%rip), %xmm0
	movups	%xmm0, 52+cubic(%rip)
	movdqa	.LC5(%rip), %xmm0
	movups	%xmm0, 68+cubic(%rip)
	movdqa	.LC6(%rip), %xmm0
	movups	%xmm0, 84+cubic(%rip)
	movdqa	.LC7(%rip), %xmm0
	movups	%xmm0, 100+cubic(%rip)
	movdqa	.LC8(%rip), %xmm0
	movups	%xmm0, 116+cubic(%rip)
	movdqa	.LC9(%rip), %xmm0
	movups	%xmm0, 132+cubic(%rip)
	movdqa	.LC10(%rip), %xmm0
	movups	%xmm0, 148+cubic(%rip)
	movdqa	.LC11(%rip), %xmm0
	movups	%xmm0, 164+cubic(%rip)
	movdqa	.LC12(%rip), %xmm0
	movups	%xmm0, 180+cubic(%rip)
	movdqa	.LC13(%rip), %xmm0
	movdqa	.LC18(%rip), %xmm2
	movq	.LC14(%rip), %rax
	movdqa	.LC0(%rip), %xmm3
	pcmpgtd	%xmm2, %xmm5
	movdqa	.LC16(%rip), %xmm7
	movdqa	.LC15(%rip), %xmm8
	movups	%xmm0, 196+cubic(%rip)
	movq	%rax, 212+cubic(%rip)
	movdqa	.LC17(%rip), %xmm6
	leaq	4+tetrahedral(%rip), %rax
	leaq	-4(%rax), %r11
	leaq	384(%rax), %rsi
.L2:
	movdqa	%xmm3, %xmm0
	addq	$16, %rax
	paddd	%xmm8, %xmm3
	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	%xmm4, %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	%xmm4, %xmm9
	pcmpgtd	%xmm0, %xmm9
	pmuludq	%xmm2, %xmm0
	pmuludq	%xmm2, %xmm9
	paddq	%xmm10, %xmm9
	psllq	$32, %xmm9
	paddq	%xmm9, %xmm0
	shufps	$221, %xmm0, %xmm1
	movups	%xmm1, -16(%rax)
	cmpq	%rsi, %rax
	jne	.L2
	leaq	cubic(%rip), %r9
	leaq	f(%rip), %r8
	leaq	220(%r9), %r10
	.p2align 4,,10
	.p2align 3
.L6:
	movl	(%r9), %ecx
	movq	%r11, %rax
	.p2align 4,,10
	.p2align 3
.L5:
	movl	(%rax), %edx
	addl	%ecx, %edx
	cmpl	$151999, %edx
	jg	.L4
	movslq	%edx, %rdi
	movb	$1, (%r8,%rdi)
.L4:
	addq	$4, %rax
	cmpq	%rsi, %rax
	jne	.L5
	addq	$4, %r9
	cmpq	%r10, %r9
	jne	.L6
	movl	%edx, 4(%rsp)
	leaq	f(%rip), %rbp
	leaq	4(%rsp), %r13
	leaq	.LC20(%rip), %r12
	leaq	1(%rbp), %r14
	leaq	.LC19(%rip), %rbx
.L7:
	xorl	%eax, %eax
	movq	%r13, %rsi
	movq	%r12, %rdi
	call	__isoc99_scanf@PLT
	testl	%eax, %eax
	je	.L10
	movl	4(%rsp), %edx
	testl	%edx, %edx
	jle	.L10
	movslq	%edx, %rax
	cmpb	$0, 0(%rbp,%rax)
	jne	.L8
	subl	$1, %edx
	movslq	%edx, %rax
	.p2align 4,,10
	.p2align 3
.L9:
	movl	%eax, %edx
	subq	$1, %rax
	cmpb	$0, (%r14,%rax)
	je	.L9
	movl	%edx, 4(%rsp)
.L8:
	movq	%rbx, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L7
.L10:
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L23
	addq	$16, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
.L23:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE35:
	.size	main, .-main
	.globl	f
	.bss
	.align 32
	.type	f, @object
	.size	f, 153000
f:
	.zero	153000
	.globl	tetrahedral
	.align 32
	.type	tetrahedral, @object
	.size	tetrahedral, 392
tetrahedral:
	.zero	392
	.globl	cubic
	.align 32
	.type	cubic, @object
	.size	cubic, 224
cubic:
	.zero	224
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.long	1
	.long	2
	.long	3
	.long	4
	.align 16
.LC1:
	.long	1
	.long	8
	.long	27
	.long	64
	.align 16
.LC2:
	.long	125
	.long	216
	.long	343
	.long	512
	.align 16
.LC3:
	.long	729
	.long	1000
	.long	1331
	.long	1728
	.align 16
.LC4:
	.long	2197
	.long	2744
	.long	3375
	.long	4096
	.align 16
.LC5:
	.long	4913
	.long	5832
	.long	6859
	.long	8000
	.align 16
.LC6:
	.long	9261
	.long	10648
	.long	12167
	.long	13824
	.align 16
.LC7:
	.long	15625
	.long	17576
	.long	19683
	.long	21952
	.align 16
.LC8:
	.long	24389
	.long	27000
	.long	29791
	.long	32768
	.align 16
.LC9:
	.long	35937
	.long	39304
	.long	42875
	.long	46656
	.align 16
.LC10:
	.long	50653
	.long	54872
	.long	59319
	.long	64000
	.align 16
.LC11:
	.long	68921
	.long	74088
	.long	79507
	.long	85184
	.align 16
.LC12:
	.long	91125
	.long	97336
	.long	103823
	.long	110592
	.align 16
.LC13:
	.long	117649
	.long	125000
	.long	132651
	.long	140608
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC14:
	.long	148877
	.long	157464
	.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:

// AOJ 1224: Starship Hakodate-maru
// 2017.10.15

#include <stdio.h>
#include <string.h>

int cubic[56];
int tetrahedral[98];
char f[153000];  // 152096 = 96*97*98/6

int main()
{
	int n, i, j;

	for (i = 1; i < 55; i++) cubic[i] = i*i*i;
	for (i = 1; i < 97; i++) tetrahedral[i] = i*(i+1)*(i+2)/6;
	for (i = 0; i < 55; i++) for (j = 0; j < 97; j++) {
		n = cubic[i]+tetrahedral[j];
		if (n < 152000) f[n] = 1;
	}

	while (scanf("%d", &n) && n > 0) {
		while (1) {
			if (f[n]) break;
			n--;
		}
		printf("%d\n", n);
	}
	return 0;
}
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
// AOJ 1224: Starship Hakodate-maru
// 2017.10.15

#include <stdio.h>
#include <string.h>

int cubic[56];
int tetrahedral[98];
char f[153000];  // 152096 = 96*97*98/6

int main()
{
	int n, i, j;

	for (i = 1; i < 55; i++) cubic[i] = i*i*i;
	for (i = 1; i < 97; i++) tetrahedral[i] = i*(i+1)*(i+2)/6;
	for (i = 0; i < 55; i++) for (j = 0; j < 97; j++) {
		n = cubic[i]+tetrahedral[j];
		if (n < 152000) f[n] = 1;
	}

	while (scanf("%d", &n) && n > 0) {
		while (1) {
			if (f[n]) break;
			n--;
		}
		printf("%d\n", n);
	}
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	cubic
	.bss
	.align 32
	.type	cubic, @object
	.size	cubic, 224
cubic:
	.zero	224
	.globl	tetrahedral
	.align 32
	.type	tetrahedral, @object
	.size	tetrahedral, 392
tetrahedral:
	.zero	392
	.globl	f
	.align 32
	.type	f, @object
	.size	f, 153000
f:
	.zero	153000
	.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	$32, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$1, -16(%rbp)
	jmp	.L2
.L3:
	movl	-16(%rbp), %eax
	imull	%eax, %eax
	imull	-16(%rbp), %eax
	movl	-16(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	cubic(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	addl	$1, -16(%rbp)
.L2:
	cmpl	$54, -16(%rbp)
	jle	.L3
	movl	$1, -16(%rbp)
	jmp	.L4
.L5:
	movl	-16(%rbp), %eax
	addl	$1, %eax
	imull	-16(%rbp), %eax
	movl	-16(%rbp), %edx
	addl	$2, %edx
	imull	%edx, %eax
	movslq	%eax, %rdx
	imulq	$715827883, %rdx, %rdx
	shrq	$32, %rdx
	sarl	$31, %eax
	movl	%edx, %ecx
	subl	%eax, %ecx
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	tetrahedral(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	addl	$1, -16(%rbp)
.L4:
	cmpl	$96, -16(%rbp)
	jle	.L5
	movl	$0, -16(%rbp)
	jmp	.L6
.L10:
	movl	$0, -12(%rbp)
	jmp	.L7
.L9:
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cubic(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	tetrahedral(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%ecx, %eax
	movl	%eax, -20(%rbp)
	movl	-20(%rbp), %eax
	cmpl	$151999, %eax
	jg	.L8
	movl	-20(%rbp), %eax
	cltq
	leaq	f(%rip), %rdx
	movb	$1, (%rax,%rdx)
.L8:
	addl	$1, -12(%rbp)
.L7:
	cmpl	$96, -12(%rbp)
	jle	.L9
	addl	$1, -16(%rbp)
.L6:
	cmpl	$54, -16(%rbp)
	jle	.L10
	jmp	.L11
.L14:
	movl	-20(%rbp), %eax
	cltq
	leaq	f(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	testb	%al, %al
	jne	.L19
	movl	-20(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -20(%rbp)
	jmp	.L14
.L19:
	nop
	movl	-20(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L11:
	leaq	-20(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	testl	%eax, %eax
	je	.L15
	movl	-20(%rbp), %eax
	testl	%eax, %eax
	jg	.L14
.L15:
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L17
	call	__stack_chk_fail@PLT
.L17:
	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	cubic
	.bss
	.align 32
	.type	cubic, @object
	.size	cubic, 224
cubic:
	.zero	224
	.globl	tetrahedral
	.align 32
	.type	tetrahedral, @object
	.size	tetrahedral, 392
tetrahedral:
	.zero	392
	.globl	f
	.align 32
	.type	f, @object
	.size	f, 153000
f:
	.zero	153000
	.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	$32, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$1, -16(%rbp)
	jmp	.L2
.L3:
	movl	-16(%rbp), %eax
	imull	%eax, %eax
	imull	-16(%rbp), %eax
	movl	-16(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	cubic(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	addl	$1, -16(%rbp)
.L2:
	cmpl	$54, -16(%rbp)
	jle	.L3
	movl	$1, -16(%rbp)
	jmp	.L4
.L5:
	movl	-16(%rbp), %eax
	addl	$1, %eax
	imull	-16(%rbp), %eax
	movl	-16(%rbp), %edx
	addl	$2, %edx
	imull	%edx, %eax
	movslq	%eax, %rdx
	imulq	$715827883, %rdx, %rdx
	shrq	$32, %rdx
	sarl	$31, %eax
	movl	%edx, %ecx
	subl	%eax, %ecx
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	tetrahedral(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	addl	$1, -16(%rbp)
.L4:
	cmpl	$96, -16(%rbp)
	jle	.L5
	movl	$0, -16(%rbp)
	jmp	.L6
.L10:
	movl	$0, -12(%rbp)
	jmp	.L7
.L9:
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cubic(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	tetrahedral(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%ecx, %eax
	movl	%eax, -20(%rbp)
	movl	-20(%rbp), %eax
	cmpl	$151999, %eax
	jg	.L8
	movl	-20(%rbp), %eax
	cltq
	leaq	f(%rip), %rdx
	movb	$1, (%rax,%rdx)
.L8:
	addl	$1, -12(%rbp)
.L7:
	cmpl	$96, -12(%rbp)
	jle	.L9
	addl	$1, -16(%rbp)
.L6:
	cmpl	$54, -16(%rbp)
	jle	.L10
	jmp	.L11
.L14:
	movl	-20(%rbp), %eax
	cltq
	leaq	f(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	testb	%al, %al
	jne	.L19
	movl	-20(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -20(%rbp)
	jmp	.L14
.L19:
	nop
	movl	-20(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L11:
	leaq	-20(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	testl	%eax, %eax
	je	.L15
	movl	-20(%rbp), %eax
	testl	%eax, %eax
	jg	.L14
.L15:
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L17
	call	__stack_chk_fail@PLT
.L17:
	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:
