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

```c
// C - Walk on Multiplication Table
#include <stdio.h>
typedef long long ll;

int main(void){
    ll i=1, n, ans=0;
    scanf("%lld", &n);
    ans = n-1;
    for(i=1; i<=sqrt(n); i++){
        if(n%i==0){ans=i;}
    }
    printf("%lld\n", ans+n/ans-2);
    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%lld"
.LC1:
	.string	"%lld\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	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movq	$1, -24(%rbp)
	movq	$0, -16(%rbp)
	leaq	-32(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-32(%rbp), %rax
	subq	$1, %rax
	movq	%rax, -16(%rbp)
	movq	$1, -24(%rbp)
	jmp	.L2
.L4:
	movq	-32(%rbp), %rax
	cqto
	idivq	-24(%rbp)
	movq	%rdx, %rax
	testq	%rax, %rax
	jne	.L3
	movq	-24(%rbp), %rax
	movq	%rax, -16(%rbp)
.L3:
	addq	$1, -24(%rbp)
.L2:
	pxor	%xmm1, %xmm1
	cvtsi2sdq	-24(%rbp), %xmm1
	movsd	%xmm1, -40(%rbp)
	movq	-32(%rbp), %rax
	pxor	%xmm2, %xmm2
	cvtsi2sdq	%rax, %xmm2
	movq	%xmm2, %rax
	movq	%rax, %xmm0
	call	sqrt@PLT
	movq	%xmm0, %rax
	movq	%rax, %xmm3
	comisd	-40(%rbp), %xmm3
	jnb	.L4
	movq	-32(%rbp), %rax
	cqto
	idivq	-16(%rbp)
	movq	%rax, %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	subq	$2, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L6
	call	__stack_chk_fail@PLT
.L6:
	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	"%lld"
.LC3:
	.string	"%lld\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	.LC0(%rip), %rdi
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	subq	$32, %rsp
	.cfi_def_cfa_offset 64
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movq	16(%rsp), %rbx
	pxor	%xmm1, %xmm1
	pxor	%xmm0, %xmm0
	cvtsi2sdq	%rbx, %xmm1
	leaq	-1(%rbx), %rbp
	ucomisd	%xmm1, %xmm0
	ja	.L17
	sqrtsd	%xmm1, %xmm1
	comisd	.LC2(%rip), %xmm1
	movl	$1, %ecx
	jb	.L5
	.p2align 4,,10
	.p2align 3
.L4:
	movq	%rbx, %rax
	pxor	%xmm0, %xmm0
	cqto
	idivq	%rcx
	testq	%rdx, %rdx
	cmove	%rcx, %rbp
	addq	$1, %rcx
	cvtsi2sdq	%rcx, %xmm0
	comisd	%xmm0, %xmm1
	jnb	.L4
.L5:
	movq	%rbx, %rax
	leaq	.LC3(%rip), %rsi
	movl	$1, %edi
	cqto
	idivq	%rbp
	leaq	-2(%rbp,%rax), %rdx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L20
	addq	$32, %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
	movl	$1, %r12d
	jmp	.L2
.L21:
	movq	%rbx, %rax
	movsd	8(%rsp), %xmm1
	cqto
	idivq	%r12
	testq	%rdx, %rdx
	cmove	%r12, %rbp
	addq	$1, %r12
.L2:
	movapd	%xmm1, %xmm0
	movsd	%xmm1, 8(%rsp)
	call	sqrt@PLT
	movapd	%xmm0, %xmm2
	pxor	%xmm0, %xmm0
	cvtsi2sdq	%r12, %xmm0
	comisd	%xmm0, %xmm2
	jnb	.L21
	jmp	.L5
.L20:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC2:
	.long	0
	.long	1072693248
	.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	"%lld"
.LC3:
	.string	"%lld\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	.LC0(%rip), %rdi
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	subq	$32, %rsp
	.cfi_def_cfa_offset 64
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movq	16(%rsp), %rbx
	pxor	%xmm1, %xmm1
	pxor	%xmm0, %xmm0
	cvtsi2sdq	%rbx, %xmm1
	leaq	-1(%rbx), %rbp
	ucomisd	%xmm1, %xmm0
	ja	.L17
	sqrtsd	%xmm1, %xmm1
	comisd	.LC2(%rip), %xmm1
	movl	$1, %ecx
	jb	.L5
	.p2align 4,,10
	.p2align 3
.L4:
	movq	%rbx, %rax
	pxor	%xmm0, %xmm0
	cqto
	idivq	%rcx
	testq	%rdx, %rdx
	cmove	%rcx, %rbp
	addq	$1, %rcx
	cvtsi2sdq	%rcx, %xmm0
	comisd	%xmm0, %xmm1
	jnb	.L4
.L5:
	movq	%rbx, %rax
	leaq	.LC3(%rip), %rsi
	movl	$1, %edi
	cqto
	idivq	%rbp
	leaq	-2(%rbp,%rax), %rdx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L20
	addq	$32, %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
	movl	$1, %r12d
	jmp	.L2
.L21:
	movq	%rbx, %rax
	movsd	8(%rsp), %xmm1
	cqto
	idivq	%r12
	testq	%rdx, %rdx
	cmove	%r12, %rbp
	addq	$1, %r12
.L2:
	movapd	%xmm1, %xmm0
	movsd	%xmm1, 8(%rsp)
	call	sqrt@PLT
	movapd	%xmm0, %xmm2
	pxor	%xmm0, %xmm0
	cvtsi2sdq	%r12, %xmm0
	comisd	%xmm0, %xmm2
	jnb	.L21
	jmp	.L5
.L20:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC2:
	.long	0
	.long	1072693248
	.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:

// C - Walk on Multiplication Table
#include <stdio.h>
typedef long long ll;

int main(void){
    ll i=1, n, ans=0;
    scanf("%lld", &n);
    ans = n-1;
    for(i=1; i<=sqrt(n); i++){
        if(n%i==0){ans=i;}
    }
    printf("%lld\n", ans+n/ans-2);
    return 0;
}
6069423871
 83
 19
 605667865
 72
 33
 927082247
 40
 5
 223605823

23434326
 82
 18
 82100
 15
 12
 61750
 11
 4
 31934

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

```c
// C - Walk on Multiplication Table
#include <stdio.h>
typedef long long ll;

int main(void){
    ll i=1, n, ans=0;
    scanf("%lld", &n);
    ans = n-1;
    for(i=1; i<=sqrt(n); i++){
        if(n%i==0){ans=i;}
    }
    printf("%lld\n", ans+n/ans-2);
    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%lld"
.LC1:
	.string	"%lld\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	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movq	$1, -24(%rbp)
	movq	$0, -16(%rbp)
	leaq	-32(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-32(%rbp), %rax
	subq	$1, %rax
	movq	%rax, -16(%rbp)
	movq	$1, -24(%rbp)
	jmp	.L2
.L4:
	movq	-32(%rbp), %rax
	cqto
	idivq	-24(%rbp)
	movq	%rdx, %rax
	testq	%rax, %rax
	jne	.L3
	movq	-24(%rbp), %rax
	movq	%rax, -16(%rbp)
.L3:
	addq	$1, -24(%rbp)
.L2:
	pxor	%xmm1, %xmm1
	cvtsi2sdq	-24(%rbp), %xmm1
	movsd	%xmm1, -40(%rbp)
	movq	-32(%rbp), %rax
	pxor	%xmm2, %xmm2
	cvtsi2sdq	%rax, %xmm2
	movq	%xmm2, %rax
	movq	%rax, %xmm0
	call	sqrt@PLT
	movq	%xmm0, %rax
	movq	%rax, %xmm3
	comisd	-40(%rbp), %xmm3
	jnb	.L4
	movq	-32(%rbp), %rax
	cqto
	idivq	-16(%rbp)
	movq	%rax, %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	subq	$2, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L6
	call	__stack_chk_fail@PLT
.L6:
	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	"%lld"
.LC1:
	.string	"%lld\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	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movq	$1, -24(%rbp)
	movq	$0, -16(%rbp)
	leaq	-32(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-32(%rbp), %rax
	subq	$1, %rax
	movq	%rax, -16(%rbp)
	movq	$1, -24(%rbp)
	jmp	.L2
.L4:
	movq	-32(%rbp), %rax
	cqto
	idivq	-24(%rbp)
	movq	%rdx, %rax
	testq	%rax, %rax
	jne	.L3
	movq	-24(%rbp), %rax
	movq	%rax, -16(%rbp)
.L3:
	addq	$1, -24(%rbp)
.L2:
	pxor	%xmm1, %xmm1
	cvtsi2sdq	-24(%rbp), %xmm1
	movsd	%xmm1, -40(%rbp)
	movq	-32(%rbp), %rax
	pxor	%xmm2, %xmm2
	cvtsi2sdq	%rax, %xmm2
	movq	%xmm2, %rax
	movq	%rax, %xmm0
	call	sqrt@PLT
	movq	%xmm0, %rax
	movq	%rax, %xmm3
	comisd	-40(%rbp), %xmm3
	jnb	.L4
	movq	-32(%rbp), %rax
	cqto
	idivq	-16(%rbp)
	movq	%rax, %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	subq	$2, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L6
	call	__stack_chk_fail@PLT
.L6:
	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:
