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 INF 100000000
#define NIL -1
#define WHITE 0
#define BLACK 1
 
main(){
        int n, i, j, u, p, m, k, cost=0, mincost;
    int **G, *tmp;
    int *flag;
    int *d, *pi;
 
    scanf("%d", &n);
    flag = (int*)malloc(sizeof(int) * n);
    d = (int *)malloc(sizeof(int)*n);
    pi = (int *)malloc(sizeof(int)*n);
    G = (int**)malloc(sizeof(int*) * n);
    tmp = (int*)malloc(sizeof(int) * n * n);
    for (i = 0; i < n; i++){
        G[i] = tmp + i * n;
        flag[i] = WHITE;
        d[i]=INF;
        pi[i]=NIL;
        for (j = 0; j < n; j++){
            G[i][j] = NIL;
        }
    }
 
    for(i=0; i<n; i++){
      scanf("%*d%d", &k);
      for(j=0; j<k; j++){
        scanf("%d", &p);
        scanf("%d", &m);
        G[i][p] = m;
      }
    }
 
    u=0;
    d[u]=0;
 
    while(1){
      mincost = INF;
      for(i=0; i<n; i++){
        if(flag[i]!=BLACK && d[i]<mincost){
          mincost = d[i];
          u=i;
        }
      }
      if(mincost == INF) break;
      flag[u] = BLACK;
      //cost += mincost;
 
      for(i=0; i<n; i++){
        if(G[u][i]!=NIL && flag[i]!=BLACK && (d[u]+G[u][i])<d[i]){
          d[i]=d[u]+G[u][i];
          pi[i] = u;
        }
      }  
    }
 
        for(i=0; i<n; i++){
      printf("%d %d\n", i, d[i]);
    }
 
    free(tmp);
    free(G);
    free(flag);
    free(d);
    free(pi);
 
    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%*d%d"
.LC2:
	.string	"%d %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
	subq	$96, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -52(%rbp)
	leaq	-84(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-84(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -48(%rbp)
	movl	-84(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -40(%rbp)
	movl	-84(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -32(%rbp)
	movl	-84(%rbp), %eax
	cltq
	salq	$3, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -24(%rbp)
	movl	-84(%rbp), %eax
	movslq	%eax, %rdx
	movl	-84(%rbp), %eax
	cltq
	imulq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -16(%rbp)
	movl	$0, -68(%rbp)
	jmp	.L2
.L5:
	movl	-84(%rbp), %eax
	imull	-68(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	movl	-68(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	-16(%rbp), %rdx
	addq	%rcx, %rdx
	movq	%rdx, (%rax)
	movl	-68(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-48(%rbp), %rax
	addq	%rdx, %rax
	movl	$0, (%rax)
	movl	-68(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	$100000000, (%rax)
	movl	-68(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movl	$-1, (%rax)
	movl	$0, -64(%rbp)
	jmp	.L3
.L4:
	movl	-68(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-64(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	$-1, (%rax)
	addl	$1, -64(%rbp)
.L3:
	movl	-84(%rbp), %eax
	cmpl	%eax, -64(%rbp)
	jl	.L4
	addl	$1, -68(%rbp)
.L2:
	movl	-84(%rbp), %eax
	cmpl	%eax, -68(%rbp)
	jl	.L5
	movl	$0, -68(%rbp)
	jmp	.L6
.L9:
	leaq	-72(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -64(%rbp)
	jmp	.L7
.L8:
	leaq	-80(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-76(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-68(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-80(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rax, %rdx
	movl	-76(%rbp), %eax
	movl	%eax, (%rdx)
	addl	$1, -64(%rbp)
.L7:
	movl	-72(%rbp), %eax
	cmpl	%eax, -64(%rbp)
	jl	.L8
	addl	$1, -68(%rbp)
.L6:
	movl	-84(%rbp), %eax
	cmpl	%eax, -68(%rbp)
	jl	.L9
	movl	$0, -60(%rbp)
	movl	-60(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	$0, (%rax)
.L18:
	movl	$100000000, -56(%rbp)
	movl	$0, -68(%rbp)
	jmp	.L10
.L12:
	movl	-68(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-48(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	$1, %eax
	je	.L11
	movl	-68(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -56(%rbp)
	jle	.L11
	movl	-68(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -56(%rbp)
	movl	-68(%rbp), %eax
	movl	%eax, -60(%rbp)
.L11:
	addl	$1, -68(%rbp)
.L10:
	movl	-84(%rbp), %eax
	cmpl	%eax, -68(%rbp)
	jl	.L12
	cmpl	$100000000, -56(%rbp)
	je	.L24
	movl	-60(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-48(%rbp), %rax
	addq	%rdx, %rax
	movl	$1, (%rax)
	movl	$0, -68(%rbp)
	jmp	.L15
.L17:
	movl	-60(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-68(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	$-1, %eax
	je	.L16
	movl	-68(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-48(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	$1, %eax
	je	.L16
	movl	-60(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movl	-60(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	movq	-24(%rbp), %rax
	addq	%rcx, %rax
	movq	(%rax), %rcx
	movl	-68(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rcx, %rax
	movl	(%rax), %eax
	addl	%eax, %edx
	movl	-68(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	movq	-40(%rbp), %rax
	addq	%rcx, %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jge	.L16
	movl	-60(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %ecx
	movl	-60(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-68(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movl	-68(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rsi
	movq	-40(%rbp), %rax
	addq	%rsi, %rax
	addl	%ecx, %edx
	movl	%edx, (%rax)
	movl	-68(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-32(%rbp), %rax
	addq	%rax, %rdx
	movl	-60(%rbp), %eax
	movl	%eax, (%rdx)
.L16:
	addl	$1, -68(%rbp)
.L15:
	movl	-84(%rbp), %eax
	cmpl	%eax, -68(%rbp)
	jl	.L17
	jmp	.L18
.L24:
	nop
	movl	$0, -68(%rbp)
	jmp	.L19
.L20:
	movl	-68(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movl	-68(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -68(%rbp)
.L19:
	movl	-84(%rbp), %eax
	cmpl	%eax, -68(%rbp)
	jl	.L20
	movq	-16(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	movq	-24(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	movq	-48(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	movq	-40(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	movq	-32(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L22
	call	__stack_chk_fail@PLT
.L22:
	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"
.LC1:
	.string	"%*d%d"
.LC2:
	.string	"%d %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	.LC0(%rip), %rbx
	movq	%rbx, %rdi
	subq	$88, %rsp
	.cfi_def_cfa_offset 144
	movq	%fs:40, %rax
	movq	%rax, 72(%rsp)
	xorl	%eax, %eax
	leaq	56(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movslq	56(%rsp), %r13
	leaq	0(,%r13,4), %r15
	movq	%r15, %rdi
	call	malloc@PLT
	movq	%r15, %rdi
	movq	%rax, %r12
	call	malloc@PLT
	movq	%r15, %rdi
	movq	%rax, %rbp
	call	malloc@PLT
	leaq	0(,%r13,8), %rdi
	movq	%rax, 8(%rsp)
	call	malloc@PLT
	movq	%r13, %rdi
	imulq	%r13, %rdi
	movq	%rax, (%rsp)
	salq	$2, %rdi
	call	malloc@PLT
	movq	%rax, 24(%rsp)
	testl	%r13d, %r13d
	jle	.L33
	movq	%rax, %rcx
	xorl	%eax, %eax
	movq	%r15, %r14
	movq	%rax, %r15
	.p2align 4,,10
	.p2align 3
.L3:
	movq	(%rsp), %rax
	movq	%rcx, %rdi
	movq	%r14, %rdx
	movl	$255, %esi
	movl	$0, (%r12,%r15,4)
	movq	%rcx, (%rax,%r15,8)
	movq	8(%rsp), %rax
	movl	$100000000, 0(%rbp,%r15,4)
	movl	$-1, (%rax,%r15,4)
	addq	$1, %r15
	call	memset@PLT
	movq	%rax, %rcx
	addq	%r14, %rcx
	cmpq	%r15, %r13
	jne	.L3
	leaq	68(%rsp), %rax
	movq	%rbp, 40(%rsp)
	movq	(%rsp), %r13
	xorl	%r15d, %r15d
	movq	%rax, 16(%rsp)
	leaq	60(%rsp), %rax
	movq	%r12, 32(%rsp)
	movq	%rax, %r12
	.p2align 4,,10
	.p2align 3
.L5:
	movq	16(%rsp), %rsi
	xorl	%eax, %eax
	xorl	%r14d, %r14d
	leaq	64(%rsp), %rbp
	leaq	.LC1(%rip), %rdi
	call	__isoc99_scanf@PLT
	movl	68(%rsp), %eax
	testl	%eax, %eax
	jle	.L6
	.p2align 4,,10
	.p2align 3
.L4:
	movq	%r12, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	addl	$1, %r14d
	call	__isoc99_scanf@PLT
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	60(%rsp), %rdx
	movq	0(%r13), %rax
	movl	64(%rsp), %ecx
	movl	%ecx, (%rax,%rdx,4)
	cmpl	%r14d, 68(%rsp)
	jg	.L4
.L6:
	movl	56(%rsp), %eax
	addl	$1, %r15d
	addq	$8, %r13
	cmpl	%r15d, %eax
	jg	.L5
	movq	32(%rsp), %r12
	movq	40(%rsp), %rbp
	movl	%eax, %r14d
.L2:
	movl	$0, 0(%rbp)
	movq	(%rsp), %r10
	xorl	%edi, %edi
	movslq	%r14d, %rcx
	movq	8(%rsp), %r9
	testl	%r14d, %r14d
	jle	.L7
	.p2align 4,,10
	.p2align 3
.L37:
	xorl	%eax, %eax
	movl	$100000000, %esi
	.p2align 4,,10
	.p2align 3
.L9:
	cmpl	$1, (%r12,%rax,4)
	je	.L8
	movl	0(%rbp,%rax,4), %edx
	cmpl	%esi, %edx
	jge	.L8
	movl	%edx, %esi
	movl	%eax, %edi
.L8:
	addq	$1, %rax
	cmpq	%rax, %rcx
	jne	.L9
	cmpl	$100000000, %esi
	je	.L36
	movslq	%edi, %rax
	movl	$1, (%r12,%rax,4)
	movq	(%r10,%rax,8), %rsi
	leaq	0(,%rax,4), %r8
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L13:
	movl	(%rsi,%rax,4), %edx
	cmpl	$-1, %edx
	je	.L12
	cmpl	$1, (%r12,%rax,4)
	je	.L12
	addl	0(%rbp,%r8), %edx
	cmpl	0(%rbp,%rax,4), %edx
	jge	.L12
	movl	%edx, 0(%rbp,%rax,4)
	movl	%edi, (%r9,%rax,4)
.L12:
	addq	$1, %rax
	cmpq	%rax, %rcx
	jne	.L13
	testl	%r14d, %r14d
	jg	.L37
.L7:
	movq	24(%rsp), %rdi
	call	free@PLT
	movq	(%rsp), %rdi
	call	free@PLT
	movq	%r12, %rdi
	call	free@PLT
	movq	%rbp, %rdi
	call	free@PLT
	movq	8(%rsp), %rdi
	call	free@PLT
	movq	72(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L38
	addq	$88, %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
.L36:
	.cfi_restore_state
	xorl	%r13d, %r13d
	leaq	.LC2(%rip), %rbx
	.p2align 4,,10
	.p2align 3
.L10:
	movl	0(%rbp,%r13,4), %ecx
	movl	%r13d, %edx
	movq	%rbx, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addq	$1, %r13
	call	__printf_chk@PLT
	cmpl	%r13d, 56(%rsp)
	jg	.L10
	jmp	.L7
.L33:
	movq	%r13, %r14
	jmp	.L2
.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"
.LC1:
	.string	"%*d%d"
.LC2:
	.string	"%d %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	.LC0(%rip), %rbx
	movq	%rbx, %rdi
	subq	$88, %rsp
	.cfi_def_cfa_offset 144
	movq	%fs:40, %rax
	movq	%rax, 72(%rsp)
	xorl	%eax, %eax
	leaq	56(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movslq	56(%rsp), %r13
	leaq	0(,%r13,4), %r15
	movq	%r15, %rdi
	call	malloc@PLT
	movq	%r15, %rdi
	movq	%rax, %r12
	call	malloc@PLT
	movq	%r15, %rdi
	movq	%rax, %rbp
	call	malloc@PLT
	leaq	0(,%r13,8), %rdi
	movq	%rax, 8(%rsp)
	call	malloc@PLT
	movq	%r13, %rdi
	imulq	%r13, %rdi
	movq	%rax, (%rsp)
	salq	$2, %rdi
	call	malloc@PLT
	movq	%rax, 24(%rsp)
	testl	%r13d, %r13d
	jle	.L33
	movq	%rax, %rcx
	xorl	%eax, %eax
	movq	%r15, %r14
	movq	%rax, %r15
	.p2align 4,,10
	.p2align 3
.L3:
	movq	(%rsp), %rax
	movq	%rcx, %rdi
	movq	%r14, %rdx
	movl	$255, %esi
	movl	$0, (%r12,%r15,4)
	movq	%rcx, (%rax,%r15,8)
	movq	8(%rsp), %rax
	movl	$100000000, 0(%rbp,%r15,4)
	movl	$-1, (%rax,%r15,4)
	addq	$1, %r15
	call	memset@PLT
	movq	%rax, %rcx
	addq	%r14, %rcx
	cmpq	%r15, %r13
	jne	.L3
	leaq	68(%rsp), %rax
	movq	%rbp, 40(%rsp)
	movq	(%rsp), %r13
	xorl	%r15d, %r15d
	movq	%rax, 16(%rsp)
	leaq	60(%rsp), %rax
	movq	%r12, 32(%rsp)
	movq	%rax, %r12
	.p2align 4,,10
	.p2align 3
.L5:
	movq	16(%rsp), %rsi
	xorl	%eax, %eax
	xorl	%r14d, %r14d
	leaq	64(%rsp), %rbp
	leaq	.LC1(%rip), %rdi
	call	__isoc99_scanf@PLT
	movl	68(%rsp), %eax
	testl	%eax, %eax
	jle	.L6
	.p2align 4,,10
	.p2align 3
.L4:
	movq	%r12, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	addl	$1, %r14d
	call	__isoc99_scanf@PLT
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	60(%rsp), %rdx
	movq	0(%r13), %rax
	movl	64(%rsp), %ecx
	movl	%ecx, (%rax,%rdx,4)
	cmpl	%r14d, 68(%rsp)
	jg	.L4
.L6:
	movl	56(%rsp), %eax
	addl	$1, %r15d
	addq	$8, %r13
	cmpl	%r15d, %eax
	jg	.L5
	movq	32(%rsp), %r12
	movq	40(%rsp), %rbp
	movl	%eax, %r14d
.L2:
	movl	$0, 0(%rbp)
	movq	(%rsp), %r10
	xorl	%edi, %edi
	movslq	%r14d, %rcx
	movq	8(%rsp), %r9
	testl	%r14d, %r14d
	jle	.L7
	.p2align 4,,10
	.p2align 3
.L37:
	xorl	%eax, %eax
	movl	$100000000, %esi
	.p2align 4,,10
	.p2align 3
.L9:
	cmpl	$1, (%r12,%rax,4)
	je	.L8
	movl	0(%rbp,%rax,4), %edx
	cmpl	%esi, %edx
	jge	.L8
	movl	%edx, %esi
	movl	%eax, %edi
.L8:
	addq	$1, %rax
	cmpq	%rax, %rcx
	jne	.L9
	cmpl	$100000000, %esi
	je	.L36
	movslq	%edi, %rax
	movl	$1, (%r12,%rax,4)
	movq	(%r10,%rax,8), %rsi
	leaq	0(,%rax,4), %r8
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L13:
	movl	(%rsi,%rax,4), %edx
	cmpl	$-1, %edx
	je	.L12
	cmpl	$1, (%r12,%rax,4)
	je	.L12
	addl	0(%rbp,%r8), %edx
	cmpl	0(%rbp,%rax,4), %edx
	jge	.L12
	movl	%edx, 0(%rbp,%rax,4)
	movl	%edi, (%r9,%rax,4)
.L12:
	addq	$1, %rax
	cmpq	%rax, %rcx
	jne	.L13
	testl	%r14d, %r14d
	jg	.L37
.L7:
	movq	24(%rsp), %rdi
	call	free@PLT
	movq	(%rsp), %rdi
	call	free@PLT
	movq	%r12, %rdi
	call	free@PLT
	movq	%rbp, %rdi
	call	free@PLT
	movq	8(%rsp), %rdi
	call	free@PLT
	movq	72(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L38
	addq	$88, %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
.L36:
	.cfi_restore_state
	xorl	%r13d, %r13d
	leaq	.LC2(%rip), %rbx
	.p2align 4,,10
	.p2align 3
.L10:
	movl	0(%rbp,%r13,4), %ecx
	movl	%r13d, %edx
	movq	%rbx, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addq	$1, %r13
	call	__printf_chk@PLT
	cmpl	%r13d, 56(%rsp)
	jg	.L10
	jmp	.L7
.L33:
	movq	%r13, %r14
	jmp	.L2
.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 INF 100000000
#define NIL -1
#define WHITE 0
#define BLACK 1
 
main(){
        int n, i, j, u, p, m, k, cost=0, mincost;
    int **G, *tmp;
    int *flag;
    int *d, *pi;
 
    scanf("%d", &n);
    flag = (int*)malloc(sizeof(int) * n);
    d = (int *)malloc(sizeof(int)*n);
    pi = (int *)malloc(sizeof(int)*n);
    G = (int**)malloc(sizeof(int*) * n);
    tmp = (int*)malloc(sizeof(int) * n * n);
    for (i = 0; i < n; i++){
        G[i] = tmp + i * n;
        flag[i] = WHITE;
        d[i]=INF;
        pi[i]=NIL;
        for (j = 0; j < n; j++){
            G[i][j] = NIL;
        }
    }
 
    for(i=0; i<n; i++){
      scanf("%*d%d", &k);
      for(j=0; j<k; j++){
        scanf("%d", &p);
        scanf("%d", &m);
        G[i][p] = m;
      }
    }
 
    u=0;
    d[u]=0;
 
    while(1){
      mincost = INF;
      for(i=0; i<n; i++){
        if(flag[i]!=BLACK && d[i]<mincost){
          mincost = d[i];
          u=i;
        }
      }
      if(mincost == INF) break;
      flag[u] = BLACK;
      //cost += mincost;
 
      for(i=0; i<n; i++){
        if(G[u][i]!=NIL && flag[i]!=BLACK && (d[u]+G[u][i])<d[i]){
          d[i]=d[u]+G[u][i];
          pi[i] = u;
        }
      }  
    }
 
        for(i=0; i<n; i++){
      printf("%d %d\n", i, d[i]);
    }
 
    free(tmp);
    free(G);
    free(flag);
    free(d);
    free(pi);
 
    return 0;
}
5
0 3 2 3 3 1 1 2
1 2 0 2 3 4
2 3 0 3 3 1 4 1
3 4 2 1 0 1 1 4 4 3
4 2 2 1 3 3

0 0
1 2
2 2
3 1
4 3

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 INF 100000000
#define NIL -1
#define WHITE 0
#define BLACK 1
 
main(){
        int n, i, j, u, p, m, k, cost=0, mincost;
    int **G, *tmp;
    int *flag;
    int *d, *pi;
 
    scanf("%d", &n);
    flag = (int*)malloc(sizeof(int) * n);
    d = (int *)malloc(sizeof(int)*n);
    pi = (int *)malloc(sizeof(int)*n);
    G = (int**)malloc(sizeof(int*) * n);
    tmp = (int*)malloc(sizeof(int) * n * n);
    for (i = 0; i < n; i++){
        G[i] = tmp + i * n;
        flag[i] = WHITE;
        d[i]=INF;
        pi[i]=NIL;
        for (j = 0; j < n; j++){
            G[i][j] = NIL;
        }
    }
 
    for(i=0; i<n; i++){
      scanf("%*d%d", &k);
      for(j=0; j<k; j++){
        scanf("%d", &p);
        scanf("%d", &m);
        G[i][p] = m;
      }
    }
 
    u=0;
    d[u]=0;
 
    while(1){
      mincost = INF;
      for(i=0; i<n; i++){
        if(flag[i]!=BLACK && d[i]<mincost){
          mincost = d[i];
          u=i;
        }
      }
      if(mincost == INF) break;
      flag[u] = BLACK;
      //cost += mincost;
 
      for(i=0; i<n; i++){
        if(G[u][i]!=NIL && flag[i]!=BLACK && (d[u]+G[u][i])<d[i]){
          d[i]=d[u]+G[u][i];
          pi[i] = u;
        }
      }  
    }
 
        for(i=0; i<n; i++){
      printf("%d %d\n", i, d[i]);
    }
 
    free(tmp);
    free(G);
    free(flag);
    free(d);
    free(pi);
 
    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%*d%d"
.LC2:
	.string	"%d %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
	subq	$96, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -52(%rbp)
	leaq	-84(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-84(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -48(%rbp)
	movl	-84(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -40(%rbp)
	movl	-84(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -32(%rbp)
	movl	-84(%rbp), %eax
	cltq
	salq	$3, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -24(%rbp)
	movl	-84(%rbp), %eax
	movslq	%eax, %rdx
	movl	-84(%rbp), %eax
	cltq
	imulq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -16(%rbp)
	movl	$0, -68(%rbp)
	jmp	.L2
.L5:
	movl	-84(%rbp), %eax
	imull	-68(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	movl	-68(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	-16(%rbp), %rdx
	addq	%rcx, %rdx
	movq	%rdx, (%rax)
	movl	-68(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-48(%rbp), %rax
	addq	%rdx, %rax
	movl	$0, (%rax)
	movl	-68(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	$100000000, (%rax)
	movl	-68(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movl	$-1, (%rax)
	movl	$0, -64(%rbp)
	jmp	.L3
.L4:
	movl	-68(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-64(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	$-1, (%rax)
	addl	$1, -64(%rbp)
.L3:
	movl	-84(%rbp), %eax
	cmpl	%eax, -64(%rbp)
	jl	.L4
	addl	$1, -68(%rbp)
.L2:
	movl	-84(%rbp), %eax
	cmpl	%eax, -68(%rbp)
	jl	.L5
	movl	$0, -68(%rbp)
	jmp	.L6
.L9:
	leaq	-72(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -64(%rbp)
	jmp	.L7
.L8:
	leaq	-80(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-76(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-68(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-80(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rax, %rdx
	movl	-76(%rbp), %eax
	movl	%eax, (%rdx)
	addl	$1, -64(%rbp)
.L7:
	movl	-72(%rbp), %eax
	cmpl	%eax, -64(%rbp)
	jl	.L8
	addl	$1, -68(%rbp)
.L6:
	movl	-84(%rbp), %eax
	cmpl	%eax, -68(%rbp)
	jl	.L9
	movl	$0, -60(%rbp)
	movl	-60(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	$0, (%rax)
.L18:
	movl	$100000000, -56(%rbp)
	movl	$0, -68(%rbp)
	jmp	.L10
.L12:
	movl	-68(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-48(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	$1, %eax
	je	.L11
	movl	-68(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -56(%rbp)
	jle	.L11
	movl	-68(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -56(%rbp)
	movl	-68(%rbp), %eax
	movl	%eax, -60(%rbp)
.L11:
	addl	$1, -68(%rbp)
.L10:
	movl	-84(%rbp), %eax
	cmpl	%eax, -68(%rbp)
	jl	.L12
	cmpl	$100000000, -56(%rbp)
	je	.L24
	movl	-60(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-48(%rbp), %rax
	addq	%rdx, %rax
	movl	$1, (%rax)
	movl	$0, -68(%rbp)
	jmp	.L15
.L17:
	movl	-60(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-68(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	$-1, %eax
	je	.L16
	movl	-68(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-48(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	$1, %eax
	je	.L16
	movl	-60(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movl	-60(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	movq	-24(%rbp), %rax
	addq	%rcx, %rax
	movq	(%rax), %rcx
	movl	-68(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rcx, %rax
	movl	(%rax), %eax
	addl	%eax, %edx
	movl	-68(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	movq	-40(%rbp), %rax
	addq	%rcx, %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jge	.L16
	movl	-60(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %ecx
	movl	-60(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-68(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movl	-68(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rsi
	movq	-40(%rbp), %rax
	addq	%rsi, %rax
	addl	%ecx, %edx
	movl	%edx, (%rax)
	movl	-68(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-32(%rbp), %rax
	addq	%rax, %rdx
	movl	-60(%rbp), %eax
	movl	%eax, (%rdx)
.L16:
	addl	$1, -68(%rbp)
.L15:
	movl	-84(%rbp), %eax
	cmpl	%eax, -68(%rbp)
	jl	.L17
	jmp	.L18
.L24:
	nop
	movl	$0, -68(%rbp)
	jmp	.L19
.L20:
	movl	-68(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movl	-68(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -68(%rbp)
.L19:
	movl	-84(%rbp), %eax
	cmpl	%eax, -68(%rbp)
	jl	.L20
	movq	-16(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	movq	-24(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	movq	-48(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	movq	-40(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	movq	-32(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L22
	call	__stack_chk_fail@PLT
.L22:
	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"
.LC1:
	.string	"%*d%d"
.LC2:
	.string	"%d %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
	subq	$96, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -52(%rbp)
	leaq	-84(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-84(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -48(%rbp)
	movl	-84(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -40(%rbp)
	movl	-84(%rbp), %eax
	cltq
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -32(%rbp)
	movl	-84(%rbp), %eax
	cltq
	salq	$3, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -24(%rbp)
	movl	-84(%rbp), %eax
	movslq	%eax, %rdx
	movl	-84(%rbp), %eax
	cltq
	imulq	%rdx, %rax
	salq	$2, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -16(%rbp)
	movl	$0, -68(%rbp)
	jmp	.L2
.L5:
	movl	-84(%rbp), %eax
	imull	-68(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	movl	-68(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	-16(%rbp), %rdx
	addq	%rcx, %rdx
	movq	%rdx, (%rax)
	movl	-68(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-48(%rbp), %rax
	addq	%rdx, %rax
	movl	$0, (%rax)
	movl	-68(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	$100000000, (%rax)
	movl	-68(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movl	$-1, (%rax)
	movl	$0, -64(%rbp)
	jmp	.L3
.L4:
	movl	-68(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-64(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	$-1, (%rax)
	addl	$1, -64(%rbp)
.L3:
	movl	-84(%rbp), %eax
	cmpl	%eax, -64(%rbp)
	jl	.L4
	addl	$1, -68(%rbp)
.L2:
	movl	-84(%rbp), %eax
	cmpl	%eax, -68(%rbp)
	jl	.L5
	movl	$0, -68(%rbp)
	jmp	.L6
.L9:
	leaq	-72(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -64(%rbp)
	jmp	.L7
.L8:
	leaq	-80(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-76(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-68(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-80(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rax, %rdx
	movl	-76(%rbp), %eax
	movl	%eax, (%rdx)
	addl	$1, -64(%rbp)
.L7:
	movl	-72(%rbp), %eax
	cmpl	%eax, -64(%rbp)
	jl	.L8
	addl	$1, -68(%rbp)
.L6:
	movl	-84(%rbp), %eax
	cmpl	%eax, -68(%rbp)
	jl	.L9
	movl	$0, -60(%rbp)
	movl	-60(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	$0, (%rax)
.L18:
	movl	$100000000, -56(%rbp)
	movl	$0, -68(%rbp)
	jmp	.L10
.L12:
	movl	-68(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-48(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	$1, %eax
	je	.L11
	movl	-68(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -56(%rbp)
	jle	.L11
	movl	-68(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -56(%rbp)
	movl	-68(%rbp), %eax
	movl	%eax, -60(%rbp)
.L11:
	addl	$1, -68(%rbp)
.L10:
	movl	-84(%rbp), %eax
	cmpl	%eax, -68(%rbp)
	jl	.L12
	cmpl	$100000000, -56(%rbp)
	je	.L24
	movl	-60(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-48(%rbp), %rax
	addq	%rdx, %rax
	movl	$1, (%rax)
	movl	$0, -68(%rbp)
	jmp	.L15
.L17:
	movl	-60(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-68(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	$-1, %eax
	je	.L16
	movl	-68(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-48(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	$1, %eax
	je	.L16
	movl	-60(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movl	-60(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	movq	-24(%rbp), %rax
	addq	%rcx, %rax
	movq	(%rax), %rcx
	movl	-68(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rcx, %rax
	movl	(%rax), %eax
	addl	%eax, %edx
	movl	-68(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	movq	-40(%rbp), %rax
	addq	%rcx, %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jge	.L16
	movl	-60(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %ecx
	movl	-60(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-68(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movl	-68(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rsi
	movq	-40(%rbp), %rax
	addq	%rsi, %rax
	addl	%ecx, %edx
	movl	%edx, (%rax)
	movl	-68(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-32(%rbp), %rax
	addq	%rax, %rdx
	movl	-60(%rbp), %eax
	movl	%eax, (%rdx)
.L16:
	addl	$1, -68(%rbp)
.L15:
	movl	-84(%rbp), %eax
	cmpl	%eax, -68(%rbp)
	jl	.L17
	jmp	.L18
.L24:
	nop
	movl	$0, -68(%rbp)
	jmp	.L19
.L20:
	movl	-68(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movl	-68(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -68(%rbp)
.L19:
	movl	-84(%rbp), %eax
	cmpl	%eax, -68(%rbp)
	jl	.L20
	movq	-16(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	movq	-24(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	movq	-48(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	movq	-40(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	movq	-32(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L22
	call	__stack_chk_fail@PLT
.L22:
	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:
