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

```c
n,v,s;main(b,i){for(;~scanf("%d",&n);)for(s=0;n-->0;s^=b)for(b=scanf("%d",&v)+">\5ZNel|&~n"[v]^s,i=7;~i;)putchar(i--?48|b>>i&1:10);}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	n
	.bss
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	v
	.align 4
	.type	v, @object
	.size	v, 4
v:
	.zero	4
	.globl	s
	.align 4
	.type	s, @object
	.size	s, 4
s:
	.zero	4
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	">\005ZNel|&~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	$16, %rsp
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	jmp	.L2
.L9:
	movl	$0, s(%rip)
	jmp	.L3
.L8:
	leaq	v(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	%eax, %ecx
	movl	v(%rip), %eax
	cltq
	leaq	.LC1(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	movsbl	%al, %eax
	leal	(%rcx,%rax), %edx
	movl	s(%rip), %eax
	xorl	%edx, %eax
	movl	%eax, -4(%rbp)
	movl	$7, -8(%rbp)
	jmp	.L4
.L7:
	movl	-8(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -8(%rbp)
	testl	%eax, %eax
	je	.L5
	movl	-8(%rbp), %eax
	movl	-4(%rbp), %edx
	movl	%eax, %ecx
	sarl	%cl, %edx
	movl	%edx, %eax
	andl	$1, %eax
	orl	$48, %eax
	jmp	.L6
.L5:
	movl	$10, %eax
.L6:
	movl	%eax, %edi
	call	putchar@PLT
.L4:
	cmpl	$-1, -8(%rbp)
	jne	.L7
	movl	s(%rip), %eax
	xorl	-4(%rbp), %eax
	movl	%eax, s(%rip)
.L3:
	movl	n(%rip), %eax
	leal	-1(%rax), %edx
	movl	%edx, n(%rip)
	testl	%eax, %eax
	jg	.L8
.L2:
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	cmpl	$-1, %eax
	jne	.L9
	movl	$0, %eax
	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	">\005ZNel|&~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
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	leaq	n(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	leaq	v(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	leaq	.LC1(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	leaq	.LC0(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$8, %rsp
	.cfi_def_cfa_offset 64
	.p2align 4,,10
	.p2align 3
.L2:
	xorl	%eax, %eax
	movq	%r14, %rsi
	movq	%rbp, %rdi
	call	scanf@PLT
	cmpl	$-1, %eax
	je	.L15
	movl	$0, s(%rip)
	.p2align 4,,10
	.p2align 3
.L13:
	movl	n(%rip), %eax
	leal	-1(%rax), %edx
	movl	%edx, n(%rip)
	testl	%eax, %eax
	jle	.L2
	movq	%r13, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	movl	$6, %r15d
	call	scanf@PLT
	movslq	v(%rip), %rdx
	movsbl	(%r12,%rdx), %ebx
	addl	%eax, %ebx
	xorl	s(%rip), %ebx
	.p2align 4,,10
	.p2align 3
.L4:
	movl	%r15d, %ecx
	movl	%ebx, %edi
	sarl	%cl, %edi
	andl	$1, %edi
	orl	$48, %edi
	call	putchar@PLT
	subl	$1, %r15d
	jnb	.L4
	movl	$10, %edi
	call	putchar@PLT
	xorl	%ebx, s(%rip)
	jmp	.L13
.L15:
	addq	$8, %rsp
	.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
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	s
	.bss
	.align 4
	.type	s, @object
	.size	s, 4
s:
	.zero	4
	.globl	v
	.align 4
	.type	v, @object
	.size	v, 4
v:
	.zero	4
	.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
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	">\005ZNel|&~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
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	leaq	n(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	leaq	v(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	leaq	.LC1(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	leaq	.LC0(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$8, %rsp
	.cfi_def_cfa_offset 64
	.p2align 4,,10
	.p2align 3
.L2:
	xorl	%eax, %eax
	movq	%r14, %rsi
	movq	%rbp, %rdi
	call	scanf@PLT
	cmpl	$-1, %eax
	je	.L15
	movl	$0, s(%rip)
	.p2align 4,,10
	.p2align 3
.L13:
	movl	n(%rip), %eax
	leal	-1(%rax), %edx
	movl	%edx, n(%rip)
	testl	%eax, %eax
	jle	.L2
	movq	%r13, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	movl	$6, %r15d
	call	scanf@PLT
	movslq	v(%rip), %rdx
	movsbl	(%r12,%rdx), %ebx
	addl	%eax, %ebx
	xorl	s(%rip), %ebx
	.p2align 4,,10
	.p2align 3
.L4:
	movl	%r15d, %ecx
	movl	%ebx, %edi
	sarl	%cl, %edi
	andl	$1, %edi
	orl	$48, %edi
	call	putchar@PLT
	subl	$1, %r15d
	jnb	.L4
	movl	$10, %edi
	call	putchar@PLT
	xorl	%ebx, s(%rip)
	jmp	.L13
.L15:
	addq	$8, %rsp
	.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
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	s
	.bss
	.align 4
	.type	s, @object
	.size	s, 4
s:
	.zero	4
	.globl	v
	.align 4
	.type	v, @object
	.size	v, 4
v:
	.zero	4
	.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:

n,v,s;main(b,i){for(;~scanf("%d",&n);)for(s=0;n-->0;s^=b)for(b=scanf("%d",&v)+">\5ZNel|&~n"[v]^s,i=7;~i;)putchar(i--?48|b>>i&1:10);}
3
0
5
1
1
1
-1
 3
0
9
1
1
0
-1
 3
0
5
1
1
2
-1
 3
1
9
1
1
0
-1
 3
0
6
1
1
2
-1
 3
1
9
0
1
0
-1
 3
0
5
0
1
0
-1
 3
1
5
1
1
0
-1
 3
0
6
1
1
1
-1
 3
0
7
1
1
0
-1

0111111
1010010
1101011
0000110
 0111111
1010000
1101001
0111111
 0111111
1010010
1101011
1011011
 0000110
1101001
1101001
0111111
 0111111
1000010
1111011
1011011
 0000110
1101001
1010000
0111111
 0111111
1010010
1010010
0111111
 0000110
1101011
1101011
0111111
 0111111
1000010
1111011
0000110
 0111111
0011000
0100001
0111111

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

```c
n,v,s;main(b,i){for(;~scanf("%d",&n);)for(s=0;n-->0;s^=b)for(b=scanf("%d",&v)+">\5ZNel|&~n"[v]^s,i=7;~i;)putchar(i--?48|b>>i&1:10);}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	n
	.bss
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	v
	.align 4
	.type	v, @object
	.size	v, 4
v:
	.zero	4
	.globl	s
	.align 4
	.type	s, @object
	.size	s, 4
s:
	.zero	4
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	">\005ZNel|&~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	$16, %rsp
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	jmp	.L2
.L9:
	movl	$0, s(%rip)
	jmp	.L3
.L8:
	leaq	v(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	%eax, %ecx
	movl	v(%rip), %eax
	cltq
	leaq	.LC1(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	movsbl	%al, %eax
	leal	(%rcx,%rax), %edx
	movl	s(%rip), %eax
	xorl	%edx, %eax
	movl	%eax, -4(%rbp)
	movl	$7, -8(%rbp)
	jmp	.L4
.L7:
	movl	-8(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -8(%rbp)
	testl	%eax, %eax
	je	.L5
	movl	-8(%rbp), %eax
	movl	-4(%rbp), %edx
	movl	%eax, %ecx
	sarl	%cl, %edx
	movl	%edx, %eax
	andl	$1, %eax
	orl	$48, %eax
	jmp	.L6
.L5:
	movl	$10, %eax
.L6:
	movl	%eax, %edi
	call	putchar@PLT
.L4:
	cmpl	$-1, -8(%rbp)
	jne	.L7
	movl	s(%rip), %eax
	xorl	-4(%rbp), %eax
	movl	%eax, s(%rip)
.L3:
	movl	n(%rip), %eax
	leal	-1(%rax), %edx
	movl	%edx, n(%rip)
	testl	%eax, %eax
	jg	.L8
.L2:
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	cmpl	$-1, %eax
	jne	.L9
	movl	$0, %eax
	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
	.globl	n
	.bss
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	v
	.align 4
	.type	v, @object
	.size	v, 4
v:
	.zero	4
	.globl	s
	.align 4
	.type	s, @object
	.size	s, 4
s:
	.zero	4
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	">\005ZNel|&~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	$16, %rsp
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	jmp	.L2
.L9:
	movl	$0, s(%rip)
	jmp	.L3
.L8:
	leaq	v(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	%eax, %ecx
	movl	v(%rip), %eax
	cltq
	leaq	.LC1(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	movsbl	%al, %eax
	leal	(%rcx,%rax), %edx
	movl	s(%rip), %eax
	xorl	%edx, %eax
	movl	%eax, -4(%rbp)
	movl	$7, -8(%rbp)
	jmp	.L4
.L7:
	movl	-8(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -8(%rbp)
	testl	%eax, %eax
	je	.L5
	movl	-8(%rbp), %eax
	movl	-4(%rbp), %edx
	movl	%eax, %ecx
	sarl	%cl, %edx
	movl	%edx, %eax
	andl	$1, %eax
	orl	$48, %eax
	jmp	.L6
.L5:
	movl	$10, %eax
.L6:
	movl	%eax, %edi
	call	putchar@PLT
.L4:
	cmpl	$-1, -8(%rbp)
	jne	.L7
	movl	s(%rip), %eax
	xorl	-4(%rbp), %eax
	movl	%eax, s(%rip)
.L3:
	movl	n(%rip), %eax
	leal	-1(%rax), %edx
	movl	%edx, n(%rip)
	testl	%eax, %eax
	jg	.L8
.L2:
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	cmpl	$-1, %eax
	jne	.L9
	movl	$0, %eax
	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:
