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 N,r[575],i,j;
double x=0,p[575];
double max(double a,double b){return a>b?a:b;}
double min(double a,double b){return a<b?a:b;}
double ch(int r1,int r2)
{
	double a=1.0*r1+r2,b=1.0*r1-r2;
	return sqrt((a*a)-(b*b));
}

int main()
{
	scanf("%d",&N);
	for(i=0;i<N;i++)
	{
		double t=0,a=0;
		scanf("%d",&r[i]);
		t=r[i];
		for(j=0;j<i;j++)
		{
			t=max(t,p[j]+ch(r[i],r[j]));
		}
		p[i]=t;
		x=max(x,p[i]+r[i]);
	}
	printf("%.5lf\n",x);
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	N
	.bss
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.globl	r
	.align 32
	.type	r, @object
	.size	r, 2300
r:
	.zero	2300
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	j
	.align 4
	.type	j, @object
	.size	j, 4
j:
	.zero	4
	.globl	x
	.align 8
	.type	x, @object
	.size	x, 8
x:
	.zero	8
	.globl	p
	.align 32
	.type	p, @object
	.size	p, 4600
p:
	.zero	4600
	.text
	.globl	max
	.type	max, @function
max:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movsd	%xmm0, -8(%rbp)
	movsd	%xmm1, -16(%rbp)
	movsd	-8(%rbp), %xmm0
	comisd	-16(%rbp), %xmm0
	jbe	.L7
	movsd	-8(%rbp), %xmm0
	jmp	.L5
.L7:
	movsd	-16(%rbp), %xmm0
.L5:
	movq	%xmm0, %rax
	movq	%rax, %xmm0
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	max, .-max
	.globl	min
	.type	min, @function
min:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movsd	%xmm0, -8(%rbp)
	movsd	%xmm1, -16(%rbp)
	movsd	-16(%rbp), %xmm0
	comisd	-8(%rbp), %xmm0
	jbe	.L14
	movsd	-8(%rbp), %xmm0
	jmp	.L12
.L14:
	movsd	-16(%rbp), %xmm0
.L12:
	movq	%xmm0, %rax
	movq	%rax, %xmm0
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	min, .-min
	.globl	ch
	.type	ch, @function
ch:
.LFB8:
	.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
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	pxor	%xmm1, %xmm1
	cvtsi2sdl	-20(%rbp), %xmm1
	pxor	%xmm0, %xmm0
	cvtsi2sdl	-24(%rbp), %xmm0
	addsd	%xmm1, %xmm0
	movsd	%xmm0, -16(%rbp)
	pxor	%xmm0, %xmm0
	cvtsi2sdl	-20(%rbp), %xmm0
	pxor	%xmm1, %xmm1
	cvtsi2sdl	-24(%rbp), %xmm1
	subsd	%xmm1, %xmm0
	movsd	%xmm0, -8(%rbp)
	movsd	-16(%rbp), %xmm0
	movapd	%xmm0, %xmm1
	mulsd	%xmm0, %xmm1
	movsd	-8(%rbp), %xmm0
	mulsd	%xmm0, %xmm0
	subsd	%xmm0, %xmm1
	movq	%xmm1, %rax
	movq	%rax, %xmm0
	call	sqrt@PLT
	movq	%xmm0, %rax
	movq	%rax, %xmm0
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	ch, .-ch
	.section	.rodata
.LC0:
	.string	"%d"
.LC2:
	.string	"%.5lf\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB9:
	.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
	leaq	N(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, i(%rip)
	jmp	.L18
.L21:
	pxor	%xmm0, %xmm0
	movsd	%xmm0, -16(%rbp)
	pxor	%xmm0, %xmm0
	movsd	%xmm0, -8(%rbp)
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	r(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	r(%rip), %rax
	movl	(%rdx,%rax), %eax
	pxor	%xmm0, %xmm0
	cvtsi2sdl	%eax, %xmm0
	movsd	%xmm0, -16(%rbp)
	movl	$0, j(%rip)
	jmp	.L19
.L20:
	movl	j(%rip), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	p(%rip), %rax
	movsd	(%rdx,%rax), %xmm2
	movsd	%xmm2, -24(%rbp)
	movl	j(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	r(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	r(%rip), %rax
	movl	(%rcx,%rax), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	ch
	addsd	-24(%rbp), %xmm0
	movq	-16(%rbp), %rax
	movapd	%xmm0, %xmm1
	movq	%rax, %xmm0
	call	max
	movq	%xmm0, %rax
	movq	%rax, -16(%rbp)
	movl	j(%rip), %eax
	addl	$1, %eax
	movl	%eax, j(%rip)
.L19:
	movl	j(%rip), %edx
	movl	i(%rip), %eax
	cmpl	%eax, %edx
	jl	.L20
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	p(%rip), %rax
	movsd	-16(%rbp), %xmm0
	movsd	%xmm0, (%rdx,%rax)
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	p(%rip), %rax
	movsd	(%rdx,%rax), %xmm1
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	r(%rip), %rax
	movl	(%rdx,%rax), %eax
	pxor	%xmm0, %xmm0
	cvtsi2sdl	%eax, %xmm0
	addsd	%xmm1, %xmm0
	movq	x(%rip), %rax
	movapd	%xmm0, %xmm1
	movq	%rax, %xmm0
	call	max
	movq	%xmm0, %rax
	movq	%rax, x(%rip)
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L18:
	movl	i(%rip), %edx
	movl	N(%rip), %eax
	cmpl	%eax, %edx
	jl	.L21
	movq	x(%rip), %rax
	movq	%rax, %xmm0
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$1, %eax
	call	printf@PLT
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.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
	.p2align 4
	.globl	max
	.type	max, @function
max:
.LFB39:
	.cfi_startproc
	endbr64
	maxsd	%xmm1, %xmm0
	ret
	.cfi_endproc
.LFE39:
	.size	max, .-max
	.p2align 4
	.globl	min
	.type	min, @function
min:
.LFB40:
	.cfi_startproc
	endbr64
	minsd	%xmm1, %xmm0
	ret
	.cfi_endproc
.LFE40:
	.size	min, .-min
	.p2align 4
	.globl	ch
	.type	ch, @function
ch:
.LFB41:
	.cfi_startproc
	endbr64
	pxor	%xmm1, %xmm1
	pxor	%xmm2, %xmm2
	cvtsi2sdl	%edi, %xmm1
	cvtsi2sdl	%esi, %xmm2
	movapd	%xmm1, %xmm0
	addsd	%xmm2, %xmm0
	subsd	%xmm2, %xmm1
	mulsd	%xmm0, %xmm0
	mulsd	%xmm1, %xmm1
	subsd	%xmm1, %xmm0
	pxor	%xmm1, %xmm1
	ucomisd	%xmm0, %xmm1
	ja	.L14
	sqrtsd	%xmm0, %xmm0
	ret
.L14:
	jmp	sqrt@PLT
	.cfi_endproc
.LFE41:
	.size	ch, .-ch
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC1:
	.string	"%d"
.LC2:
	.string	"%.5lf\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB42:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	N(%rip), %rsi
	xorl	%eax, %eax
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	leaq	.LC1(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%rbp, %rdi
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	call	__isoc99_scanf@PLT
	movl	N(%rip), %eax
	movl	$0, i(%rip)
	testl	%eax, %eax
	jle	.L16
	leaq	r(%rip), %r15
	leaq	p(%rip), %r12
	xorl	%eax, %eax
	leaq	-8(%r12), %r14
	leaq	-4(%r15), %r13
	.p2align 4,,10
	.p2align 3
.L24:
	cltq
	movq	%rbp, %rdi
	leaq	(%r15,%rax,4), %rsi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	i(%rip), %rcx
	pxor	%xmm4, %xmm4
	movl	$0, j(%rip)
	pxor	%xmm6, %xmm6
	testl	%ecx, %ecx
	cvtsi2sdl	(%r15,%rcx,4), %xmm4
	movq	%rcx, %rax
	jle	.L26
	addl	$1, %eax
	movapd	%xmm4, %xmm5
	movl	$1, %ebx
	movl	%eax, %edx
	.p2align 4,,10
	.p2align 3
.L22:
	pxor	%xmm3, %xmm3
	movapd	%xmm4, %xmm0
	movapd	%xmm4, %xmm1
	movsd	(%r14,%rbx,8), %xmm2
	cvtsi2sdl	0(%r13,%rbx,4), %xmm3
	addsd	%xmm3, %xmm0
	subsd	%xmm3, %xmm1
	mulsd	%xmm0, %xmm0
	mulsd	%xmm1, %xmm1
	subsd	%xmm1, %xmm0
	ucomisd	%xmm0, %xmm6
	ja	.L30
	sqrtsd	%xmm0, %xmm0
.L20:
	addsd	%xmm0, %xmm2
	movl	%ebx, j(%rip)
	addq	$1, %rbx
	maxsd	%xmm2, %xmm5
	cmpq	%rbx, %rdx
	jne	.L22
.L17:
	addsd	%xmm5, %xmm4
	movsd	x(%rip), %xmm0
	cmpl	N(%rip), %eax
	movl	%eax, i(%rip)
	movsd	%xmm5, (%r12,%rcx,8)
	maxsd	%xmm4, %xmm0
	movsd	%xmm0, x(%rip)
	jl	.L24
.L25:
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	movl	$1, %eax
	call	__printf_chk@PLT
	addq	$56, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L26:
	.cfi_restore_state
	movapd	%xmm4, %xmm5
	addl	$1, %eax
	jmp	.L17
.L16:
	movsd	x(%rip), %xmm0
	jmp	.L25
.L30:
	movl	%eax, 44(%rsp)
	movq	%rcx, 32(%rsp)
	movq	%rdx, 24(%rsp)
	movsd	%xmm5, 16(%rsp)
	movsd	%xmm4, 8(%rsp)
	movsd	%xmm2, (%rsp)
	call	sqrt@PLT
	movl	44(%rsp), %eax
	movq	32(%rsp), %rcx
	pxor	%xmm6, %xmm6
	movq	24(%rsp), %rdx
	movsd	16(%rsp), %xmm5
	movsd	8(%rsp), %xmm4
	movsd	(%rsp), %xmm2
	jmp	.L20
	.cfi_endproc
.LFE42:
	.size	main, .-main
	.globl	p
	.bss
	.align 32
	.type	p, @object
	.size	p, 4600
p:
	.zero	4600
	.globl	x
	.align 8
	.type	x, @object
	.size	x, 8
x:
	.zero	8
	.globl	j
	.align 4
	.type	j, @object
	.size	j, 4
j:
	.zero	4
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	r
	.align 32
	.type	r, @object
	.size	r, 2300
r:
	.zero	2300
	.globl	N
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.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
	.p2align 4
	.globl	max
	.type	max, @function
max:
.LFB39:
	.cfi_startproc
	endbr64
	maxsd	%xmm1, %xmm0
	ret
	.cfi_endproc
.LFE39:
	.size	max, .-max
	.p2align 4
	.globl	min
	.type	min, @function
min:
.LFB40:
	.cfi_startproc
	endbr64
	minsd	%xmm1, %xmm0
	ret
	.cfi_endproc
.LFE40:
	.size	min, .-min
	.p2align 4
	.globl	ch
	.type	ch, @function
ch:
.LFB41:
	.cfi_startproc
	endbr64
	pxor	%xmm1, %xmm1
	pxor	%xmm2, %xmm2
	cvtsi2sdl	%edi, %xmm1
	cvtsi2sdl	%esi, %xmm2
	movapd	%xmm1, %xmm0
	addsd	%xmm2, %xmm0
	subsd	%xmm2, %xmm1
	mulsd	%xmm0, %xmm0
	mulsd	%xmm1, %xmm1
	subsd	%xmm1, %xmm0
	pxor	%xmm1, %xmm1
	ucomisd	%xmm0, %xmm1
	ja	.L14
	sqrtsd	%xmm0, %xmm0
	ret
.L14:
	jmp	sqrt@PLT
	.cfi_endproc
.LFE41:
	.size	ch, .-ch
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC1:
	.string	"%d"
.LC2:
	.string	"%.5lf\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB42:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	N(%rip), %rsi
	xorl	%eax, %eax
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	leaq	.LC1(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%rbp, %rdi
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	call	__isoc99_scanf@PLT
	movl	N(%rip), %eax
	movl	$0, i(%rip)
	testl	%eax, %eax
	jle	.L16
	leaq	r(%rip), %r15
	leaq	p(%rip), %r12
	xorl	%eax, %eax
	leaq	-8(%r12), %r14
	leaq	-4(%r15), %r13
	.p2align 4,,10
	.p2align 3
.L24:
	cltq
	movq	%rbp, %rdi
	leaq	(%r15,%rax,4), %rsi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	i(%rip), %rcx
	pxor	%xmm4, %xmm4
	movl	$0, j(%rip)
	pxor	%xmm6, %xmm6
	testl	%ecx, %ecx
	cvtsi2sdl	(%r15,%rcx,4), %xmm4
	movq	%rcx, %rax
	jle	.L26
	addl	$1, %eax
	movapd	%xmm4, %xmm5
	movl	$1, %ebx
	movl	%eax, %edx
	.p2align 4,,10
	.p2align 3
.L22:
	pxor	%xmm3, %xmm3
	movapd	%xmm4, %xmm0
	movapd	%xmm4, %xmm1
	movsd	(%r14,%rbx,8), %xmm2
	cvtsi2sdl	0(%r13,%rbx,4), %xmm3
	addsd	%xmm3, %xmm0
	subsd	%xmm3, %xmm1
	mulsd	%xmm0, %xmm0
	mulsd	%xmm1, %xmm1
	subsd	%xmm1, %xmm0
	ucomisd	%xmm0, %xmm6
	ja	.L30
	sqrtsd	%xmm0, %xmm0
.L20:
	addsd	%xmm0, %xmm2
	movl	%ebx, j(%rip)
	addq	$1, %rbx
	maxsd	%xmm2, %xmm5
	cmpq	%rbx, %rdx
	jne	.L22
.L17:
	addsd	%xmm5, %xmm4
	movsd	x(%rip), %xmm0
	cmpl	N(%rip), %eax
	movl	%eax, i(%rip)
	movsd	%xmm5, (%r12,%rcx,8)
	maxsd	%xmm4, %xmm0
	movsd	%xmm0, x(%rip)
	jl	.L24
.L25:
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	movl	$1, %eax
	call	__printf_chk@PLT
	addq	$56, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L26:
	.cfi_restore_state
	movapd	%xmm4, %xmm5
	addl	$1, %eax
	jmp	.L17
.L16:
	movsd	x(%rip), %xmm0
	jmp	.L25
.L30:
	movl	%eax, 44(%rsp)
	movq	%rcx, 32(%rsp)
	movq	%rdx, 24(%rsp)
	movsd	%xmm5, 16(%rsp)
	movsd	%xmm4, 8(%rsp)
	movsd	%xmm2, (%rsp)
	call	sqrt@PLT
	movl	44(%rsp), %eax
	movq	32(%rsp), %rcx
	pxor	%xmm6, %xmm6
	movq	24(%rsp), %rdx
	movsd	16(%rsp), %xmm5
	movsd	8(%rsp), %xmm4
	movsd	(%rsp), %xmm2
	jmp	.L20
	.cfi_endproc
.LFE42:
	.size	main, .-main
	.globl	p
	.bss
	.align 32
	.type	p, @object
	.size	p, 4600
p:
	.zero	4600
	.globl	x
	.align 8
	.type	x, @object
	.size	x, 8
x:
	.zero	8
	.globl	j
	.align 4
	.type	j, @object
	.size	j, 4
j:
	.zero	4
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	r
	.align 32
	.type	r, @object
	.size	r, 2300
r:
	.zero	2300
	.globl	N
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.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 N,r[575],i,j;
double x=0,p[575];
double max(double a,double b){return a>b?a:b;}
double min(double a,double b){return a<b?a:b;}
double ch(int r1,int r2)
{
	double a=1.0*r1+r2,b=1.0*r1-r2;
	return sqrt((a*a)-(b*b));
}

int main()
{
	scanf("%d",&N);
	for(i=0;i<N;i++)
	{
		double t=0,a=0;
		scanf("%d",&r[i]);
		t=r[i];
		for(j=0;j<i;j++)
		{
			t=max(t,p[j]+ch(r[i],r[j]));
		}
		p[i]=t;
		x=max(x,p[i]+r[i]);
	}
	printf("%.5lf\n",x);
	return 0;
}
2
10 4
 2
3 4
 2
3 1
 2
4 1
 2
4 2
 2
7 2
 2
1 2
 2
1 0
 2
2 0
 2
4 0

26.64911
 13.92820
 7.46410
 9.00000
 11.65685
 16.48331
 5.82843
 2.00000
 4.00000
 8.00000

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 N,r[575],i,j;
double x=0,p[575];
double max(double a,double b){return a>b?a:b;}
double min(double a,double b){return a<b?a:b;}
double ch(int r1,int r2)
{
	double a=1.0*r1+r2,b=1.0*r1-r2;
	return sqrt((a*a)-(b*b));
}

int main()
{
	scanf("%d",&N);
	for(i=0;i<N;i++)
	{
		double t=0,a=0;
		scanf("%d",&r[i]);
		t=r[i];
		for(j=0;j<i;j++)
		{
			t=max(t,p[j]+ch(r[i],r[j]));
		}
		p[i]=t;
		x=max(x,p[i]+r[i]);
	}
	printf("%.5lf\n",x);
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	N
	.bss
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.globl	r
	.align 32
	.type	r, @object
	.size	r, 2300
r:
	.zero	2300
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	j
	.align 4
	.type	j, @object
	.size	j, 4
j:
	.zero	4
	.globl	x
	.align 8
	.type	x, @object
	.size	x, 8
x:
	.zero	8
	.globl	p
	.align 32
	.type	p, @object
	.size	p, 4600
p:
	.zero	4600
	.text
	.globl	max
	.type	max, @function
max:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movsd	%xmm0, -8(%rbp)
	movsd	%xmm1, -16(%rbp)
	movsd	-8(%rbp), %xmm0
	comisd	-16(%rbp), %xmm0
	jbe	.L7
	movsd	-8(%rbp), %xmm0
	jmp	.L5
.L7:
	movsd	-16(%rbp), %xmm0
.L5:
	movq	%xmm0, %rax
	movq	%rax, %xmm0
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	max, .-max
	.globl	min
	.type	min, @function
min:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movsd	%xmm0, -8(%rbp)
	movsd	%xmm1, -16(%rbp)
	movsd	-16(%rbp), %xmm0
	comisd	-8(%rbp), %xmm0
	jbe	.L14
	movsd	-8(%rbp), %xmm0
	jmp	.L12
.L14:
	movsd	-16(%rbp), %xmm0
.L12:
	movq	%xmm0, %rax
	movq	%rax, %xmm0
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	min, .-min
	.globl	ch
	.type	ch, @function
ch:
.LFB8:
	.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
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	pxor	%xmm1, %xmm1
	cvtsi2sdl	-20(%rbp), %xmm1
	pxor	%xmm0, %xmm0
	cvtsi2sdl	-24(%rbp), %xmm0
	addsd	%xmm1, %xmm0
	movsd	%xmm0, -16(%rbp)
	pxor	%xmm0, %xmm0
	cvtsi2sdl	-20(%rbp), %xmm0
	pxor	%xmm1, %xmm1
	cvtsi2sdl	-24(%rbp), %xmm1
	subsd	%xmm1, %xmm0
	movsd	%xmm0, -8(%rbp)
	movsd	-16(%rbp), %xmm0
	movapd	%xmm0, %xmm1
	mulsd	%xmm0, %xmm1
	movsd	-8(%rbp), %xmm0
	mulsd	%xmm0, %xmm0
	subsd	%xmm0, %xmm1
	movq	%xmm1, %rax
	movq	%rax, %xmm0
	call	sqrt@PLT
	movq	%xmm0, %rax
	movq	%rax, %xmm0
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	ch, .-ch
	.section	.rodata
.LC0:
	.string	"%d"
.LC2:
	.string	"%.5lf\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB9:
	.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
	leaq	N(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, i(%rip)
	jmp	.L18
.L21:
	pxor	%xmm0, %xmm0
	movsd	%xmm0, -16(%rbp)
	pxor	%xmm0, %xmm0
	movsd	%xmm0, -8(%rbp)
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	r(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	r(%rip), %rax
	movl	(%rdx,%rax), %eax
	pxor	%xmm0, %xmm0
	cvtsi2sdl	%eax, %xmm0
	movsd	%xmm0, -16(%rbp)
	movl	$0, j(%rip)
	jmp	.L19
.L20:
	movl	j(%rip), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	p(%rip), %rax
	movsd	(%rdx,%rax), %xmm2
	movsd	%xmm2, -24(%rbp)
	movl	j(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	r(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	r(%rip), %rax
	movl	(%rcx,%rax), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	ch
	addsd	-24(%rbp), %xmm0
	movq	-16(%rbp), %rax
	movapd	%xmm0, %xmm1
	movq	%rax, %xmm0
	call	max
	movq	%xmm0, %rax
	movq	%rax, -16(%rbp)
	movl	j(%rip), %eax
	addl	$1, %eax
	movl	%eax, j(%rip)
.L19:
	movl	j(%rip), %edx
	movl	i(%rip), %eax
	cmpl	%eax, %edx
	jl	.L20
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	p(%rip), %rax
	movsd	-16(%rbp), %xmm0
	movsd	%xmm0, (%rdx,%rax)
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	p(%rip), %rax
	movsd	(%rdx,%rax), %xmm1
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	r(%rip), %rax
	movl	(%rdx,%rax), %eax
	pxor	%xmm0, %xmm0
	cvtsi2sdl	%eax, %xmm0
	addsd	%xmm1, %xmm0
	movq	x(%rip), %rax
	movapd	%xmm0, %xmm1
	movq	%rax, %xmm0
	call	max
	movq	%xmm0, %rax
	movq	%rax, x(%rip)
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L18:
	movl	i(%rip), %edx
	movl	N(%rip), %eax
	cmpl	%eax, %edx
	jl	.L21
	movq	x(%rip), %rax
	movq	%rax, %xmm0
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$1, %eax
	call	printf@PLT
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.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
	.globl	N
	.bss
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.globl	r
	.align 32
	.type	r, @object
	.size	r, 2300
r:
	.zero	2300
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	j
	.align 4
	.type	j, @object
	.size	j, 4
j:
	.zero	4
	.globl	x
	.align 8
	.type	x, @object
	.size	x, 8
x:
	.zero	8
	.globl	p
	.align 32
	.type	p, @object
	.size	p, 4600
p:
	.zero	4600
	.text
	.globl	max
	.type	max, @function
max:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movsd	%xmm0, -8(%rbp)
	movsd	%xmm1, -16(%rbp)
	movsd	-8(%rbp), %xmm0
	comisd	-16(%rbp), %xmm0
	jbe	.L7
	movsd	-8(%rbp), %xmm0
	jmp	.L5
.L7:
	movsd	-16(%rbp), %xmm0
.L5:
	movq	%xmm0, %rax
	movq	%rax, %xmm0
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	max, .-max
	.globl	min
	.type	min, @function
min:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movsd	%xmm0, -8(%rbp)
	movsd	%xmm1, -16(%rbp)
	movsd	-16(%rbp), %xmm0
	comisd	-8(%rbp), %xmm0
	jbe	.L14
	movsd	-8(%rbp), %xmm0
	jmp	.L12
.L14:
	movsd	-16(%rbp), %xmm0
.L12:
	movq	%xmm0, %rax
	movq	%rax, %xmm0
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	min, .-min
	.globl	ch
	.type	ch, @function
ch:
.LFB8:
	.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
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	pxor	%xmm1, %xmm1
	cvtsi2sdl	-20(%rbp), %xmm1
	pxor	%xmm0, %xmm0
	cvtsi2sdl	-24(%rbp), %xmm0
	addsd	%xmm1, %xmm0
	movsd	%xmm0, -16(%rbp)
	pxor	%xmm0, %xmm0
	cvtsi2sdl	-20(%rbp), %xmm0
	pxor	%xmm1, %xmm1
	cvtsi2sdl	-24(%rbp), %xmm1
	subsd	%xmm1, %xmm0
	movsd	%xmm0, -8(%rbp)
	movsd	-16(%rbp), %xmm0
	movapd	%xmm0, %xmm1
	mulsd	%xmm0, %xmm1
	movsd	-8(%rbp), %xmm0
	mulsd	%xmm0, %xmm0
	subsd	%xmm0, %xmm1
	movq	%xmm1, %rax
	movq	%rax, %xmm0
	call	sqrt@PLT
	movq	%xmm0, %rax
	movq	%rax, %xmm0
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	ch, .-ch
	.section	.rodata
.LC0:
	.string	"%d"
.LC2:
	.string	"%.5lf\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB9:
	.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
	leaq	N(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, i(%rip)
	jmp	.L18
.L21:
	pxor	%xmm0, %xmm0
	movsd	%xmm0, -16(%rbp)
	pxor	%xmm0, %xmm0
	movsd	%xmm0, -8(%rbp)
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	r(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	r(%rip), %rax
	movl	(%rdx,%rax), %eax
	pxor	%xmm0, %xmm0
	cvtsi2sdl	%eax, %xmm0
	movsd	%xmm0, -16(%rbp)
	movl	$0, j(%rip)
	jmp	.L19
.L20:
	movl	j(%rip), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	p(%rip), %rax
	movsd	(%rdx,%rax), %xmm2
	movsd	%xmm2, -24(%rbp)
	movl	j(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	r(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	r(%rip), %rax
	movl	(%rcx,%rax), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	ch
	addsd	-24(%rbp), %xmm0
	movq	-16(%rbp), %rax
	movapd	%xmm0, %xmm1
	movq	%rax, %xmm0
	call	max
	movq	%xmm0, %rax
	movq	%rax, -16(%rbp)
	movl	j(%rip), %eax
	addl	$1, %eax
	movl	%eax, j(%rip)
.L19:
	movl	j(%rip), %edx
	movl	i(%rip), %eax
	cmpl	%eax, %edx
	jl	.L20
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	p(%rip), %rax
	movsd	-16(%rbp), %xmm0
	movsd	%xmm0, (%rdx,%rax)
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	p(%rip), %rax
	movsd	(%rdx,%rax), %xmm1
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	r(%rip), %rax
	movl	(%rdx,%rax), %eax
	pxor	%xmm0, %xmm0
	cvtsi2sdl	%eax, %xmm0
	addsd	%xmm1, %xmm0
	movq	x(%rip), %rax
	movapd	%xmm0, %xmm1
	movq	%rax, %xmm0
	call	max
	movq	%xmm0, %rax
	movq	%rax, x(%rip)
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L18:
	movl	i(%rip), %edx
	movl	N(%rip), %eax
	cmpl	%eax, %edx
	jl	.L21
	movq	x(%rip), %rax
	movq	%rax, %xmm0
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$1, %eax
	call	printf@PLT
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.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:
