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<string.h>
#define min(x,y) ((x<y)?x:y)
int main(){
	int n,m,c[105][105],d[105],used[105],i,j,x,y,z,v;
	memset(c,0,sizeof(c));
	
	scanf("%d",&n);
	for(i=1;i<=n;i++)for(j=1;j<=n;j++)c[i][j]=1000000;
	for(i=0;i<n;i++){
		scanf("%d%d",&x,&y);
		for(j=0;j<y;j++){
			scanf("%d",&z);
			c[x][z]=1;
		}
	}
	scanf("%d",&m);
	while(m--){
		scanf("%d%d%d",&x,&y,&z);
		//memset(d,-1,sizeof(d));
		for(i=1;i<=n;i++)d[i]=1000000;
		memset(used,0,sizeof(used));
		d[x]=0;
		while(1){
			v=-1;
			for(i=1;i<=n;i++){
				if(used[i]==0 && (v==-1 || d[v]>d[i]))v=i;
			}
			if(v==-1)break;
			used[v]=1;
			//printf("%d:%d\n",v,d[v]);
			for(i=1;i<=n;i++){
				d[i]=min(d[i],d[v]+c[v][i]);
			}
		}
		if(d[y]+1>z)printf("NA\n");
		else printf("%d\n",d[y]+1);
	}
	
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d%d"
.LC2:
	.string	"%d%d%d"
.LC3:
	.string	"NA"
.LC4:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	leaq	-40960(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$4048, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-44112(%rbp), %rax
	movl	$44100, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	leaq	-45008(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, -44988(%rbp)
	jmp	.L2
.L5:
	movl	$1, -44984(%rbp)
	jmp	.L3
.L4:
	movl	-44984(%rbp), %eax
	movslq	%eax, %rcx
	movl	-44988(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	movl	$1000000, -44112(%rbp,%rax,4)
	addl	$1, -44984(%rbp)
.L3:
	movl	-45008(%rbp), %eax
	cmpl	%eax, -44984(%rbp)
	jle	.L4
	addl	$1, -44988(%rbp)
.L2:
	movl	-45008(%rbp), %eax
	cmpl	%eax, -44988(%rbp)
	jle	.L5
	movl	$0, -44988(%rbp)
	jmp	.L6
.L9:
	leaq	-44996(%rbp), %rdx
	leaq	-45000(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -44984(%rbp)
	jmp	.L7
.L8:
	leaq	-44992(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-45000(%rbp), %eax
	movl	-44992(%rbp), %edx
	movslq	%edx, %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	movl	$1, -44112(%rbp,%rax,4)
	addl	$1, -44984(%rbp)
.L7:
	movl	-44996(%rbp), %eax
	cmpl	%eax, -44984(%rbp)
	jl	.L8
	addl	$1, -44988(%rbp)
.L6:
	movl	-45008(%rbp), %eax
	cmpl	%eax, -44988(%rbp)
	jl	.L9
	leaq	-45004(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	jmp	.L10
.L23:
	leaq	-44992(%rbp), %rcx
	leaq	-44996(%rbp), %rdx
	leaq	-45000(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, -44988(%rbp)
	jmp	.L11
.L12:
	movl	-44988(%rbp), %eax
	cltq
	movl	$1000000, -44976(%rbp,%rax,4)
	addl	$1, -44988(%rbp)
.L11:
	movl	-45008(%rbp), %eax
	cmpl	%eax, -44988(%rbp)
	jle	.L12
	leaq	-44544(%rbp), %rax
	movl	$420, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	movl	-45000(%rbp), %eax
	cltq
	movl	$0, -44976(%rbp,%rax,4)
.L21:
	movl	$-1, -44980(%rbp)
	movl	$1, -44988(%rbp)
	jmp	.L13
.L16:
	movl	-44988(%rbp), %eax
	cltq
	movl	-44544(%rbp,%rax,4), %eax
	testl	%eax, %eax
	jne	.L14
	cmpl	$-1, -44980(%rbp)
	je	.L15
	movl	-44980(%rbp), %eax
	cltq
	movl	-44976(%rbp,%rax,4), %edx
	movl	-44988(%rbp), %eax
	cltq
	movl	-44976(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jle	.L14
.L15:
	movl	-44988(%rbp), %eax
	movl	%eax, -44980(%rbp)
.L14:
	addl	$1, -44988(%rbp)
.L13:
	movl	-45008(%rbp), %eax
	cmpl	%eax, -44988(%rbp)
	jle	.L16
	cmpl	$-1, -44980(%rbp)
	je	.L27
	movl	-44980(%rbp), %eax
	cltq
	movl	$1, -44544(%rbp,%rax,4)
	movl	$1, -44988(%rbp)
	jmp	.L19
.L20:
	movl	-44980(%rbp), %eax
	cltq
	movl	-44976(%rbp,%rax,4), %ecx
	movl	-44988(%rbp), %eax
	movslq	%eax, %rsi
	movl	-44980(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	addq	%rdx, %rax
	addq	%rsi, %rax
	movl	-44112(%rbp,%rax,4), %eax
	leal	(%rcx,%rax), %edx
	movl	-44988(%rbp), %eax
	cltq
	movl	-44976(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	cmovg	%eax, %edx
	movl	-44988(%rbp), %eax
	cltq
	movl	%edx, -44976(%rbp,%rax,4)
	addl	$1, -44988(%rbp)
.L19:
	movl	-45008(%rbp), %eax
	cmpl	%eax, -44988(%rbp)
	jle	.L20
	jmp	.L21
.L27:
	nop
	movl	-44996(%rbp), %eax
	cltq
	movl	-44976(%rbp,%rax,4), %edx
	movl	-44992(%rbp), %eax
	cmpl	%eax, %edx
	jl	.L22
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L10
.L22:
	movl	-44996(%rbp), %eax
	cltq
	movl	-44976(%rbp,%rax,4), %eax
	addl	$1, %eax
	movl	%eax, %esi
	leaq	.LC4(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L10:
	movl	-45004(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -45004(%rbp)
	testl	%eax, %eax
	jne	.L23
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L25
	call	__stack_chk_fail@PLT
.L25:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.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"
.LC2:
	.string	"%d%d"
.LC3:
	.string	"%d%d%d"
.LC4:
	.string	"NA"
.LC5:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB35:
	.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	-45056(%rsp), %r11
	.cfi_def_cfa 11, 45112
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$40, %rsp
	.cfi_def_cfa_offset 45152
	movl	$44100, %edx
	xorl	%esi, %esi
	leaq	.LC0(%rip), %rbp
	movq	%fs:40, %rax
	movq	%rax, 45080(%rsp)
	xorl	%eax, %eax
	leaq	976(%rsp), %rax
	movq	%rax, %rdi
	movq	%rax, 24(%rsp)
	call	memset@PLT
	movq	%rbp, %rdi
	leaq	92(%rsp), %rsi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	92(%rsp), %edi
	testl	%edi, %edi
	jle	.L2
	movl	%edi, %eax
	movl	%edi, %r11d
	leal	1(%rdi), %r10d
	movl	$1, %ecx
	shrl	$2, %eax
	andl	$-4, %r11d
	leal	-1(%rdi), %r9d
	movdqa	.LC1(%rip), %xmm0
	leal	-1(%rax), %r8d
	leaq	1400(%rsp), %rsi
	addq	$1, %r8
	leal	1(%r11), %ebx
	salq	$4, %r8
	.p2align 4,,10
	.p2align 3
.L6:
	cmpl	$2, %r9d
	jbe	.L28
	leaq	(%r8,%rsi), %rdx
	movq	%rsi, %rax
	.p2align 4,,10
	.p2align 3
.L4:
	movups	%xmm0, (%rax)
	addq	$16, %rax
	cmpq	%rdx, %rax
	jne	.L4
	movl	%ebx, %eax
	cmpl	%edi, %r11d
	je	.L5
.L3:
	movslq	%ecx, %r12
	movslq	%eax, %rdx
	leaq	(%r12,%r12,2), %r13
	leaq	(%r12,%r13,4), %r13
	leaq	(%r12,%r13,8), %r12
	addq	%r12, %rdx
	movl	$1000000, 976(%rsp,%rdx,4)
	leal	1(%rax), %edx
	cmpl	%edx, %edi
	jl	.L5
	movslq	%edx, %rdx
	addl	$2, %eax
	addq	%r12, %rdx
	movl	$1000000, 976(%rsp,%rdx,4)
	cmpl	%eax, %edi
	jl	.L5
	cltq
	addq	%rax, %r12
	movl	$1000000, 976(%rsp,%r12,4)
.L5:
	addl	$1, %ecx
	addq	$420, %rsi
	cmpl	%r10d, %ecx
	jne	.L6
	leaq	100(%rsp), %rax
	xorl	%r12d, %r12d
	leaq	104(%rsp), %r15
	movq	%rax, 48(%rsp)
	leaq	.LC2(%rip), %r13
	leaq	108(%rsp), %rbx
	.p2align 4,,10
	.p2align 3
.L9:
	movq	48(%rsp), %rsi
	movq	%r13, %rdi
	movq	%r15, %rdx
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	104(%rsp), %edi
	testl	%edi, %edi
	jle	.L7
	xorl	%r14d, %r14d
	.p2align 4,,10
	.p2align 3
.L8:
	movq	%rbx, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	addl	$1, %r14d
	call	__isoc99_scanf@PLT
	movslq	100(%rsp), %rax
	movslq	108(%rsp), %rcx
	leaq	(%rax,%rax,2), %rsi
	leaq	(%rax,%rsi,4), %rsi
	leaq	(%rax,%rsi,8), %rax
	addq	%rcx, %rax
	movl	$1, 976(%rsp,%rax,4)
	cmpl	%r14d, 104(%rsp)
	jg	.L8
.L7:
	addl	$1, %r12d
	cmpl	%r12d, 92(%rsp)
	jg	.L9
.L2:
	leaq	96(%rsp), %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	96(%rsp), %eax
	leal	-1(%rax), %edx
	movl	%edx, 96(%rsp)
	testl	%eax, %eax
	je	.L10
	leaq	104(%rsp), %rax
	leaq	544(%rsp), %r12
	movq	%rax, 56(%rsp)
	leaq	100(%rsp), %rax
	leaq	112(%rsp), %r15
	movq	%rax, 48(%rsp)
	leaq	108(%rsp), %rax
	movq	%rax, 64(%rsp)
	leaq	120(%rsp), %rax
	movq	%rax, 72(%rsp)
	.p2align 4,,10
	.p2align 3
.L26:
	movq	64(%rsp), %rcx
	movq	56(%rsp), %rdx
	xorl	%eax, %eax
	leaq	.LC3(%rip), %rdi
	movq	48(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	92(%rsp), %r9d
	movdqa	.LC1(%rip), %xmm4
	leal	-1(%r9), %eax
	testl	%r9d, %r9d
	movl	%eax, 12(%rsp)
	jle	.L11
	cmpl	$2, %eax
	jbe	.L29
	movl	%r9d, %edx
	leaq	116(%rsp), %rax
	shrl	$2, %edx
	subl	$1, %edx
	salq	$4, %rdx
	leaq	132(%rsp,%rdx), %rdx
	.p2align 4,,10
	.p2align 3
.L13:
	movups	%xmm4, (%rax)
	addq	$16, %rax
	cmpq	%rdx, %rax
	jne	.L13
	movl	%r9d, %edx
	andl	$-4, %edx
	leal	1(%rdx), %eax
	cmpl	%edx, %r9d
	je	.L11
.L12:
	movslq	%eax, %rdx
	movl	$1000000, 112(%rsp,%rdx,4)
	leal	1(%rax), %edx
	cmpl	%edx, %r9d
	jl	.L11
	movslq	%edx, %rdx
	addl	$2, %eax
	movl	$1000000, 112(%rsp,%rdx,4)
	cmpl	%eax, %r9d
	jl	.L11
	cltq
	movl	$1000000, 112(%rsp,%rax,4)
.L11:
	xorl	%eax, %eax
	movl	$52, %ecx
	movq	%r12, %rdi
	movl	%r9d, %r14d
	rep stosq
	movslq	100(%rsp), %rax
	andl	$-4, %r14d
	movl	12(%rsp), %ecx
	leal	2(%r14), %esi
	movq	72(%rsp), %rbx
	leal	1(%r14), %r10d
	movl	%esi, 40(%rsp)
	leaq	116(%rsp), %r11
	movslq	%r10d, %r10
	movslq	%esi, %rbp
	movl	$0, 112(%rsp,%rax,4)
	movl	%r9d, %eax
	leaq	(%rbx,%rcx,4), %rbx
	addq	$2, %rcx
	leaq	4(,%rax,4), %rax
	movq	%rax, 16(%rsp)
	movl	%r9d, %eax
	shrl	$2, %eax
	movl	$0, (%rdi)
	leal	3(%r14), %edi
	subl	$1, %eax
	movl	%edi, 44(%rsp)
	movslq	%edi, %r13
	addq	$1, %rax
	salq	$4, %rax
	movq	%rax, 32(%rsp)
	.p2align 4,,10
	.p2align 3
.L23:
	testl	%r9d, %r9d
	jle	.L15
.L61:
	movl	$1, %eax
	movl	$-1, %edx
	jmp	.L17
	.p2align 4,,10
	.p2align 3
.L60:
	movslq	%edx, %rsi
	movl	(%r15,%rax,4), %edi
	cmpl	%edi, 112(%rsp,%rsi,4)
	cmovg	%eax, %edx
.L16:
	addq	$1, %rax
	cmpq	%rcx, %rax
	je	.L59
.L17:
	movl	(%r12,%rax,4), %esi
	testl	%esi, %esi
	jne	.L16
	cmpl	$-1, %edx
	jne	.L60
	movl	%eax, %edx
	addq	$1, %rax
	cmpq	%rcx, %rax
	jne	.L17
	.p2align 4,,10
	.p2align 3
.L59:
	cmpl	$-1, %edx
	je	.L15
	movslq	%edx, %rsi
	leaq	0(,%rsi,4), %rax
	leaq	4(%r15,%rsi,4), %rdx
	cmpq	16(%rsp), %rax
	movl	$1, 544(%rsp,%rsi,4)
	setge	%al
	cmpq	%rdx, %r11
	setnb	%dl
	orb	%dl, %al
	je	.L18
	cmpl	$2, 12(%rsp)
	jbe	.L18
	imulq	$420, %rsi, %rax
	movq	24(%rsp), %rdi
	movd	112(%rsp,%rsi,4), %xmm6
	movq	%r11, %rdx
	pshufd	$0, %xmm6, %xmm3
	leaq	4(%rdi,%rax), %rax
	movq	32(%rsp), %rdi
	addq	%rax, %rdi
	.p2align 4,,10
	.p2align 3
.L19:
	movdqu	(%rax), %xmm2
	movdqu	(%rdx), %xmm5
	addq	$16, %rax
	addq	$16, %rdx
	paddd	%xmm3, %xmm2
	movdqa	%xmm5, %xmm1
	movdqa	%xmm2, %xmm0
	pcmpgtd	%xmm5, %xmm0
	pand	%xmm0, %xmm1
	pandn	%xmm2, %xmm0
	por	%xmm1, %xmm0
	movups	%xmm0, -16(%rdx)
	cmpq	%rdi, %rax
	jne	.L19
	cmpl	%r14d, %r9d
	je	.L23
	leaq	(%rsi,%rsi,2), %rax
	leaq	(%rsi,%rax,4), %rax
	leaq	(%rsi,%rax,8), %rdx
	movl	112(%rsp,%rsi,4), %eax
	leaq	(%rdx,%r10), %rdi
	addl	976(%rsp,%rdi,4), %eax
	movl	112(%rsp,%r10,4), %edi
	cmpl	%edi, %eax
	cmovg	%edi, %eax
	movl	%eax, 112(%rsp,%r10,4)
	cmpl	%r9d, 40(%rsp)
	jg	.L23
	movl	112(%rsp,%rbp,4), %edi
	leaq	(%rdx,%rbp), %rax
	movl	976(%rsp,%rax,4), %eax
	addl	112(%rsp,%rsi,4), %eax
	cmpl	%edi, %eax
	cmovg	%edi, %eax
	movl	%eax, 112(%rsp,%rbp,4)
	cmpl	%r9d, 44(%rsp)
	jg	.L23
	addq	%r13, %rdx
	movl	976(%rsp,%rdx,4), %eax
	movl	112(%rsp,%r13,4), %edx
	addl	112(%rsp,%rsi,4), %eax
	cmpl	%edx, %eax
	cmovg	%edx, %eax
	movl	%eax, 112(%rsp,%r13,4)
	testl	%r9d, %r9d
	jg	.L61
.L15:
	movslq	104(%rsp), %rax
	movl	112(%rsp,%rax,4), %eax
	cmpl	108(%rsp), %eax
	jl	.L24
	leaq	.LC4(%rip), %rdi
	call	puts@PLT
.L57:
	movl	96(%rsp), %eax
	leal	-1(%rax), %edx
	movl	%edx, 96(%rsp)
	testl	%eax, %eax
	jne	.L26
.L10:
	movq	45080(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L62
	addq	$45096, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L18:
	.cfi_restore_state
	imulq	$420, %rsi, %rax
	movq	24(%rsp), %rdi
	movq	%r11, %rdx
	leaq	4(%rdi,%rax), %rdi
	.p2align 4,,10
	.p2align 3
.L21:
	movl	(%rdx), %r8d
	movl	112(%rsp,%rsi,4), %eax
	addl	(%rdi), %eax
	cmpl	%r8d, %eax
	cmovg	%r8d, %eax
	addq	$4, %rdx
	addq	$4, %rdi
	movl	%eax, -4(%rdx)
	cmpq	%rbx, %rdx
	jne	.L21
	jmp	.L23
.L24:
	leal	1(%rax), %edx
	leaq	.LC5(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L57
.L28:
	movl	$1, %eax
	jmp	.L3
.L29:
	movl	$1, %eax
	jmp	.L12
.L62:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE35:
	.size	main, .-main
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC1:
	.long	1000000
	.long	1000000
	.long	1000000
	.long	1000000
	.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"
.LC2:
	.string	"%d%d"
.LC3:
	.string	"%d%d%d"
.LC4:
	.string	"NA"
.LC5:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB35:
	.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	-45056(%rsp), %r11
	.cfi_def_cfa 11, 45112
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$40, %rsp
	.cfi_def_cfa_offset 45152
	movl	$44100, %edx
	xorl	%esi, %esi
	leaq	.LC0(%rip), %rbp
	movq	%fs:40, %rax
	movq	%rax, 45080(%rsp)
	xorl	%eax, %eax
	leaq	976(%rsp), %rax
	movq	%rax, %rdi
	movq	%rax, 24(%rsp)
	call	memset@PLT
	movq	%rbp, %rdi
	leaq	92(%rsp), %rsi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	92(%rsp), %edi
	testl	%edi, %edi
	jle	.L2
	movl	%edi, %eax
	movl	%edi, %r11d
	leal	1(%rdi), %r10d
	movl	$1, %ecx
	shrl	$2, %eax
	andl	$-4, %r11d
	leal	-1(%rdi), %r9d
	movdqa	.LC1(%rip), %xmm0
	leal	-1(%rax), %r8d
	leaq	1400(%rsp), %rsi
	addq	$1, %r8
	leal	1(%r11), %ebx
	salq	$4, %r8
	.p2align 4,,10
	.p2align 3
.L6:
	cmpl	$2, %r9d
	jbe	.L28
	leaq	(%r8,%rsi), %rdx
	movq	%rsi, %rax
	.p2align 4,,10
	.p2align 3
.L4:
	movups	%xmm0, (%rax)
	addq	$16, %rax
	cmpq	%rdx, %rax
	jne	.L4
	movl	%ebx, %eax
	cmpl	%edi, %r11d
	je	.L5
.L3:
	movslq	%ecx, %r12
	movslq	%eax, %rdx
	leaq	(%r12,%r12,2), %r13
	leaq	(%r12,%r13,4), %r13
	leaq	(%r12,%r13,8), %r12
	addq	%r12, %rdx
	movl	$1000000, 976(%rsp,%rdx,4)
	leal	1(%rax), %edx
	cmpl	%edx, %edi
	jl	.L5
	movslq	%edx, %rdx
	addl	$2, %eax
	addq	%r12, %rdx
	movl	$1000000, 976(%rsp,%rdx,4)
	cmpl	%eax, %edi
	jl	.L5
	cltq
	addq	%rax, %r12
	movl	$1000000, 976(%rsp,%r12,4)
.L5:
	addl	$1, %ecx
	addq	$420, %rsi
	cmpl	%r10d, %ecx
	jne	.L6
	leaq	100(%rsp), %rax
	xorl	%r12d, %r12d
	leaq	104(%rsp), %r15
	movq	%rax, 48(%rsp)
	leaq	.LC2(%rip), %r13
	leaq	108(%rsp), %rbx
	.p2align 4,,10
	.p2align 3
.L9:
	movq	48(%rsp), %rsi
	movq	%r13, %rdi
	movq	%r15, %rdx
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	104(%rsp), %edi
	testl	%edi, %edi
	jle	.L7
	xorl	%r14d, %r14d
	.p2align 4,,10
	.p2align 3
.L8:
	movq	%rbx, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	addl	$1, %r14d
	call	__isoc99_scanf@PLT
	movslq	100(%rsp), %rax
	movslq	108(%rsp), %rcx
	leaq	(%rax,%rax,2), %rsi
	leaq	(%rax,%rsi,4), %rsi
	leaq	(%rax,%rsi,8), %rax
	addq	%rcx, %rax
	movl	$1, 976(%rsp,%rax,4)
	cmpl	%r14d, 104(%rsp)
	jg	.L8
.L7:
	addl	$1, %r12d
	cmpl	%r12d, 92(%rsp)
	jg	.L9
.L2:
	leaq	96(%rsp), %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	96(%rsp), %eax
	leal	-1(%rax), %edx
	movl	%edx, 96(%rsp)
	testl	%eax, %eax
	je	.L10
	leaq	104(%rsp), %rax
	leaq	544(%rsp), %r12
	movq	%rax, 56(%rsp)
	leaq	100(%rsp), %rax
	leaq	112(%rsp), %r15
	movq	%rax, 48(%rsp)
	leaq	108(%rsp), %rax
	movq	%rax, 64(%rsp)
	leaq	120(%rsp), %rax
	movq	%rax, 72(%rsp)
	.p2align 4,,10
	.p2align 3
.L26:
	movq	64(%rsp), %rcx
	movq	56(%rsp), %rdx
	xorl	%eax, %eax
	leaq	.LC3(%rip), %rdi
	movq	48(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	92(%rsp), %r9d
	movdqa	.LC1(%rip), %xmm4
	leal	-1(%r9), %eax
	testl	%r9d, %r9d
	movl	%eax, 12(%rsp)
	jle	.L11
	cmpl	$2, %eax
	jbe	.L29
	movl	%r9d, %edx
	leaq	116(%rsp), %rax
	shrl	$2, %edx
	subl	$1, %edx
	salq	$4, %rdx
	leaq	132(%rsp,%rdx), %rdx
	.p2align 4,,10
	.p2align 3
.L13:
	movups	%xmm4, (%rax)
	addq	$16, %rax
	cmpq	%rdx, %rax
	jne	.L13
	movl	%r9d, %edx
	andl	$-4, %edx
	leal	1(%rdx), %eax
	cmpl	%edx, %r9d
	je	.L11
.L12:
	movslq	%eax, %rdx
	movl	$1000000, 112(%rsp,%rdx,4)
	leal	1(%rax), %edx
	cmpl	%edx, %r9d
	jl	.L11
	movslq	%edx, %rdx
	addl	$2, %eax
	movl	$1000000, 112(%rsp,%rdx,4)
	cmpl	%eax, %r9d
	jl	.L11
	cltq
	movl	$1000000, 112(%rsp,%rax,4)
.L11:
	xorl	%eax, %eax
	movl	$52, %ecx
	movq	%r12, %rdi
	movl	%r9d, %r14d
	rep stosq
	movslq	100(%rsp), %rax
	andl	$-4, %r14d
	movl	12(%rsp), %ecx
	leal	2(%r14), %esi
	movq	72(%rsp), %rbx
	leal	1(%r14), %r10d
	movl	%esi, 40(%rsp)
	leaq	116(%rsp), %r11
	movslq	%r10d, %r10
	movslq	%esi, %rbp
	movl	$0, 112(%rsp,%rax,4)
	movl	%r9d, %eax
	leaq	(%rbx,%rcx,4), %rbx
	addq	$2, %rcx
	leaq	4(,%rax,4), %rax
	movq	%rax, 16(%rsp)
	movl	%r9d, %eax
	shrl	$2, %eax
	movl	$0, (%rdi)
	leal	3(%r14), %edi
	subl	$1, %eax
	movl	%edi, 44(%rsp)
	movslq	%edi, %r13
	addq	$1, %rax
	salq	$4, %rax
	movq	%rax, 32(%rsp)
	.p2align 4,,10
	.p2align 3
.L23:
	testl	%r9d, %r9d
	jle	.L15
.L61:
	movl	$1, %eax
	movl	$-1, %edx
	jmp	.L17
	.p2align 4,,10
	.p2align 3
.L60:
	movslq	%edx, %rsi
	movl	(%r15,%rax,4), %edi
	cmpl	%edi, 112(%rsp,%rsi,4)
	cmovg	%eax, %edx
.L16:
	addq	$1, %rax
	cmpq	%rcx, %rax
	je	.L59
.L17:
	movl	(%r12,%rax,4), %esi
	testl	%esi, %esi
	jne	.L16
	cmpl	$-1, %edx
	jne	.L60
	movl	%eax, %edx
	addq	$1, %rax
	cmpq	%rcx, %rax
	jne	.L17
	.p2align 4,,10
	.p2align 3
.L59:
	cmpl	$-1, %edx
	je	.L15
	movslq	%edx, %rsi
	leaq	0(,%rsi,4), %rax
	leaq	4(%r15,%rsi,4), %rdx
	cmpq	16(%rsp), %rax
	movl	$1, 544(%rsp,%rsi,4)
	setge	%al
	cmpq	%rdx, %r11
	setnb	%dl
	orb	%dl, %al
	je	.L18
	cmpl	$2, 12(%rsp)
	jbe	.L18
	imulq	$420, %rsi, %rax
	movq	24(%rsp), %rdi
	movd	112(%rsp,%rsi,4), %xmm6
	movq	%r11, %rdx
	pshufd	$0, %xmm6, %xmm3
	leaq	4(%rdi,%rax), %rax
	movq	32(%rsp), %rdi
	addq	%rax, %rdi
	.p2align 4,,10
	.p2align 3
.L19:
	movdqu	(%rax), %xmm2
	movdqu	(%rdx), %xmm5
	addq	$16, %rax
	addq	$16, %rdx
	paddd	%xmm3, %xmm2
	movdqa	%xmm5, %xmm1
	movdqa	%xmm2, %xmm0
	pcmpgtd	%xmm5, %xmm0
	pand	%xmm0, %xmm1
	pandn	%xmm2, %xmm0
	por	%xmm1, %xmm0
	movups	%xmm0, -16(%rdx)
	cmpq	%rdi, %rax
	jne	.L19
	cmpl	%r14d, %r9d
	je	.L23
	leaq	(%rsi,%rsi,2), %rax
	leaq	(%rsi,%rax,4), %rax
	leaq	(%rsi,%rax,8), %rdx
	movl	112(%rsp,%rsi,4), %eax
	leaq	(%rdx,%r10), %rdi
	addl	976(%rsp,%rdi,4), %eax
	movl	112(%rsp,%r10,4), %edi
	cmpl	%edi, %eax
	cmovg	%edi, %eax
	movl	%eax, 112(%rsp,%r10,4)
	cmpl	%r9d, 40(%rsp)
	jg	.L23
	movl	112(%rsp,%rbp,4), %edi
	leaq	(%rdx,%rbp), %rax
	movl	976(%rsp,%rax,4), %eax
	addl	112(%rsp,%rsi,4), %eax
	cmpl	%edi, %eax
	cmovg	%edi, %eax
	movl	%eax, 112(%rsp,%rbp,4)
	cmpl	%r9d, 44(%rsp)
	jg	.L23
	addq	%r13, %rdx
	movl	976(%rsp,%rdx,4), %eax
	movl	112(%rsp,%r13,4), %edx
	addl	112(%rsp,%rsi,4), %eax
	cmpl	%edx, %eax
	cmovg	%edx, %eax
	movl	%eax, 112(%rsp,%r13,4)
	testl	%r9d, %r9d
	jg	.L61
.L15:
	movslq	104(%rsp), %rax
	movl	112(%rsp,%rax,4), %eax
	cmpl	108(%rsp), %eax
	jl	.L24
	leaq	.LC4(%rip), %rdi
	call	puts@PLT
.L57:
	movl	96(%rsp), %eax
	leal	-1(%rax), %edx
	movl	%edx, 96(%rsp)
	testl	%eax, %eax
	jne	.L26
.L10:
	movq	45080(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L62
	addq	$45096, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L18:
	.cfi_restore_state
	imulq	$420, %rsi, %rax
	movq	24(%rsp), %rdi
	movq	%r11, %rdx
	leaq	4(%rdi,%rax), %rdi
	.p2align 4,,10
	.p2align 3
.L21:
	movl	(%rdx), %r8d
	movl	112(%rsp,%rsi,4), %eax
	addl	(%rdi), %eax
	cmpl	%r8d, %eax
	cmovg	%r8d, %eax
	addq	$4, %rdx
	addq	$4, %rdi
	movl	%eax, -4(%rdx)
	cmpq	%rbx, %rdx
	jne	.L21
	jmp	.L23
.L24:
	leal	1(%rax), %edx
	leaq	.LC5(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L57
.L28:
	movl	$1, %eax
	jmp	.L3
.L29:
	movl	$1, %eax
	jmp	.L12
.L62:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE35:
	.size	main, .-main
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC1:
	.long	1000000
	.long	1000000
	.long	1000000
	.long	1000000
	.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<string.h>
#define min(x,y) ((x<y)?x:y)
int main(){
	int n,m,c[105][105],d[105],used[105],i,j,x,y,z,v;
	memset(c,0,sizeof(c));
	
	scanf("%d",&n);
	for(i=1;i<=n;i++)for(j=1;j<=n;j++)c[i][j]=1000000;
	for(i=0;i<n;i++){
		scanf("%d%d",&x,&y);
		for(j=0;j<y;j++){
			scanf("%d",&z);
			c[x][z]=1;
		}
	}
	scanf("%d",&m);
	while(m--){
		scanf("%d%d%d",&x,&y,&z);
		//memset(d,-1,sizeof(d));
		for(i=1;i<=n;i++)d[i]=1000000;
		memset(used,0,sizeof(used));
		d[x]=0;
		while(1){
			v=-1;
			for(i=1;i<=n;i++){
				if(used[i]==0 && (v==-1 || d[v]>d[i]))v=i;
			}
			if(v==-1)break;
			used[v]=1;
			//printf("%d:%d\n",v,d[v]);
			for(i=1;i<=n;i++){
				d[i]=min(d[i],d[v]+c[v][i]);
			}
		}
		if(d[y]+1>z)printf("NA\n");
		else printf("%d\n",d[y]+1);
	}
	
	return 0;
}
7
1 4 2 5 4 3
2 1 5
3 1 6
4 1 7
5 2 7 6
6 1 1
7 0
6
1 2 2
1 5 3
1 2 0
5 1 3
6 3 3
1 7 4
 7
1 4 2 5 4 6
2 1 5
3 1 6
4 1 7
5 2 7 6
6 1 1
7 0
6
1 2 2
1 3 3
1 2 0
5 1 3
6 3 3
1 7 4
 7
1 4 2 5 4 3
2 1 5
3 1 6
4 1 7
5 2 7 6
6 1 1
7 0
6
1 2 2
1 3 6
1 2 0
5 1 3
6 3 1
1 7 4
 7
1 4 2 7 4 6
2 1 5
3 1 6
4 1 7
5 2 7 6
6 1 1
7 0
6
1 2 2
1 3 3
1 2 0
5 1 3
6 3 3
1 7 4
 7
1 4 2 7 3 6
2 1 5
3 1 6
4 1 7
5 2 7 6
6 1 1
7 0
6
1 2 2
1 3 3
1 2 0
5 1 3
6 3 3
1 7 4
 7
1 4 3 5 4 3
2 1 5
3 1 6
4 1 7
5 2 7 6
6 1 1
7 0
6
1 2 2
1 5 3
1 2 1
5 1 3
6 3 3
1 7 4
 7
1 4 2 5 4 3
2 1 5
3 1 6
4 1 7
5 2 7 6
6 1 1
7 0
6
1 2 2
2 3 3
1 2 0
5 1 3
6 3 3
1 7 4
 7
1 4 2 5 4 6
2 1 5
3 1 6
4 1 7
5 2 7 6
6 1 2
7 0
6
1 2 2
1 3 3
1 2 0
5 1 3
6 3 3
1 7 4
 7
1 4 2 7 3 6
2 1 7
3 1 6
4 1 7
5 2 7 6
6 1 1
7 0
6
1 2 2
1 3 3
1 2 0
5 1 3
6 3 3
1 5 4
 7
1 4 4 5 4 6
2 1 5
3 1 6
4 1 7
5 2 7 6
6 1 1
7 0
6
1 2 2
1 3 2
1 2 0
5 1 3
6 3 3
1 7 4

2
2
NA
3
3
3
 2
NA
NA
3
NA
3
 2
2
NA
3
NA
3
 2
NA
NA
3
NA
2
 2
2
NA
3
3
2
 NA
2
NA
3
3
3
 2
NA
NA
3
3
3
 2
NA
NA
NA
NA
3
 2
2
NA
3
3
NA
 NA
NA
NA
3
NA
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<string.h>
#define min(x,y) ((x<y)?x:y)
int main(){
	int n,m,c[105][105],d[105],used[105],i,j,x,y,z,v;
	memset(c,0,sizeof(c));
	
	scanf("%d",&n);
	for(i=1;i<=n;i++)for(j=1;j<=n;j++)c[i][j]=1000000;
	for(i=0;i<n;i++){
		scanf("%d%d",&x,&y);
		for(j=0;j<y;j++){
			scanf("%d",&z);
			c[x][z]=1;
		}
	}
	scanf("%d",&m);
	while(m--){
		scanf("%d%d%d",&x,&y,&z);
		//memset(d,-1,sizeof(d));
		for(i=1;i<=n;i++)d[i]=1000000;
		memset(used,0,sizeof(used));
		d[x]=0;
		while(1){
			v=-1;
			for(i=1;i<=n;i++){
				if(used[i]==0 && (v==-1 || d[v]>d[i]))v=i;
			}
			if(v==-1)break;
			used[v]=1;
			//printf("%d:%d\n",v,d[v]);
			for(i=1;i<=n;i++){
				d[i]=min(d[i],d[v]+c[v][i]);
			}
		}
		if(d[y]+1>z)printf("NA\n");
		else printf("%d\n",d[y]+1);
	}
	
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d%d"
.LC2:
	.string	"%d%d%d"
.LC3:
	.string	"NA"
.LC4:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	leaq	-40960(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$4048, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-44112(%rbp), %rax
	movl	$44100, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	leaq	-45008(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, -44988(%rbp)
	jmp	.L2
.L5:
	movl	$1, -44984(%rbp)
	jmp	.L3
.L4:
	movl	-44984(%rbp), %eax
	movslq	%eax, %rcx
	movl	-44988(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	movl	$1000000, -44112(%rbp,%rax,4)
	addl	$1, -44984(%rbp)
.L3:
	movl	-45008(%rbp), %eax
	cmpl	%eax, -44984(%rbp)
	jle	.L4
	addl	$1, -44988(%rbp)
.L2:
	movl	-45008(%rbp), %eax
	cmpl	%eax, -44988(%rbp)
	jle	.L5
	movl	$0, -44988(%rbp)
	jmp	.L6
.L9:
	leaq	-44996(%rbp), %rdx
	leaq	-45000(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -44984(%rbp)
	jmp	.L7
.L8:
	leaq	-44992(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-45000(%rbp), %eax
	movl	-44992(%rbp), %edx
	movslq	%edx, %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	movl	$1, -44112(%rbp,%rax,4)
	addl	$1, -44984(%rbp)
.L7:
	movl	-44996(%rbp), %eax
	cmpl	%eax, -44984(%rbp)
	jl	.L8
	addl	$1, -44988(%rbp)
.L6:
	movl	-45008(%rbp), %eax
	cmpl	%eax, -44988(%rbp)
	jl	.L9
	leaq	-45004(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	jmp	.L10
.L23:
	leaq	-44992(%rbp), %rcx
	leaq	-44996(%rbp), %rdx
	leaq	-45000(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, -44988(%rbp)
	jmp	.L11
.L12:
	movl	-44988(%rbp), %eax
	cltq
	movl	$1000000, -44976(%rbp,%rax,4)
	addl	$1, -44988(%rbp)
.L11:
	movl	-45008(%rbp), %eax
	cmpl	%eax, -44988(%rbp)
	jle	.L12
	leaq	-44544(%rbp), %rax
	movl	$420, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	movl	-45000(%rbp), %eax
	cltq
	movl	$0, -44976(%rbp,%rax,4)
.L21:
	movl	$-1, -44980(%rbp)
	movl	$1, -44988(%rbp)
	jmp	.L13
.L16:
	movl	-44988(%rbp), %eax
	cltq
	movl	-44544(%rbp,%rax,4), %eax
	testl	%eax, %eax
	jne	.L14
	cmpl	$-1, -44980(%rbp)
	je	.L15
	movl	-44980(%rbp), %eax
	cltq
	movl	-44976(%rbp,%rax,4), %edx
	movl	-44988(%rbp), %eax
	cltq
	movl	-44976(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jle	.L14
.L15:
	movl	-44988(%rbp), %eax
	movl	%eax, -44980(%rbp)
.L14:
	addl	$1, -44988(%rbp)
.L13:
	movl	-45008(%rbp), %eax
	cmpl	%eax, -44988(%rbp)
	jle	.L16
	cmpl	$-1, -44980(%rbp)
	je	.L27
	movl	-44980(%rbp), %eax
	cltq
	movl	$1, -44544(%rbp,%rax,4)
	movl	$1, -44988(%rbp)
	jmp	.L19
.L20:
	movl	-44980(%rbp), %eax
	cltq
	movl	-44976(%rbp,%rax,4), %ecx
	movl	-44988(%rbp), %eax
	movslq	%eax, %rsi
	movl	-44980(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	addq	%rdx, %rax
	addq	%rsi, %rax
	movl	-44112(%rbp,%rax,4), %eax
	leal	(%rcx,%rax), %edx
	movl	-44988(%rbp), %eax
	cltq
	movl	-44976(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	cmovg	%eax, %edx
	movl	-44988(%rbp), %eax
	cltq
	movl	%edx, -44976(%rbp,%rax,4)
	addl	$1, -44988(%rbp)
.L19:
	movl	-45008(%rbp), %eax
	cmpl	%eax, -44988(%rbp)
	jle	.L20
	jmp	.L21
.L27:
	nop
	movl	-44996(%rbp), %eax
	cltq
	movl	-44976(%rbp,%rax,4), %edx
	movl	-44992(%rbp), %eax
	cmpl	%eax, %edx
	jl	.L22
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L10
.L22:
	movl	-44996(%rbp), %eax
	cltq
	movl	-44976(%rbp,%rax,4), %eax
	addl	$1, %eax
	movl	%eax, %esi
	leaq	.LC4(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L10:
	movl	-45004(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -45004(%rbp)
	testl	%eax, %eax
	jne	.L23
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L25
	call	__stack_chk_fail@PLT
.L25:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.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%d"
.LC3:
	.string	"NA"
.LC4:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	leaq	-40960(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$4048, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-44112(%rbp), %rax
	movl	$44100, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	leaq	-45008(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, -44988(%rbp)
	jmp	.L2
.L5:
	movl	$1, -44984(%rbp)
	jmp	.L3
.L4:
	movl	-44984(%rbp), %eax
	movslq	%eax, %rcx
	movl	-44988(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	movl	$1000000, -44112(%rbp,%rax,4)
	addl	$1, -44984(%rbp)
.L3:
	movl	-45008(%rbp), %eax
	cmpl	%eax, -44984(%rbp)
	jle	.L4
	addl	$1, -44988(%rbp)
.L2:
	movl	-45008(%rbp), %eax
	cmpl	%eax, -44988(%rbp)
	jle	.L5
	movl	$0, -44988(%rbp)
	jmp	.L6
.L9:
	leaq	-44996(%rbp), %rdx
	leaq	-45000(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -44984(%rbp)
	jmp	.L7
.L8:
	leaq	-44992(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-45000(%rbp), %eax
	movl	-44992(%rbp), %edx
	movslq	%edx, %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	movl	$1, -44112(%rbp,%rax,4)
	addl	$1, -44984(%rbp)
.L7:
	movl	-44996(%rbp), %eax
	cmpl	%eax, -44984(%rbp)
	jl	.L8
	addl	$1, -44988(%rbp)
.L6:
	movl	-45008(%rbp), %eax
	cmpl	%eax, -44988(%rbp)
	jl	.L9
	leaq	-45004(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	jmp	.L10
.L23:
	leaq	-44992(%rbp), %rcx
	leaq	-44996(%rbp), %rdx
	leaq	-45000(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, -44988(%rbp)
	jmp	.L11
.L12:
	movl	-44988(%rbp), %eax
	cltq
	movl	$1000000, -44976(%rbp,%rax,4)
	addl	$1, -44988(%rbp)
.L11:
	movl	-45008(%rbp), %eax
	cmpl	%eax, -44988(%rbp)
	jle	.L12
	leaq	-44544(%rbp), %rax
	movl	$420, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	movl	-45000(%rbp), %eax
	cltq
	movl	$0, -44976(%rbp,%rax,4)
.L21:
	movl	$-1, -44980(%rbp)
	movl	$1, -44988(%rbp)
	jmp	.L13
.L16:
	movl	-44988(%rbp), %eax
	cltq
	movl	-44544(%rbp,%rax,4), %eax
	testl	%eax, %eax
	jne	.L14
	cmpl	$-1, -44980(%rbp)
	je	.L15
	movl	-44980(%rbp), %eax
	cltq
	movl	-44976(%rbp,%rax,4), %edx
	movl	-44988(%rbp), %eax
	cltq
	movl	-44976(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jle	.L14
.L15:
	movl	-44988(%rbp), %eax
	movl	%eax, -44980(%rbp)
.L14:
	addl	$1, -44988(%rbp)
.L13:
	movl	-45008(%rbp), %eax
	cmpl	%eax, -44988(%rbp)
	jle	.L16
	cmpl	$-1, -44980(%rbp)
	je	.L27
	movl	-44980(%rbp), %eax
	cltq
	movl	$1, -44544(%rbp,%rax,4)
	movl	$1, -44988(%rbp)
	jmp	.L19
.L20:
	movl	-44980(%rbp), %eax
	cltq
	movl	-44976(%rbp,%rax,4), %ecx
	movl	-44988(%rbp), %eax
	movslq	%eax, %rsi
	movl	-44980(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$3, %rax
	addq	%rdx, %rax
	addq	%rsi, %rax
	movl	-44112(%rbp,%rax,4), %eax
	leal	(%rcx,%rax), %edx
	movl	-44988(%rbp), %eax
	cltq
	movl	-44976(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	cmovg	%eax, %edx
	movl	-44988(%rbp), %eax
	cltq
	movl	%edx, -44976(%rbp,%rax,4)
	addl	$1, -44988(%rbp)
.L19:
	movl	-45008(%rbp), %eax
	cmpl	%eax, -44988(%rbp)
	jle	.L20
	jmp	.L21
.L27:
	nop
	movl	-44996(%rbp), %eax
	cltq
	movl	-44976(%rbp,%rax,4), %edx
	movl	-44992(%rbp), %eax
	cmpl	%eax, %edx
	jl	.L22
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L10
.L22:
	movl	-44996(%rbp), %eax
	cltq
	movl	-44976(%rbp,%rax,4), %eax
	addl	$1, %eax
	movl	%eax, %esi
	leaq	.LC4(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L10:
	movl	-45004(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -45004(%rbp)
	testl	%eax, %eax
	jne	.L23
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L25
	call	__stack_chk_fail@PLT
.L25:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.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:
