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

```c
#include<stdio.h>
#include<stdlib.h>
#define N 100000
#define M 100000

typedef struct linklist{
	int data;
	struct linklist *next;
} List;

List *genList(void);
void addList(List *list, int n);
int pathLen(List *list, int n);

List *m[N+1];
int d[N+1];
int flag[N+1];

int main(void)
{
	int i;
	int numN;
	int numM;
	int dataX;
	int dataY;
	int maxlen=0;

	scanf("%d%d", &numN, &numM);
	for(i=0;i<numN+1;i++){
		m[i]=genList();
	}
	for(i=0; i<numM; i++){
		scanf("%d%d", &dataX, &dataY);
		addList(m[dataX], dataY);
	}
	for(i=1; i<=numN; i++){
		pathLen(m[i],i);
		if(d[i] > maxlen){
			maxlen = d[i];
		}else{/*noprocess*/}
	}
	printf("%d",maxlen);
	return 0;
}


List *genList(void)
{
	List *newlist = (List *)malloc(sizeof(List));
	newlist->data=0;
	newlist->next=NULL;
	return newlist;
}
void addList(List *list, int n)
{
	List *newlist = genList();
	newlist->data=n;
	while(list->next != NULL){
		list = list->next;
	}
	list->next = newlist;
}
int pathLen(List *list, int n)
{
	int ret;
	int len;
	int maxlen=0;
	if(flag[n] != 0){
		ret = d[n];
	}else{
		if(list->next == NULL){
			ret = 0;
		}else{
			while(list->next != NULL){
				list = list->next;
				len = pathLen(m[list->data],list->data);
				if(maxlen < len){
					maxlen = len;
				}else{/*noprocess*/}
			}
			ret = maxlen + 1;
		}
		d[n] = ret;
		flag[n]=1;
	}
	return ret;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	m
	.bss
	.align 32
	.type	m, @object
	.size	m, 800008
m:
	.zero	800008
	.globl	d
	.align 32
	.type	d, @object
	.size	d, 400004
d:
	.zero	400004
	.globl	flag
	.align 32
	.type	flag, @object
	.size	flag, 400004
flag:
	.zero	400004
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -12(%rbp)
	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	$0, -16(%rbp)
	jmp	.L2
.L3:
	call	genList
	movl	-16(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	m(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	addl	$1, -16(%rbp)
.L2:
	movl	-32(%rbp), %eax
	cmpl	%eax, -16(%rbp)
	jle	.L3
	movl	$0, -16(%rbp)
	jmp	.L4
.L5:
	leaq	-20(%rbp), %rdx
	leaq	-24(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-20(%rbp), %edx
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	m(%rip), %rax
	movq	(%rcx,%rax), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	addList
	addl	$1, -16(%rbp)
.L4:
	movl	-28(%rbp), %eax
	cmpl	%eax, -16(%rbp)
	jl	.L5
	movl	$1, -16(%rbp)
	jmp	.L6
.L8:
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	m(%rip), %rax
	movq	(%rdx,%rax), %rax
	movl	-16(%rbp), %edx
	movl	%edx, %esi
	movq	%rax, %rdi
	call	pathLen
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -12(%rbp)
	jge	.L7
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -12(%rbp)
.L7:
	addl	$1, -16(%rbp)
.L6:
	movl	-32(%rbp), %eax
	cmpl	%eax, -16(%rbp)
	jle	.L8
	movl	-12(%rbp), %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	.L10
	call	__stack_chk_fail@PLT
.L10:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	main, .-main
	.globl	genList
	.type	genList, @function
genList:
.LFB7:
	.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
	movl	$16, %edi
	call	malloc@PLT
	movq	%rax, -8(%rbp)
	movq	-8(%rbp), %rax
	movl	$0, (%rax)
	movq	-8(%rbp), %rax
	movq	$0, 8(%rax)
	movq	-8(%rbp), %rax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	genList, .-genList
	.globl	addList
	.type	addList, @function
addList:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movq	%rdi, -24(%rbp)
	movl	%esi, -28(%rbp)
	call	genList
	movq	%rax, -8(%rbp)
	movq	-8(%rbp), %rax
	movl	-28(%rbp), %edx
	movl	%edx, (%rax)
	jmp	.L14
.L15:
	movq	-24(%rbp), %rax
	movq	8(%rax), %rax
	movq	%rax, -24(%rbp)
.L14:
	movq	-24(%rbp), %rax
	movq	8(%rax), %rax
	testq	%rax, %rax
	jne	.L15
	movq	-24(%rbp), %rax
	movq	-8(%rbp), %rdx
	movq	%rdx, 8(%rax)
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	addList, .-addList
	.globl	pathLen
	.type	pathLen, @function
pathLen:
.LFB9:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movq	%rdi, -24(%rbp)
	movl	%esi, -28(%rbp)
	movl	$0, -8(%rbp)
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	flag(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	je	.L17
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -12(%rbp)
	jmp	.L18
.L17:
	movq	-24(%rbp), %rax
	movq	8(%rax), %rax
	testq	%rax, %rax
	jne	.L21
	movl	$0, -12(%rbp)
	jmp	.L20
.L22:
	movq	-24(%rbp), %rax
	movq	8(%rax), %rax
	movq	%rax, -24(%rbp)
	movq	-24(%rbp), %rax
	movl	(%rax), %edx
	movq	-24(%rbp), %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	m(%rip), %rax
	movq	(%rcx,%rax), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	pathLen
	movl	%eax, -4(%rbp)
	movl	-8(%rbp), %eax
	cmpl	-4(%rbp), %eax
	jge	.L21
	movl	-4(%rbp), %eax
	movl	%eax, -8(%rbp)
.L21:
	movq	-24(%rbp), %rax
	movq	8(%rax), %rax
	testq	%rax, %rax
	jne	.L22
	movl	-8(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -12(%rbp)
.L20:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	d(%rip), %rdx
	movl	-12(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	flag(%rip), %rax
	movl	$1, (%rdx,%rax)
.L18:
	movl	-12(%rbp), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	pathLen, .-pathLen
	.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	pathLen.part.0, @function
pathLen.part.0:
.LFB43:
	.cfi_startproc
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	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	$88, %rsp
	.cfi_def_cfa_offset 144
	movq	8(%rdi), %rax
	movl	%esi, 76(%rsp)
	movq	%rax, 16(%rsp)
	testq	%rax, %rax
	je	.L23
	movl	$0, 28(%rsp)
	leaq	flag(%rip), %r11
	leaq	d(%rip), %r10
	movq	%r11, %r14
	leaq	m(%rip), %r9
	movq	%r10, %r11
.L22:
	movq	16(%rsp), %rax
	movslq	(%rax), %rax
	movl	(%r14,%rax,4), %r15d
	movq	%rax, 40(%rsp)
	testl	%r15d, %r15d
	je	.L3
	movl	(%r11,%rax,4), %r15d
.L4:
	movl	28(%rsp), %eax
	cmpl	%r15d, %eax
	cmovge	%eax, %r15d
	movq	16(%rsp), %rax
	movq	8(%rax), %rax
	movl	%r15d, 28(%rsp)
	movq	%rax, 16(%rsp)
	testq	%rax, %rax
	jne	.L22
	movl	%r15d, %eax
	movq	%r11, %r10
	movq	%r14, %r11
	addl	$1, %eax
.L2:
	movslq	76(%rsp), %rdx
	movl	%eax, (%r10,%rdx,4)
	movl	$1, (%r11,%rdx,4)
	addq	$88, %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
.L3:
	.cfi_restore_state
	movq	(%r9,%rax,8), %rax
	movq	8(%rax), %rax
	movq	%rax, 8(%rsp)
	testq	%rax, %rax
	je	.L5
	movl	%r15d, 24(%rsp)
.L21:
	movq	8(%rsp), %rax
	movslq	(%rax), %r10
	movl	(%r14,%r10,4), %r12d
	testl	%r12d, %r12d
	je	.L6
	movl	(%r11,%r10,4), %r12d
.L7:
	movl	24(%rsp), %eax
	cmpl	%r12d, %eax
	cmovge	%eax, %r12d
	movq	8(%rsp), %rax
	movq	8(%rax), %rax
	movl	%r12d, 24(%rsp)
	movq	%rax, 8(%rsp)
	testq	%rax, %rax
	jne	.L21
	movl	%r12d, %r15d
	addl	$1, %r15d
.L5:
	movq	40(%rsp), %rax
	movl	%r15d, (%r11,%rax,4)
	movl	$1, (%r14,%rax,4)
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L6:
	movq	(%r9,%r10,8), %rax
	movq	8(%rax), %rcx
	testq	%rcx, %rcx
	je	.L8
	movq	%r10, 64(%rsp)
	movq	%r14, %rdx
	movl	%r12d, %r10d
	movq	%rcx, %r14
.L20:
	movslq	(%r14), %r8
	movl	(%rdx,%r8,4), %ebp
	testl	%ebp, %ebp
	je	.L9
	movl	(%r11,%r8,4), %ebp
.L10:
	movq	8(%r14), %r14
	cmpl	%ebp, %r10d
	cmovl	%ebp, %r10d
	testq	%r14, %r14
	jne	.L20
	movl	%r10d, %r12d
	movq	64(%rsp), %r10
	movq	%rdx, %r14
	addl	$1, %r12d
.L8:
	movl	%r12d, (%r11,%r10,4)
	movl	$1, (%r14,%r10,4)
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L9:
	movq	(%r9,%r8,8), %rax
	movq	8(%rax), %r15
	testq	%r15, %r15
	je	.L11
	movl	%r10d, 72(%rsp)
	movq	%r11, %r13
	movq	%r8, 56(%rsp)
	movq	%r14, 48(%rsp)
	movq	%rdx, %r14
.L19:
	movslq	(%r15), %rcx
	movl	(%r14,%rcx,4), %ebx
	testl	%ebx, %ebx
	je	.L12
	movl	0(%r13,%rcx,4), %ebx
.L13:
	movq	8(%r15), %r15
	cmpl	%ebx, %ebp
	cmovl	%ebx, %ebp
	testq	%r15, %r15
	jne	.L19
	movq	%r14, %rdx
	movl	72(%rsp), %r10d
	movq	56(%rsp), %r8
	movq	%r13, %r11
	movq	48(%rsp), %r14
	addl	$1, %ebp
.L11:
	movl	%ebp, (%r11,%r8,4)
	movl	$1, (%rdx,%r8,4)
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L12:
	movq	(%r9,%rcx,8), %rax
	movq	8(%rax), %r12
	testq	%r12, %r12
	je	.L14
.L18:
	movslq	(%r12), %rax
	movl	(%r14,%rax,4), %edx
	movq	%rax, %rsi
	testl	%edx, %edx
	je	.L15
	movl	0(%r13,%rax,4), %eax
	movq	8(%r12), %r12
	cmpl	%eax, %ebx
	cmovl	%eax, %ebx
	testq	%r12, %r12
	jne	.L18
.L17:
	addl	$1, %ebx
.L14:
	movl	%ebx, 0(%r13,%rcx,4)
	movl	$1, (%r14,%rcx,4)
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L15:
	movq	(%r9,%rax,8), %rdi
	movq	%rcx, 32(%rsp)
	call	pathLen.part.0
	movq	8(%r12), %r12
	movq	32(%rsp), %rcx
	leaq	m(%rip), %r9
	cmpl	%eax, %ebx
	cmovl	%eax, %ebx
	testq	%r12, %r12
	jne	.L18
	jmp	.L17
	.p2align 4,,10
	.p2align 3
.L23:
	xorl	%eax, %eax
	leaq	flag(%rip), %r11
	leaq	d(%rip), %r10
	jmp	.L2
	.cfi_endproc
.LFE43:
	.size	pathLen.part.0, .-pathLen.part.0
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	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	.LC0(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%rbp, %rdi
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rdx
	leaq	8(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movslq	8(%rsp), %rax
	testl	%eax, %eax
	js	.L50
	leaq	m(%rip), %rbx
	leaq	8(%rbx), %rdx
	leaq	(%rdx,%rax,8), %r12
	.p2align 4,,10
	.p2align 3
.L49:
	movl	$16, %edi
	addq	$8, %rbx
	call	malloc@PLT
	movq	%rax, -8(%rbx)
	movl	$0, (%rax)
	movq	$0, 8(%rax)
	cmpq	%rbx, %r12
	jne	.L49
.L50:
	movl	12(%rsp), %esi
	xorl	%r15d, %r15d
	leaq	20(%rsp), %r13
	leaq	16(%rsp), %r12
	testl	%esi, %esi
	jle	.L48
	.p2align 4,,10
	.p2align 3
.L47:
	movq	%r13, %rdx
	movq	%r12, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	16(%rsp), %rax
	movl	20(%rsp), %r14d
	leaq	m(%rip), %rcx
	movl	$16, %edi
	movq	(%rcx,%rax,8), %rbx
	call	malloc@PLT
	movq	$0, 8(%rax)
	movl	%r14d, (%rax)
	.p2align 4,,10
	.p2align 3
.L53:
	movq	%rbx, %rdx
	movq	8(%rbx), %rbx
	testq	%rbx, %rbx
	jne	.L53
	movq	%rax, 8(%rdx)
	addl	$1, %r15d
	cmpl	%r15d, 12(%rsp)
	jg	.L47
.L48:
	movl	8(%rsp), %eax
	movl	$1, %ebp
	xorl	%r13d, %r13d
	leaq	flag(%rip), %r14
	leaq	d(%rip), %r15
	leaq	m(%rip), %rdx
	testl	%eax, %eax
	jg	.L51
	jmp	.L52
	.p2align 4,,10
	.p2align 3
.L76:
	movl	(%r15,%rbp,4), %ebx
	cmpl	%ebx, %r13d
	cmovl	%ebx, %r13d
	addq	$1, %rbp
	cmpl	%ebp, %eax
	jl	.L52
.L51:
	movl	(%r14,%rbp,4), %ebx
	testl	%ebx, %ebx
	jne	.L76
	movq	(%rdx,%rbp,8), %rcx
	movq	8(%rcx), %r12
	testq	%r12, %r12
	je	.L56
.L60:
	movslq	(%r12), %rax
	movl	(%r14,%rax,4), %ecx
	movq	%rax, %rsi
	testl	%ecx, %ecx
	je	.L57
	movl	(%r15,%rax,4), %eax
	movq	8(%r12), %r12
	cmpl	%eax, %ebx
	cmovl	%eax, %ebx
	testq	%r12, %r12
	jne	.L60
.L59:
	movl	8(%rsp), %eax
	addl	$1, %ebx
.L56:
	cmpl	%ebx, %r13d
	movl	%ebx, (%r15,%rbp,4)
	movl	$1, (%r14,%rbp,4)
	cmovl	%ebx, %r13d
	addq	$1, %rbp
	cmpl	%ebp, %eax
	jge	.L51
.L52:
	xorl	%eax, %eax
	movl	%r13d, %edx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L77
	addq	$40, %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
.L57:
	.cfi_restore_state
	movq	(%rdx,%rax,8), %rdi
	call	pathLen.part.0
	movq	8(%r12), %r12
	leaq	m(%rip), %rdx
	cmpl	%eax, %ebx
	cmovl	%eax, %ebx
	testq	%r12, %r12
	jne	.L60
	jmp	.L59
.L77:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE39:
	.size	main, .-main
	.text
	.p2align 4
	.globl	genList
	.type	genList, @function
genList:
.LFB40:
	.cfi_startproc
	endbr64
	subq	$8, %rsp
	.cfi_def_cfa_offset 16
	movl	$16, %edi
	call	malloc@PLT
	movl	$0, (%rax)
	movq	$0, 8(%rax)
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE40:
	.size	genList, .-genList
	.p2align 4
	.globl	addList
	.type	addList, @function
addList:
.LFB41:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movl	%esi, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	movq	%rdi, %rbx
	movl	$16, %edi
	subq	$8, %rsp
	.cfi_def_cfa_offset 32
	call	malloc@PLT
	movq	$0, 8(%rax)
	movl	%ebp, (%rax)
	.p2align 4,,10
	.p2align 3
.L81:
	movq	%rbx, %rdx
	movq	8(%rbx), %rbx
	testq	%rbx, %rbx
	jne	.L81
	movq	%rax, 8(%rdx)
	addq	$8, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE41:
	.size	addList, .-addList
	.p2align 4
	.globl	pathLen
	.type	pathLen, @function
pathLen:
.LFB42:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	leaq	flag(%rip), %r14
	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
	movslq	%esi, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$8, %rsp
	.cfi_def_cfa_offset 64
	movl	(%r14,%rbp,4), %r12d
	testl	%r12d, %r12d
	je	.L85
	leaq	d(%rip), %rax
	movl	(%rax,%rbp,4), %r12d
.L84:
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	movl	%r12d, %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
.L85:
	.cfi_restore_state
	movq	8(%rdi), %rbx
	leaq	d(%rip), %r15
	testq	%rbx, %rbx
	je	.L87
	leaq	m(%rip), %r13
.L91:
	movslq	(%rbx), %rax
	movl	(%r14,%rax,4), %edx
	movq	%rax, %rsi
	testl	%edx, %edx
	je	.L88
	movl	(%r15,%rax,4), %eax
.L99:
	movq	8(%rbx), %rbx
	cmpl	%eax, %r12d
	cmovl	%eax, %r12d
	testq	%rbx, %rbx
	jne	.L91
	addl	$1, %r12d
.L87:
	movl	%r12d, (%r15,%rbp,4)
	movl	$1, (%r14,%rbp,4)
	jmp	.L84
	.p2align 4,,10
	.p2align 3
.L88:
	movq	0(%r13,%rax,8), %rdi
	call	pathLen.part.0
	jmp	.L99
	.cfi_endproc
.LFE42:
	.size	pathLen, .-pathLen
	.globl	flag
	.bss
	.align 32
	.type	flag, @object
	.size	flag, 400004
flag:
	.zero	400004
	.globl	d
	.align 32
	.type	d, @object
	.size	d, 400004
d:
	.zero	400004
	.globl	m
	.align 32
	.type	m, @object
	.size	m, 800008
m:
	.zero	800008
	.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	pathLen.part.0, @function
pathLen.part.0:
.LFB43:
	.cfi_startproc
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	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	$88, %rsp
	.cfi_def_cfa_offset 144
	movq	8(%rdi), %rax
	movl	%esi, 76(%rsp)
	movq	%rax, 16(%rsp)
	testq	%rax, %rax
	je	.L23
	movl	$0, 28(%rsp)
	leaq	flag(%rip), %r11
	leaq	d(%rip), %r10
	movq	%r11, %r14
	leaq	m(%rip), %r9
	movq	%r10, %r11
.L22:
	movq	16(%rsp), %rax
	movslq	(%rax), %rax
	movl	(%r14,%rax,4), %r15d
	movq	%rax, 40(%rsp)
	testl	%r15d, %r15d
	je	.L3
	movl	(%r11,%rax,4), %r15d
.L4:
	movl	28(%rsp), %eax
	cmpl	%r15d, %eax
	cmovge	%eax, %r15d
	movq	16(%rsp), %rax
	movq	8(%rax), %rax
	movl	%r15d, 28(%rsp)
	movq	%rax, 16(%rsp)
	testq	%rax, %rax
	jne	.L22
	movl	%r15d, %eax
	movq	%r11, %r10
	movq	%r14, %r11
	addl	$1, %eax
.L2:
	movslq	76(%rsp), %rdx
	movl	%eax, (%r10,%rdx,4)
	movl	$1, (%r11,%rdx,4)
	addq	$88, %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
.L3:
	.cfi_restore_state
	movq	(%r9,%rax,8), %rax
	movq	8(%rax), %rax
	movq	%rax, 8(%rsp)
	testq	%rax, %rax
	je	.L5
	movl	%r15d, 24(%rsp)
.L21:
	movq	8(%rsp), %rax
	movslq	(%rax), %r10
	movl	(%r14,%r10,4), %r12d
	testl	%r12d, %r12d
	je	.L6
	movl	(%r11,%r10,4), %r12d
.L7:
	movl	24(%rsp), %eax
	cmpl	%r12d, %eax
	cmovge	%eax, %r12d
	movq	8(%rsp), %rax
	movq	8(%rax), %rax
	movl	%r12d, 24(%rsp)
	movq	%rax, 8(%rsp)
	testq	%rax, %rax
	jne	.L21
	movl	%r12d, %r15d
	addl	$1, %r15d
.L5:
	movq	40(%rsp), %rax
	movl	%r15d, (%r11,%rax,4)
	movl	$1, (%r14,%rax,4)
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L6:
	movq	(%r9,%r10,8), %rax
	movq	8(%rax), %rcx
	testq	%rcx, %rcx
	je	.L8
	movq	%r10, 64(%rsp)
	movq	%r14, %rdx
	movl	%r12d, %r10d
	movq	%rcx, %r14
.L20:
	movslq	(%r14), %r8
	movl	(%rdx,%r8,4), %ebp
	testl	%ebp, %ebp
	je	.L9
	movl	(%r11,%r8,4), %ebp
.L10:
	movq	8(%r14), %r14
	cmpl	%ebp, %r10d
	cmovl	%ebp, %r10d
	testq	%r14, %r14
	jne	.L20
	movl	%r10d, %r12d
	movq	64(%rsp), %r10
	movq	%rdx, %r14
	addl	$1, %r12d
.L8:
	movl	%r12d, (%r11,%r10,4)
	movl	$1, (%r14,%r10,4)
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L9:
	movq	(%r9,%r8,8), %rax
	movq	8(%rax), %r15
	testq	%r15, %r15
	je	.L11
	movl	%r10d, 72(%rsp)
	movq	%r11, %r13
	movq	%r8, 56(%rsp)
	movq	%r14, 48(%rsp)
	movq	%rdx, %r14
.L19:
	movslq	(%r15), %rcx
	movl	(%r14,%rcx,4), %ebx
	testl	%ebx, %ebx
	je	.L12
	movl	0(%r13,%rcx,4), %ebx
.L13:
	movq	8(%r15), %r15
	cmpl	%ebx, %ebp
	cmovl	%ebx, %ebp
	testq	%r15, %r15
	jne	.L19
	movq	%r14, %rdx
	movl	72(%rsp), %r10d
	movq	56(%rsp), %r8
	movq	%r13, %r11
	movq	48(%rsp), %r14
	addl	$1, %ebp
.L11:
	movl	%ebp, (%r11,%r8,4)
	movl	$1, (%rdx,%r8,4)
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L12:
	movq	(%r9,%rcx,8), %rax
	movq	8(%rax), %r12
	testq	%r12, %r12
	je	.L14
.L18:
	movslq	(%r12), %rax
	movl	(%r14,%rax,4), %edx
	movq	%rax, %rsi
	testl	%edx, %edx
	je	.L15
	movl	0(%r13,%rax,4), %eax
	movq	8(%r12), %r12
	cmpl	%eax, %ebx
	cmovl	%eax, %ebx
	testq	%r12, %r12
	jne	.L18
.L17:
	addl	$1, %ebx
.L14:
	movl	%ebx, 0(%r13,%rcx,4)
	movl	$1, (%r14,%rcx,4)
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L15:
	movq	(%r9,%rax,8), %rdi
	movq	%rcx, 32(%rsp)
	call	pathLen.part.0
	movq	8(%r12), %r12
	movq	32(%rsp), %rcx
	leaq	m(%rip), %r9
	cmpl	%eax, %ebx
	cmovl	%eax, %ebx
	testq	%r12, %r12
	jne	.L18
	jmp	.L17
	.p2align 4,,10
	.p2align 3
.L23:
	xorl	%eax, %eax
	leaq	flag(%rip), %r11
	leaq	d(%rip), %r10
	jmp	.L2
	.cfi_endproc
.LFE43:
	.size	pathLen.part.0, .-pathLen.part.0
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	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	.LC0(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%rbp, %rdi
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rdx
	leaq	8(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movslq	8(%rsp), %rax
	testl	%eax, %eax
	js	.L50
	leaq	m(%rip), %rbx
	leaq	8(%rbx), %rdx
	leaq	(%rdx,%rax,8), %r12
	.p2align 4,,10
	.p2align 3
.L49:
	movl	$16, %edi
	addq	$8, %rbx
	call	malloc@PLT
	movq	%rax, -8(%rbx)
	movl	$0, (%rax)
	movq	$0, 8(%rax)
	cmpq	%rbx, %r12
	jne	.L49
.L50:
	movl	12(%rsp), %esi
	xorl	%r15d, %r15d
	leaq	20(%rsp), %r13
	leaq	16(%rsp), %r12
	testl	%esi, %esi
	jle	.L48
	.p2align 4,,10
	.p2align 3
.L47:
	movq	%r13, %rdx
	movq	%r12, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	16(%rsp), %rax
	movl	20(%rsp), %r14d
	leaq	m(%rip), %rcx
	movl	$16, %edi
	movq	(%rcx,%rax,8), %rbx
	call	malloc@PLT
	movq	$0, 8(%rax)
	movl	%r14d, (%rax)
	.p2align 4,,10
	.p2align 3
.L53:
	movq	%rbx, %rdx
	movq	8(%rbx), %rbx
	testq	%rbx, %rbx
	jne	.L53
	movq	%rax, 8(%rdx)
	addl	$1, %r15d
	cmpl	%r15d, 12(%rsp)
	jg	.L47
.L48:
	movl	8(%rsp), %eax
	movl	$1, %ebp
	xorl	%r13d, %r13d
	leaq	flag(%rip), %r14
	leaq	d(%rip), %r15
	leaq	m(%rip), %rdx
	testl	%eax, %eax
	jg	.L51
	jmp	.L52
	.p2align 4,,10
	.p2align 3
.L76:
	movl	(%r15,%rbp,4), %ebx
	cmpl	%ebx, %r13d
	cmovl	%ebx, %r13d
	addq	$1, %rbp
	cmpl	%ebp, %eax
	jl	.L52
.L51:
	movl	(%r14,%rbp,4), %ebx
	testl	%ebx, %ebx
	jne	.L76
	movq	(%rdx,%rbp,8), %rcx
	movq	8(%rcx), %r12
	testq	%r12, %r12
	je	.L56
.L60:
	movslq	(%r12), %rax
	movl	(%r14,%rax,4), %ecx
	movq	%rax, %rsi
	testl	%ecx, %ecx
	je	.L57
	movl	(%r15,%rax,4), %eax
	movq	8(%r12), %r12
	cmpl	%eax, %ebx
	cmovl	%eax, %ebx
	testq	%r12, %r12
	jne	.L60
.L59:
	movl	8(%rsp), %eax
	addl	$1, %ebx
.L56:
	cmpl	%ebx, %r13d
	movl	%ebx, (%r15,%rbp,4)
	movl	$1, (%r14,%rbp,4)
	cmovl	%ebx, %r13d
	addq	$1, %rbp
	cmpl	%ebp, %eax
	jge	.L51
.L52:
	xorl	%eax, %eax
	movl	%r13d, %edx
	movl	$1, %edi
	leaq	.LC1(%rip), %rsi
	call	__printf_chk@PLT
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L77
	addq	$40, %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
.L57:
	.cfi_restore_state
	movq	(%rdx,%rax,8), %rdi
	call	pathLen.part.0
	movq	8(%r12), %r12
	leaq	m(%rip), %rdx
	cmpl	%eax, %ebx
	cmovl	%eax, %ebx
	testq	%r12, %r12
	jne	.L60
	jmp	.L59
.L77:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE39:
	.size	main, .-main
	.text
	.p2align 4
	.globl	genList
	.type	genList, @function
genList:
.LFB40:
	.cfi_startproc
	endbr64
	subq	$8, %rsp
	.cfi_def_cfa_offset 16
	movl	$16, %edi
	call	malloc@PLT
	movl	$0, (%rax)
	movq	$0, 8(%rax)
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE40:
	.size	genList, .-genList
	.p2align 4
	.globl	addList
	.type	addList, @function
addList:
.LFB41:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movl	%esi, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	movq	%rdi, %rbx
	movl	$16, %edi
	subq	$8, %rsp
	.cfi_def_cfa_offset 32
	call	malloc@PLT
	movq	$0, 8(%rax)
	movl	%ebp, (%rax)
	.p2align 4,,10
	.p2align 3
.L81:
	movq	%rbx, %rdx
	movq	8(%rbx), %rbx
	testq	%rbx, %rbx
	jne	.L81
	movq	%rax, 8(%rdx)
	addq	$8, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE41:
	.size	addList, .-addList
	.p2align 4
	.globl	pathLen
	.type	pathLen, @function
pathLen:
.LFB42:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	leaq	flag(%rip), %r14
	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
	movslq	%esi, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$8, %rsp
	.cfi_def_cfa_offset 64
	movl	(%r14,%rbp,4), %r12d
	testl	%r12d, %r12d
	je	.L85
	leaq	d(%rip), %rax
	movl	(%rax,%rbp,4), %r12d
.L84:
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	movl	%r12d, %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
.L85:
	.cfi_restore_state
	movq	8(%rdi), %rbx
	leaq	d(%rip), %r15
	testq	%rbx, %rbx
	je	.L87
	leaq	m(%rip), %r13
.L91:
	movslq	(%rbx), %rax
	movl	(%r14,%rax,4), %edx
	movq	%rax, %rsi
	testl	%edx, %edx
	je	.L88
	movl	(%r15,%rax,4), %eax
.L99:
	movq	8(%rbx), %rbx
	cmpl	%eax, %r12d
	cmovl	%eax, %r12d
	testq	%rbx, %rbx
	jne	.L91
	addl	$1, %r12d
.L87:
	movl	%r12d, (%r15,%rbp,4)
	movl	$1, (%r14,%rbp,4)
	jmp	.L84
	.p2align 4,,10
	.p2align 3
.L88:
	movq	0(%r13,%rax,8), %rdi
	call	pathLen.part.0
	jmp	.L99
	.cfi_endproc
.LFE42:
	.size	pathLen, .-pathLen
	.globl	flag
	.bss
	.align 32
	.type	flag, @object
	.size	flag, 400004
flag:
	.zero	400004
	.globl	d
	.align 32
	.type	d, @object
	.size	d, 400004
d:
	.zero	400004
	.globl	m
	.align 32
	.type	m, @object
	.size	m, 800008
m:
	.zero	800008
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

#include<stdio.h>
#include<stdlib.h>
#define N 100000
#define M 100000

typedef struct linklist{
	int data;
	struct linklist *next;
} List;

List *genList(void);
void addList(List *list, int n);
int pathLen(List *list, int n);

List *m[N+1];
int d[N+1];
int flag[N+1];

int main(void)
{
	int i;
	int numN;
	int numM;
	int dataX;
	int dataY;
	int maxlen=0;

	scanf("%d%d", &numN, &numM);
	for(i=0;i<numN+1;i++){
		m[i]=genList();
	}
	for(i=0; i<numM; i++){
		scanf("%d%d", &dataX, &dataY);
		addList(m[dataX], dataY);
	}
	for(i=1; i<=numN; i++){
		pathLen(m[i],i);
		if(d[i] > maxlen){
			maxlen = d[i];
		}else{/*noprocess*/}
	}
	printf("%d",maxlen);
	return 0;
}


List *genList(void)
{
	List *newlist = (List *)malloc(sizeof(List));
	newlist->data=0;
	newlist->next=NULL;
	return newlist;
}
void addList(List *list, int n)
{
	List *newlist = genList();
	newlist->data=n;
	while(list->next != NULL){
		list = list->next;
	}
	list->next = newlist;
}
int pathLen(List *list, int n)
{
	int ret;
	int len;
	int maxlen=0;
	if(flag[n] != 0){
		ret = d[n];
	}else{
		if(list->next == NULL){
			ret = 0;
		}else{
			while(list->next != NULL){
				list = list->next;
				len = pathLen(m[list->data],list->data);
				if(maxlen < len){
					maxlen = len;
				}else{/*noprocess*/}
			}
			ret = maxlen + 1;
		}
		d[n] = ret;
		flag[n]=1;
	}
	return ret;
}

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>
#include<stdlib.h>
#define N 100000
#define M 100000

typedef struct linklist{
	int data;
	struct linklist *next;
} List;

List *genList(void);
void addList(List *list, int n);
int pathLen(List *list, int n);

List *m[N+1];
int d[N+1];
int flag[N+1];

int main(void)
{
	int i;
	int numN;
	int numM;
	int dataX;
	int dataY;
	int maxlen=0;

	scanf("%d%d", &numN, &numM);
	for(i=0;i<numN+1;i++){
		m[i]=genList();
	}
	for(i=0; i<numM; i++){
		scanf("%d%d", &dataX, &dataY);
		addList(m[dataX], dataY);
	}
	for(i=1; i<=numN; i++){
		pathLen(m[i],i);
		if(d[i] > maxlen){
			maxlen = d[i];
		}else{/*noprocess*/}
	}
	printf("%d",maxlen);
	return 0;
}


List *genList(void)
{
	List *newlist = (List *)malloc(sizeof(List));
	newlist->data=0;
	newlist->next=NULL;
	return newlist;
}
void addList(List *list, int n)
{
	List *newlist = genList();
	newlist->data=n;
	while(list->next != NULL){
		list = list->next;
	}
	list->next = newlist;
}
int pathLen(List *list, int n)
{
	int ret;
	int len;
	int maxlen=0;
	if(flag[n] != 0){
		ret = d[n];
	}else{
		if(list->next == NULL){
			ret = 0;
		}else{
			while(list->next != NULL){
				list = list->next;
				len = pathLen(m[list->data],list->data);
				if(maxlen < len){
					maxlen = len;
				}else{/*noprocess*/}
			}
			ret = maxlen + 1;
		}
		d[n] = ret;
		flag[n]=1;
	}
	return ret;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	m
	.bss
	.align 32
	.type	m, @object
	.size	m, 800008
m:
	.zero	800008
	.globl	d
	.align 32
	.type	d, @object
	.size	d, 400004
d:
	.zero	400004
	.globl	flag
	.align 32
	.type	flag, @object
	.size	flag, 400004
flag:
	.zero	400004
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -12(%rbp)
	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	$0, -16(%rbp)
	jmp	.L2
.L3:
	call	genList
	movl	-16(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	m(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	addl	$1, -16(%rbp)
.L2:
	movl	-32(%rbp), %eax
	cmpl	%eax, -16(%rbp)
	jle	.L3
	movl	$0, -16(%rbp)
	jmp	.L4
.L5:
	leaq	-20(%rbp), %rdx
	leaq	-24(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-20(%rbp), %edx
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	m(%rip), %rax
	movq	(%rcx,%rax), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	addList
	addl	$1, -16(%rbp)
.L4:
	movl	-28(%rbp), %eax
	cmpl	%eax, -16(%rbp)
	jl	.L5
	movl	$1, -16(%rbp)
	jmp	.L6
.L8:
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	m(%rip), %rax
	movq	(%rdx,%rax), %rax
	movl	-16(%rbp), %edx
	movl	%edx, %esi
	movq	%rax, %rdi
	call	pathLen
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -12(%rbp)
	jge	.L7
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -12(%rbp)
.L7:
	addl	$1, -16(%rbp)
.L6:
	movl	-32(%rbp), %eax
	cmpl	%eax, -16(%rbp)
	jle	.L8
	movl	-12(%rbp), %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	.L10
	call	__stack_chk_fail@PLT
.L10:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	main, .-main
	.globl	genList
	.type	genList, @function
genList:
.LFB7:
	.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
	movl	$16, %edi
	call	malloc@PLT
	movq	%rax, -8(%rbp)
	movq	-8(%rbp), %rax
	movl	$0, (%rax)
	movq	-8(%rbp), %rax
	movq	$0, 8(%rax)
	movq	-8(%rbp), %rax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	genList, .-genList
	.globl	addList
	.type	addList, @function
addList:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movq	%rdi, -24(%rbp)
	movl	%esi, -28(%rbp)
	call	genList
	movq	%rax, -8(%rbp)
	movq	-8(%rbp), %rax
	movl	-28(%rbp), %edx
	movl	%edx, (%rax)
	jmp	.L14
.L15:
	movq	-24(%rbp), %rax
	movq	8(%rax), %rax
	movq	%rax, -24(%rbp)
.L14:
	movq	-24(%rbp), %rax
	movq	8(%rax), %rax
	testq	%rax, %rax
	jne	.L15
	movq	-24(%rbp), %rax
	movq	-8(%rbp), %rdx
	movq	%rdx, 8(%rax)
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	addList, .-addList
	.globl	pathLen
	.type	pathLen, @function
pathLen:
.LFB9:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movq	%rdi, -24(%rbp)
	movl	%esi, -28(%rbp)
	movl	$0, -8(%rbp)
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	flag(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	je	.L17
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -12(%rbp)
	jmp	.L18
.L17:
	movq	-24(%rbp), %rax
	movq	8(%rax), %rax
	testq	%rax, %rax
	jne	.L21
	movl	$0, -12(%rbp)
	jmp	.L20
.L22:
	movq	-24(%rbp), %rax
	movq	8(%rax), %rax
	movq	%rax, -24(%rbp)
	movq	-24(%rbp), %rax
	movl	(%rax), %edx
	movq	-24(%rbp), %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	m(%rip), %rax
	movq	(%rcx,%rax), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	pathLen
	movl	%eax, -4(%rbp)
	movl	-8(%rbp), %eax
	cmpl	-4(%rbp), %eax
	jge	.L21
	movl	-4(%rbp), %eax
	movl	%eax, -8(%rbp)
.L21:
	movq	-24(%rbp), %rax
	movq	8(%rax), %rax
	testq	%rax, %rax
	jne	.L22
	movl	-8(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -12(%rbp)
.L20:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	d(%rip), %rdx
	movl	-12(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	flag(%rip), %rax
	movl	$1, (%rdx,%rax)
.L18:
	movl	-12(%rbp), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	pathLen, .-pathLen
	.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, 800008
m:
	.zero	800008
	.globl	d
	.align 32
	.type	d, @object
	.size	d, 400004
d:
	.zero	400004
	.globl	flag
	.align 32
	.type	flag, @object
	.size	flag, 400004
flag:
	.zero	400004
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"%d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -12(%rbp)
	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	$0, -16(%rbp)
	jmp	.L2
.L3:
	call	genList
	movl	-16(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	m(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	addl	$1, -16(%rbp)
.L2:
	movl	-32(%rbp), %eax
	cmpl	%eax, -16(%rbp)
	jle	.L3
	movl	$0, -16(%rbp)
	jmp	.L4
.L5:
	leaq	-20(%rbp), %rdx
	leaq	-24(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-20(%rbp), %edx
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	m(%rip), %rax
	movq	(%rcx,%rax), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	addList
	addl	$1, -16(%rbp)
.L4:
	movl	-28(%rbp), %eax
	cmpl	%eax, -16(%rbp)
	jl	.L5
	movl	$1, -16(%rbp)
	jmp	.L6
.L8:
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	m(%rip), %rax
	movq	(%rdx,%rax), %rax
	movl	-16(%rbp), %edx
	movl	%edx, %esi
	movq	%rax, %rdi
	call	pathLen
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -12(%rbp)
	jge	.L7
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -12(%rbp)
.L7:
	addl	$1, -16(%rbp)
.L6:
	movl	-32(%rbp), %eax
	cmpl	%eax, -16(%rbp)
	jle	.L8
	movl	-12(%rbp), %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	.L10
	call	__stack_chk_fail@PLT
.L10:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	main, .-main
	.globl	genList
	.type	genList, @function
genList:
.LFB7:
	.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
	movl	$16, %edi
	call	malloc@PLT
	movq	%rax, -8(%rbp)
	movq	-8(%rbp), %rax
	movl	$0, (%rax)
	movq	-8(%rbp), %rax
	movq	$0, 8(%rax)
	movq	-8(%rbp), %rax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	genList, .-genList
	.globl	addList
	.type	addList, @function
addList:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movq	%rdi, -24(%rbp)
	movl	%esi, -28(%rbp)
	call	genList
	movq	%rax, -8(%rbp)
	movq	-8(%rbp), %rax
	movl	-28(%rbp), %edx
	movl	%edx, (%rax)
	jmp	.L14
.L15:
	movq	-24(%rbp), %rax
	movq	8(%rax), %rax
	movq	%rax, -24(%rbp)
.L14:
	movq	-24(%rbp), %rax
	movq	8(%rax), %rax
	testq	%rax, %rax
	jne	.L15
	movq	-24(%rbp), %rax
	movq	-8(%rbp), %rdx
	movq	%rdx, 8(%rax)
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	addList, .-addList
	.globl	pathLen
	.type	pathLen, @function
pathLen:
.LFB9:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movq	%rdi, -24(%rbp)
	movl	%esi, -28(%rbp)
	movl	$0, -8(%rbp)
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	flag(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	je	.L17
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	d(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -12(%rbp)
	jmp	.L18
.L17:
	movq	-24(%rbp), %rax
	movq	8(%rax), %rax
	testq	%rax, %rax
	jne	.L21
	movl	$0, -12(%rbp)
	jmp	.L20
.L22:
	movq	-24(%rbp), %rax
	movq	8(%rax), %rax
	movq	%rax, -24(%rbp)
	movq	-24(%rbp), %rax
	movl	(%rax), %edx
	movq	-24(%rbp), %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	m(%rip), %rax
	movq	(%rcx,%rax), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	pathLen
	movl	%eax, -4(%rbp)
	movl	-8(%rbp), %eax
	cmpl	-4(%rbp), %eax
	jge	.L21
	movl	-4(%rbp), %eax
	movl	%eax, -8(%rbp)
.L21:
	movq	-24(%rbp), %rax
	movq	8(%rax), %rax
	testq	%rax, %rax
	jne	.L22
	movl	-8(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -12(%rbp)
.L20:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	d(%rip), %rdx
	movl	-12(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	flag(%rip), %rax
	movl	$1, (%rdx,%rax)
.L18:
	movl	-12(%rbp), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	pathLen, .-pathLen
	.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:
