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 MAX_E (1000000)

int main(void)
{
    int e;
    int m;
    int x, y, z;
    
    while (1){
        scanf("%d", &e);
        if (e == 0){
            break;
        }
        
        m = MAX_E;
        
        for (z = 0; z * z * z <= e; z++){
            for (y = 0; y * y <= e; y++){
                if (z * z * z + y * y > e){
                    break;
                }
            
                x = e - z * z * z - y * y;
                if (m > x + y + z){
                    m = x + y + z;
                }
            }
        }
                        
        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:
.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
.L11:
	leaq	-28(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-28(%rbp), %eax
	testl	%eax, %eax
	je	.L15
	movl	$1000000, -24(%rbp)
	movl	$0, -16(%rbp)
	jmp	.L4
.L10:
	movl	$0, -20(%rbp)
	jmp	.L5
.L9:
	movl	-16(%rbp), %eax
	imull	%eax, %eax
	imull	-16(%rbp), %eax
	movl	%eax, %edx
	movl	-20(%rbp), %eax
	imull	%eax, %eax
	addl	%eax, %edx
	movl	-28(%rbp), %eax
	cmpl	%eax, %edx
	jg	.L16
	movl	-28(%rbp), %edx
	movl	-16(%rbp), %eax
	imull	%eax, %eax
	imull	-16(%rbp), %eax
	subl	%eax, %edx
	movl	-20(%rbp), %eax
	imull	%eax, %eax
	movl	%eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	movl	%eax, -12(%rbp)
	movl	-12(%rbp), %edx
	movl	-20(%rbp), %eax
	addl	%eax, %edx
	movl	-16(%rbp), %eax
	addl	%edx, %eax
	cmpl	%eax, -24(%rbp)
	jle	.L8
	movl	-12(%rbp), %edx
	movl	-20(%rbp), %eax
	addl	%eax, %edx
	movl	-16(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -24(%rbp)
.L8:
	addl	$1, -20(%rbp)
.L5:
	movl	-20(%rbp), %eax
	imull	%eax, %eax
	movl	%eax, %edx
	movl	-28(%rbp), %eax
	cmpl	%eax, %edx
	jle	.L9
	jmp	.L7
.L16:
	nop
.L7:
	addl	$1, -16(%rbp)
.L4:
	movl	-16(%rbp), %eax
	imull	%eax, %eax
	imull	-16(%rbp), %eax
	movl	%eax, %edx
	movl	-28(%rbp), %eax
	cmpl	%eax, %edx
	jle	.L10
	movl	-24(%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
.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
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	leaq	.LC1(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	leaq	.LC0(%rip), %rbx
	subq	$16, %rsp
	.cfi_def_cfa_offset 48
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rbp
	.p2align 4,,10
	.p2align 3
.L8:
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %esi
	testl	%esi, %esi
	je	.L2
	movl	$0, %edi
	movl	$1000000, %r8d
	movl	$0, %r9d
	js	.L4
	cmpl	%r9d, %esi
	jl	.L5
	.p2align 4,,10
	.p2align 3
.L13:
	movl	%esi, %r10d
	movl	$1, %edx
	movl	$1, %ecx
	subl	%r9d, %r10d
	leal	(%r10,%rdi), %eax
	cmpl	%eax, %r8d
	cmovg	%eax, %r8d
	.p2align 4,,10
	.p2align 3
.L6:
	leal	(%rcx,%r9), %eax
	cmpl	%eax, %esi
	jl	.L5
	movl	%r10d, %eax
	subl	%ecx, %eax
	addl	%edx, %eax
	addl	%edi, %eax
	cmpl	%eax, %r8d
	cmovg	%eax, %r8d
	addl	$1, %edx
	movl	%edx, %ecx
	imull	%edx, %ecx
	cmpl	%ecx, %esi
	jge	.L6
.L5:
	addl	$1, %edi
	movl	%edi, %r9d
	imull	%edi, %r9d
	imull	%edi, %r9d
	cmpl	%r9d, %esi
	jge	.L13
.L4:
	movl	%r8d, %edx
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L8
.L2:
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L17
	addq	$16, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L17:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.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"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	leaq	.LC1(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	leaq	.LC0(%rip), %rbx
	subq	$16, %rsp
	.cfi_def_cfa_offset 48
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rbp
	.p2align 4,,10
	.p2align 3
.L8:
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %esi
	testl	%esi, %esi
	je	.L2
	movl	$0, %edi
	movl	$1000000, %r8d
	movl	$0, %r9d
	js	.L4
	cmpl	%r9d, %esi
	jl	.L5
	.p2align 4,,10
	.p2align 3
.L13:
	movl	%esi, %r10d
	movl	$1, %edx
	movl	$1, %ecx
	subl	%r9d, %r10d
	leal	(%r10,%rdi), %eax
	cmpl	%eax, %r8d
	cmovg	%eax, %r8d
	.p2align 4,,10
	.p2align 3
.L6:
	leal	(%rcx,%r9), %eax
	cmpl	%eax, %esi
	jl	.L5
	movl	%r10d, %eax
	subl	%ecx, %eax
	addl	%edx, %eax
	addl	%edi, %eax
	cmpl	%eax, %r8d
	cmovg	%eax, %r8d
	addl	$1, %edx
	movl	%edx, %ecx
	imull	%edx, %ecx
	cmpl	%ecx, %esi
	jge	.L6
.L5:
	addl	$1, %edi
	movl	%edi, %r9d
	imull	%edi, %r9d
	imull	%edi, %r9d
	cmpl	%r9d, %esi
	jge	.L13
.L4:
	movl	%r8d, %edx
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L8
.L2:
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L17
	addq	$16, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L17:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.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>

#define MAX_E (1000000)

int main(void)
{
    int e;
    int m;
    int x, y, z;
    
    while (1){
        scanf("%d", &e);
        if (e == 0){
            break;
        }
        
        m = MAX_E;
        
        for (z = 0; z * z * z <= e; z++){
            for (y = 0; y * y <= e; y++){
                if (z * z * z + y * y > e){
                    break;
                }
            
                x = e - z * z * z - y * y;
                if (m > x + y + z){
                    m = x + y + z;
                }
            }
        }
                        
        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>

#define MAX_E (1000000)

int main(void)
{
    int e;
    int m;
    int x, y, z;
    
    while (1){
        scanf("%d", &e);
        if (e == 0){
            break;
        }
        
        m = MAX_E;
        
        for (z = 0; z * z * z <= e; z++){
            for (y = 0; y * y <= e; y++){
                if (z * z * z + y * y > e){
                    break;
                }
            
                x = e - z * z * z - y * y;
                if (m > x + y + z){
                    m = x + y + z;
                }
            }
        }
                        
        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:
.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
.L11:
	leaq	-28(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-28(%rbp), %eax
	testl	%eax, %eax
	je	.L15
	movl	$1000000, -24(%rbp)
	movl	$0, -16(%rbp)
	jmp	.L4
.L10:
	movl	$0, -20(%rbp)
	jmp	.L5
.L9:
	movl	-16(%rbp), %eax
	imull	%eax, %eax
	imull	-16(%rbp), %eax
	movl	%eax, %edx
	movl	-20(%rbp), %eax
	imull	%eax, %eax
	addl	%eax, %edx
	movl	-28(%rbp), %eax
	cmpl	%eax, %edx
	jg	.L16
	movl	-28(%rbp), %edx
	movl	-16(%rbp), %eax
	imull	%eax, %eax
	imull	-16(%rbp), %eax
	subl	%eax, %edx
	movl	-20(%rbp), %eax
	imull	%eax, %eax
	movl	%eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	movl	%eax, -12(%rbp)
	movl	-12(%rbp), %edx
	movl	-20(%rbp), %eax
	addl	%eax, %edx
	movl	-16(%rbp), %eax
	addl	%edx, %eax
	cmpl	%eax, -24(%rbp)
	jle	.L8
	movl	-12(%rbp), %edx
	movl	-20(%rbp), %eax
	addl	%eax, %edx
	movl	-16(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -24(%rbp)
.L8:
	addl	$1, -20(%rbp)
.L5:
	movl	-20(%rbp), %eax
	imull	%eax, %eax
	movl	%eax, %edx
	movl	-28(%rbp), %eax
	cmpl	%eax, %edx
	jle	.L9
	jmp	.L7
.L16:
	nop
.L7:
	addl	$1, -16(%rbp)
.L4:
	movl	-16(%rbp), %eax
	imull	%eax, %eax
	imull	-16(%rbp), %eax
	movl	%eax, %edx
	movl	-28(%rbp), %eax
	cmpl	%eax, %edx
	jle	.L10
	movl	-24(%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
.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
	.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	$32, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L11:
	leaq	-28(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-28(%rbp), %eax
	testl	%eax, %eax
	je	.L15
	movl	$1000000, -24(%rbp)
	movl	$0, -16(%rbp)
	jmp	.L4
.L10:
	movl	$0, -20(%rbp)
	jmp	.L5
.L9:
	movl	-16(%rbp), %eax
	imull	%eax, %eax
	imull	-16(%rbp), %eax
	movl	%eax, %edx
	movl	-20(%rbp), %eax
	imull	%eax, %eax
	addl	%eax, %edx
	movl	-28(%rbp), %eax
	cmpl	%eax, %edx
	jg	.L16
	movl	-28(%rbp), %edx
	movl	-16(%rbp), %eax
	imull	%eax, %eax
	imull	-16(%rbp), %eax
	subl	%eax, %edx
	movl	-20(%rbp), %eax
	imull	%eax, %eax
	movl	%eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	movl	%eax, -12(%rbp)
	movl	-12(%rbp), %edx
	movl	-20(%rbp), %eax
	addl	%eax, %edx
	movl	-16(%rbp), %eax
	addl	%edx, %eax
	cmpl	%eax, -24(%rbp)
	jle	.L8
	movl	-12(%rbp), %edx
	movl	-20(%rbp), %eax
	addl	%eax, %edx
	movl	-16(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -24(%rbp)
.L8:
	addl	$1, -20(%rbp)
.L5:
	movl	-20(%rbp), %eax
	imull	%eax, %eax
	movl	%eax, %edx
	movl	-28(%rbp), %eax
	cmpl	%eax, %edx
	jle	.L9
	jmp	.L7
.L16:
	nop
.L7:
	addl	$1, -16(%rbp)
.L4:
	movl	-16(%rbp), %eax
	imull	%eax, %eax
	imull	-16(%rbp), %eax
	movl	%eax, %edx
	movl	-28(%rbp), %eax
	cmpl	%eax, %edx
	jle	.L10
	movl	-24(%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
.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:
