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 main(void){
    int n,m,i;
    int ans;
    for(;;){
        ans=1;
        scanf("%d",&n);
        if(n==0){
            break;
        }
        m=n;
        for(i=2;i<m;i++){
            if(n%i==0){
                if(n==i*i){
                    ans=ans+i;
                    break;
                }else{
                    ans=ans+i+(n/i);
                    m=n/i;
                }
            }
        }
        if(n==1){
            printf("deficient number\n");
        }else if(ans==n){
            printf("perfect number\n");
        }else if(ans<n){
            printf("deficient number\n");
        }else{
            printf("abundant number\n");
        }
    }
    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"deficient number"
.LC2:
	.string	"perfect number"
.LC3:
	.string	"abundant number"
	.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
.L13:
	movl	$1, -12(%rbp)
	leaq	-24(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-24(%rbp), %eax
	testl	%eax, %eax
	je	.L17
	movl	-24(%rbp), %eax
	movl	%eax, -20(%rbp)
	movl	$2, -16(%rbp)
	jmp	.L4
.L8:
	movl	-24(%rbp), %eax
	cltd
	idivl	-16(%rbp)
	movl	%edx, %eax
	testl	%eax, %eax
	jne	.L5
	movl	-16(%rbp), %eax
	imull	%eax, %eax
	movl	%eax, %edx
	movl	-24(%rbp), %eax
	cmpl	%eax, %edx
	jne	.L6
	movl	-16(%rbp), %eax
	addl	%eax, -12(%rbp)
	jmp	.L7
.L6:
	movl	-12(%rbp), %edx
	movl	-16(%rbp), %eax
	leal	(%rdx,%rax), %ecx
	movl	-24(%rbp), %eax
	cltd
	idivl	-16(%rbp)
	addl	%ecx, %eax
	movl	%eax, -12(%rbp)
	movl	-24(%rbp), %eax
	cltd
	idivl	-16(%rbp)
	movl	%eax, -20(%rbp)
.L5:
	addl	$1, -16(%rbp)
.L4:
	movl	-16(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jl	.L8
.L7:
	movl	-24(%rbp), %eax
	cmpl	$1, %eax
	jne	.L9
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L13
.L9:
	movl	-24(%rbp), %eax
	cmpl	%eax, -12(%rbp)
	jne	.L11
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L13
.L11:
	movl	-24(%rbp), %eax
	cmpl	%eax, -12(%rbp)
	jge	.L12
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L13
.L12:
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L13
.L17:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L15
	call	__stack_chk_fail@PLT
.L15:
	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	"deficient number"
.LC2:
	.string	"perfect number"
.LC3:
	.string	"abundant number"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	leaq	.LC2(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	leaq	.LC3(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	leaq	.LC1(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	leaq	.LC0(%rip), %rbx
	subq	$16, %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
.L2:
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %esi
	testl	%esi, %esi
	je	.L3
	cmpl	$2, %esi
	jle	.L4
	movl	%esi, %r8d
	movl	$1, %edi
	movl	$2, %ecx
	.p2align 4,,10
	.p2align 3
.L7:
	movl	%esi, %eax
	cltd
	idivl	%ecx
	testl	%edx, %edx
	jne	.L5
	movl	%ecx, %edx
	addl	%ecx, %edi
	imull	%ecx, %edx
	cmpl	%edx, %esi
	je	.L6
	movl	%eax, %r8d
	addl	%eax, %edi
.L5:
	addl	$1, %ecx
	cmpl	%ecx, %r8d
	jg	.L7
.L6:
	cmpl	%edi, %esi
	je	.L20
.L11:
	cmpl	%edi, %esi
	jg	.L9
	movq	%r13, %rdi
	call	puts@PLT
	jmp	.L2
.L4:
	movl	$1, %edi
	cmpl	$1, %esi
	jne	.L11
	.p2align 4,,10
	.p2align 3
.L9:
	movq	%r12, %rdi
	call	puts@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L20:
	movq	%r14, %rdi
	call	puts@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L3:
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L21
	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
.L21:
	.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	"deficient number"
.LC2:
	.string	"perfect number"
.LC3:
	.string	"abundant number"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	leaq	.LC2(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	leaq	.LC3(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	leaq	.LC1(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	leaq	.LC0(%rip), %rbx
	subq	$16, %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
.L2:
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %esi
	testl	%esi, %esi
	je	.L3
	cmpl	$2, %esi
	jle	.L4
	movl	%esi, %r8d
	movl	$1, %edi
	movl	$2, %ecx
	.p2align 4,,10
	.p2align 3
.L7:
	movl	%esi, %eax
	cltd
	idivl	%ecx
	testl	%edx, %edx
	jne	.L5
	movl	%ecx, %edx
	addl	%ecx, %edi
	imull	%ecx, %edx
	cmpl	%edx, %esi
	je	.L6
	movl	%eax, %r8d
	addl	%eax, %edi
.L5:
	addl	$1, %ecx
	cmpl	%ecx, %r8d
	jg	.L7
.L6:
	cmpl	%edi, %esi
	je	.L20
.L11:
	cmpl	%edi, %esi
	jg	.L9
	movq	%r13, %rdi
	call	puts@PLT
	jmp	.L2
.L4:
	movl	$1, %edi
	cmpl	$1, %esi
	jne	.L11
	.p2align 4,,10
	.p2align 3
.L9:
	movq	%r12, %rdi
	call	puts@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L20:
	movq	%r14, %rdi
	call	puts@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L3:
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L21
	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
.L21:
	.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>
int main(void){
    int n,m,i;
    int ans;
    for(;;){
        ans=1;
        scanf("%d",&n);
        if(n==0){
            break;
        }
        m=n;
        for(i=2;i<m;i++){
            if(n%i==0){
                if(n==i*i){
                    ans=ans+i;
                    break;
                }else{
                    ans=ans+i+(n/i);
                    m=n/i;
                }
            }
        }
        if(n==1){
            printf("deficient number\n");
        }else if(ans==n){
            printf("perfect number\n");
        }else if(ans<n){
            printf("deficient number\n");
        }else{
            printf("abundant number\n");
        }
    }
    return 0;
}
1
2
3
4
6
12
16
28
33550336
99999998
99999999
100001000
0
 1
2
5
4
6
12
16
28
820514
99999998
99999999
100001100
0
 1
2
5
4
6
12
18
28
820514
99999998
99999999
100001100
0
 1
1
5
0
6
12
16
28
33550336
99999998
99999999
100001100
0
 1
1
5
4
6
12
18
4
820514
99999998
99999999
100001100
0
 1
2
3
6
6
12
29
28
33550336
99999998
99999999
100001000
0
 1
1
5
4
6
12
18
4
820514
99999998
699564
100001100
0
 1
2
3
6
6
12
29
28
27350355
99999998
99999999
100001000
0
 1
2
5
3
7
12
16
28
33550336
119648219
124798312
100001000
0
 1
2
1
3
6
12
16
28
256736
48969127
99999999
100001100
0

deficient number
deficient number
deficient number
deficient number
perfect number
abundant number
deficient number
perfect number
perfect number
deficient number
deficient number
abundant number
 deficient number
deficient number
deficient number
deficient number
perfect number
abundant number
deficient number
perfect number
deficient number
deficient number
deficient number
abundant number
 deficient number
deficient number
deficient number
deficient number
perfect number
abundant number
abundant number
perfect number
deficient number
deficient number
deficient number
abundant number
 deficient number
deficient number
deficient number
 deficient number
deficient number
deficient number
deficient number
perfect number
abundant number
abundant number
deficient number
deficient number
deficient number
deficient number
abundant number
 deficient number
deficient number
deficient number
perfect number
perfect number
abundant number
deficient number
perfect number
perfect number
deficient number
deficient number
abundant number
 deficient number
deficient number
deficient number
deficient number
perfect number
abundant number
abundant number
deficient number
deficient number
deficient number
abundant number
abundant number
 deficient number
deficient number
deficient number
perfect number
perfect number
abundant number
deficient number
perfect number
deficient number
deficient number
deficient number
abundant number
 deficient number
deficient number
deficient number
deficient number
deficient number
abundant number
deficient number
perfect number
perfect number
deficient number
deficient number
abundant number
 deficient number
deficient number
deficient number
deficient number
perfect number
abundant number
deficient number
perfect number
abundant number
deficient number
deficient number
abundant number

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 main(void){
    int n,m,i;
    int ans;
    for(;;){
        ans=1;
        scanf("%d",&n);
        if(n==0){
            break;
        }
        m=n;
        for(i=2;i<m;i++){
            if(n%i==0){
                if(n==i*i){
                    ans=ans+i;
                    break;
                }else{
                    ans=ans+i+(n/i);
                    m=n/i;
                }
            }
        }
        if(n==1){
            printf("deficient number\n");
        }else if(ans==n){
            printf("perfect number\n");
        }else if(ans<n){
            printf("deficient number\n");
        }else{
            printf("abundant number\n");
        }
    }
    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"deficient number"
.LC2:
	.string	"perfect number"
.LC3:
	.string	"abundant number"
	.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
.L13:
	movl	$1, -12(%rbp)
	leaq	-24(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-24(%rbp), %eax
	testl	%eax, %eax
	je	.L17
	movl	-24(%rbp), %eax
	movl	%eax, -20(%rbp)
	movl	$2, -16(%rbp)
	jmp	.L4
.L8:
	movl	-24(%rbp), %eax
	cltd
	idivl	-16(%rbp)
	movl	%edx, %eax
	testl	%eax, %eax
	jne	.L5
	movl	-16(%rbp), %eax
	imull	%eax, %eax
	movl	%eax, %edx
	movl	-24(%rbp), %eax
	cmpl	%eax, %edx
	jne	.L6
	movl	-16(%rbp), %eax
	addl	%eax, -12(%rbp)
	jmp	.L7
.L6:
	movl	-12(%rbp), %edx
	movl	-16(%rbp), %eax
	leal	(%rdx,%rax), %ecx
	movl	-24(%rbp), %eax
	cltd
	idivl	-16(%rbp)
	addl	%ecx, %eax
	movl	%eax, -12(%rbp)
	movl	-24(%rbp), %eax
	cltd
	idivl	-16(%rbp)
	movl	%eax, -20(%rbp)
.L5:
	addl	$1, -16(%rbp)
.L4:
	movl	-16(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jl	.L8
.L7:
	movl	-24(%rbp), %eax
	cmpl	$1, %eax
	jne	.L9
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L13
.L9:
	movl	-24(%rbp), %eax
	cmpl	%eax, -12(%rbp)
	jne	.L11
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L13
.L11:
	movl	-24(%rbp), %eax
	cmpl	%eax, -12(%rbp)
	jge	.L12
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L13
.L12:
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L13
.L17:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L15
	call	__stack_chk_fail@PLT
.L15:
	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	"deficient number"
.LC2:
	.string	"perfect number"
.LC3:
	.string	"abundant number"
	.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
.L13:
	movl	$1, -12(%rbp)
	leaq	-24(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-24(%rbp), %eax
	testl	%eax, %eax
	je	.L17
	movl	-24(%rbp), %eax
	movl	%eax, -20(%rbp)
	movl	$2, -16(%rbp)
	jmp	.L4
.L8:
	movl	-24(%rbp), %eax
	cltd
	idivl	-16(%rbp)
	movl	%edx, %eax
	testl	%eax, %eax
	jne	.L5
	movl	-16(%rbp), %eax
	imull	%eax, %eax
	movl	%eax, %edx
	movl	-24(%rbp), %eax
	cmpl	%eax, %edx
	jne	.L6
	movl	-16(%rbp), %eax
	addl	%eax, -12(%rbp)
	jmp	.L7
.L6:
	movl	-12(%rbp), %edx
	movl	-16(%rbp), %eax
	leal	(%rdx,%rax), %ecx
	movl	-24(%rbp), %eax
	cltd
	idivl	-16(%rbp)
	addl	%ecx, %eax
	movl	%eax, -12(%rbp)
	movl	-24(%rbp), %eax
	cltd
	idivl	-16(%rbp)
	movl	%eax, -20(%rbp)
.L5:
	addl	$1, -16(%rbp)
.L4:
	movl	-16(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jl	.L8
.L7:
	movl	-24(%rbp), %eax
	cmpl	$1, %eax
	jne	.L9
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L13
.L9:
	movl	-24(%rbp), %eax
	cmpl	%eax, -12(%rbp)
	jne	.L11
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L13
.L11:
	movl	-24(%rbp), %eax
	cmpl	%eax, -12(%rbp)
	jge	.L12
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L13
.L12:
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L13
.L17:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L15
	call	__stack_chk_fail@PLT
.L15:
	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:
