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>

struct node {
	int val;
	struct node* next;
};
struct node* a[100005];
void insert (int u,int v) {
        struct node* q;
        q=(struct node*)malloc(1*sizeof(struct node));
        q->val=v;
        q->next=NULL;
        if(a[u]==NULL)
                a[u]=q;
        else {
                struct node* p;
                p=a[u];
                q->next=p;
                a[u]=q;
        }
}

int max(int a, int b)
{
    if(a<b)
        return b;
    else
        return a;
}

int main()
{
    int m,n,u,v,visited[100005],arr[1000005],count[100005],count2[100005],j,maxi,i,l,r;
    struct node* p;
    scanf("%d %d",&n,&m);
    for(i=1;i<=n;i++)
    {
        visited[i]=0;
        count[i]=0;
        count2[i]=0;
    }
    for(i=0;i<m;i++)
    {
        scanf("%d %d",&u,&v);
        count2[v]++;
        insert(u,v);
    }
    for(i=1;i<=n;i++)
    {
        l=0,r=-1;
        if(count2[i]==0 && visited[i]==0)
        {
            visited[i]=1;
            p=a[i];
            while(p!=NULL)
            {
                count2[p->val]--;
                if(count2[p->val]==0)
                {
                    arr[++r]=p->val;
                }
                count[p->val]=max(count[p->val],count[i]+1);
                p=p->next;
            }
            while(l<=r)
            {
                j=arr[l];
                visited[j]=1;
                p=a[j];
                while(p!=NULL)
                {
                    count2[p->val]--;
                    if(count2[p->val]==0)
                    {  
                        arr[++r]=p->val;
                    }
                    count[p->val]=max(count[p->val],count[j]+1);
                    p=p->next;
                }
                l++;
            }
        }
    }
    maxi=-1;
    for(i=1;i<=n;i++)
    {
        if(count[i]>maxi)
        {
            maxi=count[i];
        }
    }
    printf("%d\n",maxi);
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 800040
a:
	.zero	800040
	.text
	.globl	insert
	.type	insert, @function
insert:
.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
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	movl	$16, %edi
	call	malloc@PLT
	movq	%rax, -16(%rbp)
	movq	-16(%rbp), %rax
	movl	-24(%rbp), %edx
	movl	%edx, (%rax)
	movq	-16(%rbp), %rax
	movq	$0, 8(%rax)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rax
	testq	%rax, %rax
	jne	.L2
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	a(%rip), %rdx
	movq	-16(%rbp), %rax
	movq	%rax, (%rcx,%rdx)
	jmp	.L4
.L2:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	%rax, -8(%rbp)
	movq	-16(%rbp), %rax
	movq	-8(%rbp), %rdx
	movq	%rdx, 8(%rax)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	a(%rip), %rdx
	movq	-16(%rbp), %rax
	movq	%rax, (%rcx,%rdx)
.L4:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	insert, .-insert
	.globl	max
	.type	max, @function
max:
.LFB7:
	.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	-4(%rbp), %eax
	cmpl	-8(%rbp), %eax
	jge	.L6
	movl	-8(%rbp), %eax
	jmp	.L7
.L6:
	movl	-4(%rbp), %eax
.L7:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	max, .-max
	.section	.rodata
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d\n"
	.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
	pushq	%rbx
	leaq	-5197824(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$2360, %rsp
	.cfi_offset 3, -24
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
	leaq	-5200188(%rbp), %rdx
	leaq	-5200184(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, -5200168(%rbp)
	jmp	.L9
.L10:
	movl	-5200168(%rbp), %eax
	cltq
	movl	$0, -5200144(%rbp,%rax,4)
	movl	-5200168(%rbp), %eax
	cltq
	movl	$0, -4800112(%rbp,%rax,4)
	movl	-5200168(%rbp), %eax
	cltq
	movl	$0, -4400080(%rbp,%rax,4)
	addl	$1, -5200168(%rbp)
.L9:
	movl	-5200184(%rbp), %eax
	cmpl	%eax, -5200168(%rbp)
	jle	.L10
	movl	$0, -5200168(%rbp)
	jmp	.L11
.L12:
	leaq	-5200176(%rbp), %rdx
	leaq	-5200180(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-5200176(%rbp), %eax
	movslq	%eax, %rdx
	movl	-4400080(%rbp,%rdx,4), %edx
	addl	$1, %edx
	cltq
	movl	%edx, -4400080(%rbp,%rax,4)
	movl	-5200176(%rbp), %edx
	movl	-5200180(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	insert
	addl	$1, -5200168(%rbp)
.L11:
	movl	-5200188(%rbp), %eax
	cmpl	%eax, -5200168(%rbp)
	jl	.L12
	movl	$1, -5200168(%rbp)
	jmp	.L13
.L23:
	movl	$0, -5200164(%rbp)
	movl	$-1, -5200160(%rbp)
	movl	-5200168(%rbp), %eax
	cltq
	movl	-4400080(%rbp,%rax,4), %eax
	testl	%eax, %eax
	jne	.L14
	movl	-5200168(%rbp), %eax
	cltq
	movl	-5200144(%rbp,%rax,4), %eax
	testl	%eax, %eax
	jne	.L14
	movl	-5200168(%rbp), %eax
	cltq
	movl	$1, -5200144(%rbp,%rax,4)
	movl	-5200168(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	%rax, -5200152(%rbp)
	jmp	.L15
.L17:
	movq	-5200152(%rbp), %rax
	movl	(%rax), %eax
	movslq	%eax, %rdx
	movl	-4400080(%rbp,%rdx,4), %edx
	subl	$1, %edx
	cltq
	movl	%edx, -4400080(%rbp,%rax,4)
	movq	-5200152(%rbp), %rax
	movl	(%rax), %eax
	cltq
	movl	-4400080(%rbp,%rax,4), %eax
	testl	%eax, %eax
	jne	.L16
	addl	$1, -5200160(%rbp)
	movq	-5200152(%rbp), %rax
	movl	(%rax), %edx
	movl	-5200160(%rbp), %eax
	cltq
	movl	%edx, -4000048(%rbp,%rax,4)
.L16:
	movl	-5200168(%rbp), %eax
	cltq
	movl	-4800112(%rbp,%rax,4), %eax
	leal	1(%rax), %edx
	movq	-5200152(%rbp), %rax
	movl	(%rax), %eax
	cltq
	movl	-4800112(%rbp,%rax,4), %eax
	movq	-5200152(%rbp), %rcx
	movl	(%rcx), %ebx
	movl	%edx, %esi
	movl	%eax, %edi
	call	max
	movslq	%ebx, %rdx
	movl	%eax, -4800112(%rbp,%rdx,4)
	movq	-5200152(%rbp), %rax
	movq	8(%rax), %rax
	movq	%rax, -5200152(%rbp)
.L15:
	cmpq	$0, -5200152(%rbp)
	jne	.L17
	jmp	.L18
.L22:
	movl	-5200164(%rbp), %eax
	cltq
	movl	-4000048(%rbp,%rax,4), %eax
	movl	%eax, -5200156(%rbp)
	movl	-5200156(%rbp), %eax
	cltq
	movl	$1, -5200144(%rbp,%rax,4)
	movl	-5200156(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	%rax, -5200152(%rbp)
	jmp	.L19
.L21:
	movq	-5200152(%rbp), %rax
	movl	(%rax), %eax
	movslq	%eax, %rdx
	movl	-4400080(%rbp,%rdx,4), %edx
	subl	$1, %edx
	cltq
	movl	%edx, -4400080(%rbp,%rax,4)
	movq	-5200152(%rbp), %rax
	movl	(%rax), %eax
	cltq
	movl	-4400080(%rbp,%rax,4), %eax
	testl	%eax, %eax
	jne	.L20
	addl	$1, -5200160(%rbp)
	movq	-5200152(%rbp), %rax
	movl	(%rax), %edx
	movl	-5200160(%rbp), %eax
	cltq
	movl	%edx, -4000048(%rbp,%rax,4)
.L20:
	movl	-5200156(%rbp), %eax
	cltq
	movl	-4800112(%rbp,%rax,4), %eax
	leal	1(%rax), %edx
	movq	-5200152(%rbp), %rax
	movl	(%rax), %eax
	cltq
	movl	-4800112(%rbp,%rax,4), %eax
	movq	-5200152(%rbp), %rcx
	movl	(%rcx), %ebx
	movl	%edx, %esi
	movl	%eax, %edi
	call	max
	movslq	%ebx, %rdx
	movl	%eax, -4800112(%rbp,%rdx,4)
	movq	-5200152(%rbp), %rax
	movq	8(%rax), %rax
	movq	%rax, -5200152(%rbp)
.L19:
	cmpq	$0, -5200152(%rbp)
	jne	.L21
	addl	$1, -5200164(%rbp)
.L18:
	movl	-5200164(%rbp), %eax
	cmpl	-5200160(%rbp), %eax
	jle	.L22
.L14:
	addl	$1, -5200168(%rbp)
.L13:
	movl	-5200184(%rbp), %eax
	cmpl	%eax, -5200168(%rbp)
	jle	.L23
	movl	$-1, -5200172(%rbp)
	movl	$1, -5200168(%rbp)
	jmp	.L24
.L26:
	movl	-5200168(%rbp), %eax
	cltq
	movl	-4800112(%rbp,%rax,4), %eax
	cmpl	%eax, -5200172(%rbp)
	jge	.L25
	movl	-5200168(%rbp), %eax
	cltq
	movl	-4800112(%rbp,%rax,4), %eax
	movl	%eax, -5200172(%rbp)
.L25:
	addl	$1, -5200168(%rbp)
.L24:
	movl	-5200184(%rbp), %eax
	cmpl	%eax, -5200168(%rbp)
	jle	.L26
	movl	-5200172(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-24(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L28
	call	__stack_chk_fail@PLT
.L28:
	movq	-8(%rbp), %rbx
	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
	.globl	insert
	.type	insert, @function
insert:
.LFB39:
	.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
	movl	%edi, %ebx
	movl	$16, %edi
	subq	$8, %rsp
	.cfi_def_cfa_offset 32
	call	malloc@PLT
	movslq	%ebx, %rdi
	leaq	a(%rip), %rdx
	movq	(%rdx,%rdi,8), %rcx
	movl	%ebp, (%rax)
	movq	%rax, (%rdx,%rdi,8)
	movq	%rcx, 8(%rax)
	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
.LFE39:
	.size	insert, .-insert
	.p2align 4
	.globl	max
	.type	max, @function
max:
.LFB40:
	.cfi_startproc
	endbr64
	cmpl	%esi, %edi
	movl	%esi, %eax
	cmovge	%edi, %eax
	ret
	.cfi_endproc
.LFE40:
	.size	max, .-max
	.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:
.LFB41:
	.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
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	-5197824(%rsp), %r11
	.cfi_def_cfa 11, 5197880
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$2344, %rsp
	.cfi_def_cfa_offset 5200224
	leaq	.LC0(%rip), %rbp
	movq	%rbp, %rdi
	movq	%fs:40, %rax
	movq	%rax, 5200152(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %rdx
	leaq	20(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	20(%rsp), %ebx
	testl	%ebx, %ebx
	jle	.L9
	movslq	%ebx, %r12
	leaq	36(%rsp), %rdi
	xorl	%esi, %esi
	salq	$2, %r12
	movq	%r12, %rdx
	call	memset@PLT
	leaq	400068(%rsp), %rdi
	movq	%r12, %rdx
	xorl	%esi, %esi
	call	memset@PLT
	leaq	800100(%rsp), %rdi
	movq	%r12, %rdx
	xorl	%esi, %esi
	call	memset@PLT
	movl	16(%rsp), %ecx
	testl	%ecx, %ecx
	jle	.L11
.L10:
	leaq	24(%rsp), %rax
	xorl	%r14d, %r14d
	leaq	28(%rsp), %r12
	movq	%rax, 8(%rsp)
	leaq	a(%rip), %rbx
	.p2align 4,,10
	.p2align 3
.L16:
	movq	8(%rsp), %rsi
	movq	%r12, %rdx
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	28(%rsp), %rax
	movl	24(%rsp), %r13d
	movl	$16, %edi
	movq	%rax, %r15
	addl	$1, 800096(%rsp,%rax,4)
	call	malloc@PLT
	movslq	%r13d, %rdx
	movq	(%rbx,%rdx,8), %rsi
	movl	%r15d, (%rax)
	movq	$0, 8(%rax)
	testq	%rsi, %rsi
	je	.L13
	movq	%rsi, 8(%rax)
	addl	$1, %r14d
	movq	%rax, (%rbx,%rdx,8)
	cmpl	%r14d, 16(%rsp)
	jg	.L16
.L15:
	movl	20(%rsp), %ebx
	testl	%ebx, %ebx
	jle	.L54
.L11:
	movl	$1, %r8d
	leaq	800096(%rsp), %rbp
	leaq	32(%rsp), %r12
	leaq	a(%rip), %r10
	jmp	.L18
	.p2align 4,,10
	.p2align 3
.L20:
	addq	$1, %r8
	cmpl	%r8d, %ebx
	jl	.L55
.L18:
	movl	0(%rbp,%r8,4), %edx
	testl	%edx, %edx
	jne	.L20
	movl	(%r12,%r8,4), %eax
	testl	%eax, %eax
	jne	.L20
	movq	(%r10,%r8,8), %rcx
	movl	$1, (%r12,%r8,4)
	testq	%rcx, %rcx
	je	.L20
	movl	$-1, %esi
	leaq	400064(%rsp), %r9
	.p2align 4,,10
	.p2align 3
.L25:
	movslq	(%rcx), %rax
	subl	$1, 800096(%rsp,%rax,4)
	jne	.L21
	movl	(%r9,%r8,4), %edi
	addl	$1, %esi
	movq	8(%rcx), %rcx
	movslq	%esi, %rdx
	movl	%eax, 1200128(%rsp,%rdx,4)
	leal	1(%rdi), %edx
	movl	400064(%rsp,%rax,4), %edi
	cmpl	%edi, %edx
	cmovl	%edi, %edx
	movl	%edx, 400064(%rsp,%rax,4)
	testq	%rcx, %rcx
	jne	.L25
.L23:
	xorl	%r9d, %r9d
	leaq	1200128(%rsp), %r11
	.p2align 4,,10
	.p2align 3
.L30:
	movslq	(%r11,%r9,4), %rdi
	movq	(%r10,%rdi,8), %rcx
	movl	$1, 32(%rsp,%rdi,4)
	testq	%rcx, %rcx
	je	.L26
	.p2align 4,,10
	.p2align 3
.L29:
	movslq	(%rcx), %rax
	subl	$1, 800096(%rsp,%rax,4)
	jne	.L27
	addl	$1, %esi
	movslq	%esi, %rdx
	movl	%eax, 1200128(%rsp,%rdx,4)
.L27:
	movl	400064(%rsp,%rdi,4), %edx
	movl	400064(%rsp,%rax,4), %r13d
	movq	8(%rcx), %rcx
	addl	$1, %edx
	cmpl	%r13d, %edx
	cmovl	%r13d, %edx
	movl	%edx, 400064(%rsp,%rax,4)
	testq	%rcx, %rcx
	jne	.L29
.L26:
	addq	$1, %r9
	cmpl	%r9d, %esi
	jge	.L30
	addq	$1, %r8
	cmpl	%r8d, %ebx
	jge	.L18
	.p2align 4,,10
	.p2align 3
.L55:
	testl	%ebx, %ebx
	movl	$1, %ecx
	cmovg	%ebx, %ecx
	cmpl	$3, %ebx
	jle	.L36
	leaq	400068(%rsp), %rax
	pcmpeqd	%xmm2, %xmm2
	movl	%ecx, %edx
	shrl	$2, %edx
	subl	$1, %edx
	salq	$4, %rdx
	leaq	400084(%rsp,%rdx), %rdx
	.p2align 4,,10
	.p2align 3
.L32:
	movdqu	(%rax), %xmm0
	addq	$16, %rax
	movdqa	%xmm0, %xmm1
	pcmpgtd	%xmm2, %xmm1
	pand	%xmm1, %xmm0
	pandn	%xmm2, %xmm1
	movdqa	%xmm1, %xmm2
	por	%xmm0, %xmm2
	cmpq	%rax, %rdx
	jne	.L32
	movdqa	%xmm2, %xmm0
	movl	%ecx, %esi
	psrldq	$8, %xmm0
	andl	$-4, %esi
	movdqa	%xmm0, %xmm1
	leal	1(%rsi), %eax
	pcmpgtd	%xmm2, %xmm1
	pand	%xmm1, %xmm0
	pandn	%xmm2, %xmm1
	por	%xmm0, %xmm1
	movdqa	%xmm1, %xmm2
	psrldq	$4, %xmm2
	movdqa	%xmm2, %xmm0
	pcmpgtd	%xmm1, %xmm0
	pand	%xmm0, %xmm2
	pandn	%xmm1, %xmm0
	por	%xmm2, %xmm0
	movd	%xmm0, %edx
	cmpl	%ecx, %esi
	je	.L12
.L31:
	movslq	%eax, %rcx
	movl	400064(%rsp,%rcx,4), %ecx
	cmpl	%ecx, %edx
	cmovl	%ecx, %edx
	leal	1(%rax), %ecx
	cmpl	%ebx, %ecx
	jg	.L12
	movslq	%ecx, %rcx
	movl	400064(%rsp,%rcx,4), %ecx
	cmpl	%ecx, %edx
	cmovl	%ecx, %edx
	addl	$2, %eax
	cmpl	%ebx, %eax
	jg	.L12
	cltq
	movl	400064(%rsp,%rax,4), %eax
	cmpl	%eax, %edx
	cmovl	%eax, %edx
.L12:
	xorl	%eax, %eax
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	5200152(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L56
	addq	$5200168, %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
.L21:
	.cfi_restore_state
	movl	(%r9,%r8,4), %edi
	movq	8(%rcx), %rcx
	leal	1(%rdi), %edx
	movl	400064(%rsp,%rax,4), %edi
	cmpl	%edi, %edx
	cmovl	%edi, %edx
	movl	%edx, 400064(%rsp,%rax,4)
	testq	%rcx, %rcx
	jne	.L25
	cmpl	$-1, %esi
	jne	.L23
	jmp	.L20
	.p2align 4,,10
	.p2align 3
.L13:
	movq	%rax, (%rbx,%rdx,8)
	addl	$1, %r14d
	cmpl	%r14d, 16(%rsp)
	jg	.L16
	jmp	.L15
.L9:
	cmpl	$0, 16(%rsp)
	jg	.L10
.L54:
	orl	$-1, %edx
	jmp	.L12
.L36:
	movl	$1, %eax
	orl	$-1, %edx
	jmp	.L31
.L56:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE41:
	.size	main, .-main
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 800040
a:
	.zero	800040
	.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	insert
	.type	insert, @function
insert:
.LFB39:
	.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
	movl	%edi, %ebx
	movl	$16, %edi
	subq	$8, %rsp
	.cfi_def_cfa_offset 32
	call	malloc@PLT
	movslq	%ebx, %rdi
	leaq	a(%rip), %rdx
	movq	(%rdx,%rdi,8), %rcx
	movl	%ebp, (%rax)
	movq	%rax, (%rdx,%rdi,8)
	movq	%rcx, 8(%rax)
	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
.LFE39:
	.size	insert, .-insert
	.p2align 4
	.globl	max
	.type	max, @function
max:
.LFB40:
	.cfi_startproc
	endbr64
	cmpl	%esi, %edi
	movl	%esi, %eax
	cmovge	%edi, %eax
	ret
	.cfi_endproc
.LFE40:
	.size	max, .-max
	.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:
.LFB41:
	.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
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	-5197824(%rsp), %r11
	.cfi_def_cfa 11, 5197880
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$2344, %rsp
	.cfi_def_cfa_offset 5200224
	leaq	.LC0(%rip), %rbp
	movq	%rbp, %rdi
	movq	%fs:40, %rax
	movq	%rax, 5200152(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %rdx
	leaq	20(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	20(%rsp), %ebx
	testl	%ebx, %ebx
	jle	.L9
	movslq	%ebx, %r12
	leaq	36(%rsp), %rdi
	xorl	%esi, %esi
	salq	$2, %r12
	movq	%r12, %rdx
	call	memset@PLT
	leaq	400068(%rsp), %rdi
	movq	%r12, %rdx
	xorl	%esi, %esi
	call	memset@PLT
	leaq	800100(%rsp), %rdi
	movq	%r12, %rdx
	xorl	%esi, %esi
	call	memset@PLT
	movl	16(%rsp), %ecx
	testl	%ecx, %ecx
	jle	.L11
.L10:
	leaq	24(%rsp), %rax
	xorl	%r14d, %r14d
	leaq	28(%rsp), %r12
	movq	%rax, 8(%rsp)
	leaq	a(%rip), %rbx
	.p2align 4,,10
	.p2align 3
.L16:
	movq	8(%rsp), %rsi
	movq	%r12, %rdx
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	28(%rsp), %rax
	movl	24(%rsp), %r13d
	movl	$16, %edi
	movq	%rax, %r15
	addl	$1, 800096(%rsp,%rax,4)
	call	malloc@PLT
	movslq	%r13d, %rdx
	movq	(%rbx,%rdx,8), %rsi
	movl	%r15d, (%rax)
	movq	$0, 8(%rax)
	testq	%rsi, %rsi
	je	.L13
	movq	%rsi, 8(%rax)
	addl	$1, %r14d
	movq	%rax, (%rbx,%rdx,8)
	cmpl	%r14d, 16(%rsp)
	jg	.L16
.L15:
	movl	20(%rsp), %ebx
	testl	%ebx, %ebx
	jle	.L54
.L11:
	movl	$1, %r8d
	leaq	800096(%rsp), %rbp
	leaq	32(%rsp), %r12
	leaq	a(%rip), %r10
	jmp	.L18
	.p2align 4,,10
	.p2align 3
.L20:
	addq	$1, %r8
	cmpl	%r8d, %ebx
	jl	.L55
.L18:
	movl	0(%rbp,%r8,4), %edx
	testl	%edx, %edx
	jne	.L20
	movl	(%r12,%r8,4), %eax
	testl	%eax, %eax
	jne	.L20
	movq	(%r10,%r8,8), %rcx
	movl	$1, (%r12,%r8,4)
	testq	%rcx, %rcx
	je	.L20
	movl	$-1, %esi
	leaq	400064(%rsp), %r9
	.p2align 4,,10
	.p2align 3
.L25:
	movslq	(%rcx), %rax
	subl	$1, 800096(%rsp,%rax,4)
	jne	.L21
	movl	(%r9,%r8,4), %edi
	addl	$1, %esi
	movq	8(%rcx), %rcx
	movslq	%esi, %rdx
	movl	%eax, 1200128(%rsp,%rdx,4)
	leal	1(%rdi), %edx
	movl	400064(%rsp,%rax,4), %edi
	cmpl	%edi, %edx
	cmovl	%edi, %edx
	movl	%edx, 400064(%rsp,%rax,4)
	testq	%rcx, %rcx
	jne	.L25
.L23:
	xorl	%r9d, %r9d
	leaq	1200128(%rsp), %r11
	.p2align 4,,10
	.p2align 3
.L30:
	movslq	(%r11,%r9,4), %rdi
	movq	(%r10,%rdi,8), %rcx
	movl	$1, 32(%rsp,%rdi,4)
	testq	%rcx, %rcx
	je	.L26
	.p2align 4,,10
	.p2align 3
.L29:
	movslq	(%rcx), %rax
	subl	$1, 800096(%rsp,%rax,4)
	jne	.L27
	addl	$1, %esi
	movslq	%esi, %rdx
	movl	%eax, 1200128(%rsp,%rdx,4)
.L27:
	movl	400064(%rsp,%rdi,4), %edx
	movl	400064(%rsp,%rax,4), %r13d
	movq	8(%rcx), %rcx
	addl	$1, %edx
	cmpl	%r13d, %edx
	cmovl	%r13d, %edx
	movl	%edx, 400064(%rsp,%rax,4)
	testq	%rcx, %rcx
	jne	.L29
.L26:
	addq	$1, %r9
	cmpl	%r9d, %esi
	jge	.L30
	addq	$1, %r8
	cmpl	%r8d, %ebx
	jge	.L18
	.p2align 4,,10
	.p2align 3
.L55:
	testl	%ebx, %ebx
	movl	$1, %ecx
	cmovg	%ebx, %ecx
	cmpl	$3, %ebx
	jle	.L36
	leaq	400068(%rsp), %rax
	pcmpeqd	%xmm2, %xmm2
	movl	%ecx, %edx
	shrl	$2, %edx
	subl	$1, %edx
	salq	$4, %rdx
	leaq	400084(%rsp,%rdx), %rdx
	.p2align 4,,10
	.p2align 3
.L32:
	movdqu	(%rax), %xmm0
	addq	$16, %rax
	movdqa	%xmm0, %xmm1
	pcmpgtd	%xmm2, %xmm1
	pand	%xmm1, %xmm0
	pandn	%xmm2, %xmm1
	movdqa	%xmm1, %xmm2
	por	%xmm0, %xmm2
	cmpq	%rax, %rdx
	jne	.L32
	movdqa	%xmm2, %xmm0
	movl	%ecx, %esi
	psrldq	$8, %xmm0
	andl	$-4, %esi
	movdqa	%xmm0, %xmm1
	leal	1(%rsi), %eax
	pcmpgtd	%xmm2, %xmm1
	pand	%xmm1, %xmm0
	pandn	%xmm2, %xmm1
	por	%xmm0, %xmm1
	movdqa	%xmm1, %xmm2
	psrldq	$4, %xmm2
	movdqa	%xmm2, %xmm0
	pcmpgtd	%xmm1, %xmm0
	pand	%xmm0, %xmm2
	pandn	%xmm1, %xmm0
	por	%xmm2, %xmm0
	movd	%xmm0, %edx
	cmpl	%ecx, %esi
	je	.L12
.L31:
	movslq	%eax, %rcx
	movl	400064(%rsp,%rcx,4), %ecx
	cmpl	%ecx, %edx
	cmovl	%ecx, %edx
	leal	1(%rax), %ecx
	cmpl	%ebx, %ecx
	jg	.L12
	movslq	%ecx, %rcx
	movl	400064(%rsp,%rcx,4), %ecx
	cmpl	%ecx, %edx
	cmovl	%ecx, %edx
	addl	$2, %eax
	cmpl	%ebx, %eax
	jg	.L12
	cltq
	movl	400064(%rsp,%rax,4), %eax
	cmpl	%eax, %edx
	cmovl	%eax, %edx
.L12:
	xorl	%eax, %eax
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	5200152(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L56
	addq	$5200168, %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
.L21:
	.cfi_restore_state
	movl	(%r9,%r8,4), %edi
	movq	8(%rcx), %rcx
	leal	1(%rdi), %edx
	movl	400064(%rsp,%rax,4), %edi
	cmpl	%edi, %edx
	cmovl	%edi, %edx
	movl	%edx, 400064(%rsp,%rax,4)
	testq	%rcx, %rcx
	jne	.L25
	cmpl	$-1, %esi
	jne	.L23
	jmp	.L20
	.p2align 4,,10
	.p2align 3
.L13:
	movq	%rax, (%rbx,%rdx,8)
	addl	$1, %r14d
	cmpl	%r14d, 16(%rsp)
	jg	.L16
	jmp	.L15
.L9:
	cmpl	$0, 16(%rsp)
	jg	.L10
.L54:
	orl	$-1, %edx
	jmp	.L12
.L36:
	movl	$1, %eax
	orl	$-1, %edx
	jmp	.L31
.L56:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE41:
	.size	main, .-main
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 800040
a:
	.zero	800040
	.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>

struct node {
	int val;
	struct node* next;
};
struct node* a[100005];
void insert (int u,int v) {
        struct node* q;
        q=(struct node*)malloc(1*sizeof(struct node));
        q->val=v;
        q->next=NULL;
        if(a[u]==NULL)
                a[u]=q;
        else {
                struct node* p;
                p=a[u];
                q->next=p;
                a[u]=q;
        }
}

int max(int a, int b)
{
    if(a<b)
        return b;
    else
        return a;
}

int main()
{
    int m,n,u,v,visited[100005],arr[1000005],count[100005],count2[100005],j,maxi,i,l,r;
    struct node* p;
    scanf("%d %d",&n,&m);
    for(i=1;i<=n;i++)
    {
        visited[i]=0;
        count[i]=0;
        count2[i]=0;
    }
    for(i=0;i<m;i++)
    {
        scanf("%d %d",&u,&v);
        count2[v]++;
        insert(u,v);
    }
    for(i=1;i<=n;i++)
    {
        l=0,r=-1;
        if(count2[i]==0 && visited[i]==0)
        {
            visited[i]=1;
            p=a[i];
            while(p!=NULL)
            {
                count2[p->val]--;
                if(count2[p->val]==0)
                {
                    arr[++r]=p->val;
                }
                count[p->val]=max(count[p->val],count[i]+1);
                p=p->next;
            }
            while(l<=r)
            {
                j=arr[l];
                visited[j]=1;
                p=a[j];
                while(p!=NULL)
                {
                    count2[p->val]--;
                    if(count2[p->val]==0)
                    {  
                        arr[++r]=p->val;
                    }
                    count[p->val]=max(count[p->val],count[j]+1);
                    p=p->next;
                }
                l++;
            }
        }
    }
    maxi=-1;
    for(i=1;i<=n;i++)
    {
        if(count[i]>maxi)
        {
            maxi=count[i];
        }
    }
    printf("%d\n",maxi);
}
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>

struct node {
	int val;
	struct node* next;
};
struct node* a[100005];
void insert (int u,int v) {
        struct node* q;
        q=(struct node*)malloc(1*sizeof(struct node));
        q->val=v;
        q->next=NULL;
        if(a[u]==NULL)
                a[u]=q;
        else {
                struct node* p;
                p=a[u];
                q->next=p;
                a[u]=q;
        }
}

int max(int a, int b)
{
    if(a<b)
        return b;
    else
        return a;
}

int main()
{
    int m,n,u,v,visited[100005],arr[1000005],count[100005],count2[100005],j,maxi,i,l,r;
    struct node* p;
    scanf("%d %d",&n,&m);
    for(i=1;i<=n;i++)
    {
        visited[i]=0;
        count[i]=0;
        count2[i]=0;
    }
    for(i=0;i<m;i++)
    {
        scanf("%d %d",&u,&v);
        count2[v]++;
        insert(u,v);
    }
    for(i=1;i<=n;i++)
    {
        l=0,r=-1;
        if(count2[i]==0 && visited[i]==0)
        {
            visited[i]=1;
            p=a[i];
            while(p!=NULL)
            {
                count2[p->val]--;
                if(count2[p->val]==0)
                {
                    arr[++r]=p->val;
                }
                count[p->val]=max(count[p->val],count[i]+1);
                p=p->next;
            }
            while(l<=r)
            {
                j=arr[l];
                visited[j]=1;
                p=a[j];
                while(p!=NULL)
                {
                    count2[p->val]--;
                    if(count2[p->val]==0)
                    {  
                        arr[++r]=p->val;
                    }
                    count[p->val]=max(count[p->val],count[j]+1);
                    p=p->next;
                }
                l++;
            }
        }
    }
    maxi=-1;
    for(i=1;i<=n;i++)
    {
        if(count[i]>maxi)
        {
            maxi=count[i];
        }
    }
    printf("%d\n",maxi);
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 800040
a:
	.zero	800040
	.text
	.globl	insert
	.type	insert, @function
insert:
.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
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	movl	$16, %edi
	call	malloc@PLT
	movq	%rax, -16(%rbp)
	movq	-16(%rbp), %rax
	movl	-24(%rbp), %edx
	movl	%edx, (%rax)
	movq	-16(%rbp), %rax
	movq	$0, 8(%rax)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rax
	testq	%rax, %rax
	jne	.L2
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	a(%rip), %rdx
	movq	-16(%rbp), %rax
	movq	%rax, (%rcx,%rdx)
	jmp	.L4
.L2:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	%rax, -8(%rbp)
	movq	-16(%rbp), %rax
	movq	-8(%rbp), %rdx
	movq	%rdx, 8(%rax)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	a(%rip), %rdx
	movq	-16(%rbp), %rax
	movq	%rax, (%rcx,%rdx)
.L4:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	insert, .-insert
	.globl	max
	.type	max, @function
max:
.LFB7:
	.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	-4(%rbp), %eax
	cmpl	-8(%rbp), %eax
	jge	.L6
	movl	-8(%rbp), %eax
	jmp	.L7
.L6:
	movl	-4(%rbp), %eax
.L7:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	max, .-max
	.section	.rodata
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d\n"
	.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
	pushq	%rbx
	leaq	-5197824(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$2360, %rsp
	.cfi_offset 3, -24
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
	leaq	-5200188(%rbp), %rdx
	leaq	-5200184(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, -5200168(%rbp)
	jmp	.L9
.L10:
	movl	-5200168(%rbp), %eax
	cltq
	movl	$0, -5200144(%rbp,%rax,4)
	movl	-5200168(%rbp), %eax
	cltq
	movl	$0, -4800112(%rbp,%rax,4)
	movl	-5200168(%rbp), %eax
	cltq
	movl	$0, -4400080(%rbp,%rax,4)
	addl	$1, -5200168(%rbp)
.L9:
	movl	-5200184(%rbp), %eax
	cmpl	%eax, -5200168(%rbp)
	jle	.L10
	movl	$0, -5200168(%rbp)
	jmp	.L11
.L12:
	leaq	-5200176(%rbp), %rdx
	leaq	-5200180(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-5200176(%rbp), %eax
	movslq	%eax, %rdx
	movl	-4400080(%rbp,%rdx,4), %edx
	addl	$1, %edx
	cltq
	movl	%edx, -4400080(%rbp,%rax,4)
	movl	-5200176(%rbp), %edx
	movl	-5200180(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	insert
	addl	$1, -5200168(%rbp)
.L11:
	movl	-5200188(%rbp), %eax
	cmpl	%eax, -5200168(%rbp)
	jl	.L12
	movl	$1, -5200168(%rbp)
	jmp	.L13
.L23:
	movl	$0, -5200164(%rbp)
	movl	$-1, -5200160(%rbp)
	movl	-5200168(%rbp), %eax
	cltq
	movl	-4400080(%rbp,%rax,4), %eax
	testl	%eax, %eax
	jne	.L14
	movl	-5200168(%rbp), %eax
	cltq
	movl	-5200144(%rbp,%rax,4), %eax
	testl	%eax, %eax
	jne	.L14
	movl	-5200168(%rbp), %eax
	cltq
	movl	$1, -5200144(%rbp,%rax,4)
	movl	-5200168(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	%rax, -5200152(%rbp)
	jmp	.L15
.L17:
	movq	-5200152(%rbp), %rax
	movl	(%rax), %eax
	movslq	%eax, %rdx
	movl	-4400080(%rbp,%rdx,4), %edx
	subl	$1, %edx
	cltq
	movl	%edx, -4400080(%rbp,%rax,4)
	movq	-5200152(%rbp), %rax
	movl	(%rax), %eax
	cltq
	movl	-4400080(%rbp,%rax,4), %eax
	testl	%eax, %eax
	jne	.L16
	addl	$1, -5200160(%rbp)
	movq	-5200152(%rbp), %rax
	movl	(%rax), %edx
	movl	-5200160(%rbp), %eax
	cltq
	movl	%edx, -4000048(%rbp,%rax,4)
.L16:
	movl	-5200168(%rbp), %eax
	cltq
	movl	-4800112(%rbp,%rax,4), %eax
	leal	1(%rax), %edx
	movq	-5200152(%rbp), %rax
	movl	(%rax), %eax
	cltq
	movl	-4800112(%rbp,%rax,4), %eax
	movq	-5200152(%rbp), %rcx
	movl	(%rcx), %ebx
	movl	%edx, %esi
	movl	%eax, %edi
	call	max
	movslq	%ebx, %rdx
	movl	%eax, -4800112(%rbp,%rdx,4)
	movq	-5200152(%rbp), %rax
	movq	8(%rax), %rax
	movq	%rax, -5200152(%rbp)
.L15:
	cmpq	$0, -5200152(%rbp)
	jne	.L17
	jmp	.L18
.L22:
	movl	-5200164(%rbp), %eax
	cltq
	movl	-4000048(%rbp,%rax,4), %eax
	movl	%eax, -5200156(%rbp)
	movl	-5200156(%rbp), %eax
	cltq
	movl	$1, -5200144(%rbp,%rax,4)
	movl	-5200156(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	%rax, -5200152(%rbp)
	jmp	.L19
.L21:
	movq	-5200152(%rbp), %rax
	movl	(%rax), %eax
	movslq	%eax, %rdx
	movl	-4400080(%rbp,%rdx,4), %edx
	subl	$1, %edx
	cltq
	movl	%edx, -4400080(%rbp,%rax,4)
	movq	-5200152(%rbp), %rax
	movl	(%rax), %eax
	cltq
	movl	-4400080(%rbp,%rax,4), %eax
	testl	%eax, %eax
	jne	.L20
	addl	$1, -5200160(%rbp)
	movq	-5200152(%rbp), %rax
	movl	(%rax), %edx
	movl	-5200160(%rbp), %eax
	cltq
	movl	%edx, -4000048(%rbp,%rax,4)
.L20:
	movl	-5200156(%rbp), %eax
	cltq
	movl	-4800112(%rbp,%rax,4), %eax
	leal	1(%rax), %edx
	movq	-5200152(%rbp), %rax
	movl	(%rax), %eax
	cltq
	movl	-4800112(%rbp,%rax,4), %eax
	movq	-5200152(%rbp), %rcx
	movl	(%rcx), %ebx
	movl	%edx, %esi
	movl	%eax, %edi
	call	max
	movslq	%ebx, %rdx
	movl	%eax, -4800112(%rbp,%rdx,4)
	movq	-5200152(%rbp), %rax
	movq	8(%rax), %rax
	movq	%rax, -5200152(%rbp)
.L19:
	cmpq	$0, -5200152(%rbp)
	jne	.L21
	addl	$1, -5200164(%rbp)
.L18:
	movl	-5200164(%rbp), %eax
	cmpl	-5200160(%rbp), %eax
	jle	.L22
.L14:
	addl	$1, -5200168(%rbp)
.L13:
	movl	-5200184(%rbp), %eax
	cmpl	%eax, -5200168(%rbp)
	jle	.L23
	movl	$-1, -5200172(%rbp)
	movl	$1, -5200168(%rbp)
	jmp	.L24
.L26:
	movl	-5200168(%rbp), %eax
	cltq
	movl	-4800112(%rbp,%rax,4), %eax
	cmpl	%eax, -5200172(%rbp)
	jge	.L25
	movl	-5200168(%rbp), %eax
	cltq
	movl	-4800112(%rbp,%rax,4), %eax
	movl	%eax, -5200172(%rbp)
.L25:
	addl	$1, -5200168(%rbp)
.L24:
	movl	-5200184(%rbp), %eax
	cmpl	%eax, -5200168(%rbp)
	jle	.L26
	movl	-5200172(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-24(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L28
	call	__stack_chk_fail@PLT
.L28:
	movq	-8(%rbp), %rbx
	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	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 800040
a:
	.zero	800040
	.text
	.globl	insert
	.type	insert, @function
insert:
.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
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	movl	$16, %edi
	call	malloc@PLT
	movq	%rax, -16(%rbp)
	movq	-16(%rbp), %rax
	movl	-24(%rbp), %edx
	movl	%edx, (%rax)
	movq	-16(%rbp), %rax
	movq	$0, 8(%rax)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rax
	testq	%rax, %rax
	jne	.L2
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	a(%rip), %rdx
	movq	-16(%rbp), %rax
	movq	%rax, (%rcx,%rdx)
	jmp	.L4
.L2:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	%rax, -8(%rbp)
	movq	-16(%rbp), %rax
	movq	-8(%rbp), %rdx
	movq	%rdx, 8(%rax)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	a(%rip), %rdx
	movq	-16(%rbp), %rax
	movq	%rax, (%rcx,%rdx)
.L4:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	insert, .-insert
	.globl	max
	.type	max, @function
max:
.LFB7:
	.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	-4(%rbp), %eax
	cmpl	-8(%rbp), %eax
	jge	.L6
	movl	-8(%rbp), %eax
	jmp	.L7
.L6:
	movl	-4(%rbp), %eax
.L7:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	max, .-max
	.section	.rodata
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d\n"
	.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
	pushq	%rbx
	leaq	-5197824(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$2360, %rsp
	.cfi_offset 3, -24
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
	leaq	-5200188(%rbp), %rdx
	leaq	-5200184(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, -5200168(%rbp)
	jmp	.L9
.L10:
	movl	-5200168(%rbp), %eax
	cltq
	movl	$0, -5200144(%rbp,%rax,4)
	movl	-5200168(%rbp), %eax
	cltq
	movl	$0, -4800112(%rbp,%rax,4)
	movl	-5200168(%rbp), %eax
	cltq
	movl	$0, -4400080(%rbp,%rax,4)
	addl	$1, -5200168(%rbp)
.L9:
	movl	-5200184(%rbp), %eax
	cmpl	%eax, -5200168(%rbp)
	jle	.L10
	movl	$0, -5200168(%rbp)
	jmp	.L11
.L12:
	leaq	-5200176(%rbp), %rdx
	leaq	-5200180(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-5200176(%rbp), %eax
	movslq	%eax, %rdx
	movl	-4400080(%rbp,%rdx,4), %edx
	addl	$1, %edx
	cltq
	movl	%edx, -4400080(%rbp,%rax,4)
	movl	-5200176(%rbp), %edx
	movl	-5200180(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	insert
	addl	$1, -5200168(%rbp)
.L11:
	movl	-5200188(%rbp), %eax
	cmpl	%eax, -5200168(%rbp)
	jl	.L12
	movl	$1, -5200168(%rbp)
	jmp	.L13
.L23:
	movl	$0, -5200164(%rbp)
	movl	$-1, -5200160(%rbp)
	movl	-5200168(%rbp), %eax
	cltq
	movl	-4400080(%rbp,%rax,4), %eax
	testl	%eax, %eax
	jne	.L14
	movl	-5200168(%rbp), %eax
	cltq
	movl	-5200144(%rbp,%rax,4), %eax
	testl	%eax, %eax
	jne	.L14
	movl	-5200168(%rbp), %eax
	cltq
	movl	$1, -5200144(%rbp,%rax,4)
	movl	-5200168(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	%rax, -5200152(%rbp)
	jmp	.L15
.L17:
	movq	-5200152(%rbp), %rax
	movl	(%rax), %eax
	movslq	%eax, %rdx
	movl	-4400080(%rbp,%rdx,4), %edx
	subl	$1, %edx
	cltq
	movl	%edx, -4400080(%rbp,%rax,4)
	movq	-5200152(%rbp), %rax
	movl	(%rax), %eax
	cltq
	movl	-4400080(%rbp,%rax,4), %eax
	testl	%eax, %eax
	jne	.L16
	addl	$1, -5200160(%rbp)
	movq	-5200152(%rbp), %rax
	movl	(%rax), %edx
	movl	-5200160(%rbp), %eax
	cltq
	movl	%edx, -4000048(%rbp,%rax,4)
.L16:
	movl	-5200168(%rbp), %eax
	cltq
	movl	-4800112(%rbp,%rax,4), %eax
	leal	1(%rax), %edx
	movq	-5200152(%rbp), %rax
	movl	(%rax), %eax
	cltq
	movl	-4800112(%rbp,%rax,4), %eax
	movq	-5200152(%rbp), %rcx
	movl	(%rcx), %ebx
	movl	%edx, %esi
	movl	%eax, %edi
	call	max
	movslq	%ebx, %rdx
	movl	%eax, -4800112(%rbp,%rdx,4)
	movq	-5200152(%rbp), %rax
	movq	8(%rax), %rax
	movq	%rax, -5200152(%rbp)
.L15:
	cmpq	$0, -5200152(%rbp)
	jne	.L17
	jmp	.L18
.L22:
	movl	-5200164(%rbp), %eax
	cltq
	movl	-4000048(%rbp,%rax,4), %eax
	movl	%eax, -5200156(%rbp)
	movl	-5200156(%rbp), %eax
	cltq
	movl	$1, -5200144(%rbp,%rax,4)
	movl	-5200156(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rax
	movq	%rax, -5200152(%rbp)
	jmp	.L19
.L21:
	movq	-5200152(%rbp), %rax
	movl	(%rax), %eax
	movslq	%eax, %rdx
	movl	-4400080(%rbp,%rdx,4), %edx
	subl	$1, %edx
	cltq
	movl	%edx, -4400080(%rbp,%rax,4)
	movq	-5200152(%rbp), %rax
	movl	(%rax), %eax
	cltq
	movl	-4400080(%rbp,%rax,4), %eax
	testl	%eax, %eax
	jne	.L20
	addl	$1, -5200160(%rbp)
	movq	-5200152(%rbp), %rax
	movl	(%rax), %edx
	movl	-5200160(%rbp), %eax
	cltq
	movl	%edx, -4000048(%rbp,%rax,4)
.L20:
	movl	-5200156(%rbp), %eax
	cltq
	movl	-4800112(%rbp,%rax,4), %eax
	leal	1(%rax), %edx
	movq	-5200152(%rbp), %rax
	movl	(%rax), %eax
	cltq
	movl	-4800112(%rbp,%rax,4), %eax
	movq	-5200152(%rbp), %rcx
	movl	(%rcx), %ebx
	movl	%edx, %esi
	movl	%eax, %edi
	call	max
	movslq	%ebx, %rdx
	movl	%eax, -4800112(%rbp,%rdx,4)
	movq	-5200152(%rbp), %rax
	movq	8(%rax), %rax
	movq	%rax, -5200152(%rbp)
.L19:
	cmpq	$0, -5200152(%rbp)
	jne	.L21
	addl	$1, -5200164(%rbp)
.L18:
	movl	-5200164(%rbp), %eax
	cmpl	-5200160(%rbp), %eax
	jle	.L22
.L14:
	addl	$1, -5200168(%rbp)
.L13:
	movl	-5200184(%rbp), %eax
	cmpl	%eax, -5200168(%rbp)
	jle	.L23
	movl	$-1, -5200172(%rbp)
	movl	$1, -5200168(%rbp)
	jmp	.L24
.L26:
	movl	-5200168(%rbp), %eax
	cltq
	movl	-4800112(%rbp,%rax,4), %eax
	cmpl	%eax, -5200172(%rbp)
	jge	.L25
	movl	-5200168(%rbp), %eax
	cltq
	movl	-4800112(%rbp,%rax,4), %eax
	movl	%eax, -5200172(%rbp)
.L25:
	addl	$1, -5200168(%rbp)
.L24:
	movl	-5200184(%rbp), %eax
	cmpl	%eax, -5200168(%rbp)
	jle	.L26
	movl	-5200172(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-24(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L28
	call	__stack_chk_fail@PLT
.L28:
	movq	-8(%rbp), %rbx
	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:
