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(void){
	int stone[100000];
	int num[100000];
	int pos = 0;
	int n;
	int i;
	int d;

	while(scanf("%d",&n) && n){
		scanf("%d",&d);
		stone[pos] = d;
		num[pos] = 1;

		for(i=1;i<n;i++){
			scanf("%d",&d);
			if(stone[pos]==d){
				num[pos]++;
			}else{
				if((i+1) & 0x0001){
					//奇数
					pos++;
					stone[pos]=d;
					num[pos]=1;
				}else{
					//偶数
					if(pos>0){
						if(stone[pos-1]!=stone[pos]){
							num[pos]++;
							num[pos-1]+=num[pos];
							pos--;
						}else{
							stone[pos]=d;
							num[pos]++;
						}
					}else{
						stone[pos]=d;
						num[pos]++;
					}
				}
			}
		}
		
		d=0;
		for(i=0;i<=pos;i++){
			if(stone[i]==0){
				d+=num[i];
			}
		}
		printf("%d\n",d);
		
		pos=0;
	}
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.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
	leaq	-798720(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$1312, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -800024(%rbp)
	jmp	.L2
.L14:
	leaq	-800028(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-800028(%rbp), %edx
	movl	-800024(%rbp), %eax
	cltq
	movl	%edx, -800016(%rbp,%rax,4)
	movl	-800024(%rbp), %eax
	cltq
	movl	$1, -400016(%rbp,%rax,4)
	movl	$1, -800020(%rbp)
	jmp	.L3
.L9:
	leaq	-800028(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-800024(%rbp), %eax
	cltq
	movl	-800016(%rbp,%rax,4), %edx
	movl	-800028(%rbp), %eax
	cmpl	%eax, %edx
	jne	.L4
	movl	-800024(%rbp), %eax
	cltq
	movl	-400016(%rbp,%rax,4), %eax
	leal	1(%rax), %edx
	movl	-800024(%rbp), %eax
	cltq
	movl	%edx, -400016(%rbp,%rax,4)
	jmp	.L5
.L4:
	movl	-800020(%rbp), %eax
	addl	$1, %eax
	andl	$1, %eax
	testl	%eax, %eax
	je	.L6
	addl	$1, -800024(%rbp)
	movl	-800028(%rbp), %edx
	movl	-800024(%rbp), %eax
	cltq
	movl	%edx, -800016(%rbp,%rax,4)
	movl	-800024(%rbp), %eax
	cltq
	movl	$1, -400016(%rbp,%rax,4)
	jmp	.L5
.L6:
	cmpl	$0, -800024(%rbp)
	jle	.L7
	movl	-800024(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-800016(%rbp,%rax,4), %edx
	movl	-800024(%rbp), %eax
	cltq
	movl	-800016(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	je	.L8
	movl	-800024(%rbp), %eax
	cltq
	movl	-400016(%rbp,%rax,4), %eax
	leal	1(%rax), %edx
	movl	-800024(%rbp), %eax
	cltq
	movl	%edx, -400016(%rbp,%rax,4)
	movl	-800024(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-400016(%rbp,%rax,4), %ecx
	movl	-800024(%rbp), %eax
	cltq
	movl	-400016(%rbp,%rax,4), %edx
	movl	-800024(%rbp), %eax
	subl	$1, %eax
	addl	%ecx, %edx
	cltq
	movl	%edx, -400016(%rbp,%rax,4)
	subl	$1, -800024(%rbp)
	jmp	.L5
.L8:
	movl	-800028(%rbp), %edx
	movl	-800024(%rbp), %eax
	cltq
	movl	%edx, -800016(%rbp,%rax,4)
	movl	-800024(%rbp), %eax
	cltq
	movl	-400016(%rbp,%rax,4), %eax
	leal	1(%rax), %edx
	movl	-800024(%rbp), %eax
	cltq
	movl	%edx, -400016(%rbp,%rax,4)
	jmp	.L5
.L7:
	movl	-800028(%rbp), %edx
	movl	-800024(%rbp), %eax
	cltq
	movl	%edx, -800016(%rbp,%rax,4)
	movl	-800024(%rbp), %eax
	cltq
	movl	-400016(%rbp,%rax,4), %eax
	leal	1(%rax), %edx
	movl	-800024(%rbp), %eax
	cltq
	movl	%edx, -400016(%rbp,%rax,4)
.L5:
	addl	$1, -800020(%rbp)
.L3:
	movl	-800032(%rbp), %eax
	cmpl	%eax, -800020(%rbp)
	jl	.L9
	movl	$0, -800028(%rbp)
	movl	$0, -800020(%rbp)
	jmp	.L10
.L12:
	movl	-800020(%rbp), %eax
	cltq
	movl	-800016(%rbp,%rax,4), %eax
	testl	%eax, %eax
	jne	.L11
	movl	-800020(%rbp), %eax
	cltq
	movl	-400016(%rbp,%rax,4), %edx
	movl	-800028(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -800028(%rbp)
.L11:
	addl	$1, -800020(%rbp)
.L10:
	movl	-800020(%rbp), %eax
	cmpl	-800024(%rbp), %eax
	jle	.L12
	movl	-800028(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, -800024(%rbp)
.L2:
	leaq	-800032(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	testl	%eax, %eax
	je	.L13
	movl	-800032(%rbp), %eax
	testl	%eax, %eax
	jne	.L14
.L13:
	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"
.LC1:
	.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	-798720(%rsp), %r11
	.cfi_def_cfa 11, 798776
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$1320, %rsp
	.cfi_def_cfa_offset 800096
	leaq	.LC0(%rip), %rbp
	movq	%fs:40, %rax
	movq	%rax, 800024(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %r13
	leaq	12(%rsp), %r12
	.p2align 4,,10
	.p2align 3
.L2:
	xorl	%eax, %eax
	movq	%r13, %rsi
	movq	%rbp, %rdi
	call	__isoc99_scanf@PLT
	testl	%eax, %eax
	je	.L13
	movl	8(%rsp), %eax
	testl	%eax, %eax
	je	.L13
	xorl	%eax, %eax
	movq	%r12, %rsi
	movq	%rbp, %rdi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	cmpl	$1, 8(%rsp)
	movl	$1, 400016(%rsp)
	movl	%eax, 16(%rsp)
	jle	.L16
	movl	$1, %ebx
	xorl	%r15d, %r15d
	xorl	%r14d, %r14d
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L4:
	testb	$1, %bl
	je	.L6
	addl	$1, %r15d
	movslq	%r15d, %r14
	movl	%eax, 16(%rsp,%r14,4)
	movl	$1, 400016(%rsp,%r14,4)
.L5:
	cmpl	%ebx, 8(%rsp)
	jle	.L3
.L9:
	movq	%r12, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	16(%rsp,%r14,4), %ecx
	movl	12(%rsp), %eax
	cmpl	%eax, %ecx
	jne	.L4
	addl	$1, 400016(%rsp,%r14,4)
	cmpl	%ebx, 8(%rsp)
	jg	.L9
.L3:
	movl	$0, 12(%rsp)
	xorl	%eax, %eax
	xorl	%edi, %edi
	xorl	%edx, %edx
	leaq	4(,%r14,4), %rsi
	leaq	16(%rsp), %rcx
	.p2align 4,,10
	.p2align 3
.L11:
	movl	(%rcx,%rax), %r8d
	testl	%r8d, %r8d
	jne	.L10
	addl	400016(%rsp,%rax), %edx
	movl	$1, %edi
.L10:
	addq	$4, %rax
	cmpq	%rax, %rsi
	jne	.L11
	testb	%dil, %dil
	je	.L17
	movl	%edx, 12(%rsp)
.L12:
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L6:
	testl	%r15d, %r15d
	je	.L7
	movl	400016(%rsp,%r14,4), %edx
	leal	-1(%r15), %r8d
	movslq	%r8d, %rdi
	leal	1(%rdx), %esi
	cmpl	16(%rsp,%rdi,4), %ecx
	je	.L8
	movl	%esi, 400016(%rsp,%r14,4)
	movl	%r8d, %r15d
	movq	%rdi, %r14
	addl	%esi, 400016(%rsp,%rdi,4)
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L7:
	addl	$1, 400016(%rsp)
	movl	%eax, 16(%rsp)
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L8:
	movl	%eax, 16(%rsp,%r14,4)
	movl	%esi, 400016(%rsp,%r14,4)
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L17:
	xorl	%edx, %edx
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L13:
	movq	800024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L25
	addq	$800040, %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
.L16:
	.cfi_restore_state
	xorl	%r14d, %r14d
	jmp	.L3
.L25:
	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	"%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	-798720(%rsp), %r11
	.cfi_def_cfa 11, 798776
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$1320, %rsp
	.cfi_def_cfa_offset 800096
	leaq	.LC0(%rip), %rbp
	movq	%fs:40, %rax
	movq	%rax, 800024(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %r13
	leaq	12(%rsp), %r12
	.p2align 4,,10
	.p2align 3
.L2:
	xorl	%eax, %eax
	movq	%r13, %rsi
	movq	%rbp, %rdi
	call	__isoc99_scanf@PLT
	testl	%eax, %eax
	je	.L13
	movl	8(%rsp), %eax
	testl	%eax, %eax
	je	.L13
	xorl	%eax, %eax
	movq	%r12, %rsi
	movq	%rbp, %rdi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	cmpl	$1, 8(%rsp)
	movl	$1, 400016(%rsp)
	movl	%eax, 16(%rsp)
	jle	.L16
	movl	$1, %ebx
	xorl	%r15d, %r15d
	xorl	%r14d, %r14d
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L4:
	testb	$1, %bl
	je	.L6
	addl	$1, %r15d
	movslq	%r15d, %r14
	movl	%eax, 16(%rsp,%r14,4)
	movl	$1, 400016(%rsp,%r14,4)
.L5:
	cmpl	%ebx, 8(%rsp)
	jle	.L3
.L9:
	movq	%r12, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	16(%rsp,%r14,4), %ecx
	movl	12(%rsp), %eax
	cmpl	%eax, %ecx
	jne	.L4
	addl	$1, 400016(%rsp,%r14,4)
	cmpl	%ebx, 8(%rsp)
	jg	.L9
.L3:
	movl	$0, 12(%rsp)
	xorl	%eax, %eax
	xorl	%edi, %edi
	xorl	%edx, %edx
	leaq	4(,%r14,4), %rsi
	leaq	16(%rsp), %rcx
	.p2align 4,,10
	.p2align 3
.L11:
	movl	(%rcx,%rax), %r8d
	testl	%r8d, %r8d
	jne	.L10
	addl	400016(%rsp,%rax), %edx
	movl	$1, %edi
.L10:
	addq	$4, %rax
	cmpq	%rax, %rsi
	jne	.L11
	testb	%dil, %dil
	je	.L17
	movl	%edx, 12(%rsp)
.L12:
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L6:
	testl	%r15d, %r15d
	je	.L7
	movl	400016(%rsp,%r14,4), %edx
	leal	-1(%r15), %r8d
	movslq	%r8d, %rdi
	leal	1(%rdx), %esi
	cmpl	16(%rsp,%rdi,4), %ecx
	je	.L8
	movl	%esi, 400016(%rsp,%r14,4)
	movl	%r8d, %r15d
	movq	%rdi, %r14
	addl	%esi, 400016(%rsp,%rdi,4)
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L7:
	addl	$1, 400016(%rsp)
	movl	%eax, 16(%rsp)
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L8:
	movl	%eax, 16(%rsp,%r14,4)
	movl	%esi, 400016(%rsp,%r14,4)
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L17:
	xorl	%edx, %edx
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L13:
	movq	800024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L25
	addq	$800040, %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
.L16:
	.cfi_restore_state
	xorl	%r14d, %r14d
	jmp	.L3
.L25:
	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(void){
	int stone[100000];
	int num[100000];
	int pos = 0;
	int n;
	int i;
	int d;

	while(scanf("%d",&n) && n){
		scanf("%d",&d);
		stone[pos] = d;
		num[pos] = 1;

		for(i=1;i<n;i++){
			scanf("%d",&d);
			if(stone[pos]==d){
				num[pos]++;
			}else{
				if((i+1) & 0x0001){
					//奇数
					pos++;
					stone[pos]=d;
					num[pos]=1;
				}else{
					//偶数
					if(pos>0){
						if(stone[pos-1]!=stone[pos]){
							num[pos]++;
							num[pos-1]+=num[pos];
							pos--;
						}else{
							stone[pos]=d;
							num[pos]++;
						}
					}else{
						stone[pos]=d;
						num[pos]++;
					}
				}
			}
		}
		
		d=0;
		for(i=0;i<=pos;i++){
			if(stone[i]==0){
				d+=num[i];
			}
		}
		printf("%d\n",d);
		
		pos=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(void){
	int stone[100000];
	int num[100000];
	int pos = 0;
	int n;
	int i;
	int d;

	while(scanf("%d",&n) && n){
		scanf("%d",&d);
		stone[pos] = d;
		num[pos] = 1;

		for(i=1;i<n;i++){
			scanf("%d",&d);
			if(stone[pos]==d){
				num[pos]++;
			}else{
				if((i+1) & 0x0001){
					//奇数
					pos++;
					stone[pos]=d;
					num[pos]=1;
				}else{
					//偶数
					if(pos>0){
						if(stone[pos-1]!=stone[pos]){
							num[pos]++;
							num[pos-1]+=num[pos];
							pos--;
						}else{
							stone[pos]=d;
							num[pos]++;
						}
					}else{
						stone[pos]=d;
						num[pos]++;
					}
				}
			}
		}
		
		d=0;
		for(i=0;i<=pos;i++){
			if(stone[i]==0){
				d+=num[i];
			}
		}
		printf("%d\n",d);
		
		pos=0;
	}
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.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
	leaq	-798720(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$1312, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -800024(%rbp)
	jmp	.L2
.L14:
	leaq	-800028(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-800028(%rbp), %edx
	movl	-800024(%rbp), %eax
	cltq
	movl	%edx, -800016(%rbp,%rax,4)
	movl	-800024(%rbp), %eax
	cltq
	movl	$1, -400016(%rbp,%rax,4)
	movl	$1, -800020(%rbp)
	jmp	.L3
.L9:
	leaq	-800028(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-800024(%rbp), %eax
	cltq
	movl	-800016(%rbp,%rax,4), %edx
	movl	-800028(%rbp), %eax
	cmpl	%eax, %edx
	jne	.L4
	movl	-800024(%rbp), %eax
	cltq
	movl	-400016(%rbp,%rax,4), %eax
	leal	1(%rax), %edx
	movl	-800024(%rbp), %eax
	cltq
	movl	%edx, -400016(%rbp,%rax,4)
	jmp	.L5
.L4:
	movl	-800020(%rbp), %eax
	addl	$1, %eax
	andl	$1, %eax
	testl	%eax, %eax
	je	.L6
	addl	$1, -800024(%rbp)
	movl	-800028(%rbp), %edx
	movl	-800024(%rbp), %eax
	cltq
	movl	%edx, -800016(%rbp,%rax,4)
	movl	-800024(%rbp), %eax
	cltq
	movl	$1, -400016(%rbp,%rax,4)
	jmp	.L5
.L6:
	cmpl	$0, -800024(%rbp)
	jle	.L7
	movl	-800024(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-800016(%rbp,%rax,4), %edx
	movl	-800024(%rbp), %eax
	cltq
	movl	-800016(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	je	.L8
	movl	-800024(%rbp), %eax
	cltq
	movl	-400016(%rbp,%rax,4), %eax
	leal	1(%rax), %edx
	movl	-800024(%rbp), %eax
	cltq
	movl	%edx, -400016(%rbp,%rax,4)
	movl	-800024(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-400016(%rbp,%rax,4), %ecx
	movl	-800024(%rbp), %eax
	cltq
	movl	-400016(%rbp,%rax,4), %edx
	movl	-800024(%rbp), %eax
	subl	$1, %eax
	addl	%ecx, %edx
	cltq
	movl	%edx, -400016(%rbp,%rax,4)
	subl	$1, -800024(%rbp)
	jmp	.L5
.L8:
	movl	-800028(%rbp), %edx
	movl	-800024(%rbp), %eax
	cltq
	movl	%edx, -800016(%rbp,%rax,4)
	movl	-800024(%rbp), %eax
	cltq
	movl	-400016(%rbp,%rax,4), %eax
	leal	1(%rax), %edx
	movl	-800024(%rbp), %eax
	cltq
	movl	%edx, -400016(%rbp,%rax,4)
	jmp	.L5
.L7:
	movl	-800028(%rbp), %edx
	movl	-800024(%rbp), %eax
	cltq
	movl	%edx, -800016(%rbp,%rax,4)
	movl	-800024(%rbp), %eax
	cltq
	movl	-400016(%rbp,%rax,4), %eax
	leal	1(%rax), %edx
	movl	-800024(%rbp), %eax
	cltq
	movl	%edx, -400016(%rbp,%rax,4)
.L5:
	addl	$1, -800020(%rbp)
.L3:
	movl	-800032(%rbp), %eax
	cmpl	%eax, -800020(%rbp)
	jl	.L9
	movl	$0, -800028(%rbp)
	movl	$0, -800020(%rbp)
	jmp	.L10
.L12:
	movl	-800020(%rbp), %eax
	cltq
	movl	-800016(%rbp,%rax,4), %eax
	testl	%eax, %eax
	jne	.L11
	movl	-800020(%rbp), %eax
	cltq
	movl	-400016(%rbp,%rax,4), %edx
	movl	-800028(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -800028(%rbp)
.L11:
	addl	$1, -800020(%rbp)
.L10:
	movl	-800020(%rbp), %eax
	cmpl	-800024(%rbp), %eax
	jle	.L12
	movl	-800028(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, -800024(%rbp)
.L2:
	leaq	-800032(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	testl	%eax, %eax
	je	.L13
	movl	-800032(%rbp), %eax
	testl	%eax, %eax
	jne	.L14
.L13:
	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	"%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
	leaq	-798720(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$1312, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -800024(%rbp)
	jmp	.L2
.L14:
	leaq	-800028(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-800028(%rbp), %edx
	movl	-800024(%rbp), %eax
	cltq
	movl	%edx, -800016(%rbp,%rax,4)
	movl	-800024(%rbp), %eax
	cltq
	movl	$1, -400016(%rbp,%rax,4)
	movl	$1, -800020(%rbp)
	jmp	.L3
.L9:
	leaq	-800028(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-800024(%rbp), %eax
	cltq
	movl	-800016(%rbp,%rax,4), %edx
	movl	-800028(%rbp), %eax
	cmpl	%eax, %edx
	jne	.L4
	movl	-800024(%rbp), %eax
	cltq
	movl	-400016(%rbp,%rax,4), %eax
	leal	1(%rax), %edx
	movl	-800024(%rbp), %eax
	cltq
	movl	%edx, -400016(%rbp,%rax,4)
	jmp	.L5
.L4:
	movl	-800020(%rbp), %eax
	addl	$1, %eax
	andl	$1, %eax
	testl	%eax, %eax
	je	.L6
	addl	$1, -800024(%rbp)
	movl	-800028(%rbp), %edx
	movl	-800024(%rbp), %eax
	cltq
	movl	%edx, -800016(%rbp,%rax,4)
	movl	-800024(%rbp), %eax
	cltq
	movl	$1, -400016(%rbp,%rax,4)
	jmp	.L5
.L6:
	cmpl	$0, -800024(%rbp)
	jle	.L7
	movl	-800024(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-800016(%rbp,%rax,4), %edx
	movl	-800024(%rbp), %eax
	cltq
	movl	-800016(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	je	.L8
	movl	-800024(%rbp), %eax
	cltq
	movl	-400016(%rbp,%rax,4), %eax
	leal	1(%rax), %edx
	movl	-800024(%rbp), %eax
	cltq
	movl	%edx, -400016(%rbp,%rax,4)
	movl	-800024(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-400016(%rbp,%rax,4), %ecx
	movl	-800024(%rbp), %eax
	cltq
	movl	-400016(%rbp,%rax,4), %edx
	movl	-800024(%rbp), %eax
	subl	$1, %eax
	addl	%ecx, %edx
	cltq
	movl	%edx, -400016(%rbp,%rax,4)
	subl	$1, -800024(%rbp)
	jmp	.L5
.L8:
	movl	-800028(%rbp), %edx
	movl	-800024(%rbp), %eax
	cltq
	movl	%edx, -800016(%rbp,%rax,4)
	movl	-800024(%rbp), %eax
	cltq
	movl	-400016(%rbp,%rax,4), %eax
	leal	1(%rax), %edx
	movl	-800024(%rbp), %eax
	cltq
	movl	%edx, -400016(%rbp,%rax,4)
	jmp	.L5
.L7:
	movl	-800028(%rbp), %edx
	movl	-800024(%rbp), %eax
	cltq
	movl	%edx, -800016(%rbp,%rax,4)
	movl	-800024(%rbp), %eax
	cltq
	movl	-400016(%rbp,%rax,4), %eax
	leal	1(%rax), %edx
	movl	-800024(%rbp), %eax
	cltq
	movl	%edx, -400016(%rbp,%rax,4)
.L5:
	addl	$1, -800020(%rbp)
.L3:
	movl	-800032(%rbp), %eax
	cmpl	%eax, -800020(%rbp)
	jl	.L9
	movl	$0, -800028(%rbp)
	movl	$0, -800020(%rbp)
	jmp	.L10
.L12:
	movl	-800020(%rbp), %eax
	cltq
	movl	-800016(%rbp,%rax,4), %eax
	testl	%eax, %eax
	jne	.L11
	movl	-800020(%rbp), %eax
	cltq
	movl	-400016(%rbp,%rax,4), %edx
	movl	-800028(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -800028(%rbp)
.L11:
	addl	$1, -800020(%rbp)
.L10:
	movl	-800020(%rbp), %eax
	cmpl	-800024(%rbp), %eax
	jle	.L12
	movl	-800028(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, -800024(%rbp)
.L2:
	leaq	-800032(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	testl	%eax, %eax
	je	.L13
	movl	-800032(%rbp), %eax
	testl	%eax, %eax
	jne	.L14
.L13:
	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:
