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

```c
// Aizu Vol-1 0107: Carry a Cheese
// 2017.8.2

#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>

char *gets(char *);
char buf[100], *p;

int getInt(void)
{
	int n = 0;
	while (isspace(*p)) p++;
	while (isdigit(*p)) n = 10 * n + (*p++ - '0');
	return n;
}

long long min3(long long d1, long long d2, long long d3)
{
	if (d2 < d1) d1 = d2;
	if (d3 < d1) d1 = d3;
	return d1;
}

int main()
{
	long long d, w, h, min, r;
	int i, n;

	while (1) {
		gets(p = buf); d = getInt(), w = getInt(), h = getInt();
		if (!d && !w && !h) break;
		min = min3(d*d + w*w, d*d + h*h, w*w + h*h);
		gets(p = buf); n = getInt();
		for (i = 0; i < n; i++) {
			gets(p = buf); r = getInt(); r = 4 * r * r;
			puts(r > min ? "OK" : "NA");
		}
	}
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	buf
	.bss
	.align 32
	.type	buf, @object
	.size	buf, 100
buf:
	.zero	100
	.globl	p
	.align 8
	.type	p, @object
	.size	p, 8
p:
	.zero	8
	.text
	.globl	getInt
	.type	getInt, @function
getInt:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	$0, -4(%rbp)
	jmp	.L2
.L3:
	movq	p(%rip), %rax
	addq	$1, %rax
	movq	%rax, p(%rip)
.L2:
	call	__ctype_b_loc@PLT
	movq	(%rax), %rdx
	movq	p(%rip), %rax
	movzbl	(%rax), %eax
	movsbq	%al, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	movzwl	(%rax), %eax
	movzwl	%ax, %eax
	andl	$8192, %eax
	testl	%eax, %eax
	jne	.L3
	jmp	.L4
.L5:
	movl	-4(%rbp), %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	movl	%eax, %ecx
	movq	p(%rip), %rax
	leaq	1(%rax), %rdx
	movq	%rdx, p(%rip)
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	subl	$48, %eax
	addl	%ecx, %eax
	movl	%eax, -4(%rbp)
.L4:
	call	__ctype_b_loc@PLT
	movq	(%rax), %rdx
	movq	p(%rip), %rax
	movzbl	(%rax), %eax
	movsbq	%al, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	movzwl	(%rax), %eax
	movzwl	%ax, %eax
	andl	$2048, %eax
	testl	%eax, %eax
	jne	.L5
	movl	-4(%rbp), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	getInt, .-getInt
	.globl	min3
	.type	min3, @function
min3:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	%rdx, -24(%rbp)
	movq	-16(%rbp), %rax
	cmpq	-8(%rbp), %rax
	jge	.L8
	movq	-16(%rbp), %rax
	movq	%rax, -8(%rbp)
.L8:
	movq	-24(%rbp), %rax
	cmpq	-8(%rbp), %rax
	jge	.L9
	movq	-24(%rbp), %rax
	movq	%rax, -8(%rbp)
.L9:
	movq	-8(%rbp), %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	min3, .-min3
	.section	.rodata
.LC0:
	.string	"OK"
.LC1:
	.string	"NA"
	.text
	.globl	main
	.type	main, @function
main:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
.L18:
	leaq	buf(%rip), %rax
	movq	%rax, p(%rip)
	movq	p(%rip), %rax
	movq	%rax, %rdi
	call	gets@PLT
	call	getInt
	cltq
	movq	%rax, -40(%rbp)
	call	getInt
	cltq
	movq	%rax, -32(%rbp)
	call	getInt
	cltq
	movq	%rax, -24(%rbp)
	cmpq	$0, -40(%rbp)
	jne	.L12
	cmpq	$0, -32(%rbp)
	jne	.L12
	cmpq	$0, -24(%rbp)
	je	.L21
.L12:
	movq	-32(%rbp), %rax
	imulq	%rax, %rax
	movq	%rax, %rdx
	movq	-24(%rbp), %rax
	imulq	%rax, %rax
	addq	%rax, %rdx
	movq	-40(%rbp), %rax
	imulq	%rax, %rax
	movq	%rax, %rcx
	movq	-24(%rbp), %rax
	imulq	%rax, %rax
	addq	%rax, %rcx
	movq	-40(%rbp), %rax
	imulq	%rax, %rax
	movq	%rax, %rsi
	movq	-32(%rbp), %rax
	imulq	%rax, %rax
	addq	%rsi, %rax
	movq	%rcx, %rsi
	movq	%rax, %rdi
	call	min3
	movq	%rax, -16(%rbp)
	leaq	buf(%rip), %rax
	movq	%rax, p(%rip)
	movq	p(%rip), %rax
	movq	%rax, %rdi
	call	gets@PLT
	call	getInt
	movl	%eax, -44(%rbp)
	movl	$0, -48(%rbp)
	jmp	.L14
.L17:
	leaq	buf(%rip), %rax
	movq	%rax, p(%rip)
	movq	p(%rip), %rax
	movq	%rax, %rdi
	call	gets@PLT
	call	getInt
	cltq
	movq	%rax, -8(%rbp)
	movq	-8(%rbp), %rax
	imulq	%rax, %rax
	salq	$2, %rax
	movq	%rax, -8(%rbp)
	movq	-8(%rbp), %rax
	cmpq	-16(%rbp), %rax
	jle	.L15
	leaq	.LC0(%rip), %rax
	jmp	.L16
.L15:
	leaq	.LC1(%rip), %rax
.L16:
	movq	%rax, %rdi
	call	puts@PLT
	addl	$1, -48(%rbp)
.L14:
	movl	-48(%rbp), %eax
	cmpl	-44(%rbp), %eax
	jl	.L17
	jmp	.L18
.L21:
	nop
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
user
	.file	"temp.c"
	.text
	.p2align 4
	.globl	getInt
	.type	getInt, @function
getInt:
.LFB41:
	.cfi_startproc
	endbr64
	subq	$8, %rsp
	.cfi_def_cfa_offset 16
	call	__ctype_b_loc@PLT
	movq	(%rax), %rsi
	movq	p(%rip), %rax
	movsbq	(%rax), %rdx
	movzwl	(%rsi,%rdx,2), %ecx
	testb	$32, %ch
	je	.L2
	leaq	1(%rax), %rdx
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%rdx, p(%rip)
	movsbq	(%rdx), %rcx
	movq	%rdx, %rax
	addq	$1, %rdx
	movzwl	(%rsi,%rcx,2), %ecx
	testb	$32, %ch
	jne	.L3
.L2:
	andb	$8, %ch
	je	.L6
	addq	$1, %rax
	xorl	%r8d, %r8d
	.p2align 4,,10
	.p2align 3
.L5:
	movq	%rax, %rdx
	movq	%rax, p(%rip)
	movsbl	-1(%rax), %ecx
	leal	(%r8,%r8,4), %edi
	movsbq	(%rdx), %rdx
	addq	$1, %rax
	leal	-48(%rcx,%rdi,2), %r8d
	testb	$8, 1(%rsi,%rdx,2)
	jne	.L5
	movl	%r8d, %eax
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L6:
	.cfi_restore_state
	xorl	%r8d, %r8d
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
	movl	%r8d, %eax
	ret
	.cfi_endproc
.LFE41:
	.size	getInt, .-getInt
	.p2align 4
	.globl	min3
	.type	min3, @function
min3:
.LFB42:
	.cfi_startproc
	endbr64
	cmpq	%rdx, %rdi
	movq	%rsi, %rax
	cmovg	%rdx, %rdi
	cmpq	%rsi, %rdi
	cmovle	%rdi, %rax
	ret
	.cfi_endproc
.LFE42:
	.size	min3, .-min3
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"OK"
.LC1:
	.string	"NA"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB43:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	.LC1(%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
	leaq	buf(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$8, %rsp
	.cfi_def_cfa_offset 64
	call	__ctype_b_loc@PLT
	movq	%rax, %r13
	.p2align 4,,10
	.p2align 3
.L30:
	movq	%rbp, %rdi
	movq	%rbp, p(%rip)
	call	gets@PLT
	movq	p(%rip), %rax
	movq	0(%r13), %rdx
	movsbq	(%rax), %rcx
	movzwl	(%rdx,%rcx,2), %esi
	testw	$8192, %si
	je	.L16
	leaq	1(%rax), %rcx
	.p2align 4,,10
	.p2align 3
.L17:
	movq	%rcx, p(%rip)
	movsbq	(%rcx), %rsi
	movq	%rcx, %rax
	addq	$1, %rcx
	movzwl	(%rdx,%rsi,2), %esi
	testw	$8192, %si
	jne	.L17
.L16:
	testw	$2048, %si
	je	.L50
	addq	$1, %rax
	xorl	%esi, %esi
	.p2align 4,,10
	.p2align 3
.L19:
	movq	%rax, p(%rip)
	leal	(%rsi,%rsi,4), %edi
	movsbl	-1(%rax), %esi
	addq	$1, %rax
	leal	-48(%rsi,%rdi,2), %esi
	movsbq	-1(%rax), %rdi
	movzwl	(%rdx,%rdi,2), %r8d
	testw	$2048, %r8w
	jne	.L19
	movslq	%esi, %rdi
	testw	$8192, %r8w
	je	.L20
	movq	%rax, %rcx
	.p2align 4,,10
	.p2align 3
.L21:
	movq	%rcx, p(%rip)
	movsbq	(%rcx), %r8
	addq	$1, %rcx
	movzwl	(%rdx,%r8,2), %r8d
	testw	$8192, %r8w
	jne	.L21
	testw	$2048, %r8w
	je	.L20
	movq	%rcx, %rax
	xorl	%r8d, %r8d
	.p2align 4,,10
	.p2align 3
.L22:
	movq	%rax, p(%rip)
	leal	(%r8,%r8,4), %r9d
	movsbl	-1(%rax), %r8d
	addq	$1, %rax
	leal	-48(%r8,%r9,2), %r8d
	movsbq	-1(%rax), %r9
	movzwl	(%rdx,%r9,2), %r10d
	testw	$2048, %r10w
	jne	.L22
	movslq	%r8d, %r9
	orl	%r8d, %esi
	testw	$8192, %r10w
	je	.L40
	movq	%rax, %rcx
	.p2align 4,,10
	.p2align 3
.L24:
	movq	%rcx, p(%rip)
	movsbq	(%rcx), %r8
	addq	$1, %rcx
	movzwl	(%rdx,%r8,2), %r8d
	testw	$8192, %r8w
	jne	.L24
	testw	$2048, %r8w
	je	.L40
	movq	%rcx, %rax
	xorl	%ecx, %ecx
	.p2align 4,,10
	.p2align 3
.L26:
	movq	%rax, %r8
	movq	%rax, p(%rip)
	leal	(%rcx,%rcx,4), %r10d
	movsbl	-1(%rax), %ecx
	movsbq	(%r8), %r8
	addq	$1, %rax
	leal	-48(%rcx,%r10,2), %ecx
	testb	$8, 1(%rdx,%r8,2)
	jne	.L26
	movslq	%ecx, %rax
	orl	%ecx, %esi
.L25:
	testl	%esi, %esi
	je	.L50
	imulq	%r9, %r9
	movq	%rbp, p(%rip)
	imulq	%rdi, %rdi
	imulq	%rax, %rax
	leaq	(%r9,%rax), %r12
	addq	%rdi, %rax
	cmpq	%rax, %r12
	cmovg	%rax, %r12
	leaq	(%r9,%rdi), %rax
	movq	%rbp, %rdi
	cmpq	%rax, %r12
	cmovg	%rax, %r12
	call	gets@PLT
	movq	p(%rip), %rax
	movq	0(%r13), %rdi
	movsbq	(%rax), %rdx
	movzwl	(%rdi,%rdx,2), %esi
	testw	$8192, %si
	je	.L27
	leaq	1(%rax), %rdx
	.p2align 4,,10
	.p2align 3
.L28:
	movq	%rdx, p(%rip)
	movsbq	(%rdx), %rcx
	movq	%rdx, %rax
	addq	$1, %rdx
	movzwl	(%rdi,%rcx,2), %esi
	testw	$8192, %si
	jne	.L28
.L27:
	addq	$1, %rax
	xorl	%r14d, %r14d
	testw	$2048, %si
	je	.L30
	.p2align 4,,10
	.p2align 3
.L31:
	movq	%rax, %rdx
	movq	%rax, p(%rip)
	movsbl	-1(%rax), %ecx
	leal	(%r14,%r14,4), %esi
	movsbq	(%rdx), %rdx
	addq	$1, %rax
	leal	-48(%rcx,%rsi,2), %r14d
	testb	$8, 1(%rdi,%rdx,2)
	jne	.L31
	testl	%r14d, %r14d
	jle	.L30
	xorl	%ebx, %ebx
	.p2align 4,,10
	.p2align 3
.L39:
	movq	%rbp, %rdi
	movq	%rbp, p(%rip)
	call	gets@PLT
	movq	p(%rip), %rax
	movq	0(%r13), %rdi
	movsbq	(%rax), %rdx
	movzwl	(%rdi,%rdx,2), %esi
	testw	$8192, %si
	je	.L33
	leaq	1(%rax), %rdx
	.p2align 4,,10
	.p2align 3
.L34:
	movq	%rdx, p(%rip)
	movsbq	(%rdx), %rsi
	movq	%rdx, %rax
	addq	$1, %rdx
	movzwl	(%rdi,%rsi,2), %esi
	testw	$8192, %si
	jne	.L34
.L33:
	testw	$2048, %si
	je	.L41
	addq	$1, %rax
	xorl	%edx, %edx
	.p2align 4,,10
	.p2align 3
.L36:
	movq	%rax, %rsi
	movq	%rax, p(%rip)
	leal	(%rdx,%rdx,4), %r8d
	movsbl	-1(%rax), %edx
	movsbq	(%rsi), %rsi
	addq	$1, %rax
	leal	-48(%rdx,%r8,2), %edx
	testb	$8, 1(%rdi,%rsi,2)
	jne	.L36
	movslq	%edx, %rdx
	imulq	%rdx, %rdx
	salq	$2, %rdx
.L35:
	cmpq	%rdx, %r12
	jge	.L37
	leaq	.LC0(%rip), %rdi
	addl	$1, %ebx
	call	puts@PLT
	cmpl	%ebx, %r14d
	jne	.L39
	jmp	.L30
	.p2align 4,,10
	.p2align 3
.L37:
	movq	%r15, %rdi
	addl	$1, %ebx
	call	puts@PLT
	cmpl	%r14d, %ebx
	jne	.L39
	jmp	.L30
	.p2align 4,,10
	.p2align 3
.L41:
	xorl	%edx, %edx
	jmp	.L35
.L50:
	addq	$8, %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
.L20:
	.cfi_restore_state
	xorl	%r9d, %r9d
.L40:
	xorl	%eax, %eax
	jmp	.L25
	.cfi_endproc
.LFE43:
	.size	main, .-main
	.globl	p
	.bss
	.align 8
	.type	p, @object
	.size	p, 8
p:
	.zero	8
	.globl	buf
	.align 32
	.type	buf, @object
	.size	buf, 100
buf:
	.zero	100
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

rule
	.file	"temp.c"
	.text
	.p2align 4
	.globl	getInt
	.type	getInt, @function
getInt:
.LFB41:
	.cfi_startproc
	endbr64
	subq	$8, %rsp
	.cfi_def_cfa_offset 16
	call	__ctype_b_loc@PLT
	movq	(%rax), %rsi
	movq	p(%rip), %rax
	movsbq	(%rax), %rdx
	movzwl	(%rsi,%rdx,2), %ecx
	testb	$32, %ch
	je	.L2
	leaq	1(%rax), %rdx
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%rdx, p(%rip)
	movsbq	(%rdx), %rcx
	movq	%rdx, %rax
	addq	$1, %rdx
	movzwl	(%rsi,%rcx,2), %ecx
	testb	$32, %ch
	jne	.L3
.L2:
	andb	$8, %ch
	je	.L6
	addq	$1, %rax
	xorl	%r8d, %r8d
	.p2align 4,,10
	.p2align 3
.L5:
	movq	%rax, %rdx
	movq	%rax, p(%rip)
	movsbl	-1(%rax), %ecx
	leal	(%r8,%r8,4), %edi
	movsbq	(%rdx), %rdx
	addq	$1, %rax
	leal	-48(%rcx,%rdi,2), %r8d
	testb	$8, 1(%rsi,%rdx,2)
	jne	.L5
	movl	%r8d, %eax
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L6:
	.cfi_restore_state
	xorl	%r8d, %r8d
	addq	$8, %rsp
	.cfi_def_cfa_offset 8
	movl	%r8d, %eax
	ret
	.cfi_endproc
.LFE41:
	.size	getInt, .-getInt
	.p2align 4
	.globl	min3
	.type	min3, @function
min3:
.LFB42:
	.cfi_startproc
	endbr64
	cmpq	%rdx, %rdi
	movq	%rsi, %rax
	cmovg	%rdx, %rdi
	cmpq	%rsi, %rdi
	cmovle	%rdi, %rax
	ret
	.cfi_endproc
.LFE42:
	.size	min3, .-min3
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"OK"
.LC1:
	.string	"NA"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB43:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	.LC1(%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
	leaq	buf(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$8, %rsp
	.cfi_def_cfa_offset 64
	call	__ctype_b_loc@PLT
	movq	%rax, %r13
	.p2align 4,,10
	.p2align 3
.L30:
	movq	%rbp, %rdi
	movq	%rbp, p(%rip)
	call	gets@PLT
	movq	p(%rip), %rax
	movq	0(%r13), %rdx
	movsbq	(%rax), %rcx
	movzwl	(%rdx,%rcx,2), %esi
	testw	$8192, %si
	je	.L16
	leaq	1(%rax), %rcx
	.p2align 4,,10
	.p2align 3
.L17:
	movq	%rcx, p(%rip)
	movsbq	(%rcx), %rsi
	movq	%rcx, %rax
	addq	$1, %rcx
	movzwl	(%rdx,%rsi,2), %esi
	testw	$8192, %si
	jne	.L17
.L16:
	testw	$2048, %si
	je	.L50
	addq	$1, %rax
	xorl	%esi, %esi
	.p2align 4,,10
	.p2align 3
.L19:
	movq	%rax, p(%rip)
	leal	(%rsi,%rsi,4), %edi
	movsbl	-1(%rax), %esi
	addq	$1, %rax
	leal	-48(%rsi,%rdi,2), %esi
	movsbq	-1(%rax), %rdi
	movzwl	(%rdx,%rdi,2), %r8d
	testw	$2048, %r8w
	jne	.L19
	movslq	%esi, %rdi
	testw	$8192, %r8w
	je	.L20
	movq	%rax, %rcx
	.p2align 4,,10
	.p2align 3
.L21:
	movq	%rcx, p(%rip)
	movsbq	(%rcx), %r8
	addq	$1, %rcx
	movzwl	(%rdx,%r8,2), %r8d
	testw	$8192, %r8w
	jne	.L21
	testw	$2048, %r8w
	je	.L20
	movq	%rcx, %rax
	xorl	%r8d, %r8d
	.p2align 4,,10
	.p2align 3
.L22:
	movq	%rax, p(%rip)
	leal	(%r8,%r8,4), %r9d
	movsbl	-1(%rax), %r8d
	addq	$1, %rax
	leal	-48(%r8,%r9,2), %r8d
	movsbq	-1(%rax), %r9
	movzwl	(%rdx,%r9,2), %r10d
	testw	$2048, %r10w
	jne	.L22
	movslq	%r8d, %r9
	orl	%r8d, %esi
	testw	$8192, %r10w
	je	.L40
	movq	%rax, %rcx
	.p2align 4,,10
	.p2align 3
.L24:
	movq	%rcx, p(%rip)
	movsbq	(%rcx), %r8
	addq	$1, %rcx
	movzwl	(%rdx,%r8,2), %r8d
	testw	$8192, %r8w
	jne	.L24
	testw	$2048, %r8w
	je	.L40
	movq	%rcx, %rax
	xorl	%ecx, %ecx
	.p2align 4,,10
	.p2align 3
.L26:
	movq	%rax, %r8
	movq	%rax, p(%rip)
	leal	(%rcx,%rcx,4), %r10d
	movsbl	-1(%rax), %ecx
	movsbq	(%r8), %r8
	addq	$1, %rax
	leal	-48(%rcx,%r10,2), %ecx
	testb	$8, 1(%rdx,%r8,2)
	jne	.L26
	movslq	%ecx, %rax
	orl	%ecx, %esi
.L25:
	testl	%esi, %esi
	je	.L50
	imulq	%r9, %r9
	movq	%rbp, p(%rip)
	imulq	%rdi, %rdi
	imulq	%rax, %rax
	leaq	(%r9,%rax), %r12
	addq	%rdi, %rax
	cmpq	%rax, %r12
	cmovg	%rax, %r12
	leaq	(%r9,%rdi), %rax
	movq	%rbp, %rdi
	cmpq	%rax, %r12
	cmovg	%rax, %r12
	call	gets@PLT
	movq	p(%rip), %rax
	movq	0(%r13), %rdi
	movsbq	(%rax), %rdx
	movzwl	(%rdi,%rdx,2), %esi
	testw	$8192, %si
	je	.L27
	leaq	1(%rax), %rdx
	.p2align 4,,10
	.p2align 3
.L28:
	movq	%rdx, p(%rip)
	movsbq	(%rdx), %rcx
	movq	%rdx, %rax
	addq	$1, %rdx
	movzwl	(%rdi,%rcx,2), %esi
	testw	$8192, %si
	jne	.L28
.L27:
	addq	$1, %rax
	xorl	%r14d, %r14d
	testw	$2048, %si
	je	.L30
	.p2align 4,,10
	.p2align 3
.L31:
	movq	%rax, %rdx
	movq	%rax, p(%rip)
	movsbl	-1(%rax), %ecx
	leal	(%r14,%r14,4), %esi
	movsbq	(%rdx), %rdx
	addq	$1, %rax
	leal	-48(%rcx,%rsi,2), %r14d
	testb	$8, 1(%rdi,%rdx,2)
	jne	.L31
	testl	%r14d, %r14d
	jle	.L30
	xorl	%ebx, %ebx
	.p2align 4,,10
	.p2align 3
.L39:
	movq	%rbp, %rdi
	movq	%rbp, p(%rip)
	call	gets@PLT
	movq	p(%rip), %rax
	movq	0(%r13), %rdi
	movsbq	(%rax), %rdx
	movzwl	(%rdi,%rdx,2), %esi
	testw	$8192, %si
	je	.L33
	leaq	1(%rax), %rdx
	.p2align 4,,10
	.p2align 3
.L34:
	movq	%rdx, p(%rip)
	movsbq	(%rdx), %rsi
	movq	%rdx, %rax
	addq	$1, %rdx
	movzwl	(%rdi,%rsi,2), %esi
	testw	$8192, %si
	jne	.L34
.L33:
	testw	$2048, %si
	je	.L41
	addq	$1, %rax
	xorl	%edx, %edx
	.p2align 4,,10
	.p2align 3
.L36:
	movq	%rax, %rsi
	movq	%rax, p(%rip)
	leal	(%rdx,%rdx,4), %r8d
	movsbl	-1(%rax), %edx
	movsbq	(%rsi), %rsi
	addq	$1, %rax
	leal	-48(%rdx,%r8,2), %edx
	testb	$8, 1(%rdi,%rsi,2)
	jne	.L36
	movslq	%edx, %rdx
	imulq	%rdx, %rdx
	salq	$2, %rdx
.L35:
	cmpq	%rdx, %r12
	jge	.L37
	leaq	.LC0(%rip), %rdi
	addl	$1, %ebx
	call	puts@PLT
	cmpl	%ebx, %r14d
	jne	.L39
	jmp	.L30
	.p2align 4,,10
	.p2align 3
.L37:
	movq	%r15, %rdi
	addl	$1, %ebx
	call	puts@PLT
	cmpl	%r14d, %ebx
	jne	.L39
	jmp	.L30
	.p2align 4,,10
	.p2align 3
.L41:
	xorl	%edx, %edx
	jmp	.L35
.L50:
	addq	$8, %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
.L20:
	.cfi_restore_state
	xorl	%r9d, %r9d
.L40:
	xorl	%eax, %eax
	jmp	.L25
	.cfi_endproc
.LFE43:
	.size	main, .-main
	.globl	p
	.bss
	.align 8
	.type	p, @object
	.size	p, 8
p:
	.zero	8
	.globl	buf
	.align 32
	.type	buf, @object
	.size	buf, 100
buf:
	.zero	100
	.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:

// Aizu Vol-1 0107: Carry a Cheese
// 2017.8.2

#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>

char *gets(char *);
char buf[100], *p;

int getInt(void)
{
	int n = 0;
	while (isspace(*p)) p++;
	while (isdigit(*p)) n = 10 * n + (*p++ - '0');
	return n;
}

long long min3(long long d1, long long d2, long long d3)
{
	if (d2 < d1) d1 = d2;
	if (d3 < d1) d1 = d3;
	return d1;
}

int main()
{
	long long d, w, h, min, r;
	int i, n;

	while (1) {
		gets(p = buf); d = getInt(), w = getInt(), h = getInt();
		if (!d && !w && !h) break;
		min = min3(d*d + w*w, d*d + h*h, w*w + h*h);
		gets(p = buf); n = getInt();
		for (i = 0; i < n; i++) {
			gets(p = buf); r = getInt(); r = 4 * r * r;
			puts(r > min ? "OK" : "NA");
		}
	}
	return 0;
}
10 6 8
5
4
1
6
2
5
0 0 0
 10 6 8
5
4
0
0
2
5
0 0 0
 10 6 8
5
4
0
0
2
7
0 0 0
 10 6 8
5
1
8
6
2
5
0 0 0
 10 6 4
5
4
0
-1
2
7
0 0 0
 10 6 4
5
4
0
-1
4
7
0 0 0
 10 3 8
5
4
0
6
2
5
0 0 0
 10 6 8
5
1
8
3
2
5
0 0 0
 10 2 8
5
1
8
11
2
5
0 0 0
 10 6 7
5
4
1
-2
8
7
0 0 0

NA
NA
OK
NA
NA
 NA
NA
NA
NA
NA
 NA
NA
NA
NA
OK
 NA
OK
OK
NA
NA
 OK
NA
NA
NA
OK
 OK
NA
NA
OK
OK
 NA
NA
OK
NA
OK
 NA
OK
NA
NA
NA
 NA
OK
OK
NA
OK
 NA
NA
NA
OK
OK

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

```c
// Aizu Vol-1 0107: Carry a Cheese
// 2017.8.2

#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>

char *gets(char *);
char buf[100], *p;

int getInt(void)
{
	int n = 0;
	while (isspace(*p)) p++;
	while (isdigit(*p)) n = 10 * n + (*p++ - '0');
	return n;
}

long long min3(long long d1, long long d2, long long d3)
{
	if (d2 < d1) d1 = d2;
	if (d3 < d1) d1 = d3;
	return d1;
}

int main()
{
	long long d, w, h, min, r;
	int i, n;

	while (1) {
		gets(p = buf); d = getInt(), w = getInt(), h = getInt();
		if (!d && !w && !h) break;
		min = min3(d*d + w*w, d*d + h*h, w*w + h*h);
		gets(p = buf); n = getInt();
		for (i = 0; i < n; i++) {
			gets(p = buf); r = getInt(); r = 4 * r * r;
			puts(r > min ? "OK" : "NA");
		}
	}
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	buf
	.bss
	.align 32
	.type	buf, @object
	.size	buf, 100
buf:
	.zero	100
	.globl	p
	.align 8
	.type	p, @object
	.size	p, 8
p:
	.zero	8
	.text
	.globl	getInt
	.type	getInt, @function
getInt:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	$0, -4(%rbp)
	jmp	.L2
.L3:
	movq	p(%rip), %rax
	addq	$1, %rax
	movq	%rax, p(%rip)
.L2:
	call	__ctype_b_loc@PLT
	movq	(%rax), %rdx
	movq	p(%rip), %rax
	movzbl	(%rax), %eax
	movsbq	%al, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	movzwl	(%rax), %eax
	movzwl	%ax, %eax
	andl	$8192, %eax
	testl	%eax, %eax
	jne	.L3
	jmp	.L4
.L5:
	movl	-4(%rbp), %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	movl	%eax, %ecx
	movq	p(%rip), %rax
	leaq	1(%rax), %rdx
	movq	%rdx, p(%rip)
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	subl	$48, %eax
	addl	%ecx, %eax
	movl	%eax, -4(%rbp)
.L4:
	call	__ctype_b_loc@PLT
	movq	(%rax), %rdx
	movq	p(%rip), %rax
	movzbl	(%rax), %eax
	movsbq	%al, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	movzwl	(%rax), %eax
	movzwl	%ax, %eax
	andl	$2048, %eax
	testl	%eax, %eax
	jne	.L5
	movl	-4(%rbp), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	getInt, .-getInt
	.globl	min3
	.type	min3, @function
min3:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	%rdx, -24(%rbp)
	movq	-16(%rbp), %rax
	cmpq	-8(%rbp), %rax
	jge	.L8
	movq	-16(%rbp), %rax
	movq	%rax, -8(%rbp)
.L8:
	movq	-24(%rbp), %rax
	cmpq	-8(%rbp), %rax
	jge	.L9
	movq	-24(%rbp), %rax
	movq	%rax, -8(%rbp)
.L9:
	movq	-8(%rbp), %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	min3, .-min3
	.section	.rodata
.LC0:
	.string	"OK"
.LC1:
	.string	"NA"
	.text
	.globl	main
	.type	main, @function
main:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
.L18:
	leaq	buf(%rip), %rax
	movq	%rax, p(%rip)
	movq	p(%rip), %rax
	movq	%rax, %rdi
	call	gets@PLT
	call	getInt
	cltq
	movq	%rax, -40(%rbp)
	call	getInt
	cltq
	movq	%rax, -32(%rbp)
	call	getInt
	cltq
	movq	%rax, -24(%rbp)
	cmpq	$0, -40(%rbp)
	jne	.L12
	cmpq	$0, -32(%rbp)
	jne	.L12
	cmpq	$0, -24(%rbp)
	je	.L21
.L12:
	movq	-32(%rbp), %rax
	imulq	%rax, %rax
	movq	%rax, %rdx
	movq	-24(%rbp), %rax
	imulq	%rax, %rax
	addq	%rax, %rdx
	movq	-40(%rbp), %rax
	imulq	%rax, %rax
	movq	%rax, %rcx
	movq	-24(%rbp), %rax
	imulq	%rax, %rax
	addq	%rax, %rcx
	movq	-40(%rbp), %rax
	imulq	%rax, %rax
	movq	%rax, %rsi
	movq	-32(%rbp), %rax
	imulq	%rax, %rax
	addq	%rsi, %rax
	movq	%rcx, %rsi
	movq	%rax, %rdi
	call	min3
	movq	%rax, -16(%rbp)
	leaq	buf(%rip), %rax
	movq	%rax, p(%rip)
	movq	p(%rip), %rax
	movq	%rax, %rdi
	call	gets@PLT
	call	getInt
	movl	%eax, -44(%rbp)
	movl	$0, -48(%rbp)
	jmp	.L14
.L17:
	leaq	buf(%rip), %rax
	movq	%rax, p(%rip)
	movq	p(%rip), %rax
	movq	%rax, %rdi
	call	gets@PLT
	call	getInt
	cltq
	movq	%rax, -8(%rbp)
	movq	-8(%rbp), %rax
	imulq	%rax, %rax
	salq	$2, %rax
	movq	%rax, -8(%rbp)
	movq	-8(%rbp), %rax
	cmpq	-16(%rbp), %rax
	jle	.L15
	leaq	.LC0(%rip), %rax
	jmp	.L16
.L15:
	leaq	.LC1(%rip), %rax
.L16:
	movq	%rax, %rdi
	call	puts@PLT
	addl	$1, -48(%rbp)
.L14:
	movl	-48(%rbp), %eax
	cmpl	-44(%rbp), %eax
	jl	.L17
	jmp	.L18
.L21:
	nop
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
train
	.file	"temp.c"
	.text
	.globl	buf
	.bss
	.align 32
	.type	buf, @object
	.size	buf, 100
buf:
	.zero	100
	.globl	p
	.align 8
	.type	p, @object
	.size	p, 8
p:
	.zero	8
	.text
	.globl	getInt
	.type	getInt, @function
getInt:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	$0, -4(%rbp)
	jmp	.L2
.L3:
	movq	p(%rip), %rax
	addq	$1, %rax
	movq	%rax, p(%rip)
.L2:
	call	__ctype_b_loc@PLT
	movq	(%rax), %rdx
	movq	p(%rip), %rax
	movzbl	(%rax), %eax
	movsbq	%al, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	movzwl	(%rax), %eax
	movzwl	%ax, %eax
	andl	$8192, %eax
	testl	%eax, %eax
	jne	.L3
	jmp	.L4
.L5:
	movl	-4(%rbp), %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	movl	%eax, %ecx
	movq	p(%rip), %rax
	leaq	1(%rax), %rdx
	movq	%rdx, p(%rip)
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	subl	$48, %eax
	addl	%ecx, %eax
	movl	%eax, -4(%rbp)
.L4:
	call	__ctype_b_loc@PLT
	movq	(%rax), %rdx
	movq	p(%rip), %rax
	movzbl	(%rax), %eax
	movsbq	%al, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	movzwl	(%rax), %eax
	movzwl	%ax, %eax
	andl	$2048, %eax
	testl	%eax, %eax
	jne	.L5
	movl	-4(%rbp), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	getInt, .-getInt
	.globl	min3
	.type	min3, @function
min3:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	%rdx, -24(%rbp)
	movq	-16(%rbp), %rax
	cmpq	-8(%rbp), %rax
	jge	.L8
	movq	-16(%rbp), %rax
	movq	%rax, -8(%rbp)
.L8:
	movq	-24(%rbp), %rax
	cmpq	-8(%rbp), %rax
	jge	.L9
	movq	-24(%rbp), %rax
	movq	%rax, -8(%rbp)
.L9:
	movq	-8(%rbp), %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	min3, .-min3
	.section	.rodata
.LC0:
	.string	"OK"
.LC1:
	.string	"NA"
	.text
	.globl	main
	.type	main, @function
main:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
.L18:
	leaq	buf(%rip), %rax
	movq	%rax, p(%rip)
	movq	p(%rip), %rax
	movq	%rax, %rdi
	call	gets@PLT
	call	getInt
	cltq
	movq	%rax, -40(%rbp)
	call	getInt
	cltq
	movq	%rax, -32(%rbp)
	call	getInt
	cltq
	movq	%rax, -24(%rbp)
	cmpq	$0, -40(%rbp)
	jne	.L12
	cmpq	$0, -32(%rbp)
	jne	.L12
	cmpq	$0, -24(%rbp)
	je	.L21
.L12:
	movq	-32(%rbp), %rax
	imulq	%rax, %rax
	movq	%rax, %rdx
	movq	-24(%rbp), %rax
	imulq	%rax, %rax
	addq	%rax, %rdx
	movq	-40(%rbp), %rax
	imulq	%rax, %rax
	movq	%rax, %rcx
	movq	-24(%rbp), %rax
	imulq	%rax, %rax
	addq	%rax, %rcx
	movq	-40(%rbp), %rax
	imulq	%rax, %rax
	movq	%rax, %rsi
	movq	-32(%rbp), %rax
	imulq	%rax, %rax
	addq	%rsi, %rax
	movq	%rcx, %rsi
	movq	%rax, %rdi
	call	min3
	movq	%rax, -16(%rbp)
	leaq	buf(%rip), %rax
	movq	%rax, p(%rip)
	movq	p(%rip), %rax
	movq	%rax, %rdi
	call	gets@PLT
	call	getInt
	movl	%eax, -44(%rbp)
	movl	$0, -48(%rbp)
	jmp	.L14
.L17:
	leaq	buf(%rip), %rax
	movq	%rax, p(%rip)
	movq	p(%rip), %rax
	movq	%rax, %rdi
	call	gets@PLT
	call	getInt
	cltq
	movq	%rax, -8(%rbp)
	movq	-8(%rbp), %rax
	imulq	%rax, %rax
	salq	$2, %rax
	movq	%rax, -8(%rbp)
	movq	-8(%rbp), %rax
	cmpq	-16(%rbp), %rax
	jle	.L15
	leaq	.LC0(%rip), %rax
	jmp	.L16
.L15:
	leaq	.LC1(%rip), %rax
.L16:
	movq	%rax, %rdi
	call	puts@PLT
	addl	$1, -48(%rbp)
.L14:
	movl	-48(%rbp), %eax
	cmpl	-44(%rbp), %eax
	jl	.L17
	jmp	.L18
.L21:
	nop
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.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:
