Given the following C code and unoptimized assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
//from PKU1125
#define M 299
double dist[M][M],d;
next[M][M],x[M],y[M];
main(){
	int a,b,k,n,i,j;
	for(;scanf("%d",&n),n;){
		/*initialize*/
		for(i=1;i<=n;i++)scanf("%d",&a),scanf("%d%d",x+a,y+a);
		for(i=1;i<=n;i++)for(j=1;j<=n;next[i][j]=j,j++)
			dist[i][j]=(d=hypot(x[i]-x[j],y[i]-y[j]))<50.1?d:M;

		{/*warshall-floyd*/
			int k,i,j;
			for(k=1;k<=n;k++)
				for(i=1;i<=n;i++)
					for(j=1;j<=n;j++){
						if(dist[i][j]>dist[i][k]+dist[k][j])
							dist[i][j]=dist[i][k]+dist[k][j],next[i][j]=next[i][k];
					}
		}

		{/*query*/
			for(scanf("%d",&k);k;k--){
				scanf("%d%d",&a,&b);
				if(dist[a][b]>=M){puts("NA");continue;}
				for(j=a;j!=b;j=next[j][b])printf("%d ",j);
				printf("%d\n",b);
			}
		}
	}exit(0);
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	dist
	.bss
	.align 32
	.type	dist, @object
	.size	dist, 715208
dist:
	.zero	715208
	.globl	d
	.align 8
	.type	d, @object
	.size	d, 8
d:
	.zero	8
	.globl	next
	.align 32
	.type	next, @object
	.size	next, 357604
next:
	.zero	357604
	.globl	x
	.align 32
	.type	x, @object
	.size	x, 1196
x:
	.zero	1196
	.globl	y
	.align 32
	.type	y, @object
	.size	y, 1196
y:
	.zero	1196
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d%d"
.LC4:
	.string	"NA"
.LC5:
	.string	"%d "
.LC6:
	.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
	subq	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	jmp	.L2
.L27:
	movl	$1, -28(%rbp)
	jmp	.L3
.L4:
	leaq	-44(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	y(%rip), %rax
	addq	%rax, %rdx
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	x(%rip), %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	addl	$1, -28(%rbp)
.L3:
	movl	-32(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jle	.L4
	movl	$1, -28(%rbp)
	jmp	.L5
.L11:
	movl	$1, -24(%rbp)
	jmp	.L6
.L10:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	y(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-24(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	y(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	subl	%edx, %eax
	pxor	%xmm0, %xmm0
	cvtsi2sdl	%eax, %xmm0
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	x(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-24(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	x(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	subl	%edx, %eax
	pxor	%xmm3, %xmm3
	cvtsi2sdl	%eax, %xmm3
	movq	%xmm3, %rax
	movapd	%xmm0, %xmm1
	movq	%rax, %xmm0
	call	hypot@PLT
	movq	%xmm0, %rax
	movq	%rax, d(%rip)
	movsd	d(%rip), %xmm1
	movsd	.LC2(%rip), %xmm0
	comisd	%xmm1, %xmm0
	jbe	.L32
	movsd	d(%rip), %xmm0
	jmp	.L9
.L32:
	movsd	.LC3(%rip), %xmm0
.L9:
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movl	-28(%rbp), %eax
	cltq
	imulq	$299, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	dist(%rip), %rax
	movsd	%xmm0, (%rdx,%rax)
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movl	-28(%rbp), %eax
	cltq
	imulq	$299, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rcx
	leaq	next(%rip), %rdx
	movl	-24(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	addl	$1, -24(%rbp)
.L6:
	movl	-32(%rbp), %eax
	cmpl	%eax, -24(%rbp)
	jle	.L10
	addl	$1, -28(%rbp)
.L5:
	movl	-32(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jle	.L11
	movl	$1, -20(%rbp)
	jmp	.L12
.L19:
	movl	$1, -16(%rbp)
	jmp	.L13
.L18:
	movl	$1, -12(%rbp)
	jmp	.L14
.L17:
	movl	-12(%rbp), %eax
	movslq	%eax, %rdx
	movl	-16(%rbp), %eax
	cltq
	imulq	$299, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	dist(%rip), %rax
	movsd	(%rdx,%rax), %xmm0
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movl	-16(%rbp), %eax
	cltq
	imulq	$299, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	dist(%rip), %rax
	movsd	(%rdx,%rax), %xmm2
	movl	-12(%rbp), %eax
	movslq	%eax, %rdx
	movl	-20(%rbp), %eax
	cltq
	imulq	$299, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	dist(%rip), %rax
	movsd	(%rdx,%rax), %xmm1
	addsd	%xmm2, %xmm1
	comisd	%xmm1, %xmm0
	jbe	.L15
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movl	-16(%rbp), %eax
	cltq
	imulq	$299, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	dist(%rip), %rax
	movsd	(%rdx,%rax), %xmm1
	movl	-12(%rbp), %eax
	movslq	%eax, %rdx
	movl	-20(%rbp), %eax
	cltq
	imulq	$299, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	dist(%rip), %rax
	movsd	(%rdx,%rax), %xmm0
	addsd	%xmm1, %xmm0
	movl	-12(%rbp), %eax
	movslq	%eax, %rdx
	movl	-16(%rbp), %eax
	cltq
	imulq	$299, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	dist(%rip), %rax
	movsd	%xmm0, (%rdx,%rax)
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movl	-16(%rbp), %eax
	cltq
	imulq	$299, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	next(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-12(%rbp), %edx
	movslq	%edx, %rcx
	movl	-16(%rbp), %edx
	movslq	%edx, %rdx
	imulq	$299, %rdx, %rdx
	addq	%rcx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	next(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
.L15:
	addl	$1, -12(%rbp)
.L14:
	movl	-32(%rbp), %eax
	cmpl	%eax, -12(%rbp)
	jle	.L17
	addl	$1, -16(%rbp)
.L13:
	movl	-32(%rbp), %eax
	cmpl	%eax, -16(%rbp)
	jle	.L18
	addl	$1, -20(%rbp)
.L12:
	movl	-32(%rbp), %eax
	cmpl	%eax, -20(%rbp)
	jle	.L19
	leaq	-36(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	jmp	.L20
.L26:
	leaq	-40(%rbp), %rdx
	leaq	-44(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	-44(%rbp), %eax
	movl	-40(%rbp), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$299, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	dist(%rip), %rax
	movsd	(%rdx,%rax), %xmm0
	comisd	.LC3(%rip), %xmm0
	jb	.L33
	leaq	.LC4(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L23
.L33:
	movl	-44(%rbp), %eax
	movl	%eax, -24(%rbp)
	jmp	.L24
.L25:
	movl	-24(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC5(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	movl	-24(%rbp), %eax
	cltq
	imulq	$299, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	next(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -24(%rbp)
.L24:
	movl	-40(%rbp), %eax
	cmpl	%eax, -24(%rbp)
	jne	.L25
	movl	-40(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC6(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L23:
	movl	-36(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -36(%rbp)
.L20:
	movl	-36(%rbp), %eax
	testl	%eax, %eax
	jne	.L26
.L2:
	leaq	-32(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	-32(%rbp), %eax
	testl	%eax, %eax
	jne	.L27
	movl	$0, %edi
	call	exit@PLT
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.section	.rodata
	.align 8
.LC2:
	.long	-858993459
	.long	1078529228
	.align 8
.LC3:
	.long	0
	.long	1081257984
	.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"
.LC4:
	.string	"NA"
.LC5:
	.string	"%d "
.LC6:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	x(%rip), %r15
	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
	subq	$104, %rsp
	.cfi_def_cfa_offset 160
	movq	%fs:40, %rax
	movq	%rax, 88(%rsp)
	xorl	%eax, %eax
	leaq	84(%rsp), %rax
	movq	%rax, 56(%rsp)
.L2:
	movq	56(%rsp), %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	call	scanf@PLT
	movl	84(%rsp), %edx
	testl	%edx, %edx
	je	.L23
	movl	$1, %ebx
	leaq	72(%rsp), %r13
	leaq	.LC1(%rip), %r12
	jle	.L15
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r13, %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	scanf@PLT
	movslq	72(%rsp), %rax
	leaq	y(%rip), %rdi
	salq	$2, %rax
	leaq	(%rdi,%rax), %rdx
	leaq	(%r15,%rax), %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	scanf@PLT
	movl	84(%rsp), %eax
	cmpl	%ebx, %eax
	jge	.L3
	testl	%eax, %eax
	jle	.L15
	leal	-1(%rax), %edi
	leaq	8+y(%rip), %rax
	leaq	0(,%rdi,4), %rsi
	leaq	4+y(%rip), %rbx
	movq	%rdi, 40(%rsp)
	addq	%rsi, %rax
	movq	%rsi, 48(%rsp)
	leaq	2392+dist(%rip), %rbp
	movq	%rax, 32(%rsp)
	leaq	2(%rdi), %rax
	movq	%rax, 8(%rsp)
	movq	%rbx, 16(%rsp)
	leaq	4+x(%rip), %rbx
	movq	%rbx, 24(%rsp)
	leaq	1196+next(%rip), %rbx
	.p2align 4,,10
	.p2align 3
.L9:
	movq	16(%rsp), %rax
	movl	$1, %r14d
	movl	(%rax), %r13d
	movq	24(%rsp), %rax
	movl	(%rax), %r12d
	.p2align 4,,10
	.p2align 3
.L8:
	movl	%r13d, %eax
	pxor	%xmm0, %xmm0
	pxor	%xmm1, %xmm1
	movl	%r12d, %edx
	leaq	y(%rip), %rdi
	subl	(%r15,%r14,4), %edx
	subl	(%rdi,%r14,4), %eax
	cvtsi2sdl	%edx, %xmm0
	cvtsi2sdl	%eax, %xmm1
	call	hypot@PLT
	movsd	.LC2(%rip), %xmm2
	movsd	%xmm0, d(%rip)
	comisd	%xmm0, %xmm2
	ja	.L5
	movq	.LC3(%rip), %rax
	movq	%rax, 0(%rbp,%r14,8)
	movl	%r14d, (%rbx,%r14,4)
	addq	$1, %r14
	cmpq	8(%rsp), %r14
	jne	.L8
.L7:
	addq	$4, 16(%rsp)
	addq	$2392, %rbp
	movq	16(%rsp), %rax
	addq	$1196, %rbx
	addq	$4, 24(%rsp)
	cmpq	32(%rsp), %rax
	jne	.L9
	movq	40(%rsp), %rbx
	leaq	8+dist(%rip), %r12
	movq	$-8, %rax
	subq	48(%rsp), %rax
	movq	%rax, 8(%rsp)
	leaq	8(%r12), %rax
	movq	$-4, %r14
	movq	%r12, %rbp
	leaq	2392(%rax,%rbx,8), %r13
	movl	$2392, %r9d
	imulq	$-2392, %rbx, %rbx
	subq	$4784, %rbx
	.p2align 4,,10
	.p2align 3
.L10:
	leaq	next(%rip), %r10
	movq	%r12, %r8
	movq	%r13, %rdi
	movq	$-2392, %rsi
	subq	%r14, %r10
	leaq	1200(%r14), %r11
	.p2align 4,,10
	.p2align 3
.L16:
	movq	%rbp, %rax
	leaq	(%r11,%r10), %rdx
	subq	%rsi, %rax
	.p2align 4,,10
	.p2align 3
.L13:
	leaq	(%rax,%rsi), %rcx
	movsd	(%rax), %xmm1
	movsd	(%rcx,%r9), %xmm0
	addsd	2392(%r8), %xmm0
	comisd	%xmm0, %xmm1
	jbe	.L11
	movl	1196(%r10), %ecx
	movsd	%xmm0, (%rax)
	movl	%ecx, (%rdx)
.L11:
	addq	$8, %rax
	addq	$4, %rdx
	cmpq	%rax, %rdi
	jne	.L13
	subq	$2392, %rsi
	addq	$2392, %rdi
	addq	$1196, %r10
	addq	$2392, %r8
	cmpq	%rbx, %rsi
	jne	.L16
	addq	$2392, %r9
	addq	$8, %r12
	subq	$4, %r14
	cmpq	%r14, 8(%rsp)
	jne	.L10
.L15:
	leaq	80(%rsp), %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	call	scanf@PLT
	movl	80(%rsp), %eax
	testl	%eax, %eax
	je	.L2
	leaq	76(%rsp), %rax
	leaq	72(%rsp), %r13
	movq	%rax, 8(%rsp)
	leaq	.LC1(%rip), %r12
	leaq	next(%rip), %rbp
	leaq	.LC5(%rip), %rbx
	.p2align 4,,10
	.p2align 3
.L21:
	movq	8(%rsp), %rdx
	movq	%r13, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	scanf@PLT
	movslq	72(%rsp), %r14
	movslq	76(%rsp), %rdi
	imulq	$299, %r14, %rax
	movq	%rdi, %rcx
	movq	%r14, %rsi
	addq	%rdi, %rax
	leaq	dist(%rip), %rdi
	movsd	(%rdi,%rax,8), %xmm0
	comisd	.LC3(%rip), %xmm0
	jnb	.L17
	cmpl	%ecx, %r14d
	jne	.L18
	jmp	.L19
	.p2align 4,,10
	.p2align 3
.L41:
	movslq	%esi, %r14
.L18:
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	printf@PLT
	imulq	$299, %r14, %rax
	movslq	76(%rsp), %rcx
	addq	%rcx, %rax
	movl	0(%rbp,%rax,4), %esi
	cmpl	%esi, %ecx
	jne	.L41
.L19:
	leaq	.LC6(%rip), %rdi
	xorl	%eax, %eax
	call	printf@PLT
.L20:
	subl	$1, 80(%rsp)
	jne	.L21
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L5:
	movsd	%xmm0, 0(%rbp,%r14,8)
	movl	%r14d, (%rbx,%r14,4)
	addq	$1, %r14
	cmpq	8(%rsp), %r14
	jne	.L8
	jmp	.L7
.L17:
	leaq	.LC4(%rip), %rdi
	call	puts@PLT
	jmp	.L20
.L23:
	xorl	%edi, %edi
	call	exit@PLT
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	y
	.bss
	.align 32
	.type	y, @object
	.size	y, 1196
y:
	.zero	1196
	.globl	x
	.align 32
	.type	x, @object
	.size	x, 1196
x:
	.zero	1196
	.globl	next
	.align 32
	.type	next, @object
	.size	next, 357604
next:
	.zero	357604
	.globl	d
	.align 8
	.type	d, @object
	.size	d, 8
d:
	.zero	8
	.globl	dist
	.align 32
	.type	dist, @object
	.size	dist, 715208
dist:
	.zero	715208
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC2:
	.long	-858993459
	.long	1078529228
	.align 8
.LC3:
	.long	0
	.long	1081257984
	.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"
.LC4:
	.string	"NA"
.LC5:
	.string	"%d "
.LC6:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	x(%rip), %r15
	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
	subq	$104, %rsp
	.cfi_def_cfa_offset 160
	movq	%fs:40, %rax
	movq	%rax, 88(%rsp)
	xorl	%eax, %eax
	leaq	84(%rsp), %rax
	movq	%rax, 56(%rsp)
.L2:
	movq	56(%rsp), %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	call	scanf@PLT
	movl	84(%rsp), %edx
	testl	%edx, %edx
	je	.L23
	movl	$1, %ebx
	leaq	72(%rsp), %r13
	leaq	.LC1(%rip), %r12
	jle	.L15
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r13, %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	scanf@PLT
	movslq	72(%rsp), %rax
	leaq	y(%rip), %rdi
	salq	$2, %rax
	leaq	(%rdi,%rax), %rdx
	leaq	(%r15,%rax), %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	scanf@PLT
	movl	84(%rsp), %eax
	cmpl	%ebx, %eax
	jge	.L3
	testl	%eax, %eax
	jle	.L15
	leal	-1(%rax), %edi
	leaq	8+y(%rip), %rax
	leaq	0(,%rdi,4), %rsi
	leaq	4+y(%rip), %rbx
	movq	%rdi, 40(%rsp)
	addq	%rsi, %rax
	movq	%rsi, 48(%rsp)
	leaq	2392+dist(%rip), %rbp
	movq	%rax, 32(%rsp)
	leaq	2(%rdi), %rax
	movq	%rax, 8(%rsp)
	movq	%rbx, 16(%rsp)
	leaq	4+x(%rip), %rbx
	movq	%rbx, 24(%rsp)
	leaq	1196+next(%rip), %rbx
	.p2align 4,,10
	.p2align 3
.L9:
	movq	16(%rsp), %rax
	movl	$1, %r14d
	movl	(%rax), %r13d
	movq	24(%rsp), %rax
	movl	(%rax), %r12d
	.p2align 4,,10
	.p2align 3
.L8:
	movl	%r13d, %eax
	pxor	%xmm0, %xmm0
	pxor	%xmm1, %xmm1
	movl	%r12d, %edx
	leaq	y(%rip), %rdi
	subl	(%r15,%r14,4), %edx
	subl	(%rdi,%r14,4), %eax
	cvtsi2sdl	%edx, %xmm0
	cvtsi2sdl	%eax, %xmm1
	call	hypot@PLT
	movsd	.LC2(%rip), %xmm2
	movsd	%xmm0, d(%rip)
	comisd	%xmm0, %xmm2
	ja	.L5
	movq	.LC3(%rip), %rax
	movq	%rax, 0(%rbp,%r14,8)
	movl	%r14d, (%rbx,%r14,4)
	addq	$1, %r14
	cmpq	8(%rsp), %r14
	jne	.L8
.L7:
	addq	$4, 16(%rsp)
	addq	$2392, %rbp
	movq	16(%rsp), %rax
	addq	$1196, %rbx
	addq	$4, 24(%rsp)
	cmpq	32(%rsp), %rax
	jne	.L9
	movq	40(%rsp), %rbx
	leaq	8+dist(%rip), %r12
	movq	$-8, %rax
	subq	48(%rsp), %rax
	movq	%rax, 8(%rsp)
	leaq	8(%r12), %rax
	movq	$-4, %r14
	movq	%r12, %rbp
	leaq	2392(%rax,%rbx,8), %r13
	movl	$2392, %r9d
	imulq	$-2392, %rbx, %rbx
	subq	$4784, %rbx
	.p2align 4,,10
	.p2align 3
.L10:
	leaq	next(%rip), %r10
	movq	%r12, %r8
	movq	%r13, %rdi
	movq	$-2392, %rsi
	subq	%r14, %r10
	leaq	1200(%r14), %r11
	.p2align 4,,10
	.p2align 3
.L16:
	movq	%rbp, %rax
	leaq	(%r11,%r10), %rdx
	subq	%rsi, %rax
	.p2align 4,,10
	.p2align 3
.L13:
	leaq	(%rax,%rsi), %rcx
	movsd	(%rax), %xmm1
	movsd	(%rcx,%r9), %xmm0
	addsd	2392(%r8), %xmm0
	comisd	%xmm0, %xmm1
	jbe	.L11
	movl	1196(%r10), %ecx
	movsd	%xmm0, (%rax)
	movl	%ecx, (%rdx)
.L11:
	addq	$8, %rax
	addq	$4, %rdx
	cmpq	%rax, %rdi
	jne	.L13
	subq	$2392, %rsi
	addq	$2392, %rdi
	addq	$1196, %r10
	addq	$2392, %r8
	cmpq	%rbx, %rsi
	jne	.L16
	addq	$2392, %r9
	addq	$8, %r12
	subq	$4, %r14
	cmpq	%r14, 8(%rsp)
	jne	.L10
.L15:
	leaq	80(%rsp), %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	call	scanf@PLT
	movl	80(%rsp), %eax
	testl	%eax, %eax
	je	.L2
	leaq	76(%rsp), %rax
	leaq	72(%rsp), %r13
	movq	%rax, 8(%rsp)
	leaq	.LC1(%rip), %r12
	leaq	next(%rip), %rbp
	leaq	.LC5(%rip), %rbx
	.p2align 4,,10
	.p2align 3
.L21:
	movq	8(%rsp), %rdx
	movq	%r13, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	scanf@PLT
	movslq	72(%rsp), %r14
	movslq	76(%rsp), %rdi
	imulq	$299, %r14, %rax
	movq	%rdi, %rcx
	movq	%r14, %rsi
	addq	%rdi, %rax
	leaq	dist(%rip), %rdi
	movsd	(%rdi,%rax,8), %xmm0
	comisd	.LC3(%rip), %xmm0
	jnb	.L17
	cmpl	%ecx, %r14d
	jne	.L18
	jmp	.L19
	.p2align 4,,10
	.p2align 3
.L41:
	movslq	%esi, %r14
.L18:
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	printf@PLT
	imulq	$299, %r14, %rax
	movslq	76(%rsp), %rcx
	addq	%rcx, %rax
	movl	0(%rbp,%rax,4), %esi
	cmpl	%esi, %ecx
	jne	.L41
.L19:
	leaq	.LC6(%rip), %rdi
	xorl	%eax, %eax
	call	printf@PLT
.L20:
	subl	$1, 80(%rsp)
	jne	.L21
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L5:
	movsd	%xmm0, 0(%rbp,%r14,8)
	movl	%r14d, (%rbx,%r14,4)
	addq	$1, %r14
	cmpq	8(%rsp), %r14
	jne	.L8
	jmp	.L7
.L17:
	leaq	.LC4(%rip), %rdi
	call	puts@PLT
	jmp	.L20
.L23:
	xorl	%edi, %edi
	call	exit@PLT
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	y
	.bss
	.align 32
	.type	y, @object
	.size	y, 1196
y:
	.zero	1196
	.globl	x
	.align 32
	.type	x, @object
	.size	x, 1196
x:
	.zero	1196
	.globl	next
	.align 32
	.type	next, @object
	.size	next, 357604
next:
	.zero	357604
	.globl	d
	.align 8
	.type	d, @object
	.size	d, 8
d:
	.zero	8
	.globl	dist
	.align 32
	.type	dist, @object
	.size	dist, 715208
dist:
	.zero	715208
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC2:
	.long	-858993459
	.long	1078529228
	.align 8
.LC3:
	.long	0
	.long	1081257984
	.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:

//from PKU1125
#define M 299
double dist[M][M],d;
next[M][M],x[M],y[M];
main(){
	int a,b,k,n,i,j;
	for(;scanf("%d",&n),n;){
		/*initialize*/
		for(i=1;i<=n;i++)scanf("%d",&a),scanf("%d%d",x+a,y+a);
		for(i=1;i<=n;i++)for(j=1;j<=n;next[i][j]=j,j++)
			dist[i][j]=(d=hypot(x[i]-x[j],y[i]-y[j]))<50.1?d:M;

		{/*warshall-floyd*/
			int k,i,j;
			for(k=1;k<=n;k++)
				for(i=1;i<=n;i++)
					for(j=1;j<=n;j++){
						if(dist[i][j]>dist[i][k]+dist[k][j])
							dist[i][j]=dist[i][k]+dist[k][j],next[i][j]=next[i][k];
					}
		}

		{/*query*/
			for(scanf("%d",&k);k;k--){
				scanf("%d%d",&a,&b);
				if(dist[a][b]>=M){puts("NA");continue;}
				for(j=a;j!=b;j=next[j][b])printf("%d ",j);
				printf("%d\n",b);
			}
		}
	}exit(0);
}
4
1 -1 0
2 30 0
3 60 40
4 0 60
2
1 3
1 4
22
1 0 0
2 150 40
3 30 20
4 180 150
5 40 80
6 130 130
7 72 28
8 172 118
9 50 50
10 160 82
11 90 105
12 144 131
13 130 64
14 80 140
15 38 117
16 190 90
17 60 100
18 100 70
19 130 100
20 71 69
21 200 110
22 120 150
1
1 22
0
 4
1 -1 0
2 30 0
3 60 40
4 0 60
2
1 3
1 2
22
1 0 0
2 150 40
3 30 20
4 180 150
5 40 80
6 130 130
7 72 28
8 172 118
9 50 50
10 160 82
11 90 105
12 144 131
13 130 64
14 80 140
15 36 117
16 190 90
17 60 100
18 100 70
19 130 100
20 71 69
21 200 110
22 120 150
1
1 22
0
 4
1 -1 0
2 30 0
3 60 40
4 0 60
2
1 3
1 4
22
1 0 0
2 150 40
3 30 20
4 180 150
5 40 80
6 130 130
7 72 28
8 172 118
9 50 50
10 160 82
11 90 105
12 144 131
13 130 64
14 80 140
15 36 117
16 190 90
17 49 100
18 100 70
19 130 100
20 71 69
21 200 110
22 5 150
1
1 22
0
 4
1 -1 0
2 30 0
3 71 40
4 0 60
2
1 3
1 4
22
1 0 0
2 150 40
3 30 20
4 180 150
5 40 80
6 130 130
7 72 28
8 172 118
9 50 50
10 160 82
11 90 5
20 144 131
13 130 32
14 80 140
15 36 117
16 190 90
17 49 100
18 100 70
19 130 100
20 71 69
21 200 110
22 5 150
1
1 22
0
 4
1 -1 0
2 30 0
3 60 40
4 0 60
2
1 2
1 4
22
1 0 0
2 150 40
3 30 20
4 180 150
5 40 80
6 130 130
7 72 28
8 172 118
9 50 50
10 160 82
11 90 105
12 144 131
13 130 64
14 80 140
15 38 117
16 190 90
17 60 100
18 100 70
19 130 100
20 71 69
21 200 110
22 140 150
1
1 22
0
 4
1 -2 0
2 30 0
3 60 40
4 0 60
2
1 3
1 4
22
1 0 0
2 150 40
3 30 20
4 180 150
5 40 80
6 130 130
7 72 28
8 172 118
9 50 50
10 160 82
11 90 105
12 144 131
13 130 64
14 80 140
15 36 117
16 190 90
17 60 100
18 100 70
19 130 100
20 71 19
21 200 110
22 120 150
1
1 22
0
 4
1 -1 0
2 30 0
3 60 40
4 0 60
2
1 3
1 4
22
1 0 0
2 150 40
3 30 20
4 180 150
5 40 80
6 130 130
7 72 28
8 172 202
9 50 50
10 160 82
11 90 105
12 144 131
13 130 64
14 80 140
15 38 117
16 190 90
17 109 100
18 110 70
19 130 100
20 71 69
21 200 110
22 120 150
1
1 22
0
 4
1 -1 0
2 30 0
3 58 40
4 0 60
2
1 3
1 2
22
1 0 0
2 150 40
3 30 20
4 180 150
5 40 80
6 130 130
7 72 28
8 172 118
9 50 50
10 160 82
11 90 105
12 144 131
13 197 6
14 80 140
15 36 117
16 190 90
17 60 100
18 100 138
19 130 100
20 71 69
21 200 110
22 120 150
1
1 22
0
 4
1 -1 0
2 30 0
3 60 40
4 0 60
2
1 3
1 4
22
1 0 0
2 150 40
3 30 2
4 180 150
5 40 80
6 130 130
7 72 28
8 172 202
9 50 50
10 160 82
11 90 105
12 144 131
13 130 64
14 80 140
15 38 117
16 190 90
17 109 100
18 110 70
19 130 100
20 71 69
21 200 110
22 120 150
1
1 22
0
 4
1 -1 0
2 30 0
3 60 40
4 0 60
2
1 3
1 4
22
1 0 0
2 150 40
3 30 2
4 180 150
5 40 80
6 130 130
7 72 28
8 172 202
9 50 50
10 160 82
11 90 105
12 144 131
13 130 64
14 80 140
15 38 117
16 190 90
17 109 100
18 110 70
19 130 100
20 31 69
21 200 110
22 120 150
1
1 22
0

1 2 3
NA
1 3 9 20 11 6 22
 1 2 3
1 2
1 3 9 20 11 6 22
 1 2 3
NA
1 3 9 5 15 22
 NA
NA
1 3 9 5 15 22
 1 2
NA
1 3 9 20 11 6 22
 1 2 3
NA
1 3 9 5 17 14 22
 1 2 3
NA
1 3 9 20 17 6 22
 1 2 3
1 2
1 3 9 20 11 18 22
 1 2 3
NA
1 3 7 20 17 6 22
 1 2 3
NA
1 3 7 9 5 15 14 22

Given the following C code and unoptimized assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
//from PKU1125
#define M 299
double dist[M][M],d;
next[M][M],x[M],y[M];
main(){
	int a,b,k,n,i,j;
	for(;scanf("%d",&n),n;){
		/*initialize*/
		for(i=1;i<=n;i++)scanf("%d",&a),scanf("%d%d",x+a,y+a);
		for(i=1;i<=n;i++)for(j=1;j<=n;next[i][j]=j,j++)
			dist[i][j]=(d=hypot(x[i]-x[j],y[i]-y[j]))<50.1?d:M;

		{/*warshall-floyd*/
			int k,i,j;
			for(k=1;k<=n;k++)
				for(i=1;i<=n;i++)
					for(j=1;j<=n;j++){
						if(dist[i][j]>dist[i][k]+dist[k][j])
							dist[i][j]=dist[i][k]+dist[k][j],next[i][j]=next[i][k];
					}
		}

		{/*query*/
			for(scanf("%d",&k);k;k--){
				scanf("%d%d",&a,&b);
				if(dist[a][b]>=M){puts("NA");continue;}
				for(j=a;j!=b;j=next[j][b])printf("%d ",j);
				printf("%d\n",b);
			}
		}
	}exit(0);
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	dist
	.bss
	.align 32
	.type	dist, @object
	.size	dist, 715208
dist:
	.zero	715208
	.globl	d
	.align 8
	.type	d, @object
	.size	d, 8
d:
	.zero	8
	.globl	next
	.align 32
	.type	next, @object
	.size	next, 357604
next:
	.zero	357604
	.globl	x
	.align 32
	.type	x, @object
	.size	x, 1196
x:
	.zero	1196
	.globl	y
	.align 32
	.type	y, @object
	.size	y, 1196
y:
	.zero	1196
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d%d"
.LC4:
	.string	"NA"
.LC5:
	.string	"%d "
.LC6:
	.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
	subq	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	jmp	.L2
.L27:
	movl	$1, -28(%rbp)
	jmp	.L3
.L4:
	leaq	-44(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	y(%rip), %rax
	addq	%rax, %rdx
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	x(%rip), %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	addl	$1, -28(%rbp)
.L3:
	movl	-32(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jle	.L4
	movl	$1, -28(%rbp)
	jmp	.L5
.L11:
	movl	$1, -24(%rbp)
	jmp	.L6
.L10:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	y(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-24(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	y(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	subl	%edx, %eax
	pxor	%xmm0, %xmm0
	cvtsi2sdl	%eax, %xmm0
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	x(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-24(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	x(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	subl	%edx, %eax
	pxor	%xmm3, %xmm3
	cvtsi2sdl	%eax, %xmm3
	movq	%xmm3, %rax
	movapd	%xmm0, %xmm1
	movq	%rax, %xmm0
	call	hypot@PLT
	movq	%xmm0, %rax
	movq	%rax, d(%rip)
	movsd	d(%rip), %xmm1
	movsd	.LC2(%rip), %xmm0
	comisd	%xmm1, %xmm0
	jbe	.L32
	movsd	d(%rip), %xmm0
	jmp	.L9
.L32:
	movsd	.LC3(%rip), %xmm0
.L9:
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movl	-28(%rbp), %eax
	cltq
	imulq	$299, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	dist(%rip), %rax
	movsd	%xmm0, (%rdx,%rax)
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movl	-28(%rbp), %eax
	cltq
	imulq	$299, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rcx
	leaq	next(%rip), %rdx
	movl	-24(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	addl	$1, -24(%rbp)
.L6:
	movl	-32(%rbp), %eax
	cmpl	%eax, -24(%rbp)
	jle	.L10
	addl	$1, -28(%rbp)
.L5:
	movl	-32(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jle	.L11
	movl	$1, -20(%rbp)
	jmp	.L12
.L19:
	movl	$1, -16(%rbp)
	jmp	.L13
.L18:
	movl	$1, -12(%rbp)
	jmp	.L14
.L17:
	movl	-12(%rbp), %eax
	movslq	%eax, %rdx
	movl	-16(%rbp), %eax
	cltq
	imulq	$299, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	dist(%rip), %rax
	movsd	(%rdx,%rax), %xmm0
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movl	-16(%rbp), %eax
	cltq
	imulq	$299, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	dist(%rip), %rax
	movsd	(%rdx,%rax), %xmm2
	movl	-12(%rbp), %eax
	movslq	%eax, %rdx
	movl	-20(%rbp), %eax
	cltq
	imulq	$299, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	dist(%rip), %rax
	movsd	(%rdx,%rax), %xmm1
	addsd	%xmm2, %xmm1
	comisd	%xmm1, %xmm0
	jbe	.L15
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movl	-16(%rbp), %eax
	cltq
	imulq	$299, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	dist(%rip), %rax
	movsd	(%rdx,%rax), %xmm1
	movl	-12(%rbp), %eax
	movslq	%eax, %rdx
	movl	-20(%rbp), %eax
	cltq
	imulq	$299, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	dist(%rip), %rax
	movsd	(%rdx,%rax), %xmm0
	addsd	%xmm1, %xmm0
	movl	-12(%rbp), %eax
	movslq	%eax, %rdx
	movl	-16(%rbp), %eax
	cltq
	imulq	$299, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	dist(%rip), %rax
	movsd	%xmm0, (%rdx,%rax)
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movl	-16(%rbp), %eax
	cltq
	imulq	$299, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	next(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-12(%rbp), %edx
	movslq	%edx, %rcx
	movl	-16(%rbp), %edx
	movslq	%edx, %rdx
	imulq	$299, %rdx, %rdx
	addq	%rcx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	next(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
.L15:
	addl	$1, -12(%rbp)
.L14:
	movl	-32(%rbp), %eax
	cmpl	%eax, -12(%rbp)
	jle	.L17
	addl	$1, -16(%rbp)
.L13:
	movl	-32(%rbp), %eax
	cmpl	%eax, -16(%rbp)
	jle	.L18
	addl	$1, -20(%rbp)
.L12:
	movl	-32(%rbp), %eax
	cmpl	%eax, -20(%rbp)
	jle	.L19
	leaq	-36(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	jmp	.L20
.L26:
	leaq	-40(%rbp), %rdx
	leaq	-44(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	-44(%rbp), %eax
	movl	-40(%rbp), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$299, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	dist(%rip), %rax
	movsd	(%rdx,%rax), %xmm0
	comisd	.LC3(%rip), %xmm0
	jb	.L33
	leaq	.LC4(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L23
.L33:
	movl	-44(%rbp), %eax
	movl	%eax, -24(%rbp)
	jmp	.L24
.L25:
	movl	-24(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC5(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	movl	-24(%rbp), %eax
	cltq
	imulq	$299, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	next(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -24(%rbp)
.L24:
	movl	-40(%rbp), %eax
	cmpl	%eax, -24(%rbp)
	jne	.L25
	movl	-40(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC6(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L23:
	movl	-36(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -36(%rbp)
.L20:
	movl	-36(%rbp), %eax
	testl	%eax, %eax
	jne	.L26
.L2:
	leaq	-32(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	-32(%rbp), %eax
	testl	%eax, %eax
	jne	.L27
	movl	$0, %edi
	call	exit@PLT
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.section	.rodata
	.align 8
.LC2:
	.long	-858993459
	.long	1078529228
	.align 8
.LC3:
	.long	0
	.long	1081257984
	.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	dist
	.bss
	.align 32
	.type	dist, @object
	.size	dist, 715208
dist:
	.zero	715208
	.globl	d
	.align 8
	.type	d, @object
	.size	d, 8
d:
	.zero	8
	.globl	next
	.align 32
	.type	next, @object
	.size	next, 357604
next:
	.zero	357604
	.globl	x
	.align 32
	.type	x, @object
	.size	x, 1196
x:
	.zero	1196
	.globl	y
	.align 32
	.type	y, @object
	.size	y, 1196
y:
	.zero	1196
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d%d"
.LC4:
	.string	"NA"
.LC5:
	.string	"%d "
.LC6:
	.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
	subq	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	jmp	.L2
.L27:
	movl	$1, -28(%rbp)
	jmp	.L3
.L4:
	leaq	-44(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	y(%rip), %rax
	addq	%rax, %rdx
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	x(%rip), %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	addl	$1, -28(%rbp)
.L3:
	movl	-32(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jle	.L4
	movl	$1, -28(%rbp)
	jmp	.L5
.L11:
	movl	$1, -24(%rbp)
	jmp	.L6
.L10:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	y(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-24(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	y(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	subl	%edx, %eax
	pxor	%xmm0, %xmm0
	cvtsi2sdl	%eax, %xmm0
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	x(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-24(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	x(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	subl	%edx, %eax
	pxor	%xmm3, %xmm3
	cvtsi2sdl	%eax, %xmm3
	movq	%xmm3, %rax
	movapd	%xmm0, %xmm1
	movq	%rax, %xmm0
	call	hypot@PLT
	movq	%xmm0, %rax
	movq	%rax, d(%rip)
	movsd	d(%rip), %xmm1
	movsd	.LC2(%rip), %xmm0
	comisd	%xmm1, %xmm0
	jbe	.L32
	movsd	d(%rip), %xmm0
	jmp	.L9
.L32:
	movsd	.LC3(%rip), %xmm0
.L9:
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movl	-28(%rbp), %eax
	cltq
	imulq	$299, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	dist(%rip), %rax
	movsd	%xmm0, (%rdx,%rax)
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movl	-28(%rbp), %eax
	cltq
	imulq	$299, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rcx
	leaq	next(%rip), %rdx
	movl	-24(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	addl	$1, -24(%rbp)
.L6:
	movl	-32(%rbp), %eax
	cmpl	%eax, -24(%rbp)
	jle	.L10
	addl	$1, -28(%rbp)
.L5:
	movl	-32(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jle	.L11
	movl	$1, -20(%rbp)
	jmp	.L12
.L19:
	movl	$1, -16(%rbp)
	jmp	.L13
.L18:
	movl	$1, -12(%rbp)
	jmp	.L14
.L17:
	movl	-12(%rbp), %eax
	movslq	%eax, %rdx
	movl	-16(%rbp), %eax
	cltq
	imulq	$299, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	dist(%rip), %rax
	movsd	(%rdx,%rax), %xmm0
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movl	-16(%rbp), %eax
	cltq
	imulq	$299, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	dist(%rip), %rax
	movsd	(%rdx,%rax), %xmm2
	movl	-12(%rbp), %eax
	movslq	%eax, %rdx
	movl	-20(%rbp), %eax
	cltq
	imulq	$299, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	dist(%rip), %rax
	movsd	(%rdx,%rax), %xmm1
	addsd	%xmm2, %xmm1
	comisd	%xmm1, %xmm0
	jbe	.L15
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movl	-16(%rbp), %eax
	cltq
	imulq	$299, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	dist(%rip), %rax
	movsd	(%rdx,%rax), %xmm1
	movl	-12(%rbp), %eax
	movslq	%eax, %rdx
	movl	-20(%rbp), %eax
	cltq
	imulq	$299, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	dist(%rip), %rax
	movsd	(%rdx,%rax), %xmm0
	addsd	%xmm1, %xmm0
	movl	-12(%rbp), %eax
	movslq	%eax, %rdx
	movl	-16(%rbp), %eax
	cltq
	imulq	$299, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	dist(%rip), %rax
	movsd	%xmm0, (%rdx,%rax)
	movl	-20(%rbp), %eax
	movslq	%eax, %rdx
	movl	-16(%rbp), %eax
	cltq
	imulq	$299, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	next(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-12(%rbp), %edx
	movslq	%edx, %rcx
	movl	-16(%rbp), %edx
	movslq	%edx, %rdx
	imulq	$299, %rdx, %rdx
	addq	%rcx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	next(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
.L15:
	addl	$1, -12(%rbp)
.L14:
	movl	-32(%rbp), %eax
	cmpl	%eax, -12(%rbp)
	jle	.L17
	addl	$1, -16(%rbp)
.L13:
	movl	-32(%rbp), %eax
	cmpl	%eax, -16(%rbp)
	jle	.L18
	addl	$1, -20(%rbp)
.L12:
	movl	-32(%rbp), %eax
	cmpl	%eax, -20(%rbp)
	jle	.L19
	leaq	-36(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	jmp	.L20
.L26:
	leaq	-40(%rbp), %rdx
	leaq	-44(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	-44(%rbp), %eax
	movl	-40(%rbp), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$299, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	dist(%rip), %rax
	movsd	(%rdx,%rax), %xmm0
	comisd	.LC3(%rip), %xmm0
	jb	.L33
	leaq	.LC4(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L23
.L33:
	movl	-44(%rbp), %eax
	movl	%eax, -24(%rbp)
	jmp	.L24
.L25:
	movl	-24(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC5(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	movl	-24(%rbp), %eax
	cltq
	imulq	$299, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	next(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -24(%rbp)
.L24:
	movl	-40(%rbp), %eax
	cmpl	%eax, -24(%rbp)
	jne	.L25
	movl	-40(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC6(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L23:
	movl	-36(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -36(%rbp)
.L20:
	movl	-36(%rbp), %eax
	testl	%eax, %eax
	jne	.L26
.L2:
	leaq	-32(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	-32(%rbp), %eax
	testl	%eax, %eax
	jne	.L27
	movl	$0, %edi
	call	exit@PLT
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.section	.rodata
	.align 8
.LC2:
	.long	-858993459
	.long	1078529228
	.align 8
.LC3:
	.long	0
	.long	1081257984
	.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:
