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 <math.h>

#define EPS 1e-7

int main(void) {
	double d;
	double answer = 0;
	int i;
	if (scanf("%lf", &d) != 1) return 1;
	answer = d * sqrt(2);
	for (i = 1; i < d + EPS; i++) {
		double y = sqrt(d * d - i * i);
		double candidate;
		if (y < 1) candidate = i + y + (1.0 - y) /* / 2 * 2 */;
		else candidate = i + y;
		if (candidate > answer) answer = candidate;
	}
	printf("%.15f\n", answer);
	return 0;
}

```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC1:
	.string	"%lf"
.LC5:
	.string	"%.15f\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
	pxor	%xmm0, %xmm0
	movsd	%xmm0, -32(%rbp)
	leaq	-40(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$1, %eax
	je	.L2
	movl	$1, %eax
	jmp	.L11
.L2:
	movsd	-40(%rbp), %xmm1
	movsd	.LC2(%rip), %xmm0
	mulsd	%xmm1, %xmm0
	movsd	%xmm0, -32(%rbp)
	movl	$1, -44(%rbp)
	jmp	.L4
.L10:
	movsd	-40(%rbp), %xmm1
	movsd	-40(%rbp), %xmm0
	mulsd	%xmm1, %xmm0
	movl	-44(%rbp), %eax
	imull	%eax, %eax
	pxor	%xmm1, %xmm1
	cvtsi2sdl	%eax, %xmm1
	subsd	%xmm1, %xmm0
	movq	%xmm0, %rax
	movq	%rax, %xmm0
	call	sqrt@PLT
	movq	%xmm0, %rax
	movq	%rax, -16(%rbp)
	movsd	.LC3(%rip), %xmm0
	comisd	-16(%rbp), %xmm0
	jbe	.L15
	pxor	%xmm0, %xmm0
	cvtsi2sdl	-44(%rbp), %xmm0
	movapd	%xmm0, %xmm1
	addsd	-16(%rbp), %xmm1
	movsd	.LC3(%rip), %xmm0
	subsd	-16(%rbp), %xmm0
	addsd	%xmm1, %xmm0
	movsd	%xmm0, -24(%rbp)
	jmp	.L7
.L15:
	pxor	%xmm0, %xmm0
	cvtsi2sdl	-44(%rbp), %xmm0
	movsd	-16(%rbp), %xmm1
	addsd	%xmm1, %xmm0
	movsd	%xmm0, -24(%rbp)
.L7:
	movsd	-24(%rbp), %xmm0
	comisd	-32(%rbp), %xmm0
	jbe	.L8
	movsd	-24(%rbp), %xmm0
	movsd	%xmm0, -32(%rbp)
.L8:
	addl	$1, -44(%rbp)
.L4:
	pxor	%xmm1, %xmm1
	cvtsi2sdl	-44(%rbp), %xmm1
	movsd	-40(%rbp), %xmm2
	movsd	.LC4(%rip), %xmm0
	addsd	%xmm2, %xmm0
	comisd	%xmm1, %xmm0
	ja	.L10
	movq	-32(%rbp), %rax
	movq	%rax, %xmm0
	leaq	.LC5(%rip), %rax
	movq	%rax, %rdi
	movl	$1, %eax
	call	printf@PLT
	movl	$0, %eax
.L11:
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L12
	call	__stack_chk_fail@PLT
.L12:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.section	.rodata
	.align 8
.LC2:
	.long	1719614413
	.long	1073127582
	.align 8
.LC3:
	.long	0
	.long	1072693248
	.align 8
.LC4:
	.long	-1698910392
	.long	1048238066
	.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
.LC1:
	.string	"%lf"
.LC5:
	.string	"%.15f\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	subq	$72, %rsp
	.cfi_def_cfa_offset 80
	leaq	.LC1(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 56(%rsp)
	xorl	%eax, %eax
	leaq	48(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	$1, %r8d
	cmpl	$1, %eax
	jne	.L1
	movsd	48(%rsp), %xmm5
	movsd	.LC3(%rip), %xmm6
	movsd	.LC0(%rip), %xmm4
	movsd	.LC2(%rip), %xmm2
	addsd	%xmm5, %xmm6
	mulsd	%xmm5, %xmm2
	comisd	%xmm4, %xmm6
	jbe	.L3
	mulsd	%xmm5, %xmm5
	movapd	%xmm4, %xmm1
	pxor	%xmm7, %xmm7
	.p2align 4,,10
	.p2align 3
.L12:
	movl	%eax, %edx
	pxor	%xmm3, %xmm3
	movapd	%xmm5, %xmm0
	imull	%eax, %edx
	cvtsi2sdl	%edx, %xmm3
	subsd	%xmm3, %xmm0
	ucomisd	%xmm0, %xmm7
	ja	.L20
	sqrtsd	%xmm0, %xmm0
.L7:
	comisd	%xmm0, %xmm4
	addsd	%xmm0, %xmm1
	jbe	.L8
	movapd	%xmm4, %xmm3
	subsd	%xmm0, %xmm3
	addsd	%xmm3, %xmm1
.L8:
	maxsd	%xmm2, %xmm1
	addl	$1, %eax
	movapd	%xmm1, %xmm2
	pxor	%xmm1, %xmm1
	cvtsi2sdl	%eax, %xmm1
	comisd	%xmm1, %xmm6
	ja	.L12
.L3:
	movapd	%xmm2, %xmm0
	movl	$1, %edi
	movl	$1, %eax
	leaq	.LC5(%rip), %rsi
	call	__printf_chk@PLT
	xorl	%r8d, %r8d
.L1:
	movq	56(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L24
	movl	%r8d, %eax
	addq	$72, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
.L20:
	.cfi_restore_state
	movl	%eax, 36(%rsp)
	movsd	%xmm6, 40(%rsp)
	movsd	%xmm2, 24(%rsp)
	movsd	%xmm1, 16(%rsp)
	movsd	%xmm5, 8(%rsp)
	call	sqrt@PLT
	movq	.LC0(%rip), %rax
	pxor	%xmm7, %xmm7
	movsd	40(%rsp), %xmm6
	movsd	24(%rsp), %xmm2
	movsd	16(%rsp), %xmm1
	movq	%rax, %xmm4
	movsd	8(%rsp), %xmm5
	movl	36(%rsp), %eax
	jmp	.L7
.L24:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC0:
	.long	0
	.long	1072693248
	.align 8
.LC2:
	.long	1719614413
	.long	1073127582
	.align 8
.LC3:
	.long	-1698910392
	.long	1048238066
	.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
.LC1:
	.string	"%lf"
.LC5:
	.string	"%.15f\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	subq	$72, %rsp
	.cfi_def_cfa_offset 80
	leaq	.LC1(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 56(%rsp)
	xorl	%eax, %eax
	leaq	48(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	$1, %r8d
	cmpl	$1, %eax
	jne	.L1
	movsd	48(%rsp), %xmm5
	movsd	.LC3(%rip), %xmm6
	movsd	.LC0(%rip), %xmm4
	movsd	.LC2(%rip), %xmm2
	addsd	%xmm5, %xmm6
	mulsd	%xmm5, %xmm2
	comisd	%xmm4, %xmm6
	jbe	.L3
	mulsd	%xmm5, %xmm5
	movapd	%xmm4, %xmm1
	pxor	%xmm7, %xmm7
	.p2align 4,,10
	.p2align 3
.L12:
	movl	%eax, %edx
	pxor	%xmm3, %xmm3
	movapd	%xmm5, %xmm0
	imull	%eax, %edx
	cvtsi2sdl	%edx, %xmm3
	subsd	%xmm3, %xmm0
	ucomisd	%xmm0, %xmm7
	ja	.L20
	sqrtsd	%xmm0, %xmm0
.L7:
	comisd	%xmm0, %xmm4
	addsd	%xmm0, %xmm1
	jbe	.L8
	movapd	%xmm4, %xmm3
	subsd	%xmm0, %xmm3
	addsd	%xmm3, %xmm1
.L8:
	maxsd	%xmm2, %xmm1
	addl	$1, %eax
	movapd	%xmm1, %xmm2
	pxor	%xmm1, %xmm1
	cvtsi2sdl	%eax, %xmm1
	comisd	%xmm1, %xmm6
	ja	.L12
.L3:
	movapd	%xmm2, %xmm0
	movl	$1, %edi
	movl	$1, %eax
	leaq	.LC5(%rip), %rsi
	call	__printf_chk@PLT
	xorl	%r8d, %r8d
.L1:
	movq	56(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L24
	movl	%r8d, %eax
	addq	$72, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
.L20:
	.cfi_restore_state
	movl	%eax, 36(%rsp)
	movsd	%xmm6, 40(%rsp)
	movsd	%xmm2, 24(%rsp)
	movsd	%xmm1, 16(%rsp)
	movsd	%xmm5, 8(%rsp)
	call	sqrt@PLT
	movq	.LC0(%rip), %rax
	pxor	%xmm7, %xmm7
	movsd	40(%rsp), %xmm6
	movsd	24(%rsp), %xmm2
	movsd	16(%rsp), %xmm1
	movq	%rax, %xmm4
	movsd	8(%rsp), %xmm5
	movl	36(%rsp), %eax
	jmp	.L7
.L24:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC0:
	.long	0
	.long	1072693248
	.align 8
.LC2:
	.long	1719614413
	.long	1073127582
	.align 8
.LC3:
	.long	-1698910392
	.long	1048238066
	.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 <math.h>

#define EPS 1e-7

int main(void) {
	double d;
	double answer = 0;
	int i;
	if (scanf("%lf", &d) != 1) return 1;
	answer = d * sqrt(2);
	for (i = 1; i < d + EPS; i++) {
		double y = sqrt(d * d - i * i);
		double candidate;
		if (y < 1) candidate = i + y + (1.0 - y) /* / 2 * 2 */;
		else candidate = i + y;
		if (candidate > answer) answer = candidate;
	}
	printf("%.15f\n", answer);
	return 0;
}


1.6623460269048462
 3.25937378137542
 2.618243582076879
 4.191829833885925
 2.6469616558038407
 4.247442548717362
 2.711344148850446
 4.7522412032328525
 2.895597134917855
 5.55775493898071

2.350912296605864
 4.609450606464399
 3.702755583369436
 5.928142602241634
 3.743369072719336
 6.006790857796639
 3.834419667565237
 6.720683961280137
 4.094992739369507
 7.859852411052574

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 <math.h>

#define EPS 1e-7

int main(void) {
	double d;
	double answer = 0;
	int i;
	if (scanf("%lf", &d) != 1) return 1;
	answer = d * sqrt(2);
	for (i = 1; i < d + EPS; i++) {
		double y = sqrt(d * d - i * i);
		double candidate;
		if (y < 1) candidate = i + y + (1.0 - y) /* / 2 * 2 */;
		else candidate = i + y;
		if (candidate > answer) answer = candidate;
	}
	printf("%.15f\n", answer);
	return 0;
}

```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC1:
	.string	"%lf"
.LC5:
	.string	"%.15f\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
	pxor	%xmm0, %xmm0
	movsd	%xmm0, -32(%rbp)
	leaq	-40(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$1, %eax
	je	.L2
	movl	$1, %eax
	jmp	.L11
.L2:
	movsd	-40(%rbp), %xmm1
	movsd	.LC2(%rip), %xmm0
	mulsd	%xmm1, %xmm0
	movsd	%xmm0, -32(%rbp)
	movl	$1, -44(%rbp)
	jmp	.L4
.L10:
	movsd	-40(%rbp), %xmm1
	movsd	-40(%rbp), %xmm0
	mulsd	%xmm1, %xmm0
	movl	-44(%rbp), %eax
	imull	%eax, %eax
	pxor	%xmm1, %xmm1
	cvtsi2sdl	%eax, %xmm1
	subsd	%xmm1, %xmm0
	movq	%xmm0, %rax
	movq	%rax, %xmm0
	call	sqrt@PLT
	movq	%xmm0, %rax
	movq	%rax, -16(%rbp)
	movsd	.LC3(%rip), %xmm0
	comisd	-16(%rbp), %xmm0
	jbe	.L15
	pxor	%xmm0, %xmm0
	cvtsi2sdl	-44(%rbp), %xmm0
	movapd	%xmm0, %xmm1
	addsd	-16(%rbp), %xmm1
	movsd	.LC3(%rip), %xmm0
	subsd	-16(%rbp), %xmm0
	addsd	%xmm1, %xmm0
	movsd	%xmm0, -24(%rbp)
	jmp	.L7
.L15:
	pxor	%xmm0, %xmm0
	cvtsi2sdl	-44(%rbp), %xmm0
	movsd	-16(%rbp), %xmm1
	addsd	%xmm1, %xmm0
	movsd	%xmm0, -24(%rbp)
.L7:
	movsd	-24(%rbp), %xmm0
	comisd	-32(%rbp), %xmm0
	jbe	.L8
	movsd	-24(%rbp), %xmm0
	movsd	%xmm0, -32(%rbp)
.L8:
	addl	$1, -44(%rbp)
.L4:
	pxor	%xmm1, %xmm1
	cvtsi2sdl	-44(%rbp), %xmm1
	movsd	-40(%rbp), %xmm2
	movsd	.LC4(%rip), %xmm0
	addsd	%xmm2, %xmm0
	comisd	%xmm1, %xmm0
	ja	.L10
	movq	-32(%rbp), %rax
	movq	%rax, %xmm0
	leaq	.LC5(%rip), %rax
	movq	%rax, %rdi
	movl	$1, %eax
	call	printf@PLT
	movl	$0, %eax
.L11:
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L12
	call	__stack_chk_fail@PLT
.L12:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.section	.rodata
	.align 8
.LC2:
	.long	1719614413
	.long	1073127582
	.align 8
.LC3:
	.long	0
	.long	1072693248
	.align 8
.LC4:
	.long	-1698910392
	.long	1048238066
	.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
.LC1:
	.string	"%lf"
.LC5:
	.string	"%.15f\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
	pxor	%xmm0, %xmm0
	movsd	%xmm0, -32(%rbp)
	leaq	-40(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$1, %eax
	je	.L2
	movl	$1, %eax
	jmp	.L11
.L2:
	movsd	-40(%rbp), %xmm1
	movsd	.LC2(%rip), %xmm0
	mulsd	%xmm1, %xmm0
	movsd	%xmm0, -32(%rbp)
	movl	$1, -44(%rbp)
	jmp	.L4
.L10:
	movsd	-40(%rbp), %xmm1
	movsd	-40(%rbp), %xmm0
	mulsd	%xmm1, %xmm0
	movl	-44(%rbp), %eax
	imull	%eax, %eax
	pxor	%xmm1, %xmm1
	cvtsi2sdl	%eax, %xmm1
	subsd	%xmm1, %xmm0
	movq	%xmm0, %rax
	movq	%rax, %xmm0
	call	sqrt@PLT
	movq	%xmm0, %rax
	movq	%rax, -16(%rbp)
	movsd	.LC3(%rip), %xmm0
	comisd	-16(%rbp), %xmm0
	jbe	.L15
	pxor	%xmm0, %xmm0
	cvtsi2sdl	-44(%rbp), %xmm0
	movapd	%xmm0, %xmm1
	addsd	-16(%rbp), %xmm1
	movsd	.LC3(%rip), %xmm0
	subsd	-16(%rbp), %xmm0
	addsd	%xmm1, %xmm0
	movsd	%xmm0, -24(%rbp)
	jmp	.L7
.L15:
	pxor	%xmm0, %xmm0
	cvtsi2sdl	-44(%rbp), %xmm0
	movsd	-16(%rbp), %xmm1
	addsd	%xmm1, %xmm0
	movsd	%xmm0, -24(%rbp)
.L7:
	movsd	-24(%rbp), %xmm0
	comisd	-32(%rbp), %xmm0
	jbe	.L8
	movsd	-24(%rbp), %xmm0
	movsd	%xmm0, -32(%rbp)
.L8:
	addl	$1, -44(%rbp)
.L4:
	pxor	%xmm1, %xmm1
	cvtsi2sdl	-44(%rbp), %xmm1
	movsd	-40(%rbp), %xmm2
	movsd	.LC4(%rip), %xmm0
	addsd	%xmm2, %xmm0
	comisd	%xmm1, %xmm0
	ja	.L10
	movq	-32(%rbp), %rax
	movq	%rax, %xmm0
	leaq	.LC5(%rip), %rax
	movq	%rax, %rdi
	movl	$1, %eax
	call	printf@PLT
	movl	$0, %eax
.L11:
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L12
	call	__stack_chk_fail@PLT
.L12:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.section	.rodata
	.align 8
.LC2:
	.long	1719614413
	.long	1073127582
	.align 8
.LC3:
	.long	0
	.long	1072693248
	.align 8
.LC4:
	.long	-1698910392
	.long	1048238066
	.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:
