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>
typedef struct go{
	char c;
	int n;
}GO;
GO a[100005];
int main(){
	int n,f,x,i,j,ans;
	FILE *fp;
	//fp=fopen("test.txt","r");
	fp=stdin;
	while(1){
		fscanf(fp,"%d",&n);
		if(n==0)break;
		fscanf(fp,"%d",&x);
		a[0].c=x;
		a[0].n=1;
		f=1;
		for(i=2;i<=n;i++){
			fscanf(fp,"%d",&x);
			if(i%2==1){
				if(a[f-1].c==x){
					a[f-1].n++;
				}else{
					a[f].c=x;
					a[f].n=1;
					f++;
				}
			}else{
				if(a[f-1].c==x){
					a[f-1].n++;
				}else{
					if(f>=2){
						a[f-2].n+=a[f-1].n+1;
						f--;
					}else{
						a[f-1].c=(a[f-1].c+1)%2;
						a[f-1].n++;
					}
				}
			}
			//printf("%d:",i);for(j=0;j<f;j++)printf("(%d:%d,%d)",j,a[j].c,a[j].n);
			//printf("\n");
		}
		ans=0;
		for(i=0;i<f;i++){
			if(a[i].c==0)ans+=a[i].n;
		}
		printf("%d\n",ans);
	}
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 800040
a:
	.zero	800040
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.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
	subq	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movq	stdin(%rip), %rax
	movq	%rax, -16(%rbp)
.L14:
	leaq	-36(%rbp), %rdx
	movq	-16(%rbp), %rax
	leaq	.LC0(%rip), %rcx
	movq	%rcx, %rsi
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_fscanf@PLT
	movl	-36(%rbp), %eax
	testl	%eax, %eax
	je	.L18
	leaq	-32(%rbp), %rdx
	movq	-16(%rbp), %rax
	leaq	.LC0(%rip), %rcx
	movq	%rcx, %rsi
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_fscanf@PLT
	movl	-32(%rbp), %eax
	movb	%al, a(%rip)
	movl	$1, 4+a(%rip)
	movl	$1, -28(%rbp)
	movl	$2, -24(%rbp)
	jmp	.L4
.L10:
	leaq	-32(%rbp), %rdx
	movq	-16(%rbp), %rax
	leaq	.LC0(%rip), %rcx
	movq	%rcx, %rsi
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_fscanf@PLT
	movl	-24(%rbp), %eax
	cltd
	shrl	$31, %edx
	addl	%edx, %eax
	andl	$1, %eax
	subl	%edx, %eax
	cmpl	$1, %eax
	jne	.L5
	movl	-28(%rbp), %eax
	subl	$1, %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movzbl	(%rdx,%rax), %eax
	movsbl	%al, %edx
	movl	-32(%rbp), %eax
	cmpl	%eax, %edx
	jne	.L6
	movl	-28(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	4+a(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	leal	1(%rdx), %ecx
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+a(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	jmp	.L7
.L6:
	movl	-32(%rbp), %eax
	movl	%eax, %ecx
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movb	%cl, (%rdx,%rax)
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+a(%rip), %rax
	movl	$1, (%rdx,%rax)
	addl	$1, -28(%rbp)
	jmp	.L7
.L5:
	movl	-28(%rbp), %eax
	subl	$1, %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movzbl	(%rdx,%rax), %eax
	movsbl	%al, %edx
	movl	-32(%rbp), %eax
	cmpl	%eax, %edx
	jne	.L8
	movl	-28(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	4+a(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	leal	1(%rdx), %ecx
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+a(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	jmp	.L7
.L8:
	cmpl	$1, -28(%rbp)
	jle	.L9
	movl	-28(%rbp), %eax
	subl	$2, %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+a(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-28(%rbp), %eax
	subl	$1, %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+a(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	1(%rax), %edx
	movl	-28(%rbp), %eax
	subl	$2, %eax
	addl	%edx, %ecx
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+a(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	subl	$1, -28(%rbp)
	jmp	.L7
.L9:
	movl	-28(%rbp), %eax
	subl	$1, %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movzbl	(%rdx,%rax), %eax
	movsbl	%al, %eax
	addl	$1, %eax
	cltd
	shrl	$31, %edx
	addl	%edx, %eax
	andl	$1, %eax
	subl	%edx, %eax
	movl	%eax, %edx
	movl	-28(%rbp), %eax
	subl	$1, %eax
	movl	%edx, %ecx
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movb	%cl, (%rdx,%rax)
	movl	-28(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	4+a(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	leal	1(%rdx), %ecx
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+a(%rip), %rax
	movl	%ecx, (%rdx,%rax)
.L7:
	addl	$1, -24(%rbp)
.L4:
	movl	-36(%rbp), %eax
	cmpl	%eax, -24(%rbp)
	jle	.L10
	movl	$0, -20(%rbp)
	movl	$0, -24(%rbp)
	jmp	.L11
.L13:
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movzbl	(%rdx,%rax), %eax
	testb	%al, %al
	jne	.L12
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+a(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, -20(%rbp)
.L12:
	addl	$1, -24(%rbp)
.L11:
	movl	-24(%rbp), %eax
	cmpl	-28(%rbp), %eax
	jl	.L13
	movl	-20(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L14
.L18:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L16
	call	__stack_chk_fail@PLT
.L16:
	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"
.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
	leaq	a(%rip), %r14
	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	.LC0(%rip), %rbx
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	movq	stdin(%rip), %rbp
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %rax
	movq	%rax, 8(%rsp)
	.p2align 4,,10
	.p2align 3
.L32:
	movq	8(%rsp), %rdx
	movq	%rbx, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_fscanf@PLT
	movl	16(%rsp), %eax
	testl	%eax, %eax
	je	.L2
	leaq	20(%rsp), %r15
	xorl	%eax, %eax
	movq	%rbx, %rsi
	movq	%rbp, %rdi
	movq	%r15, %rdx
	movl	$2, %r12d
	movl	$1, %r13d
	call	__isoc99_fscanf@PLT
	movl	20(%rsp), %eax
	cmpl	$1, 16(%rsp)
	movl	$1, 4+a(%rip)
	movb	%al, (%r14)
	jg	.L3
	jmp	.L44
	.p2align 4,,10
	.p2align 3
.L6:
	movslq	%eax, %rsi
	movsbl	(%r14,%rsi,8), %edx
	cmpl	20(%rsp), %edx
	je	.L42
	cmpl	$1, %r13d
	jle	.L10
	leal	-2(%r13), %ecx
	movl	4(%r14,%rsi,8), %esi
	movl	%eax, %r13d
	movslq	%ecx, %rcx
	movl	4(%r14,%rcx,8), %edx
	leal	1(%rsi,%rdx), %edx
	movl	%edx, 4(%r14,%rcx,8)
.L8:
	addl	$1, %r12d
	cmpl	%r12d, 16(%rsp)
	jl	.L45
.L3:
	xorl	%eax, %eax
	movq	%r15, %rdx
	movq	%rbx, %rsi
	movq	%rbp, %rdi
	call	__isoc99_fscanf@PLT
	testb	$1, %r12b
	leal	-1(%r13), %eax
	movdqa	.LC1(%rip), %xmm1
	je	.L6
	cltq
	movl	20(%rsp), %edx
	movsbl	(%r14,%rax,8), %esi
	cmpl	%edx, %esi
	je	.L46
	movslq	%r13d, %rax
	addl	$1, %r12d
	addl	$1, %r13d
	movb	%dl, (%r14,%rax,8)
	movl	$1, 4(%r14,%rax,8)
	cmpl	%r12d, 16(%rsp)
	jge	.L3
.L45:
	testl	%r13d, %r13d
	jle	.L36
	cmpl	$16, %r13d
	jle	.L37
	leal	-1(%r13), %esi
	leaq	a(%rip), %rax
	pxor	%xmm6, %xmm6
	movl	%esi, %edx
	leaq	128(%rax), %rcx
	pxor	%xmm8, %xmm8
	shrl	$4, %edx
	pxor	%xmm7, %xmm7
	subl	$1, %edx
	salq	$7, %rdx
	addq	%rcx, %rdx
	.p2align 4,,10
	.p2align 3
.L13:
	movdqu	52(%rax), %xmm5
	movdqu	36(%rax), %xmm4
	subq	$-128, %rax
	movdqu	-60(%rax), %xmm3
	movdqu	-12(%rax), %xmm0
	shufps	$136, %xmm5, %xmm4
	movdqu	-44(%rax), %xmm5
	movdqa	-112(%rax), %xmm2
	movdqa	-80(%rax), %xmm9
	movdqa	-16(%rax), %xmm10
	shufps	$136, %xmm5, %xmm3
	movdqu	-28(%rax), %xmm5
	pand	%xmm1, %xmm2
	movdqu	-108(%rax), %xmm12
	pand	%xmm1, %xmm9
	pand	%xmm1, %xmm10
	shufps	$136, %xmm0, %xmm5
	movdqa	-128(%rax), %xmm0
	pand	%xmm1, %xmm0
	packuswb	%xmm2, %xmm0
	movdqa	-96(%rax), %xmm2
	pand	%xmm1, %xmm0
	pand	%xmm1, %xmm2
	packuswb	%xmm9, %xmm2
	movdqa	-48(%rax), %xmm9
	pand	%xmm1, %xmm2
	packuswb	%xmm2, %xmm0
	movdqa	-64(%rax), %xmm2
	pand	%xmm1, %xmm9
	pand	%xmm1, %xmm0
	pand	%xmm1, %xmm2
	packuswb	%xmm9, %xmm2
	movdqa	-32(%rax), %xmm9
	pand	%xmm1, %xmm2
	pand	%xmm1, %xmm9
	packuswb	%xmm10, %xmm9
	movdqa	%xmm7, %xmm10
	pand	%xmm1, %xmm9
	packuswb	%xmm9, %xmm2
	movdqa	%xmm8, %xmm9
	pand	%xmm1, %xmm2
	packuswb	%xmm2, %xmm0
	pcmpeqb	%xmm8, %xmm0
	pcmpgtb	%xmm0, %xmm9
	movdqa	%xmm0, %xmm2
	punpcklbw	%xmm9, %xmm2
	punpckhbw	%xmm9, %xmm0
	movdqu	-124(%rax), %xmm9
	pcmpgtw	%xmm2, %xmm10
	movdqa	%xmm2, %xmm11
	shufps	$136, %xmm12, %xmm9
	punpckhwd	%xmm10, %xmm2
	punpcklwd	%xmm10, %xmm11
	movdqa	%xmm0, %xmm10
	pand	%xmm2, %xmm4
	movdqa	%xmm7, %xmm2
	pand	%xmm11, %xmm9
	pcmpgtw	%xmm0, %xmm2
	paddd	%xmm9, %xmm6
	paddd	%xmm6, %xmm4
	punpcklwd	%xmm2, %xmm10
	punpckhwd	%xmm2, %xmm0
	pand	%xmm10, %xmm3
	pand	%xmm0, %xmm5
	paddd	%xmm4, %xmm3
	movdqa	%xmm5, %xmm6
	paddd	%xmm3, %xmm6
	cmpq	%rdx, %rax
	jne	.L13
	movdqa	%xmm6, %xmm0
	movl	%esi, %eax
	psrldq	$8, %xmm0
	andl	$-16, %eax
	paddd	%xmm0, %xmm6
	movdqa	%xmm6, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm6
	movd	%xmm6, %edx
.L12:
	movslq	%eax, %rsi
	cmpb	$0, (%r14,%rsi,8)
	jne	.L15
.L4:
	addl	4(%r14,%rsi,8), %edx
.L15:
	leal	1(%rax), %esi
	cmpl	%esi, %r13d
	jle	.L11
	movslq	%esi, %rsi
	cmpb	$0, (%r14,%rsi,8)
	jne	.L16
	addl	4(%r14,%rsi,8), %edx
.L16:
	leal	2(%rax), %esi
	cmpl	%esi, %r13d
	jle	.L11
	movslq	%esi, %rsi
	cmpb	$0, (%r14,%rsi,8)
	jne	.L17
	addl	4(%r14,%rsi,8), %edx
.L17:
	leal	3(%rax), %esi
	cmpl	%r13d, %esi
	jge	.L11
	movslq	%esi, %rsi
	cmpb	$0, (%r14,%rsi,8)
	jne	.L18
	addl	4(%r14,%rsi,8), %edx
.L18:
	leal	4(%rax), %esi
	cmpl	%r13d, %esi
	jge	.L11
	movslq	%esi, %rsi
	cmpb	$0, (%r14,%rsi,8)
	jne	.L19
	addl	4(%r14,%rsi,8), %edx
.L19:
	leal	5(%rax), %esi
	cmpl	%r13d, %esi
	jge	.L11
	movslq	%esi, %rsi
	cmpb	$0, (%r14,%rsi,8)
	jne	.L20
	addl	4(%r14,%rsi,8), %edx
.L20:
	leal	6(%rax), %esi
	cmpl	%r13d, %esi
	jge	.L11
	movslq	%esi, %rsi
	cmpb	$0, (%r14,%rsi,8)
	jne	.L21
	addl	4(%r14,%rsi,8), %edx
.L21:
	leal	7(%rax), %esi
	cmpl	%esi, %r13d
	jle	.L11
	movslq	%esi, %rsi
	cmpb	$0, (%r14,%rsi,8)
	jne	.L22
	addl	4(%r14,%rsi,8), %edx
.L22:
	leal	8(%rax), %esi
	cmpl	%esi, %r13d
	jle	.L11
	movslq	%esi, %rsi
	cmpb	$0, (%r14,%rsi,8)
	jne	.L23
	addl	4(%r14,%rsi,8), %edx
.L23:
	leal	9(%rax), %esi
	cmpl	%esi, %r13d
	jle	.L11
	movslq	%esi, %rsi
	cmpb	$0, (%r14,%rsi,8)
	jne	.L24
	addl	4(%r14,%rsi,8), %edx
.L24:
	leal	10(%rax), %esi
	cmpl	%esi, %r13d
	jle	.L11
	movslq	%esi, %rsi
	cmpb	$0, (%r14,%rsi,8)
	jne	.L25
	addl	4(%r14,%rsi,8), %edx
.L25:
	leal	11(%rax), %esi
	cmpl	%esi, %r13d
	jle	.L11
	movslq	%esi, %rsi
	cmpb	$0, (%r14,%rsi,8)
	jne	.L26
	addl	4(%r14,%rsi,8), %edx
.L26:
	leal	12(%rax), %esi
	cmpl	%esi, %r13d
	jle	.L11
	movslq	%esi, %rsi
	cmpb	$0, (%r14,%rsi,8)
	jne	.L27
	addl	4(%r14,%rsi,8), %edx
.L27:
	leal	13(%rax), %esi
	cmpl	%esi, %r13d
	jle	.L11
	movslq	%esi, %rsi
	cmpb	$0, (%r14,%rsi,8)
	jne	.L28
	addl	4(%r14,%rsi,8), %edx
.L28:
	leal	14(%rax), %esi
	cmpl	%esi, %r13d
	jle	.L11
	movslq	%esi, %rsi
	cmpb	$0, (%r14,%rsi,8)
	jne	.L29
	addl	4(%r14,%rsi,8), %edx
.L29:
	addl	$15, %eax
	cmpl	%eax, %r13d
	jle	.L11
	cltq
	cmpb	$0, (%r14,%rax,8)
	jne	.L11
	addl	4(%r14,%rax,8), %edx
	.p2align 4,,10
	.p2align 3
.L11:
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L32
	.p2align 4,,10
	.p2align 3
.L10:
	addl	$1, %edx
	movl	%edx, %eax
	shrl	$31, %eax
	addl	%eax, %edx
	andl	$1, %edx
	subl	%eax, %edx
	movb	%dl, (%r14,%rsi,8)
.L42:
	addl	$1, 4(%r14,%rsi,8)
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L46:
	addl	$1, 4(%r14,%rax,8)
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L2:
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L47
	addq	$40, %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
	.p2align 4,,10
	.p2align 3
.L36:
	.cfi_restore_state
	xorl	%edx, %edx
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L44:
	xorl	%edx, %edx
	testb	%al, %al
	jne	.L11
	xorl	%eax, %eax
	xorl	%esi, %esi
	jmp	.L4
.L37:
	xorl	%edx, %edx
	xorl	%eax, %eax
	jmp	.L12
.L47:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 800040
a:
	.zero	800040
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC1:
	.value	255
	.value	255
	.value	255
	.value	255
	.value	255
	.value	255
	.value	255
	.value	255
	.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"
.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
	leaq	a(%rip), %r14
	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	.LC0(%rip), %rbx
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	movq	stdin(%rip), %rbp
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %rax
	movq	%rax, 8(%rsp)
	.p2align 4,,10
	.p2align 3
.L32:
	movq	8(%rsp), %rdx
	movq	%rbx, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_fscanf@PLT
	movl	16(%rsp), %eax
	testl	%eax, %eax
	je	.L2
	leaq	20(%rsp), %r15
	xorl	%eax, %eax
	movq	%rbx, %rsi
	movq	%rbp, %rdi
	movq	%r15, %rdx
	movl	$2, %r12d
	movl	$1, %r13d
	call	__isoc99_fscanf@PLT
	movl	20(%rsp), %eax
	cmpl	$1, 16(%rsp)
	movl	$1, 4+a(%rip)
	movb	%al, (%r14)
	jg	.L3
	jmp	.L44
	.p2align 4,,10
	.p2align 3
.L6:
	movslq	%eax, %rsi
	movsbl	(%r14,%rsi,8), %edx
	cmpl	20(%rsp), %edx
	je	.L42
	cmpl	$1, %r13d
	jle	.L10
	leal	-2(%r13), %ecx
	movl	4(%r14,%rsi,8), %esi
	movl	%eax, %r13d
	movslq	%ecx, %rcx
	movl	4(%r14,%rcx,8), %edx
	leal	1(%rsi,%rdx), %edx
	movl	%edx, 4(%r14,%rcx,8)
.L8:
	addl	$1, %r12d
	cmpl	%r12d, 16(%rsp)
	jl	.L45
.L3:
	xorl	%eax, %eax
	movq	%r15, %rdx
	movq	%rbx, %rsi
	movq	%rbp, %rdi
	call	__isoc99_fscanf@PLT
	testb	$1, %r12b
	leal	-1(%r13), %eax
	movdqa	.LC1(%rip), %xmm1
	je	.L6
	cltq
	movl	20(%rsp), %edx
	movsbl	(%r14,%rax,8), %esi
	cmpl	%edx, %esi
	je	.L46
	movslq	%r13d, %rax
	addl	$1, %r12d
	addl	$1, %r13d
	movb	%dl, (%r14,%rax,8)
	movl	$1, 4(%r14,%rax,8)
	cmpl	%r12d, 16(%rsp)
	jge	.L3
.L45:
	testl	%r13d, %r13d
	jle	.L36
	cmpl	$16, %r13d
	jle	.L37
	leal	-1(%r13), %esi
	leaq	a(%rip), %rax
	pxor	%xmm6, %xmm6
	movl	%esi, %edx
	leaq	128(%rax), %rcx
	pxor	%xmm8, %xmm8
	shrl	$4, %edx
	pxor	%xmm7, %xmm7
	subl	$1, %edx
	salq	$7, %rdx
	addq	%rcx, %rdx
	.p2align 4,,10
	.p2align 3
.L13:
	movdqu	52(%rax), %xmm5
	movdqu	36(%rax), %xmm4
	subq	$-128, %rax
	movdqu	-60(%rax), %xmm3
	movdqu	-12(%rax), %xmm0
	shufps	$136, %xmm5, %xmm4
	movdqu	-44(%rax), %xmm5
	movdqa	-112(%rax), %xmm2
	movdqa	-80(%rax), %xmm9
	movdqa	-16(%rax), %xmm10
	shufps	$136, %xmm5, %xmm3
	movdqu	-28(%rax), %xmm5
	pand	%xmm1, %xmm2
	movdqu	-108(%rax), %xmm12
	pand	%xmm1, %xmm9
	pand	%xmm1, %xmm10
	shufps	$136, %xmm0, %xmm5
	movdqa	-128(%rax), %xmm0
	pand	%xmm1, %xmm0
	packuswb	%xmm2, %xmm0
	movdqa	-96(%rax), %xmm2
	pand	%xmm1, %xmm0
	pand	%xmm1, %xmm2
	packuswb	%xmm9, %xmm2
	movdqa	-48(%rax), %xmm9
	pand	%xmm1, %xmm2
	packuswb	%xmm2, %xmm0
	movdqa	-64(%rax), %xmm2
	pand	%xmm1, %xmm9
	pand	%xmm1, %xmm0
	pand	%xmm1, %xmm2
	packuswb	%xmm9, %xmm2
	movdqa	-32(%rax), %xmm9
	pand	%xmm1, %xmm2
	pand	%xmm1, %xmm9
	packuswb	%xmm10, %xmm9
	movdqa	%xmm7, %xmm10
	pand	%xmm1, %xmm9
	packuswb	%xmm9, %xmm2
	movdqa	%xmm8, %xmm9
	pand	%xmm1, %xmm2
	packuswb	%xmm2, %xmm0
	pcmpeqb	%xmm8, %xmm0
	pcmpgtb	%xmm0, %xmm9
	movdqa	%xmm0, %xmm2
	punpcklbw	%xmm9, %xmm2
	punpckhbw	%xmm9, %xmm0
	movdqu	-124(%rax), %xmm9
	pcmpgtw	%xmm2, %xmm10
	movdqa	%xmm2, %xmm11
	shufps	$136, %xmm12, %xmm9
	punpckhwd	%xmm10, %xmm2
	punpcklwd	%xmm10, %xmm11
	movdqa	%xmm0, %xmm10
	pand	%xmm2, %xmm4
	movdqa	%xmm7, %xmm2
	pand	%xmm11, %xmm9
	pcmpgtw	%xmm0, %xmm2
	paddd	%xmm9, %xmm6
	paddd	%xmm6, %xmm4
	punpcklwd	%xmm2, %xmm10
	punpckhwd	%xmm2, %xmm0
	pand	%xmm10, %xmm3
	pand	%xmm0, %xmm5
	paddd	%xmm4, %xmm3
	movdqa	%xmm5, %xmm6
	paddd	%xmm3, %xmm6
	cmpq	%rdx, %rax
	jne	.L13
	movdqa	%xmm6, %xmm0
	movl	%esi, %eax
	psrldq	$8, %xmm0
	andl	$-16, %eax
	paddd	%xmm0, %xmm6
	movdqa	%xmm6, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm6
	movd	%xmm6, %edx
.L12:
	movslq	%eax, %rsi
	cmpb	$0, (%r14,%rsi,8)
	jne	.L15
.L4:
	addl	4(%r14,%rsi,8), %edx
.L15:
	leal	1(%rax), %esi
	cmpl	%esi, %r13d
	jle	.L11
	movslq	%esi, %rsi
	cmpb	$0, (%r14,%rsi,8)
	jne	.L16
	addl	4(%r14,%rsi,8), %edx
.L16:
	leal	2(%rax), %esi
	cmpl	%esi, %r13d
	jle	.L11
	movslq	%esi, %rsi
	cmpb	$0, (%r14,%rsi,8)
	jne	.L17
	addl	4(%r14,%rsi,8), %edx
.L17:
	leal	3(%rax), %esi
	cmpl	%r13d, %esi
	jge	.L11
	movslq	%esi, %rsi
	cmpb	$0, (%r14,%rsi,8)
	jne	.L18
	addl	4(%r14,%rsi,8), %edx
.L18:
	leal	4(%rax), %esi
	cmpl	%r13d, %esi
	jge	.L11
	movslq	%esi, %rsi
	cmpb	$0, (%r14,%rsi,8)
	jne	.L19
	addl	4(%r14,%rsi,8), %edx
.L19:
	leal	5(%rax), %esi
	cmpl	%r13d, %esi
	jge	.L11
	movslq	%esi, %rsi
	cmpb	$0, (%r14,%rsi,8)
	jne	.L20
	addl	4(%r14,%rsi,8), %edx
.L20:
	leal	6(%rax), %esi
	cmpl	%r13d, %esi
	jge	.L11
	movslq	%esi, %rsi
	cmpb	$0, (%r14,%rsi,8)
	jne	.L21
	addl	4(%r14,%rsi,8), %edx
.L21:
	leal	7(%rax), %esi
	cmpl	%esi, %r13d
	jle	.L11
	movslq	%esi, %rsi
	cmpb	$0, (%r14,%rsi,8)
	jne	.L22
	addl	4(%r14,%rsi,8), %edx
.L22:
	leal	8(%rax), %esi
	cmpl	%esi, %r13d
	jle	.L11
	movslq	%esi, %rsi
	cmpb	$0, (%r14,%rsi,8)
	jne	.L23
	addl	4(%r14,%rsi,8), %edx
.L23:
	leal	9(%rax), %esi
	cmpl	%esi, %r13d
	jle	.L11
	movslq	%esi, %rsi
	cmpb	$0, (%r14,%rsi,8)
	jne	.L24
	addl	4(%r14,%rsi,8), %edx
.L24:
	leal	10(%rax), %esi
	cmpl	%esi, %r13d
	jle	.L11
	movslq	%esi, %rsi
	cmpb	$0, (%r14,%rsi,8)
	jne	.L25
	addl	4(%r14,%rsi,8), %edx
.L25:
	leal	11(%rax), %esi
	cmpl	%esi, %r13d
	jle	.L11
	movslq	%esi, %rsi
	cmpb	$0, (%r14,%rsi,8)
	jne	.L26
	addl	4(%r14,%rsi,8), %edx
.L26:
	leal	12(%rax), %esi
	cmpl	%esi, %r13d
	jle	.L11
	movslq	%esi, %rsi
	cmpb	$0, (%r14,%rsi,8)
	jne	.L27
	addl	4(%r14,%rsi,8), %edx
.L27:
	leal	13(%rax), %esi
	cmpl	%esi, %r13d
	jle	.L11
	movslq	%esi, %rsi
	cmpb	$0, (%r14,%rsi,8)
	jne	.L28
	addl	4(%r14,%rsi,8), %edx
.L28:
	leal	14(%rax), %esi
	cmpl	%esi, %r13d
	jle	.L11
	movslq	%esi, %rsi
	cmpb	$0, (%r14,%rsi,8)
	jne	.L29
	addl	4(%r14,%rsi,8), %edx
.L29:
	addl	$15, %eax
	cmpl	%eax, %r13d
	jle	.L11
	cltq
	cmpb	$0, (%r14,%rax,8)
	jne	.L11
	addl	4(%r14,%rax,8), %edx
	.p2align 4,,10
	.p2align 3
.L11:
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L32
	.p2align 4,,10
	.p2align 3
.L10:
	addl	$1, %edx
	movl	%edx, %eax
	shrl	$31, %eax
	addl	%eax, %edx
	andl	$1, %edx
	subl	%eax, %edx
	movb	%dl, (%r14,%rsi,8)
.L42:
	addl	$1, 4(%r14,%rsi,8)
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L46:
	addl	$1, 4(%r14,%rax,8)
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L2:
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L47
	addq	$40, %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
	.p2align 4,,10
	.p2align 3
.L36:
	.cfi_restore_state
	xorl	%edx, %edx
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L44:
	xorl	%edx, %edx
	testb	%al, %al
	jne	.L11
	xorl	%eax, %eax
	xorl	%esi, %esi
	jmp	.L4
.L37:
	xorl	%edx, %edx
	xorl	%eax, %eax
	jmp	.L12
.L47:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 800040
a:
	.zero	800040
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC1:
	.value	255
	.value	255
	.value	255
	.value	255
	.value	255
	.value	255
	.value	255
	.value	255
	.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>
typedef struct go{
	char c;
	int n;
}GO;
GO a[100005];
int main(){
	int n,f,x,i,j,ans;
	FILE *fp;
	//fp=fopen("test.txt","r");
	fp=stdin;
	while(1){
		fscanf(fp,"%d",&n);
		if(n==0)break;
		fscanf(fp,"%d",&x);
		a[0].c=x;
		a[0].n=1;
		f=1;
		for(i=2;i<=n;i++){
			fscanf(fp,"%d",&x);
			if(i%2==1){
				if(a[f-1].c==x){
					a[f-1].n++;
				}else{
					a[f].c=x;
					a[f].n=1;
					f++;
				}
			}else{
				if(a[f-1].c==x){
					a[f-1].n++;
				}else{
					if(f>=2){
						a[f-2].n+=a[f-1].n+1;
						f--;
					}else{
						a[f-1].c=(a[f-1].c+1)%2;
						a[f-1].n++;
					}
				}
			}
			//printf("%d:",i);for(j=0;j<f;j++)printf("(%d:%d,%d)",j,a[j].c,a[j].n);
			//printf("\n");
		}
		ans=0;
		for(i=0;i<f;i++){
			if(a[i].c==0)ans+=a[i].n;
		}
		printf("%d\n",ans);
	}
	return 0;
}
8
1
1
1
1
0
0
0
0
8
1
0
1
1
0
0
0
1
0
 8
1
1
1
1
0
0
0
0
8
1
0
0
1
0
0
0
1
0
 8
1
0
1
1
0
0
0
0
4
1
0
1
1
0
0
0
1
0
 8
1
0
1
1
0
0
0
0
2
1
0
1
1
0
0
-1
1
0
 8
0
0
1
1
0
0
0
0
2
1
0
2
1
0
0
-1
1
0
 8
1
1
1
1
0
0
0
0
8
1
0
1
1
0
0
1
1
0
 8
1
0
1
1
0
0
-1
0
8
1
0
0
1
0
0
0
1
0
 8
1
1
2
1
0
0
0
0
1
0
0
1
1
0
0
0
1
0
 8
0
0
1
1
0
0
0
0
3
1
0
1
1
0
0
-1
1
0
 8
1
1
1
1
1
0
0
0
8
1
0
1
1
0
0
1
1
0

4
2
 4
0
 6
2
 6
2
0
 6
2
2
 4
4
 6
0
 4
1
 6
2
1
 8
4

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>
typedef struct go{
	char c;
	int n;
}GO;
GO a[100005];
int main(){
	int n,f,x,i,j,ans;
	FILE *fp;
	//fp=fopen("test.txt","r");
	fp=stdin;
	while(1){
		fscanf(fp,"%d",&n);
		if(n==0)break;
		fscanf(fp,"%d",&x);
		a[0].c=x;
		a[0].n=1;
		f=1;
		for(i=2;i<=n;i++){
			fscanf(fp,"%d",&x);
			if(i%2==1){
				if(a[f-1].c==x){
					a[f-1].n++;
				}else{
					a[f].c=x;
					a[f].n=1;
					f++;
				}
			}else{
				if(a[f-1].c==x){
					a[f-1].n++;
				}else{
					if(f>=2){
						a[f-2].n+=a[f-1].n+1;
						f--;
					}else{
						a[f-1].c=(a[f-1].c+1)%2;
						a[f-1].n++;
					}
				}
			}
			//printf("%d:",i);for(j=0;j<f;j++)printf("(%d:%d,%d)",j,a[j].c,a[j].n);
			//printf("\n");
		}
		ans=0;
		for(i=0;i<f;i++){
			if(a[i].c==0)ans+=a[i].n;
		}
		printf("%d\n",ans);
	}
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 800040
a:
	.zero	800040
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.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
	subq	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movq	stdin(%rip), %rax
	movq	%rax, -16(%rbp)
.L14:
	leaq	-36(%rbp), %rdx
	movq	-16(%rbp), %rax
	leaq	.LC0(%rip), %rcx
	movq	%rcx, %rsi
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_fscanf@PLT
	movl	-36(%rbp), %eax
	testl	%eax, %eax
	je	.L18
	leaq	-32(%rbp), %rdx
	movq	-16(%rbp), %rax
	leaq	.LC0(%rip), %rcx
	movq	%rcx, %rsi
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_fscanf@PLT
	movl	-32(%rbp), %eax
	movb	%al, a(%rip)
	movl	$1, 4+a(%rip)
	movl	$1, -28(%rbp)
	movl	$2, -24(%rbp)
	jmp	.L4
.L10:
	leaq	-32(%rbp), %rdx
	movq	-16(%rbp), %rax
	leaq	.LC0(%rip), %rcx
	movq	%rcx, %rsi
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_fscanf@PLT
	movl	-24(%rbp), %eax
	cltd
	shrl	$31, %edx
	addl	%edx, %eax
	andl	$1, %eax
	subl	%edx, %eax
	cmpl	$1, %eax
	jne	.L5
	movl	-28(%rbp), %eax
	subl	$1, %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movzbl	(%rdx,%rax), %eax
	movsbl	%al, %edx
	movl	-32(%rbp), %eax
	cmpl	%eax, %edx
	jne	.L6
	movl	-28(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	4+a(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	leal	1(%rdx), %ecx
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+a(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	jmp	.L7
.L6:
	movl	-32(%rbp), %eax
	movl	%eax, %ecx
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movb	%cl, (%rdx,%rax)
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+a(%rip), %rax
	movl	$1, (%rdx,%rax)
	addl	$1, -28(%rbp)
	jmp	.L7
.L5:
	movl	-28(%rbp), %eax
	subl	$1, %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movzbl	(%rdx,%rax), %eax
	movsbl	%al, %edx
	movl	-32(%rbp), %eax
	cmpl	%eax, %edx
	jne	.L8
	movl	-28(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	4+a(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	leal	1(%rdx), %ecx
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+a(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	jmp	.L7
.L8:
	cmpl	$1, -28(%rbp)
	jle	.L9
	movl	-28(%rbp), %eax
	subl	$2, %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+a(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-28(%rbp), %eax
	subl	$1, %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+a(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	1(%rax), %edx
	movl	-28(%rbp), %eax
	subl	$2, %eax
	addl	%edx, %ecx
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+a(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	subl	$1, -28(%rbp)
	jmp	.L7
.L9:
	movl	-28(%rbp), %eax
	subl	$1, %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movzbl	(%rdx,%rax), %eax
	movsbl	%al, %eax
	addl	$1, %eax
	cltd
	shrl	$31, %edx
	addl	%edx, %eax
	andl	$1, %eax
	subl	%edx, %eax
	movl	%eax, %edx
	movl	-28(%rbp), %eax
	subl	$1, %eax
	movl	%edx, %ecx
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movb	%cl, (%rdx,%rax)
	movl	-28(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	4+a(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	leal	1(%rdx), %ecx
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+a(%rip), %rax
	movl	%ecx, (%rdx,%rax)
.L7:
	addl	$1, -24(%rbp)
.L4:
	movl	-36(%rbp), %eax
	cmpl	%eax, -24(%rbp)
	jle	.L10
	movl	$0, -20(%rbp)
	movl	$0, -24(%rbp)
	jmp	.L11
.L13:
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movzbl	(%rdx,%rax), %eax
	testb	%al, %al
	jne	.L12
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+a(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, -20(%rbp)
.L12:
	addl	$1, -24(%rbp)
.L11:
	movl	-24(%rbp), %eax
	cmpl	-28(%rbp), %eax
	jl	.L13
	movl	-20(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L14
.L18:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L16
	call	__stack_chk_fail@PLT
.L16:
	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	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 800040
a:
	.zero	800040
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.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
	subq	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movq	stdin(%rip), %rax
	movq	%rax, -16(%rbp)
.L14:
	leaq	-36(%rbp), %rdx
	movq	-16(%rbp), %rax
	leaq	.LC0(%rip), %rcx
	movq	%rcx, %rsi
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_fscanf@PLT
	movl	-36(%rbp), %eax
	testl	%eax, %eax
	je	.L18
	leaq	-32(%rbp), %rdx
	movq	-16(%rbp), %rax
	leaq	.LC0(%rip), %rcx
	movq	%rcx, %rsi
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_fscanf@PLT
	movl	-32(%rbp), %eax
	movb	%al, a(%rip)
	movl	$1, 4+a(%rip)
	movl	$1, -28(%rbp)
	movl	$2, -24(%rbp)
	jmp	.L4
.L10:
	leaq	-32(%rbp), %rdx
	movq	-16(%rbp), %rax
	leaq	.LC0(%rip), %rcx
	movq	%rcx, %rsi
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_fscanf@PLT
	movl	-24(%rbp), %eax
	cltd
	shrl	$31, %edx
	addl	%edx, %eax
	andl	$1, %eax
	subl	%edx, %eax
	cmpl	$1, %eax
	jne	.L5
	movl	-28(%rbp), %eax
	subl	$1, %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movzbl	(%rdx,%rax), %eax
	movsbl	%al, %edx
	movl	-32(%rbp), %eax
	cmpl	%eax, %edx
	jne	.L6
	movl	-28(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	4+a(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	leal	1(%rdx), %ecx
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+a(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	jmp	.L7
.L6:
	movl	-32(%rbp), %eax
	movl	%eax, %ecx
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movb	%cl, (%rdx,%rax)
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+a(%rip), %rax
	movl	$1, (%rdx,%rax)
	addl	$1, -28(%rbp)
	jmp	.L7
.L5:
	movl	-28(%rbp), %eax
	subl	$1, %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movzbl	(%rdx,%rax), %eax
	movsbl	%al, %edx
	movl	-32(%rbp), %eax
	cmpl	%eax, %edx
	jne	.L8
	movl	-28(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	4+a(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	leal	1(%rdx), %ecx
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+a(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	jmp	.L7
.L8:
	cmpl	$1, -28(%rbp)
	jle	.L9
	movl	-28(%rbp), %eax
	subl	$2, %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+a(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-28(%rbp), %eax
	subl	$1, %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+a(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	1(%rax), %edx
	movl	-28(%rbp), %eax
	subl	$2, %eax
	addl	%edx, %ecx
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+a(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	subl	$1, -28(%rbp)
	jmp	.L7
.L9:
	movl	-28(%rbp), %eax
	subl	$1, %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movzbl	(%rdx,%rax), %eax
	movsbl	%al, %eax
	addl	$1, %eax
	cltd
	shrl	$31, %edx
	addl	%edx, %eax
	andl	$1, %eax
	subl	%edx, %eax
	movl	%eax, %edx
	movl	-28(%rbp), %eax
	subl	$1, %eax
	movl	%edx, %ecx
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movb	%cl, (%rdx,%rax)
	movl	-28(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	4+a(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	leal	1(%rdx), %ecx
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+a(%rip), %rax
	movl	%ecx, (%rdx,%rax)
.L7:
	addl	$1, -24(%rbp)
.L4:
	movl	-36(%rbp), %eax
	cmpl	%eax, -24(%rbp)
	jle	.L10
	movl	$0, -20(%rbp)
	movl	$0, -24(%rbp)
	jmp	.L11
.L13:
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movzbl	(%rdx,%rax), %eax
	testb	%al, %al
	jne	.L12
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+a(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, -20(%rbp)
.L12:
	addl	$1, -24(%rbp)
.L11:
	movl	-24(%rbp), %eax
	cmpl	-28(%rbp), %eax
	jl	.L13
	movl	-20(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L14
.L18:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L16
	call	__stack_chk_fail@PLT
.L16:
	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:
