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

```c
#include<stdio.h>

int N,G[10005],i,j,p,q;

int main()
{
	for(;scanf("%d",&N),N;)
	{
		p=q=0;
		for(i=0;i<N;i++)
			scanf("%d",&G[i]);
		for(i=0;i<N;i++)if(G[i]>0)p++;
		for(i=0;i<N;i++)if(G[i]>1)q++;
		if(p+q<2||q<1)puts("NA");
		else printf("%d\n",p+1);
	}
	return 0;
}```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"NA"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	.LC1(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	leaq	N(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	leaq	G(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	leaq	.LC0(%rip), %rbx
	subq	$8, %rsp
	.cfi_def_cfa_offset 48
	.p2align 4,,10
	.p2align 3
.L2:
	movq	%r12, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	N(%rip), %eax
	testl	%eax, %eax
	je	.L22
	movl	$0, q(%rip)
	movl	$0, p(%rip)
	movl	$0, i(%rip)
	jle	.L3
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L4:
	cltq
	movq	%rbx, %rdi
	leaq	0(%rbp,%rax,4), %rsi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	i(%rip), %eax
	movl	N(%rip), %esi
	addl	$1, %eax
	movl	%eax, i(%rip)
	cmpl	%esi, %eax
	jl	.L4
	movl	p(%rip), %r10d
	movl	q(%rip), %r9d
	movl	$0, i(%rip)
	testl	%esi, %esi
	jle	.L23
	leaq	G(%rip), %rax
	leal	-1(%rsi), %edx
	xorl	%r8d, %r8d
	leaq	4(%rax), %rcx
	leaq	(%rcx,%rdx,4), %rdi
	movq	%rax, %rcx
	movl	%r10d, %edx
	.p2align 4,,10
	.p2align 3
.L8:
	movl	(%rcx), %r11d
	testl	%r11d, %r11d
	jle	.L7
	addl	$1, %edx
	movl	$1, %r8d
.L7:
	addq	$4, %rcx
	cmpq	%rcx, %rdi
	jne	.L8
	testb	%r8b, %r8b
	je	.L16
	movl	%edx, p(%rip)
.L9:
	movl	%r9d, %ecx
	xorl	%r8d, %r8d
	.p2align 4,,10
	.p2align 3
.L11:
	cmpl	$1, (%rax)
	jle	.L10
	addl	$1, %ecx
	movl	$1, %r8d
.L10:
	addq	$4, %rax
	cmpq	%rax, %rdi
	jne	.L11
	movl	%esi, i(%rip)
	testb	%r8b, %r8b
	je	.L24
	movl	p(%rip), %edx
	movl	%ecx, q(%rip)
	leal	(%rcx,%rdx), %eax
	cmpl	$1, %eax
	setle	%al
	testl	%ecx, %ecx
	setle	%cl
	orl	%ecx, %eax
.L6:
	testb	%al, %al
	je	.L13
.L3:
	movq	%r13, %rdi
	call	puts@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L13:
	addl	$1, %edx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L24:
	leal	(%rdx,%r9), %eax
	cmpl	$1, %eax
	setle	%al
	testl	%r9d, %r9d
	setle	%cl
	orl	%ecx, %eax
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L16:
	movl	%r10d, %edx
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L22:
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
.L23:
	.cfi_restore_state
	leal	(%r10,%r9), %eax
	subl	$1, %eax
	setle	%al
	testl	%r9d, %r9d
	setle	%dl
	orl	%edx, %eax
	movl	%r10d, %edx
	jmp	.L6
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	q
	.bss
	.align 4
	.type	q, @object
	.size	q, 4
q:
	.zero	4
	.globl	p
	.align 4
	.type	p, @object
	.size	p, 4
p:
	.zero	4
	.globl	j
	.align 4
	.type	j, @object
	.size	j, 4
j:
	.zero	4
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	G
	.align 32
	.type	G, @object
	.size	G, 40020
G:
	.zero	40020
	.globl	N
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.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.
Optimized Assembly Code:

user
```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"NA"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	.LC1(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	leaq	N(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	leaq	G(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	leaq	.LC0(%rip), %rbx
	subq	$8, %rsp
	.cfi_def_cfa_offset 48
	.p2align 4,,10
	.p2align 3
.L2:
	movq	%r12, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	N(%rip), %eax
	testl	%eax, %eax
	je	.L22
	movl	$0, q(%rip)
	movl	$0, p(%rip)
	movl	$0, i(%rip)
	jle	.L3
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L4:
	cltq
	movq	%rbx, %rdi
	leaq	0(%rbp,%rax,4), %rsi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	i(%rip), %eax
	movl	N(%rip), %esi
	addl	$1, %eax
	movl	%eax, i(%rip)
	cmpl	%esi, %eax
	jl	.L4
	movl	p(%rip), %r10d
	movl	q(%rip), %r9d
	movl	$0, i(%rip)
	testl	%esi, %esi
	jle	.L23
	leaq	G(%rip), %rax
	leal	-1(%rsi), %edx
	xorl	%r8d, %r8d
	leaq	4(%rax), %rcx
	leaq	(%rcx,%rdx,4), %rdi
	movq	%rax, %rcx
	movl	%r10d, %edx
	.p2align 4,,10
	.p2align 3
.L8:
	movl	(%rcx), %r11d
	testl	%r11d, %r11d
	jle	.L7
	addl	$1, %edx
	movl	$1, %r8d
.L7:
	addq	$4, %rcx
	cmpq	%rcx, %rdi
	jne	.L8
	testb	%r8b, %r8b
	je	.L16
	movl	%edx, p(%rip)
.L9:
	movl	%r9d, %ecx
	xorl	%r8d, %r8d
	.p2align 4,,10
	.p2align 3
.L11:
	cmpl	$1, (%rax)
	jle	.L10
	addl	$1, %ecx
	movl	$1, %r8d
.L10:
	addq	$4, %rax
	cmpq	%rax, %rdi
	jne	.L11
	movl	%esi, i(%rip)
	testb	%r8b, %r8b
	je	.L24
	movl	p(%rip), %edx
	movl	%ecx, q(%rip)
	leal	(%rcx,%rdx), %eax
	cmpl	$1, %eax
	setle	%al
	testl	%ecx, %ecx
	setle	%cl
	orl	%ecx, %eax
.L6:
	testb	%al, %al
	je	.L13
.L3:
	movq	%r13, %rdi
	call	puts@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L13:
	addl	$1, %edx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L24:
	leal	(%rdx,%r9), %eax
	cmpl	$1, %eax
	setle	%al
	testl	%r9d, %r9d
	setle	%cl
	orl	%ecx, %eax
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L16:
	movl	%r10d, %edx
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L22:
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
.L23:
	.cfi_restore_state
	leal	(%r10,%r9), %eax
	subl	$1, %eax
	setle	%al
	testl	%r9d, %r9d
	setle	%dl
	orl	%edx, %eax
	movl	%r10d, %edx
	jmp	.L6
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	q
	.bss
	.align 4
	.type	q, @object
	.size	q, 4
q:
	.zero	4
	.globl	p
	.align 4
	.type	p, @object
	.size	p, 4
p:
	.zero	4
	.globl	j
	.align 4
	.type	j, @object
	.size	j, 4
j:
	.zero	4
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	G
	.align 32
	.type	G, @object
	.size	G, 40020
G:
	.zero	40020
	.globl	N
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.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
```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"NA"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	.LC1(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	leaq	N(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	leaq	G(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	leaq	.LC0(%rip), %rbx
	subq	$8, %rsp
	.cfi_def_cfa_offset 48
	.p2align 4,,10
	.p2align 3
.L2:
	movq	%r12, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	N(%rip), %eax
	testl	%eax, %eax
	je	.L22
	movl	$0, q(%rip)
	movl	$0, p(%rip)
	movl	$0, i(%rip)
	jle	.L3
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L4:
	cltq
	movq	%rbx, %rdi
	leaq	0(%rbp,%rax,4), %rsi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	i(%rip), %eax
	movl	N(%rip), %esi
	addl	$1, %eax
	movl	%eax, i(%rip)
	cmpl	%esi, %eax
	jl	.L4
	movl	p(%rip), %r10d
	movl	q(%rip), %r9d
	movl	$0, i(%rip)
	testl	%esi, %esi
	jle	.L23
	leaq	G(%rip), %rax
	leal	-1(%rsi), %edx
	xorl	%r8d, %r8d
	leaq	4(%rax), %rcx
	leaq	(%rcx,%rdx,4), %rdi
	movq	%rax, %rcx
	movl	%r10d, %edx
	.p2align 4,,10
	.p2align 3
.L8:
	movl	(%rcx), %r11d
	testl	%r11d, %r11d
	jle	.L7
	addl	$1, %edx
	movl	$1, %r8d
.L7:
	addq	$4, %rcx
	cmpq	%rcx, %rdi
	jne	.L8
	testb	%r8b, %r8b
	je	.L16
	movl	%edx, p(%rip)
.L9:
	movl	%r9d, %ecx
	xorl	%r8d, %r8d
	.p2align 4,,10
	.p2align 3
.L11:
	cmpl	$1, (%rax)
	jle	.L10
	addl	$1, %ecx
	movl	$1, %r8d
.L10:
	addq	$4, %rax
	cmpq	%rax, %rdi
	jne	.L11
	movl	%esi, i(%rip)
	testb	%r8b, %r8b
	je	.L24
	movl	p(%rip), %edx
	movl	%ecx, q(%rip)
	leal	(%rcx,%rdx), %eax
	cmpl	$1, %eax
	setle	%al
	testl	%ecx, %ecx
	setle	%cl
	orl	%ecx, %eax
.L6:
	testb	%al, %al
	je	.L13
.L3:
	movq	%r13, %rdi
	call	puts@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L13:
	addl	$1, %edx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L24:
	leal	(%rdx,%r9), %eax
	cmpl	$1, %eax
	setle	%al
	testl	%r9d, %r9d
	setle	%cl
	orl	%ecx, %eax
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L16:
	movl	%r10d, %edx
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L22:
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
.L23:
	.cfi_restore_state
	leal	(%r10,%r9), %eax
	subl	$1, %eax
	setle	%al
	testl	%r9d, %r9d
	setle	%dl
	orl	%edx, %eax
	movl	%r10d, %edx
	jmp	.L6
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	q
	.bss
	.align 4
	.type	q, @object
	.size	q, 4
q:
	.zero	4
	.globl	p
	.align 4
	.type	p, @object
	.size	p, 4
p:
	.zero	4
	.globl	j
	.align 4
	.type	j, @object
	.size	j, 4
j:
	.zero	4
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	G
	.align 32
	.type	G, @object
	.size	G, 40020
G:
	.zero	40020
	.globl	N
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.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:
```
```c
#include<stdio.h>

int N,G[10005],i,j,p,q;

int main()
{
	for(;scanf("%d",&N),N;)
	{
		p=q=0;
		for(i=0;i<N;i++)
			scanf("%d",&G[i]);
		for(i=0;i<N;i++)if(G[i]>0)p++;
		for(i=0;i<N;i++)if(G[i]>1)q++;
		if(p+q<2||q<1)puts("NA");
		else printf("%d\n",p+1);
	}
	return 0;
}```
Given the following C code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include<stdio.h>

int N,G[10005],i,j,p,q;

int main()
{
	for(;scanf("%d",&N),N;)
	{
		p=q=0;
		for(i=0;i<N;i++)
			scanf("%d",&G[i]);
		for(i=0;i<N;i++)if(G[i]>0)p++;
		for(i=0;i<N;i++)if(G[i]>1)q++;
		if(p+q<2||q<1)puts("NA");
		else printf("%d\n",p+1);
	}
	return 0;
}```

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.
Optimized Assembly Code:

2
3 0
3
0 1 1
1
1000
0
 2
3 2
3
0 1 1
1
0000
0
 2
1 0
3
0 1 1
1
1000
0
 2
2 0
3
0 1 1
0
1100
0
 2
1 0
3
0 1 1
0
1100
0
 2
3 2
3
0 0 1
1
1000
0
 2
6 4
3
0 1 2
1
0000
0
 2
0 4
3
0 1 2
1
0000
0
 2
2 0
0
0 1 0
0
0000
0
 2
0 0
3
1 0 2
0
0010
-1

2
NA
2
 3
NA
NA
 NA
NA
2
 2
NA
 NA
NA
 3
NA
2
 3
3
NA
 2
3
NA
 2
 NA
3

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

```c
#include<stdio.h>

int N,G[10005],i,j,p,q;

int main()
{
	for(;scanf("%d",&N),N;)
	{
		p=q=0;
		for(i=0;i<N;i++)
			scanf("%d",&G[i]);
		for(i=0;i<N;i++)if(G[i]>0)p++;
		for(i=0;i<N;i++)if(G[i]>1)q++;
		if(p+q<2||q<1)puts("NA");
		else printf("%d\n",p+1);
	}
	return 0;
}```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"NA"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	.LC1(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	leaq	N(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	leaq	G(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	leaq	.LC0(%rip), %rbx
	subq	$8, %rsp
	.cfi_def_cfa_offset 48
	.p2align 4,,10
	.p2align 3
.L2:
	movq	%r12, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	N(%rip), %eax
	testl	%eax, %eax
	je	.L22
	movl	$0, q(%rip)
	movl	$0, p(%rip)
	movl	$0, i(%rip)
	jle	.L3
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L4:
	cltq
	movq	%rbx, %rdi
	leaq	0(%rbp,%rax,4), %rsi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	i(%rip), %eax
	movl	N(%rip), %esi
	addl	$1, %eax
	movl	%eax, i(%rip)
	cmpl	%esi, %eax
	jl	.L4
	movl	p(%rip), %r10d
	movl	q(%rip), %r9d
	movl	$0, i(%rip)
	testl	%esi, %esi
	jle	.L23
	leaq	G(%rip), %rax
	leal	-1(%rsi), %edx
	xorl	%r8d, %r8d
	leaq	4(%rax), %rcx
	leaq	(%rcx,%rdx,4), %rdi
	movq	%rax, %rcx
	movl	%r10d, %edx
	.p2align 4,,10
	.p2align 3
.L8:
	movl	(%rcx), %r11d
	testl	%r11d, %r11d
	jle	.L7
	addl	$1, %edx
	movl	$1, %r8d
.L7:
	addq	$4, %rcx
	cmpq	%rcx, %rdi
	jne	.L8
	testb	%r8b, %r8b
	je	.L16
	movl	%edx, p(%rip)
.L9:
	movl	%r9d, %ecx
	xorl	%r8d, %r8d
	.p2align 4,,10
	.p2align 3
.L11:
	cmpl	$1, (%rax)
	jle	.L10
	addl	$1, %ecx
	movl	$1, %r8d
.L10:
	addq	$4, %rax
	cmpq	%rax, %rdi
	jne	.L11
	movl	%esi, i(%rip)
	testb	%r8b, %r8b
	je	.L24
	movl	p(%rip), %edx
	movl	%ecx, q(%rip)
	leal	(%rcx,%rdx), %eax
	cmpl	$1, %eax
	setle	%al
	testl	%ecx, %ecx
	setle	%cl
	orl	%ecx, %eax
.L6:
	testb	%al, %al
	je	.L13
.L3:
	movq	%r13, %rdi
	call	puts@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L13:
	addl	$1, %edx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L24:
	leal	(%rdx,%r9), %eax
	cmpl	$1, %eax
	setle	%al
	testl	%r9d, %r9d
	setle	%cl
	orl	%ecx, %eax
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L16:
	movl	%r10d, %edx
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L22:
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
.L23:
	.cfi_restore_state
	leal	(%r10,%r9), %eax
	subl	$1, %eax
	setle	%al
	testl	%r9d, %r9d
	setle	%dl
	orl	%edx, %eax
	movl	%r10d, %edx
	jmp	.L6
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	q
	.bss
	.align 4
	.type	q, @object
	.size	q, 4
q:
	.zero	4
	.globl	p
	.align 4
	.type	p, @object
	.size	p, 4
p:
	.zero	4
	.globl	j
	.align 4
	.type	j, @object
	.size	j, 4
j:
	.zero	4
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	G
	.align 32
	.type	G, @object
	.size	G, 40020
G:
	.zero	40020
	.globl	N
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.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.
Optimized Assembly Code:

train
```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"NA"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	.LC1(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	leaq	N(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	leaq	G(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	leaq	.LC0(%rip), %rbx
	subq	$8, %rsp
	.cfi_def_cfa_offset 48
	.p2align 4,,10
	.p2align 3
.L2:
	movq	%r12, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	N(%rip), %eax
	testl	%eax, %eax
	je	.L22
	movl	$0, q(%rip)
	movl	$0, p(%rip)
	movl	$0, i(%rip)
	jle	.L3
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L4:
	cltq
	movq	%rbx, %rdi
	leaq	0(%rbp,%rax,4), %rsi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	i(%rip), %eax
	movl	N(%rip), %esi
	addl	$1, %eax
	movl	%eax, i(%rip)
	cmpl	%esi, %eax
	jl	.L4
	movl	p(%rip), %r10d
	movl	q(%rip), %r9d
	movl	$0, i(%rip)
	testl	%esi, %esi
	jle	.L23
	leaq	G(%rip), %rax
	leal	-1(%rsi), %edx
	xorl	%r8d, %r8d
	leaq	4(%rax), %rcx
	leaq	(%rcx,%rdx,4), %rdi
	movq	%rax, %rcx
	movl	%r10d, %edx
	.p2align 4,,10
	.p2align 3
.L8:
	movl	(%rcx), %r11d
	testl	%r11d, %r11d
	jle	.L7
	addl	$1, %edx
	movl	$1, %r8d
.L7:
	addq	$4, %rcx
	cmpq	%rcx, %rdi
	jne	.L8
	testb	%r8b, %r8b
	je	.L16
	movl	%edx, p(%rip)
.L9:
	movl	%r9d, %ecx
	xorl	%r8d, %r8d
	.p2align 4,,10
	.p2align 3
.L11:
	cmpl	$1, (%rax)
	jle	.L10
	addl	$1, %ecx
	movl	$1, %r8d
.L10:
	addq	$4, %rax
	cmpq	%rax, %rdi
	jne	.L11
	movl	%esi, i(%rip)
	testb	%r8b, %r8b
	je	.L24
	movl	p(%rip), %edx
	movl	%ecx, q(%rip)
	leal	(%rcx,%rdx), %eax
	cmpl	$1, %eax
	setle	%al
	testl	%ecx, %ecx
	setle	%cl
	orl	%ecx, %eax
.L6:
	testb	%al, %al
	je	.L13
.L3:
	movq	%r13, %rdi
	call	puts@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L13:
	addl	$1, %edx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L24:
	leal	(%rdx,%r9), %eax
	cmpl	$1, %eax
	setle	%al
	testl	%r9d, %r9d
	setle	%cl
	orl	%ecx, %eax
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L16:
	movl	%r10d, %edx
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L22:
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
.L23:
	.cfi_restore_state
	leal	(%r10,%r9), %eax
	subl	$1, %eax
	setle	%al
	testl	%r9d, %r9d
	setle	%dl
	orl	%edx, %eax
	movl	%r10d, %edx
	jmp	.L6
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	q
	.bss
	.align 4
	.type	q, @object
	.size	q, 4
q:
	.zero	4
	.globl	p
	.align 4
	.type	p, @object
	.size	p, 4
p:
	.zero	4
	.globl	j
	.align 4
	.type	j, @object
	.size	j, 4
j:
	.zero	4
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	G
	.align 32
	.type	G, @object
	.size	G, 40020
G:
	.zero	40020
	.globl	N
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.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:
```