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>
int main(){
	int i,n,j,k;
	double *arr,**ans,res=0;
	scanf ("%d",&n);
	arr=(double*)malloc(n*sizeof(double));
	for(i=0;i<n;i++) scanf ("%lf",&arr[i]);
	ans=(double**)malloc(n*sizeof(double*));
	for(i=0;i<n;i++) ans[i]=(double*)malloc((n+2)*sizeof(double));
	for(i=0;i<n;i++){
		for(j=0;j<n+2;j++) ans[i][j]=0;
	}
	ans[0][0]=1-arr[0];
	ans[0][1]=arr[0];
	for(i=1;i<n;i++){
    	for (j=0;j<i+2;j++){
        	if (j==0) ans[i][j]=ans[i-1][j]*(1-arr[i]);
        	else ans[i][j]=ans[i-1][j]*(1-arr[i])+ans[i-1][j-1]*arr[i];
        }
    }
    for(i=n;i>n/2;i--){
    	res+=ans[n-1][i];
	}
	printf ("%.10lf\n",res);
    return 0;	
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC1:
	.string	"%d"
.LC2:
	.string	"%lf"
.LC4:
	.string	"%.10lf\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%rbx
	subq	$56, %rsp
	.cfi_offset 3, -24
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
	pxor	%xmm0, %xmm0
	movsd	%xmm0, -48(%rbp)
	leaq	-60(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-60(%rbp), %eax
	cltq
	salq	$3, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -40(%rbp)
	movl	$0, -56(%rbp)
	jmp	.L2
.L3:
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -56(%rbp)
.L2:
	movl	-60(%rbp), %eax
	cmpl	%eax, -56(%rbp)
	jl	.L3
	movl	-60(%rbp), %eax
	cltq
	salq	$3, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -32(%rbp)
	movl	$0, -56(%rbp)
	jmp	.L4
.L5:
	movl	-60(%rbp), %eax
	addl	$2, %eax
	cltq
	salq	$3, %rax
	movl	-56(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	movq	-32(%rbp), %rdx
	leaq	(%rcx,%rdx), %rbx
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, (%rbx)
	addl	$1, -56(%rbp)
.L4:
	movl	-60(%rbp), %eax
	cmpl	%eax, -56(%rbp)
	jl	.L5
	movl	$0, -56(%rbp)
	jmp	.L6
.L9:
	movl	$0, -52(%rbp)
	jmp	.L7
.L8:
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-52(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	pxor	%xmm0, %xmm0
	movsd	%xmm0, (%rax)
	addl	$1, -52(%rbp)
.L7:
	movl	-60(%rbp), %eax
	addl	$1, %eax
	cmpl	%eax, -52(%rbp)
	jle	.L8
	addl	$1, -56(%rbp)
.L6:
	movl	-60(%rbp), %eax
	cmpl	%eax, -56(%rbp)
	jl	.L9
	movq	-40(%rbp), %rax
	movsd	(%rax), %xmm1
	movq	-32(%rbp), %rax
	movq	(%rax), %rax
	movsd	.LC3(%rip), %xmm0
	subsd	%xmm1, %xmm0
	movsd	%xmm0, (%rax)
	movq	-32(%rbp), %rax
	movq	(%rax), %rax
	leaq	8(%rax), %rdx
	movq	-40(%rbp), %rax
	movsd	(%rax), %xmm0
	movsd	%xmm0, (%rdx)
	movl	$1, -56(%rbp)
	jmp	.L10
.L15:
	movl	$0, -52(%rbp)
	jmp	.L11
.L14:
	cmpl	$0, -52(%rbp)
	jne	.L12
	movl	-56(%rbp), %eax
	cltq
	salq	$3, %rax
	leaq	-8(%rax), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-52(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	movsd	(%rax), %xmm1
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movsd	(%rax), %xmm2
	movsd	.LC3(%rip), %xmm0
	subsd	%xmm2, %xmm0
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-52(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	mulsd	%xmm1, %xmm0
	movsd	%xmm0, (%rax)
	jmp	.L13
.L12:
	movl	-56(%rbp), %eax
	cltq
	salq	$3, %rax
	leaq	-8(%rax), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-52(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	movsd	(%rax), %xmm1
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movsd	(%rax), %xmm2
	movsd	.LC3(%rip), %xmm0
	subsd	%xmm2, %xmm0
	mulsd	%xmm0, %xmm1
	movl	-56(%rbp), %eax
	cltq
	salq	$3, %rax
	leaq	-8(%rax), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-52(%rbp), %eax
	cltq
	salq	$3, %rax
	subq	$8, %rax
	addq	%rdx, %rax
	movsd	(%rax), %xmm2
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movsd	(%rax), %xmm0
	mulsd	%xmm2, %xmm0
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-52(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	addsd	%xmm1, %xmm0
	movsd	%xmm0, (%rax)
.L13:
	addl	$1, -52(%rbp)
.L11:
	movl	-56(%rbp), %eax
	addl	$1, %eax
	cmpl	%eax, -52(%rbp)
	jle	.L14
	addl	$1, -56(%rbp)
.L10:
	movl	-60(%rbp), %eax
	cmpl	%eax, -56(%rbp)
	jl	.L15
	movl	-60(%rbp), %eax
	movl	%eax, -56(%rbp)
	jmp	.L16
.L17:
	movl	-60(%rbp), %eax
	cltq
	salq	$3, %rax
	leaq	-8(%rax), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-56(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	movsd	(%rax), %xmm0
	movsd	-48(%rbp), %xmm1
	addsd	%xmm1, %xmm0
	movsd	%xmm0, -48(%rbp)
	subl	$1, -56(%rbp)
.L16:
	movl	-60(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	cmpl	%eax, -56(%rbp)
	jg	.L17
	movq	-48(%rbp), %rax
	movq	%rax, %xmm0
	leaq	.LC4(%rip), %rax
	movq	%rax, %rdi
	movl	$1, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-24(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L19
	call	__stack_chk_fail@PLT
.L19:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	main, .-main
	.section	.rodata
	.align 8
.LC3:
	.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:
```

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	"%d"
.LC2:
	.string	"%lf"
.LC4:
	.string	"%.10lf\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	.LC1(%rip), %rdi
	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
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leaq	36(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movslq	36(%rsp), %r12
	leaq	0(,%r12,8), %rax
	movq	%rax, %rdi
	movq	%rax, 24(%rsp)
	call	malloc@PLT
	movq	%rax, 16(%rsp)
	testl	%r12d, %r12d
	jle	.L2
	movq	%rax, %r12
	xorl	%ebp, %ebp
	leaq	.LC2(%rip), %r13
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r12, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addl	$1, %ebp
	call	__isoc99_scanf@PLT
	movl	36(%rsp), %ebx
	addq	$8, %r12
	cmpl	%ebp, %ebx
	jg	.L3
	movslq	%ebx, %r12
	leaq	0(,%r12,8), %r15
	movq	%r15, %rdi
	movq	%r15, 24(%rsp)
	call	malloc@PLT
	movq	%rax, %rbp
	testl	%ebx, %ebx
	jle	.L29
	movq	%rax, %r14
	movl	%ebx, %eax
	addq	$16, %r15
	movq	%rbp, %r13
	leaq	0(%rbp,%rax,8), %rax
	movq	%rax, 8(%rsp)
	.p2align 4,,10
	.p2align 3
.L5:
	movq	%r15, %rdi
	addq	$8, %r13
	call	malloc@PLT
	movq	%rax, -8(%r13)
	cmpq	%r13, 8(%rsp)
	jne	.L5
	leaq	16(,%r12,8), %r15
	.p2align 4,,10
	.p2align 3
.L6:
	movq	(%r14), %rdi
	movq	%r15, %rdx
	xorl	%esi, %esi
	addq	$8, %r14
	call	memset@PLT
	cmpq	8(%rsp), %r14
	jne	.L6
	movq	16(%rsp), %rax
	movsd	.LC3(%rip), %xmm4
	movapd	%xmm4, %xmm0
	subsd	(%rax), %xmm0
	movhpd	(%rax), %xmm0
	movq	0(%rbp), %rax
	movups	%xmm0, (%rax)
	cmpl	$1, %ebx
	jle	.L13
	movl	$1, %ecx
	.p2align 4,,10
	.p2align 3
.L8:
	movq	16(%rsp), %rax
	movapd	%xmm4, %xmm2
	movq	-8(%rbp,%rcx,8), %rdx
	movq	0(%rbp,%rcx,8), %rsi
	movsd	(%rax,%rcx,8), %xmm3
	xorl	%eax, %eax
	subsd	%xmm3, %xmm2
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L9:
	movsd	-8(%rdx,%rax,8), %xmm1
	mulsd	(%rdx,%rax,8), %xmm0
	mulsd	%xmm3, %xmm1
	addsd	%xmm1, %xmm0
	movsd	%xmm0, (%rsi,%rax,8)
	cmpl	%ecx, %eax
	jg	.L11
.L10:
	addq	$1, %rax
.L12:
	movapd	%xmm2, %xmm0
	testq	%rax, %rax
	jne	.L9
	mulsd	(%rdx), %xmm0
	movsd	%xmm0, (%rsi)
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L11:
	addq	$1, %rcx
	cmpq	%rcx, %r12
	jne	.L8
.L13:
	movl	%ebx, %eax
	shrl	$31, %eax
	addl	%ebx, %eax
	sarl	%eax
	cmpl	%ebx, %eax
	jge	.L20
	movq	24(%rsp), %rdi
	movq	-8(%rbp,%rdi), %rcx
	movl	%ebx, %edi
	subl	%eax, %edi
	cmpl	$1, %edi
	je	.L21
	movl	%edi, %esi
	leaq	-8(%rcx,%r12,8), %rdx
	pxor	%xmm0, %xmm0
	shrl	%esi
	leaq	-16(%rdx), %rax
	leal	-1(%rsi), %r8d
	movq	%rax, %rsi
	salq	$4, %r8
	subq	%r8, %rsi
	jmp	.L16
	.p2align 4,,10
	.p2align 3
.L31:
	subq	$16, %rax
.L16:
	movupd	(%rdx), %xmm1
	movq	%rax, %rdx
	movapd	%xmm1, %xmm5
	unpckhpd	%xmm5, %xmm5
	addsd	%xmm5, %xmm0
	addsd	%xmm1, %xmm0
	cmpq	%rsi, %rax
	jne	.L31
	movl	%edi, %eax
	andl	$-2, %eax
	subl	%eax, %ebx
	cmpl	%eax, %edi
	je	.L14
	movslq	%ebx, %r12
.L15:
	addsd	(%rcx,%r12,8), %xmm0
.L14:
	leaq	.LC4(%rip), %rsi
	movl	$1, %edi
	movl	$1, %eax
	call	__printf_chk@PLT
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L32
	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
.L2:
	.cfi_restore_state
	movq	24(%rsp), %rdi
	movq	%r12, %rbx
	call	malloc@PLT
	movq	%rax, %rbp
.L29:
	movq	16(%rsp), %rax
	movsd	.LC3(%rip), %xmm0
	subsd	(%rax), %xmm0
	movhpd	(%rax), %xmm0
	movq	0(%rbp), %rax
	movups	%xmm0, (%rax)
	jmp	.L13
.L20:
	pxor	%xmm0, %xmm0
	jmp	.L14
.L21:
	pxor	%xmm0, %xmm0
	jmp	.L15
.L32:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE39:
	.size	main, .-main
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC3:
	.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
.LC1:
	.string	"%d"
.LC2:
	.string	"%lf"
.LC4:
	.string	"%.10lf\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	.LC1(%rip), %rdi
	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
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leaq	36(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movslq	36(%rsp), %r12
	leaq	0(,%r12,8), %rax
	movq	%rax, %rdi
	movq	%rax, 24(%rsp)
	call	malloc@PLT
	movq	%rax, 16(%rsp)
	testl	%r12d, %r12d
	jle	.L2
	movq	%rax, %r12
	xorl	%ebp, %ebp
	leaq	.LC2(%rip), %r13
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r12, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addl	$1, %ebp
	call	__isoc99_scanf@PLT
	movl	36(%rsp), %ebx
	addq	$8, %r12
	cmpl	%ebp, %ebx
	jg	.L3
	movslq	%ebx, %r12
	leaq	0(,%r12,8), %r15
	movq	%r15, %rdi
	movq	%r15, 24(%rsp)
	call	malloc@PLT
	movq	%rax, %rbp
	testl	%ebx, %ebx
	jle	.L29
	movq	%rax, %r14
	movl	%ebx, %eax
	addq	$16, %r15
	movq	%rbp, %r13
	leaq	0(%rbp,%rax,8), %rax
	movq	%rax, 8(%rsp)
	.p2align 4,,10
	.p2align 3
.L5:
	movq	%r15, %rdi
	addq	$8, %r13
	call	malloc@PLT
	movq	%rax, -8(%r13)
	cmpq	%r13, 8(%rsp)
	jne	.L5
	leaq	16(,%r12,8), %r15
	.p2align 4,,10
	.p2align 3
.L6:
	movq	(%r14), %rdi
	movq	%r15, %rdx
	xorl	%esi, %esi
	addq	$8, %r14
	call	memset@PLT
	cmpq	8(%rsp), %r14
	jne	.L6
	movq	16(%rsp), %rax
	movsd	.LC3(%rip), %xmm4
	movapd	%xmm4, %xmm0
	subsd	(%rax), %xmm0
	movhpd	(%rax), %xmm0
	movq	0(%rbp), %rax
	movups	%xmm0, (%rax)
	cmpl	$1, %ebx
	jle	.L13
	movl	$1, %ecx
	.p2align 4,,10
	.p2align 3
.L8:
	movq	16(%rsp), %rax
	movapd	%xmm4, %xmm2
	movq	-8(%rbp,%rcx,8), %rdx
	movq	0(%rbp,%rcx,8), %rsi
	movsd	(%rax,%rcx,8), %xmm3
	xorl	%eax, %eax
	subsd	%xmm3, %xmm2
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L9:
	movsd	-8(%rdx,%rax,8), %xmm1
	mulsd	(%rdx,%rax,8), %xmm0
	mulsd	%xmm3, %xmm1
	addsd	%xmm1, %xmm0
	movsd	%xmm0, (%rsi,%rax,8)
	cmpl	%ecx, %eax
	jg	.L11
.L10:
	addq	$1, %rax
.L12:
	movapd	%xmm2, %xmm0
	testq	%rax, %rax
	jne	.L9
	mulsd	(%rdx), %xmm0
	movsd	%xmm0, (%rsi)
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L11:
	addq	$1, %rcx
	cmpq	%rcx, %r12
	jne	.L8
.L13:
	movl	%ebx, %eax
	shrl	$31, %eax
	addl	%ebx, %eax
	sarl	%eax
	cmpl	%ebx, %eax
	jge	.L20
	movq	24(%rsp), %rdi
	movq	-8(%rbp,%rdi), %rcx
	movl	%ebx, %edi
	subl	%eax, %edi
	cmpl	$1, %edi
	je	.L21
	movl	%edi, %esi
	leaq	-8(%rcx,%r12,8), %rdx
	pxor	%xmm0, %xmm0
	shrl	%esi
	leaq	-16(%rdx), %rax
	leal	-1(%rsi), %r8d
	movq	%rax, %rsi
	salq	$4, %r8
	subq	%r8, %rsi
	jmp	.L16
	.p2align 4,,10
	.p2align 3
.L31:
	subq	$16, %rax
.L16:
	movupd	(%rdx), %xmm1
	movq	%rax, %rdx
	movapd	%xmm1, %xmm5
	unpckhpd	%xmm5, %xmm5
	addsd	%xmm5, %xmm0
	addsd	%xmm1, %xmm0
	cmpq	%rsi, %rax
	jne	.L31
	movl	%edi, %eax
	andl	$-2, %eax
	subl	%eax, %ebx
	cmpl	%eax, %edi
	je	.L14
	movslq	%ebx, %r12
.L15:
	addsd	(%rcx,%r12,8), %xmm0
.L14:
	leaq	.LC4(%rip), %rsi
	movl	$1, %edi
	movl	$1, %eax
	call	__printf_chk@PLT
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L32
	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
.L2:
	.cfi_restore_state
	movq	24(%rsp), %rdi
	movq	%r12, %rbx
	call	malloc@PLT
	movq	%rax, %rbp
.L29:
	movq	16(%rsp), %rax
	movsd	.LC3(%rip), %xmm0
	subsd	(%rax), %xmm0
	movhpd	(%rax), %xmm0
	movq	0(%rbp), %rax
	movups	%xmm0, (%rax)
	jmp	.L13
.L20:
	pxor	%xmm0, %xmm0
	jmp	.L14
.L21:
	pxor	%xmm0, %xmm0
	jmp	.L15
.L32:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE39:
	.size	main, .-main
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC3:
	.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:

# include <stdio.h>
# include <stdlib.h>
int main(){
	int i,n,j,k;
	double *arr,**ans,res=0;
	scanf ("%d",&n);
	arr=(double*)malloc(n*sizeof(double));
	for(i=0;i<n;i++) scanf ("%lf",&arr[i]);
	ans=(double**)malloc(n*sizeof(double*));
	for(i=0;i<n;i++) ans[i]=(double*)malloc((n+2)*sizeof(double));
	for(i=0;i<n;i++){
		for(j=0;j<n+2;j++) ans[i][j]=0;
	}
	ans[0][0]=1-arr[0];
	ans[0][1]=arr[0];
	for(i=1;i<n;i++){
    	for (j=0;j<i+2;j++){
        	if (j==0) ans[i][j]=ans[i-1][j]*(1-arr[i]);
        	else ans[i][j]=ans[i-1][j]*(1-arr[i])+ans[i-1][j-1]*arr[i];
        }
    }
    for(i=n;i>n/2;i--){
    	res+=ans[n-1][i];
	}
	printf ("%.10lf\n",res);
    return 0;	
}
5
1.024501914223776 0.01 0.42 0.99 0.42
 1
1.0727834824798
 3
0.5605093833878567 0.60 0.80
 5
1.024501914223776 0.01 0.5446982864891694 0.99 0.42
 1
1.4147366857390051
 3
0.63370309829039 0.60 0.80
 5
1.024501914223776 0.01 0.5446982864891694 1.8265871769248951 0.42
 1
1.7909231128005865
 3
1.2830063329674655 0.60 0.80
 5
1.024501914223776 0.01 1.1183883728508386 1.8265871769248951 0.42

0.6739324428
 1.0727834825
 0.7266241287
 0.7458182458
 1.4147366857
 0.7588293632
 1.1736606376
 1.7909231128
 1.0445227865
 1.5745054790

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>
int main(){
	int i,n,j,k;
	double *arr,**ans,res=0;
	scanf ("%d",&n);
	arr=(double*)malloc(n*sizeof(double));
	for(i=0;i<n;i++) scanf ("%lf",&arr[i]);
	ans=(double**)malloc(n*sizeof(double*));
	for(i=0;i<n;i++) ans[i]=(double*)malloc((n+2)*sizeof(double));
	for(i=0;i<n;i++){
		for(j=0;j<n+2;j++) ans[i][j]=0;
	}
	ans[0][0]=1-arr[0];
	ans[0][1]=arr[0];
	for(i=1;i<n;i++){
    	for (j=0;j<i+2;j++){
        	if (j==0) ans[i][j]=ans[i-1][j]*(1-arr[i]);
        	else ans[i][j]=ans[i-1][j]*(1-arr[i])+ans[i-1][j-1]*arr[i];
        }
    }
    for(i=n;i>n/2;i--){
    	res+=ans[n-1][i];
	}
	printf ("%.10lf\n",res);
    return 0;	
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC1:
	.string	"%d"
.LC2:
	.string	"%lf"
.LC4:
	.string	"%.10lf\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%rbx
	subq	$56, %rsp
	.cfi_offset 3, -24
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
	pxor	%xmm0, %xmm0
	movsd	%xmm0, -48(%rbp)
	leaq	-60(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-60(%rbp), %eax
	cltq
	salq	$3, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -40(%rbp)
	movl	$0, -56(%rbp)
	jmp	.L2
.L3:
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -56(%rbp)
.L2:
	movl	-60(%rbp), %eax
	cmpl	%eax, -56(%rbp)
	jl	.L3
	movl	-60(%rbp), %eax
	cltq
	salq	$3, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -32(%rbp)
	movl	$0, -56(%rbp)
	jmp	.L4
.L5:
	movl	-60(%rbp), %eax
	addl	$2, %eax
	cltq
	salq	$3, %rax
	movl	-56(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	movq	-32(%rbp), %rdx
	leaq	(%rcx,%rdx), %rbx
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, (%rbx)
	addl	$1, -56(%rbp)
.L4:
	movl	-60(%rbp), %eax
	cmpl	%eax, -56(%rbp)
	jl	.L5
	movl	$0, -56(%rbp)
	jmp	.L6
.L9:
	movl	$0, -52(%rbp)
	jmp	.L7
.L8:
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-52(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	pxor	%xmm0, %xmm0
	movsd	%xmm0, (%rax)
	addl	$1, -52(%rbp)
.L7:
	movl	-60(%rbp), %eax
	addl	$1, %eax
	cmpl	%eax, -52(%rbp)
	jle	.L8
	addl	$1, -56(%rbp)
.L6:
	movl	-60(%rbp), %eax
	cmpl	%eax, -56(%rbp)
	jl	.L9
	movq	-40(%rbp), %rax
	movsd	(%rax), %xmm1
	movq	-32(%rbp), %rax
	movq	(%rax), %rax
	movsd	.LC3(%rip), %xmm0
	subsd	%xmm1, %xmm0
	movsd	%xmm0, (%rax)
	movq	-32(%rbp), %rax
	movq	(%rax), %rax
	leaq	8(%rax), %rdx
	movq	-40(%rbp), %rax
	movsd	(%rax), %xmm0
	movsd	%xmm0, (%rdx)
	movl	$1, -56(%rbp)
	jmp	.L10
.L15:
	movl	$0, -52(%rbp)
	jmp	.L11
.L14:
	cmpl	$0, -52(%rbp)
	jne	.L12
	movl	-56(%rbp), %eax
	cltq
	salq	$3, %rax
	leaq	-8(%rax), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-52(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	movsd	(%rax), %xmm1
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movsd	(%rax), %xmm2
	movsd	.LC3(%rip), %xmm0
	subsd	%xmm2, %xmm0
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-52(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	mulsd	%xmm1, %xmm0
	movsd	%xmm0, (%rax)
	jmp	.L13
.L12:
	movl	-56(%rbp), %eax
	cltq
	salq	$3, %rax
	leaq	-8(%rax), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-52(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	movsd	(%rax), %xmm1
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movsd	(%rax), %xmm2
	movsd	.LC3(%rip), %xmm0
	subsd	%xmm2, %xmm0
	mulsd	%xmm0, %xmm1
	movl	-56(%rbp), %eax
	cltq
	salq	$3, %rax
	leaq	-8(%rax), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-52(%rbp), %eax
	cltq
	salq	$3, %rax
	subq	$8, %rax
	addq	%rdx, %rax
	movsd	(%rax), %xmm2
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movsd	(%rax), %xmm0
	mulsd	%xmm2, %xmm0
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-52(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	addsd	%xmm1, %xmm0
	movsd	%xmm0, (%rax)
.L13:
	addl	$1, -52(%rbp)
.L11:
	movl	-56(%rbp), %eax
	addl	$1, %eax
	cmpl	%eax, -52(%rbp)
	jle	.L14
	addl	$1, -56(%rbp)
.L10:
	movl	-60(%rbp), %eax
	cmpl	%eax, -56(%rbp)
	jl	.L15
	movl	-60(%rbp), %eax
	movl	%eax, -56(%rbp)
	jmp	.L16
.L17:
	movl	-60(%rbp), %eax
	cltq
	salq	$3, %rax
	leaq	-8(%rax), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-56(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	movsd	(%rax), %xmm0
	movsd	-48(%rbp), %xmm1
	addsd	%xmm1, %xmm0
	movsd	%xmm0, -48(%rbp)
	subl	$1, -56(%rbp)
.L16:
	movl	-60(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	cmpl	%eax, -56(%rbp)
	jg	.L17
	movq	-48(%rbp), %rax
	movq	%rax, %xmm0
	leaq	.LC4(%rip), %rax
	movq	%rax, %rdi
	movl	$1, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-24(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L19
	call	__stack_chk_fail@PLT
.L19:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	main, .-main
	.section	.rodata
	.align 8
.LC3:
	.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:
```

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	"%d"
.LC2:
	.string	"%lf"
.LC4:
	.string	"%.10lf\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%rbx
	subq	$56, %rsp
	.cfi_offset 3, -24
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
	pxor	%xmm0, %xmm0
	movsd	%xmm0, -48(%rbp)
	leaq	-60(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-60(%rbp), %eax
	cltq
	salq	$3, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -40(%rbp)
	movl	$0, -56(%rbp)
	jmp	.L2
.L3:
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -56(%rbp)
.L2:
	movl	-60(%rbp), %eax
	cmpl	%eax, -56(%rbp)
	jl	.L3
	movl	-60(%rbp), %eax
	cltq
	salq	$3, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -32(%rbp)
	movl	$0, -56(%rbp)
	jmp	.L4
.L5:
	movl	-60(%rbp), %eax
	addl	$2, %eax
	cltq
	salq	$3, %rax
	movl	-56(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	movq	-32(%rbp), %rdx
	leaq	(%rcx,%rdx), %rbx
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, (%rbx)
	addl	$1, -56(%rbp)
.L4:
	movl	-60(%rbp), %eax
	cmpl	%eax, -56(%rbp)
	jl	.L5
	movl	$0, -56(%rbp)
	jmp	.L6
.L9:
	movl	$0, -52(%rbp)
	jmp	.L7
.L8:
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-52(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	pxor	%xmm0, %xmm0
	movsd	%xmm0, (%rax)
	addl	$1, -52(%rbp)
.L7:
	movl	-60(%rbp), %eax
	addl	$1, %eax
	cmpl	%eax, -52(%rbp)
	jle	.L8
	addl	$1, -56(%rbp)
.L6:
	movl	-60(%rbp), %eax
	cmpl	%eax, -56(%rbp)
	jl	.L9
	movq	-40(%rbp), %rax
	movsd	(%rax), %xmm1
	movq	-32(%rbp), %rax
	movq	(%rax), %rax
	movsd	.LC3(%rip), %xmm0
	subsd	%xmm1, %xmm0
	movsd	%xmm0, (%rax)
	movq	-32(%rbp), %rax
	movq	(%rax), %rax
	leaq	8(%rax), %rdx
	movq	-40(%rbp), %rax
	movsd	(%rax), %xmm0
	movsd	%xmm0, (%rdx)
	movl	$1, -56(%rbp)
	jmp	.L10
.L15:
	movl	$0, -52(%rbp)
	jmp	.L11
.L14:
	cmpl	$0, -52(%rbp)
	jne	.L12
	movl	-56(%rbp), %eax
	cltq
	salq	$3, %rax
	leaq	-8(%rax), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-52(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	movsd	(%rax), %xmm1
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movsd	(%rax), %xmm2
	movsd	.LC3(%rip), %xmm0
	subsd	%xmm2, %xmm0
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-52(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	mulsd	%xmm1, %xmm0
	movsd	%xmm0, (%rax)
	jmp	.L13
.L12:
	movl	-56(%rbp), %eax
	cltq
	salq	$3, %rax
	leaq	-8(%rax), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-52(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	movsd	(%rax), %xmm1
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movsd	(%rax), %xmm2
	movsd	.LC3(%rip), %xmm0
	subsd	%xmm2, %xmm0
	mulsd	%xmm0, %xmm1
	movl	-56(%rbp), %eax
	cltq
	salq	$3, %rax
	leaq	-8(%rax), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-52(%rbp), %eax
	cltq
	salq	$3, %rax
	subq	$8, %rax
	addq	%rdx, %rax
	movsd	(%rax), %xmm2
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movsd	(%rax), %xmm0
	mulsd	%xmm2, %xmm0
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-52(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	addsd	%xmm1, %xmm0
	movsd	%xmm0, (%rax)
.L13:
	addl	$1, -52(%rbp)
.L11:
	movl	-56(%rbp), %eax
	addl	$1, %eax
	cmpl	%eax, -52(%rbp)
	jle	.L14
	addl	$1, -56(%rbp)
.L10:
	movl	-60(%rbp), %eax
	cmpl	%eax, -56(%rbp)
	jl	.L15
	movl	-60(%rbp), %eax
	movl	%eax, -56(%rbp)
	jmp	.L16
.L17:
	movl	-60(%rbp), %eax
	cltq
	salq	$3, %rax
	leaq	-8(%rax), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-56(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	movsd	(%rax), %xmm0
	movsd	-48(%rbp), %xmm1
	addsd	%xmm1, %xmm0
	movsd	%xmm0, -48(%rbp)
	subl	$1, -56(%rbp)
.L16:
	movl	-60(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	cmpl	%eax, -56(%rbp)
	jg	.L17
	movq	-48(%rbp), %rax
	movq	%rax, %xmm0
	leaq	.LC4(%rip), %rax
	movq	%rax, %rdi
	movl	$1, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-24(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L19
	call	__stack_chk_fail@PLT
.L19:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	main, .-main
	.section	.rodata
	.align 8
.LC3:
	.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:
