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

```c
// AOJ 2139: Memory Match
// 2017.11.13

#include <stdio.h>
#include <string.h>

double m[1001][1001];
char f[1001][1001];

double calc(int unopen, int known)
{
	double u, k, r;
	
	if (unopen == known) { f[unopen][known] = 1; return 0; }
	if (f[unopen][known]) return m[unopen][known];

	u = unopen, k = known, r = 0;
	if (known > 0) r += (k/u) * calc(unopen-1, known-1);
	r += ((u-k)/u) * (1.0/(u-1)) * calc(unopen-2, known);
	if (known > 0) r += ((u-k)/u)*(k/(u-1)) * (calc(unopen-2, known)+1);
	if (unopen - known > 2) r += ((u-k)/u)*((u-k-2)/(u-1)) * (calc(unopen-2, known+2)+1);

	f[unopen][known] = 1;
	m[unopen][known] = r;
	return r;
}

int main()
{
	int n;
	
	memset(f[0], 1, sizeof(f[0]));
	while (scanf("%d", &n) && n > 0) printf("%.10lf\n", calc(n, 0));
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	m
	.bss
	.align 32
	.type	m, @object
	.size	m, 8016008
m:
	.zero	8016008
	.globl	f
	.align 32
	.type	f, @object
	.size	f, 1002001
f:
	.zero	1002001
	.text
	.globl	calc
	.type	calc, @function
calc:
.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
	movl	%edi, -36(%rbp)
	movl	%esi, -40(%rbp)
	movl	-36(%rbp), %eax
	cmpl	-40(%rbp), %eax
	jne	.L2
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	movl	-36(%rbp), %eax
	cltq
	imulq	$1001, %rax, %rax
	addq	%rax, %rdx
	leaq	f(%rip), %rax
	addq	%rdx, %rax
	movb	$1, (%rax)
	pxor	%xmm0, %xmm0
	jmp	.L3
.L2:
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	movl	-36(%rbp), %eax
	cltq
	imulq	$1001, %rax, %rax
	addq	%rax, %rdx
	leaq	f(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	testb	%al, %al
	je	.L4
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	movl	-36(%rbp), %eax
	cltq
	imulq	$1001, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	m(%rip), %rax
	movsd	(%rdx,%rax), %xmm0
	jmp	.L3
.L4:
	pxor	%xmm0, %xmm0
	cvtsi2sdl	-36(%rbp), %xmm0
	movsd	%xmm0, -16(%rbp)
	pxor	%xmm0, %xmm0
	cvtsi2sdl	-40(%rbp), %xmm0
	movsd	%xmm0, -8(%rbp)
	pxor	%xmm0, %xmm0
	movsd	%xmm0, -24(%rbp)
	cmpl	$0, -40(%rbp)
	jle	.L5
	movsd	-8(%rbp), %xmm0
	divsd	-16(%rbp), %xmm0
	movsd	%xmm0, -48(%rbp)
	movl	-40(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-36(%rbp), %eax
	subl	$1, %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	calc
	mulsd	-48(%rbp), %xmm0
	movsd	-24(%rbp), %xmm1
	addsd	%xmm1, %xmm0
	movsd	%xmm0, -24(%rbp)
.L5:
	movsd	-16(%rbp), %xmm0
	subsd	-8(%rbp), %xmm0
	movapd	%xmm0, %xmm1
	divsd	-16(%rbp), %xmm1
	movsd	-16(%rbp), %xmm0
	movsd	.LC1(%rip), %xmm3
	movapd	%xmm0, %xmm2
	subsd	%xmm3, %xmm2
	movsd	.LC1(%rip), %xmm0
	divsd	%xmm2, %xmm0
	mulsd	%xmm0, %xmm1
	movsd	%xmm1, -48(%rbp)
	movl	-36(%rbp), %eax
	leal	-2(%rax), %edx
	movl	-40(%rbp), %eax
	movl	%eax, %esi
	movl	%edx, %edi
	call	calc
	mulsd	-48(%rbp), %xmm0
	movsd	-24(%rbp), %xmm1
	addsd	%xmm1, %xmm0
	movsd	%xmm0, -24(%rbp)
	cmpl	$0, -40(%rbp)
	jle	.L6
	movsd	-16(%rbp), %xmm0
	subsd	-8(%rbp), %xmm0
	movapd	%xmm0, %xmm1
	divsd	-16(%rbp), %xmm1
	movsd	-16(%rbp), %xmm0
	movsd	.LC1(%rip), %xmm3
	movapd	%xmm0, %xmm2
	subsd	%xmm3, %xmm2
	movsd	-8(%rbp), %xmm0
	divsd	%xmm2, %xmm0
	mulsd	%xmm0, %xmm1
	movsd	%xmm1, -48(%rbp)
	movl	-36(%rbp), %eax
	leal	-2(%rax), %edx
	movl	-40(%rbp), %eax
	movl	%eax, %esi
	movl	%edx, %edi
	call	calc
	movsd	.LC1(%rip), %xmm1
	addsd	%xmm1, %xmm0
	mulsd	-48(%rbp), %xmm0
	movsd	-24(%rbp), %xmm1
	addsd	%xmm1, %xmm0
	movsd	%xmm0, -24(%rbp)
.L6:
	movl	-36(%rbp), %eax
	subl	-40(%rbp), %eax
	cmpl	$2, %eax
	jle	.L7
	movsd	-16(%rbp), %xmm0
	subsd	-8(%rbp), %xmm0
	movapd	%xmm0, %xmm2
	divsd	-16(%rbp), %xmm2
	movsd	-16(%rbp), %xmm0
	subsd	-8(%rbp), %xmm0
	movsd	.LC2(%rip), %xmm1
	subsd	%xmm1, %xmm0
	movsd	-16(%rbp), %xmm1
	movsd	.LC1(%rip), %xmm3
	subsd	%xmm3, %xmm1
	divsd	%xmm1, %xmm0
	mulsd	%xmm0, %xmm2
	movsd	%xmm2, -48(%rbp)
	movl	-40(%rbp), %eax
	leal	2(%rax), %edx
	movl	-36(%rbp), %eax
	subl	$2, %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	calc
	movsd	.LC1(%rip), %xmm1
	addsd	%xmm1, %xmm0
	mulsd	-48(%rbp), %xmm0
	movsd	-24(%rbp), %xmm1
	addsd	%xmm1, %xmm0
	movsd	%xmm0, -24(%rbp)
.L7:
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	movl	-36(%rbp), %eax
	cltq
	imulq	$1001, %rax, %rax
	addq	%rax, %rdx
	leaq	f(%rip), %rax
	addq	%rdx, %rax
	movb	$1, (%rax)
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	movl	-36(%rbp), %eax
	cltq
	imulq	$1001, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	m(%rip), %rax
	movsd	-24(%rbp), %xmm0
	movsd	%xmm0, (%rdx,%rax)
	movsd	-24(%rbp), %xmm0
.L3:
	movq	%xmm0, %rax
	movq	%rax, %xmm0
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	calc, .-calc
	.section	.rodata
.LC3:
	.string	"%.10lf\n"
.LC4:
	.string	"%d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$1001, %edx
	movl	$1, %esi
	leaq	f(%rip), %rax
	movq	%rax, %rdi
	call	memset@PLT
	jmp	.L9
.L11:
	movl	-12(%rbp), %eax
	movl	$0, %esi
	movl	%eax, %edi
	call	calc
	movq	%xmm0, %rax
	movq	%rax, %xmm0
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$1, %eax
	call	printf@PLT
.L9:
	leaq	-12(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC4(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	testl	%eax, %eax
	je	.L10
	movl	-12(%rbp), %eax
	testl	%eax, %eax
	jg	.L11
.L10:
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L13
	call	__stack_chk_fail@PLT
.L13:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	main, .-main
	.section	.rodata
	.align 8
.LC1:
	.long	0
	.long	1072693248
	.align 8
.LC2:
	.long	0
	.long	1073741824
	.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
	.type	calc.part.0, @function
calc.part.0:
.LFB37:
	.cfi_startproc
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pxor	%xmm3, %xmm3
	pxor	%xmm6, %xmm6
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	cvtsi2sdl	%esi, %xmm6
	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
	movl	%esi, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movslq	%edi, %rbx
	cvtsi2sdl	%ebx, %xmm3
	subq	$72, %rsp
	.cfi_def_cfa_offset 128
	testl	%esi, %esi
	jg	.L26
	pxor	%xmm7, %xmm7
	leaq	f(%rip), %r12
	leaq	m(%rip), %r15
	movapd	%xmm7, %xmm1
.L2:
	movapd	%xmm3, %xmm4
	movsd	.LC1(%rip), %xmm2
	leal	-2(%rbx), %edi
	movslq	%ebp, %r13
	subsd	%xmm6, %xmm4
	movapd	%xmm4, %xmm5
	divsd	%xmm3, %xmm5
	subsd	.LC1(%rip), %xmm3
	divsd	%xmm3, %xmm2
	mulsd	%xmm5, %xmm2
	cmpl	%edi, %ebp
	je	.L27
	movslq	%edi, %r14
	imulq	$1001, %r14, %r14
	leaq	(%r12,%r14), %rax
	addq	%r13, %rax
	cmpb	$0, (%rax)
	jne	.L28
	movl	%ebp, %esi
	movl	%edi, (%rsp)
	movsd	%xmm2, 40(%rsp)
	movsd	%xmm3, 32(%rsp)
	movsd	%xmm5, 24(%rsp)
	movsd	%xmm4, 16(%rsp)
	movsd	%xmm1, 8(%rsp)
	movq	%rax, 56(%rsp)
	movsd	%xmm6, 48(%rsp)
	call	calc.part.0
	movsd	40(%rsp), %xmm2
	testl	%ebp, %ebp
	movl	(%rsp), %edi
	movsd	8(%rsp), %xmm1
	movsd	16(%rsp), %xmm4
	mulsd	%xmm0, %xmm2
	movsd	24(%rsp), %xmm5
	movsd	32(%rsp), %xmm3
	addsd	%xmm2, %xmm1
	jg	.L29
.L8:
	movl	%ebx, %eax
	subl	%ebp, %eax
	cmpl	$2, %eax
	jg	.L30
.L13:
	imulq	$1001, %rbx, %rbx
	movapd	%xmm1, %xmm0
	addq	%rbx, %r12
	addq	%r13, %rbx
	movb	$1, (%r12,%r13)
	movsd	%xmm1, (%r15,%rbx,8)
	addq	$72, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	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
.L29:
	.cfi_restore_state
	movsd	48(%rsp), %xmm6
	movq	56(%rsp), %rax
	divsd	%xmm3, %xmm6
	cmpb	$0, (%rax)
	movapd	%xmm6, %xmm2
	mulsd	%xmm5, %xmm2
	jne	.L31
	movl	%ebp, %esi
	movl	%edi, (%rsp)
	movsd	%xmm1, 40(%rsp)
	movsd	%xmm2, 32(%rsp)
	movsd	%xmm3, 24(%rsp)
	movsd	%xmm5, 16(%rsp)
	movsd	%xmm4, 8(%rsp)
	call	calc.part.0
	addsd	.LC1(%rip), %xmm0
	movl	(%rsp), %edi
	movsd	32(%rsp), %xmm2
	movsd	40(%rsp), %xmm1
	movsd	24(%rsp), %xmm3
	movsd	16(%rsp), %xmm5
	mulsd	%xmm2, %xmm0
	movsd	8(%rsp), %xmm4
.L12:
	movl	%ebx, %eax
	addsd	%xmm0, %xmm1
	subl	%ebp, %eax
	cmpl	$2, %eax
	jle	.L13
.L30:
	subsd	.LC2(%rip), %xmm4
	leal	2(%rbp), %esi
	divsd	%xmm3, %xmm4
	mulsd	%xmm5, %xmm4
	cmpl	%esi, %edi
	je	.L32
	movslq	%edi, %rax
	movslq	%esi, %rdx
	imulq	$1001, %rax, %rax
	leaq	(%r12,%rax), %rcx
	cmpb	$0, (%rcx,%rdx)
	jne	.L33
	movsd	%xmm1, 8(%rsp)
	movsd	%xmm4, (%rsp)
	call	calc.part.0
	movsd	(%rsp), %xmm4
	addsd	.LC1(%rip), %xmm0
	movsd	8(%rsp), %xmm1
	mulsd	%xmm0, %xmm4
.L15:
	addsd	%xmm4, %xmm1
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L26:
	movapd	%xmm6, %xmm1
	leal	-1(%rsi), %esi
	leal	-1(%rbx), %edi
	divsd	%xmm3, %xmm1
	leaq	f(%rip), %r12
	cmpl	%ebp, %ebx
	je	.L34
	movslq	%edi, %rax
	movslq	%esi, %rdx
	imulq	$1001, %rax, %rax
	leaq	(%r12,%rax), %rcx
	cmpb	$0, (%rcx,%rdx)
	jne	.L35
	movsd	%xmm1, 16(%rsp)
	leaq	m(%rip), %r15
	movsd	%xmm6, 8(%rsp)
	movsd	%xmm3, (%rsp)
	call	calc.part.0
	movsd	16(%rsp), %xmm1
	movsd	8(%rsp), %xmm6
	pxor	%xmm7, %xmm7
	movsd	(%rsp), %xmm3
.L4:
	mulsd	%xmm0, %xmm1
	addsd	%xmm7, %xmm1
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L28:
	addq	%r13, %r14
	movsd	(%r15,%r14,8), %xmm7
	mulsd	%xmm7, %xmm2
	addsd	%xmm2, %xmm1
	testl	%ebp, %ebp
	jle	.L8
	divsd	%xmm3, %xmm6
	movapd	%xmm6, %xmm2
	mulsd	%xmm5, %xmm2
.L19:
	addsd	.LC1(%rip), %xmm7
	mulsd	%xmm2, %xmm7
	movapd	%xmm7, %xmm0
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L27:
	mulsd	%xmm7, %xmm2
	imulq	$1002, %r13, %rax
	movb	$1, (%r12,%rax)
	addsd	%xmm2, %xmm1
	testl	%ebp, %ebp
	jle	.L8
	divsd	%xmm3, %xmm6
	movapd	%xmm6, %xmm0
	mulsd	%xmm5, %xmm0
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L33:
	addq	%rdx, %rax
	movsd	.LC1(%rip), %xmm0
	addsd	(%r15,%rax,8), %xmm0
	mulsd	%xmm0, %xmm4
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L35:
	leaq	m(%rip), %r15
	addq	%rdx, %rax
	pxor	%xmm7, %xmm7
	movsd	(%r15,%rax,8), %xmm0
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L34:
	movslq	%edi, %rdi
	movslq	%esi, %rsi
	pxor	%xmm7, %xmm7
	imulq	$1001, %rdi, %rdi
	movapd	%xmm7, %xmm0
	leaq	m(%rip), %r15
	addq	%r12, %rdi
	movb	$1, (%rdi,%rsi)
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L32:
	movslq	%edi, %rdi
	imulq	$1002, %rdi, %rdi
	movb	$1, (%r12,%rdi)
	jmp	.L15
.L31:
	addq	%r13, %r14
	movsd	(%r15,%r14,8), %xmm7
	jmp	.L19
	.cfi_endproc
.LFE37:
	.size	calc.part.0, .-calc.part.0
	.p2align 4
	.globl	calc
	.type	calc, @function
calc:
.LFB35:
	.cfi_startproc
	endbr64
	cmpl	%esi, %edi
	je	.L40
	movslq	%edi, %rax
	leaq	f(%rip), %rdx
	movslq	%esi, %rcx
	imulq	$1001, %rax, %rax
	addq	%rax, %rdx
	cmpb	$0, (%rdx,%rcx)
	jne	.L41
	jmp	calc.part.0
	.p2align 4,,10
	.p2align 3
.L41:
	addq	%rcx, %rax
	leaq	m(%rip), %rdx
	movsd	(%rdx,%rax,8), %xmm0
	ret
	.p2align 4,,10
	.p2align 3
.L40:
	movslq	%edi, %rdi
	leaq	f(%rip), %rax
	pxor	%xmm0, %xmm0
	imulq	$1002, %rdi, %rdi
	movb	$1, (%rax,%rdi)
	ret
	.cfi_endproc
.LFE35:
	.size	calc, .-calc
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC3:
	.string	"%.10lf\n"
.LC4:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB36:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movl	$125, %ecx
	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	.LC4(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	f(%rip), %rbx
	movq	%rbx, %rdi
	subq	$136, %rsp
	.cfi_def_cfa_offset 192
	movq	%fs:40, %rax
	movq	%rax, 120(%rsp)
	xorl	%eax, %eax
	leaq	116(%rsp), %r12
	movabsq	$72340172838076673, %rax
	rep stosq
	movb	$1, (%rdi)
	.p2align 4,,10
	.p2align 3
.L43:
	xorl	%eax, %eax
	movq	%r12, %rsi
	movq	%rbp, %rdi
	call	__isoc99_scanf@PLT
	testl	%eax, %eax
	je	.L74
	movl	116(%rsp), %r8d
	testl	%r8d, %r8d
	jle	.L74
	movslq	%r8d, %r9
	imulq	$1001, %r9, %rax
	cmpb	$0, (%rbx,%rax)
	jne	.L81
	pxor	%xmm9, %xmm9
	movl	%r8d, %r13d
	movsd	.LC1(%rip), %xmm8
	cvtsi2sdl	%r8d, %xmm9
	movapd	%xmm9, %xmm3
	subsd	.LC1(%rip), %xmm3
	movapd	%xmm9, %xmm15
	divsd	%xmm9, %xmm15
	divsd	%xmm3, %xmm8
	mulsd	%xmm15, %xmm8
	subl	$2, %r13d
	je	.L82
	movslq	%r13d, %r11
	imulq	$1001, %r11, %rax
	cmpb	$0, (%rbx,%rax)
	jne	.L83
	pxor	%xmm12, %xmm12
	movl	%r8d, %r15d
	movsd	.LC1(%rip), %xmm11
	cvtsi2sdl	%r13d, %xmm12
	movapd	%xmm12, %xmm6
	subsd	.LC1(%rip), %xmm6
	movapd	%xmm12, %xmm4
	divsd	%xmm12, %xmm4
	divsd	%xmm6, %xmm11
	mulsd	%xmm4, %xmm11
	subl	$4, %r15d
	je	.L84
	movslq	%r15d, %r14
	imulq	$1001, %r14, %rax
	cmpb	$0, (%rbx,%rax)
	jne	.L85
	movsd	.LC1(%rip), %xmm13
	pxor	%xmm1, %xmm1
	movl	%r8d, %edx
	cvtsi2sdl	%r15d, %xmm1
	movapd	%xmm1, %xmm7
	subsd	.LC1(%rip), %xmm7
	movapd	%xmm1, %xmm2
	divsd	%xmm1, %xmm2
	divsd	%xmm7, %xmm13
	movsd	%xmm2, 8(%rsp)
	mulsd	%xmm2, %xmm13
	subl	$6, %edx
	je	.L86
	movslq	%edx, %rax
	imulq	$1001, %rax, %rcx
	cmpb	$0, (%rbx,%rcx)
	jne	.L87
	pxor	%xmm5, %xmm5
	movl	%r8d, %edi
	cvtsi2sdl	%edx, %xmm5
	movapd	%xmm5, %xmm2
	subsd	.LC1(%rip), %xmm2
	movapd	%xmm5, %xmm0
	divsd	%xmm5, %xmm0
	movapd	%xmm2, %xmm14
	movsd	%xmm2, 24(%rsp)
	movsd	.LC1(%rip), %xmm2
	divsd	%xmm14, %xmm2
	movsd	%xmm0, 16(%rsp)
	mulsd	%xmm0, %xmm2
	movapd	%xmm2, %xmm14
	subl	$8, %edi
	je	.L88
	movslq	%edi, %rcx
	imulq	$1001, %rcx, %rsi
	cmpb	$0, (%rbx,%rsi)
	jne	.L89
	xorl	%esi, %esi
	movq	%rcx, 104(%rsp)
	leaq	m(%rip), %r10
	movq	%rax, 96(%rsp)
	movl	%edx, 84(%rsp)
	movl	%edi, 32(%rsp)
	movsd	%xmm5, 88(%rsp)
	movsd	%xmm7, 72(%rsp)
	movsd	%xmm1, 64(%rsp)
	movsd	%xmm6, 56(%rsp)
	movsd	%xmm4, 48(%rsp)
	movsd	%xmm3, 40(%rsp)
	call	calc.part.0
	movq	104(%rsp), %rcx
	movq	96(%rsp), %rax
	movsd	88(%rsp), %xmm5
	movl	84(%rsp), %edx
	movapd	%xmm0, %xmm2
	movsd	72(%rsp), %xmm7
	movsd	64(%rsp), %xmm1
	movsd	56(%rsp), %xmm6
	movsd	48(%rsp), %xmm4
	movsd	40(%rsp), %xmm3
	movl	32(%rsp), %edi
.L61:
	mulsd	%xmm14, %xmm2
	pxor	%xmm14, %xmm14
	pxor	%xmm10, %xmm10
	addsd	%xmm2, %xmm14
	cmpl	$2, %edx
	jg	.L90
.L59:
	imulq	$1001, %rax, %rcx
	movb	$1, (%rbx,%rcx)
	imulq	$8008, %rax, %rcx
	movsd	%xmm14, (%r10,%rcx)
.L57:
	mulsd	%xmm14, %xmm13
	addsd	%xmm10, %xmm13
	cmpl	$2, %r15d
	jg	.L91
.L55:
	imulq	$1001, %r14, %rax
	mulsd	%xmm13, %xmm11
	movb	$1, (%rbx,%rax)
	imulq	$8008, %r14, %rax
	addsd	%xmm10, %xmm11
	movsd	%xmm13, (%r10,%rax)
	cmpl	$2, %r13d
	jle	.L51
.L98:
	subsd	.LC2(%rip), %xmm12
	divsd	%xmm6, %xmm12
	mulsd	%xmm4, %xmm12
	cmpl	$2, %r15d
	je	.L92
	imulq	$1001, %r14, %rax
	cmpb	$0, 2(%rbx,%rax)
	jne	.L93
	movl	$2, %esi
	movl	%r15d, %edi
	movsd	%xmm3, 8(%rsp)
	call	calc.part.0
	movsd	8(%rsp), %xmm3
.L69:
	addsd	.LC1(%rip), %xmm0
	mulsd	%xmm12, %xmm0
	addsd	%xmm0, %xmm11
	jmp	.L51
	.p2align 4,,10
	.p2align 3
.L81:
	imulq	$8008, %r9, %r9
	leaq	m(%rip), %r10
	movsd	(%r10,%r9), %xmm8
.L45:
	movapd	%xmm8, %xmm0
	movl	$1, %edi
	movl	$1, %eax
	leaq	.LC3(%rip), %rsi
	call	__printf_chk@PLT
	jmp	.L43
	.p2align 4,,10
	.p2align 3
.L83:
	imulq	$8008, %r11, %rax
	leaq	m(%rip), %r10
	pxor	%xmm10, %xmm10
	movsd	(%r10,%rax), %xmm11
.L49:
	mulsd	%xmm11, %xmm8
	addsd	%xmm10, %xmm8
	cmpl	$2, %r8d
	jg	.L94
.L47:
	imulq	$1001, %r9, %rax
	imulq	$8008, %r9, %r9
	movb	$1, (%rbx,%rax)
	movsd	%xmm8, (%r10,%r9)
	jmp	.L45
	.p2align 4,,10
	.p2align 3
.L94:
	subsd	.LC2(%rip), %xmm9
	divsd	%xmm3, %xmm9
	mulsd	%xmm15, %xmm9
	cmpl	$2, %r13d
	je	.L95
	imulq	$1001, %r11, %rax
	cmpb	$0, 2(%rbx,%rax)
	jne	.L96
	movl	$2, %esi
	movl	%r13d, %edi
	call	calc.part.0
	movapd	%xmm0, %xmm10
.L72:
	addsd	.LC1(%rip), %xmm10
	mulsd	%xmm9, %xmm10
	addsd	%xmm10, %xmm8
	jmp	.L47
	.p2align 4,,10
	.p2align 3
.L74:
	movq	120(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L97
	addq	$136, %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
.L82:
	.cfi_restore_state
	pxor	%xmm10, %xmm10
	movb	$1, f(%rip)
	leaq	m(%rip), %r10
	mulsd	%xmm10, %xmm8
	addsd	%xmm10, %xmm8
	jmp	.L47
.L85:
	imulq	$8008, %r14, %rax
	leaq	m(%rip), %r10
	pxor	%xmm10, %xmm10
	movsd	(%r10,%rax), %xmm13
	mulsd	%xmm13, %xmm11
	addsd	%xmm10, %xmm11
	cmpl	$2, %r13d
	jg	.L98
	.p2align 4,,10
	.p2align 3
.L51:
	imulq	$1001, %r11, %rax
	movb	$1, (%rbx,%rax)
	imulq	$8008, %r11, %rax
	movsd	%xmm11, (%r10,%rax)
	jmp	.L49
.L93:
	imulq	$8008, %r14, %r14
	movsd	16(%r10,%r14), %xmm0
	jmp	.L69
.L84:
	pxor	%xmm10, %xmm10
	movb	$1, f(%rip)
	leaq	m(%rip), %r10
	mulsd	%xmm10, %xmm11
	addsd	%xmm10, %xmm11
	jmp	.L51
.L91:
	subsd	.LC2(%rip), %xmm1
	movsd	8(%rsp), %xmm14
	divsd	%xmm7, %xmm1
	mulsd	%xmm1, %xmm14
	cmpl	$2, %edx
	je	.L99
	imulq	$1001, %rax, %rcx
	cmpb	$0, 2(%rbx,%rcx)
	jne	.L100
	movl	$2, %esi
	movl	%edx, %edi
	movsd	%xmm6, 24(%rsp)
	movsd	%xmm4, 16(%rsp)
	movsd	%xmm3, 8(%rsp)
	call	calc.part.0
	movsd	24(%rsp), %xmm6
	movsd	16(%rsp), %xmm4
	movsd	8(%rsp), %xmm3
.L66:
	addsd	.LC1(%rip), %xmm0
	mulsd	%xmm14, %xmm0
	addsd	%xmm0, %xmm13
	jmp	.L55
.L96:
	imulq	$8008, %r11, %rax
	movsd	16(%r10,%rax), %xmm10
	jmp	.L72
.L87:
	imulq	$8008, %rax, %rcx
	leaq	m(%rip), %r10
	pxor	%xmm10, %xmm10
	movsd	(%r10,%rcx), %xmm14
	jmp	.L57
.L95:
	movb	$1, 2004+f(%rip)
	jmp	.L72
.L86:
	pxor	%xmm10, %xmm10
	movb	$1, f(%rip)
	leaq	m(%rip), %r10
	mulsd	%xmm10, %xmm13
	addsd	%xmm10, %xmm13
	jmp	.L55
.L90:
	subsd	.LC2(%rip), %xmm5
	divsd	24(%rsp), %xmm5
	mulsd	16(%rsp), %xmm5
	cmpl	$2, %edi
	je	.L101
	imulq	$1001, %rcx, %rsi
	cmpb	$0, 2(%rbx,%rsi)
	jne	.L102
	movl	$2, %esi
	movq	%rax, 72(%rsp)
	movl	%edx, 56(%rsp)
	movsd	%xmm5, 64(%rsp)
	movsd	%xmm7, 48(%rsp)
	movsd	%xmm1, 40(%rsp)
	movsd	%xmm6, 32(%rsp)
	movsd	%xmm4, 24(%rsp)
	movsd	%xmm3, 16(%rsp)
	call	calc.part.0
	movq	72(%rsp), %rax
	movl	56(%rsp), %edx
	movsd	64(%rsp), %xmm5
	movsd	48(%rsp), %xmm7
	movsd	40(%rsp), %xmm1
	movsd	32(%rsp), %xmm6
	movsd	24(%rsp), %xmm4
	movsd	16(%rsp), %xmm3
.L63:
	addsd	.LC1(%rip), %xmm0
	mulsd	%xmm5, %xmm0
	addsd	%xmm0, %xmm14
	jmp	.L59
.L88:
	pxor	%xmm10, %xmm10
	movb	$1, f(%rip)
	leaq	m(%rip), %r10
	mulsd	%xmm10, %xmm2
	addsd	%xmm10, %xmm2
	movapd	%xmm2, %xmm14
	jmp	.L59
.L89:
	imulq	$8008, %rcx, %rsi
	leaq	m(%rip), %r10
	movsd	(%r10,%rsi), %xmm2
	jmp	.L61
.L92:
	movb	$1, 2004+f(%rip)
	movapd	%xmm10, %xmm0
	jmp	.L69
.L100:
	imulq	$8008, %rax, %rax
	movsd	16(%r10,%rax), %xmm0
	jmp	.L66
.L99:
	movb	$1, 2004+f(%rip)
	movapd	%xmm10, %xmm0
	jmp	.L66
.L102:
	imulq	$8008, %rcx, %rcx
	movsd	16(%r10,%rcx), %xmm0
	jmp	.L63
.L101:
	movb	$1, 2004+f(%rip)
	movapd	%xmm10, %xmm0
	jmp	.L63
.L97:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE36:
	.size	main, .-main
	.globl	f
	.bss
	.align 32
	.type	f, @object
	.size	f, 1002001
f:
	.zero	1002001
	.globl	m
	.align 32
	.type	m, @object
	.size	m, 8016008
m:
	.zero	8016008
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC1:
	.long	0
	.long	1072693248
	.align 8
.LC2:
	.long	0
	.long	1073741824
	.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
	.type	calc.part.0, @function
calc.part.0:
.LFB37:
	.cfi_startproc
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pxor	%xmm3, %xmm3
	pxor	%xmm6, %xmm6
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	cvtsi2sdl	%esi, %xmm6
	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
	movl	%esi, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movslq	%edi, %rbx
	cvtsi2sdl	%ebx, %xmm3
	subq	$72, %rsp
	.cfi_def_cfa_offset 128
	testl	%esi, %esi
	jg	.L26
	pxor	%xmm7, %xmm7
	leaq	f(%rip), %r12
	leaq	m(%rip), %r15
	movapd	%xmm7, %xmm1
.L2:
	movapd	%xmm3, %xmm4
	movsd	.LC1(%rip), %xmm2
	leal	-2(%rbx), %edi
	movslq	%ebp, %r13
	subsd	%xmm6, %xmm4
	movapd	%xmm4, %xmm5
	divsd	%xmm3, %xmm5
	subsd	.LC1(%rip), %xmm3
	divsd	%xmm3, %xmm2
	mulsd	%xmm5, %xmm2
	cmpl	%edi, %ebp
	je	.L27
	movslq	%edi, %r14
	imulq	$1001, %r14, %r14
	leaq	(%r12,%r14), %rax
	addq	%r13, %rax
	cmpb	$0, (%rax)
	jne	.L28
	movl	%ebp, %esi
	movl	%edi, (%rsp)
	movsd	%xmm2, 40(%rsp)
	movsd	%xmm3, 32(%rsp)
	movsd	%xmm5, 24(%rsp)
	movsd	%xmm4, 16(%rsp)
	movsd	%xmm1, 8(%rsp)
	movq	%rax, 56(%rsp)
	movsd	%xmm6, 48(%rsp)
	call	calc.part.0
	movsd	40(%rsp), %xmm2
	testl	%ebp, %ebp
	movl	(%rsp), %edi
	movsd	8(%rsp), %xmm1
	movsd	16(%rsp), %xmm4
	mulsd	%xmm0, %xmm2
	movsd	24(%rsp), %xmm5
	movsd	32(%rsp), %xmm3
	addsd	%xmm2, %xmm1
	jg	.L29
.L8:
	movl	%ebx, %eax
	subl	%ebp, %eax
	cmpl	$2, %eax
	jg	.L30
.L13:
	imulq	$1001, %rbx, %rbx
	movapd	%xmm1, %xmm0
	addq	%rbx, %r12
	addq	%r13, %rbx
	movb	$1, (%r12,%r13)
	movsd	%xmm1, (%r15,%rbx,8)
	addq	$72, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	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
.L29:
	.cfi_restore_state
	movsd	48(%rsp), %xmm6
	movq	56(%rsp), %rax
	divsd	%xmm3, %xmm6
	cmpb	$0, (%rax)
	movapd	%xmm6, %xmm2
	mulsd	%xmm5, %xmm2
	jne	.L31
	movl	%ebp, %esi
	movl	%edi, (%rsp)
	movsd	%xmm1, 40(%rsp)
	movsd	%xmm2, 32(%rsp)
	movsd	%xmm3, 24(%rsp)
	movsd	%xmm5, 16(%rsp)
	movsd	%xmm4, 8(%rsp)
	call	calc.part.0
	addsd	.LC1(%rip), %xmm0
	movl	(%rsp), %edi
	movsd	32(%rsp), %xmm2
	movsd	40(%rsp), %xmm1
	movsd	24(%rsp), %xmm3
	movsd	16(%rsp), %xmm5
	mulsd	%xmm2, %xmm0
	movsd	8(%rsp), %xmm4
.L12:
	movl	%ebx, %eax
	addsd	%xmm0, %xmm1
	subl	%ebp, %eax
	cmpl	$2, %eax
	jle	.L13
.L30:
	subsd	.LC2(%rip), %xmm4
	leal	2(%rbp), %esi
	divsd	%xmm3, %xmm4
	mulsd	%xmm5, %xmm4
	cmpl	%esi, %edi
	je	.L32
	movslq	%edi, %rax
	movslq	%esi, %rdx
	imulq	$1001, %rax, %rax
	leaq	(%r12,%rax), %rcx
	cmpb	$0, (%rcx,%rdx)
	jne	.L33
	movsd	%xmm1, 8(%rsp)
	movsd	%xmm4, (%rsp)
	call	calc.part.0
	movsd	(%rsp), %xmm4
	addsd	.LC1(%rip), %xmm0
	movsd	8(%rsp), %xmm1
	mulsd	%xmm0, %xmm4
.L15:
	addsd	%xmm4, %xmm1
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L26:
	movapd	%xmm6, %xmm1
	leal	-1(%rsi), %esi
	leal	-1(%rbx), %edi
	divsd	%xmm3, %xmm1
	leaq	f(%rip), %r12
	cmpl	%ebp, %ebx
	je	.L34
	movslq	%edi, %rax
	movslq	%esi, %rdx
	imulq	$1001, %rax, %rax
	leaq	(%r12,%rax), %rcx
	cmpb	$0, (%rcx,%rdx)
	jne	.L35
	movsd	%xmm1, 16(%rsp)
	leaq	m(%rip), %r15
	movsd	%xmm6, 8(%rsp)
	movsd	%xmm3, (%rsp)
	call	calc.part.0
	movsd	16(%rsp), %xmm1
	movsd	8(%rsp), %xmm6
	pxor	%xmm7, %xmm7
	movsd	(%rsp), %xmm3
.L4:
	mulsd	%xmm0, %xmm1
	addsd	%xmm7, %xmm1
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L28:
	addq	%r13, %r14
	movsd	(%r15,%r14,8), %xmm7
	mulsd	%xmm7, %xmm2
	addsd	%xmm2, %xmm1
	testl	%ebp, %ebp
	jle	.L8
	divsd	%xmm3, %xmm6
	movapd	%xmm6, %xmm2
	mulsd	%xmm5, %xmm2
.L19:
	addsd	.LC1(%rip), %xmm7
	mulsd	%xmm2, %xmm7
	movapd	%xmm7, %xmm0
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L27:
	mulsd	%xmm7, %xmm2
	imulq	$1002, %r13, %rax
	movb	$1, (%r12,%rax)
	addsd	%xmm2, %xmm1
	testl	%ebp, %ebp
	jle	.L8
	divsd	%xmm3, %xmm6
	movapd	%xmm6, %xmm0
	mulsd	%xmm5, %xmm0
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L33:
	addq	%rdx, %rax
	movsd	.LC1(%rip), %xmm0
	addsd	(%r15,%rax,8), %xmm0
	mulsd	%xmm0, %xmm4
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L35:
	leaq	m(%rip), %r15
	addq	%rdx, %rax
	pxor	%xmm7, %xmm7
	movsd	(%r15,%rax,8), %xmm0
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L34:
	movslq	%edi, %rdi
	movslq	%esi, %rsi
	pxor	%xmm7, %xmm7
	imulq	$1001, %rdi, %rdi
	movapd	%xmm7, %xmm0
	leaq	m(%rip), %r15
	addq	%r12, %rdi
	movb	$1, (%rdi,%rsi)
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L32:
	movslq	%edi, %rdi
	imulq	$1002, %rdi, %rdi
	movb	$1, (%r12,%rdi)
	jmp	.L15
.L31:
	addq	%r13, %r14
	movsd	(%r15,%r14,8), %xmm7
	jmp	.L19
	.cfi_endproc
.LFE37:
	.size	calc.part.0, .-calc.part.0
	.p2align 4
	.globl	calc
	.type	calc, @function
calc:
.LFB35:
	.cfi_startproc
	endbr64
	cmpl	%esi, %edi
	je	.L40
	movslq	%edi, %rax
	leaq	f(%rip), %rdx
	movslq	%esi, %rcx
	imulq	$1001, %rax, %rax
	addq	%rax, %rdx
	cmpb	$0, (%rdx,%rcx)
	jne	.L41
	jmp	calc.part.0
	.p2align 4,,10
	.p2align 3
.L41:
	addq	%rcx, %rax
	leaq	m(%rip), %rdx
	movsd	(%rdx,%rax,8), %xmm0
	ret
	.p2align 4,,10
	.p2align 3
.L40:
	movslq	%edi, %rdi
	leaq	f(%rip), %rax
	pxor	%xmm0, %xmm0
	imulq	$1002, %rdi, %rdi
	movb	$1, (%rax,%rdi)
	ret
	.cfi_endproc
.LFE35:
	.size	calc, .-calc
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC3:
	.string	"%.10lf\n"
.LC4:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB36:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movl	$125, %ecx
	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	.LC4(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	f(%rip), %rbx
	movq	%rbx, %rdi
	subq	$136, %rsp
	.cfi_def_cfa_offset 192
	movq	%fs:40, %rax
	movq	%rax, 120(%rsp)
	xorl	%eax, %eax
	leaq	116(%rsp), %r12
	movabsq	$72340172838076673, %rax
	rep stosq
	movb	$1, (%rdi)
	.p2align 4,,10
	.p2align 3
.L43:
	xorl	%eax, %eax
	movq	%r12, %rsi
	movq	%rbp, %rdi
	call	__isoc99_scanf@PLT
	testl	%eax, %eax
	je	.L74
	movl	116(%rsp), %r8d
	testl	%r8d, %r8d
	jle	.L74
	movslq	%r8d, %r9
	imulq	$1001, %r9, %rax
	cmpb	$0, (%rbx,%rax)
	jne	.L81
	pxor	%xmm9, %xmm9
	movl	%r8d, %r13d
	movsd	.LC1(%rip), %xmm8
	cvtsi2sdl	%r8d, %xmm9
	movapd	%xmm9, %xmm3
	subsd	.LC1(%rip), %xmm3
	movapd	%xmm9, %xmm15
	divsd	%xmm9, %xmm15
	divsd	%xmm3, %xmm8
	mulsd	%xmm15, %xmm8
	subl	$2, %r13d
	je	.L82
	movslq	%r13d, %r11
	imulq	$1001, %r11, %rax
	cmpb	$0, (%rbx,%rax)
	jne	.L83
	pxor	%xmm12, %xmm12
	movl	%r8d, %r15d
	movsd	.LC1(%rip), %xmm11
	cvtsi2sdl	%r13d, %xmm12
	movapd	%xmm12, %xmm6
	subsd	.LC1(%rip), %xmm6
	movapd	%xmm12, %xmm4
	divsd	%xmm12, %xmm4
	divsd	%xmm6, %xmm11
	mulsd	%xmm4, %xmm11
	subl	$4, %r15d
	je	.L84
	movslq	%r15d, %r14
	imulq	$1001, %r14, %rax
	cmpb	$0, (%rbx,%rax)
	jne	.L85
	movsd	.LC1(%rip), %xmm13
	pxor	%xmm1, %xmm1
	movl	%r8d, %edx
	cvtsi2sdl	%r15d, %xmm1
	movapd	%xmm1, %xmm7
	subsd	.LC1(%rip), %xmm7
	movapd	%xmm1, %xmm2
	divsd	%xmm1, %xmm2
	divsd	%xmm7, %xmm13
	movsd	%xmm2, 8(%rsp)
	mulsd	%xmm2, %xmm13
	subl	$6, %edx
	je	.L86
	movslq	%edx, %rax
	imulq	$1001, %rax, %rcx
	cmpb	$0, (%rbx,%rcx)
	jne	.L87
	pxor	%xmm5, %xmm5
	movl	%r8d, %edi
	cvtsi2sdl	%edx, %xmm5
	movapd	%xmm5, %xmm2
	subsd	.LC1(%rip), %xmm2
	movapd	%xmm5, %xmm0
	divsd	%xmm5, %xmm0
	movapd	%xmm2, %xmm14
	movsd	%xmm2, 24(%rsp)
	movsd	.LC1(%rip), %xmm2
	divsd	%xmm14, %xmm2
	movsd	%xmm0, 16(%rsp)
	mulsd	%xmm0, %xmm2
	movapd	%xmm2, %xmm14
	subl	$8, %edi
	je	.L88
	movslq	%edi, %rcx
	imulq	$1001, %rcx, %rsi
	cmpb	$0, (%rbx,%rsi)
	jne	.L89
	xorl	%esi, %esi
	movq	%rcx, 104(%rsp)
	leaq	m(%rip), %r10
	movq	%rax, 96(%rsp)
	movl	%edx, 84(%rsp)
	movl	%edi, 32(%rsp)
	movsd	%xmm5, 88(%rsp)
	movsd	%xmm7, 72(%rsp)
	movsd	%xmm1, 64(%rsp)
	movsd	%xmm6, 56(%rsp)
	movsd	%xmm4, 48(%rsp)
	movsd	%xmm3, 40(%rsp)
	call	calc.part.0
	movq	104(%rsp), %rcx
	movq	96(%rsp), %rax
	movsd	88(%rsp), %xmm5
	movl	84(%rsp), %edx
	movapd	%xmm0, %xmm2
	movsd	72(%rsp), %xmm7
	movsd	64(%rsp), %xmm1
	movsd	56(%rsp), %xmm6
	movsd	48(%rsp), %xmm4
	movsd	40(%rsp), %xmm3
	movl	32(%rsp), %edi
.L61:
	mulsd	%xmm14, %xmm2
	pxor	%xmm14, %xmm14
	pxor	%xmm10, %xmm10
	addsd	%xmm2, %xmm14
	cmpl	$2, %edx
	jg	.L90
.L59:
	imulq	$1001, %rax, %rcx
	movb	$1, (%rbx,%rcx)
	imulq	$8008, %rax, %rcx
	movsd	%xmm14, (%r10,%rcx)
.L57:
	mulsd	%xmm14, %xmm13
	addsd	%xmm10, %xmm13
	cmpl	$2, %r15d
	jg	.L91
.L55:
	imulq	$1001, %r14, %rax
	mulsd	%xmm13, %xmm11
	movb	$1, (%rbx,%rax)
	imulq	$8008, %r14, %rax
	addsd	%xmm10, %xmm11
	movsd	%xmm13, (%r10,%rax)
	cmpl	$2, %r13d
	jle	.L51
.L98:
	subsd	.LC2(%rip), %xmm12
	divsd	%xmm6, %xmm12
	mulsd	%xmm4, %xmm12
	cmpl	$2, %r15d
	je	.L92
	imulq	$1001, %r14, %rax
	cmpb	$0, 2(%rbx,%rax)
	jne	.L93
	movl	$2, %esi
	movl	%r15d, %edi
	movsd	%xmm3, 8(%rsp)
	call	calc.part.0
	movsd	8(%rsp), %xmm3
.L69:
	addsd	.LC1(%rip), %xmm0
	mulsd	%xmm12, %xmm0
	addsd	%xmm0, %xmm11
	jmp	.L51
	.p2align 4,,10
	.p2align 3
.L81:
	imulq	$8008, %r9, %r9
	leaq	m(%rip), %r10
	movsd	(%r10,%r9), %xmm8
.L45:
	movapd	%xmm8, %xmm0
	movl	$1, %edi
	movl	$1, %eax
	leaq	.LC3(%rip), %rsi
	call	__printf_chk@PLT
	jmp	.L43
	.p2align 4,,10
	.p2align 3
.L83:
	imulq	$8008, %r11, %rax
	leaq	m(%rip), %r10
	pxor	%xmm10, %xmm10
	movsd	(%r10,%rax), %xmm11
.L49:
	mulsd	%xmm11, %xmm8
	addsd	%xmm10, %xmm8
	cmpl	$2, %r8d
	jg	.L94
.L47:
	imulq	$1001, %r9, %rax
	imulq	$8008, %r9, %r9
	movb	$1, (%rbx,%rax)
	movsd	%xmm8, (%r10,%r9)
	jmp	.L45
	.p2align 4,,10
	.p2align 3
.L94:
	subsd	.LC2(%rip), %xmm9
	divsd	%xmm3, %xmm9
	mulsd	%xmm15, %xmm9
	cmpl	$2, %r13d
	je	.L95
	imulq	$1001, %r11, %rax
	cmpb	$0, 2(%rbx,%rax)
	jne	.L96
	movl	$2, %esi
	movl	%r13d, %edi
	call	calc.part.0
	movapd	%xmm0, %xmm10
.L72:
	addsd	.LC1(%rip), %xmm10
	mulsd	%xmm9, %xmm10
	addsd	%xmm10, %xmm8
	jmp	.L47
	.p2align 4,,10
	.p2align 3
.L74:
	movq	120(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L97
	addq	$136, %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
.L82:
	.cfi_restore_state
	pxor	%xmm10, %xmm10
	movb	$1, f(%rip)
	leaq	m(%rip), %r10
	mulsd	%xmm10, %xmm8
	addsd	%xmm10, %xmm8
	jmp	.L47
.L85:
	imulq	$8008, %r14, %rax
	leaq	m(%rip), %r10
	pxor	%xmm10, %xmm10
	movsd	(%r10,%rax), %xmm13
	mulsd	%xmm13, %xmm11
	addsd	%xmm10, %xmm11
	cmpl	$2, %r13d
	jg	.L98
	.p2align 4,,10
	.p2align 3
.L51:
	imulq	$1001, %r11, %rax
	movb	$1, (%rbx,%rax)
	imulq	$8008, %r11, %rax
	movsd	%xmm11, (%r10,%rax)
	jmp	.L49
.L93:
	imulq	$8008, %r14, %r14
	movsd	16(%r10,%r14), %xmm0
	jmp	.L69
.L84:
	pxor	%xmm10, %xmm10
	movb	$1, f(%rip)
	leaq	m(%rip), %r10
	mulsd	%xmm10, %xmm11
	addsd	%xmm10, %xmm11
	jmp	.L51
.L91:
	subsd	.LC2(%rip), %xmm1
	movsd	8(%rsp), %xmm14
	divsd	%xmm7, %xmm1
	mulsd	%xmm1, %xmm14
	cmpl	$2, %edx
	je	.L99
	imulq	$1001, %rax, %rcx
	cmpb	$0, 2(%rbx,%rcx)
	jne	.L100
	movl	$2, %esi
	movl	%edx, %edi
	movsd	%xmm6, 24(%rsp)
	movsd	%xmm4, 16(%rsp)
	movsd	%xmm3, 8(%rsp)
	call	calc.part.0
	movsd	24(%rsp), %xmm6
	movsd	16(%rsp), %xmm4
	movsd	8(%rsp), %xmm3
.L66:
	addsd	.LC1(%rip), %xmm0
	mulsd	%xmm14, %xmm0
	addsd	%xmm0, %xmm13
	jmp	.L55
.L96:
	imulq	$8008, %r11, %rax
	movsd	16(%r10,%rax), %xmm10
	jmp	.L72
.L87:
	imulq	$8008, %rax, %rcx
	leaq	m(%rip), %r10
	pxor	%xmm10, %xmm10
	movsd	(%r10,%rcx), %xmm14
	jmp	.L57
.L95:
	movb	$1, 2004+f(%rip)
	jmp	.L72
.L86:
	pxor	%xmm10, %xmm10
	movb	$1, f(%rip)
	leaq	m(%rip), %r10
	mulsd	%xmm10, %xmm13
	addsd	%xmm10, %xmm13
	jmp	.L55
.L90:
	subsd	.LC2(%rip), %xmm5
	divsd	24(%rsp), %xmm5
	mulsd	16(%rsp), %xmm5
	cmpl	$2, %edi
	je	.L101
	imulq	$1001, %rcx, %rsi
	cmpb	$0, 2(%rbx,%rsi)
	jne	.L102
	movl	$2, %esi
	movq	%rax, 72(%rsp)
	movl	%edx, 56(%rsp)
	movsd	%xmm5, 64(%rsp)
	movsd	%xmm7, 48(%rsp)
	movsd	%xmm1, 40(%rsp)
	movsd	%xmm6, 32(%rsp)
	movsd	%xmm4, 24(%rsp)
	movsd	%xmm3, 16(%rsp)
	call	calc.part.0
	movq	72(%rsp), %rax
	movl	56(%rsp), %edx
	movsd	64(%rsp), %xmm5
	movsd	48(%rsp), %xmm7
	movsd	40(%rsp), %xmm1
	movsd	32(%rsp), %xmm6
	movsd	24(%rsp), %xmm4
	movsd	16(%rsp), %xmm3
.L63:
	addsd	.LC1(%rip), %xmm0
	mulsd	%xmm5, %xmm0
	addsd	%xmm0, %xmm14
	jmp	.L59
.L88:
	pxor	%xmm10, %xmm10
	movb	$1, f(%rip)
	leaq	m(%rip), %r10
	mulsd	%xmm10, %xmm2
	addsd	%xmm10, %xmm2
	movapd	%xmm2, %xmm14
	jmp	.L59
.L89:
	imulq	$8008, %rcx, %rsi
	leaq	m(%rip), %r10
	movsd	(%r10,%rsi), %xmm2
	jmp	.L61
.L92:
	movb	$1, 2004+f(%rip)
	movapd	%xmm10, %xmm0
	jmp	.L69
.L100:
	imulq	$8008, %rax, %rax
	movsd	16(%r10,%rax), %xmm0
	jmp	.L66
.L99:
	movb	$1, 2004+f(%rip)
	movapd	%xmm10, %xmm0
	jmp	.L66
.L102:
	imulq	$8008, %rcx, %rcx
	movsd	16(%r10,%rcx), %xmm0
	jmp	.L63
.L101:
	movb	$1, 2004+f(%rip)
	movapd	%xmm10, %xmm0
	jmp	.L63
.L97:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE36:
	.size	main, .-main
	.globl	f
	.bss
	.align 32
	.type	f, @object
	.size	f, 1002001
f:
	.zero	1002001
	.globl	m
	.align 32
	.type	m, @object
	.size	m, 8016008
m:
	.zero	8016008
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC1:
	.long	0
	.long	1072693248
	.align 8
.LC2:
	.long	0
	.long	1073741824
	.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:

// AOJ 2139: Memory Match
// 2017.11.13

#include <stdio.h>
#include <string.h>

double m[1001][1001];
char f[1001][1001];

double calc(int unopen, int known)
{
	double u, k, r;
	
	if (unopen == known) { f[unopen][known] = 1; return 0; }
	if (f[unopen][known]) return m[unopen][known];

	u = unopen, k = known, r = 0;
	if (known > 0) r += (k/u) * calc(unopen-1, known-1);
	r += ((u-k)/u) * (1.0/(u-1)) * calc(unopen-2, known);
	if (known > 0) r += ((u-k)/u)*(k/(u-1)) * (calc(unopen-2, known)+1);
	if (unopen - known > 2) r += ((u-k)/u)*((u-k-2)/(u-1)) * (calc(unopen-2, known+2)+1);

	f[unopen][known] = 1;
	m[unopen][known] = r;
	return r;
}

int main()
{
	int n;
	
	memset(f[0], 1, sizeof(f[0]));
	while (scanf("%d", &n) && n > 0) printf("%.10lf\n", calc(n, 0));
	return 0;
}
2
4
6
8
10
38
0
 2
4
6
8
4
38
0
 2
4
0
8
4
38
0
 2
4
12
8
4
38
0
 2
4
12
8
2
38
0
 2
4
12
10
2
38
0
 2
6
0
1
1
44
-2
 2
4
6
16
10
38
0
 2
4
12
8
4
72
0
 2
4
6
8
2
38
0

0.0000000000
0.6666666667
1.3333333333
1.9238095238
2.5523809524
11.1470075834
 0.0000000000
0.6666666667
1.3333333333
1.9238095238
0.6666666667
11.1470075834
 0.0000000000
0.6666666667
 0.0000000000
0.6666666667
3.1624819625
1.9238095238
0.6666666667
11.1470075834
 0.0000000000
0.6666666667
3.1624819625
1.9238095238
0.0000000000
11.1470075834
 0.0000000000
0.6666666667
3.1624819625
2.5523809524
0.0000000000
11.1470075834
 0.0000000000
1.3333333333
 0.0000000000
0.6666666667
1.3333333333
4.3929847930
2.5523809524
11.1470075834
 0.0000000000
0.6666666667
3.1624819625
1.9238095238
0.6666666667
21.5810099165
 0.0000000000
0.6666666667
1.3333333333
1.9238095238
0.0000000000
11.1470075834

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

```c
// AOJ 2139: Memory Match
// 2017.11.13

#include <stdio.h>
#include <string.h>

double m[1001][1001];
char f[1001][1001];

double calc(int unopen, int known)
{
	double u, k, r;
	
	if (unopen == known) { f[unopen][known] = 1; return 0; }
	if (f[unopen][known]) return m[unopen][known];

	u = unopen, k = known, r = 0;
	if (known > 0) r += (k/u) * calc(unopen-1, known-1);
	r += ((u-k)/u) * (1.0/(u-1)) * calc(unopen-2, known);
	if (known > 0) r += ((u-k)/u)*(k/(u-1)) * (calc(unopen-2, known)+1);
	if (unopen - known > 2) r += ((u-k)/u)*((u-k-2)/(u-1)) * (calc(unopen-2, known+2)+1);

	f[unopen][known] = 1;
	m[unopen][known] = r;
	return r;
}

int main()
{
	int n;
	
	memset(f[0], 1, sizeof(f[0]));
	while (scanf("%d", &n) && n > 0) printf("%.10lf\n", calc(n, 0));
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	m
	.bss
	.align 32
	.type	m, @object
	.size	m, 8016008
m:
	.zero	8016008
	.globl	f
	.align 32
	.type	f, @object
	.size	f, 1002001
f:
	.zero	1002001
	.text
	.globl	calc
	.type	calc, @function
calc:
.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
	movl	%edi, -36(%rbp)
	movl	%esi, -40(%rbp)
	movl	-36(%rbp), %eax
	cmpl	-40(%rbp), %eax
	jne	.L2
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	movl	-36(%rbp), %eax
	cltq
	imulq	$1001, %rax, %rax
	addq	%rax, %rdx
	leaq	f(%rip), %rax
	addq	%rdx, %rax
	movb	$1, (%rax)
	pxor	%xmm0, %xmm0
	jmp	.L3
.L2:
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	movl	-36(%rbp), %eax
	cltq
	imulq	$1001, %rax, %rax
	addq	%rax, %rdx
	leaq	f(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	testb	%al, %al
	je	.L4
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	movl	-36(%rbp), %eax
	cltq
	imulq	$1001, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	m(%rip), %rax
	movsd	(%rdx,%rax), %xmm0
	jmp	.L3
.L4:
	pxor	%xmm0, %xmm0
	cvtsi2sdl	-36(%rbp), %xmm0
	movsd	%xmm0, -16(%rbp)
	pxor	%xmm0, %xmm0
	cvtsi2sdl	-40(%rbp), %xmm0
	movsd	%xmm0, -8(%rbp)
	pxor	%xmm0, %xmm0
	movsd	%xmm0, -24(%rbp)
	cmpl	$0, -40(%rbp)
	jle	.L5
	movsd	-8(%rbp), %xmm0
	divsd	-16(%rbp), %xmm0
	movsd	%xmm0, -48(%rbp)
	movl	-40(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-36(%rbp), %eax
	subl	$1, %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	calc
	mulsd	-48(%rbp), %xmm0
	movsd	-24(%rbp), %xmm1
	addsd	%xmm1, %xmm0
	movsd	%xmm0, -24(%rbp)
.L5:
	movsd	-16(%rbp), %xmm0
	subsd	-8(%rbp), %xmm0
	movapd	%xmm0, %xmm1
	divsd	-16(%rbp), %xmm1
	movsd	-16(%rbp), %xmm0
	movsd	.LC1(%rip), %xmm3
	movapd	%xmm0, %xmm2
	subsd	%xmm3, %xmm2
	movsd	.LC1(%rip), %xmm0
	divsd	%xmm2, %xmm0
	mulsd	%xmm0, %xmm1
	movsd	%xmm1, -48(%rbp)
	movl	-36(%rbp), %eax
	leal	-2(%rax), %edx
	movl	-40(%rbp), %eax
	movl	%eax, %esi
	movl	%edx, %edi
	call	calc
	mulsd	-48(%rbp), %xmm0
	movsd	-24(%rbp), %xmm1
	addsd	%xmm1, %xmm0
	movsd	%xmm0, -24(%rbp)
	cmpl	$0, -40(%rbp)
	jle	.L6
	movsd	-16(%rbp), %xmm0
	subsd	-8(%rbp), %xmm0
	movapd	%xmm0, %xmm1
	divsd	-16(%rbp), %xmm1
	movsd	-16(%rbp), %xmm0
	movsd	.LC1(%rip), %xmm3
	movapd	%xmm0, %xmm2
	subsd	%xmm3, %xmm2
	movsd	-8(%rbp), %xmm0
	divsd	%xmm2, %xmm0
	mulsd	%xmm0, %xmm1
	movsd	%xmm1, -48(%rbp)
	movl	-36(%rbp), %eax
	leal	-2(%rax), %edx
	movl	-40(%rbp), %eax
	movl	%eax, %esi
	movl	%edx, %edi
	call	calc
	movsd	.LC1(%rip), %xmm1
	addsd	%xmm1, %xmm0
	mulsd	-48(%rbp), %xmm0
	movsd	-24(%rbp), %xmm1
	addsd	%xmm1, %xmm0
	movsd	%xmm0, -24(%rbp)
.L6:
	movl	-36(%rbp), %eax
	subl	-40(%rbp), %eax
	cmpl	$2, %eax
	jle	.L7
	movsd	-16(%rbp), %xmm0
	subsd	-8(%rbp), %xmm0
	movapd	%xmm0, %xmm2
	divsd	-16(%rbp), %xmm2
	movsd	-16(%rbp), %xmm0
	subsd	-8(%rbp), %xmm0
	movsd	.LC2(%rip), %xmm1
	subsd	%xmm1, %xmm0
	movsd	-16(%rbp), %xmm1
	movsd	.LC1(%rip), %xmm3
	subsd	%xmm3, %xmm1
	divsd	%xmm1, %xmm0
	mulsd	%xmm0, %xmm2
	movsd	%xmm2, -48(%rbp)
	movl	-40(%rbp), %eax
	leal	2(%rax), %edx
	movl	-36(%rbp), %eax
	subl	$2, %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	calc
	movsd	.LC1(%rip), %xmm1
	addsd	%xmm1, %xmm0
	mulsd	-48(%rbp), %xmm0
	movsd	-24(%rbp), %xmm1
	addsd	%xmm1, %xmm0
	movsd	%xmm0, -24(%rbp)
.L7:
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	movl	-36(%rbp), %eax
	cltq
	imulq	$1001, %rax, %rax
	addq	%rax, %rdx
	leaq	f(%rip), %rax
	addq	%rdx, %rax
	movb	$1, (%rax)
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	movl	-36(%rbp), %eax
	cltq
	imulq	$1001, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	m(%rip), %rax
	movsd	-24(%rbp), %xmm0
	movsd	%xmm0, (%rdx,%rax)
	movsd	-24(%rbp), %xmm0
.L3:
	movq	%xmm0, %rax
	movq	%rax, %xmm0
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	calc, .-calc
	.section	.rodata
.LC3:
	.string	"%.10lf\n"
.LC4:
	.string	"%d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$1001, %edx
	movl	$1, %esi
	leaq	f(%rip), %rax
	movq	%rax, %rdi
	call	memset@PLT
	jmp	.L9
.L11:
	movl	-12(%rbp), %eax
	movl	$0, %esi
	movl	%eax, %edi
	call	calc
	movq	%xmm0, %rax
	movq	%rax, %xmm0
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$1, %eax
	call	printf@PLT
.L9:
	leaq	-12(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC4(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	testl	%eax, %eax
	je	.L10
	movl	-12(%rbp), %eax
	testl	%eax, %eax
	jg	.L11
.L10:
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L13
	call	__stack_chk_fail@PLT
.L13:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	main, .-main
	.section	.rodata
	.align 8
.LC1:
	.long	0
	.long	1072693248
	.align 8
.LC2:
	.long	0
	.long	1073741824
	.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	m
	.bss
	.align 32
	.type	m, @object
	.size	m, 8016008
m:
	.zero	8016008
	.globl	f
	.align 32
	.type	f, @object
	.size	f, 1002001
f:
	.zero	1002001
	.text
	.globl	calc
	.type	calc, @function
calc:
.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
	movl	%edi, -36(%rbp)
	movl	%esi, -40(%rbp)
	movl	-36(%rbp), %eax
	cmpl	-40(%rbp), %eax
	jne	.L2
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	movl	-36(%rbp), %eax
	cltq
	imulq	$1001, %rax, %rax
	addq	%rax, %rdx
	leaq	f(%rip), %rax
	addq	%rdx, %rax
	movb	$1, (%rax)
	pxor	%xmm0, %xmm0
	jmp	.L3
.L2:
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	movl	-36(%rbp), %eax
	cltq
	imulq	$1001, %rax, %rax
	addq	%rax, %rdx
	leaq	f(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	testb	%al, %al
	je	.L4
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	movl	-36(%rbp), %eax
	cltq
	imulq	$1001, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	m(%rip), %rax
	movsd	(%rdx,%rax), %xmm0
	jmp	.L3
.L4:
	pxor	%xmm0, %xmm0
	cvtsi2sdl	-36(%rbp), %xmm0
	movsd	%xmm0, -16(%rbp)
	pxor	%xmm0, %xmm0
	cvtsi2sdl	-40(%rbp), %xmm0
	movsd	%xmm0, -8(%rbp)
	pxor	%xmm0, %xmm0
	movsd	%xmm0, -24(%rbp)
	cmpl	$0, -40(%rbp)
	jle	.L5
	movsd	-8(%rbp), %xmm0
	divsd	-16(%rbp), %xmm0
	movsd	%xmm0, -48(%rbp)
	movl	-40(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-36(%rbp), %eax
	subl	$1, %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	calc
	mulsd	-48(%rbp), %xmm0
	movsd	-24(%rbp), %xmm1
	addsd	%xmm1, %xmm0
	movsd	%xmm0, -24(%rbp)
.L5:
	movsd	-16(%rbp), %xmm0
	subsd	-8(%rbp), %xmm0
	movapd	%xmm0, %xmm1
	divsd	-16(%rbp), %xmm1
	movsd	-16(%rbp), %xmm0
	movsd	.LC1(%rip), %xmm3
	movapd	%xmm0, %xmm2
	subsd	%xmm3, %xmm2
	movsd	.LC1(%rip), %xmm0
	divsd	%xmm2, %xmm0
	mulsd	%xmm0, %xmm1
	movsd	%xmm1, -48(%rbp)
	movl	-36(%rbp), %eax
	leal	-2(%rax), %edx
	movl	-40(%rbp), %eax
	movl	%eax, %esi
	movl	%edx, %edi
	call	calc
	mulsd	-48(%rbp), %xmm0
	movsd	-24(%rbp), %xmm1
	addsd	%xmm1, %xmm0
	movsd	%xmm0, -24(%rbp)
	cmpl	$0, -40(%rbp)
	jle	.L6
	movsd	-16(%rbp), %xmm0
	subsd	-8(%rbp), %xmm0
	movapd	%xmm0, %xmm1
	divsd	-16(%rbp), %xmm1
	movsd	-16(%rbp), %xmm0
	movsd	.LC1(%rip), %xmm3
	movapd	%xmm0, %xmm2
	subsd	%xmm3, %xmm2
	movsd	-8(%rbp), %xmm0
	divsd	%xmm2, %xmm0
	mulsd	%xmm0, %xmm1
	movsd	%xmm1, -48(%rbp)
	movl	-36(%rbp), %eax
	leal	-2(%rax), %edx
	movl	-40(%rbp), %eax
	movl	%eax, %esi
	movl	%edx, %edi
	call	calc
	movsd	.LC1(%rip), %xmm1
	addsd	%xmm1, %xmm0
	mulsd	-48(%rbp), %xmm0
	movsd	-24(%rbp), %xmm1
	addsd	%xmm1, %xmm0
	movsd	%xmm0, -24(%rbp)
.L6:
	movl	-36(%rbp), %eax
	subl	-40(%rbp), %eax
	cmpl	$2, %eax
	jle	.L7
	movsd	-16(%rbp), %xmm0
	subsd	-8(%rbp), %xmm0
	movapd	%xmm0, %xmm2
	divsd	-16(%rbp), %xmm2
	movsd	-16(%rbp), %xmm0
	subsd	-8(%rbp), %xmm0
	movsd	.LC2(%rip), %xmm1
	subsd	%xmm1, %xmm0
	movsd	-16(%rbp), %xmm1
	movsd	.LC1(%rip), %xmm3
	subsd	%xmm3, %xmm1
	divsd	%xmm1, %xmm0
	mulsd	%xmm0, %xmm2
	movsd	%xmm2, -48(%rbp)
	movl	-40(%rbp), %eax
	leal	2(%rax), %edx
	movl	-36(%rbp), %eax
	subl	$2, %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	calc
	movsd	.LC1(%rip), %xmm1
	addsd	%xmm1, %xmm0
	mulsd	-48(%rbp), %xmm0
	movsd	-24(%rbp), %xmm1
	addsd	%xmm1, %xmm0
	movsd	%xmm0, -24(%rbp)
.L7:
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	movl	-36(%rbp), %eax
	cltq
	imulq	$1001, %rax, %rax
	addq	%rax, %rdx
	leaq	f(%rip), %rax
	addq	%rdx, %rax
	movb	$1, (%rax)
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	movl	-36(%rbp), %eax
	cltq
	imulq	$1001, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	m(%rip), %rax
	movsd	-24(%rbp), %xmm0
	movsd	%xmm0, (%rdx,%rax)
	movsd	-24(%rbp), %xmm0
.L3:
	movq	%xmm0, %rax
	movq	%rax, %xmm0
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	calc, .-calc
	.section	.rodata
.LC3:
	.string	"%.10lf\n"
.LC4:
	.string	"%d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$1001, %edx
	movl	$1, %esi
	leaq	f(%rip), %rax
	movq	%rax, %rdi
	call	memset@PLT
	jmp	.L9
.L11:
	movl	-12(%rbp), %eax
	movl	$0, %esi
	movl	%eax, %edi
	call	calc
	movq	%xmm0, %rax
	movq	%rax, %xmm0
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$1, %eax
	call	printf@PLT
.L9:
	leaq	-12(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC4(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	testl	%eax, %eax
	je	.L10
	movl	-12(%rbp), %eax
	testl	%eax, %eax
	jg	.L11
.L10:
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L13
	call	__stack_chk_fail@PLT
.L13:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	main, .-main
	.section	.rodata
	.align 8
.LC1:
	.long	0
	.long	1072693248
	.align 8
.LC2:
	.long	0
	.long	1073741824
	.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:
