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

```c
#include <stdio.h>

int main(){
	int Go[100000];
	int i,j,k;
	int n;
	int sum;
	
	while(1){
		scanf("%d\n",&n);
		if(n==0)break;
		for(i=0;i<n;i++){
			scanf("%d\n",&Go[i]);
			if(i%2&&Go[i]^Go[i-1]){
				for(k=i-1;k>=0;k--){
					if(Go[k]==Go[i])break;
					Go[k]=Go[i];
				}
			}
		}
		sum=0;
		for(i=0;i<n;i++)sum+=Go[i];
		printf("%d\n",n-sum);
	}
	return 0;
}```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.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	-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	.LC0(%rip), %r12
	movq	%fs:40, %rax
	movq	%rax, 400040(%rsp)
	xorl	%eax, %eax
	leaq	28(%rsp), %rax
	leaq	32(%rsp), %r13
	movq	%rax, 8(%rsp)
	.p2align 4,,10
	.p2align 3
.L14:
	movq	8(%rsp), %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	28(%rsp), %edx
	testl	%edx, %edx
	je	.L2
	jle	.L4
	movq	%r13, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	movq	%r13, %rbp
	call	__isoc99_scanf@PLT
	movl	28(%rsp), %edx
	xorl	%r15d, %r15d
	movl	$1, %r14d
	cmpl	$1, %edx
	jg	.L6
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L8:
	addq	$1, %r15
	movl	28(%rsp), %edx
	leal	1(%r15), %r14d
	cmpl	%r14d, %edx
	jle	.L7
.L6:
	movq	%rbp, %rbx
	addq	$4, %rbp
	xorl	%eax, %eax
	movq	%r12, %rdi
	movq	%rbp, %rsi
	call	__isoc99_scanf@PLT
	andl	$1, %r14d
	je	.L8
	movl	4(%rbx), %eax
	movq	%rbx, %rcx
	cmpl	(%rbx), %eax
	je	.L8
	leaq	0(,%r15,4), %rdx
	movq	%rbx, %rsi
	subq	%rdx, %rsi
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L10:
	movl	4(%rcx), %eax
	subq	$4, %rbx
	cmpl	%eax, -4(%rdx)
	je	.L8
.L9:
	movl	%eax, (%rbx)
	movq	%rbx, %rdx
	cmpq	%rsi, %rbx
	jne	.L10
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L7:
	testl	%edx, %edx
	jle	.L4
	leal	-1(%rdx), %eax
	cmpl	$2, %eax
	jbe	.L17
	movl	%edx, %ecx
	movq	%r13, %rax
	pxor	%xmm0, %xmm0
	shrl	$2, %ecx
	subl	$1, %ecx
	salq	$4, %rcx
	leaq	48(%rsp,%rcx), %rcx
	.p2align 4,,10
	.p2align 3
.L12:
	paddd	(%rax), %xmm0
	addq	$16, %rax
	cmpq	%rcx, %rax
	jne	.L12
	movdqa	%xmm0, %xmm1
	movl	%edx, %ecx
	psrldq	$8, %xmm1
	andl	$-4, %ecx
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %eax
	testb	$3, %dl
	je	.L13
.L11:
	movslq	%ecx, %rsi
	addl	32(%rsp,%rsi,4), %eax
	leal	1(%rcx), %esi
	cmpl	%edx, %esi
	jge	.L13
	movslq	%esi, %rsi
	addl	$2, %ecx
	addl	32(%rsp,%rsi,4), %eax
	cmpl	%ecx, %edx
	jle	.L13
	movslq	%ecx, %rcx
	addl	32(%rsp,%rcx,4), %eax
.L13:
	subl	%eax, %edx
.L4:
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L14
.L2:
	movq	400040(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L24
	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
.L17:
	.cfi_restore_state
	xorl	%eax, %eax
	xorl	%ecx, %ecx
	jmp	.L11
.L24:
	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:
```

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.
Optimized Assembly Code:

user
```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.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	-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	.LC0(%rip), %r12
	movq	%fs:40, %rax
	movq	%rax, 400040(%rsp)
	xorl	%eax, %eax
	leaq	28(%rsp), %rax
	leaq	32(%rsp), %r13
	movq	%rax, 8(%rsp)
	.p2align 4,,10
	.p2align 3
.L14:
	movq	8(%rsp), %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	28(%rsp), %edx
	testl	%edx, %edx
	je	.L2
	jle	.L4
	movq	%r13, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	movq	%r13, %rbp
	call	__isoc99_scanf@PLT
	movl	28(%rsp), %edx
	xorl	%r15d, %r15d
	movl	$1, %r14d
	cmpl	$1, %edx
	jg	.L6
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L8:
	addq	$1, %r15
	movl	28(%rsp), %edx
	leal	1(%r15), %r14d
	cmpl	%r14d, %edx
	jle	.L7
.L6:
	movq	%rbp, %rbx
	addq	$4, %rbp
	xorl	%eax, %eax
	movq	%r12, %rdi
	movq	%rbp, %rsi
	call	__isoc99_scanf@PLT
	andl	$1, %r14d
	je	.L8
	movl	4(%rbx), %eax
	movq	%rbx, %rcx
	cmpl	(%rbx), %eax
	je	.L8
	leaq	0(,%r15,4), %rdx
	movq	%rbx, %rsi
	subq	%rdx, %rsi
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L10:
	movl	4(%rcx), %eax
	subq	$4, %rbx
	cmpl	%eax, -4(%rdx)
	je	.L8
.L9:
	movl	%eax, (%rbx)
	movq	%rbx, %rdx
	cmpq	%rsi, %rbx
	jne	.L10
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L7:
	testl	%edx, %edx
	jle	.L4
	leal	-1(%rdx), %eax
	cmpl	$2, %eax
	jbe	.L17
	movl	%edx, %ecx
	movq	%r13, %rax
	pxor	%xmm0, %xmm0
	shrl	$2, %ecx
	subl	$1, %ecx
	salq	$4, %rcx
	leaq	48(%rsp,%rcx), %rcx
	.p2align 4,,10
	.p2align 3
.L12:
	paddd	(%rax), %xmm0
	addq	$16, %rax
	cmpq	%rcx, %rax
	jne	.L12
	movdqa	%xmm0, %xmm1
	movl	%edx, %ecx
	psrldq	$8, %xmm1
	andl	$-4, %ecx
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %eax
	testb	$3, %dl
	je	.L13
.L11:
	movslq	%ecx, %rsi
	addl	32(%rsp,%rsi,4), %eax
	leal	1(%rcx), %esi
	cmpl	%edx, %esi
	jge	.L13
	movslq	%esi, %rsi
	addl	$2, %ecx
	addl	32(%rsp,%rsi,4), %eax
	cmpl	%ecx, %edx
	jle	.L13
	movslq	%ecx, %rcx
	addl	32(%rsp,%rcx,4), %eax
.L13:
	subl	%eax, %edx
.L4:
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L14
.L2:
	movq	400040(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L24
	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
.L17:
	.cfi_restore_state
	xorl	%eax, %eax
	xorl	%ecx, %ecx
	jmp	.L11
.L24:
	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
```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.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	-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	.LC0(%rip), %r12
	movq	%fs:40, %rax
	movq	%rax, 400040(%rsp)
	xorl	%eax, %eax
	leaq	28(%rsp), %rax
	leaq	32(%rsp), %r13
	movq	%rax, 8(%rsp)
	.p2align 4,,10
	.p2align 3
.L14:
	movq	8(%rsp), %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	28(%rsp), %edx
	testl	%edx, %edx
	je	.L2
	jle	.L4
	movq	%r13, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	movq	%r13, %rbp
	call	__isoc99_scanf@PLT
	movl	28(%rsp), %edx
	xorl	%r15d, %r15d
	movl	$1, %r14d
	cmpl	$1, %edx
	jg	.L6
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L8:
	addq	$1, %r15
	movl	28(%rsp), %edx
	leal	1(%r15), %r14d
	cmpl	%r14d, %edx
	jle	.L7
.L6:
	movq	%rbp, %rbx
	addq	$4, %rbp
	xorl	%eax, %eax
	movq	%r12, %rdi
	movq	%rbp, %rsi
	call	__isoc99_scanf@PLT
	andl	$1, %r14d
	je	.L8
	movl	4(%rbx), %eax
	movq	%rbx, %rcx
	cmpl	(%rbx), %eax
	je	.L8
	leaq	0(,%r15,4), %rdx
	movq	%rbx, %rsi
	subq	%rdx, %rsi
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L10:
	movl	4(%rcx), %eax
	subq	$4, %rbx
	cmpl	%eax, -4(%rdx)
	je	.L8
.L9:
	movl	%eax, (%rbx)
	movq	%rbx, %rdx
	cmpq	%rsi, %rbx
	jne	.L10
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L7:
	testl	%edx, %edx
	jle	.L4
	leal	-1(%rdx), %eax
	cmpl	$2, %eax
	jbe	.L17
	movl	%edx, %ecx
	movq	%r13, %rax
	pxor	%xmm0, %xmm0
	shrl	$2, %ecx
	subl	$1, %ecx
	salq	$4, %rcx
	leaq	48(%rsp,%rcx), %rcx
	.p2align 4,,10
	.p2align 3
.L12:
	paddd	(%rax), %xmm0
	addq	$16, %rax
	cmpq	%rcx, %rax
	jne	.L12
	movdqa	%xmm0, %xmm1
	movl	%edx, %ecx
	psrldq	$8, %xmm1
	andl	$-4, %ecx
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %eax
	testb	$3, %dl
	je	.L13
.L11:
	movslq	%ecx, %rsi
	addl	32(%rsp,%rsi,4), %eax
	leal	1(%rcx), %esi
	cmpl	%edx, %esi
	jge	.L13
	movslq	%esi, %rsi
	addl	$2, %ecx
	addl	32(%rsp,%rsi,4), %eax
	cmpl	%ecx, %edx
	jle	.L13
	movslq	%ecx, %rcx
	addl	32(%rsp,%rcx,4), %eax
.L13:
	subl	%eax, %edx
.L4:
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L14
.L2:
	movq	400040(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L24
	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
.L17:
	.cfi_restore_state
	xorl	%eax, %eax
	xorl	%ecx, %ecx
	jmp	.L11
.L24:
	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:
```
```c
#include <stdio.h>

int main(){
	int Go[100000];
	int i,j,k;
	int n;
	int sum;
	
	while(1){
		scanf("%d\n",&n);
		if(n==0)break;
		for(i=0;i<n;i++){
			scanf("%d\n",&Go[i]);
			if(i%2&&Go[i]^Go[i-1]){
				for(k=i-1;k>=0;k--){
					if(Go[k]==Go[i])break;
					Go[k]=Go[i];
				}
			}
		}
		sum=0;
		for(i=0;i<n;i++)sum+=Go[i];
		printf("%d\n",n-sum);
	}
	return 0;
}```
Given the following C code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include <stdio.h>

int main(){
	int Go[100000];
	int i,j,k;
	int n;
	int sum;
	
	while(1){
		scanf("%d\n",&n);
		if(n==0)break;
		for(i=0;i<n;i++){
			scanf("%d\n",&Go[i]);
			if(i%2&&Go[i]^Go[i-1]){
				for(k=i-1;k>=0;k--){
					if(Go[k]==Go[i])break;
					Go[k]=Go[i];
				}
			}
		}
		sum=0;
		for(i=0;i<n;i++)sum+=Go[i];
		printf("%d\n",n-sum);
	}
	return 0;
}```

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.
Optimized Assembly Code:

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 assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include <stdio.h>

int main(){
	int Go[100000];
	int i,j,k;
	int n;
	int sum;
	
	while(1){
		scanf("%d\n",&n);
		if(n==0)break;
		for(i=0;i<n;i++){
			scanf("%d\n",&Go[i]);
			if(i%2&&Go[i]^Go[i-1]){
				for(k=i-1;k>=0;k--){
					if(Go[k]==Go[i])break;
					Go[k]=Go[i];
				}
			}
		}
		sum=0;
		for(i=0;i<n;i++)sum+=Go[i];
		printf("%d\n",n-sum);
	}
	return 0;
}```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.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	-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	.LC0(%rip), %r12
	movq	%fs:40, %rax
	movq	%rax, 400040(%rsp)
	xorl	%eax, %eax
	leaq	28(%rsp), %rax
	leaq	32(%rsp), %r13
	movq	%rax, 8(%rsp)
	.p2align 4,,10
	.p2align 3
.L14:
	movq	8(%rsp), %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	28(%rsp), %edx
	testl	%edx, %edx
	je	.L2
	jle	.L4
	movq	%r13, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	movq	%r13, %rbp
	call	__isoc99_scanf@PLT
	movl	28(%rsp), %edx
	xorl	%r15d, %r15d
	movl	$1, %r14d
	cmpl	$1, %edx
	jg	.L6
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L8:
	addq	$1, %r15
	movl	28(%rsp), %edx
	leal	1(%r15), %r14d
	cmpl	%r14d, %edx
	jle	.L7
.L6:
	movq	%rbp, %rbx
	addq	$4, %rbp
	xorl	%eax, %eax
	movq	%r12, %rdi
	movq	%rbp, %rsi
	call	__isoc99_scanf@PLT
	andl	$1, %r14d
	je	.L8
	movl	4(%rbx), %eax
	movq	%rbx, %rcx
	cmpl	(%rbx), %eax
	je	.L8
	leaq	0(,%r15,4), %rdx
	movq	%rbx, %rsi
	subq	%rdx, %rsi
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L10:
	movl	4(%rcx), %eax
	subq	$4, %rbx
	cmpl	%eax, -4(%rdx)
	je	.L8
.L9:
	movl	%eax, (%rbx)
	movq	%rbx, %rdx
	cmpq	%rsi, %rbx
	jne	.L10
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L7:
	testl	%edx, %edx
	jle	.L4
	leal	-1(%rdx), %eax
	cmpl	$2, %eax
	jbe	.L17
	movl	%edx, %ecx
	movq	%r13, %rax
	pxor	%xmm0, %xmm0
	shrl	$2, %ecx
	subl	$1, %ecx
	salq	$4, %rcx
	leaq	48(%rsp,%rcx), %rcx
	.p2align 4,,10
	.p2align 3
.L12:
	paddd	(%rax), %xmm0
	addq	$16, %rax
	cmpq	%rcx, %rax
	jne	.L12
	movdqa	%xmm0, %xmm1
	movl	%edx, %ecx
	psrldq	$8, %xmm1
	andl	$-4, %ecx
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %eax
	testb	$3, %dl
	je	.L13
.L11:
	movslq	%ecx, %rsi
	addl	32(%rsp,%rsi,4), %eax
	leal	1(%rcx), %esi
	cmpl	%edx, %esi
	jge	.L13
	movslq	%esi, %rsi
	addl	$2, %ecx
	addl	32(%rsp,%rsi,4), %eax
	cmpl	%ecx, %edx
	jle	.L13
	movslq	%ecx, %rcx
	addl	32(%rsp,%rcx,4), %eax
.L13:
	subl	%eax, %edx
.L4:
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L14
.L2:
	movq	400040(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L24
	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
.L17:
	.cfi_restore_state
	xorl	%eax, %eax
	xorl	%ecx, %ecx
	jmp	.L11
.L24:
	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:
```

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.
Optimized Assembly Code:

train
```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.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	-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	.LC0(%rip), %r12
	movq	%fs:40, %rax
	movq	%rax, 400040(%rsp)
	xorl	%eax, %eax
	leaq	28(%rsp), %rax
	leaq	32(%rsp), %r13
	movq	%rax, 8(%rsp)
	.p2align 4,,10
	.p2align 3
.L14:
	movq	8(%rsp), %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	28(%rsp), %edx
	testl	%edx, %edx
	je	.L2
	jle	.L4
	movq	%r13, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	movq	%r13, %rbp
	call	__isoc99_scanf@PLT
	movl	28(%rsp), %edx
	xorl	%r15d, %r15d
	movl	$1, %r14d
	cmpl	$1, %edx
	jg	.L6
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L8:
	addq	$1, %r15
	movl	28(%rsp), %edx
	leal	1(%r15), %r14d
	cmpl	%r14d, %edx
	jle	.L7
.L6:
	movq	%rbp, %rbx
	addq	$4, %rbp
	xorl	%eax, %eax
	movq	%r12, %rdi
	movq	%rbp, %rsi
	call	__isoc99_scanf@PLT
	andl	$1, %r14d
	je	.L8
	movl	4(%rbx), %eax
	movq	%rbx, %rcx
	cmpl	(%rbx), %eax
	je	.L8
	leaq	0(,%r15,4), %rdx
	movq	%rbx, %rsi
	subq	%rdx, %rsi
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L10:
	movl	4(%rcx), %eax
	subq	$4, %rbx
	cmpl	%eax, -4(%rdx)
	je	.L8
.L9:
	movl	%eax, (%rbx)
	movq	%rbx, %rdx
	cmpq	%rsi, %rbx
	jne	.L10
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L7:
	testl	%edx, %edx
	jle	.L4
	leal	-1(%rdx), %eax
	cmpl	$2, %eax
	jbe	.L17
	movl	%edx, %ecx
	movq	%r13, %rax
	pxor	%xmm0, %xmm0
	shrl	$2, %ecx
	subl	$1, %ecx
	salq	$4, %rcx
	leaq	48(%rsp,%rcx), %rcx
	.p2align 4,,10
	.p2align 3
.L12:
	paddd	(%rax), %xmm0
	addq	$16, %rax
	cmpq	%rcx, %rax
	jne	.L12
	movdqa	%xmm0, %xmm1
	movl	%edx, %ecx
	psrldq	$8, %xmm1
	andl	$-4, %ecx
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %eax
	testb	$3, %dl
	je	.L13
.L11:
	movslq	%ecx, %rsi
	addl	32(%rsp,%rsi,4), %eax
	leal	1(%rcx), %esi
	cmpl	%edx, %esi
	jge	.L13
	movslq	%esi, %rsi
	addl	$2, %ecx
	addl	32(%rsp,%rsi,4), %eax
	cmpl	%ecx, %edx
	jle	.L13
	movslq	%ecx, %rcx
	addl	32(%rsp,%rcx,4), %eax
.L13:
	subl	%eax, %edx
.L4:
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L14
.L2:
	movq	400040(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L24
	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
.L17:
	.cfi_restore_state
	xorl	%eax, %eax
	xorl	%ecx, %ecx
	jmp	.L11
.L24:
	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:
```