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

```c
//#include "pch.h"
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>

#define llong long long
#define fr(i,l,r) for(i=(l);i<(r);i++)
#define min(p,q) ((p)<(q)?(p):(q))
#define max(p,q) ((p)>(q)?(p):(q))
#define INF 1000000000000//10^12

llong ketamax[80];
llong sanjo[80];
llong nijo[80];
int roop=0;
int dp[100][5];

int init(int x, int y) {
	int i, j;
	for (i = 1;i <= x;i++) {
		for (j = 0;j < y;j++) {
			dp[i][j] = 0;
		}
	}
	return 0;
}

llong rec(llong keta, llong sum) {

	int r;
	int i;
	llong ret = 0;

	roop++;
	//printf("keta=%lld,sum=%lld,roop=%d\n",keta,sum,roop);

		//再帰の終了条件と返り値を書く

	if (sum >= ketamax[keta]) {
		return sanjo[keta];
	}else if(sum==0){
		return 1;
	}else if (keta == 1) {
		return sum+1;
	}

	//今の桁の数字を数値に直すのとroop回数を決める

	//x=(int)n[keta]-'0';

	r = min(2,sum/nijo[keta]);

	if (dp[keta][r] > 0) {
		return dp[keta][r];
	}


	//再帰先(rec())を書く
	for (i = 0;i <= r;i++) {
		ret = ret + rec(keta - 1, sum - i*nijo[keta]);
		ret = ret % 1000000007;
	}

	dp[keta][r] = ret;
	return ret;
}

int main(void)
{
	//変数の宣言
	llong n;

	//よく使う変数
	int i, j, k, l;
	int flag = 0;
	llong int ans = 0;
	int count = 0;
	llong int temp, temp1, temp2;
	int max, min;
	int len;
	int sum = 0;
	int under, upper, middle;
	int dummy;

	//データの読み込み
	scanf("%lld", &n);
	//scanf_s("%lld", &n);

	//	printf("nは%dです\n", n);
	//	printf("データの読み込み終了\n");
	//実際の処理

	temp = 1;
	count = 1;
	ketamax[1] = 2;
	nijo[1] = 1;
	sanjo[1] = 3;
	
	while (temp < n) {
		temp = temp * 2;
		count++;
		ketamax[count] = temp*4-2;
		nijo[count] = nijo[count - 1] * 2;
	}

	for (i = 1;i <= count;i++) {
		if (i == 1) {
			sanjo[i] = 3;
		}
		else {
			sanjo[i] = (sanjo[i - 1] * 3) % 1000000007;
		}
	}

	init(80, 4);
	ans = rec(count, n);

	//	printf("計算部分終了\n");
	//出力

	printf("%lld", ans);


	//	printf("結果の出力終了\n");

	return 0;

}

```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	ketamax
	.bss
	.align 32
	.type	ketamax, @object
	.size	ketamax, 640
ketamax:
	.zero	640
	.globl	sanjo
	.align 32
	.type	sanjo, @object
	.size	sanjo, 640
sanjo:
	.zero	640
	.globl	nijo
	.align 32
	.type	nijo, @object
	.size	nijo, 640
nijo:
	.zero	640
	.globl	roop
	.align 4
	.type	roop, @object
	.size	roop, 4
roop:
	.zero	4
	.globl	dp
	.align 32
	.type	dp, @object
	.size	dp, 2000
dp:
	.zero	2000
	.text
	.globl	init
	.type	init, @function
init:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	movl	$1, -8(%rbp)
	jmp	.L2
.L5:
	movl	$0, -4(%rbp)
	jmp	.L3
.L4:
	movl	-4(%rbp), %eax
	movslq	%eax, %rcx
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	dp(%rip), %rax
	movl	$0, (%rdx,%rax)
	addl	$1, -4(%rbp)
.L3:
	movl	-4(%rbp), %eax
	cmpl	-24(%rbp), %eax
	jl	.L4
	addl	$1, -8(%rbp)
.L2:
	movl	-8(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jle	.L5
	movl	$0, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	init, .-init
	.globl	rec
	.type	rec, @function
rec:
.LFB7:
	.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
	movq	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movq	$0, -8(%rbp)
	movl	roop(%rip), %eax
	addl	$1, %eax
	movl	%eax, roop(%rip)
	movq	-24(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	ketamax(%rip), %rax
	movq	(%rdx,%rax), %rax
	cmpq	%rax, -32(%rbp)
	jl	.L8
	movq	-24(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	sanjo(%rip), %rax
	movq	(%rdx,%rax), %rax
	jmp	.L9
.L8:
	cmpq	$0, -32(%rbp)
	jne	.L10
	movl	$1, %eax
	jmp	.L9
.L10:
	cmpq	$1, -24(%rbp)
	jne	.L11
	movq	-32(%rbp), %rax
	addq	$1, %rax
	jmp	.L9
.L11:
	movq	-24(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	nijo(%rip), %rax
	movq	(%rdx,%rax), %rdi
	movq	-32(%rbp), %rax
	cqto
	idivq	%rdi
	movq	%rax, %rdx
	movl	$2, %eax
	cmpq	%rax, %rdx
	cmovle	%rdx, %rax
	movl	%eax, -12(%rbp)
	movl	-12(%rbp), %eax
	movslq	%eax, %rcx
	movq	-24(%rbp), %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	dp(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	jle	.L12
	movl	-12(%rbp), %eax
	movslq	%eax, %rcx
	movq	-24(%rbp), %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	dp(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	jmp	.L9
.L12:
	movl	$0, -16(%rbp)
	jmp	.L13
.L14:
	movl	-16(%rbp), %eax
	movslq	%eax, %rdx
	movq	-24(%rbp), %rax
	leaq	0(,%rax,8), %rcx
	leaq	nijo(%rip), %rax
	movq	(%rcx,%rax), %rax
	movq	%rdx, %rcx
	imulq	%rax, %rcx
	movq	-32(%rbp), %rax
	subq	%rcx, %rax
	movq	%rax, %rdx
	movq	-24(%rbp), %rax
	subq	$1, %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	rec
	addq	%rax, -8(%rbp)
	movq	-8(%rbp), %rcx
	movabsq	$-8543223828751151131, %rdx
	movq	%rcx, %rax
	imulq	%rdx
	leaq	(%rdx,%rcx), %rax
	sarq	$29, %rax
	movq	%rcx, %rdx
	sarq	$63, %rdx
	subq	%rdx, %rax
	imulq	$1000000007, %rax, %rdx
	movq	%rcx, %rax
	subq	%rdx, %rax
	movq	%rax, -8(%rbp)
	addl	$1, -16(%rbp)
.L13:
	movl	-16(%rbp), %eax
	cmpl	-12(%rbp), %eax
	jle	.L14
	movq	-8(%rbp), %rax
	movl	%eax, %ecx
	movl	-12(%rbp), %eax
	movslq	%eax, %rsi
	movq	-24(%rbp), %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	dp(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movq	-8(%rbp), %rax
.L9:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	rec, .-rec
	.section	.rodata
.LC0:
	.string	"%lld"
	.text
	.globl	main
	.type	main, @function
main:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -40(%rbp)
	movq	$0, -16(%rbp)
	movl	$0, -44(%rbp)
	movl	$0, -36(%rbp)
	leaq	-32(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	$1, -24(%rbp)
	movl	$1, -44(%rbp)
	movq	$2, 8+ketamax(%rip)
	movq	$1, 8+nijo(%rip)
	movq	$3, 8+sanjo(%rip)
	jmp	.L16
.L17:
	salq	-24(%rbp)
	addl	$1, -44(%rbp)
	movq	-24(%rbp), %rax
	salq	$2, %rax
	leaq	-2(%rax), %rcx
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	ketamax(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	movl	-44(%rbp), %eax
	subl	$1, %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	nijo(%rip), %rax
	movq	(%rdx,%rax), %rax
	leaq	(%rax,%rax), %rcx
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	nijo(%rip), %rax
	movq	%rcx, (%rdx,%rax)
.L16:
	movq	-32(%rbp), %rax
	cmpq	%rax, -24(%rbp)
	jl	.L17
	movl	$1, -48(%rbp)
	jmp	.L18
.L21:
	cmpl	$1, -48(%rbp)
	jne	.L19
	movl	-48(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	sanjo(%rip), %rax
	movq	$3, (%rdx,%rax)
	jmp	.L20
.L19:
	movl	-48(%rbp), %eax
	subl	$1, %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	sanjo(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	leaq	(%rax,%rdx), %rcx
	movabsq	$-8543223828751151131, %rdx
	movq	%rcx, %rax
	imulq	%rdx
	leaq	(%rdx,%rcx), %rax
	sarq	$29, %rax
	movq	%rcx, %rdx
	sarq	$63, %rdx
	subq	%rdx, %rax
	imulq	$1000000007, %rax, %rdx
	movq	%rcx, %rax
	subq	%rdx, %rax
	movl	-48(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	sanjo(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
.L20:
	addl	$1, -48(%rbp)
.L18:
	movl	-48(%rbp), %eax
	cmpl	-44(%rbp), %eax
	jle	.L21
	movl	$4, %esi
	movl	$80, %edi
	call	init
	movq	-32(%rbp), %rdx
	movl	-44(%rbp), %eax
	cltq
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	rec
	movq	%rax, -16(%rbp)
	movq	-16(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L23
	call	__stack_chk_fail@PLT
.L23:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.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
	.type	rec.part.0, @function
rec.part.0:
.LFB54:
	.cfi_startproc
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	nijo(%rip), %rax
	leaq	dp(%rip), %r8
	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	$40, %rsp
	.cfi_def_cfa_offset 96
	movq	(%rax,%rdi,8), %r14
	movq	%rsi, %rax
	cqto
	idivq	%r14
	movl	$2, %edx
	cmpq	%rdx, %rax
	cmovg	%rdx, %rax
	leaq	(%rdi,%rdi,4), %rdx
	movslq	%eax, %r9
	addq	%r9, %rdx
	movslq	(%r8,%rdx,4), %r12
	testl	%r12d, %r12d
	jg	.L1
	movq	%rdi, %rbp
	xorl	%edx, %edx
	xorl	%r12d, %r12d
	testl	%eax, %eax
	js	.L4
	leaq	-1(%rdi), %rdi
	leaq	ketamax(%rip), %rdx
	movq	(%rdx,%rdi,8), %r10
	cmpq	$1, %rdi
	je	.L6
	movl	%eax, %ecx
	movq	%rsi, %rbx
	xorl	%r12d, %r12d
	xorl	%r13d, %r13d
	movabsq	$-8543223828751151131, %r15
.L9:
	addl	$1, roop(%rip)
	cmpq	%rbx, %r10
	jle	.L7
	movl	$1, %esi
	testq	%rbx, %rbx
	je	.L8
	movq	%rbx, %rsi
	movq	%r9, 24(%rsp)
	movq	%r10, 16(%rsp)
	movl	%ecx, 12(%rsp)
	movq	%rdi, (%rsp)
	call	rec.part.0
	movq	(%rsp), %rdi
	movl	12(%rsp), %ecx
	leaq	dp(%rip), %r8
	movq	16(%rsp), %r10
	movq	24(%rsp), %r9
	movq	%rax, %rsi
.L8:
	addq	%r12, %rsi
	addl	$1, %r13d
	subq	%r14, %rbx
	movq	%rsi, %rax
	imulq	%r15
	movq	%rsi, %rax
	sarq	$63, %rax
	leaq	(%rdx,%rsi), %r12
	sarq	$29, %r12
	subq	%rax, %r12
	imulq	$1000000007, %r12, %rax
	subq	%rax, %rsi
	movq	%rsi, %r12
	cmpl	%r13d, %ecx
	jge	.L9
.L10:
	movl	%r12d, %edx
.L4:
	leaq	0(%rbp,%rbp,4), %rax
	addq	%r9, %rax
	movl	%edx, (%r8,%rax,4)
.L1:
	addq	$40, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	movq	%r12, %rax
	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
.L7:
	.cfi_restore_state
	leaq	sanjo(%rip), %rax
	movq	(%rax,%rdi,8), %rsi
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L6:
	movl	roop(%rip), %r11d
	movq	%rsi, %rbx
	leal	1(%rax), %ecx
	xorl	%r12d, %r12d
	xorl	%edi, %edi
	movl	$1, %r15d
	movabsq	$-8543223828751151131, %r13
.L13:
	movq	8+sanjo(%rip), %rsi
	addl	$1, %r11d
	cmpq	%rbx, %r10
	jle	.L12
	leaq	1(%rbx), %rsi
	testq	%rbx, %rbx
	cmove	%r15, %rsi
.L12:
	addq	%r12, %rsi
	addl	$1, %edi
	subq	%r14, %rbx
	movq	%rsi, %rax
	imulq	%r13
	movq	%rsi, %rax
	sarq	$63, %rax
	leaq	(%rdx,%rsi), %r12
	sarq	$29, %r12
	subq	%rax, %r12
	imulq	$1000000007, %r12, %rax
	subq	%rax, %rsi
	movq	%rsi, %r12
	cmpl	%ecx, %edi
	jne	.L13
	movl	%r11d, roop(%rip)
	jmp	.L10
	.cfi_endproc
.LFE54:
	.size	rec.part.0, .-rec.part.0
	.p2align 4
	.globl	init
	.type	init, @function
init:
.LFB51:
	.cfi_startproc
	endbr64
	testl	%edi, %edi
	jle	.L26
	testl	%esi, %esi
	jle	.L26
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	leal	-1(%rdi), %eax
	leaq	20+dp(%rip), %rcx
	movslq	%esi, %rsi
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	leaq	(%rax,%rax,4), %rdx
	leaq	20(%rcx), %rax
	leaq	(%rax,%rdx,4), %rbp
	leaq	0(,%rsi,4), %rbx
	subq	$8, %rsp
	.cfi_def_cfa_offset 32
	.p2align 4,,10
	.p2align 3
.L23:
	movq	%rcx, %rdi
	movq	%rbx, %rdx
	xorl	%esi, %esi
	call	memset@PLT
	movq	%rax, %rcx
	addq	$20, %rcx
	cmpq	%rbp, %rcx
	jne	.L23
	addq	$8, %rsp
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
.L26:
	.cfi_restore 3
	.cfi_restore 6
	xorl	%eax, %eax
	ret
	.cfi_endproc
.LFE51:
	.size	init, .-init
	.p2align 4
	.globl	rec
	.type	rec, @function
rec:
.LFB52:
	.cfi_startproc
	endbr64
	leaq	ketamax(%rip), %rax
	addl	$1, roop(%rip)
	cmpq	%rsi, (%rax,%rdi,8)
	jle	.L34
	testq	%rsi, %rsi
	je	.L33
	cmpq	$1, %rdi
	je	.L35
	jmp	rec.part.0
	.p2align 4,,10
	.p2align 3
.L33:
	movl	$1, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L34:
	leaq	sanjo(%rip), %rax
	movq	(%rax,%rdi,8), %rax
	ret
	.p2align 4,,10
	.p2align 3
.L35:
	leaq	1(%rsi), %rax
	ret
	.cfi_endproc
.LFE52:
	.size	rec, .-rec
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%lld"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB53:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	leaq	.LC0(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	movq	%rbp, %rdi
	subq	$24, %rsp
	.cfi_def_cfa_offset 48
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rsi
	call	__isoc99_scanf@PLT
	movq	(%rsp), %r8
	movq	$2, 8+ketamax(%rip)
	movq	$1, 8+nijo(%rip)
	movq	$3, 8+sanjo(%rip)
	cmpq	$1, %r8
	jle	.L44
	movl	$2, %eax
	movl	$1, %ecx
	movl	$1, %edx
	leaq	ketamax(%rip), %r10
	leaq	nijo(%rip), %r9
	.p2align 4,,10
	.p2align 3
.L38:
	movq	%rdx, %rsi
	addq	%rcx, %rcx
	addq	%rdx, %rdx
	movslq	%eax, %rdi
	leaq	-2(,%rsi,8), %rsi
	movq	%rcx, (%r9,%rax,8)
	movq	%rsi, (%r10,%rax,8)
	addq	$1, %rax
	cmpq	%r8, %rdx
	jl	.L38
.L37:
	leaq	sanjo(%rip), %rbx
	leal	1(%rdi), %r9d
	movl	$1, %ecx
	movabsq	$-8543223828751151131, %r10
	leaq	-8(%rbx), %r11
	jmp	.L41
	.p2align 4,,10
	.p2align 3
.L39:
	movq	(%r11,%rcx,8), %rax
	leaq	(%rax,%rax,2), %rsi
	movq	%rsi, %rax
	imulq	%r10
	movq	%rsi, %rax
	sarq	$63, %rax
	addq	%rsi, %rdx
	sarq	$29, %rdx
	subq	%rax, %rdx
	imulq	$1000000007, %rdx, %rdx
	subq	%rdx, %rsi
	movq	%rsi, (%rbx,%rcx,8)
	addq	$1, %rcx
	cmpq	%r9, %rcx
	je	.L49
.L41:
	cmpq	$1, %rcx
	jne	.L39
	movq	$3, 8+sanjo(%rip)
	addq	$1, %rcx
	cmpq	%r9, %rcx
	jne	.L41
.L49:
	leaq	20+dp(%rip), %rax
	pxor	%xmm0, %xmm0
	leaq	1600(%rax), %rdx
	.p2align 4,,10
	.p2align 3
.L42:
	movups	%xmm0, (%rax)
	addq	$20, %rax
	cmpq	%rax, %rdx
	jne	.L42
	movq	%r8, %rsi
	call	rec
	movq	%rbp, %rsi
	movl	$1, %edi
	movq	%rax, %rdx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L50
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
.L44:
	.cfi_restore_state
	movl	$1, %edi
	jmp	.L37
.L50:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE53:
	.size	main, .-main
	.globl	dp
	.bss
	.align 32
	.type	dp, @object
	.size	dp, 2000
dp:
	.zero	2000
	.globl	roop
	.align 4
	.type	roop, @object
	.size	roop, 4
roop:
	.zero	4
	.globl	nijo
	.align 32
	.type	nijo, @object
	.size	nijo, 640
nijo:
	.zero	640
	.globl	sanjo
	.align 32
	.type	sanjo, @object
	.size	sanjo, 640
sanjo:
	.zero	640
	.globl	ketamax
	.align 32
	.type	ketamax, @object
	.size	ketamax, 640
ketamax:
	.zero	640
	.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	rec.part.0, @function
rec.part.0:
.LFB54:
	.cfi_startproc
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	nijo(%rip), %rax
	leaq	dp(%rip), %r8
	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	$40, %rsp
	.cfi_def_cfa_offset 96
	movq	(%rax,%rdi,8), %r14
	movq	%rsi, %rax
	cqto
	idivq	%r14
	movl	$2, %edx
	cmpq	%rdx, %rax
	cmovg	%rdx, %rax
	leaq	(%rdi,%rdi,4), %rdx
	movslq	%eax, %r9
	addq	%r9, %rdx
	movslq	(%r8,%rdx,4), %r12
	testl	%r12d, %r12d
	jg	.L1
	movq	%rdi, %rbp
	xorl	%edx, %edx
	xorl	%r12d, %r12d
	testl	%eax, %eax
	js	.L4
	leaq	-1(%rdi), %rdi
	leaq	ketamax(%rip), %rdx
	movq	(%rdx,%rdi,8), %r10
	cmpq	$1, %rdi
	je	.L6
	movl	%eax, %ecx
	movq	%rsi, %rbx
	xorl	%r12d, %r12d
	xorl	%r13d, %r13d
	movabsq	$-8543223828751151131, %r15
.L9:
	addl	$1, roop(%rip)
	cmpq	%rbx, %r10
	jle	.L7
	movl	$1, %esi
	testq	%rbx, %rbx
	je	.L8
	movq	%rbx, %rsi
	movq	%r9, 24(%rsp)
	movq	%r10, 16(%rsp)
	movl	%ecx, 12(%rsp)
	movq	%rdi, (%rsp)
	call	rec.part.0
	movq	(%rsp), %rdi
	movl	12(%rsp), %ecx
	leaq	dp(%rip), %r8
	movq	16(%rsp), %r10
	movq	24(%rsp), %r9
	movq	%rax, %rsi
.L8:
	addq	%r12, %rsi
	addl	$1, %r13d
	subq	%r14, %rbx
	movq	%rsi, %rax
	imulq	%r15
	movq	%rsi, %rax
	sarq	$63, %rax
	leaq	(%rdx,%rsi), %r12
	sarq	$29, %r12
	subq	%rax, %r12
	imulq	$1000000007, %r12, %rax
	subq	%rax, %rsi
	movq	%rsi, %r12
	cmpl	%r13d, %ecx
	jge	.L9
.L10:
	movl	%r12d, %edx
.L4:
	leaq	0(%rbp,%rbp,4), %rax
	addq	%r9, %rax
	movl	%edx, (%r8,%rax,4)
.L1:
	addq	$40, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	movq	%r12, %rax
	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
.L7:
	.cfi_restore_state
	leaq	sanjo(%rip), %rax
	movq	(%rax,%rdi,8), %rsi
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L6:
	movl	roop(%rip), %r11d
	movq	%rsi, %rbx
	leal	1(%rax), %ecx
	xorl	%r12d, %r12d
	xorl	%edi, %edi
	movl	$1, %r15d
	movabsq	$-8543223828751151131, %r13
.L13:
	movq	8+sanjo(%rip), %rsi
	addl	$1, %r11d
	cmpq	%rbx, %r10
	jle	.L12
	leaq	1(%rbx), %rsi
	testq	%rbx, %rbx
	cmove	%r15, %rsi
.L12:
	addq	%r12, %rsi
	addl	$1, %edi
	subq	%r14, %rbx
	movq	%rsi, %rax
	imulq	%r13
	movq	%rsi, %rax
	sarq	$63, %rax
	leaq	(%rdx,%rsi), %r12
	sarq	$29, %r12
	subq	%rax, %r12
	imulq	$1000000007, %r12, %rax
	subq	%rax, %rsi
	movq	%rsi, %r12
	cmpl	%ecx, %edi
	jne	.L13
	movl	%r11d, roop(%rip)
	jmp	.L10
	.cfi_endproc
.LFE54:
	.size	rec.part.0, .-rec.part.0
	.p2align 4
	.globl	init
	.type	init, @function
init:
.LFB51:
	.cfi_startproc
	endbr64
	testl	%edi, %edi
	jle	.L26
	testl	%esi, %esi
	jle	.L26
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	leal	-1(%rdi), %eax
	leaq	20+dp(%rip), %rcx
	movslq	%esi, %rsi
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	leaq	(%rax,%rax,4), %rdx
	leaq	20(%rcx), %rax
	leaq	(%rax,%rdx,4), %rbp
	leaq	0(,%rsi,4), %rbx
	subq	$8, %rsp
	.cfi_def_cfa_offset 32
	.p2align 4,,10
	.p2align 3
.L23:
	movq	%rcx, %rdi
	movq	%rbx, %rdx
	xorl	%esi, %esi
	call	memset@PLT
	movq	%rax, %rcx
	addq	$20, %rcx
	cmpq	%rbp, %rcx
	jne	.L23
	addq	$8, %rsp
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
.L26:
	.cfi_restore 3
	.cfi_restore 6
	xorl	%eax, %eax
	ret
	.cfi_endproc
.LFE51:
	.size	init, .-init
	.p2align 4
	.globl	rec
	.type	rec, @function
rec:
.LFB52:
	.cfi_startproc
	endbr64
	leaq	ketamax(%rip), %rax
	addl	$1, roop(%rip)
	cmpq	%rsi, (%rax,%rdi,8)
	jle	.L34
	testq	%rsi, %rsi
	je	.L33
	cmpq	$1, %rdi
	je	.L35
	jmp	rec.part.0
	.p2align 4,,10
	.p2align 3
.L33:
	movl	$1, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L34:
	leaq	sanjo(%rip), %rax
	movq	(%rax,%rdi,8), %rax
	ret
	.p2align 4,,10
	.p2align 3
.L35:
	leaq	1(%rsi), %rax
	ret
	.cfi_endproc
.LFE52:
	.size	rec, .-rec
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%lld"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB53:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	leaq	.LC0(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	movq	%rbp, %rdi
	subq	$24, %rsp
	.cfi_def_cfa_offset 48
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %rsi
	call	__isoc99_scanf@PLT
	movq	(%rsp), %r8
	movq	$2, 8+ketamax(%rip)
	movq	$1, 8+nijo(%rip)
	movq	$3, 8+sanjo(%rip)
	cmpq	$1, %r8
	jle	.L44
	movl	$2, %eax
	movl	$1, %ecx
	movl	$1, %edx
	leaq	ketamax(%rip), %r10
	leaq	nijo(%rip), %r9
	.p2align 4,,10
	.p2align 3
.L38:
	movq	%rdx, %rsi
	addq	%rcx, %rcx
	addq	%rdx, %rdx
	movslq	%eax, %rdi
	leaq	-2(,%rsi,8), %rsi
	movq	%rcx, (%r9,%rax,8)
	movq	%rsi, (%r10,%rax,8)
	addq	$1, %rax
	cmpq	%r8, %rdx
	jl	.L38
.L37:
	leaq	sanjo(%rip), %rbx
	leal	1(%rdi), %r9d
	movl	$1, %ecx
	movabsq	$-8543223828751151131, %r10
	leaq	-8(%rbx), %r11
	jmp	.L41
	.p2align 4,,10
	.p2align 3
.L39:
	movq	(%r11,%rcx,8), %rax
	leaq	(%rax,%rax,2), %rsi
	movq	%rsi, %rax
	imulq	%r10
	movq	%rsi, %rax
	sarq	$63, %rax
	addq	%rsi, %rdx
	sarq	$29, %rdx
	subq	%rax, %rdx
	imulq	$1000000007, %rdx, %rdx
	subq	%rdx, %rsi
	movq	%rsi, (%rbx,%rcx,8)
	addq	$1, %rcx
	cmpq	%r9, %rcx
	je	.L49
.L41:
	cmpq	$1, %rcx
	jne	.L39
	movq	$3, 8+sanjo(%rip)
	addq	$1, %rcx
	cmpq	%r9, %rcx
	jne	.L41
.L49:
	leaq	20+dp(%rip), %rax
	pxor	%xmm0, %xmm0
	leaq	1600(%rax), %rdx
	.p2align 4,,10
	.p2align 3
.L42:
	movups	%xmm0, (%rax)
	addq	$20, %rax
	cmpq	%rax, %rdx
	jne	.L42
	movq	%r8, %rsi
	call	rec
	movq	%rbp, %rsi
	movl	$1, %edi
	movq	%rax, %rdx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L50
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
.L44:
	.cfi_restore_state
	movl	$1, %edi
	jmp	.L37
.L50:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE53:
	.size	main, .-main
	.globl	dp
	.bss
	.align 32
	.type	dp, @object
	.size	dp, 2000
dp:
	.zero	2000
	.globl	roop
	.align 4
	.type	roop, @object
	.size	roop, 4
roop:
	.zero	4
	.globl	nijo
	.align 32
	.type	nijo, @object
	.size	nijo, 640
nijo:
	.zero	640
	.globl	sanjo
	.align 32
	.type	sanjo, @object
	.size	sanjo, 640
sanjo:
	.zero	640
	.globl	ketamax
	.align 32
	.type	ketamax, @object
	.size	ketamax, 640
ketamax:
	.zero	640
	.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 "pch.h"
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>

#define llong long long
#define fr(i,l,r) for(i=(l);i<(r);i++)
#define min(p,q) ((p)<(q)?(p):(q))
#define max(p,q) ((p)>(q)?(p):(q))
#define INF 1000000000000//10^12

llong ketamax[80];
llong sanjo[80];
llong nijo[80];
int roop=0;
int dp[100][5];

int init(int x, int y) {
	int i, j;
	for (i = 1;i <= x;i++) {
		for (j = 0;j < y;j++) {
			dp[i][j] = 0;
		}
	}
	return 0;
}

llong rec(llong keta, llong sum) {

	int r;
	int i;
	llong ret = 0;

	roop++;
	//printf("keta=%lld,sum=%lld,roop=%d\n",keta,sum,roop);

		//再帰の終了条件と返り値を書く

	if (sum >= ketamax[keta]) {
		return sanjo[keta];
	}else if(sum==0){
		return 1;
	}else if (keta == 1) {
		return sum+1;
	}

	//今の桁の数字を数値に直すのとroop回数を決める

	//x=(int)n[keta]-'0';

	r = min(2,sum/nijo[keta]);

	if (dp[keta][r] > 0) {
		return dp[keta][r];
	}


	//再帰先(rec())を書く
	for (i = 0;i <= r;i++) {
		ret = ret + rec(keta - 1, sum - i*nijo[keta]);
		ret = ret % 1000000007;
	}

	dp[keta][r] = ret;
	return ret;
}

int main(void)
{
	//変数の宣言
	llong n;

	//よく使う変数
	int i, j, k, l;
	int flag = 0;
	llong int ans = 0;
	int count = 0;
	llong int temp, temp1, temp2;
	int max, min;
	int len;
	int sum = 0;
	int under, upper, middle;
	int dummy;

	//データの読み込み
	scanf("%lld", &n);
	//scanf_s("%lld", &n);

	//	printf("nは%dです\n", n);
	//	printf("データの読み込み終了\n");
	//実際の処理

	temp = 1;
	count = 1;
	ketamax[1] = 2;
	nijo[1] = 1;
	sanjo[1] = 3;
	
	while (temp < n) {
		temp = temp * 2;
		count++;
		ketamax[count] = temp*4-2;
		nijo[count] = nijo[count - 1] * 2;
	}

	for (i = 1;i <= count;i++) {
		if (i == 1) {
			sanjo[i] = 3;
		}
		else {
			sanjo[i] = (sanjo[i - 1] * 3) % 1000000007;
		}
	}

	init(80, 4);
	ans = rec(count, n);

	//	printf("計算部分終了\n");
	//出力

	printf("%lld", ans);


	//	printf("結果の出力終了\n");

	return 0;

}


4
 1026
 1000000001000000000
 0
 530
 1100000001000000000
 1
 706
 1100000001000010000
 2

8 29565 999867657 1 10220 355035671 2 17242 391646023 4
Given the following C code and unoptimized assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
//#include "pch.h"
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>

#define llong long long
#define fr(i,l,r) for(i=(l);i<(r);i++)
#define min(p,q) ((p)<(q)?(p):(q))
#define max(p,q) ((p)>(q)?(p):(q))
#define INF 1000000000000//10^12

llong ketamax[80];
llong sanjo[80];
llong nijo[80];
int roop=0;
int dp[100][5];

int init(int x, int y) {
	int i, j;
	for (i = 1;i <= x;i++) {
		for (j = 0;j < y;j++) {
			dp[i][j] = 0;
		}
	}
	return 0;
}

llong rec(llong keta, llong sum) {

	int r;
	int i;
	llong ret = 0;

	roop++;
	//printf("keta=%lld,sum=%lld,roop=%d\n",keta,sum,roop);

		//再帰の終了条件と返り値を書く

	if (sum >= ketamax[keta]) {
		return sanjo[keta];
	}else if(sum==0){
		return 1;
	}else if (keta == 1) {
		return sum+1;
	}

	//今の桁の数字を数値に直すのとroop回数を決める

	//x=(int)n[keta]-'0';

	r = min(2,sum/nijo[keta]);

	if (dp[keta][r] > 0) {
		return dp[keta][r];
	}


	//再帰先(rec())を書く
	for (i = 0;i <= r;i++) {
		ret = ret + rec(keta - 1, sum - i*nijo[keta]);
		ret = ret % 1000000007;
	}

	dp[keta][r] = ret;
	return ret;
}

int main(void)
{
	//変数の宣言
	llong n;

	//よく使う変数
	int i, j, k, l;
	int flag = 0;
	llong int ans = 0;
	int count = 0;
	llong int temp, temp1, temp2;
	int max, min;
	int len;
	int sum = 0;
	int under, upper, middle;
	int dummy;

	//データの読み込み
	scanf("%lld", &n);
	//scanf_s("%lld", &n);

	//	printf("nは%dです\n", n);
	//	printf("データの読み込み終了\n");
	//実際の処理

	temp = 1;
	count = 1;
	ketamax[1] = 2;
	nijo[1] = 1;
	sanjo[1] = 3;
	
	while (temp < n) {
		temp = temp * 2;
		count++;
		ketamax[count] = temp*4-2;
		nijo[count] = nijo[count - 1] * 2;
	}

	for (i = 1;i <= count;i++) {
		if (i == 1) {
			sanjo[i] = 3;
		}
		else {
			sanjo[i] = (sanjo[i - 1] * 3) % 1000000007;
		}
	}

	init(80, 4);
	ans = rec(count, n);

	//	printf("計算部分終了\n");
	//出力

	printf("%lld", ans);


	//	printf("結果の出力終了\n");

	return 0;

}

```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	ketamax
	.bss
	.align 32
	.type	ketamax, @object
	.size	ketamax, 640
ketamax:
	.zero	640
	.globl	sanjo
	.align 32
	.type	sanjo, @object
	.size	sanjo, 640
sanjo:
	.zero	640
	.globl	nijo
	.align 32
	.type	nijo, @object
	.size	nijo, 640
nijo:
	.zero	640
	.globl	roop
	.align 4
	.type	roop, @object
	.size	roop, 4
roop:
	.zero	4
	.globl	dp
	.align 32
	.type	dp, @object
	.size	dp, 2000
dp:
	.zero	2000
	.text
	.globl	init
	.type	init, @function
init:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	movl	$1, -8(%rbp)
	jmp	.L2
.L5:
	movl	$0, -4(%rbp)
	jmp	.L3
.L4:
	movl	-4(%rbp), %eax
	movslq	%eax, %rcx
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	dp(%rip), %rax
	movl	$0, (%rdx,%rax)
	addl	$1, -4(%rbp)
.L3:
	movl	-4(%rbp), %eax
	cmpl	-24(%rbp), %eax
	jl	.L4
	addl	$1, -8(%rbp)
.L2:
	movl	-8(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jle	.L5
	movl	$0, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	init, .-init
	.globl	rec
	.type	rec, @function
rec:
.LFB7:
	.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
	movq	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movq	$0, -8(%rbp)
	movl	roop(%rip), %eax
	addl	$1, %eax
	movl	%eax, roop(%rip)
	movq	-24(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	ketamax(%rip), %rax
	movq	(%rdx,%rax), %rax
	cmpq	%rax, -32(%rbp)
	jl	.L8
	movq	-24(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	sanjo(%rip), %rax
	movq	(%rdx,%rax), %rax
	jmp	.L9
.L8:
	cmpq	$0, -32(%rbp)
	jne	.L10
	movl	$1, %eax
	jmp	.L9
.L10:
	cmpq	$1, -24(%rbp)
	jne	.L11
	movq	-32(%rbp), %rax
	addq	$1, %rax
	jmp	.L9
.L11:
	movq	-24(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	nijo(%rip), %rax
	movq	(%rdx,%rax), %rdi
	movq	-32(%rbp), %rax
	cqto
	idivq	%rdi
	movq	%rax, %rdx
	movl	$2, %eax
	cmpq	%rax, %rdx
	cmovle	%rdx, %rax
	movl	%eax, -12(%rbp)
	movl	-12(%rbp), %eax
	movslq	%eax, %rcx
	movq	-24(%rbp), %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	dp(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	jle	.L12
	movl	-12(%rbp), %eax
	movslq	%eax, %rcx
	movq	-24(%rbp), %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	dp(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	jmp	.L9
.L12:
	movl	$0, -16(%rbp)
	jmp	.L13
.L14:
	movl	-16(%rbp), %eax
	movslq	%eax, %rdx
	movq	-24(%rbp), %rax
	leaq	0(,%rax,8), %rcx
	leaq	nijo(%rip), %rax
	movq	(%rcx,%rax), %rax
	movq	%rdx, %rcx
	imulq	%rax, %rcx
	movq	-32(%rbp), %rax
	subq	%rcx, %rax
	movq	%rax, %rdx
	movq	-24(%rbp), %rax
	subq	$1, %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	rec
	addq	%rax, -8(%rbp)
	movq	-8(%rbp), %rcx
	movabsq	$-8543223828751151131, %rdx
	movq	%rcx, %rax
	imulq	%rdx
	leaq	(%rdx,%rcx), %rax
	sarq	$29, %rax
	movq	%rcx, %rdx
	sarq	$63, %rdx
	subq	%rdx, %rax
	imulq	$1000000007, %rax, %rdx
	movq	%rcx, %rax
	subq	%rdx, %rax
	movq	%rax, -8(%rbp)
	addl	$1, -16(%rbp)
.L13:
	movl	-16(%rbp), %eax
	cmpl	-12(%rbp), %eax
	jle	.L14
	movq	-8(%rbp), %rax
	movl	%eax, %ecx
	movl	-12(%rbp), %eax
	movslq	%eax, %rsi
	movq	-24(%rbp), %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	dp(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movq	-8(%rbp), %rax
.L9:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	rec, .-rec
	.section	.rodata
.LC0:
	.string	"%lld"
	.text
	.globl	main
	.type	main, @function
main:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -40(%rbp)
	movq	$0, -16(%rbp)
	movl	$0, -44(%rbp)
	movl	$0, -36(%rbp)
	leaq	-32(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	$1, -24(%rbp)
	movl	$1, -44(%rbp)
	movq	$2, 8+ketamax(%rip)
	movq	$1, 8+nijo(%rip)
	movq	$3, 8+sanjo(%rip)
	jmp	.L16
.L17:
	salq	-24(%rbp)
	addl	$1, -44(%rbp)
	movq	-24(%rbp), %rax
	salq	$2, %rax
	leaq	-2(%rax), %rcx
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	ketamax(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	movl	-44(%rbp), %eax
	subl	$1, %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	nijo(%rip), %rax
	movq	(%rdx,%rax), %rax
	leaq	(%rax,%rax), %rcx
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	nijo(%rip), %rax
	movq	%rcx, (%rdx,%rax)
.L16:
	movq	-32(%rbp), %rax
	cmpq	%rax, -24(%rbp)
	jl	.L17
	movl	$1, -48(%rbp)
	jmp	.L18
.L21:
	cmpl	$1, -48(%rbp)
	jne	.L19
	movl	-48(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	sanjo(%rip), %rax
	movq	$3, (%rdx,%rax)
	jmp	.L20
.L19:
	movl	-48(%rbp), %eax
	subl	$1, %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	sanjo(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	leaq	(%rax,%rdx), %rcx
	movabsq	$-8543223828751151131, %rdx
	movq	%rcx, %rax
	imulq	%rdx
	leaq	(%rdx,%rcx), %rax
	sarq	$29, %rax
	movq	%rcx, %rdx
	sarq	$63, %rdx
	subq	%rdx, %rax
	imulq	$1000000007, %rax, %rdx
	movq	%rcx, %rax
	subq	%rdx, %rax
	movl	-48(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	sanjo(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
.L20:
	addl	$1, -48(%rbp)
.L18:
	movl	-48(%rbp), %eax
	cmpl	-44(%rbp), %eax
	jle	.L21
	movl	$4, %esi
	movl	$80, %edi
	call	init
	movq	-32(%rbp), %rdx
	movl	-44(%rbp), %eax
	cltq
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	rec
	movq	%rax, -16(%rbp)
	movq	-16(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L23
	call	__stack_chk_fail@PLT
.L23:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.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	ketamax
	.bss
	.align 32
	.type	ketamax, @object
	.size	ketamax, 640
ketamax:
	.zero	640
	.globl	sanjo
	.align 32
	.type	sanjo, @object
	.size	sanjo, 640
sanjo:
	.zero	640
	.globl	nijo
	.align 32
	.type	nijo, @object
	.size	nijo, 640
nijo:
	.zero	640
	.globl	roop
	.align 4
	.type	roop, @object
	.size	roop, 4
roop:
	.zero	4
	.globl	dp
	.align 32
	.type	dp, @object
	.size	dp, 2000
dp:
	.zero	2000
	.text
	.globl	init
	.type	init, @function
init:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	movl	$1, -8(%rbp)
	jmp	.L2
.L5:
	movl	$0, -4(%rbp)
	jmp	.L3
.L4:
	movl	-4(%rbp), %eax
	movslq	%eax, %rcx
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	dp(%rip), %rax
	movl	$0, (%rdx,%rax)
	addl	$1, -4(%rbp)
.L3:
	movl	-4(%rbp), %eax
	cmpl	-24(%rbp), %eax
	jl	.L4
	addl	$1, -8(%rbp)
.L2:
	movl	-8(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jle	.L5
	movl	$0, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	init, .-init
	.globl	rec
	.type	rec, @function
rec:
.LFB7:
	.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
	movq	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movq	$0, -8(%rbp)
	movl	roop(%rip), %eax
	addl	$1, %eax
	movl	%eax, roop(%rip)
	movq	-24(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	ketamax(%rip), %rax
	movq	(%rdx,%rax), %rax
	cmpq	%rax, -32(%rbp)
	jl	.L8
	movq	-24(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	sanjo(%rip), %rax
	movq	(%rdx,%rax), %rax
	jmp	.L9
.L8:
	cmpq	$0, -32(%rbp)
	jne	.L10
	movl	$1, %eax
	jmp	.L9
.L10:
	cmpq	$1, -24(%rbp)
	jne	.L11
	movq	-32(%rbp), %rax
	addq	$1, %rax
	jmp	.L9
.L11:
	movq	-24(%rbp), %rax
	leaq	0(,%rax,8), %rdx
	leaq	nijo(%rip), %rax
	movq	(%rdx,%rax), %rdi
	movq	-32(%rbp), %rax
	cqto
	idivq	%rdi
	movq	%rax, %rdx
	movl	$2, %eax
	cmpq	%rax, %rdx
	cmovle	%rdx, %rax
	movl	%eax, -12(%rbp)
	movl	-12(%rbp), %eax
	movslq	%eax, %rcx
	movq	-24(%rbp), %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	dp(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	jle	.L12
	movl	-12(%rbp), %eax
	movslq	%eax, %rcx
	movq	-24(%rbp), %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	dp(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	jmp	.L9
.L12:
	movl	$0, -16(%rbp)
	jmp	.L13
.L14:
	movl	-16(%rbp), %eax
	movslq	%eax, %rdx
	movq	-24(%rbp), %rax
	leaq	0(,%rax,8), %rcx
	leaq	nijo(%rip), %rax
	movq	(%rcx,%rax), %rax
	movq	%rdx, %rcx
	imulq	%rax, %rcx
	movq	-32(%rbp), %rax
	subq	%rcx, %rax
	movq	%rax, %rdx
	movq	-24(%rbp), %rax
	subq	$1, %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	rec
	addq	%rax, -8(%rbp)
	movq	-8(%rbp), %rcx
	movabsq	$-8543223828751151131, %rdx
	movq	%rcx, %rax
	imulq	%rdx
	leaq	(%rdx,%rcx), %rax
	sarq	$29, %rax
	movq	%rcx, %rdx
	sarq	$63, %rdx
	subq	%rdx, %rax
	imulq	$1000000007, %rax, %rdx
	movq	%rcx, %rax
	subq	%rdx, %rax
	movq	%rax, -8(%rbp)
	addl	$1, -16(%rbp)
.L13:
	movl	-16(%rbp), %eax
	cmpl	-12(%rbp), %eax
	jle	.L14
	movq	-8(%rbp), %rax
	movl	%eax, %ecx
	movl	-12(%rbp), %eax
	movslq	%eax, %rsi
	movq	-24(%rbp), %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	dp(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movq	-8(%rbp), %rax
.L9:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	rec, .-rec
	.section	.rodata
.LC0:
	.string	"%lld"
	.text
	.globl	main
	.type	main, @function
main:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -40(%rbp)
	movq	$0, -16(%rbp)
	movl	$0, -44(%rbp)
	movl	$0, -36(%rbp)
	leaq	-32(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	$1, -24(%rbp)
	movl	$1, -44(%rbp)
	movq	$2, 8+ketamax(%rip)
	movq	$1, 8+nijo(%rip)
	movq	$3, 8+sanjo(%rip)
	jmp	.L16
.L17:
	salq	-24(%rbp)
	addl	$1, -44(%rbp)
	movq	-24(%rbp), %rax
	salq	$2, %rax
	leaq	-2(%rax), %rcx
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	ketamax(%rip), %rax
	movq	%rcx, (%rdx,%rax)
	movl	-44(%rbp), %eax
	subl	$1, %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	nijo(%rip), %rax
	movq	(%rdx,%rax), %rax
	leaq	(%rax,%rax), %rcx
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	nijo(%rip), %rax
	movq	%rcx, (%rdx,%rax)
.L16:
	movq	-32(%rbp), %rax
	cmpq	%rax, -24(%rbp)
	jl	.L17
	movl	$1, -48(%rbp)
	jmp	.L18
.L21:
	cmpl	$1, -48(%rbp)
	jne	.L19
	movl	-48(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	sanjo(%rip), %rax
	movq	$3, (%rdx,%rax)
	jmp	.L20
.L19:
	movl	-48(%rbp), %eax
	subl	$1, %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	sanjo(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	leaq	(%rax,%rdx), %rcx
	movabsq	$-8543223828751151131, %rdx
	movq	%rcx, %rax
	imulq	%rdx
	leaq	(%rdx,%rcx), %rax
	sarq	$29, %rax
	movq	%rcx, %rdx
	sarq	$63, %rdx
	subq	%rdx, %rax
	imulq	$1000000007, %rax, %rdx
	movq	%rcx, %rax
	subq	%rdx, %rax
	movl	-48(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	sanjo(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
.L20:
	addl	$1, -48(%rbp)
.L18:
	movl	-48(%rbp), %eax
	cmpl	-44(%rbp), %eax
	jle	.L21
	movl	$4, %esi
	movl	$80, %edi
	call	init
	movq	-32(%rbp), %rdx
	movl	-44(%rbp), %eax
	cltq
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	rec
	movq	%rax, -16(%rbp)
	movq	-16(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L23
	call	__stack_chk_fail@PLT
.L23:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.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:
