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>
#include<stdint.h>
#include<inttypes.h>

typedef int32_t i32;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define ALLOC(size,type) ((type*)calloc((size),sizeof(type)))

typedef struct directed_edge {
  int32_t vertex;
  int32_t next;
} graph_edge;

typedef struct directedGraph {
  graph_edge *edge;
  int32_t *start;
  int32_t pointer;
  int32_t vertex_num;
  int32_t edge_max_size;
} graph;

graph* new_graph (const int vertex_num) {
  graph *g = (graph *) calloc (1, sizeof (graph));
  g->edge = (graph_edge *) calloc (1, sizeof (graph_edge));
  g->start = (int32_t *) calloc (vertex_num, sizeof (int32_t));
  g->pointer = 0;
  g->vertex_num = vertex_num;
  g->edge_max_size = 1;
  for (int32_t i = 0; i < vertex_num; ++i) {
    g->start[i] = -1;
  }
  return g;
}

void add_edge (graph *g, int32_t from, int32_t to) {
  if (g->pointer == g->edge_max_size) {
    g->edge_max_size *= 2;
    g->edge = (graph_edge *) realloc (g->edge, sizeof (graph_edge) * g->edge_max_size);
  }
  g->edge[g->pointer] = (graph_edge) {to, g->start[from]};
  g->start[from] = g->pointer++;
}

i32 calc (i32 v, graph *g, i32 *dp) {
  if (dp[v] >= 0) return dp[v];
  dp[v] = 0;
  for (i32 p = g->start[v]; p != -1; p = g->edge[p].next) {
    i32 u = g->edge[p].vertex;
    i32 x = calc (u, g, dp) + 1;
    dp[v] = MAX (dp[v], x);
  }
  return dp[v];
}

void run (void) {
  i32 n, m;
  scanf ("%" SCNi32 "%" SCNi32, &n, &m);
  graph *g = new_graph (n + 1);
  while (m--) {
    i32 x, y;
    scanf ("%" SCNi32 "%" SCNi32, &x, &y);
    add_edge (g, x, y);
  }
  for (i32 i = 1; i <= n; ++i) {
    add_edge (g, 0, i);
  }
  i32 *dp = ALLOC (n + 1, i32);
  for (i32 i = 0; i <=n; ++i) {
    dp[i] = -1;
  }
  i32 ans = calc (0, g, dp) - 1;
  printf ("%" PRIi32 "\n", ans);
}

int main (void) {
  run();
  return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	new_graph
	.type	new_graph, @function
new_graph:
.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	$32, %esi
	movl	$1, %edi
	call	calloc@PLT
	movq	%rax, -8(%rbp)
	movl	$8, %esi
	movl	$1, %edi
	call	calloc@PLT
	movq	%rax, %rdx
	movq	-8(%rbp), %rax
	movq	%rdx, (%rax)
	movl	-20(%rbp), %eax
	cltq
	movl	$4, %esi
	movq	%rax, %rdi
	call	calloc@PLT
	movq	%rax, %rdx
	movq	-8(%rbp), %rax
	movq	%rdx, 8(%rax)
	movq	-8(%rbp), %rax
	movl	$0, 16(%rax)
	movq	-8(%rbp), %rax
	movl	-20(%rbp), %edx
	movl	%edx, 20(%rax)
	movq	-8(%rbp), %rax
	movl	$1, 24(%rax)
	movl	$0, -12(%rbp)
	jmp	.L2
.L3:
	movq	-8(%rbp), %rax
	movq	8(%rax), %rdx
	movl	-12(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	$-1, (%rax)
	addl	$1, -12(%rbp)
.L2:
	movl	-12(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jl	.L3
	movq	-8(%rbp), %rax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	new_graph, .-new_graph
	.globl	add_edge
	.type	add_edge, @function
add_edge:
.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
	movq	%rdi, -8(%rbp)
	movl	%esi, -12(%rbp)
	movl	%edx, -16(%rbp)
	movq	-8(%rbp), %rax
	movl	16(%rax), %edx
	movq	-8(%rbp), %rax
	movl	24(%rax), %eax
	cmpl	%eax, %edx
	jne	.L6
	movq	-8(%rbp), %rax
	movl	24(%rax), %eax
	leal	(%rax,%rax), %edx
	movq	-8(%rbp), %rax
	movl	%edx, 24(%rax)
	movq	-8(%rbp), %rax
	movl	24(%rax), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-8(%rbp), %rax
	movq	(%rax), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	realloc@PLT
	movq	-8(%rbp), %rdx
	movq	%rax, (%rdx)
.L6:
	movq	-8(%rbp), %rax
	movq	(%rax), %rdx
	movq	-8(%rbp), %rax
	movl	16(%rax), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	movq	-8(%rbp), %rdx
	movq	8(%rdx), %rcx
	movl	-12(%rbp), %edx
	movslq	%edx, %rdx
	salq	$2, %rdx
	addq	%rcx, %rdx
	movl	(%rdx), %edx
	movl	-16(%rbp), %ecx
	movl	%ecx, (%rax)
	movl	%edx, 4(%rax)
	movq	-8(%rbp), %rax
	movl	16(%rax), %eax
	leal	1(%rax), %ecx
	movq	-8(%rbp), %rdx
	movl	%ecx, 16(%rdx)
	movq	-8(%rbp), %rdx
	movq	8(%rdx), %rcx
	movl	-12(%rbp), %edx
	movslq	%edx, %rdx
	salq	$2, %rdx
	addq	%rcx, %rdx
	movl	%eax, (%rdx)
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	add_edge, .-add_edge
	.globl	calc
	.type	calc, @function
calc:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movl	%edi, -20(%rbp)
	movq	%rsi, -32(%rbp)
	movq	%rdx, -40(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	testl	%eax, %eax
	js	.L8
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	jmp	.L9
.L8:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	$0, (%rax)
	movq	-32(%rbp), %rax
	movq	8(%rax), %rdx
	movl	-20(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -12(%rbp)
	jmp	.L10
.L11:
	movq	-32(%rbp), %rax
	movq	(%rax), %rdx
	movl	-12(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -8(%rbp)
	movq	-40(%rbp), %rdx
	movq	-32(%rbp), %rcx
	movl	-8(%rbp), %eax
	movq	%rcx, %rsi
	movl	%eax, %edi
	call	calc
	addl	$1, %eax
	movl	%eax, -4(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	movq	-40(%rbp), %rax
	addq	%rax, %rcx
	movl	-4(%rbp), %eax
	cmpl	%eax, %edx
	cmovge	%edx, %eax
	movl	%eax, (%rcx)
	movq	-32(%rbp), %rax
	movq	(%rax), %rdx
	movl	-12(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	movl	4(%rax), %eax
	movl	%eax, -12(%rbp)
.L10:
	cmpl	$-1, -12(%rbp)
	jne	.L11
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
.L9:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	calc, .-calc
	.section	.rodata
.LC0:
	.string	"%i%i"
.LC1:
	.string	"%i\n"
	.text
	.globl	run
	.type	run, @function
run:
.LFB9:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$64, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-48(%rbp), %rdx
	leaq	-52(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-52(%rbp), %eax
	addl	$1, %eax
	movl	%eax, %edi
	call	new_graph
	movq	%rax, -24(%rbp)
	jmp	.L13
.L14:
	leaq	-40(%rbp), %rdx
	leaq	-44(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-40(%rbp), %edx
	movl	-44(%rbp), %ecx
	movq	-24(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	add_edge
.L13:
	movl	-48(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -48(%rbp)
	testl	%eax, %eax
	jne	.L14
	movl	$1, -36(%rbp)
	jmp	.L15
.L16:
	movl	-36(%rbp), %edx
	movq	-24(%rbp), %rax
	movl	$0, %esi
	movq	%rax, %rdi
	call	add_edge
	addl	$1, -36(%rbp)
.L15:
	movl	-52(%rbp), %eax
	cmpl	%eax, -36(%rbp)
	jle	.L16
	movl	-52(%rbp), %eax
	addl	$1, %eax
	cltq
	movl	$4, %esi
	movq	%rax, %rdi
	call	calloc@PLT
	movq	%rax, -16(%rbp)
	movl	$0, -32(%rbp)
	jmp	.L17
.L18:
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	$-1, (%rax)
	addl	$1, -32(%rbp)
.L17:
	movl	-52(%rbp), %eax
	cmpl	%eax, -32(%rbp)
	jle	.L18
	movq	-16(%rbp), %rdx
	movq	-24(%rbp), %rax
	movq	%rax, %rsi
	movl	$0, %edi
	call	calc
	subl	$1, %eax
	movl	%eax, -28(%rbp)
	movl	-28(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	nop
	movq	-8(%rbp), %rax
	subq	%fs:40, %rax
	je	.L19
	call	__stack_chk_fail@PLT
.L19:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	run, .-run
	.globl	main
	.type	main, @function
main:
.LFB10:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	call	run
	movl	$0, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.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	new_graph
	.type	new_graph, @function
new_graph:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	movl	$32, %esi
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	movslq	%edi, %rbp
	movl	$1, %edi
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	call	calloc@PLT
	movl	$8, %esi
	movl	$1, %edi
	movq	%rax, %r12
	call	calloc@PLT
	movl	$4, %esi
	movq	%rbp, %rdi
	movq	%rax, (%r12)
	call	calloc@PLT
	movl	%ebp, 20(%r12)
	movq	%rax, 8(%r12)
	movl	$0, 16(%r12)
	movl	$1, 24(%r12)
	testl	%ebp, %ebp
	jle	.L1
	movq	%rax, %rdi
	leaq	0(,%rbp,4), %rdx
	movl	$255, %esi
	call	memset@PLT
.L1:
	movq	%r12, %rax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE39:
	.size	new_graph, .-new_graph
	.p2align 4
	.globl	add_edge
	.type	add_edge, @function
add_edge:
.LFB40:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	movl	%edx, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	movslq	%esi, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	movq	%rdi, %rbx
	movl	16(%rdi), %ecx
	movq	(%rdi), %rdi
	cmpl	24(%rbx), %ecx
	je	.L8
.L6:
	movq	8(%rbx), %rax
	movd	%r12d, %xmm0
	movslq	%ecx, %rsi
	leal	1(%rcx), %edx
	leaq	(%rax,%rbp,4), %rax
	movd	(%rax), %xmm1
	punpckldq	%xmm1, %xmm0
	movq	%xmm0, (%rdi,%rsi,8)
	movl	%edx, 16(%rbx)
	movl	%ecx, (%rax)
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L8:
	.cfi_restore_state
	addl	%ecx, %ecx
	movl	%ecx, 24(%rbx)
	movslq	%ecx, %rcx
	leaq	0(,%rcx,8), %rsi
	call	realloc@PLT
	movl	16(%rbx), %ecx
	movq	%rax, (%rbx)
	movq	%rax, %rdi
	jmp	.L6
	.cfi_endproc
.LFE40:
	.size	add_edge, .-add_edge
	.p2align 4
	.globl	calc
	.type	calc, @function
calc:
.LFB41:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movslq	%edi, %rcx
	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
	movq	%rdx, %r12
	leaq	(%rdx,%rcx,4), %rdx
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$136, %rsp
	.cfi_def_cfa_offset 192
	movl	(%rdx), %eax
	movq	%rsi, 24(%rsp)
	movq	%rdx, 112(%rsp)
	testl	%eax, %eax
	jns	.L9
	movq	8(%rsi), %rax
	movl	$0, (%rdx)
	movslq	(%rax,%rcx,4), %rcx
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	cmpl	$-1, %ecx
	je	.L9
	movq	(%rsi), %r15
	movq	%r12, %r13
	movq	%r15, %r12
.L44:
	leaq	(%r12,%rcx,8), %rbx
	movslq	(%rbx), %rsi
	movq	%rbx, 120(%rsp)
	leaq	0(%r13,%rsi,4), %rbx
	movl	(%rbx), %ecx
	movq	%rbx, 96(%rsp)
	testl	%ecx, %ecx
	jns	.L73
	movq	8(%rsp), %rax
	movl	$0, (%rbx)
	movl	$1, %ecx
	movslq	(%rax,%rsi,4), %rax
	cmpl	$-1, %eax
	je	.L14
	xorl	%ecx, %ecx
	movq	%r13, %r14
.L43:
	leaq	(%r12,%rax,8), %rax
	movslq	(%rax), %rsi
	movq	%rax, 104(%rsp)
	leaq	(%r14,%rsi,4), %rax
	movq	%rax, 80(%rsp)
	movl	(%rax), %eax
	testl	%eax, %eax
	jns	.L74
	movq	80(%rsp), %rax
	movl	$0, (%rax)
	movq	8(%rsp), %rax
	movslq	(%rax,%rsi,4), %rcx
	movl	$1, %eax
	cmpl	$-1, %ecx
	je	.L17
	xorl	%eax, %eax
	movq	%r14, %r13
.L42:
	leaq	(%r12,%rcx,8), %rbx
	movslq	(%rbx), %rsi
	movq	%rbx, 88(%rsp)
	leaq	0(%r13,%rsi,4), %rdi
	movl	(%rdi), %ecx
	movq	%rdi, 64(%rsp)
	testl	%ecx, %ecx
	jns	.L75
	movq	8(%rsp), %rax
	movl	$0, (%rdi)
	movl	$1, %ecx
	movslq	(%rax,%rsi,4), %rax
	cmpl	$-1, %eax
	je	.L20
	xorl	%ecx, %ecx
	movq	%r13, %r15
.L41:
	leaq	(%r12,%rax,8), %rax
	movslq	(%rax), %rsi
	movq	%rax, 72(%rsp)
	leaq	(%r15,%rsi,4), %rax
	movq	%rax, 48(%rsp)
	movl	(%rax), %eax
	testl	%eax, %eax
	jns	.L76
	movq	48(%rsp), %rax
	movl	$0, (%rax)
	movq	8(%rsp), %rax
	movslq	(%rax,%rsi,4), %rcx
	movl	$1, %eax
	cmpl	$-1, %ecx
	je	.L23
	movq	%r15, %rdi
	xorl	%eax, %eax
	movq	%r12, %r15
	movq	%rdi, %r12
.L40:
	leaq	(%r15,%rcx,8), %rbx
	movslq	(%rbx), %rsi
	movq	%rbx, 56(%rsp)
	leaq	(%r12,%rsi,4), %rdi
	movl	(%rdi), %ecx
	movq	%rdi, 32(%rsp)
	testl	%ecx, %ecx
	jns	.L77
	movq	8(%rsp), %rax
	movl	$0, (%rdi)
	movl	$1, %ecx
	movslq	(%rax,%rsi,4), %rax
	cmpl	$-1, %eax
	je	.L26
	xorl	%ecx, %ecx
.L39:
	leaq	(%r15,%rax,8), %rax
	movslq	(%rax), %rsi
	movq	%rax, 40(%rsp)
	leaq	(%r12,%rsi,4), %rax
	movq	%rax, (%rsp)
	movl	(%rax), %eax
	testl	%eax, %eax
	jns	.L78
	movq	(%rsp), %rax
	movl	$0, (%rax)
	movq	8(%rsp), %rax
	movslq	(%rax,%rsi,4), %rcx
	movl	$1, %eax
	cmpl	$-1, %ecx
	je	.L29
	xorl	%eax, %eax
	movq	%r15, %r13
	movq	%r12, %r14
.L38:
	leaq	0(%r13,%rcx,8), %rdx
	movslq	(%rdx), %rdi
	movq	%rdx, 16(%rsp)
	leaq	(%r14,%rdi,4), %rbp
	movl	0(%rbp), %esi
	testl	%esi, %esi
	jns	.L79
	movq	8(%rsp), %rax
	movl	$0, 0(%rbp)
	movl	$1, %esi
	movslq	(%rax,%rdi,4), %rax
	cmpl	$-1, %eax
	je	.L32
	movq	%r14, %r12
	xorl	%esi, %esi
	movq	%r13, %r14
.L37:
	leaq	(%r14,%rax,8), %r13
	movslq	0(%r13), %rcx
	leaq	(%r12,%rcx,4), %r15
	movl	(%r15), %eax
	testl	%eax, %eax
	jns	.L80
	movq	8(%rsp), %rax
	movl	$0, (%r15)
	movslq	(%rax,%rcx,4), %rcx
	movl	$1, %eax
	cmpl	$-1, %ecx
	je	.L35
	movq	%r12, %rbx
	movq	%r15, %r12
.L36:
	leaq	(%r14,%rcx,8), %r15
	movq	24(%rsp), %rsi
	movq	%rbx, %rdx
	movl	(%r15), %edi
	call	calc
	movl	(%r12), %ecx
	addl	$1, %eax
	cmpl	%ecx, %eax
	cmovl	%ecx, %eax
	movl	%eax, (%r12)
	movslq	4(%r15), %rcx
	cmpl	$-1, %ecx
	jne	.L36
	movq	%rbx, %r12
	addl	$1, %eax
.L35:
	movl	0(%rbp), %esi
.L34:
	cmpl	%eax, %esi
	cmovl	%eax, %esi
	movl	%esi, 0(%rbp)
	movslq	4(%r13), %rax
	cmpl	$-1, %eax
	jne	.L37
	movq	%r14, %r13
	addl	$1, %esi
	movq	%r12, %r14
.L32:
	movq	(%rsp), %rax
	movl	(%rax), %eax
.L31:
	cmpl	%esi, %eax
	movq	(%rsp), %rbx
	movq	16(%rsp), %rdi
	cmovl	%esi, %eax
	movl	%eax, (%rbx)
	movslq	4(%rdi), %rcx
	cmpl	$-1, %ecx
	jne	.L38
	movq	%r13, %r15
	movq	%r14, %r12
	addl	$1, %eax
.L29:
	movq	32(%rsp), %rbx
	movl	(%rbx), %ecx
.L28:
	cmpl	%eax, %ecx
	cmovl	%eax, %ecx
	movq	32(%rsp), %rax
	movl	%ecx, (%rax)
	movq	40(%rsp), %rax
	movslq	4(%rax), %rax
	cmpl	$-1, %eax
	jne	.L39
	addl	$1, %ecx
.L26:
	movq	48(%rsp), %rax
	movl	(%rax), %eax
.L25:
	cmpl	%ecx, %eax
	movq	48(%rsp), %rbx
	movq	56(%rsp), %rdi
	cmovl	%ecx, %eax
	movl	%eax, (%rbx)
	movslq	4(%rdi), %rcx
	cmpl	$-1, %ecx
	jne	.L40
	movq	%r12, %rdx
	addl	$1, %eax
	movq	%r15, %r12
	movq	%rdx, %r15
.L23:
	movq	64(%rsp), %rbx
	movl	(%rbx), %ecx
.L22:
	cmpl	%eax, %ecx
	cmovl	%eax, %ecx
	movq	64(%rsp), %rax
	movl	%ecx, (%rax)
	movq	72(%rsp), %rax
	movslq	4(%rax), %rax
	cmpl	$-1, %eax
	jne	.L41
	movq	%r15, %r13
	addl	$1, %ecx
.L20:
	movq	80(%rsp), %rax
	movl	(%rax), %eax
.L19:
	cmpl	%ecx, %eax
	movq	80(%rsp), %rdx
	movq	88(%rsp), %rbx
	cmovl	%ecx, %eax
	movl	%eax, (%rdx)
	movslq	4(%rbx), %rcx
	cmpl	$-1, %ecx
	jne	.L42
	movq	%r13, %r14
	addl	$1, %eax
.L17:
	movq	96(%rsp), %rdi
	movl	(%rdi), %ecx
.L16:
	cmpl	%eax, %ecx
	cmovl	%eax, %ecx
	movq	96(%rsp), %rax
	movl	%ecx, (%rax)
	movq	104(%rsp), %rax
	movslq	4(%rax), %rax
	cmpl	$-1, %eax
	jne	.L43
	movq	%r14, %r13
	addl	$1, %ecx
.L14:
	movq	112(%rsp), %rax
	movl	(%rax), %eax
.L13:
	cmpl	%ecx, %eax
	movq	112(%rsp), %rdi
	cmovl	%ecx, %eax
	movl	%eax, (%rdi)
	movq	120(%rsp), %rdi
	movslq	4(%rdi), %rcx
	cmpl	$-1, %ecx
	jne	.L44
.L9:
	addq	$136, %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
.L80:
	.cfi_restore_state
	addl	$1, %eax
	jmp	.L34
	.p2align 4,,10
	.p2align 3
.L79:
	addl	$1, %esi
	jmp	.L31
	.p2align 4,,10
	.p2align 3
.L78:
	addl	$1, %eax
	jmp	.L28
	.p2align 4,,10
	.p2align 3
.L77:
	addl	$1, %ecx
	jmp	.L25
.L76:
	addl	$1, %eax
	jmp	.L22
.L75:
	addl	$1, %ecx
	jmp	.L19
.L74:
	addl	$1, %eax
	jmp	.L16
.L73:
	addl	$1, %ecx
	jmp	.L13
	.cfi_endproc
.LFE41:
	.size	calc, .-calc
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%i%i"
.LC1:
	.string	"%i\n"
	.text
	.p2align 4
	.globl	run
	.type	run, @function
run:
.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
	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	$56, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leaq	28(%rsp), %rdx
	leaq	24(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	24(%rsp), %r15d
	movl	$32, %esi
	movl	$1, %edi
	call	calloc@PLT
	movl	$8, %esi
	movl	$1, %edi
	leal	1(%r15), %r12d
	movq	%rax, %rbx
	call	calloc@PLT
	movslq	%r12d, %rdi
	movl	$4, %esi
	movq	%rax, (%rbx)
	movq	%rax, %r14
	call	calloc@PLT
	movl	$0, 16(%rbx)
	movq	%rax, 8(%rbx)
	movl	%r12d, 20(%rbx)
	movl	$1, 24(%rbx)
	testl	%r12d, %r12d
	jle	.L85
	movq	%rax, %rdi
	movl	%r15d, %eax
	movl	$255, %esi
	leaq	4(,%rax,4), %rdx
	call	memset@PLT
.L85:
	movl	28(%rsp), %eax
	leaq	36(%rsp), %r13
	leaq	32(%rsp), %r12
	leal	-1(%rax), %edx
	movl	%edx, 28(%rsp)
	testl	%eax, %eax
	jne	.L83
	jmp	.L84
	.p2align 4,,10
	.p2align 3
.L111:
	movq	(%rbx), %r14
.L87:
	movq	8(%rbx), %rcx
	movd	%r15d, %xmm0
	leaq	(%rcx,%rdx,4), %rdx
	movslq	%eax, %rcx
	movd	(%rdx), %xmm1
	punpckldq	%xmm1, %xmm0
	movq	%xmm0, (%r14,%rcx,8)
	leal	1(%rax), %ecx
	movl	%ecx, 16(%rbx)
	movl	%eax, (%rdx)
	movl	28(%rsp), %eax
	leal	-1(%rax), %edx
	movl	%edx, 28(%rsp)
	testl	%eax, %eax
	je	.L110
.L83:
	movq	%r13, %rdx
	movq	%r12, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	36(%rsp), %r15d
	movslq	32(%rsp), %rdx
	movl	16(%rbx), %eax
	cmpl	24(%rbx), %eax
	jne	.L111
	addl	%eax, %eax
	movq	(%rbx), %rdi
	movl	%edx, 12(%rsp)
	movl	%eax, 24(%rbx)
	cltq
	leaq	0(,%rax,8), %rsi
	call	realloc@PLT
	movslq	12(%rsp), %rdx
	movq	%rax, (%rbx)
	movq	%rax, %r14
	movl	16(%rbx), %eax
	jmp	.L87
	.p2align 4,,10
	.p2align 3
.L110:
	movl	24(%rsp), %r15d
.L84:
	testl	%r15d, %r15d
	jle	.L88
	movl	$1, %ebp
	jmp	.L91
	.p2align 4,,10
	.p2align 3
.L89:
	movq	8(%rbx), %rdx
	movd	%ebp, %xmm0
	movslq	%eax, %rcx
	movd	(%rdx), %xmm2
	punpckldq	%xmm2, %xmm0
.L109:
	movq	%xmm0, (%r14,%rcx,8)
	leal	1(%rax), %ecx
	addl	$1, %ebp
	movl	%ecx, 16(%rbx)
	movl	%eax, (%rdx)
	movl	24(%rsp), %r15d
	cmpl	%ebp, %r15d
	jl	.L88
.L91:
	movl	16(%rbx), %eax
	cmpl	24(%rbx), %eax
	jne	.L89
	addl	%eax, %eax
	movq	%r14, %rdi
	movl	%eax, 24(%rbx)
	cltq
	leaq	0(,%rax,8), %rsi
	call	realloc@PLT
	movq	8(%rbx), %rdx
	movslq	16(%rbx), %rcx
	movd	%ebp, %xmm0
	movq	%rax, (%rbx)
	movq	%rax, %r14
	movd	(%rdx), %xmm3
	movq	%rcx, %rax
	punpckldq	%xmm3, %xmm0
	jmp	.L109
	.p2align 4,,10
	.p2align 3
.L88:
	leal	1(%r15), %r12d
	movl	$4, %esi
	movslq	%r12d, %r12
	movq	%r12, %rdi
	call	calloc@PLT
	movq	%rax, %rbp
	testl	%r15d, %r15d
	js	.L95
	leaq	0(,%r12,4), %rdx
	movl	$255, %esi
	movq	%rax, %rdi
	call	memset@PLT
.L95:
	movl	0(%rbp), %eax
	leal	-1(%rax), %edx
	testl	%eax, %eax
	jns	.L96
	movq	8(%rbx), %rax
	movl	$0, 0(%rbp)
	movslq	(%rax), %rdx
	cmpl	$-1, %edx
	je	.L96
	movq	(%rbx), %r9
.L98:
	leaq	(%r9,%rdx,8), %r8
	movq	%rbx, %rsi
	movq	%rbp, %rdx
	movl	(%r8), %edi
	call	calc
	movl	0(%rbp), %edx
	addl	$1, %eax
	cmpl	%edx, %eax
	cmovl	%edx, %eax
	movl	%eax, 0(%rbp)
	movslq	4(%r8), %rdx
	cmpl	$-1, %edx
	jne	.L98
	leal	-1(%rax), %edx
.L96:
	xorl	%eax, %eax
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L112
	addq	$56, %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
.L112:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE42:
	.size	run, .-run
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB43:
	.cfi_startproc
	endbr64
	subq	$8, %rsp
	.cfi_def_cfa_offset 16
	call	run
	xorl	%eax, %eax
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE43:
	.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
	.p2align 4
	.globl	new_graph
	.type	new_graph, @function
new_graph:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	movl	$32, %esi
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	movslq	%edi, %rbp
	movl	$1, %edi
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	call	calloc@PLT
	movl	$8, %esi
	movl	$1, %edi
	movq	%rax, %r12
	call	calloc@PLT
	movl	$4, %esi
	movq	%rbp, %rdi
	movq	%rax, (%r12)
	call	calloc@PLT
	movl	%ebp, 20(%r12)
	movq	%rax, 8(%r12)
	movl	$0, 16(%r12)
	movl	$1, 24(%r12)
	testl	%ebp, %ebp
	jle	.L1
	movq	%rax, %rdi
	leaq	0(,%rbp,4), %rdx
	movl	$255, %esi
	call	memset@PLT
.L1:
	movq	%r12, %rax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE39:
	.size	new_graph, .-new_graph
	.p2align 4
	.globl	add_edge
	.type	add_edge, @function
add_edge:
.LFB40:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	movl	%edx, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	movslq	%esi, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	movq	%rdi, %rbx
	movl	16(%rdi), %ecx
	movq	(%rdi), %rdi
	cmpl	24(%rbx), %ecx
	je	.L8
.L6:
	movq	8(%rbx), %rax
	movd	%r12d, %xmm0
	movslq	%ecx, %rsi
	leal	1(%rcx), %edx
	leaq	(%rax,%rbp,4), %rax
	movd	(%rax), %xmm1
	punpckldq	%xmm1, %xmm0
	movq	%xmm0, (%rdi,%rsi,8)
	movl	%edx, 16(%rbx)
	movl	%ecx, (%rax)
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L8:
	.cfi_restore_state
	addl	%ecx, %ecx
	movl	%ecx, 24(%rbx)
	movslq	%ecx, %rcx
	leaq	0(,%rcx,8), %rsi
	call	realloc@PLT
	movl	16(%rbx), %ecx
	movq	%rax, (%rbx)
	movq	%rax, %rdi
	jmp	.L6
	.cfi_endproc
.LFE40:
	.size	add_edge, .-add_edge
	.p2align 4
	.globl	calc
	.type	calc, @function
calc:
.LFB41:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movslq	%edi, %rcx
	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
	movq	%rdx, %r12
	leaq	(%rdx,%rcx,4), %rdx
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$136, %rsp
	.cfi_def_cfa_offset 192
	movl	(%rdx), %eax
	movq	%rsi, 24(%rsp)
	movq	%rdx, 112(%rsp)
	testl	%eax, %eax
	jns	.L9
	movq	8(%rsi), %rax
	movl	$0, (%rdx)
	movslq	(%rax,%rcx,4), %rcx
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	cmpl	$-1, %ecx
	je	.L9
	movq	(%rsi), %r15
	movq	%r12, %r13
	movq	%r15, %r12
.L44:
	leaq	(%r12,%rcx,8), %rbx
	movslq	(%rbx), %rsi
	movq	%rbx, 120(%rsp)
	leaq	0(%r13,%rsi,4), %rbx
	movl	(%rbx), %ecx
	movq	%rbx, 96(%rsp)
	testl	%ecx, %ecx
	jns	.L73
	movq	8(%rsp), %rax
	movl	$0, (%rbx)
	movl	$1, %ecx
	movslq	(%rax,%rsi,4), %rax
	cmpl	$-1, %eax
	je	.L14
	xorl	%ecx, %ecx
	movq	%r13, %r14
.L43:
	leaq	(%r12,%rax,8), %rax
	movslq	(%rax), %rsi
	movq	%rax, 104(%rsp)
	leaq	(%r14,%rsi,4), %rax
	movq	%rax, 80(%rsp)
	movl	(%rax), %eax
	testl	%eax, %eax
	jns	.L74
	movq	80(%rsp), %rax
	movl	$0, (%rax)
	movq	8(%rsp), %rax
	movslq	(%rax,%rsi,4), %rcx
	movl	$1, %eax
	cmpl	$-1, %ecx
	je	.L17
	xorl	%eax, %eax
	movq	%r14, %r13
.L42:
	leaq	(%r12,%rcx,8), %rbx
	movslq	(%rbx), %rsi
	movq	%rbx, 88(%rsp)
	leaq	0(%r13,%rsi,4), %rdi
	movl	(%rdi), %ecx
	movq	%rdi, 64(%rsp)
	testl	%ecx, %ecx
	jns	.L75
	movq	8(%rsp), %rax
	movl	$0, (%rdi)
	movl	$1, %ecx
	movslq	(%rax,%rsi,4), %rax
	cmpl	$-1, %eax
	je	.L20
	xorl	%ecx, %ecx
	movq	%r13, %r15
.L41:
	leaq	(%r12,%rax,8), %rax
	movslq	(%rax), %rsi
	movq	%rax, 72(%rsp)
	leaq	(%r15,%rsi,4), %rax
	movq	%rax, 48(%rsp)
	movl	(%rax), %eax
	testl	%eax, %eax
	jns	.L76
	movq	48(%rsp), %rax
	movl	$0, (%rax)
	movq	8(%rsp), %rax
	movslq	(%rax,%rsi,4), %rcx
	movl	$1, %eax
	cmpl	$-1, %ecx
	je	.L23
	movq	%r15, %rdi
	xorl	%eax, %eax
	movq	%r12, %r15
	movq	%rdi, %r12
.L40:
	leaq	(%r15,%rcx,8), %rbx
	movslq	(%rbx), %rsi
	movq	%rbx, 56(%rsp)
	leaq	(%r12,%rsi,4), %rdi
	movl	(%rdi), %ecx
	movq	%rdi, 32(%rsp)
	testl	%ecx, %ecx
	jns	.L77
	movq	8(%rsp), %rax
	movl	$0, (%rdi)
	movl	$1, %ecx
	movslq	(%rax,%rsi,4), %rax
	cmpl	$-1, %eax
	je	.L26
	xorl	%ecx, %ecx
.L39:
	leaq	(%r15,%rax,8), %rax
	movslq	(%rax), %rsi
	movq	%rax, 40(%rsp)
	leaq	(%r12,%rsi,4), %rax
	movq	%rax, (%rsp)
	movl	(%rax), %eax
	testl	%eax, %eax
	jns	.L78
	movq	(%rsp), %rax
	movl	$0, (%rax)
	movq	8(%rsp), %rax
	movslq	(%rax,%rsi,4), %rcx
	movl	$1, %eax
	cmpl	$-1, %ecx
	je	.L29
	xorl	%eax, %eax
	movq	%r15, %r13
	movq	%r12, %r14
.L38:
	leaq	0(%r13,%rcx,8), %rdx
	movslq	(%rdx), %rdi
	movq	%rdx, 16(%rsp)
	leaq	(%r14,%rdi,4), %rbp
	movl	0(%rbp), %esi
	testl	%esi, %esi
	jns	.L79
	movq	8(%rsp), %rax
	movl	$0, 0(%rbp)
	movl	$1, %esi
	movslq	(%rax,%rdi,4), %rax
	cmpl	$-1, %eax
	je	.L32
	movq	%r14, %r12
	xorl	%esi, %esi
	movq	%r13, %r14
.L37:
	leaq	(%r14,%rax,8), %r13
	movslq	0(%r13), %rcx
	leaq	(%r12,%rcx,4), %r15
	movl	(%r15), %eax
	testl	%eax, %eax
	jns	.L80
	movq	8(%rsp), %rax
	movl	$0, (%r15)
	movslq	(%rax,%rcx,4), %rcx
	movl	$1, %eax
	cmpl	$-1, %ecx
	je	.L35
	movq	%r12, %rbx
	movq	%r15, %r12
.L36:
	leaq	(%r14,%rcx,8), %r15
	movq	24(%rsp), %rsi
	movq	%rbx, %rdx
	movl	(%r15), %edi
	call	calc
	movl	(%r12), %ecx
	addl	$1, %eax
	cmpl	%ecx, %eax
	cmovl	%ecx, %eax
	movl	%eax, (%r12)
	movslq	4(%r15), %rcx
	cmpl	$-1, %ecx
	jne	.L36
	movq	%rbx, %r12
	addl	$1, %eax
.L35:
	movl	0(%rbp), %esi
.L34:
	cmpl	%eax, %esi
	cmovl	%eax, %esi
	movl	%esi, 0(%rbp)
	movslq	4(%r13), %rax
	cmpl	$-1, %eax
	jne	.L37
	movq	%r14, %r13
	addl	$1, %esi
	movq	%r12, %r14
.L32:
	movq	(%rsp), %rax
	movl	(%rax), %eax
.L31:
	cmpl	%esi, %eax
	movq	(%rsp), %rbx
	movq	16(%rsp), %rdi
	cmovl	%esi, %eax
	movl	%eax, (%rbx)
	movslq	4(%rdi), %rcx
	cmpl	$-1, %ecx
	jne	.L38
	movq	%r13, %r15
	movq	%r14, %r12
	addl	$1, %eax
.L29:
	movq	32(%rsp), %rbx
	movl	(%rbx), %ecx
.L28:
	cmpl	%eax, %ecx
	cmovl	%eax, %ecx
	movq	32(%rsp), %rax
	movl	%ecx, (%rax)
	movq	40(%rsp), %rax
	movslq	4(%rax), %rax
	cmpl	$-1, %eax
	jne	.L39
	addl	$1, %ecx
.L26:
	movq	48(%rsp), %rax
	movl	(%rax), %eax
.L25:
	cmpl	%ecx, %eax
	movq	48(%rsp), %rbx
	movq	56(%rsp), %rdi
	cmovl	%ecx, %eax
	movl	%eax, (%rbx)
	movslq	4(%rdi), %rcx
	cmpl	$-1, %ecx
	jne	.L40
	movq	%r12, %rdx
	addl	$1, %eax
	movq	%r15, %r12
	movq	%rdx, %r15
.L23:
	movq	64(%rsp), %rbx
	movl	(%rbx), %ecx
.L22:
	cmpl	%eax, %ecx
	cmovl	%eax, %ecx
	movq	64(%rsp), %rax
	movl	%ecx, (%rax)
	movq	72(%rsp), %rax
	movslq	4(%rax), %rax
	cmpl	$-1, %eax
	jne	.L41
	movq	%r15, %r13
	addl	$1, %ecx
.L20:
	movq	80(%rsp), %rax
	movl	(%rax), %eax
.L19:
	cmpl	%ecx, %eax
	movq	80(%rsp), %rdx
	movq	88(%rsp), %rbx
	cmovl	%ecx, %eax
	movl	%eax, (%rdx)
	movslq	4(%rbx), %rcx
	cmpl	$-1, %ecx
	jne	.L42
	movq	%r13, %r14
	addl	$1, %eax
.L17:
	movq	96(%rsp), %rdi
	movl	(%rdi), %ecx
.L16:
	cmpl	%eax, %ecx
	cmovl	%eax, %ecx
	movq	96(%rsp), %rax
	movl	%ecx, (%rax)
	movq	104(%rsp), %rax
	movslq	4(%rax), %rax
	cmpl	$-1, %eax
	jne	.L43
	movq	%r14, %r13
	addl	$1, %ecx
.L14:
	movq	112(%rsp), %rax
	movl	(%rax), %eax
.L13:
	cmpl	%ecx, %eax
	movq	112(%rsp), %rdi
	cmovl	%ecx, %eax
	movl	%eax, (%rdi)
	movq	120(%rsp), %rdi
	movslq	4(%rdi), %rcx
	cmpl	$-1, %ecx
	jne	.L44
.L9:
	addq	$136, %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
.L80:
	.cfi_restore_state
	addl	$1, %eax
	jmp	.L34
	.p2align 4,,10
	.p2align 3
.L79:
	addl	$1, %esi
	jmp	.L31
	.p2align 4,,10
	.p2align 3
.L78:
	addl	$1, %eax
	jmp	.L28
	.p2align 4,,10
	.p2align 3
.L77:
	addl	$1, %ecx
	jmp	.L25
.L76:
	addl	$1, %eax
	jmp	.L22
.L75:
	addl	$1, %ecx
	jmp	.L19
.L74:
	addl	$1, %eax
	jmp	.L16
.L73:
	addl	$1, %ecx
	jmp	.L13
	.cfi_endproc
.LFE41:
	.size	calc, .-calc
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%i%i"
.LC1:
	.string	"%i\n"
	.text
	.p2align 4
	.globl	run
	.type	run, @function
run:
.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
	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	$56, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leaq	28(%rsp), %rdx
	leaq	24(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	24(%rsp), %r15d
	movl	$32, %esi
	movl	$1, %edi
	call	calloc@PLT
	movl	$8, %esi
	movl	$1, %edi
	leal	1(%r15), %r12d
	movq	%rax, %rbx
	call	calloc@PLT
	movslq	%r12d, %rdi
	movl	$4, %esi
	movq	%rax, (%rbx)
	movq	%rax, %r14
	call	calloc@PLT
	movl	$0, 16(%rbx)
	movq	%rax, 8(%rbx)
	movl	%r12d, 20(%rbx)
	movl	$1, 24(%rbx)
	testl	%r12d, %r12d
	jle	.L85
	movq	%rax, %rdi
	movl	%r15d, %eax
	movl	$255, %esi
	leaq	4(,%rax,4), %rdx
	call	memset@PLT
.L85:
	movl	28(%rsp), %eax
	leaq	36(%rsp), %r13
	leaq	32(%rsp), %r12
	leal	-1(%rax), %edx
	movl	%edx, 28(%rsp)
	testl	%eax, %eax
	jne	.L83
	jmp	.L84
	.p2align 4,,10
	.p2align 3
.L111:
	movq	(%rbx), %r14
.L87:
	movq	8(%rbx), %rcx
	movd	%r15d, %xmm0
	leaq	(%rcx,%rdx,4), %rdx
	movslq	%eax, %rcx
	movd	(%rdx), %xmm1
	punpckldq	%xmm1, %xmm0
	movq	%xmm0, (%r14,%rcx,8)
	leal	1(%rax), %ecx
	movl	%ecx, 16(%rbx)
	movl	%eax, (%rdx)
	movl	28(%rsp), %eax
	leal	-1(%rax), %edx
	movl	%edx, 28(%rsp)
	testl	%eax, %eax
	je	.L110
.L83:
	movq	%r13, %rdx
	movq	%r12, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	36(%rsp), %r15d
	movslq	32(%rsp), %rdx
	movl	16(%rbx), %eax
	cmpl	24(%rbx), %eax
	jne	.L111
	addl	%eax, %eax
	movq	(%rbx), %rdi
	movl	%edx, 12(%rsp)
	movl	%eax, 24(%rbx)
	cltq
	leaq	0(,%rax,8), %rsi
	call	realloc@PLT
	movslq	12(%rsp), %rdx
	movq	%rax, (%rbx)
	movq	%rax, %r14
	movl	16(%rbx), %eax
	jmp	.L87
	.p2align 4,,10
	.p2align 3
.L110:
	movl	24(%rsp), %r15d
.L84:
	testl	%r15d, %r15d
	jle	.L88
	movl	$1, %ebp
	jmp	.L91
	.p2align 4,,10
	.p2align 3
.L89:
	movq	8(%rbx), %rdx
	movd	%ebp, %xmm0
	movslq	%eax, %rcx
	movd	(%rdx), %xmm2
	punpckldq	%xmm2, %xmm0
.L109:
	movq	%xmm0, (%r14,%rcx,8)
	leal	1(%rax), %ecx
	addl	$1, %ebp
	movl	%ecx, 16(%rbx)
	movl	%eax, (%rdx)
	movl	24(%rsp), %r15d
	cmpl	%ebp, %r15d
	jl	.L88
.L91:
	movl	16(%rbx), %eax
	cmpl	24(%rbx), %eax
	jne	.L89
	addl	%eax, %eax
	movq	%r14, %rdi
	movl	%eax, 24(%rbx)
	cltq
	leaq	0(,%rax,8), %rsi
	call	realloc@PLT
	movq	8(%rbx), %rdx
	movslq	16(%rbx), %rcx
	movd	%ebp, %xmm0
	movq	%rax, (%rbx)
	movq	%rax, %r14
	movd	(%rdx), %xmm3
	movq	%rcx, %rax
	punpckldq	%xmm3, %xmm0
	jmp	.L109
	.p2align 4,,10
	.p2align 3
.L88:
	leal	1(%r15), %r12d
	movl	$4, %esi
	movslq	%r12d, %r12
	movq	%r12, %rdi
	call	calloc@PLT
	movq	%rax, %rbp
	testl	%r15d, %r15d
	js	.L95
	leaq	0(,%r12,4), %rdx
	movl	$255, %esi
	movq	%rax, %rdi
	call	memset@PLT
.L95:
	movl	0(%rbp), %eax
	leal	-1(%rax), %edx
	testl	%eax, %eax
	jns	.L96
	movq	8(%rbx), %rax
	movl	$0, 0(%rbp)
	movslq	(%rax), %rdx
	cmpl	$-1, %edx
	je	.L96
	movq	(%rbx), %r9
.L98:
	leaq	(%r9,%rdx,8), %r8
	movq	%rbx, %rsi
	movq	%rbp, %rdx
	movl	(%r8), %edi
	call	calc
	movl	0(%rbp), %edx
	addl	$1, %eax
	cmpl	%edx, %eax
	cmovl	%edx, %eax
	movl	%eax, 0(%rbp)
	movslq	4(%r8), %rdx
	cmpl	$-1, %edx
	jne	.L98
	leal	-1(%rax), %edx
.L96:
	xorl	%eax, %eax
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L112
	addq	$56, %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
.L112:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE42:
	.size	run, .-run
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB43:
	.cfi_startproc
	endbr64
	subq	$8, %rsp
	.cfi_def_cfa_offset 16
	call	run
	xorl	%eax, %eax
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE43:
	.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>
#include<stdint.h>
#include<inttypes.h>

typedef int32_t i32;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define ALLOC(size,type) ((type*)calloc((size),sizeof(type)))

typedef struct directed_edge {
  int32_t vertex;
  int32_t next;
} graph_edge;

typedef struct directedGraph {
  graph_edge *edge;
  int32_t *start;
  int32_t pointer;
  int32_t vertex_num;
  int32_t edge_max_size;
} graph;

graph* new_graph (const int vertex_num) {
  graph *g = (graph *) calloc (1, sizeof (graph));
  g->edge = (graph_edge *) calloc (1, sizeof (graph_edge));
  g->start = (int32_t *) calloc (vertex_num, sizeof (int32_t));
  g->pointer = 0;
  g->vertex_num = vertex_num;
  g->edge_max_size = 1;
  for (int32_t i = 0; i < vertex_num; ++i) {
    g->start[i] = -1;
  }
  return g;
}

void add_edge (graph *g, int32_t from, int32_t to) {
  if (g->pointer == g->edge_max_size) {
    g->edge_max_size *= 2;
    g->edge = (graph_edge *) realloc (g->edge, sizeof (graph_edge) * g->edge_max_size);
  }
  g->edge[g->pointer] = (graph_edge) {to, g->start[from]};
  g->start[from] = g->pointer++;
}

i32 calc (i32 v, graph *g, i32 *dp) {
  if (dp[v] >= 0) return dp[v];
  dp[v] = 0;
  for (i32 p = g->start[v]; p != -1; p = g->edge[p].next) {
    i32 u = g->edge[p].vertex;
    i32 x = calc (u, g, dp) + 1;
    dp[v] = MAX (dp[v], x);
  }
  return dp[v];
}

void run (void) {
  i32 n, m;
  scanf ("%" SCNi32 "%" SCNi32, &n, &m);
  graph *g = new_graph (n + 1);
  while (m--) {
    i32 x, y;
    scanf ("%" SCNi32 "%" SCNi32, &x, &y);
    add_edge (g, x, y);
  }
  for (i32 i = 1; i <= n; ++i) {
    add_edge (g, 0, i);
  }
  i32 *dp = ALLOC (n + 1, i32);
  for (i32 i = 0; i <=n; ++i) {
    dp[i] = -1;
  }
  i32 ans = calc (0, g, dp) - 1;
  printf ("%" PRIi32 "\n", ans);
}

int main (void) {
  run();
  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>
#include<stdint.h>
#include<inttypes.h>

typedef int32_t i32;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define ALLOC(size,type) ((type*)calloc((size),sizeof(type)))

typedef struct directed_edge {
  int32_t vertex;
  int32_t next;
} graph_edge;

typedef struct directedGraph {
  graph_edge *edge;
  int32_t *start;
  int32_t pointer;
  int32_t vertex_num;
  int32_t edge_max_size;
} graph;

graph* new_graph (const int vertex_num) {
  graph *g = (graph *) calloc (1, sizeof (graph));
  g->edge = (graph_edge *) calloc (1, sizeof (graph_edge));
  g->start = (int32_t *) calloc (vertex_num, sizeof (int32_t));
  g->pointer = 0;
  g->vertex_num = vertex_num;
  g->edge_max_size = 1;
  for (int32_t i = 0; i < vertex_num; ++i) {
    g->start[i] = -1;
  }
  return g;
}

void add_edge (graph *g, int32_t from, int32_t to) {
  if (g->pointer == g->edge_max_size) {
    g->edge_max_size *= 2;
    g->edge = (graph_edge *) realloc (g->edge, sizeof (graph_edge) * g->edge_max_size);
  }
  g->edge[g->pointer] = (graph_edge) {to, g->start[from]};
  g->start[from] = g->pointer++;
}

i32 calc (i32 v, graph *g, i32 *dp) {
  if (dp[v] >= 0) return dp[v];
  dp[v] = 0;
  for (i32 p = g->start[v]; p != -1; p = g->edge[p].next) {
    i32 u = g->edge[p].vertex;
    i32 x = calc (u, g, dp) + 1;
    dp[v] = MAX (dp[v], x);
  }
  return dp[v];
}

void run (void) {
  i32 n, m;
  scanf ("%" SCNi32 "%" SCNi32, &n, &m);
  graph *g = new_graph (n + 1);
  while (m--) {
    i32 x, y;
    scanf ("%" SCNi32 "%" SCNi32, &x, &y);
    add_edge (g, x, y);
  }
  for (i32 i = 1; i <= n; ++i) {
    add_edge (g, 0, i);
  }
  i32 *dp = ALLOC (n + 1, i32);
  for (i32 i = 0; i <=n; ++i) {
    dp[i] = -1;
  }
  i32 ans = calc (0, g, dp) - 1;
  printf ("%" PRIi32 "\n", ans);
}

int main (void) {
  run();
  return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	new_graph
	.type	new_graph, @function
new_graph:
.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	$32, %esi
	movl	$1, %edi
	call	calloc@PLT
	movq	%rax, -8(%rbp)
	movl	$8, %esi
	movl	$1, %edi
	call	calloc@PLT
	movq	%rax, %rdx
	movq	-8(%rbp), %rax
	movq	%rdx, (%rax)
	movl	-20(%rbp), %eax
	cltq
	movl	$4, %esi
	movq	%rax, %rdi
	call	calloc@PLT
	movq	%rax, %rdx
	movq	-8(%rbp), %rax
	movq	%rdx, 8(%rax)
	movq	-8(%rbp), %rax
	movl	$0, 16(%rax)
	movq	-8(%rbp), %rax
	movl	-20(%rbp), %edx
	movl	%edx, 20(%rax)
	movq	-8(%rbp), %rax
	movl	$1, 24(%rax)
	movl	$0, -12(%rbp)
	jmp	.L2
.L3:
	movq	-8(%rbp), %rax
	movq	8(%rax), %rdx
	movl	-12(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	$-1, (%rax)
	addl	$1, -12(%rbp)
.L2:
	movl	-12(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jl	.L3
	movq	-8(%rbp), %rax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	new_graph, .-new_graph
	.globl	add_edge
	.type	add_edge, @function
add_edge:
.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
	movq	%rdi, -8(%rbp)
	movl	%esi, -12(%rbp)
	movl	%edx, -16(%rbp)
	movq	-8(%rbp), %rax
	movl	16(%rax), %edx
	movq	-8(%rbp), %rax
	movl	24(%rax), %eax
	cmpl	%eax, %edx
	jne	.L6
	movq	-8(%rbp), %rax
	movl	24(%rax), %eax
	leal	(%rax,%rax), %edx
	movq	-8(%rbp), %rax
	movl	%edx, 24(%rax)
	movq	-8(%rbp), %rax
	movl	24(%rax), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-8(%rbp), %rax
	movq	(%rax), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	realloc@PLT
	movq	-8(%rbp), %rdx
	movq	%rax, (%rdx)
.L6:
	movq	-8(%rbp), %rax
	movq	(%rax), %rdx
	movq	-8(%rbp), %rax
	movl	16(%rax), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	movq	-8(%rbp), %rdx
	movq	8(%rdx), %rcx
	movl	-12(%rbp), %edx
	movslq	%edx, %rdx
	salq	$2, %rdx
	addq	%rcx, %rdx
	movl	(%rdx), %edx
	movl	-16(%rbp), %ecx
	movl	%ecx, (%rax)
	movl	%edx, 4(%rax)
	movq	-8(%rbp), %rax
	movl	16(%rax), %eax
	leal	1(%rax), %ecx
	movq	-8(%rbp), %rdx
	movl	%ecx, 16(%rdx)
	movq	-8(%rbp), %rdx
	movq	8(%rdx), %rcx
	movl	-12(%rbp), %edx
	movslq	%edx, %rdx
	salq	$2, %rdx
	addq	%rcx, %rdx
	movl	%eax, (%rdx)
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	add_edge, .-add_edge
	.globl	calc
	.type	calc, @function
calc:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movl	%edi, -20(%rbp)
	movq	%rsi, -32(%rbp)
	movq	%rdx, -40(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	testl	%eax, %eax
	js	.L8
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	jmp	.L9
.L8:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	$0, (%rax)
	movq	-32(%rbp), %rax
	movq	8(%rax), %rdx
	movl	-20(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -12(%rbp)
	jmp	.L10
.L11:
	movq	-32(%rbp), %rax
	movq	(%rax), %rdx
	movl	-12(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -8(%rbp)
	movq	-40(%rbp), %rdx
	movq	-32(%rbp), %rcx
	movl	-8(%rbp), %eax
	movq	%rcx, %rsi
	movl	%eax, %edi
	call	calc
	addl	$1, %eax
	movl	%eax, -4(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	movq	-40(%rbp), %rax
	addq	%rax, %rcx
	movl	-4(%rbp), %eax
	cmpl	%eax, %edx
	cmovge	%edx, %eax
	movl	%eax, (%rcx)
	movq	-32(%rbp), %rax
	movq	(%rax), %rdx
	movl	-12(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	movl	4(%rax), %eax
	movl	%eax, -12(%rbp)
.L10:
	cmpl	$-1, -12(%rbp)
	jne	.L11
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
.L9:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	calc, .-calc
	.section	.rodata
.LC0:
	.string	"%i%i"
.LC1:
	.string	"%i\n"
	.text
	.globl	run
	.type	run, @function
run:
.LFB9:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$64, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-48(%rbp), %rdx
	leaq	-52(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-52(%rbp), %eax
	addl	$1, %eax
	movl	%eax, %edi
	call	new_graph
	movq	%rax, -24(%rbp)
	jmp	.L13
.L14:
	leaq	-40(%rbp), %rdx
	leaq	-44(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-40(%rbp), %edx
	movl	-44(%rbp), %ecx
	movq	-24(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	add_edge
.L13:
	movl	-48(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -48(%rbp)
	testl	%eax, %eax
	jne	.L14
	movl	$1, -36(%rbp)
	jmp	.L15
.L16:
	movl	-36(%rbp), %edx
	movq	-24(%rbp), %rax
	movl	$0, %esi
	movq	%rax, %rdi
	call	add_edge
	addl	$1, -36(%rbp)
.L15:
	movl	-52(%rbp), %eax
	cmpl	%eax, -36(%rbp)
	jle	.L16
	movl	-52(%rbp), %eax
	addl	$1, %eax
	cltq
	movl	$4, %esi
	movq	%rax, %rdi
	call	calloc@PLT
	movq	%rax, -16(%rbp)
	movl	$0, -32(%rbp)
	jmp	.L17
.L18:
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	$-1, (%rax)
	addl	$1, -32(%rbp)
.L17:
	movl	-52(%rbp), %eax
	cmpl	%eax, -32(%rbp)
	jle	.L18
	movq	-16(%rbp), %rdx
	movq	-24(%rbp), %rax
	movq	%rax, %rsi
	movl	$0, %edi
	call	calc
	subl	$1, %eax
	movl	%eax, -28(%rbp)
	movl	-28(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	nop
	movq	-8(%rbp), %rax
	subq	%fs:40, %rax
	je	.L19
	call	__stack_chk_fail@PLT
.L19:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	run, .-run
	.globl	main
	.type	main, @function
main:
.LFB10:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	call	run
	movl	$0, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.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	new_graph
	.type	new_graph, @function
new_graph:
.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	$32, %esi
	movl	$1, %edi
	call	calloc@PLT
	movq	%rax, -8(%rbp)
	movl	$8, %esi
	movl	$1, %edi
	call	calloc@PLT
	movq	%rax, %rdx
	movq	-8(%rbp), %rax
	movq	%rdx, (%rax)
	movl	-20(%rbp), %eax
	cltq
	movl	$4, %esi
	movq	%rax, %rdi
	call	calloc@PLT
	movq	%rax, %rdx
	movq	-8(%rbp), %rax
	movq	%rdx, 8(%rax)
	movq	-8(%rbp), %rax
	movl	$0, 16(%rax)
	movq	-8(%rbp), %rax
	movl	-20(%rbp), %edx
	movl	%edx, 20(%rax)
	movq	-8(%rbp), %rax
	movl	$1, 24(%rax)
	movl	$0, -12(%rbp)
	jmp	.L2
.L3:
	movq	-8(%rbp), %rax
	movq	8(%rax), %rdx
	movl	-12(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	$-1, (%rax)
	addl	$1, -12(%rbp)
.L2:
	movl	-12(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jl	.L3
	movq	-8(%rbp), %rax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	new_graph, .-new_graph
	.globl	add_edge
	.type	add_edge, @function
add_edge:
.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
	movq	%rdi, -8(%rbp)
	movl	%esi, -12(%rbp)
	movl	%edx, -16(%rbp)
	movq	-8(%rbp), %rax
	movl	16(%rax), %edx
	movq	-8(%rbp), %rax
	movl	24(%rax), %eax
	cmpl	%eax, %edx
	jne	.L6
	movq	-8(%rbp), %rax
	movl	24(%rax), %eax
	leal	(%rax,%rax), %edx
	movq	-8(%rbp), %rax
	movl	%edx, 24(%rax)
	movq	-8(%rbp), %rax
	movl	24(%rax), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-8(%rbp), %rax
	movq	(%rax), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	realloc@PLT
	movq	-8(%rbp), %rdx
	movq	%rax, (%rdx)
.L6:
	movq	-8(%rbp), %rax
	movq	(%rax), %rdx
	movq	-8(%rbp), %rax
	movl	16(%rax), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	movq	-8(%rbp), %rdx
	movq	8(%rdx), %rcx
	movl	-12(%rbp), %edx
	movslq	%edx, %rdx
	salq	$2, %rdx
	addq	%rcx, %rdx
	movl	(%rdx), %edx
	movl	-16(%rbp), %ecx
	movl	%ecx, (%rax)
	movl	%edx, 4(%rax)
	movq	-8(%rbp), %rax
	movl	16(%rax), %eax
	leal	1(%rax), %ecx
	movq	-8(%rbp), %rdx
	movl	%ecx, 16(%rdx)
	movq	-8(%rbp), %rdx
	movq	8(%rdx), %rcx
	movl	-12(%rbp), %edx
	movslq	%edx, %rdx
	salq	$2, %rdx
	addq	%rcx, %rdx
	movl	%eax, (%rdx)
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	add_edge, .-add_edge
	.globl	calc
	.type	calc, @function
calc:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movl	%edi, -20(%rbp)
	movq	%rsi, -32(%rbp)
	movq	%rdx, -40(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	testl	%eax, %eax
	js	.L8
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	jmp	.L9
.L8:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	$0, (%rax)
	movq	-32(%rbp), %rax
	movq	8(%rax), %rdx
	movl	-20(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -12(%rbp)
	jmp	.L10
.L11:
	movq	-32(%rbp), %rax
	movq	(%rax), %rdx
	movl	-12(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -8(%rbp)
	movq	-40(%rbp), %rdx
	movq	-32(%rbp), %rcx
	movl	-8(%rbp), %eax
	movq	%rcx, %rsi
	movl	%eax, %edi
	call	calc
	addl	$1, %eax
	movl	%eax, -4(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	movq	-40(%rbp), %rax
	addq	%rax, %rcx
	movl	-4(%rbp), %eax
	cmpl	%eax, %edx
	cmovge	%edx, %eax
	movl	%eax, (%rcx)
	movq	-32(%rbp), %rax
	movq	(%rax), %rdx
	movl	-12(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	movl	4(%rax), %eax
	movl	%eax, -12(%rbp)
.L10:
	cmpl	$-1, -12(%rbp)
	jne	.L11
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
.L9:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	calc, .-calc
	.section	.rodata
.LC0:
	.string	"%i%i"
.LC1:
	.string	"%i\n"
	.text
	.globl	run
	.type	run, @function
run:
.LFB9:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$64, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-48(%rbp), %rdx
	leaq	-52(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-52(%rbp), %eax
	addl	$1, %eax
	movl	%eax, %edi
	call	new_graph
	movq	%rax, -24(%rbp)
	jmp	.L13
.L14:
	leaq	-40(%rbp), %rdx
	leaq	-44(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-40(%rbp), %edx
	movl	-44(%rbp), %ecx
	movq	-24(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	add_edge
.L13:
	movl	-48(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -48(%rbp)
	testl	%eax, %eax
	jne	.L14
	movl	$1, -36(%rbp)
	jmp	.L15
.L16:
	movl	-36(%rbp), %edx
	movq	-24(%rbp), %rax
	movl	$0, %esi
	movq	%rax, %rdi
	call	add_edge
	addl	$1, -36(%rbp)
.L15:
	movl	-52(%rbp), %eax
	cmpl	%eax, -36(%rbp)
	jle	.L16
	movl	-52(%rbp), %eax
	addl	$1, %eax
	cltq
	movl	$4, %esi
	movq	%rax, %rdi
	call	calloc@PLT
	movq	%rax, -16(%rbp)
	movl	$0, -32(%rbp)
	jmp	.L17
.L18:
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	$-1, (%rax)
	addl	$1, -32(%rbp)
.L17:
	movl	-52(%rbp), %eax
	cmpl	%eax, -32(%rbp)
	jle	.L18
	movq	-16(%rbp), %rdx
	movq	-24(%rbp), %rax
	movq	%rax, %rsi
	movl	$0, %edi
	call	calc
	subl	$1, %eax
	movl	%eax, -28(%rbp)
	movl	-28(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	nop
	movq	-8(%rbp), %rax
	subq	%fs:40, %rax
	je	.L19
	call	__stack_chk_fail@PLT
.L19:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	run, .-run
	.globl	main
	.type	main, @function
main:
.LFB10:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	call	run
	movl	$0, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.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:
