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>
#include<stdlib.h>
#include<math.h>

int main(void)
{
	int i,j;
	int y,z;
	int e,m,tmp;
	double es;
	
	while(1)
	{
		scanf("%d ",&e);
		if(e==0)break;
		
		m=e;
		es = sqrt(e);
		
		for(y=0;y<=es;y++){
			i = y*y;
			for(z=0;z<e;z++){
				if(z*z*z > e-i){
					z--;
					tmp = e -i -z*z*z +y +z;
					if(m>tmp)m=tmp;
					break;
				}
			}
		}	
		
		printf("%d\n",m);
	}
	return 0;
}
	```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d "
.LC1:
	.string	"%d\n"
	.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	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L11:
	leaq	-40(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-40(%rbp), %eax
	testl	%eax, %eax
	je	.L15
	movl	-40(%rbp), %eax
	movl	%eax, -28(%rbp)
	movl	-40(%rbp), %eax
	pxor	%xmm2, %xmm2
	cvtsi2sdl	%eax, %xmm2
	movq	%xmm2, %rax
	movq	%rax, %xmm0
	call	sqrt@PLT
	movq	%xmm0, %rax
	movq	%rax, -16(%rbp)
	movl	$0, -36(%rbp)
	jmp	.L4
.L10:
	movl	-36(%rbp), %eax
	imull	%eax, %eax
	movl	%eax, -24(%rbp)
	movl	$0, -32(%rbp)
	jmp	.L5
.L9:
	movl	-32(%rbp), %eax
	imull	%eax, %eax
	imull	-32(%rbp), %eax
	movl	%eax, %edx
	movl	-40(%rbp), %eax
	subl	-24(%rbp), %eax
	cmpl	%eax, %edx
	jle	.L6
	subl	$1, -32(%rbp)
	movl	-40(%rbp), %eax
	subl	-24(%rbp), %eax
	movl	%eax, %edx
	movl	-32(%rbp), %eax
	imull	%eax, %eax
	imull	-32(%rbp), %eax
	subl	%eax, %edx
	movl	-36(%rbp), %eax
	addl	%eax, %edx
	movl	-32(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -20(%rbp)
	movl	-28(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jle	.L16
	movl	-20(%rbp), %eax
	movl	%eax, -28(%rbp)
	jmp	.L16
.L6:
	addl	$1, -32(%rbp)
.L5:
	movl	-40(%rbp), %eax
	cmpl	%eax, -32(%rbp)
	jl	.L9
	jmp	.L8
.L16:
	nop
.L8:
	addl	$1, -36(%rbp)
.L4:
	pxor	%xmm1, %xmm1
	cvtsi2sdl	-36(%rbp), %xmm1
	movsd	-16(%rbp), %xmm0
	comisd	%xmm1, %xmm0
	jnb	.L10
	movl	-28(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L11
.L15:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L13
	call	__stack_chk_fail@PLT
.L13:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.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
.LC0:
	.string	"%d "
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	leaq	.LC2(%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
	.p2align 4,,10
	.p2align 3
.L13:
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %r13d
	testl	%r13d, %r13d
	je	.L2
	pxor	%xmm0, %xmm0
	pxor	%xmm2, %xmm2
	cvtsi2sdl	%r13d, %xmm0
	ucomisd	%xmm0, %xmm2
	ja	.L22
	sqrtsd	%xmm0, %xmm0
	movapd	%xmm2, %xmm3
.L5:
	xorl	%edi, %edi
	comisd	%xmm3, %xmm0
	movl	%r13d, %r8d
	jb	.L6
	.p2align 4,,10
	.p2align 3
.L12:
	movl	%edi, %eax
	imull	%edi, %eax
	testl	%r13d, %r13d
	jle	.L8
	movl	%r13d, %esi
	subl	%eax, %esi
	js	.L16
	xorl	%eax, %eax
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L11:
	movl	%eax, %edx
	imull	%eax, %edx
	imull	%eax, %edx
	cmpl	%esi, %edx
	jg	.L25
.L10:
	movl	%eax, %ecx
	leal	1(%rax), %eax
	cmpl	%eax, %r13d
	jne	.L11
.L8:
	addl	$1, %edi
	pxor	%xmm1, %xmm1
	cvtsi2sdl	%edi, %xmm1
	comisd	%xmm1, %xmm0
	jnb	.L12
.L6:
	movl	%r8d, %edx
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L25:
	movl	%ecx, %eax
	imull	%ecx, %eax
	imull	%ecx, %eax
.L9:
	subl	%eax, %esi
	pxor	%xmm1, %xmm1
	leal	(%rsi,%rdi), %eax
	addl	%ecx, %eax
	cmpl	%eax, %r8d
	cmovg	%eax, %r8d
	addl	$1, %edi
	cvtsi2sdl	%edi, %xmm1
	comisd	%xmm1, %xmm0
	jnb	.L12
	jmp	.L6
.L16:
	movl	$-1, %eax
	movl	$-1, %ecx
	jmp	.L9
.L2:
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L26
	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
.L22:
	.cfi_restore_state
	call	sqrt@PLT
	pxor	%xmm3, %xmm3
	jmp	.L5
.L26:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE39:
	.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:

rule
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d "
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	leaq	.LC2(%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
	.p2align 4,,10
	.p2align 3
.L13:
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %r13d
	testl	%r13d, %r13d
	je	.L2
	pxor	%xmm0, %xmm0
	pxor	%xmm2, %xmm2
	cvtsi2sdl	%r13d, %xmm0
	ucomisd	%xmm0, %xmm2
	ja	.L22
	sqrtsd	%xmm0, %xmm0
	movapd	%xmm2, %xmm3
.L5:
	xorl	%edi, %edi
	comisd	%xmm3, %xmm0
	movl	%r13d, %r8d
	jb	.L6
	.p2align 4,,10
	.p2align 3
.L12:
	movl	%edi, %eax
	imull	%edi, %eax
	testl	%r13d, %r13d
	jle	.L8
	movl	%r13d, %esi
	subl	%eax, %esi
	js	.L16
	xorl	%eax, %eax
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L11:
	movl	%eax, %edx
	imull	%eax, %edx
	imull	%eax, %edx
	cmpl	%esi, %edx
	jg	.L25
.L10:
	movl	%eax, %ecx
	leal	1(%rax), %eax
	cmpl	%eax, %r13d
	jne	.L11
.L8:
	addl	$1, %edi
	pxor	%xmm1, %xmm1
	cvtsi2sdl	%edi, %xmm1
	comisd	%xmm1, %xmm0
	jnb	.L12
.L6:
	movl	%r8d, %edx
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L25:
	movl	%ecx, %eax
	imull	%ecx, %eax
	imull	%ecx, %eax
.L9:
	subl	%eax, %esi
	pxor	%xmm1, %xmm1
	leal	(%rsi,%rdi), %eax
	addl	%ecx, %eax
	cmpl	%eax, %r8d
	cmovg	%eax, %r8d
	addl	$1, %edi
	cvtsi2sdl	%edi, %xmm1
	comisd	%xmm1, %xmm0
	jnb	.L12
	jmp	.L6
.L16:
	movl	$-1, %eax
	movl	$-1, %ecx
	jmp	.L9
.L2:
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L26
	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
.L22:
	.cfi_restore_state
	call	sqrt@PLT
	pxor	%xmm3, %xmm3
	jmp	.L5
.L26:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE39:
	.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:

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

int main(void)
{
	int i,j;
	int y,z;
	int e,m,tmp;
	double es;
	
	while(1)
	{
		scanf("%d ",&e);
		if(e==0)break;
		
		m=e;
		es = sqrt(e);
		
		for(y=0;y<=es;y++){
			i = y*y;
			for(z=0;z<e;z++){
				if(z*z*z > e-i){
					z--;
					tmp = e -i -z*z*z +y +z;
					if(m>tmp)m=tmp;
					break;
				}
			}
		}	
		
		printf("%d\n",m);
	}
	return 0;
}
	
1
2
4
6
300
1250
0
 1
2
4
2
300
1250
0
 1
2
4
3
300
1250
0
 1
2
4
3
76
1250
0
 1
2
4
27
557
1250
0
 1
2
4
6
300
1687
0
 1
1
4
2
300
1250
0
 1
2
5
3
300
1250
0
 1
2
3
3
76
1250
0
 1
2
4
27
266
1250
0

1
2
2
4
18
44
 1
2
2
2
18
44
 1
2
2
3
18
44
 1
2
2
3
10
44
 1
2
2
3
23
44
 1
2
2
4
18
47
 1
1
2
2
18
44
 1
2
3
3
18
44
 1
2
3
3
10
44
 1
2
2
3
14
44

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>
#include<stdlib.h>
#include<math.h>

int main(void)
{
	int i,j;
	int y,z;
	int e,m,tmp;
	double es;
	
	while(1)
	{
		scanf("%d ",&e);
		if(e==0)break;
		
		m=e;
		es = sqrt(e);
		
		for(y=0;y<=es;y++){
			i = y*y;
			for(z=0;z<e;z++){
				if(z*z*z > e-i){
					z--;
					tmp = e -i -z*z*z +y +z;
					if(m>tmp)m=tmp;
					break;
				}
			}
		}	
		
		printf("%d\n",m);
	}
	return 0;
}
	```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d "
.LC1:
	.string	"%d\n"
	.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	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L11:
	leaq	-40(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-40(%rbp), %eax
	testl	%eax, %eax
	je	.L15
	movl	-40(%rbp), %eax
	movl	%eax, -28(%rbp)
	movl	-40(%rbp), %eax
	pxor	%xmm2, %xmm2
	cvtsi2sdl	%eax, %xmm2
	movq	%xmm2, %rax
	movq	%rax, %xmm0
	call	sqrt@PLT
	movq	%xmm0, %rax
	movq	%rax, -16(%rbp)
	movl	$0, -36(%rbp)
	jmp	.L4
.L10:
	movl	-36(%rbp), %eax
	imull	%eax, %eax
	movl	%eax, -24(%rbp)
	movl	$0, -32(%rbp)
	jmp	.L5
.L9:
	movl	-32(%rbp), %eax
	imull	%eax, %eax
	imull	-32(%rbp), %eax
	movl	%eax, %edx
	movl	-40(%rbp), %eax
	subl	-24(%rbp), %eax
	cmpl	%eax, %edx
	jle	.L6
	subl	$1, -32(%rbp)
	movl	-40(%rbp), %eax
	subl	-24(%rbp), %eax
	movl	%eax, %edx
	movl	-32(%rbp), %eax
	imull	%eax, %eax
	imull	-32(%rbp), %eax
	subl	%eax, %edx
	movl	-36(%rbp), %eax
	addl	%eax, %edx
	movl	-32(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -20(%rbp)
	movl	-28(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jle	.L16
	movl	-20(%rbp), %eax
	movl	%eax, -28(%rbp)
	jmp	.L16
.L6:
	addl	$1, -32(%rbp)
.L5:
	movl	-40(%rbp), %eax
	cmpl	%eax, -32(%rbp)
	jl	.L9
	jmp	.L8
.L16:
	nop
.L8:
	addl	$1, -36(%rbp)
.L4:
	pxor	%xmm1, %xmm1
	cvtsi2sdl	-36(%rbp), %xmm1
	movsd	-16(%rbp), %xmm0
	comisd	%xmm1, %xmm0
	jnb	.L10
	movl	-28(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L11
.L15:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L13
	call	__stack_chk_fail@PLT
.L13:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.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
	.section	.rodata
.LC0:
	.string	"%d "
.LC1:
	.string	"%d\n"
	.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	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L11:
	leaq	-40(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-40(%rbp), %eax
	testl	%eax, %eax
	je	.L15
	movl	-40(%rbp), %eax
	movl	%eax, -28(%rbp)
	movl	-40(%rbp), %eax
	pxor	%xmm2, %xmm2
	cvtsi2sdl	%eax, %xmm2
	movq	%xmm2, %rax
	movq	%rax, %xmm0
	call	sqrt@PLT
	movq	%xmm0, %rax
	movq	%rax, -16(%rbp)
	movl	$0, -36(%rbp)
	jmp	.L4
.L10:
	movl	-36(%rbp), %eax
	imull	%eax, %eax
	movl	%eax, -24(%rbp)
	movl	$0, -32(%rbp)
	jmp	.L5
.L9:
	movl	-32(%rbp), %eax
	imull	%eax, %eax
	imull	-32(%rbp), %eax
	movl	%eax, %edx
	movl	-40(%rbp), %eax
	subl	-24(%rbp), %eax
	cmpl	%eax, %edx
	jle	.L6
	subl	$1, -32(%rbp)
	movl	-40(%rbp), %eax
	subl	-24(%rbp), %eax
	movl	%eax, %edx
	movl	-32(%rbp), %eax
	imull	%eax, %eax
	imull	-32(%rbp), %eax
	subl	%eax, %edx
	movl	-36(%rbp), %eax
	addl	%eax, %edx
	movl	-32(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -20(%rbp)
	movl	-28(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jle	.L16
	movl	-20(%rbp), %eax
	movl	%eax, -28(%rbp)
	jmp	.L16
.L6:
	addl	$1, -32(%rbp)
.L5:
	movl	-40(%rbp), %eax
	cmpl	%eax, -32(%rbp)
	jl	.L9
	jmp	.L8
.L16:
	nop
.L8:
	addl	$1, -36(%rbp)
.L4:
	pxor	%xmm1, %xmm1
	cvtsi2sdl	-36(%rbp), %xmm1
	movsd	-16(%rbp), %xmm0
	comisd	%xmm1, %xmm0
	jnb	.L10
	movl	-28(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L11
.L15:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L13
	call	__stack_chk_fail@PLT
.L13:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.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:
