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>

typedef struct re {
    int adj[500];
    int cnt;
} graph;

graph g[100100];
int dp[100100];

int max(int a, int b) {
    return (a > b ? a : b);
}

int cal(int v) {
    if (!dp[v]) {
        for (int i = 0; i < g[v].cnt; i++) {
            dp[v] = max(dp[v], cal(g[v].adj[i]));
        }
        dp[v]++;
    }
    return dp[v];
}

int n, m;
 
int main() {
    scanf("%d%d", &n, &m);
    for (int i = 0; i < n; i++) {
        g[i].cnt = 0; 
    }

    for (int i = 0; i < m; i++) {
        int u, v;
        scanf("%d%d", &u, &v);
        u--, v--;
        g[u].adj[g[u].cnt++] = v;
    }

    int res = 0;
    for (int i = 0; i < n; i++) res = max(res, cal(i));

    printf("%d\n", res - 1);
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	g
	.bss
	.align 32
	.type	g, @object
	.size	g, 200600400
g:
	.zero	200600400
	.globl	dp
	.align 32
	.type	dp, @object
	.size	dp, 400400
dp:
	.zero	400400
	.text
	.globl	max
	.type	max, @function
max:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	-8(%rbp), %edx
	movl	-4(%rbp), %eax
	cmpl	%eax, %edx
	cmovge	%edx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	max, .-max
	.globl	cal
	.type	cal, @function
cal:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movl	%edi, -20(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dp(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	jne	.L4
	movl	$0, -4(%rbp)
	jmp	.L5
.L6:
	movl	-4(%rbp), %eax
	movslq	%eax, %rdx
	movl	-20(%rbp), %eax
	cltq
	imulq	$501, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	g(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %edi
	call	cal
	movl	%eax, %edx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	dp(%rip), %rax
	movl	(%rcx,%rax), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	max
	movl	-20(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	dp(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	addl	$1, -4(%rbp)
.L5:
	movl	-20(%rbp), %eax
	cltq
	imulq	$2004, %rax, %rax
	leaq	2000+g(%rip), %rdx
	movl	(%rax,%rdx), %eax
	cmpl	%eax, -4(%rbp)
	jl	.L6
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dp(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	1(%rax), %ecx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dp(%rip), %rax
	movl	%ecx, (%rdx,%rax)
.L4:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dp(%rip), %rax
	movl	(%rdx,%rax), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	cal, .-cal
	.globl	n
	.bss
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	m
	.align 4
	.type	m, @object
	.size	m, 4
m:
	.zero	4
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB2:
	.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	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	m(%rip), %rax
	movq	%rax, %rdx
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -24(%rbp)
	jmp	.L9
.L10:
	movl	-24(%rbp), %eax
	cltq
	imulq	$2004, %rax, %rax
	leaq	2000+g(%rip), %rdx
	movl	$0, (%rax,%rdx)
	addl	$1, -24(%rbp)
.L9:
	movl	n(%rip), %eax
	cmpl	%eax, -24(%rbp)
	jl	.L10
	movl	$0, -20(%rbp)
	jmp	.L11
.L12:
	leaq	-28(%rbp), %rdx
	leaq	-32(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-32(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -32(%rbp)
	movl	-28(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -28(%rbp)
	movl	-32(%rbp), %esi
	movl	-32(%rbp), %edx
	movslq	%edx, %rax
	imulq	$2004, %rax, %rax
	leaq	2000+g(%rip), %rcx
	movl	(%rax,%rcx), %eax
	leal	1(%rax), %ecx
	movslq	%edx, %rdx
	imulq	$2004, %rdx, %rdx
	leaq	2000+g(%rip), %rdi
	movl	%ecx, (%rdx,%rdi)
	movl	-28(%rbp), %edx
	movslq	%eax, %rcx
	movslq	%esi, %rax
	imulq	$501, %rax, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rcx
	leaq	g(%rip), %rax
	movl	%edx, (%rcx,%rax)
	addl	$1, -20(%rbp)
.L11:
	movl	m(%rip), %eax
	cmpl	%eax, -20(%rbp)
	jl	.L12
	movl	$0, -16(%rbp)
	movl	$0, -12(%rbp)
	jmp	.L13
.L14:
	movl	-12(%rbp), %eax
	movl	%eax, %edi
	call	cal
	movl	%eax, %edx
	movl	-16(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	max
	movl	%eax, -16(%rbp)
	addl	$1, -12(%rbp)
.L13:
	movl	n(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L14
	movl	-16(%rbp), %eax
	subl	$1, %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L16
	call	__stack_chk_fail@PLT
.L16:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
user
	.file	"temp.c"
	.text
	.p2align 4
	.globl	max
	.type	max, @function
max:
.LFB23:
	.cfi_startproc
	endbr64
	cmpl	%edi, %esi
	movl	%edi, %eax
	cmovge	%esi, %eax
	ret
	.cfi_endproc
.LFE23:
	.size	max, .-max
	.p2align 4
	.globl	cal
	.type	cal, @function
cal:
.LFB24:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movslq	%edi, %rdi
	leaq	dp(%rip), %r15
	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	$264, %rsp
	.cfi_def_cfa_offset 320
	movl	(%r15,%rdi,4), %eax
	movq	%rdi, 216(%rsp)
	testl	%eax, %eax
	jne	.L3
	imulq	$2004, %rdi, %rdi
	leaq	g(%rip), %r14
	leaq	(%r14,%rdi), %rsi
	movq	%rdi, 248(%rsp)
	movq	%rsi, 232(%rsp)
	movl	2000(%rsi), %esi
	testl	%esi, %esi
	jle	.L5
	movq	$0, 176(%rsp)
.L30:
	movq	232(%rsp), %rdi
	movq	176(%rsp), %rbx
	movslq	(%rdi,%rbx,4), %rbx
	movl	(%r15,%rbx,4), %edx
	movq	%rbx, 184(%rsp)
	testl	%edx, %edx
	jne	.L6
	imulq	$2004, %rbx, %rax
	movq	%rax, 240(%rsp)
	addq	%r14, %rax
	movl	2000(%rax), %edi
	movq	%rax, 208(%rsp)
	testl	%edi, %edi
	jle	.L7
	movq	$0, 144(%rsp)
.L29:
	movq	208(%rsp), %rax
	movq	144(%rsp), %rsi
	movslq	(%rax,%rsi,4), %rcx
	movl	(%r15,%rcx,4), %eax
	movq	%rcx, 152(%rsp)
	testl	%eax, %eax
	jne	.L8
	imulq	$2004, %rcx, %rsi
	leaq	(%r14,%rsi), %rcx
	movq	%rsi, 224(%rsp)
	movq	%rcx, 192(%rsp)
	movl	2000(%rcx), %ecx
	testl	%ecx, %ecx
	jle	.L9
	movq	$0, 112(%rsp)
.L28:
	movq	192(%rsp), %rdi
	movq	112(%rsp), %rsi
	movslq	(%rdi,%rsi,4), %rsi
	movl	(%r15,%rsi,4), %edx
	movq	%rsi, 120(%rsp)
	testl	%edx, %edx
	jne	.L10
	imulq	$2004, %rsi, %rax
	movq	%rax, 200(%rsp)
	addq	%r14, %rax
	movl	2000(%rax), %esi
	movq	%rax, 160(%rsp)
	testl	%esi, %esi
	jle	.L11
	movq	$0, 80(%rsp)
.L27:
	movq	160(%rsp), %rax
	movq	80(%rsp), %rdi
	movslq	(%rax,%rdi,4), %rcx
	movl	(%r15,%rcx,4), %eax
	movq	%rcx, 88(%rsp)
	testl	%eax, %eax
	jne	.L12
	imulq	$2004, %rcx, %rdi
	leaq	(%r14,%rdi), %rbx
	movq	%rdi, 168(%rsp)
	movl	2000(%rbx), %ecx
	movq	%rbx, 128(%rsp)
	testl	%ecx, %ecx
	jle	.L13
	movq	$0, 48(%rsp)
.L26:
	movq	128(%rsp), %rbx
	movq	48(%rsp), %rsi
	movslq	(%rbx,%rsi,4), %rsi
	movl	(%r15,%rsi,4), %edx
	movq	%rsi, 56(%rsp)
	testl	%edx, %edx
	jne	.L14
	imulq	$2004, %rsi, %rax
	movq	%rax, 136(%rsp)
	addq	%r14, %rax
	movl	2000(%rax), %esi
	movq	%rax, 96(%rsp)
	testl	%esi, %esi
	jle	.L15
	movq	$0, 16(%rsp)
.L25:
	movq	96(%rsp), %rax
	movq	16(%rsp), %rbx
	movslq	(%rax,%rbx,4), %rcx
	movl	(%r15,%rcx,4), %eax
	movq	%rcx, 24(%rsp)
	testl	%eax, %eax
	jne	.L16
	imulq	$2004, %rcx, %rcx
	leaq	(%r14,%rcx), %rdi
	movq	%rcx, 104(%rsp)
	movl	2000(%rdi), %ecx
	movq	%rdi, 64(%rsp)
	testl	%ecx, %ecx
	jle	.L17
	movq	$0, (%rsp)
.L24:
	movq	64(%rsp), %rdi
	movq	(%rsp), %rsi
	movslq	(%rdi,%rsi,4), %rbx
	movl	(%r15,%rbx,4), %edx
	movq	%rbx, 8(%rsp)
	testl	%edx, %edx
	jne	.L18
	imulq	$2004, %rbx, %rax
	movq	%rax, 72(%rsp)
	addq	%r14, %rax
	movl	2000(%rax), %esi
	movq	%rax, 32(%rsp)
	testl	%esi, %esi
	jle	.L19
	xorl	%r13d, %r13d
.L23:
	movq	32(%rsp), %rax
	movslq	(%rax,%r13,4), %r12
	movl	(%r15,%r12,4), %eax
	testl	%eax, %eax
	jne	.L20
	imulq	$2004, %r12, %rcx
	leaq	(%r14,%rcx), %rbx
	movl	2000(%rbx), %edx
	testl	%edx, %edx
	jle	.L21
	movq	%r13, 40(%rsp)
	xorl	%ebp, %ebp
	movq	%rbx, %r13
	movq	%rcx, %rbx
.L22:
	movl	0(%r13,%rbp,4), %edi
	call	cal
	movl	(%r15,%r12,4), %edx
	cmpl	%edx, %eax
	cmovl	%edx, %eax
	addq	$1, %rbp
	movl	%eax, (%r15,%r12,4)
	cmpl	%ebp, 2000(%r14,%rbx)
	jg	.L22
	movq	72(%rsp), %rsi
	movq	40(%rsp), %r13
	movl	2000(%r14,%rsi), %esi
.L21:
	movq	8(%rsp), %rdi
	addl	$1, %eax
	movl	%eax, (%r15,%r12,4)
	movl	(%r15,%rdi,4), %edx
.L20:
	cmpl	%eax, %edx
	cmovl	%eax, %edx
	movq	8(%rsp), %rax
	addq	$1, %r13
	movl	%edx, (%r15,%rax,4)
	cmpl	%r13d, %esi
	jg	.L23
	movq	104(%rsp), %rax
	movl	2000(%r14,%rax), %ecx
.L19:
	movq	8(%rsp), %rax
	addl	$1, %edx
	movl	%edx, (%r15,%rax,4)
	movq	24(%rsp), %rax
	movl	(%r15,%rax,4), %eax
.L18:
	cmpl	%edx, %eax
	movq	24(%rsp), %rdi
	cmovl	%edx, %eax
	addq	$1, (%rsp)
	movq	(%rsp), %rsi
	movl	%eax, (%r15,%rdi,4)
	cmpl	%esi, %ecx
	jg	.L24
	movq	136(%rsp), %rsi
	movl	2000(%r14,%rsi), %esi
.L17:
	movq	24(%rsp), %rbx
	movq	56(%rsp), %rdi
	addl	$1, %eax
	movl	%eax, (%r15,%rbx,4)
	movl	(%r15,%rdi,4), %edx
.L16:
	cmpl	%eax, %edx
	cmovl	%eax, %edx
	movq	56(%rsp), %rax
	addq	$1, 16(%rsp)
	movl	%edx, (%r15,%rax,4)
	movq	16(%rsp), %rax
	cmpl	%eax, %esi
	jg	.L25
	movq	168(%rsp), %rax
	movl	2000(%r14,%rax), %ecx
.L15:
	movq	56(%rsp), %rax
	addl	$1, %edx
	movl	%edx, (%r15,%rax,4)
	movq	88(%rsp), %rax
	movl	(%r15,%rax,4), %eax
.L14:
	cmpl	%edx, %eax
	movq	88(%rsp), %rbx
	cmovl	%edx, %eax
	addq	$1, 48(%rsp)
	movq	48(%rsp), %rdi
	movl	%eax, (%r15,%rbx,4)
	cmpl	%edi, %ecx
	jg	.L26
	movq	200(%rsp), %rsi
	movl	2000(%r14,%rsi), %esi
.L13:
	movq	88(%rsp), %rdi
	movq	120(%rsp), %rbx
	addl	$1, %eax
	movl	%eax, (%r15,%rdi,4)
	movl	(%r15,%rbx,4), %edx
.L12:
	cmpl	%eax, %edx
	cmovl	%eax, %edx
	movq	120(%rsp), %rax
	addq	$1, 80(%rsp)
	movl	%edx, (%r15,%rax,4)
	movq	80(%rsp), %rax
	cmpl	%eax, %esi
	jg	.L27
	movq	224(%rsp), %rax
	movl	2000(%r14,%rax), %ecx
.L11:
	movq	120(%rsp), %rax
	addl	$1, %edx
	movl	%edx, (%r15,%rax,4)
	movq	152(%rsp), %rax
	movl	(%r15,%rax,4), %eax
.L10:
	cmpl	%edx, %eax
	movq	152(%rsp), %rbx
	cmovl	%edx, %eax
	addq	$1, 112(%rsp)
	movl	%eax, (%r15,%rbx,4)
	movq	112(%rsp), %rbx
	cmpl	%ebx, %ecx
	jg	.L28
	movq	240(%rsp), %rsi
	movl	2000(%r14,%rsi), %edi
.L9:
	movq	152(%rsp), %rsi
	addl	$1, %eax
	movl	%eax, (%r15,%rsi,4)
	movq	184(%rsp), %rsi
	movl	(%r15,%rsi,4), %edx
.L8:
	cmpl	%eax, %edx
	cmovl	%eax, %edx
	movq	184(%rsp), %rax
	addq	$1, 144(%rsp)
	movl	%edx, (%r15,%rax,4)
	movq	144(%rsp), %rax
	cmpl	%eax, %edi
	jg	.L29
	movq	248(%rsp), %rax
	movl	2000(%r14,%rax), %esi
.L7:
	movq	184(%rsp), %rax
	addl	$1, %edx
	movl	%edx, (%r15,%rax,4)
	movq	216(%rsp), %rax
	movl	(%r15,%rax,4), %eax
.L6:
	cmpl	%edx, %eax
	movq	216(%rsp), %rdi
	cmovl	%edx, %eax
	addq	$1, 176(%rsp)
	movl	%eax, (%r15,%rdi,4)
	movq	176(%rsp), %rdi
	cmpl	%edi, %esi
	jg	.L30
.L5:
	movq	216(%rsp), %rcx
	addl	$1, %eax
	movl	%eax, (%r15,%rcx,4)
.L3:
	addq	$264, %rsp
	.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
	.cfi_endproc
.LFE24:
	.size	cal, .-cal
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB25:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	leaq	m(%rip), %rdx
	leaq	n(%rip), %rsi
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	leaq	.LC0(%rip), %rbx
	movq	%rbx, %rdi
	subq	$16, %rsp
	.cfi_def_cfa_offset 64
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	n(%rip), %edx
	testl	%edx, %edx
	jle	.L46
	leal	-1(%rdx), %ecx
	leaq	2000+g(%rip), %rax
	imulq	$2004, %rcx, %rcx
	leaq	2004(%rax), %rsi
	addq	%rsi, %rcx
	.p2align 4,,10
	.p2align 3
.L45:
	movl	$0, (%rax)
	addq	$2004, %rax
	cmpq	%rcx, %rax
	jne	.L45
.L46:
	movl	m(%rip), %esi
	testl	%esi, %esi
	jle	.L44
	xorl	%r13d, %r13d
	leaq	4(%rsp), %r12
	movq	%rsp, %rbp
	leaq	g(%rip), %r14
	.p2align 4,,10
	.p2align 3
.L43:
	movq	%r12, %rdx
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	(%rsp), %eax
	movl	4(%rsp), %esi
	addl	$1, %r13d
	subl	$1, %eax
	subl	$1, %esi
	cltq
	imulq	$2004, %rax, %rcx
	imulq	$501, %rax, %rax
	addq	%r14, %rcx
	movslq	2000(%rcx), %rdx
	addq	%rdx, %rax
	leal	1(%rdx), %edi
	cmpl	%r13d, m(%rip)
	movl	%edi, 2000(%rcx)
	movl	%esi, (%r14,%rax,4)
	jg	.L43
	movl	n(%rip), %edx
.L44:
	leaq	dp(%rip), %r9
	leaq	g(%rip), %r10
	xorl	%ebx, %ebx
	xorl	%r11d, %r11d
	testl	%edx, %edx
	jle	.L48
	.p2align 4,,10
	.p2align 3
.L52:
	movl	(%r9), %eax
	testl	%eax, %eax
	jne	.L49
	movl	2000(%r10), %ecx
	testl	%ecx, %ecx
	jle	.L50
	xorl	%r8d, %r8d
.L51:
	movl	(%r10,%r8,4), %edi
	call	cal
	movl	(%r9), %edx
	cmpl	%edx, %eax
	cmovl	%edx, %eax
	addq	$1, %r8
	movl	%eax, (%r9)
	cmpl	%r8d, 2000(%r10)
	jg	.L51
	movl	n(%rip), %edx
.L50:
	addl	$1, %eax
	movl	%eax, (%r9)
.L49:
	cmpl	%eax, %r11d
	cmovl	%eax, %r11d
	addl	$1, %ebx
	addq	$4, %r9
	addq	$2004, %r10
	cmpl	%ebx, %edx
	jg	.L52
.L48:
	xorl	%eax, %eax
	leal	-1(%r11), %edx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L61
	addq	$16, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
.L61:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE25:
	.size	main, .-main
	.globl	m
	.bss
	.align 4
	.type	m, @object
	.size	m, 4
m:
	.zero	4
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	dp
	.align 32
	.type	dp, @object
	.size	dp, 400400
dp:
	.zero	400400
	.globl	g
	.align 32
	.type	g, @object
	.size	g, 200600400
g:
	.zero	200600400
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

rule
	.file	"temp.c"
	.text
	.p2align 4
	.globl	max
	.type	max, @function
max:
.LFB23:
	.cfi_startproc
	endbr64
	cmpl	%edi, %esi
	movl	%edi, %eax
	cmovge	%esi, %eax
	ret
	.cfi_endproc
.LFE23:
	.size	max, .-max
	.p2align 4
	.globl	cal
	.type	cal, @function
cal:
.LFB24:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movslq	%edi, %rdi
	leaq	dp(%rip), %r15
	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	$264, %rsp
	.cfi_def_cfa_offset 320
	movl	(%r15,%rdi,4), %eax
	movq	%rdi, 216(%rsp)
	testl	%eax, %eax
	jne	.L3
	imulq	$2004, %rdi, %rdi
	leaq	g(%rip), %r14
	leaq	(%r14,%rdi), %rsi
	movq	%rdi, 248(%rsp)
	movq	%rsi, 232(%rsp)
	movl	2000(%rsi), %esi
	testl	%esi, %esi
	jle	.L5
	movq	$0, 176(%rsp)
.L30:
	movq	232(%rsp), %rdi
	movq	176(%rsp), %rbx
	movslq	(%rdi,%rbx,4), %rbx
	movl	(%r15,%rbx,4), %edx
	movq	%rbx, 184(%rsp)
	testl	%edx, %edx
	jne	.L6
	imulq	$2004, %rbx, %rax
	movq	%rax, 240(%rsp)
	addq	%r14, %rax
	movl	2000(%rax), %edi
	movq	%rax, 208(%rsp)
	testl	%edi, %edi
	jle	.L7
	movq	$0, 144(%rsp)
.L29:
	movq	208(%rsp), %rax
	movq	144(%rsp), %rsi
	movslq	(%rax,%rsi,4), %rcx
	movl	(%r15,%rcx,4), %eax
	movq	%rcx, 152(%rsp)
	testl	%eax, %eax
	jne	.L8
	imulq	$2004, %rcx, %rsi
	leaq	(%r14,%rsi), %rcx
	movq	%rsi, 224(%rsp)
	movq	%rcx, 192(%rsp)
	movl	2000(%rcx), %ecx
	testl	%ecx, %ecx
	jle	.L9
	movq	$0, 112(%rsp)
.L28:
	movq	192(%rsp), %rdi
	movq	112(%rsp), %rsi
	movslq	(%rdi,%rsi,4), %rsi
	movl	(%r15,%rsi,4), %edx
	movq	%rsi, 120(%rsp)
	testl	%edx, %edx
	jne	.L10
	imulq	$2004, %rsi, %rax
	movq	%rax, 200(%rsp)
	addq	%r14, %rax
	movl	2000(%rax), %esi
	movq	%rax, 160(%rsp)
	testl	%esi, %esi
	jle	.L11
	movq	$0, 80(%rsp)
.L27:
	movq	160(%rsp), %rax
	movq	80(%rsp), %rdi
	movslq	(%rax,%rdi,4), %rcx
	movl	(%r15,%rcx,4), %eax
	movq	%rcx, 88(%rsp)
	testl	%eax, %eax
	jne	.L12
	imulq	$2004, %rcx, %rdi
	leaq	(%r14,%rdi), %rbx
	movq	%rdi, 168(%rsp)
	movl	2000(%rbx), %ecx
	movq	%rbx, 128(%rsp)
	testl	%ecx, %ecx
	jle	.L13
	movq	$0, 48(%rsp)
.L26:
	movq	128(%rsp), %rbx
	movq	48(%rsp), %rsi
	movslq	(%rbx,%rsi,4), %rsi
	movl	(%r15,%rsi,4), %edx
	movq	%rsi, 56(%rsp)
	testl	%edx, %edx
	jne	.L14
	imulq	$2004, %rsi, %rax
	movq	%rax, 136(%rsp)
	addq	%r14, %rax
	movl	2000(%rax), %esi
	movq	%rax, 96(%rsp)
	testl	%esi, %esi
	jle	.L15
	movq	$0, 16(%rsp)
.L25:
	movq	96(%rsp), %rax
	movq	16(%rsp), %rbx
	movslq	(%rax,%rbx,4), %rcx
	movl	(%r15,%rcx,4), %eax
	movq	%rcx, 24(%rsp)
	testl	%eax, %eax
	jne	.L16
	imulq	$2004, %rcx, %rcx
	leaq	(%r14,%rcx), %rdi
	movq	%rcx, 104(%rsp)
	movl	2000(%rdi), %ecx
	movq	%rdi, 64(%rsp)
	testl	%ecx, %ecx
	jle	.L17
	movq	$0, (%rsp)
.L24:
	movq	64(%rsp), %rdi
	movq	(%rsp), %rsi
	movslq	(%rdi,%rsi,4), %rbx
	movl	(%r15,%rbx,4), %edx
	movq	%rbx, 8(%rsp)
	testl	%edx, %edx
	jne	.L18
	imulq	$2004, %rbx, %rax
	movq	%rax, 72(%rsp)
	addq	%r14, %rax
	movl	2000(%rax), %esi
	movq	%rax, 32(%rsp)
	testl	%esi, %esi
	jle	.L19
	xorl	%r13d, %r13d
.L23:
	movq	32(%rsp), %rax
	movslq	(%rax,%r13,4), %r12
	movl	(%r15,%r12,4), %eax
	testl	%eax, %eax
	jne	.L20
	imulq	$2004, %r12, %rcx
	leaq	(%r14,%rcx), %rbx
	movl	2000(%rbx), %edx
	testl	%edx, %edx
	jle	.L21
	movq	%r13, 40(%rsp)
	xorl	%ebp, %ebp
	movq	%rbx, %r13
	movq	%rcx, %rbx
.L22:
	movl	0(%r13,%rbp,4), %edi
	call	cal
	movl	(%r15,%r12,4), %edx
	cmpl	%edx, %eax
	cmovl	%edx, %eax
	addq	$1, %rbp
	movl	%eax, (%r15,%r12,4)
	cmpl	%ebp, 2000(%r14,%rbx)
	jg	.L22
	movq	72(%rsp), %rsi
	movq	40(%rsp), %r13
	movl	2000(%r14,%rsi), %esi
.L21:
	movq	8(%rsp), %rdi
	addl	$1, %eax
	movl	%eax, (%r15,%r12,4)
	movl	(%r15,%rdi,4), %edx
.L20:
	cmpl	%eax, %edx
	cmovl	%eax, %edx
	movq	8(%rsp), %rax
	addq	$1, %r13
	movl	%edx, (%r15,%rax,4)
	cmpl	%r13d, %esi
	jg	.L23
	movq	104(%rsp), %rax
	movl	2000(%r14,%rax), %ecx
.L19:
	movq	8(%rsp), %rax
	addl	$1, %edx
	movl	%edx, (%r15,%rax,4)
	movq	24(%rsp), %rax
	movl	(%r15,%rax,4), %eax
.L18:
	cmpl	%edx, %eax
	movq	24(%rsp), %rdi
	cmovl	%edx, %eax
	addq	$1, (%rsp)
	movq	(%rsp), %rsi
	movl	%eax, (%r15,%rdi,4)
	cmpl	%esi, %ecx
	jg	.L24
	movq	136(%rsp), %rsi
	movl	2000(%r14,%rsi), %esi
.L17:
	movq	24(%rsp), %rbx
	movq	56(%rsp), %rdi
	addl	$1, %eax
	movl	%eax, (%r15,%rbx,4)
	movl	(%r15,%rdi,4), %edx
.L16:
	cmpl	%eax, %edx
	cmovl	%eax, %edx
	movq	56(%rsp), %rax
	addq	$1, 16(%rsp)
	movl	%edx, (%r15,%rax,4)
	movq	16(%rsp), %rax
	cmpl	%eax, %esi
	jg	.L25
	movq	168(%rsp), %rax
	movl	2000(%r14,%rax), %ecx
.L15:
	movq	56(%rsp), %rax
	addl	$1, %edx
	movl	%edx, (%r15,%rax,4)
	movq	88(%rsp), %rax
	movl	(%r15,%rax,4), %eax
.L14:
	cmpl	%edx, %eax
	movq	88(%rsp), %rbx
	cmovl	%edx, %eax
	addq	$1, 48(%rsp)
	movq	48(%rsp), %rdi
	movl	%eax, (%r15,%rbx,4)
	cmpl	%edi, %ecx
	jg	.L26
	movq	200(%rsp), %rsi
	movl	2000(%r14,%rsi), %esi
.L13:
	movq	88(%rsp), %rdi
	movq	120(%rsp), %rbx
	addl	$1, %eax
	movl	%eax, (%r15,%rdi,4)
	movl	(%r15,%rbx,4), %edx
.L12:
	cmpl	%eax, %edx
	cmovl	%eax, %edx
	movq	120(%rsp), %rax
	addq	$1, 80(%rsp)
	movl	%edx, (%r15,%rax,4)
	movq	80(%rsp), %rax
	cmpl	%eax, %esi
	jg	.L27
	movq	224(%rsp), %rax
	movl	2000(%r14,%rax), %ecx
.L11:
	movq	120(%rsp), %rax
	addl	$1, %edx
	movl	%edx, (%r15,%rax,4)
	movq	152(%rsp), %rax
	movl	(%r15,%rax,4), %eax
.L10:
	cmpl	%edx, %eax
	movq	152(%rsp), %rbx
	cmovl	%edx, %eax
	addq	$1, 112(%rsp)
	movl	%eax, (%r15,%rbx,4)
	movq	112(%rsp), %rbx
	cmpl	%ebx, %ecx
	jg	.L28
	movq	240(%rsp), %rsi
	movl	2000(%r14,%rsi), %edi
.L9:
	movq	152(%rsp), %rsi
	addl	$1, %eax
	movl	%eax, (%r15,%rsi,4)
	movq	184(%rsp), %rsi
	movl	(%r15,%rsi,4), %edx
.L8:
	cmpl	%eax, %edx
	cmovl	%eax, %edx
	movq	184(%rsp), %rax
	addq	$1, 144(%rsp)
	movl	%edx, (%r15,%rax,4)
	movq	144(%rsp), %rax
	cmpl	%eax, %edi
	jg	.L29
	movq	248(%rsp), %rax
	movl	2000(%r14,%rax), %esi
.L7:
	movq	184(%rsp), %rax
	addl	$1, %edx
	movl	%edx, (%r15,%rax,4)
	movq	216(%rsp), %rax
	movl	(%r15,%rax,4), %eax
.L6:
	cmpl	%edx, %eax
	movq	216(%rsp), %rdi
	cmovl	%edx, %eax
	addq	$1, 176(%rsp)
	movl	%eax, (%r15,%rdi,4)
	movq	176(%rsp), %rdi
	cmpl	%edi, %esi
	jg	.L30
.L5:
	movq	216(%rsp), %rcx
	addl	$1, %eax
	movl	%eax, (%r15,%rcx,4)
.L3:
	addq	$264, %rsp
	.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
	.cfi_endproc
.LFE24:
	.size	cal, .-cal
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB25:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	leaq	m(%rip), %rdx
	leaq	n(%rip), %rsi
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	leaq	.LC0(%rip), %rbx
	movq	%rbx, %rdi
	subq	$16, %rsp
	.cfi_def_cfa_offset 64
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	n(%rip), %edx
	testl	%edx, %edx
	jle	.L46
	leal	-1(%rdx), %ecx
	leaq	2000+g(%rip), %rax
	imulq	$2004, %rcx, %rcx
	leaq	2004(%rax), %rsi
	addq	%rsi, %rcx
	.p2align 4,,10
	.p2align 3
.L45:
	movl	$0, (%rax)
	addq	$2004, %rax
	cmpq	%rcx, %rax
	jne	.L45
.L46:
	movl	m(%rip), %esi
	testl	%esi, %esi
	jle	.L44
	xorl	%r13d, %r13d
	leaq	4(%rsp), %r12
	movq	%rsp, %rbp
	leaq	g(%rip), %r14
	.p2align 4,,10
	.p2align 3
.L43:
	movq	%r12, %rdx
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	(%rsp), %eax
	movl	4(%rsp), %esi
	addl	$1, %r13d
	subl	$1, %eax
	subl	$1, %esi
	cltq
	imulq	$2004, %rax, %rcx
	imulq	$501, %rax, %rax
	addq	%r14, %rcx
	movslq	2000(%rcx), %rdx
	addq	%rdx, %rax
	leal	1(%rdx), %edi
	cmpl	%r13d, m(%rip)
	movl	%edi, 2000(%rcx)
	movl	%esi, (%r14,%rax,4)
	jg	.L43
	movl	n(%rip), %edx
.L44:
	leaq	dp(%rip), %r9
	leaq	g(%rip), %r10
	xorl	%ebx, %ebx
	xorl	%r11d, %r11d
	testl	%edx, %edx
	jle	.L48
	.p2align 4,,10
	.p2align 3
.L52:
	movl	(%r9), %eax
	testl	%eax, %eax
	jne	.L49
	movl	2000(%r10), %ecx
	testl	%ecx, %ecx
	jle	.L50
	xorl	%r8d, %r8d
.L51:
	movl	(%r10,%r8,4), %edi
	call	cal
	movl	(%r9), %edx
	cmpl	%edx, %eax
	cmovl	%edx, %eax
	addq	$1, %r8
	movl	%eax, (%r9)
	cmpl	%r8d, 2000(%r10)
	jg	.L51
	movl	n(%rip), %edx
.L50:
	addl	$1, %eax
	movl	%eax, (%r9)
.L49:
	cmpl	%eax, %r11d
	cmovl	%eax, %r11d
	addl	$1, %ebx
	addq	$4, %r9
	addq	$2004, %r10
	cmpl	%ebx, %edx
	jg	.L52
.L48:
	xorl	%eax, %eax
	leal	-1(%r11), %edx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L61
	addq	$16, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
.L61:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE25:
	.size	main, .-main
	.globl	m
	.bss
	.align 4
	.type	m, @object
	.size	m, 4
m:
	.zero	4
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	dp
	.align 32
	.type	dp, @object
	.size	dp, 400400
dp:
	.zero	400400
	.globl	g
	.align 32
	.type	g, @object
	.size	g, 200600400
g:
	.zero	200600400
	.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>

typedef struct re {
    int adj[500];
    int cnt;
} graph;

graph g[100100];
int dp[100100];

int max(int a, int b) {
    return (a > b ? a : b);
}

int cal(int v) {
    if (!dp[v]) {
        for (int i = 0; i < g[v].cnt; i++) {
            dp[v] = max(dp[v], cal(g[v].adj[i]));
        }
        dp[v]++;
    }
    return dp[v];
}

int n, m;
 
int main() {
    scanf("%d%d", &n, &m);
    for (int i = 0; i < n; i++) {
        g[i].cnt = 0; 
    }

    for (int i = 0; i < m; i++) {
        int u, v;
        scanf("%d%d", &u, &v);
        u--, v--;
        g[u].adj[g[u].cnt++] = v;
    }

    int res = 0;
    for (int i = 0; i < n; i++) res = max(res, cal(i));

    printf("%d\n", res - 1);
}
6 3
2 6
4 5
5 6
 6 3
2 6
4 6
5 6
 6 3
4 3
3 5
5 6
 4 0
1 2
1 3
3 2
2 4
3 4
 7 3
2 3
4 5
5 6
 7 3
2 3
1 5
5 6
 11 3
2 3
4 5
5 6
 4 5
1 2
1 4
3 2
2 4
3 4
 6 3
2 6
4 5
4 6
 7 1
2 3
4 5
5 6

2
 1
 3
 0
 2
 2
 2
 2
 1
 1

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>

typedef struct re {
    int adj[500];
    int cnt;
} graph;

graph g[100100];
int dp[100100];

int max(int a, int b) {
    return (a > b ? a : b);
}

int cal(int v) {
    if (!dp[v]) {
        for (int i = 0; i < g[v].cnt; i++) {
            dp[v] = max(dp[v], cal(g[v].adj[i]));
        }
        dp[v]++;
    }
    return dp[v];
}

int n, m;
 
int main() {
    scanf("%d%d", &n, &m);
    for (int i = 0; i < n; i++) {
        g[i].cnt = 0; 
    }

    for (int i = 0; i < m; i++) {
        int u, v;
        scanf("%d%d", &u, &v);
        u--, v--;
        g[u].adj[g[u].cnt++] = v;
    }

    int res = 0;
    for (int i = 0; i < n; i++) res = max(res, cal(i));

    printf("%d\n", res - 1);
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	g
	.bss
	.align 32
	.type	g, @object
	.size	g, 200600400
g:
	.zero	200600400
	.globl	dp
	.align 32
	.type	dp, @object
	.size	dp, 400400
dp:
	.zero	400400
	.text
	.globl	max
	.type	max, @function
max:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	-8(%rbp), %edx
	movl	-4(%rbp), %eax
	cmpl	%eax, %edx
	cmovge	%edx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	max, .-max
	.globl	cal
	.type	cal, @function
cal:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movl	%edi, -20(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dp(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	jne	.L4
	movl	$0, -4(%rbp)
	jmp	.L5
.L6:
	movl	-4(%rbp), %eax
	movslq	%eax, %rdx
	movl	-20(%rbp), %eax
	cltq
	imulq	$501, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	g(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %edi
	call	cal
	movl	%eax, %edx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	dp(%rip), %rax
	movl	(%rcx,%rax), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	max
	movl	-20(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	dp(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	addl	$1, -4(%rbp)
.L5:
	movl	-20(%rbp), %eax
	cltq
	imulq	$2004, %rax, %rax
	leaq	2000+g(%rip), %rdx
	movl	(%rax,%rdx), %eax
	cmpl	%eax, -4(%rbp)
	jl	.L6
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dp(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	1(%rax), %ecx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dp(%rip), %rax
	movl	%ecx, (%rdx,%rax)
.L4:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dp(%rip), %rax
	movl	(%rdx,%rax), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	cal, .-cal
	.globl	n
	.bss
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	m
	.align 4
	.type	m, @object
	.size	m, 4
m:
	.zero	4
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB2:
	.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	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	m(%rip), %rax
	movq	%rax, %rdx
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -24(%rbp)
	jmp	.L9
.L10:
	movl	-24(%rbp), %eax
	cltq
	imulq	$2004, %rax, %rax
	leaq	2000+g(%rip), %rdx
	movl	$0, (%rax,%rdx)
	addl	$1, -24(%rbp)
.L9:
	movl	n(%rip), %eax
	cmpl	%eax, -24(%rbp)
	jl	.L10
	movl	$0, -20(%rbp)
	jmp	.L11
.L12:
	leaq	-28(%rbp), %rdx
	leaq	-32(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-32(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -32(%rbp)
	movl	-28(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -28(%rbp)
	movl	-32(%rbp), %esi
	movl	-32(%rbp), %edx
	movslq	%edx, %rax
	imulq	$2004, %rax, %rax
	leaq	2000+g(%rip), %rcx
	movl	(%rax,%rcx), %eax
	leal	1(%rax), %ecx
	movslq	%edx, %rdx
	imulq	$2004, %rdx, %rdx
	leaq	2000+g(%rip), %rdi
	movl	%ecx, (%rdx,%rdi)
	movl	-28(%rbp), %edx
	movslq	%eax, %rcx
	movslq	%esi, %rax
	imulq	$501, %rax, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rcx
	leaq	g(%rip), %rax
	movl	%edx, (%rcx,%rax)
	addl	$1, -20(%rbp)
.L11:
	movl	m(%rip), %eax
	cmpl	%eax, -20(%rbp)
	jl	.L12
	movl	$0, -16(%rbp)
	movl	$0, -12(%rbp)
	jmp	.L13
.L14:
	movl	-12(%rbp), %eax
	movl	%eax, %edi
	call	cal
	movl	%eax, %edx
	movl	-16(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	max
	movl	%eax, -16(%rbp)
	addl	$1, -12(%rbp)
.L13:
	movl	n(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L14
	movl	-16(%rbp), %eax
	subl	$1, %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L16
	call	__stack_chk_fail@PLT
.L16:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.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	g
	.bss
	.align 32
	.type	g, @object
	.size	g, 200600400
g:
	.zero	200600400
	.globl	dp
	.align 32
	.type	dp, @object
	.size	dp, 400400
dp:
	.zero	400400
	.text
	.globl	max
	.type	max, @function
max:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	-8(%rbp), %edx
	movl	-4(%rbp), %eax
	cmpl	%eax, %edx
	cmovge	%edx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	max, .-max
	.globl	cal
	.type	cal, @function
cal:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movl	%edi, -20(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dp(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	jne	.L4
	movl	$0, -4(%rbp)
	jmp	.L5
.L6:
	movl	-4(%rbp), %eax
	movslq	%eax, %rdx
	movl	-20(%rbp), %eax
	cltq
	imulq	$501, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	g(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %edi
	call	cal
	movl	%eax, %edx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	dp(%rip), %rax
	movl	(%rcx,%rax), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	max
	movl	-20(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	dp(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	addl	$1, -4(%rbp)
.L5:
	movl	-20(%rbp), %eax
	cltq
	imulq	$2004, %rax, %rax
	leaq	2000+g(%rip), %rdx
	movl	(%rax,%rdx), %eax
	cmpl	%eax, -4(%rbp)
	jl	.L6
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dp(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	1(%rax), %ecx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dp(%rip), %rax
	movl	%ecx, (%rdx,%rax)
.L4:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dp(%rip), %rax
	movl	(%rdx,%rax), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	cal, .-cal
	.globl	n
	.bss
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	m
	.align 4
	.type	m, @object
	.size	m, 4
m:
	.zero	4
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB2:
	.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	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	m(%rip), %rax
	movq	%rax, %rdx
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -24(%rbp)
	jmp	.L9
.L10:
	movl	-24(%rbp), %eax
	cltq
	imulq	$2004, %rax, %rax
	leaq	2000+g(%rip), %rdx
	movl	$0, (%rax,%rdx)
	addl	$1, -24(%rbp)
.L9:
	movl	n(%rip), %eax
	cmpl	%eax, -24(%rbp)
	jl	.L10
	movl	$0, -20(%rbp)
	jmp	.L11
.L12:
	leaq	-28(%rbp), %rdx
	leaq	-32(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-32(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -32(%rbp)
	movl	-28(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -28(%rbp)
	movl	-32(%rbp), %esi
	movl	-32(%rbp), %edx
	movslq	%edx, %rax
	imulq	$2004, %rax, %rax
	leaq	2000+g(%rip), %rcx
	movl	(%rax,%rcx), %eax
	leal	1(%rax), %ecx
	movslq	%edx, %rdx
	imulq	$2004, %rdx, %rdx
	leaq	2000+g(%rip), %rdi
	movl	%ecx, (%rdx,%rdi)
	movl	-28(%rbp), %edx
	movslq	%eax, %rcx
	movslq	%esi, %rax
	imulq	$501, %rax, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rcx
	leaq	g(%rip), %rax
	movl	%edx, (%rcx,%rax)
	addl	$1, -20(%rbp)
.L11:
	movl	m(%rip), %eax
	cmpl	%eax, -20(%rbp)
	jl	.L12
	movl	$0, -16(%rbp)
	movl	$0, -12(%rbp)
	jmp	.L13
.L14:
	movl	-12(%rbp), %eax
	movl	%eax, %edi
	call	cal
	movl	%eax, %edx
	movl	-16(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	max
	movl	%eax, -16(%rbp)
	addl	$1, -12(%rbp)
.L13:
	movl	n(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L14
	movl	-16(%rbp), %eax
	subl	$1, %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L16
	call	__stack_chk_fail@PLT
.L16:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.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:
