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(){
	long n,i,count,j;
	int c[100000],s;
	while(1){
		scanf("%ld",&n);
		if(n==0) break;
		for(i=0;i<n;i++){
			scanf("%d",&s);
			if(i%2==0){
				c[i]=s;
			}else{
				c[i]=s;
				if(c[i-1]==c[i]){
				}else{
					for(j=i-1;j>=0;j--){
						if(c[j]==s) break;
						c[j]=s;
					}
				}
			}
		}
		count=0;
		for(i=0;i<n;i++){
			if(c[i]==0) count++;
		}
		printf("%ld\n",count);
	}
  return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%ld"
.LC1:
	.string	"%d"
.LC2:
	.string	"%ld\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	-397312(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$2752, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L14:
	leaq	-400048(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-400048(%rbp), %rax
	testq	%rax, %rax
	je	.L18
	movq	$0, -400040(%rbp)
	jmp	.L4
.L10:
	leaq	-400052(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-400040(%rbp), %rax
	andl	$1, %eax
	testq	%rax, %rax
	jne	.L5
	movl	-400052(%rbp), %edx
	movq	-400040(%rbp), %rax
	movl	%edx, -400016(%rbp,%rax,4)
	jmp	.L6
.L5:
	movl	-400052(%rbp), %edx
	movq	-400040(%rbp), %rax
	movl	%edx, -400016(%rbp,%rax,4)
	movq	-400040(%rbp), %rax
	subq	$1, %rax
	movl	-400016(%rbp,%rax,4), %edx
	movq	-400040(%rbp), %rax
	movl	-400016(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	je	.L6
	movq	-400040(%rbp), %rax
	subq	$1, %rax
	movq	%rax, -400024(%rbp)
	jmp	.L7
.L9:
	movq	-400024(%rbp), %rax
	movl	-400016(%rbp,%rax,4), %edx
	movl	-400052(%rbp), %eax
	cmpl	%eax, %edx
	je	.L19
	movl	-400052(%rbp), %edx
	movq	-400024(%rbp), %rax
	movl	%edx, -400016(%rbp,%rax,4)
	subq	$1, -400024(%rbp)
.L7:
	cmpq	$0, -400024(%rbp)
	jns	.L9
	jmp	.L6
.L19:
	nop
.L6:
	addq	$1, -400040(%rbp)
.L4:
	movq	-400048(%rbp), %rax
	cmpq	%rax, -400040(%rbp)
	jl	.L10
	movq	$0, -400032(%rbp)
	movq	$0, -400040(%rbp)
	jmp	.L11
.L13:
	movq	-400040(%rbp), %rax
	movl	-400016(%rbp,%rax,4), %eax
	testl	%eax, %eax
	jne	.L12
	addq	$1, -400032(%rbp)
.L12:
	addq	$1, -400040(%rbp)
.L11:
	movq	-400048(%rbp), %rax
	cmpq	%rax, -400040(%rbp)
	jl	.L13
	movq	-400032(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%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	"%ld"
.LC1:
	.string	"%d"
.LC3:
	.string	"%ld\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	-397312(%rsp), %r11
	.cfi_def_cfa 11, 397368
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$2744, %rsp
	.cfi_def_cfa_offset 400112
	leaq	.LC1(%rip), %rbp
	movq	%fs:40, %rax
	movq	%rax, 400040(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	leaq	32(%rsp), %r14
	movq	%rax, 8(%rsp)
	.p2align 4,,10
	.p2align 3
.L19:
	movq	8(%rsp), %rsi
	xorl	%eax, %eax
	leaq	.LC0(%rip), %rdi
	call	__isoc99_scanf@PLT
	cmpq	$0, 24(%rsp)
	je	.L2
	jle	.L3
	movq	%r14, %r12
	movq	%r14, %r13
	leaq	20(%rsp), %rbx
	xorl	%r15d, %r15d
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L28:
	movl	20(%rsp), %eax
	movl	%eax, 0(%r13)
.L5:
	movq	24(%rsp), %rax
	addq	$1, %r15
	addq	$4, %r13
	cmpq	%r15, %rax
	jle	.L27
.L9:
	xorl	%eax, %eax
	movq	%rbx, %rsi
	movq	%rbp, %rdi
	call	__isoc99_scanf@PLT
	testb	$1, %r15b
	je	.L28
	movl	20(%rsp), %edx
	leaq	-1(%r15), %rax
	movl	%edx, 0(%r13)
	cmpl	-4(%r13), %edx
	je	.L5
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L8:
	cmpl	(%r14,%rax,4), %edx
	je	.L5
.L6:
	movl	%edx, (%r14,%rax,4)
	subq	$1, %rax
	jnb	.L8
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L27:
	testq	%rax, %rax
	jle	.L3
	leaq	-1(%rax), %rdx
	cmpq	$2, %rdx
	jbe	.L21
	movq	%rax, %rdx
	pxor	%xmm1, %xmm1
	pxor	%xmm3, %xmm3
	shrq	$2, %rdx
	salq	$4, %rdx
	addq	%r14, %rdx
	.p2align 4,,10
	.p2align 3
.L11:
	movdqa	%xmm3, %xmm0
	movdqa	%xmm3, %xmm2
	addq	$16, %r12
	pcmpeqd	-16(%r12), %xmm0
	pand	.LC2(%rip), %xmm0
	pcmpgtd	%xmm0, %xmm2
	movdqa	%xmm0, %xmm4
	punpckldq	%xmm2, %xmm4
	punpckhdq	%xmm2, %xmm0
	paddq	%xmm4, %xmm1
	paddq	%xmm0, %xmm1
	cmpq	%r12, %rdx
	jne	.L11
	movdqa	%xmm1, %xmm0
	movq	%rax, %rsi
	psrldq	$8, %xmm0
	andq	$-4, %rsi
	paddq	%xmm0, %xmm1
	movq	%xmm1, %rdx
	testb	$3, %al
	je	.L13
.L10:
	cmpl	$1, 32(%rsp,%rsi,4)
	leaq	1(%rsi), %rdi
	adcq	$0, %rdx
	cmpq	%rdi, %rax
	jle	.L13
	cmpl	$1, 32(%rsp,%rdi,4)
	adcq	$0, %rdx
	addq	$2, %rsi
	cmpq	%rsi, %rax
	jle	.L13
	cmpl	$1, 32(%rsp,%rsi,4)
	adcq	$0, %rdx
.L13:
	leaq	.LC3(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L19
.L2:
	movq	400040(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L29
	addq	$400056, %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
.L3:
	.cfi_restore_state
	xorl	%edx, %edx
	jmp	.L13
.L21:
	xorl	%edx, %edx
	xorl	%esi, %esi
	jmp	.L10
.L29:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC2:
	.long	1
	.long	1
	.long	1
	.long	1
	.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	"%ld"
.LC1:
	.string	"%d"
.LC3:
	.string	"%ld\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	-397312(%rsp), %r11
	.cfi_def_cfa 11, 397368
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$2744, %rsp
	.cfi_def_cfa_offset 400112
	leaq	.LC1(%rip), %rbp
	movq	%fs:40, %rax
	movq	%rax, 400040(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	leaq	32(%rsp), %r14
	movq	%rax, 8(%rsp)
	.p2align 4,,10
	.p2align 3
.L19:
	movq	8(%rsp), %rsi
	xorl	%eax, %eax
	leaq	.LC0(%rip), %rdi
	call	__isoc99_scanf@PLT
	cmpq	$0, 24(%rsp)
	je	.L2
	jle	.L3
	movq	%r14, %r12
	movq	%r14, %r13
	leaq	20(%rsp), %rbx
	xorl	%r15d, %r15d
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L28:
	movl	20(%rsp), %eax
	movl	%eax, 0(%r13)
.L5:
	movq	24(%rsp), %rax
	addq	$1, %r15
	addq	$4, %r13
	cmpq	%r15, %rax
	jle	.L27
.L9:
	xorl	%eax, %eax
	movq	%rbx, %rsi
	movq	%rbp, %rdi
	call	__isoc99_scanf@PLT
	testb	$1, %r15b
	je	.L28
	movl	20(%rsp), %edx
	leaq	-1(%r15), %rax
	movl	%edx, 0(%r13)
	cmpl	-4(%r13), %edx
	je	.L5
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L8:
	cmpl	(%r14,%rax,4), %edx
	je	.L5
.L6:
	movl	%edx, (%r14,%rax,4)
	subq	$1, %rax
	jnb	.L8
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L27:
	testq	%rax, %rax
	jle	.L3
	leaq	-1(%rax), %rdx
	cmpq	$2, %rdx
	jbe	.L21
	movq	%rax, %rdx
	pxor	%xmm1, %xmm1
	pxor	%xmm3, %xmm3
	shrq	$2, %rdx
	salq	$4, %rdx
	addq	%r14, %rdx
	.p2align 4,,10
	.p2align 3
.L11:
	movdqa	%xmm3, %xmm0
	movdqa	%xmm3, %xmm2
	addq	$16, %r12
	pcmpeqd	-16(%r12), %xmm0
	pand	.LC2(%rip), %xmm0
	pcmpgtd	%xmm0, %xmm2
	movdqa	%xmm0, %xmm4
	punpckldq	%xmm2, %xmm4
	punpckhdq	%xmm2, %xmm0
	paddq	%xmm4, %xmm1
	paddq	%xmm0, %xmm1
	cmpq	%r12, %rdx
	jne	.L11
	movdqa	%xmm1, %xmm0
	movq	%rax, %rsi
	psrldq	$8, %xmm0
	andq	$-4, %rsi
	paddq	%xmm0, %xmm1
	movq	%xmm1, %rdx
	testb	$3, %al
	je	.L13
.L10:
	cmpl	$1, 32(%rsp,%rsi,4)
	leaq	1(%rsi), %rdi
	adcq	$0, %rdx
	cmpq	%rdi, %rax
	jle	.L13
	cmpl	$1, 32(%rsp,%rdi,4)
	adcq	$0, %rdx
	addq	$2, %rsi
	cmpq	%rsi, %rax
	jle	.L13
	cmpl	$1, 32(%rsp,%rsi,4)
	adcq	$0, %rdx
.L13:
	leaq	.LC3(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L19
.L2:
	movq	400040(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L29
	addq	$400056, %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
.L3:
	.cfi_restore_state
	xorl	%edx, %edx
	jmp	.L13
.L21:
	xorl	%edx, %edx
	xorl	%esi, %esi
	jmp	.L10
.L29:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC2:
	.long	1
	.long	1
	.long	1
	.long	1
	.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(){
	long n,i,count,j;
	int c[100000],s;
	while(1){
		scanf("%ld",&n);
		if(n==0) break;
		for(i=0;i<n;i++){
			scanf("%d",&s);
			if(i%2==0){
				c[i]=s;
			}else{
				c[i]=s;
				if(c[i-1]==c[i]){
				}else{
					for(j=i-1;j>=0;j--){
						if(c[j]==s) break;
						c[j]=s;
					}
				}
			}
		}
		count=0;
		for(i=0;i<n;i++){
			if(c[i]==0) count++;
		}
		printf("%ld\n",count);
	}
  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>
int main(){
	long n,i,count,j;
	int c[100000],s;
	while(1){
		scanf("%ld",&n);
		if(n==0) break;
		for(i=0;i<n;i++){
			scanf("%d",&s);
			if(i%2==0){
				c[i]=s;
			}else{
				c[i]=s;
				if(c[i-1]==c[i]){
				}else{
					for(j=i-1;j>=0;j--){
						if(c[j]==s) break;
						c[j]=s;
					}
				}
			}
		}
		count=0;
		for(i=0;i<n;i++){
			if(c[i]==0) count++;
		}
		printf("%ld\n",count);
	}
  return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%ld"
.LC1:
	.string	"%d"
.LC2:
	.string	"%ld\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	-397312(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$2752, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L14:
	leaq	-400048(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-400048(%rbp), %rax
	testq	%rax, %rax
	je	.L18
	movq	$0, -400040(%rbp)
	jmp	.L4
.L10:
	leaq	-400052(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-400040(%rbp), %rax
	andl	$1, %eax
	testq	%rax, %rax
	jne	.L5
	movl	-400052(%rbp), %edx
	movq	-400040(%rbp), %rax
	movl	%edx, -400016(%rbp,%rax,4)
	jmp	.L6
.L5:
	movl	-400052(%rbp), %edx
	movq	-400040(%rbp), %rax
	movl	%edx, -400016(%rbp,%rax,4)
	movq	-400040(%rbp), %rax
	subq	$1, %rax
	movl	-400016(%rbp,%rax,4), %edx
	movq	-400040(%rbp), %rax
	movl	-400016(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	je	.L6
	movq	-400040(%rbp), %rax
	subq	$1, %rax
	movq	%rax, -400024(%rbp)
	jmp	.L7
.L9:
	movq	-400024(%rbp), %rax
	movl	-400016(%rbp,%rax,4), %edx
	movl	-400052(%rbp), %eax
	cmpl	%eax, %edx
	je	.L19
	movl	-400052(%rbp), %edx
	movq	-400024(%rbp), %rax
	movl	%edx, -400016(%rbp,%rax,4)
	subq	$1, -400024(%rbp)
.L7:
	cmpq	$0, -400024(%rbp)
	jns	.L9
	jmp	.L6
.L19:
	nop
.L6:
	addq	$1, -400040(%rbp)
.L4:
	movq	-400048(%rbp), %rax
	cmpq	%rax, -400040(%rbp)
	jl	.L10
	movq	$0, -400032(%rbp)
	movq	$0, -400040(%rbp)
	jmp	.L11
.L13:
	movq	-400040(%rbp), %rax
	movl	-400016(%rbp,%rax,4), %eax
	testl	%eax, %eax
	jne	.L12
	addq	$1, -400032(%rbp)
.L12:
	addq	$1, -400040(%rbp)
.L11:
	movq	-400048(%rbp), %rax
	cmpq	%rax, -400040(%rbp)
	jl	.L13
	movq	-400032(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%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
	.section	.rodata
.LC0:
	.string	"%ld"
.LC1:
	.string	"%d"
.LC2:
	.string	"%ld\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	-397312(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$2752, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L14:
	leaq	-400048(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-400048(%rbp), %rax
	testq	%rax, %rax
	je	.L18
	movq	$0, -400040(%rbp)
	jmp	.L4
.L10:
	leaq	-400052(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-400040(%rbp), %rax
	andl	$1, %eax
	testq	%rax, %rax
	jne	.L5
	movl	-400052(%rbp), %edx
	movq	-400040(%rbp), %rax
	movl	%edx, -400016(%rbp,%rax,4)
	jmp	.L6
.L5:
	movl	-400052(%rbp), %edx
	movq	-400040(%rbp), %rax
	movl	%edx, -400016(%rbp,%rax,4)
	movq	-400040(%rbp), %rax
	subq	$1, %rax
	movl	-400016(%rbp,%rax,4), %edx
	movq	-400040(%rbp), %rax
	movl	-400016(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	je	.L6
	movq	-400040(%rbp), %rax
	subq	$1, %rax
	movq	%rax, -400024(%rbp)
	jmp	.L7
.L9:
	movq	-400024(%rbp), %rax
	movl	-400016(%rbp,%rax,4), %edx
	movl	-400052(%rbp), %eax
	cmpl	%eax, %edx
	je	.L19
	movl	-400052(%rbp), %edx
	movq	-400024(%rbp), %rax
	movl	%edx, -400016(%rbp,%rax,4)
	subq	$1, -400024(%rbp)
.L7:
	cmpq	$0, -400024(%rbp)
	jns	.L9
	jmp	.L6
.L19:
	nop
.L6:
	addq	$1, -400040(%rbp)
.L4:
	movq	-400048(%rbp), %rax
	cmpq	%rax, -400040(%rbp)
	jl	.L10
	movq	$0, -400032(%rbp)
	movq	$0, -400040(%rbp)
	jmp	.L11
.L13:
	movq	-400040(%rbp), %rax
	movl	-400016(%rbp,%rax,4), %eax
	testl	%eax, %eax
	jne	.L12
	addq	$1, -400032(%rbp)
.L12:
	addq	$1, -400040(%rbp)
.L11:
	movq	-400048(%rbp), %rax
	cmpq	%rax, -400040(%rbp)
	jl	.L13
	movq	-400032(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%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:
