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(){
  int a,b,c,i,n,k[10000];
  while(scanf("%d",&n),n!=0){
    for(a=b=c=i=0;i<n;i++){
      scanf("%d",&k[i]);
      if(k[i]>1){ a=1; c++;}
       else b+=k[i]; 
    }
    if(a==0) printf("NA\n");
     else printf("%d\n",c+b+1);
  }
  return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"NA"
.LC2:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	leaq	-36864(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$3184, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	jmp	.L2
.L8:
	movl	$0, -40020(%rbp)
	movl	-40020(%rbp), %eax
	movl	%eax, -40024(%rbp)
	movl	-40024(%rbp), %eax
	movl	%eax, -40028(%rbp)
	movl	-40028(%rbp), %eax
	movl	%eax, -40032(%rbp)
	jmp	.L3
.L6:
	leaq	-40016(%rbp), %rdx
	movl	-40020(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-40020(%rbp), %eax
	cltq
	movl	-40016(%rbp,%rax,4), %eax
	cmpl	$1, %eax
	jle	.L4
	movl	$1, -40032(%rbp)
	addl	$1, -40024(%rbp)
	jmp	.L5
.L4:
	movl	-40020(%rbp), %eax
	cltq
	movl	-40016(%rbp,%rax,4), %eax
	addl	%eax, -40028(%rbp)
.L5:
	addl	$1, -40020(%rbp)
.L3:
	movl	-40036(%rbp), %eax
	cmpl	%eax, -40020(%rbp)
	jl	.L6
	cmpl	$0, -40032(%rbp)
	jne	.L7
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L2
.L7:
	movl	-40024(%rbp), %edx
	movl	-40028(%rbp), %eax
	addl	%edx, %eax
	addl	$1, %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L2:
	leaq	-40036(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-40036(%rbp), %eax
	testl	%eax, %eax
	jne	.L8
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L10
	call	__stack_chk_fail@PLT
.L10:
	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	"NA"
.LC2:
	.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
	leaq	-36864(%rsp), %r11
	.cfi_def_cfa 11, 36920
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$3192, %rsp
	.cfi_def_cfa_offset 40112
	leaq	.LC0(%rip), %rbp
	movq	%fs:40, %rax
	movq	%rax, 40040(%rsp)
	xorl	%eax, %eax
	leaq	28(%rsp), %rax
	movq	%rax, 8(%rsp)
	.p2align 4,,10
	.p2align 3
.L2:
	movq	8(%rsp), %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	28(%rsp), %eax
	testl	%eax, %eax
	je	.L9
	jle	.L8
	leaq	32(%rsp), %r14
	xorl	%r15d, %r15d
	xorl	%ebx, %ebx
	xorl	%r12d, %r12d
	xorl	%r13d, %r13d
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L20:
	addl	$1, %ebx
	movl	$1, %r13d
	addl	$1, %r15d
	addq	$4, %r14
	cmpl	%r15d, 28(%rsp)
	jle	.L19
.L5:
	movq	%r14, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	(%r14), %eax
	cmpl	$1, %eax
	jg	.L20
	addl	%eax, %r12d
	addl	$1, %r15d
	addq	$4, %r14
	cmpl	%r15d, 28(%rsp)
	jg	.L5
.L19:
	testl	%r13d, %r13d
	je	.L8
	leal	1(%r12,%rbx), %edx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L8:
	leaq	.LC1(%rip), %rdi
	call	puts@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L9:
	movq	40040(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L21
	addq	$40056, %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
.L21:
	.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	"NA"
.LC2:
	.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
	leaq	-36864(%rsp), %r11
	.cfi_def_cfa 11, 36920
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$3192, %rsp
	.cfi_def_cfa_offset 40112
	leaq	.LC0(%rip), %rbp
	movq	%fs:40, %rax
	movq	%rax, 40040(%rsp)
	xorl	%eax, %eax
	leaq	28(%rsp), %rax
	movq	%rax, 8(%rsp)
	.p2align 4,,10
	.p2align 3
.L2:
	movq	8(%rsp), %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	28(%rsp), %eax
	testl	%eax, %eax
	je	.L9
	jle	.L8
	leaq	32(%rsp), %r14
	xorl	%r15d, %r15d
	xorl	%ebx, %ebx
	xorl	%r12d, %r12d
	xorl	%r13d, %r13d
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L20:
	addl	$1, %ebx
	movl	$1, %r13d
	addl	$1, %r15d
	addq	$4, %r14
	cmpl	%r15d, 28(%rsp)
	jle	.L19
.L5:
	movq	%r14, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	(%r14), %eax
	cmpl	$1, %eax
	jg	.L20
	addl	%eax, %r12d
	addl	$1, %r15d
	addq	$4, %r14
	cmpl	%r15d, 28(%rsp)
	jg	.L5
.L19:
	testl	%r13d, %r13d
	je	.L8
	leal	1(%r12,%rbx), %edx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L8:
	leaq	.LC1(%rip), %rdi
	call	puts@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L9:
	movq	40040(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L21
	addq	$40056, %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
.L21:
	.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(){
  int a,b,c,i,n,k[10000];
  while(scanf("%d",&n),n!=0){
    for(a=b=c=i=0;i<n;i++){
      scanf("%d",&k[i]);
      if(k[i]>1){ a=1; c++;}
       else b+=k[i]; 
    }
    if(a==0) printf("NA\n");
     else printf("%d\n",c+b+1);
  }
  return 0;
}
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 unoptimized assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include <stdio.h>

int main(){
  int a,b,c,i,n,k[10000];
  while(scanf("%d",&n),n!=0){
    for(a=b=c=i=0;i<n;i++){
      scanf("%d",&k[i]);
      if(k[i]>1){ a=1; c++;}
       else b+=k[i]; 
    }
    if(a==0) printf("NA\n");
     else printf("%d\n",c+b+1);
  }
  return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"NA"
.LC2:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	leaq	-36864(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$3184, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	jmp	.L2
.L8:
	movl	$0, -40020(%rbp)
	movl	-40020(%rbp), %eax
	movl	%eax, -40024(%rbp)
	movl	-40024(%rbp), %eax
	movl	%eax, -40028(%rbp)
	movl	-40028(%rbp), %eax
	movl	%eax, -40032(%rbp)
	jmp	.L3
.L6:
	leaq	-40016(%rbp), %rdx
	movl	-40020(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-40020(%rbp), %eax
	cltq
	movl	-40016(%rbp,%rax,4), %eax
	cmpl	$1, %eax
	jle	.L4
	movl	$1, -40032(%rbp)
	addl	$1, -40024(%rbp)
	jmp	.L5
.L4:
	movl	-40020(%rbp), %eax
	cltq
	movl	-40016(%rbp,%rax,4), %eax
	addl	%eax, -40028(%rbp)
.L5:
	addl	$1, -40020(%rbp)
.L3:
	movl	-40036(%rbp), %eax
	cmpl	%eax, -40020(%rbp)
	jl	.L6
	cmpl	$0, -40032(%rbp)
	jne	.L7
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L2
.L7:
	movl	-40024(%rbp), %edx
	movl	-40028(%rbp), %eax
	addl	%edx, %eax
	addl	$1, %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L2:
	leaq	-40036(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-40036(%rbp), %eax
	testl	%eax, %eax
	jne	.L8
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L10
	call	__stack_chk_fail@PLT
.L10:
	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	"NA"
.LC2:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	leaq	-36864(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$3184, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	jmp	.L2
.L8:
	movl	$0, -40020(%rbp)
	movl	-40020(%rbp), %eax
	movl	%eax, -40024(%rbp)
	movl	-40024(%rbp), %eax
	movl	%eax, -40028(%rbp)
	movl	-40028(%rbp), %eax
	movl	%eax, -40032(%rbp)
	jmp	.L3
.L6:
	leaq	-40016(%rbp), %rdx
	movl	-40020(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-40020(%rbp), %eax
	cltq
	movl	-40016(%rbp,%rax,4), %eax
	cmpl	$1, %eax
	jle	.L4
	movl	$1, -40032(%rbp)
	addl	$1, -40024(%rbp)
	jmp	.L5
.L4:
	movl	-40020(%rbp), %eax
	cltq
	movl	-40016(%rbp,%rax,4), %eax
	addl	%eax, -40028(%rbp)
.L5:
	addl	$1, -40020(%rbp)
.L3:
	movl	-40036(%rbp), %eax
	cmpl	%eax, -40020(%rbp)
	jl	.L6
	cmpl	$0, -40032(%rbp)
	jne	.L7
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L2
.L7:
	movl	-40024(%rbp), %edx
	movl	-40028(%rbp), %eax
	addl	%edx, %eax
	addl	$1, %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L2:
	leaq	-40036(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-40036(%rbp), %eax
	testl	%eax, %eax
	jne	.L8
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L10
	call	__stack_chk_fail@PLT
.L10:
	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:
