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>

int main(void)
{
	int sweets;
	int info[1000][4] = {0};
	int limit[4];
	int cal, ok;
	int i;
	
	while(1){
		ok = 0;
		
		scanf("%d", &sweets);
		if(sweets == 0)    break;
		for(i = 0; i < sweets; i++){
			scanf("%d %d %d %d", &info[i][0], &info[i][1], &info[i][2], &info[i][3]);
		}
		scanf("%d %d %d %d", &limit[0], &limit[1], &limit[2], &limit[3]);
		
		for(i = 0; i < sweets; i++){
			cal = (info[i][1] * 4) + (info[i][2] * 9) + (info[i][3] * 4);
			
			if (info[i][1] <= limit[0] && info[i][2] <= limit[1] &&
				info[i][3] <= limit[2] && cal <= limit[3]){
				printf("%d\n", info[i][0]);
				ok++;
				}
		}
		if(ok == 0)    printf("NA\n");
	}
	
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d %d %d %d"
.LC2:
	.string	"%d\n"
.LC3:
	.string	"NA"
	.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	$4096, %rsp
	orq	$0, (%rsp)
	subq	$4096, %rsp
	orq	$0, (%rsp)
	subq	$4096, %rsp
	orq	$0, (%rsp)
	subq	$3760, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-16016(%rbp), %rax
	movl	$16000, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
.L10:
	movl	$0, -16044(%rbp)
	leaq	-16048(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-16048(%rbp), %eax
	testl	%eax, %eax
	je	.L14
	movl	$0, -16040(%rbp)
	jmp	.L4
.L5:
	leaq	-16016(%rbp), %rdx
	movl	-16040(%rbp), %eax
	cltq
	salq	$4, %rax
	addq	$12, %rax
	leaq	(%rdx,%rax), %rsi
	leaq	-16016(%rbp), %rdx
	movl	-16040(%rbp), %eax
	cltq
	salq	$4, %rax
	addq	$8, %rax
	leaq	(%rdx,%rax), %rcx
	leaq	-16016(%rbp), %rdx
	movl	-16040(%rbp), %eax
	cltq
	salq	$4, %rax
	addq	$4, %rax
	addq	%rax, %rdx
	leaq	-16016(%rbp), %rdi
	movl	-16040(%rbp), %eax
	cltq
	salq	$4, %rax
	addq	%rdi, %rax
	movq	%rsi, %r8
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -16040(%rbp)
.L4:
	movl	-16048(%rbp), %eax
	cmpl	%eax, -16040(%rbp)
	jl	.L5
	leaq	-16032(%rbp), %rax
	leaq	12(%rax), %rsi
	leaq	-16032(%rbp), %rax
	leaq	8(%rax), %rcx
	leaq	-16032(%rbp), %rax
	leaq	4(%rax), %rdx
	leaq	-16032(%rbp), %rax
	movq	%rsi, %r8
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -16040(%rbp)
	jmp	.L6
.L8:
	movl	-16040(%rbp), %eax
	cltq
	salq	$4, %rax
	addq	%rbp, %rax
	subq	$16012, %rax
	movl	(%rax), %eax
	leal	0(,%rax,4), %ecx
	movl	-16040(%rbp), %eax
	cltq
	salq	$4, %rax
	addq	%rbp, %rax
	subq	$16008, %rax
	movl	(%rax), %edx
	movl	%edx, %eax
	sall	$3, %eax
	addl	%edx, %eax
	leal	(%rcx,%rax), %edx
	movl	-16040(%rbp), %eax
	cltq
	salq	$4, %rax
	addq	%rbp, %rax
	subq	$16004, %rax
	movl	(%rax), %eax
	sall	$2, %eax
	addl	%edx, %eax
	movl	%eax, -16036(%rbp)
	movl	-16040(%rbp), %eax
	cltq
	salq	$4, %rax
	addq	%rbp, %rax
	subq	$16012, %rax
	movl	(%rax), %edx
	movl	-16032(%rbp), %eax
	cmpl	%eax, %edx
	jg	.L7
	movl	-16040(%rbp), %eax
	cltq
	salq	$4, %rax
	addq	%rbp, %rax
	subq	$16008, %rax
	movl	(%rax), %edx
	movl	-16028(%rbp), %eax
	cmpl	%eax, %edx
	jg	.L7
	movl	-16040(%rbp), %eax
	cltq
	salq	$4, %rax
	addq	%rbp, %rax
	subq	$16004, %rax
	movl	(%rax), %edx
	movl	-16024(%rbp), %eax
	cmpl	%eax, %edx
	jg	.L7
	movl	-16020(%rbp), %eax
	cmpl	%eax, -16036(%rbp)
	jg	.L7
	movl	-16040(%rbp), %eax
	cltq
	salq	$4, %rax
	addq	%rbp, %rax
	subq	$16016, %rax
	movl	(%rax), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -16044(%rbp)
.L7:
	addl	$1, -16040(%rbp)
.L6:
	movl	-16048(%rbp), %eax
	cmpl	%eax, -16040(%rbp)
	jl	.L8
	cmpl	$0, -16044(%rbp)
	jne	.L10
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L10
.L14:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L12
	call	__stack_chk_fail@PLT
.L12:
	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"
.LC1:
	.string	"%d %d %d %d"
.LC2:
	.string	"NA"
.LC3:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.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
	subq	$4096, %rsp
	.cfi_def_cfa_offset 4152
	orq	$0, (%rsp)
	subq	$4096, %rsp
	.cfi_def_cfa_offset 8248
	orq	$0, (%rsp)
	subq	$4096, %rsp
	.cfi_def_cfa_offset 12344
	orq	$0, (%rsp)
	subq	$3800, %rsp
	.cfi_def_cfa_offset 16144
	movl	$16000, %edx
	xorl	%esi, %esi
	leaq	.LC0(%rip), %r12
	leaq	.LC1(%rip), %rbx
	movq	%fs:40, %rax
	movq	%rax, 16072(%rsp)
	xorl	%eax, %eax
	leaq	64(%rsp), %rax
	leaq	44(%rsp), %r13
	movq	%rax, %rdi
	movq	%rax, 8(%rsp)
	call	memset@PLT
.L8:
	leaq	48(%rsp), %r14
	.p2align 4,,10
	.p2align 3
.L11:
	movq	%r13, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	44(%rsp), %eax
	testl	%eax, %eax
	je	.L2
	movq	8(%rsp), %rbp
	movl	$0, %r15d
	jle	.L7
	.p2align 4,,10
	.p2align 3
.L6:
	leaq	8(%rbp), %rcx
	leaq	4(%rbp), %rdx
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	leaq	12(%rbp), %r8
	xorl	%eax, %eax
	addl	$1, %r15d
	addq	$16, %rbp
	call	__isoc99_scanf@PLT
	cmpl	%r15d, 44(%rsp)
	jg	.L6
.L7:
	leaq	52(%rsp), %rdx
	leaq	56(%rsp), %rcx
	movq	%r14, %rsi
	movq	%rbx, %rdi
	leaq	60(%rsp), %r8
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	44(%rsp), %edx
	testl	%edx, %edx
	jle	.L5
	movq	8(%rsp), %rcx
	xorl	%r8d, %r8d
	xorl	%r15d, %r15d
	.p2align 4,,10
	.p2align 3
.L10:
	movl	4(%rcx), %eax
	cmpl	48(%rsp), %eax
	jg	.L9
	movl	8(%rcx), %esi
	cmpl	52(%rsp), %esi
	jg	.L9
	movl	12(%rcx), %edi
	cmpl	56(%rsp), %edi
	jg	.L9
	leal	(%rsi,%rsi,8), %esi
	leal	(%rsi,%rax,4), %eax
	leal	(%rax,%rdi,4), %eax
	cmpl	%eax, 60(%rsp)
	jge	.L21
	.p2align 4,,10
	.p2align 3
.L9:
	addl	$1, %r8d
	addq	$16, %rcx
	cmpl	%edx, %r8d
	jl	.L10
	testl	%r15d, %r15d
	jne	.L11
	.p2align 4,,10
	.p2align 3
.L5:
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L21:
	movl	(%rcx), %edx
	leaq	.LC3(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	movl	%r8d, 28(%rsp)
	addl	$1, %r15d
	movq	%rcx, 16(%rsp)
	call	__printf_chk@PLT
	movl	44(%rsp), %edx
	movl	28(%rsp), %r8d
	movq	16(%rsp), %rcx
	jmp	.L9
.L2:
	movq	16072(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L22
	addq	$16088, %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
.L22:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

rule
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%d %d %d %d"
.LC2:
	.string	"NA"
.LC3:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.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
	subq	$4096, %rsp
	.cfi_def_cfa_offset 4152
	orq	$0, (%rsp)
	subq	$4096, %rsp
	.cfi_def_cfa_offset 8248
	orq	$0, (%rsp)
	subq	$4096, %rsp
	.cfi_def_cfa_offset 12344
	orq	$0, (%rsp)
	subq	$3800, %rsp
	.cfi_def_cfa_offset 16144
	movl	$16000, %edx
	xorl	%esi, %esi
	leaq	.LC0(%rip), %r12
	leaq	.LC1(%rip), %rbx
	movq	%fs:40, %rax
	movq	%rax, 16072(%rsp)
	xorl	%eax, %eax
	leaq	64(%rsp), %rax
	leaq	44(%rsp), %r13
	movq	%rax, %rdi
	movq	%rax, 8(%rsp)
	call	memset@PLT
.L8:
	leaq	48(%rsp), %r14
	.p2align 4,,10
	.p2align 3
.L11:
	movq	%r13, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	44(%rsp), %eax
	testl	%eax, %eax
	je	.L2
	movq	8(%rsp), %rbp
	movl	$0, %r15d
	jle	.L7
	.p2align 4,,10
	.p2align 3
.L6:
	leaq	8(%rbp), %rcx
	leaq	4(%rbp), %rdx
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	leaq	12(%rbp), %r8
	xorl	%eax, %eax
	addl	$1, %r15d
	addq	$16, %rbp
	call	__isoc99_scanf@PLT
	cmpl	%r15d, 44(%rsp)
	jg	.L6
.L7:
	leaq	52(%rsp), %rdx
	leaq	56(%rsp), %rcx
	movq	%r14, %rsi
	movq	%rbx, %rdi
	leaq	60(%rsp), %r8
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	44(%rsp), %edx
	testl	%edx, %edx
	jle	.L5
	movq	8(%rsp), %rcx
	xorl	%r8d, %r8d
	xorl	%r15d, %r15d
	.p2align 4,,10
	.p2align 3
.L10:
	movl	4(%rcx), %eax
	cmpl	48(%rsp), %eax
	jg	.L9
	movl	8(%rcx), %esi
	cmpl	52(%rsp), %esi
	jg	.L9
	movl	12(%rcx), %edi
	cmpl	56(%rsp), %edi
	jg	.L9
	leal	(%rsi,%rsi,8), %esi
	leal	(%rsi,%rax,4), %eax
	leal	(%rax,%rdi,4), %eax
	cmpl	%eax, 60(%rsp)
	jge	.L21
	.p2align 4,,10
	.p2align 3
.L9:
	addl	$1, %r8d
	addq	$16, %rcx
	cmpl	%edx, %r8d
	jl	.L10
	testl	%r15d, %r15d
	jne	.L11
	.p2align 4,,10
	.p2align 3
.L5:
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L21:
	movl	(%rcx), %edx
	leaq	.LC3(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	movl	%r8d, 28(%rsp)
	addl	$1, %r15d
	movq	%rcx, 16(%rsp)
	call	__printf_chk@PLT
	movl	44(%rsp), %edx
	movl	28(%rsp), %r8d
	movq	16(%rsp), %rcx
	jmp	.L9
.L2:
	movq	16072(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L22
	addq	$16088, %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
.L22:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

#include <stdio.h>

int main(void)
{
	int sweets;
	int info[1000][4] = {0};
	int limit[4];
	int cal, ok;
	int i;
	
	while(1){
		ok = 0;
		
		scanf("%d", &sweets);
		if(sweets == 0)    break;
		for(i = 0; i < sweets; i++){
			scanf("%d %d %d %d", &info[i][0], &info[i][1], &info[i][2], &info[i][3]);
		}
		scanf("%d %d %d %d", &limit[0], &limit[1], &limit[2], &limit[3]);
		
		for(i = 0; i < sweets; i++){
			cal = (info[i][1] * 4) + (info[i][2] * 9) + (info[i][3] * 4);
			
			if (info[i][1] <= limit[0] && info[i][2] <= limit[1] &&
				info[i][3] <= limit[2] && cal <= limit[3]){
				printf("%d\n", info[i][0]);
				ok++;
				}
		}
		if(ok == 0)    printf("NA\n");
	}
	
	return 0;
}
4
1 7 14 47
2 5 35 55
3 6 3 59
4 6 5 15
10 15 50 110
2
1 8 10 78
2 4 18 33
10 10 50 300
0
 4
1 7 14 47
2 7 35 55
3 6 3 78
4 2 7 15
10 15 50 110
2
1 8 10 215
0 4 8 33
4 10 50 300
0
 4
1 7 14 47
2 5 35 55
3 6 3 59
4 6 5 15
10 15 50 318
2
1 8 10 78
2 4 18 33
10 10 50 300
0
 4
1 7 24 67
2 7 35 55
3 7 3 78
8 2 9 16
8 15 50 110
2
1 8 10 254
1 3 9 33
4 10 50 300
0
 4
0 5 24 67
0 7 35 15
3 14 1 74
4 2 9 18
8 29 50 100
0
1 8 10 254
1 7 9 33
3 1 28 300
0
 4
1 7 24 67
2 7 35 55
3 7 3 78
8 2 9 16
8 15 50 100
2
1 8 10 254
2 3 9 33
4 10 50 300
0
 4
1 3 14 47
0 7 35 55
3 6 3 14
4 2 7 31
10 15 50 110
2
1 8 10 254
1 5 8 33
4 2 50 300
0
 4
0 5 24 100
0 14 48 15
3 14 0 74
2 2 2 9
5 29 102 111
2
1 1 10 147
0 7 3 0
3 1 33 278
0
 4
1 5 24 67
4 7 35 45
3 3 1 78
4 1 1 18
3 15 50 101
0
1 8 3 397
1 7 4 33
4 1 28 553
0
 4
0 3 24 100
0 14 25 15
3 14 0 23
0 1 2 9
9 37 73 111
2
1 8 5 254
0 7 7 33
2 1 31 278
0

NA
NA
 NA
0
 4
NA
 NA
1
 NA
 NA
2
 3
NA
 2
NA
 4
 0
NA

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>

int main(void)
{
	int sweets;
	int info[1000][4] = {0};
	int limit[4];
	int cal, ok;
	int i;
	
	while(1){
		ok = 0;
		
		scanf("%d", &sweets);
		if(sweets == 0)    break;
		for(i = 0; i < sweets; i++){
			scanf("%d %d %d %d", &info[i][0], &info[i][1], &info[i][2], &info[i][3]);
		}
		scanf("%d %d %d %d", &limit[0], &limit[1], &limit[2], &limit[3]);
		
		for(i = 0; i < sweets; i++){
			cal = (info[i][1] * 4) + (info[i][2] * 9) + (info[i][3] * 4);
			
			if (info[i][1] <= limit[0] && info[i][2] <= limit[1] &&
				info[i][3] <= limit[2] && cal <= limit[3]){
				printf("%d\n", info[i][0]);
				ok++;
				}
		}
		if(ok == 0)    printf("NA\n");
	}
	
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d %d %d %d"
.LC2:
	.string	"%d\n"
.LC3:
	.string	"NA"
	.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	$4096, %rsp
	orq	$0, (%rsp)
	subq	$4096, %rsp
	orq	$0, (%rsp)
	subq	$4096, %rsp
	orq	$0, (%rsp)
	subq	$3760, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-16016(%rbp), %rax
	movl	$16000, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
.L10:
	movl	$0, -16044(%rbp)
	leaq	-16048(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-16048(%rbp), %eax
	testl	%eax, %eax
	je	.L14
	movl	$0, -16040(%rbp)
	jmp	.L4
.L5:
	leaq	-16016(%rbp), %rdx
	movl	-16040(%rbp), %eax
	cltq
	salq	$4, %rax
	addq	$12, %rax
	leaq	(%rdx,%rax), %rsi
	leaq	-16016(%rbp), %rdx
	movl	-16040(%rbp), %eax
	cltq
	salq	$4, %rax
	addq	$8, %rax
	leaq	(%rdx,%rax), %rcx
	leaq	-16016(%rbp), %rdx
	movl	-16040(%rbp), %eax
	cltq
	salq	$4, %rax
	addq	$4, %rax
	addq	%rax, %rdx
	leaq	-16016(%rbp), %rdi
	movl	-16040(%rbp), %eax
	cltq
	salq	$4, %rax
	addq	%rdi, %rax
	movq	%rsi, %r8
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -16040(%rbp)
.L4:
	movl	-16048(%rbp), %eax
	cmpl	%eax, -16040(%rbp)
	jl	.L5
	leaq	-16032(%rbp), %rax
	leaq	12(%rax), %rsi
	leaq	-16032(%rbp), %rax
	leaq	8(%rax), %rcx
	leaq	-16032(%rbp), %rax
	leaq	4(%rax), %rdx
	leaq	-16032(%rbp), %rax
	movq	%rsi, %r8
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -16040(%rbp)
	jmp	.L6
.L8:
	movl	-16040(%rbp), %eax
	cltq
	salq	$4, %rax
	addq	%rbp, %rax
	subq	$16012, %rax
	movl	(%rax), %eax
	leal	0(,%rax,4), %ecx
	movl	-16040(%rbp), %eax
	cltq
	salq	$4, %rax
	addq	%rbp, %rax
	subq	$16008, %rax
	movl	(%rax), %edx
	movl	%edx, %eax
	sall	$3, %eax
	addl	%edx, %eax
	leal	(%rcx,%rax), %edx
	movl	-16040(%rbp), %eax
	cltq
	salq	$4, %rax
	addq	%rbp, %rax
	subq	$16004, %rax
	movl	(%rax), %eax
	sall	$2, %eax
	addl	%edx, %eax
	movl	%eax, -16036(%rbp)
	movl	-16040(%rbp), %eax
	cltq
	salq	$4, %rax
	addq	%rbp, %rax
	subq	$16012, %rax
	movl	(%rax), %edx
	movl	-16032(%rbp), %eax
	cmpl	%eax, %edx
	jg	.L7
	movl	-16040(%rbp), %eax
	cltq
	salq	$4, %rax
	addq	%rbp, %rax
	subq	$16008, %rax
	movl	(%rax), %edx
	movl	-16028(%rbp), %eax
	cmpl	%eax, %edx
	jg	.L7
	movl	-16040(%rbp), %eax
	cltq
	salq	$4, %rax
	addq	%rbp, %rax
	subq	$16004, %rax
	movl	(%rax), %edx
	movl	-16024(%rbp), %eax
	cmpl	%eax, %edx
	jg	.L7
	movl	-16020(%rbp), %eax
	cmpl	%eax, -16036(%rbp)
	jg	.L7
	movl	-16040(%rbp), %eax
	cltq
	salq	$4, %rax
	addq	%rbp, %rax
	subq	$16016, %rax
	movl	(%rax), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -16044(%rbp)
.L7:
	addl	$1, -16040(%rbp)
.L6:
	movl	-16048(%rbp), %eax
	cmpl	%eax, -16040(%rbp)
	jl	.L8
	cmpl	$0, -16044(%rbp)
	jne	.L10
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L10
.L14:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L12
	call	__stack_chk_fail@PLT
.L12:
	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 %d %d"
.LC2:
	.string	"%d\n"
.LC3:
	.string	"NA"
	.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	$4096, %rsp
	orq	$0, (%rsp)
	subq	$4096, %rsp
	orq	$0, (%rsp)
	subq	$4096, %rsp
	orq	$0, (%rsp)
	subq	$3760, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-16016(%rbp), %rax
	movl	$16000, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
.L10:
	movl	$0, -16044(%rbp)
	leaq	-16048(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-16048(%rbp), %eax
	testl	%eax, %eax
	je	.L14
	movl	$0, -16040(%rbp)
	jmp	.L4
.L5:
	leaq	-16016(%rbp), %rdx
	movl	-16040(%rbp), %eax
	cltq
	salq	$4, %rax
	addq	$12, %rax
	leaq	(%rdx,%rax), %rsi
	leaq	-16016(%rbp), %rdx
	movl	-16040(%rbp), %eax
	cltq
	salq	$4, %rax
	addq	$8, %rax
	leaq	(%rdx,%rax), %rcx
	leaq	-16016(%rbp), %rdx
	movl	-16040(%rbp), %eax
	cltq
	salq	$4, %rax
	addq	$4, %rax
	addq	%rax, %rdx
	leaq	-16016(%rbp), %rdi
	movl	-16040(%rbp), %eax
	cltq
	salq	$4, %rax
	addq	%rdi, %rax
	movq	%rsi, %r8
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -16040(%rbp)
.L4:
	movl	-16048(%rbp), %eax
	cmpl	%eax, -16040(%rbp)
	jl	.L5
	leaq	-16032(%rbp), %rax
	leaq	12(%rax), %rsi
	leaq	-16032(%rbp), %rax
	leaq	8(%rax), %rcx
	leaq	-16032(%rbp), %rax
	leaq	4(%rax), %rdx
	leaq	-16032(%rbp), %rax
	movq	%rsi, %r8
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -16040(%rbp)
	jmp	.L6
.L8:
	movl	-16040(%rbp), %eax
	cltq
	salq	$4, %rax
	addq	%rbp, %rax
	subq	$16012, %rax
	movl	(%rax), %eax
	leal	0(,%rax,4), %ecx
	movl	-16040(%rbp), %eax
	cltq
	salq	$4, %rax
	addq	%rbp, %rax
	subq	$16008, %rax
	movl	(%rax), %edx
	movl	%edx, %eax
	sall	$3, %eax
	addl	%edx, %eax
	leal	(%rcx,%rax), %edx
	movl	-16040(%rbp), %eax
	cltq
	salq	$4, %rax
	addq	%rbp, %rax
	subq	$16004, %rax
	movl	(%rax), %eax
	sall	$2, %eax
	addl	%edx, %eax
	movl	%eax, -16036(%rbp)
	movl	-16040(%rbp), %eax
	cltq
	salq	$4, %rax
	addq	%rbp, %rax
	subq	$16012, %rax
	movl	(%rax), %edx
	movl	-16032(%rbp), %eax
	cmpl	%eax, %edx
	jg	.L7
	movl	-16040(%rbp), %eax
	cltq
	salq	$4, %rax
	addq	%rbp, %rax
	subq	$16008, %rax
	movl	(%rax), %edx
	movl	-16028(%rbp), %eax
	cmpl	%eax, %edx
	jg	.L7
	movl	-16040(%rbp), %eax
	cltq
	salq	$4, %rax
	addq	%rbp, %rax
	subq	$16004, %rax
	movl	(%rax), %edx
	movl	-16024(%rbp), %eax
	cmpl	%eax, %edx
	jg	.L7
	movl	-16020(%rbp), %eax
	cmpl	%eax, -16036(%rbp)
	jg	.L7
	movl	-16040(%rbp), %eax
	cltq
	salq	$4, %rax
	addq	%rbp, %rax
	subq	$16016, %rax
	movl	(%rax), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -16044(%rbp)
.L7:
	addl	$1, -16040(%rbp)
.L6:
	movl	-16048(%rbp), %eax
	cmpl	%eax, -16040(%rbp)
	jl	.L8
	cmpl	$0, -16044(%rbp)
	jne	.L10
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L10
.L14:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L12
	call	__stack_chk_fail@PLT
.L12:
	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:
