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 max(x, y) ((x)<(y) ? (y) : (x))

int main(){
  int n, m;  scanf("%d %d", &n, &m);
  int **graph, *to, *ans, *table, anslen = 0;
  graph = (int**)malloc(sizeof(int*)*(n+3));
  to    = (int*) malloc(sizeof(int) *(n+3));
  ans   = (int*) malloc(sizeof(int) *(n+3));
  table = (int*) malloc(sizeof(int) *(n+3));
  for(int i=0; i<n+3; i++)
    graph[i] = (int*)malloc(sizeof(int)*(n+3));

  while(m--){
    int x, y;  scanf("%d %d", &x, &y);
    graph[x][++graph[x][0]] = y;
    to[y]++;
  }
    
  int queue[100005] = {0}, front = 0, rear = 0;
  for(int i=1; i<=n; i++)  
    if(!to[i])  queue[rear++] = i;
  
  while(front != rear){
    int now = queue[front];  front = (front + 1) % 100005;
    ans[anslen++] = now;
    for(int i=1; i<=graph[now][0]; i++)
      if(--to[graph[now][i]] == 0)
	queue[rear] = graph[now][i],  rear = (rear + 1) % 100005;
  }

  int r = 0;
  for(int i=0; i<anslen; i++)
    for(int j=1; j<=graph[ans[i]][0]; j++){
      table[graph[ans[i]][j]] = max(table[graph[ans[i]][j]], table[ans[i]]+1);
      r = max(r, table[graph[ans[i]][j]]);
    }
  
  printf("%d\n", r);

  free(graph);
  free(to);
  free(ans);
  return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d\n"
	.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
	pushq	%rbx
	leaq	-397312(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$2824, %rsp
	.cfi_offset 3, -24
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
	leaq	-400132(%rbp), %rdx
	leaq	-400136(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -400120(%rbp)
	movl	-400136(%rbp), %eax
	addl	$3, %eax
	cltq
	salq	$3, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -400080(%rbp)
	movl	-400136(%rbp), %eax
	addl	$3, %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -400072(%rbp)
	movl	-400136(%rbp), %eax
	addl	$3, %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -400064(%rbp)
	movl	-400136(%rbp), %eax
	addl	$3, %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -400056(%rbp)
	movl	$0, -400116(%rbp)
	jmp	.L2
.L3:
	movl	-400136(%rbp), %eax
	addl	$3, %eax
	cltq
	salq	$2, %rax
	movl	-400116(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	movq	-400080(%rbp), %rdx
	leaq	(%rcx,%rdx), %rbx
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, (%rbx)
	addl	$1, -400116(%rbp)
.L2:
	movl	-400136(%rbp), %eax
	addl	$2, %eax
	cmpl	%eax, -400116(%rbp)
	jle	.L3
	jmp	.L4
.L5:
	leaq	-400124(%rbp), %rdx
	leaq	-400128(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-400128(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-400080(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rcx
	movl	-400128(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-400080(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	movl	(%rax), %edx
	addl	$1, %edx
	movl	%edx, (%rax)
	movl	(%rax), %eax
	cltq
	salq	$2, %rax
	leaq	(%rcx,%rax), %rdx
	movl	-400124(%rbp), %eax
	movl	%eax, (%rdx)
	movl	-400124(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-400072(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	addl	$1, %edx
	movl	%edx, (%rax)
.L4:
	movl	-400132(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -400132(%rbp)
	testl	%eax, %eax
	jne	.L5
	leaq	-400048(%rbp), %rax
	movl	$400020, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, -400112(%rbp)
	movl	$0, -400108(%rbp)
	movl	$1, -400104(%rbp)
	jmp	.L6
.L8:
	movl	-400104(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-400072(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	testl	%eax, %eax
	jne	.L7
	movl	-400108(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -400108(%rbp)
	cltq
	movl	-400104(%rbp), %edx
	movl	%edx, -400048(%rbp,%rax,4)
.L7:
	addl	$1, -400104(%rbp)
.L6:
	movl	-400136(%rbp), %eax
	cmpl	%eax, -400104(%rbp)
	jle	.L8
	jmp	.L9
.L13:
	movl	-400112(%rbp), %eax
	cltq
	movl	-400048(%rbp,%rax,4), %eax
	movl	%eax, -400084(%rbp)
	movl	-400112(%rbp), %eax
	addl	$1, %eax
	movslq	%eax, %rdx
	imulq	$-1480358259, %rdx, %rdx
	shrq	$32, %rdx
	addl	%eax, %edx
	sarl	$16, %edx
	movl	%eax, %ecx
	sarl	$31, %ecx
	subl	%ecx, %edx
	movl	%edx, -400112(%rbp)
	movl	-400112(%rbp), %edx
	imull	$100005, %edx, %edx
	subl	%edx, %eax
	movl	%eax, -400112(%rbp)
	movl	-400120(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -400120(%rbp)
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-400064(%rbp), %rax
	addq	%rax, %rdx
	movl	-400084(%rbp), %eax
	movl	%eax, (%rdx)
	movl	$1, -400100(%rbp)
	jmp	.L10
.L12:
	movl	-400084(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-400080(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-400100(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-400072(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	subl	$1, %edx
	movl	%edx, (%rax)
	movl	(%rax), %eax
	testl	%eax, %eax
	jne	.L11
	movl	-400084(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-400080(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-400100(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movl	-400108(%rbp), %eax
	cltq
	movl	%edx, -400048(%rbp,%rax,4)
	movl	-400108(%rbp), %eax
	addl	$1, %eax
	movslq	%eax, %rdx
	imulq	$-1480358259, %rdx, %rdx
	shrq	$32, %rdx
	addl	%eax, %edx
	sarl	$16, %edx
	movl	%eax, %ecx
	sarl	$31, %ecx
	subl	%ecx, %edx
	movl	%edx, -400108(%rbp)
	movl	-400108(%rbp), %edx
	imull	$100005, %edx, %edx
	subl	%edx, %eax
	movl	%eax, -400108(%rbp)
.L11:
	addl	$1, -400100(%rbp)
.L10:
	movl	-400084(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-400080(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	movl	(%rax), %eax
	cmpl	%eax, -400100(%rbp)
	jle	.L12
.L9:
	movl	-400112(%rbp), %eax
	cmpl	-400108(%rbp), %eax
	jne	.L13
	movl	$0, -400096(%rbp)
	movl	$0, -400092(%rbp)
	jmp	.L14
.L19:
	movl	$1, -400088(%rbp)
	jmp	.L15
.L18:
	movl	-400092(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-400064(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-400056(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movl	-400092(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	movq	-400064(%rbp), %rax
	addq	%rcx, %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	movq	-400080(%rbp), %rax
	addq	%rcx, %rax
	movq	(%rax), %rcx
	movl	-400088(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rcx, %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	movq	-400056(%rbp), %rax
	addq	%rcx, %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jl	.L16
	movl	-400092(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-400064(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-400056(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	addl	$1, %eax
	jmp	.L17
.L16:
	movl	-400092(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-400064(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-400080(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-400088(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-400056(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
.L17:
	movl	-400092(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	movq	-400064(%rbp), %rdx
	addq	%rcx, %rdx
	movl	(%rdx), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	movq	-400080(%rbp), %rdx
	addq	%rcx, %rdx
	movq	(%rdx), %rcx
	movl	-400088(%rbp), %edx
	movslq	%edx, %rdx
	salq	$2, %rdx
	addq	%rcx, %rdx
	movl	(%rdx), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	movq	-400056(%rbp), %rdx
	addq	%rcx, %rdx
	movl	%eax, (%rdx)
	movl	-400092(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-400064(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-400080(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-400088(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-400056(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	-400096(%rbp), %edx
	cmpl	%eax, %edx
	cmovge	%edx, %eax
	movl	%eax, -400096(%rbp)
	addl	$1, -400088(%rbp)
.L15:
	movl	-400092(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-400064(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-400080(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	movl	(%rax), %eax
	cmpl	%eax, -400088(%rbp)
	jle	.L18
	addl	$1, -400092(%rbp)
.L14:
	movl	-400092(%rbp), %eax
	cmpl	-400120(%rbp), %eax
	jl	.L19
	movl	-400096(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movq	-400080(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	movq	-400072(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	movq	-400064(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	movl	$0, %eax
	movq	-24(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L21
	call	__stack_chk_fail@PLT
.L21:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.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
	.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:
.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
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	-397312(%rsp), %r11
	.cfi_def_cfa 11, 397368
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$2760, %rsp
	.cfi_def_cfa_offset 400128
	leaq	.LC0(%rip), %r14
	movq	%r14, %rdi
	movq	%fs:40, %rax
	movq	%rax, 400056(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %rsi
	leaq	20(%rsp), %rdx
	call	__isoc99_scanf@PLT
	movl	16(%rsp), %edx
	leal	3(%rdx), %ebx
	movl	%edx, 8(%rsp)
	movslq	%ebx, %rbx
	leaq	0(,%rbx,8), %rdi
	salq	$2, %rbx
	call	malloc@PLT
	movq	%rbx, %rdi
	movq	%rax, %r12
	call	malloc@PLT
	movq	%rbx, %rdi
	movq	%rax, %rbp
	call	malloc@PLT
	movq	%rbx, %rdi
	movq	%rax, (%rsp)
	call	malloc@PLT
	movl	8(%rsp), %edx
	movq	%rax, %r13
	cmpl	$-2, %edx
	jl	.L2
	leal	2(%rdx), %eax
	movq	%r12, %r15
	leaq	8(%r12,%rax,8), %rax
	movq	%rax, 8(%rsp)
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%rbx, %rdi
	addq	$8, %r15
	call	malloc@PLT
	movq	%rax, -8(%r15)
	cmpq	%r15, 8(%rsp)
	jne	.L3
.L2:
	movl	20(%rsp), %eax
	leal	-1(%rax), %edx
	movl	%edx, 20(%rsp)
	testl	%eax, %eax
	je	.L4
	leaq	28(%rsp), %r15
	leaq	24(%rsp), %rbx
	.p2align 4,,10
	.p2align 3
.L5:
	movq	%r15, %rdx
	movq	%rbx, %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	24(%rsp), %rax
	movl	28(%rsp), %edx
	movq	(%r12,%rax,8), %rsi
	movl	(%rsi), %eax
	addl	$1, %eax
	movl	%eax, (%rsi)
	cltq
	movl	%edx, (%rsi,%rax,4)
	movslq	%edx, %rax
	addl	$1, 0(%rbp,%rax,4)
	movl	20(%rsp), %eax
	leal	-1(%rax), %edx
	movl	%edx, 20(%rsp)
	testl	%eax, %eax
	jne	.L5
.L4:
	leaq	32(%rsp), %rdi
	movl	$400020, %edx
	xorl	%esi, %esi
	call	memset@PLT
	movl	16(%rsp), %eax
	testl	%eax, %eax
	jle	.L6
	leal	1(%rax), %esi
	movl	$1, %edx
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L8:
	movl	0(%rbp,%rdx,4), %ecx
	testl	%ecx, %ecx
	jne	.L7
	movslq	%eax, %rdi
	addl	$1, %eax
	movl	%edx, 32(%rsp,%rdi,4)
.L7:
	addq	$1, %rdx
	cmpq	%rdx, %rsi
	jne	.L8
	testl	%eax, %eax
	je	.L6
	xorl	%r9d, %r9d
	xorl	%edi, %edi
	.p2align 4,,10
	.p2align 3
.L12:
	leal	1(%rdi), %esi
	movslq	%edi, %rdx
	movq	(%rsp), %rbx
	movslq	%esi, %rdi
	movl	%esi, %r8d
	movslq	32(%rsp,%rdx,4), %rdx
	imulq	$-1480358259, %rdi, %rdi
	sarl	$31, %r8d
	movl	%edx, (%rbx,%r9,4)
	movq	(%r12,%rdx,8), %rdx
	shrq	$32, %rdi
	addl	%esi, %edi
	sarl	$16, %edi
	subl	%r8d, %edi
	imull	$100005, %edi, %r8d
	movl	%esi, %edi
	subl	%r8d, %edi
	movl	(%rdx), %r8d
	testl	%r8d, %r8d
	jle	.L9
	subl	$1, %r8d
	leaq	4(%rdx), %rsi
	leaq	8(%rdx,%r8,4), %r8
	.p2align 4,,10
	.p2align 3
.L11:
	movslq	(%rsi), %rdx
	leaq	0(%rbp,%rdx,4), %r10
	movq	%rdx, %r11
	subl	$1, (%r10)
	jne	.L10
	movslq	%eax, %rdx
	movl	%r11d, 32(%rsp,%rdx,4)
	leal	1(%rax), %edx
	movslq	%edx, %rax
	movl	%edx, %r10d
	imulq	$-1480358259, %rax, %rax
	sarl	$31, %r10d
	shrq	$32, %rax
	addl	%edx, %eax
	sarl	$16, %eax
	subl	%r10d, %eax
	imull	$100005, %eax, %r10d
	movl	%edx, %eax
	subl	%r10d, %eax
.L10:
	addq	$4, %rsi
	cmpq	%rsi, %r8
	jne	.L11
.L9:
	leaq	1(%r9), %rdx
	cmpl	%eax, %edi
	je	.L36
	movq	%rdx, %r9
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L36:
	movq	(%rsp), %rax
	xorl	%r8d, %r8d
	movq	%rax, %r11
	leaq	4(%rax,%r9,4), %rbx
	.p2align 4,,10
	.p2align 3
.L13:
	movslq	(%r11), %rax
	movq	(%r12,%rax,8), %rdx
	movl	(%rdx), %esi
	testl	%esi, %esi
	jle	.L16
	subl	$1, %esi
	leaq	0(%r13,%rax,4), %r10
	leaq	4(%rdx), %rax
	leaq	8(%rdx,%rsi,4), %r9
	jmp	.L34
	.p2align 4,,10
	.p2align 3
.L37:
	addl	$1, %edx
	cmpl	%edx, %r8d
	movl	%edx, (%rdi)
	cmovl	%edx, %r8d
	addq	$4, %rax
	cmpq	%rax, %r9
	je	.L16
.L34:
	movl	(%r10), %edx
.L17:
	movslq	(%rax), %rsi
	leaq	0(%r13,%rsi,4), %rdi
	movl	(%rdi), %esi
	cmpl	%edx, %esi
	jle	.L37
	cmpl	%esi, %r8d
	cmovl	%esi, %r8d
	addq	$4, %rax
	cmpq	%rax, %r9
	jne	.L17
.L16:
	addq	$4, %r11
	cmpq	%rbx, %r11
	jne	.L13
.L18:
	movl	%r8d, %edx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	%r12, %rdi
	call	free@PLT
	movq	%rbp, %rdi
	call	free@PLT
	movq	(%rsp), %rdi
	call	free@PLT
	movq	400056(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L38
	addq	$400072, %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
.L6:
	.cfi_restore_state
	xorl	%r8d, %r8d
	jmp	.L18
.L38:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE39:
	.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:

rule
	.file	"temp.c"
	.text
	.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:
.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
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	-397312(%rsp), %r11
	.cfi_def_cfa 11, 397368
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$2760, %rsp
	.cfi_def_cfa_offset 400128
	leaq	.LC0(%rip), %r14
	movq	%r14, %rdi
	movq	%fs:40, %rax
	movq	%rax, 400056(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %rsi
	leaq	20(%rsp), %rdx
	call	__isoc99_scanf@PLT
	movl	16(%rsp), %edx
	leal	3(%rdx), %ebx
	movl	%edx, 8(%rsp)
	movslq	%ebx, %rbx
	leaq	0(,%rbx,8), %rdi
	salq	$2, %rbx
	call	malloc@PLT
	movq	%rbx, %rdi
	movq	%rax, %r12
	call	malloc@PLT
	movq	%rbx, %rdi
	movq	%rax, %rbp
	call	malloc@PLT
	movq	%rbx, %rdi
	movq	%rax, (%rsp)
	call	malloc@PLT
	movl	8(%rsp), %edx
	movq	%rax, %r13
	cmpl	$-2, %edx
	jl	.L2
	leal	2(%rdx), %eax
	movq	%r12, %r15
	leaq	8(%r12,%rax,8), %rax
	movq	%rax, 8(%rsp)
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%rbx, %rdi
	addq	$8, %r15
	call	malloc@PLT
	movq	%rax, -8(%r15)
	cmpq	%r15, 8(%rsp)
	jne	.L3
.L2:
	movl	20(%rsp), %eax
	leal	-1(%rax), %edx
	movl	%edx, 20(%rsp)
	testl	%eax, %eax
	je	.L4
	leaq	28(%rsp), %r15
	leaq	24(%rsp), %rbx
	.p2align 4,,10
	.p2align 3
.L5:
	movq	%r15, %rdx
	movq	%rbx, %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	24(%rsp), %rax
	movl	28(%rsp), %edx
	movq	(%r12,%rax,8), %rsi
	movl	(%rsi), %eax
	addl	$1, %eax
	movl	%eax, (%rsi)
	cltq
	movl	%edx, (%rsi,%rax,4)
	movslq	%edx, %rax
	addl	$1, 0(%rbp,%rax,4)
	movl	20(%rsp), %eax
	leal	-1(%rax), %edx
	movl	%edx, 20(%rsp)
	testl	%eax, %eax
	jne	.L5
.L4:
	leaq	32(%rsp), %rdi
	movl	$400020, %edx
	xorl	%esi, %esi
	call	memset@PLT
	movl	16(%rsp), %eax
	testl	%eax, %eax
	jle	.L6
	leal	1(%rax), %esi
	movl	$1, %edx
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L8:
	movl	0(%rbp,%rdx,4), %ecx
	testl	%ecx, %ecx
	jne	.L7
	movslq	%eax, %rdi
	addl	$1, %eax
	movl	%edx, 32(%rsp,%rdi,4)
.L7:
	addq	$1, %rdx
	cmpq	%rdx, %rsi
	jne	.L8
	testl	%eax, %eax
	je	.L6
	xorl	%r9d, %r9d
	xorl	%edi, %edi
	.p2align 4,,10
	.p2align 3
.L12:
	leal	1(%rdi), %esi
	movslq	%edi, %rdx
	movq	(%rsp), %rbx
	movslq	%esi, %rdi
	movl	%esi, %r8d
	movslq	32(%rsp,%rdx,4), %rdx
	imulq	$-1480358259, %rdi, %rdi
	sarl	$31, %r8d
	movl	%edx, (%rbx,%r9,4)
	movq	(%r12,%rdx,8), %rdx
	shrq	$32, %rdi
	addl	%esi, %edi
	sarl	$16, %edi
	subl	%r8d, %edi
	imull	$100005, %edi, %r8d
	movl	%esi, %edi
	subl	%r8d, %edi
	movl	(%rdx), %r8d
	testl	%r8d, %r8d
	jle	.L9
	subl	$1, %r8d
	leaq	4(%rdx), %rsi
	leaq	8(%rdx,%r8,4), %r8
	.p2align 4,,10
	.p2align 3
.L11:
	movslq	(%rsi), %rdx
	leaq	0(%rbp,%rdx,4), %r10
	movq	%rdx, %r11
	subl	$1, (%r10)
	jne	.L10
	movslq	%eax, %rdx
	movl	%r11d, 32(%rsp,%rdx,4)
	leal	1(%rax), %edx
	movslq	%edx, %rax
	movl	%edx, %r10d
	imulq	$-1480358259, %rax, %rax
	sarl	$31, %r10d
	shrq	$32, %rax
	addl	%edx, %eax
	sarl	$16, %eax
	subl	%r10d, %eax
	imull	$100005, %eax, %r10d
	movl	%edx, %eax
	subl	%r10d, %eax
.L10:
	addq	$4, %rsi
	cmpq	%rsi, %r8
	jne	.L11
.L9:
	leaq	1(%r9), %rdx
	cmpl	%eax, %edi
	je	.L36
	movq	%rdx, %r9
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L36:
	movq	(%rsp), %rax
	xorl	%r8d, %r8d
	movq	%rax, %r11
	leaq	4(%rax,%r9,4), %rbx
	.p2align 4,,10
	.p2align 3
.L13:
	movslq	(%r11), %rax
	movq	(%r12,%rax,8), %rdx
	movl	(%rdx), %esi
	testl	%esi, %esi
	jle	.L16
	subl	$1, %esi
	leaq	0(%r13,%rax,4), %r10
	leaq	4(%rdx), %rax
	leaq	8(%rdx,%rsi,4), %r9
	jmp	.L34
	.p2align 4,,10
	.p2align 3
.L37:
	addl	$1, %edx
	cmpl	%edx, %r8d
	movl	%edx, (%rdi)
	cmovl	%edx, %r8d
	addq	$4, %rax
	cmpq	%rax, %r9
	je	.L16
.L34:
	movl	(%r10), %edx
.L17:
	movslq	(%rax), %rsi
	leaq	0(%r13,%rsi,4), %rdi
	movl	(%rdi), %esi
	cmpl	%edx, %esi
	jle	.L37
	cmpl	%esi, %r8d
	cmovl	%esi, %r8d
	addq	$4, %rax
	cmpq	%rax, %r9
	jne	.L17
.L16:
	addq	$4, %r11
	cmpq	%rbx, %r11
	jne	.L13
.L18:
	movl	%r8d, %edx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	%r12, %rdi
	call	free@PLT
	movq	%rbp, %rdi
	call	free@PLT
	movq	(%rsp), %rdi
	call	free@PLT
	movq	400056(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L38
	addq	$400072, %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
.L6:
	.cfi_restore_state
	xorl	%r8d, %r8d
	jmp	.L18
.L38:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE39:
	.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:

#include <stdio.h>
#include <stdlib.h>
#define max(x, y) ((x)<(y) ? (y) : (x))

int main(){
  int n, m;  scanf("%d %d", &n, &m);
  int **graph, *to, *ans, *table, anslen = 0;
  graph = (int**)malloc(sizeof(int*)*(n+3));
  to    = (int*) malloc(sizeof(int) *(n+3));
  ans   = (int*) malloc(sizeof(int) *(n+3));
  table = (int*) malloc(sizeof(int) *(n+3));
  for(int i=0; i<n+3; i++)
    graph[i] = (int*)malloc(sizeof(int)*(n+3));

  while(m--){
    int x, y;  scanf("%d %d", &x, &y);
    graph[x][++graph[x][0]] = y;
    to[y]++;
  }
    
  int queue[100005] = {0}, front = 0, rear = 0;
  for(int i=1; i<=n; i++)  
    if(!to[i])  queue[rear++] = i;
  
  while(front != rear){
    int now = queue[front];  front = (front + 1) % 100005;
    ans[anslen++] = now;
    for(int i=1; i<=graph[now][0]; i++)
      if(--to[graph[now][i]] == 0)
	queue[rear] = graph[now][i],  rear = (rear + 1) % 100005;
  }

  int r = 0;
  for(int i=0; i<anslen; i++)
    for(int j=1; j<=graph[ans[i]][0]; j++){
      table[graph[ans[i]][j]] = max(table[graph[ans[i]][j]], table[ans[i]]+1);
      r = max(r, table[graph[ans[i]][j]]);
    }
  
  printf("%d\n", r);

  free(graph);
  free(to);
  free(ans);
  return 0;
}

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 max(x, y) ((x)<(y) ? (y) : (x))

int main(){
  int n, m;  scanf("%d %d", &n, &m);
  int **graph, *to, *ans, *table, anslen = 0;
  graph = (int**)malloc(sizeof(int*)*(n+3));
  to    = (int*) malloc(sizeof(int) *(n+3));
  ans   = (int*) malloc(sizeof(int) *(n+3));
  table = (int*) malloc(sizeof(int) *(n+3));
  for(int i=0; i<n+3; i++)
    graph[i] = (int*)malloc(sizeof(int)*(n+3));

  while(m--){
    int x, y;  scanf("%d %d", &x, &y);
    graph[x][++graph[x][0]] = y;
    to[y]++;
  }
    
  int queue[100005] = {0}, front = 0, rear = 0;
  for(int i=1; i<=n; i++)  
    if(!to[i])  queue[rear++] = i;
  
  while(front != rear){
    int now = queue[front];  front = (front + 1) % 100005;
    ans[anslen++] = now;
    for(int i=1; i<=graph[now][0]; i++)
      if(--to[graph[now][i]] == 0)
	queue[rear] = graph[now][i],  rear = (rear + 1) % 100005;
  }

  int r = 0;
  for(int i=0; i<anslen; i++)
    for(int j=1; j<=graph[ans[i]][0]; j++){
      table[graph[ans[i]][j]] = max(table[graph[ans[i]][j]], table[ans[i]]+1);
      r = max(r, table[graph[ans[i]][j]]);
    }
  
  printf("%d\n", r);

  free(graph);
  free(to);
  free(ans);
  return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d\n"
	.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
	pushq	%rbx
	leaq	-397312(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$2824, %rsp
	.cfi_offset 3, -24
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
	leaq	-400132(%rbp), %rdx
	leaq	-400136(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -400120(%rbp)
	movl	-400136(%rbp), %eax
	addl	$3, %eax
	cltq
	salq	$3, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -400080(%rbp)
	movl	-400136(%rbp), %eax
	addl	$3, %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -400072(%rbp)
	movl	-400136(%rbp), %eax
	addl	$3, %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -400064(%rbp)
	movl	-400136(%rbp), %eax
	addl	$3, %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -400056(%rbp)
	movl	$0, -400116(%rbp)
	jmp	.L2
.L3:
	movl	-400136(%rbp), %eax
	addl	$3, %eax
	cltq
	salq	$2, %rax
	movl	-400116(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	movq	-400080(%rbp), %rdx
	leaq	(%rcx,%rdx), %rbx
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, (%rbx)
	addl	$1, -400116(%rbp)
.L2:
	movl	-400136(%rbp), %eax
	addl	$2, %eax
	cmpl	%eax, -400116(%rbp)
	jle	.L3
	jmp	.L4
.L5:
	leaq	-400124(%rbp), %rdx
	leaq	-400128(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-400128(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-400080(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rcx
	movl	-400128(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-400080(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	movl	(%rax), %edx
	addl	$1, %edx
	movl	%edx, (%rax)
	movl	(%rax), %eax
	cltq
	salq	$2, %rax
	leaq	(%rcx,%rax), %rdx
	movl	-400124(%rbp), %eax
	movl	%eax, (%rdx)
	movl	-400124(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-400072(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	addl	$1, %edx
	movl	%edx, (%rax)
.L4:
	movl	-400132(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -400132(%rbp)
	testl	%eax, %eax
	jne	.L5
	leaq	-400048(%rbp), %rax
	movl	$400020, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, -400112(%rbp)
	movl	$0, -400108(%rbp)
	movl	$1, -400104(%rbp)
	jmp	.L6
.L8:
	movl	-400104(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-400072(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	testl	%eax, %eax
	jne	.L7
	movl	-400108(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -400108(%rbp)
	cltq
	movl	-400104(%rbp), %edx
	movl	%edx, -400048(%rbp,%rax,4)
.L7:
	addl	$1, -400104(%rbp)
.L6:
	movl	-400136(%rbp), %eax
	cmpl	%eax, -400104(%rbp)
	jle	.L8
	jmp	.L9
.L13:
	movl	-400112(%rbp), %eax
	cltq
	movl	-400048(%rbp,%rax,4), %eax
	movl	%eax, -400084(%rbp)
	movl	-400112(%rbp), %eax
	addl	$1, %eax
	movslq	%eax, %rdx
	imulq	$-1480358259, %rdx, %rdx
	shrq	$32, %rdx
	addl	%eax, %edx
	sarl	$16, %edx
	movl	%eax, %ecx
	sarl	$31, %ecx
	subl	%ecx, %edx
	movl	%edx, -400112(%rbp)
	movl	-400112(%rbp), %edx
	imull	$100005, %edx, %edx
	subl	%edx, %eax
	movl	%eax, -400112(%rbp)
	movl	-400120(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -400120(%rbp)
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-400064(%rbp), %rax
	addq	%rax, %rdx
	movl	-400084(%rbp), %eax
	movl	%eax, (%rdx)
	movl	$1, -400100(%rbp)
	jmp	.L10
.L12:
	movl	-400084(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-400080(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-400100(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-400072(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	subl	$1, %edx
	movl	%edx, (%rax)
	movl	(%rax), %eax
	testl	%eax, %eax
	jne	.L11
	movl	-400084(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-400080(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-400100(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movl	-400108(%rbp), %eax
	cltq
	movl	%edx, -400048(%rbp,%rax,4)
	movl	-400108(%rbp), %eax
	addl	$1, %eax
	movslq	%eax, %rdx
	imulq	$-1480358259, %rdx, %rdx
	shrq	$32, %rdx
	addl	%eax, %edx
	sarl	$16, %edx
	movl	%eax, %ecx
	sarl	$31, %ecx
	subl	%ecx, %edx
	movl	%edx, -400108(%rbp)
	movl	-400108(%rbp), %edx
	imull	$100005, %edx, %edx
	subl	%edx, %eax
	movl	%eax, -400108(%rbp)
.L11:
	addl	$1, -400100(%rbp)
.L10:
	movl	-400084(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-400080(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	movl	(%rax), %eax
	cmpl	%eax, -400100(%rbp)
	jle	.L12
.L9:
	movl	-400112(%rbp), %eax
	cmpl	-400108(%rbp), %eax
	jne	.L13
	movl	$0, -400096(%rbp)
	movl	$0, -400092(%rbp)
	jmp	.L14
.L19:
	movl	$1, -400088(%rbp)
	jmp	.L15
.L18:
	movl	-400092(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-400064(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-400056(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movl	-400092(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	movq	-400064(%rbp), %rax
	addq	%rcx, %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	movq	-400080(%rbp), %rax
	addq	%rcx, %rax
	movq	(%rax), %rcx
	movl	-400088(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rcx, %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	movq	-400056(%rbp), %rax
	addq	%rcx, %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jl	.L16
	movl	-400092(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-400064(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-400056(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	addl	$1, %eax
	jmp	.L17
.L16:
	movl	-400092(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-400064(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-400080(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-400088(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-400056(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
.L17:
	movl	-400092(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	movq	-400064(%rbp), %rdx
	addq	%rcx, %rdx
	movl	(%rdx), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	movq	-400080(%rbp), %rdx
	addq	%rcx, %rdx
	movq	(%rdx), %rcx
	movl	-400088(%rbp), %edx
	movslq	%edx, %rdx
	salq	$2, %rdx
	addq	%rcx, %rdx
	movl	(%rdx), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	movq	-400056(%rbp), %rdx
	addq	%rcx, %rdx
	movl	%eax, (%rdx)
	movl	-400092(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-400064(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-400080(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-400088(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-400056(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	-400096(%rbp), %edx
	cmpl	%eax, %edx
	cmovge	%edx, %eax
	movl	%eax, -400096(%rbp)
	addl	$1, -400088(%rbp)
.L15:
	movl	-400092(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-400064(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-400080(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	movl	(%rax), %eax
	cmpl	%eax, -400088(%rbp)
	jle	.L18
	addl	$1, -400092(%rbp)
.L14:
	movl	-400092(%rbp), %eax
	cmpl	-400120(%rbp), %eax
	jl	.L19
	movl	-400096(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movq	-400080(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	movq	-400072(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	movq	-400064(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	movl	$0, %eax
	movq	-24(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L21
	call	__stack_chk_fail@PLT
.L21:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.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
	.section	.rodata
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d\n"
	.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
	pushq	%rbx
	leaq	-397312(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$2824, %rsp
	.cfi_offset 3, -24
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
	leaq	-400132(%rbp), %rdx
	leaq	-400136(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -400120(%rbp)
	movl	-400136(%rbp), %eax
	addl	$3, %eax
	cltq
	salq	$3, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -400080(%rbp)
	movl	-400136(%rbp), %eax
	addl	$3, %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -400072(%rbp)
	movl	-400136(%rbp), %eax
	addl	$3, %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -400064(%rbp)
	movl	-400136(%rbp), %eax
	addl	$3, %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -400056(%rbp)
	movl	$0, -400116(%rbp)
	jmp	.L2
.L3:
	movl	-400136(%rbp), %eax
	addl	$3, %eax
	cltq
	salq	$2, %rax
	movl	-400116(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	movq	-400080(%rbp), %rdx
	leaq	(%rcx,%rdx), %rbx
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, (%rbx)
	addl	$1, -400116(%rbp)
.L2:
	movl	-400136(%rbp), %eax
	addl	$2, %eax
	cmpl	%eax, -400116(%rbp)
	jle	.L3
	jmp	.L4
.L5:
	leaq	-400124(%rbp), %rdx
	leaq	-400128(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-400128(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-400080(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rcx
	movl	-400128(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-400080(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	movl	(%rax), %edx
	addl	$1, %edx
	movl	%edx, (%rax)
	movl	(%rax), %eax
	cltq
	salq	$2, %rax
	leaq	(%rcx,%rax), %rdx
	movl	-400124(%rbp), %eax
	movl	%eax, (%rdx)
	movl	-400124(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-400072(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	addl	$1, %edx
	movl	%edx, (%rax)
.L4:
	movl	-400132(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -400132(%rbp)
	testl	%eax, %eax
	jne	.L5
	leaq	-400048(%rbp), %rax
	movl	$400020, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, -400112(%rbp)
	movl	$0, -400108(%rbp)
	movl	$1, -400104(%rbp)
	jmp	.L6
.L8:
	movl	-400104(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-400072(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	testl	%eax, %eax
	jne	.L7
	movl	-400108(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -400108(%rbp)
	cltq
	movl	-400104(%rbp), %edx
	movl	%edx, -400048(%rbp,%rax,4)
.L7:
	addl	$1, -400104(%rbp)
.L6:
	movl	-400136(%rbp), %eax
	cmpl	%eax, -400104(%rbp)
	jle	.L8
	jmp	.L9
.L13:
	movl	-400112(%rbp), %eax
	cltq
	movl	-400048(%rbp,%rax,4), %eax
	movl	%eax, -400084(%rbp)
	movl	-400112(%rbp), %eax
	addl	$1, %eax
	movslq	%eax, %rdx
	imulq	$-1480358259, %rdx, %rdx
	shrq	$32, %rdx
	addl	%eax, %edx
	sarl	$16, %edx
	movl	%eax, %ecx
	sarl	$31, %ecx
	subl	%ecx, %edx
	movl	%edx, -400112(%rbp)
	movl	-400112(%rbp), %edx
	imull	$100005, %edx, %edx
	subl	%edx, %eax
	movl	%eax, -400112(%rbp)
	movl	-400120(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -400120(%rbp)
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-400064(%rbp), %rax
	addq	%rax, %rdx
	movl	-400084(%rbp), %eax
	movl	%eax, (%rdx)
	movl	$1, -400100(%rbp)
	jmp	.L10
.L12:
	movl	-400084(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-400080(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-400100(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-400072(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	subl	$1, %edx
	movl	%edx, (%rax)
	movl	(%rax), %eax
	testl	%eax, %eax
	jne	.L11
	movl	-400084(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-400080(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-400100(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movl	-400108(%rbp), %eax
	cltq
	movl	%edx, -400048(%rbp,%rax,4)
	movl	-400108(%rbp), %eax
	addl	$1, %eax
	movslq	%eax, %rdx
	imulq	$-1480358259, %rdx, %rdx
	shrq	$32, %rdx
	addl	%eax, %edx
	sarl	$16, %edx
	movl	%eax, %ecx
	sarl	$31, %ecx
	subl	%ecx, %edx
	movl	%edx, -400108(%rbp)
	movl	-400108(%rbp), %edx
	imull	$100005, %edx, %edx
	subl	%edx, %eax
	movl	%eax, -400108(%rbp)
.L11:
	addl	$1, -400100(%rbp)
.L10:
	movl	-400084(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-400080(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	movl	(%rax), %eax
	cmpl	%eax, -400100(%rbp)
	jle	.L12
.L9:
	movl	-400112(%rbp), %eax
	cmpl	-400108(%rbp), %eax
	jne	.L13
	movl	$0, -400096(%rbp)
	movl	$0, -400092(%rbp)
	jmp	.L14
.L19:
	movl	$1, -400088(%rbp)
	jmp	.L15
.L18:
	movl	-400092(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-400064(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-400056(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movl	-400092(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	movq	-400064(%rbp), %rax
	addq	%rcx, %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	movq	-400080(%rbp), %rax
	addq	%rcx, %rax
	movq	(%rax), %rcx
	movl	-400088(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rcx, %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	movq	-400056(%rbp), %rax
	addq	%rcx, %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jl	.L16
	movl	-400092(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-400064(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-400056(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	addl	$1, %eax
	jmp	.L17
.L16:
	movl	-400092(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-400064(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-400080(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-400088(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-400056(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
.L17:
	movl	-400092(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	movq	-400064(%rbp), %rdx
	addq	%rcx, %rdx
	movl	(%rdx), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	movq	-400080(%rbp), %rdx
	addq	%rcx, %rdx
	movq	(%rdx), %rcx
	movl	-400088(%rbp), %edx
	movslq	%edx, %rdx
	salq	$2, %rdx
	addq	%rcx, %rdx
	movl	(%rdx), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	movq	-400056(%rbp), %rdx
	addq	%rcx, %rdx
	movl	%eax, (%rdx)
	movl	-400092(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-400064(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-400080(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-400088(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-400056(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	-400096(%rbp), %edx
	cmpl	%eax, %edx
	cmovge	%edx, %eax
	movl	%eax, -400096(%rbp)
	addl	$1, -400088(%rbp)
.L15:
	movl	-400092(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-400064(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-400080(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	movl	(%rax), %eax
	cmpl	%eax, -400088(%rbp)
	jle	.L18
	addl	$1, -400092(%rbp)
.L14:
	movl	-400092(%rbp), %eax
	cmpl	-400120(%rbp), %eax
	jl	.L19
	movl	-400096(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movq	-400080(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	movq	-400072(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	movq	-400064(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	movl	$0, %eax
	movq	-24(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L21
	call	__stack_chk_fail@PLT
.L21:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.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:
