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

```c
#define rep(i,n)for(int i=0;i<n;i++)
n,h[101],flag,ans=0;main(){
	scanf("%d",&n);
	rep(i,n)scanf("%d",&h[i]);
	rep(i,10001){
		flag=0;
		rep(j,n)flag+=h[j];
		if(!flag)break;
		flag=0;
		rep(j,n){
			if(!h[j]){flag=0;continue;}
			if(!flag){ans++;flag++;}
			h[j]--;
		}
	}
	printf("%d",ans);
}```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	leaq	n(%rip), %rsi
	xorl	%eax, %eax
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	leaq	.LC0(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	movq	%rbp, %rdi
	leaq	h(%rip), %rbx
	call	scanf@PLT
	movl	n(%rip), %r8d
	testl	%r8d, %r8d
	jle	.L2
	movq	%rbx, %r13
	xorl	%r12d, %r12d
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r13, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	addl	$1, %r12d
	call	scanf@PLT
	movl	n(%rip), %r8d
	addq	$4, %r13
	cmpl	%r12d, %r8d
	jg	.L3
.L2:
	movl	%r8d, %eax
	movl	ans(%rip), %r13d
	movl	%r8d, %r11d
	xorl	%r10d, %r10d
	shrl	$2, %eax
	leal	-1(%r8), %edx
	andl	$-4, %r11d
	movl	$10001, %r9d
	leal	-1(%rax), %edi
	leaq	16+h(%rip), %rax
	movq	%rdx, %r12
	movl	%r13d, %esi
	salq	$4, %rdi
	addq	%rax, %rdi
	subq	$12, %rax
	leaq	(%rax,%rdx,4), %rcx
	.p2align 4,,10
	.p2align 3
.L12:
	testl	%r8d, %r8d
	jle	.L27
	cmpl	$2, %r12d
	jbe	.L14
	movq	%rbx, %rax
	pxor	%xmm0, %xmm0
	.p2align 4,,10
	.p2align 3
.L7:
	paddd	(%rax), %xmm0
	addq	$16, %rax
	cmpq	%rdi, %rax
	jne	.L7
	movdqa	%xmm0, %xmm1
	movl	%r11d, %edx
	psrldq	$8, %xmm1
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %eax
	cmpl	%r11d, %r8d
	je	.L8
.L6:
	movslq	%edx, %r14
	addl	(%rbx,%r14,4), %eax
	leal	1(%rdx), %r14d
	cmpl	%r8d, %r14d
	jge	.L8
	movslq	%r14d, %r14
	addl	$2, %edx
	addl	(%rbx,%r14,4), %eax
	cmpl	%edx, %r8d
	jle	.L8
	movslq	%edx, %rdx
	addl	(%rbx,%rdx,4), %eax
.L8:
	testl	%eax, %eax
	je	.L27
	movq	%rbx, %rax
	xorl	%r14d, %r14d
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L30:
	testl	%r14d, %r14d
	jne	.L11
	addl	$1, %esi
	movl	$1, %r10d
.L11:
	subl	$1, %edx
	addq	$4, %rax
	movl	$1, %r14d
	movl	%edx, -4(%rax)
	cmpq	%rcx, %rax
	je	.L29
.L9:
	movl	(%rax), %edx
	testl	%edx, %edx
	jne	.L30
	addq	$4, %rax
	xorl	%r14d, %r14d
	cmpq	%rcx, %rax
	jne	.L9
.L29:
	subl	$1, %r9d
	jne	.L12
	movl	%r14d, flag(%rip)
	testb	%r10b, %r10b
	jne	.L25
.L18:
	movl	%r13d, %esi
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L27:
	movl	$0, flag(%rip)
	testb	%r10b, %r10b
	je	.L18
.L25:
	movl	%esi, ans(%rip)
.L5:
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	printf@PLT
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
.L14:
	.cfi_restore_state
	xorl	%eax, %eax
	xorl	%edx, %edx
	jmp	.L6
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	ans
	.bss
	.align 4
	.type	ans, @object
	.size	ans, 4
ans:
	.zero	4
	.globl	flag
	.align 4
	.type	flag, @object
	.size	flag, 4
flag:
	.zero	4
	.globl	h
	.align 32
	.type	h, @object
	.size	h, 404
h:
	.zero	404
	.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:
```

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"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	leaq	n(%rip), %rsi
	xorl	%eax, %eax
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	leaq	.LC0(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	movq	%rbp, %rdi
	leaq	h(%rip), %rbx
	call	scanf@PLT
	movl	n(%rip), %r8d
	testl	%r8d, %r8d
	jle	.L2
	movq	%rbx, %r13
	xorl	%r12d, %r12d
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r13, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	addl	$1, %r12d
	call	scanf@PLT
	movl	n(%rip), %r8d
	addq	$4, %r13
	cmpl	%r12d, %r8d
	jg	.L3
.L2:
	movl	%r8d, %eax
	movl	ans(%rip), %r13d
	movl	%r8d, %r11d
	xorl	%r10d, %r10d
	shrl	$2, %eax
	leal	-1(%r8), %edx
	andl	$-4, %r11d
	movl	$10001, %r9d
	leal	-1(%rax), %edi
	leaq	16+h(%rip), %rax
	movq	%rdx, %r12
	movl	%r13d, %esi
	salq	$4, %rdi
	addq	%rax, %rdi
	subq	$12, %rax
	leaq	(%rax,%rdx,4), %rcx
	.p2align 4,,10
	.p2align 3
.L12:
	testl	%r8d, %r8d
	jle	.L27
	cmpl	$2, %r12d
	jbe	.L14
	movq	%rbx, %rax
	pxor	%xmm0, %xmm0
	.p2align 4,,10
	.p2align 3
.L7:
	paddd	(%rax), %xmm0
	addq	$16, %rax
	cmpq	%rdi, %rax
	jne	.L7
	movdqa	%xmm0, %xmm1
	movl	%r11d, %edx
	psrldq	$8, %xmm1
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %eax
	cmpl	%r11d, %r8d
	je	.L8
.L6:
	movslq	%edx, %r14
	addl	(%rbx,%r14,4), %eax
	leal	1(%rdx), %r14d
	cmpl	%r8d, %r14d
	jge	.L8
	movslq	%r14d, %r14
	addl	$2, %edx
	addl	(%rbx,%r14,4), %eax
	cmpl	%edx, %r8d
	jle	.L8
	movslq	%edx, %rdx
	addl	(%rbx,%rdx,4), %eax
.L8:
	testl	%eax, %eax
	je	.L27
	movq	%rbx, %rax
	xorl	%r14d, %r14d
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L30:
	testl	%r14d, %r14d
	jne	.L11
	addl	$1, %esi
	movl	$1, %r10d
.L11:
	subl	$1, %edx
	addq	$4, %rax
	movl	$1, %r14d
	movl	%edx, -4(%rax)
	cmpq	%rcx, %rax
	je	.L29
.L9:
	movl	(%rax), %edx
	testl	%edx, %edx
	jne	.L30
	addq	$4, %rax
	xorl	%r14d, %r14d
	cmpq	%rcx, %rax
	jne	.L9
.L29:
	subl	$1, %r9d
	jne	.L12
	movl	%r14d, flag(%rip)
	testb	%r10b, %r10b
	jne	.L25
.L18:
	movl	%r13d, %esi
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L27:
	movl	$0, flag(%rip)
	testb	%r10b, %r10b
	je	.L18
.L25:
	movl	%esi, ans(%rip)
.L5:
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	printf@PLT
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
.L14:
	.cfi_restore_state
	xorl	%eax, %eax
	xorl	%edx, %edx
	jmp	.L6
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	ans
	.bss
	.align 4
	.type	ans, @object
	.size	ans, 4
ans:
	.zero	4
	.globl	flag
	.align 4
	.type	flag, @object
	.size	flag, 4
flag:
	.zero	4
	.globl	h
	.align 32
	.type	h, @object
	.size	h, 404
h:
	.zero	404
	.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
```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	leaq	n(%rip), %rsi
	xorl	%eax, %eax
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	leaq	.LC0(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	movq	%rbp, %rdi
	leaq	h(%rip), %rbx
	call	scanf@PLT
	movl	n(%rip), %r8d
	testl	%r8d, %r8d
	jle	.L2
	movq	%rbx, %r13
	xorl	%r12d, %r12d
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r13, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	addl	$1, %r12d
	call	scanf@PLT
	movl	n(%rip), %r8d
	addq	$4, %r13
	cmpl	%r12d, %r8d
	jg	.L3
.L2:
	movl	%r8d, %eax
	movl	ans(%rip), %r13d
	movl	%r8d, %r11d
	xorl	%r10d, %r10d
	shrl	$2, %eax
	leal	-1(%r8), %edx
	andl	$-4, %r11d
	movl	$10001, %r9d
	leal	-1(%rax), %edi
	leaq	16+h(%rip), %rax
	movq	%rdx, %r12
	movl	%r13d, %esi
	salq	$4, %rdi
	addq	%rax, %rdi
	subq	$12, %rax
	leaq	(%rax,%rdx,4), %rcx
	.p2align 4,,10
	.p2align 3
.L12:
	testl	%r8d, %r8d
	jle	.L27
	cmpl	$2, %r12d
	jbe	.L14
	movq	%rbx, %rax
	pxor	%xmm0, %xmm0
	.p2align 4,,10
	.p2align 3
.L7:
	paddd	(%rax), %xmm0
	addq	$16, %rax
	cmpq	%rdi, %rax
	jne	.L7
	movdqa	%xmm0, %xmm1
	movl	%r11d, %edx
	psrldq	$8, %xmm1
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %eax
	cmpl	%r11d, %r8d
	je	.L8
.L6:
	movslq	%edx, %r14
	addl	(%rbx,%r14,4), %eax
	leal	1(%rdx), %r14d
	cmpl	%r8d, %r14d
	jge	.L8
	movslq	%r14d, %r14
	addl	$2, %edx
	addl	(%rbx,%r14,4), %eax
	cmpl	%edx, %r8d
	jle	.L8
	movslq	%edx, %rdx
	addl	(%rbx,%rdx,4), %eax
.L8:
	testl	%eax, %eax
	je	.L27
	movq	%rbx, %rax
	xorl	%r14d, %r14d
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L30:
	testl	%r14d, %r14d
	jne	.L11
	addl	$1, %esi
	movl	$1, %r10d
.L11:
	subl	$1, %edx
	addq	$4, %rax
	movl	$1, %r14d
	movl	%edx, -4(%rax)
	cmpq	%rcx, %rax
	je	.L29
.L9:
	movl	(%rax), %edx
	testl	%edx, %edx
	jne	.L30
	addq	$4, %rax
	xorl	%r14d, %r14d
	cmpq	%rcx, %rax
	jne	.L9
.L29:
	subl	$1, %r9d
	jne	.L12
	movl	%r14d, flag(%rip)
	testb	%r10b, %r10b
	jne	.L25
.L18:
	movl	%r13d, %esi
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L27:
	movl	$0, flag(%rip)
	testb	%r10b, %r10b
	je	.L18
.L25:
	movl	%esi, ans(%rip)
.L5:
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	printf@PLT
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
.L14:
	.cfi_restore_state
	xorl	%eax, %eax
	xorl	%edx, %edx
	jmp	.L6
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	ans
	.bss
	.align 4
	.type	ans, @object
	.size	ans, 4
ans:
	.zero	4
	.globl	flag
	.align 4
	.type	flag, @object
	.size	flag, 4
flag:
	.zero	4
	.globl	h
	.align 32
	.type	h, @object
	.size	h, 404
h:
	.zero	404
	.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:
```
```c
#define rep(i,n)for(int i=0;i<n;i++)
n,h[101],flag,ans=0;main(){
	scanf("%d",&n);
	rep(i,n)scanf("%d",&h[i]);
	rep(i,10001){
		flag=0;
		rep(j,n)flag+=h[j];
		if(!flag)break;
		flag=0;
		rep(j,n){
			if(!h[j]){flag=0;continue;}
			if(!flag){ans++;flag++;}
			h[j]--;
		}
	}
	printf("%d",ans);
}```
Given the following C code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#define rep(i,n)for(int i=0;i<n;i++)
n,h[101],flag,ans=0;main(){
	scanf("%d",&n);
	rep(i,n)scanf("%d",&h[i]);
	rep(i,10001){
		flag=0;
		rep(j,n)flag+=h[j];
		if(!flag)break;
		flag=0;
		rep(j,n){
			if(!h[j]){flag=0;continue;}
			if(!flag){ans++;flag++;}
			h[j]--;
		}
	}
	printf("%d",ans);
}```

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:

4
1 4 2 1
 8
4 23 75 1 23 96 50 100
 5
1 1 2 3 1
 4
1 8 2 1
 8
4 23 75 0 23 97 50 100
 4
1 12 2 1
 8
4 23 136 0 23 97 50 100
 4
1 12 0 2
 8
4 39 136 0 23 97 50 101
 8
4 39 136 0 23 108 50 101

4 220 3 8 222 12 283 14 284 295
Given the following C code and assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#define rep(i,n)for(int i=0;i<n;i++)
n,h[101],flag,ans=0;main(){
	scanf("%d",&n);
	rep(i,n)scanf("%d",&h[i]);
	rep(i,10001){
		flag=0;
		rep(j,n)flag+=h[j];
		if(!flag)break;
		flag=0;
		rep(j,n){
			if(!h[j]){flag=0;continue;}
			if(!flag){ans++;flag++;}
			h[j]--;
		}
	}
	printf("%d",ans);
}```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	leaq	n(%rip), %rsi
	xorl	%eax, %eax
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	leaq	.LC0(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	movq	%rbp, %rdi
	leaq	h(%rip), %rbx
	call	scanf@PLT
	movl	n(%rip), %r8d
	testl	%r8d, %r8d
	jle	.L2
	movq	%rbx, %r13
	xorl	%r12d, %r12d
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r13, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	addl	$1, %r12d
	call	scanf@PLT
	movl	n(%rip), %r8d
	addq	$4, %r13
	cmpl	%r12d, %r8d
	jg	.L3
.L2:
	movl	%r8d, %eax
	movl	ans(%rip), %r13d
	movl	%r8d, %r11d
	xorl	%r10d, %r10d
	shrl	$2, %eax
	leal	-1(%r8), %edx
	andl	$-4, %r11d
	movl	$10001, %r9d
	leal	-1(%rax), %edi
	leaq	16+h(%rip), %rax
	movq	%rdx, %r12
	movl	%r13d, %esi
	salq	$4, %rdi
	addq	%rax, %rdi
	subq	$12, %rax
	leaq	(%rax,%rdx,4), %rcx
	.p2align 4,,10
	.p2align 3
.L12:
	testl	%r8d, %r8d
	jle	.L27
	cmpl	$2, %r12d
	jbe	.L14
	movq	%rbx, %rax
	pxor	%xmm0, %xmm0
	.p2align 4,,10
	.p2align 3
.L7:
	paddd	(%rax), %xmm0
	addq	$16, %rax
	cmpq	%rdi, %rax
	jne	.L7
	movdqa	%xmm0, %xmm1
	movl	%r11d, %edx
	psrldq	$8, %xmm1
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %eax
	cmpl	%r11d, %r8d
	je	.L8
.L6:
	movslq	%edx, %r14
	addl	(%rbx,%r14,4), %eax
	leal	1(%rdx), %r14d
	cmpl	%r8d, %r14d
	jge	.L8
	movslq	%r14d, %r14
	addl	$2, %edx
	addl	(%rbx,%r14,4), %eax
	cmpl	%edx, %r8d
	jle	.L8
	movslq	%edx, %rdx
	addl	(%rbx,%rdx,4), %eax
.L8:
	testl	%eax, %eax
	je	.L27
	movq	%rbx, %rax
	xorl	%r14d, %r14d
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L30:
	testl	%r14d, %r14d
	jne	.L11
	addl	$1, %esi
	movl	$1, %r10d
.L11:
	subl	$1, %edx
	addq	$4, %rax
	movl	$1, %r14d
	movl	%edx, -4(%rax)
	cmpq	%rcx, %rax
	je	.L29
.L9:
	movl	(%rax), %edx
	testl	%edx, %edx
	jne	.L30
	addq	$4, %rax
	xorl	%r14d, %r14d
	cmpq	%rcx, %rax
	jne	.L9
.L29:
	subl	$1, %r9d
	jne	.L12
	movl	%r14d, flag(%rip)
	testb	%r10b, %r10b
	jne	.L25
.L18:
	movl	%r13d, %esi
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L27:
	movl	$0, flag(%rip)
	testb	%r10b, %r10b
	je	.L18
.L25:
	movl	%esi, ans(%rip)
.L5:
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	printf@PLT
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
.L14:
	.cfi_restore_state
	xorl	%eax, %eax
	xorl	%edx, %edx
	jmp	.L6
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	ans
	.bss
	.align 4
	.type	ans, @object
	.size	ans, 4
ans:
	.zero	4
	.globl	flag
	.align 4
	.type	flag, @object
	.size	flag, 4
flag:
	.zero	4
	.globl	h
	.align 32
	.type	h, @object
	.size	h, 404
h:
	.zero	404
	.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:
```

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"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	leaq	n(%rip), %rsi
	xorl	%eax, %eax
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	leaq	.LC0(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	movq	%rbp, %rdi
	leaq	h(%rip), %rbx
	call	scanf@PLT
	movl	n(%rip), %r8d
	testl	%r8d, %r8d
	jle	.L2
	movq	%rbx, %r13
	xorl	%r12d, %r12d
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r13, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	addl	$1, %r12d
	call	scanf@PLT
	movl	n(%rip), %r8d
	addq	$4, %r13
	cmpl	%r12d, %r8d
	jg	.L3
.L2:
	movl	%r8d, %eax
	movl	ans(%rip), %r13d
	movl	%r8d, %r11d
	xorl	%r10d, %r10d
	shrl	$2, %eax
	leal	-1(%r8), %edx
	andl	$-4, %r11d
	movl	$10001, %r9d
	leal	-1(%rax), %edi
	leaq	16+h(%rip), %rax
	movq	%rdx, %r12
	movl	%r13d, %esi
	salq	$4, %rdi
	addq	%rax, %rdi
	subq	$12, %rax
	leaq	(%rax,%rdx,4), %rcx
	.p2align 4,,10
	.p2align 3
.L12:
	testl	%r8d, %r8d
	jle	.L27
	cmpl	$2, %r12d
	jbe	.L14
	movq	%rbx, %rax
	pxor	%xmm0, %xmm0
	.p2align 4,,10
	.p2align 3
.L7:
	paddd	(%rax), %xmm0
	addq	$16, %rax
	cmpq	%rdi, %rax
	jne	.L7
	movdqa	%xmm0, %xmm1
	movl	%r11d, %edx
	psrldq	$8, %xmm1
	paddd	%xmm1, %xmm0
	movdqa	%xmm0, %xmm1
	psrldq	$4, %xmm1
	paddd	%xmm1, %xmm0
	movd	%xmm0, %eax
	cmpl	%r11d, %r8d
	je	.L8
.L6:
	movslq	%edx, %r14
	addl	(%rbx,%r14,4), %eax
	leal	1(%rdx), %r14d
	cmpl	%r8d, %r14d
	jge	.L8
	movslq	%r14d, %r14
	addl	$2, %edx
	addl	(%rbx,%r14,4), %eax
	cmpl	%edx, %r8d
	jle	.L8
	movslq	%edx, %rdx
	addl	(%rbx,%rdx,4), %eax
.L8:
	testl	%eax, %eax
	je	.L27
	movq	%rbx, %rax
	xorl	%r14d, %r14d
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L30:
	testl	%r14d, %r14d
	jne	.L11
	addl	$1, %esi
	movl	$1, %r10d
.L11:
	subl	$1, %edx
	addq	$4, %rax
	movl	$1, %r14d
	movl	%edx, -4(%rax)
	cmpq	%rcx, %rax
	je	.L29
.L9:
	movl	(%rax), %edx
	testl	%edx, %edx
	jne	.L30
	addq	$4, %rax
	xorl	%r14d, %r14d
	cmpq	%rcx, %rax
	jne	.L9
.L29:
	subl	$1, %r9d
	jne	.L12
	movl	%r14d, flag(%rip)
	testb	%r10b, %r10b
	jne	.L25
.L18:
	movl	%r13d, %esi
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L27:
	movl	$0, flag(%rip)
	testb	%r10b, %r10b
	je	.L18
.L25:
	movl	%esi, ans(%rip)
.L5:
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	printf@PLT
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
.L14:
	.cfi_restore_state
	xorl	%eax, %eax
	xorl	%edx, %edx
	jmp	.L6
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	ans
	.bss
	.align 4
	.type	ans, @object
	.size	ans, 4
ans:
	.zero	4
	.globl	flag
	.align 4
	.type	flag, @object
	.size	flag, 4
flag:
	.zero	4
	.globl	h
	.align 32
	.type	h, @object
	.size	h, 404
h:
	.zero	404
	.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:
```