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 l[1000], neko_stack[100];
	int i, j, k, n, err;
	
	scanf( "%d", &n );
	for( i = 0; i < n; i++ )
	{
		scanf( "%d", &l[i] );
	}

	i = 0;
	j = 0;
	err = 0;
	do
	{
		//printf( "l[%d]=%d,", i, l[i] );
		if( l[i] > 0 )
		{
			if( j > 0 )
			{
				for( k = j - 1; k >= 0; k-- )
				{
					if( l[i] == neko_stack[k] )
					{
						err = i+1;
					}
					else if( l[i] + neko_stack[k] == 0 )
					{
						k = 0;
					}
				}
			}
			if( err == 0 )
			{
				neko_stack[j] = l[i];
				//printf( "neko_stack[%d]=%d\n", j, neko_stack[j] );
				j++;
			}
			else
			{
				//printf( "error_p=%d\n", err );
			}
		}
		else if( l[i] < 0 )
		{
			if( j > 0 )
			{
				if( l[i] + neko_stack[j-1] != 0 )
				{
					err = i+1;
				}
			}
			else if( j == 0 )
			{
				err = i+1;
			}
			if( err == 0 )
			{
				j--;
				//printf( "neko_stack[%d]=%d\n", j-1, neko_stack[j-1] );
			}
			else
			{
				//printf( "error_n=%d\n", err );
			}
		}
		i++;
		if( err == 0 && n == i )
		{
			err = 9999;
		}
	}
	while( err == 0 );

	if( err == 9999 )
	{
		printf( "OK\n" );
	}
	else
	{
		printf( "%d\n", err );
	}

	return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"OK"
.LC2:
	.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	$4096, %rsp
	orq	$0, (%rsp)
	subq	$352, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-4436(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -4432(%rbp)
	jmp	.L2
.L3:
	leaq	-4016(%rbp), %rdx
	movl	-4432(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -4432(%rbp)
.L2:
	movl	-4436(%rbp), %eax
	cmpl	%eax, -4432(%rbp)
	jl	.L3
	movl	$0, -4432(%rbp)
	movl	$0, -4428(%rbp)
	movl	$0, -4420(%rbp)
.L14:
	movl	-4432(%rbp), %eax
	cltq
	movl	-4016(%rbp,%rax,4), %eax
	testl	%eax, %eax
	jle	.L4
	cmpl	$0, -4428(%rbp)
	jle	.L5
	movl	-4428(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -4424(%rbp)
	jmp	.L6
.L9:
	movl	-4432(%rbp), %eax
	cltq
	movl	-4016(%rbp,%rax,4), %edx
	movl	-4424(%rbp), %eax
	cltq
	movl	-4416(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jne	.L7
	movl	-4432(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -4420(%rbp)
	jmp	.L8
.L7:
	movl	-4432(%rbp), %eax
	cltq
	movl	-4016(%rbp,%rax,4), %edx
	movl	-4424(%rbp), %eax
	cltq
	movl	-4416(%rbp,%rax,4), %eax
	addl	%edx, %eax
	testl	%eax, %eax
	jne	.L8
	movl	$0, -4424(%rbp)
.L8:
	subl	$1, -4424(%rbp)
.L6:
	cmpl	$0, -4424(%rbp)
	jns	.L9
.L5:
	cmpl	$0, -4420(%rbp)
	jne	.L10
	movl	-4432(%rbp), %eax
	cltq
	movl	-4016(%rbp,%rax,4), %edx
	movl	-4428(%rbp), %eax
	cltq
	movl	%edx, -4416(%rbp,%rax,4)
	addl	$1, -4428(%rbp)
	jmp	.L10
.L4:
	movl	-4432(%rbp), %eax
	cltq
	movl	-4016(%rbp,%rax,4), %eax
	testl	%eax, %eax
	jns	.L10
	cmpl	$0, -4428(%rbp)
	jle	.L11
	movl	-4432(%rbp), %eax
	cltq
	movl	-4016(%rbp,%rax,4), %edx
	movl	-4428(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-4416(%rbp,%rax,4), %eax
	addl	%edx, %eax
	testl	%eax, %eax
	je	.L12
	movl	-4432(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -4420(%rbp)
	jmp	.L12
.L11:
	cmpl	$0, -4428(%rbp)
	jne	.L12
	movl	-4432(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -4420(%rbp)
.L12:
	cmpl	$0, -4420(%rbp)
	jne	.L10
	subl	$1, -4428(%rbp)
.L10:
	addl	$1, -4432(%rbp)
	cmpl	$0, -4420(%rbp)
	jne	.L13
	movl	-4436(%rbp), %eax
	cmpl	%eax, -4432(%rbp)
	jne	.L13
	movl	$9999, -4420(%rbp)
.L13:
	cmpl	$0, -4420(%rbp)
	je	.L14
	cmpl	$9999, -4420(%rbp)
	jne	.L15
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L16
.L15:
	movl	-4420(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L16:
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L18
	call	__stack_chk_fail@PLT
.L18:
	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	"OK"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$4096, %rsp
	.cfi_def_cfa_offset 4136
	orq	$0, (%rsp)
	subq	$344, %rsp
	.cfi_def_cfa_offset 4480
	leaq	.LC0(%rip), %r13
	xorl	%ebp, %ebp
	movq	%r13, %rdi
	movq	%fs:40, %rax
	movq	%rax, 4424(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	leaq	416(%rsp), %rbx
	movq	%rbx, %r12
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %r11d
	testl	%r11d, %r11d
	jle	.L2
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r12, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addl	$1, %ebp
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %r11d
	addq	$4, %r12
	cmpl	%ebp, %r11d
	jg	.L3
.L2:
	movq	%rbx, %r9
	movl	$1, %edi
	leaq	16(%rsp), %rbp
	xorl	%r10d, %r10d
	.p2align 4,,10
	.p2align 3
.L13:
	movl	(%r9), %edx
	testl	%edx, %edx
	jle	.L4
	xorl	%ebx, %ebx
	testl	%r10d, %r10d
	jne	.L37
.L5:
	movl	%edx, 16(%rsp,%rbx,4)
	addl	$1, %r10d
	movl	%edi, %r8d
.L11:
	addq	$4, %r9
	addl	$1, %edi
	cmpl	%r8d, %r11d
	jne	.L13
	leaq	.LC1(%rip), %rdi
	call	puts@PLT
	jmp	.L14
	.p2align 4,,10
	.p2align 3
.L4:
	movl	%edi, %r8d
	je	.L11
	testl	%r10d, %r10d
	je	.L8
	subl	$1, %r10d
	movslq	%r10d, %rbx
	addl	16(%rsp,%rbx,4), %edx
	je	.L11
	.p2align 4,,10
	.p2align 3
.L8:
	movl	%r8d, %edx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L14:
	movq	4424(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L38
	addq	$4440, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L37:
	.cfi_restore_state
	movslq	%r10d, %rbx
	leal	-2(%r10), %esi
	xorl	%r8d, %r8d
	leaq	0(%rbp,%rbx,4), %rcx
	movl	-4(%rcx), %eax
	cmpl	%eax, %edx
	je	.L39
	.p2align 4,,10
	.p2align 3
.L6:
	addl	%edx, %eax
	jne	.L40
.L9:
	testl	%r8d, %r8d
	jne	.L8
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L40:
	cmpl	$-1, %esi
	je	.L9
.L7:
	movl	-8(%rcx), %eax
	subq	$4, %rcx
	subl	$1, %esi
	cmpl	%eax, %edx
	jne	.L6
.L39:
	movl	%edi, %r8d
	cmpl	$-1, %esi
	jne	.L7
	jmp	.L8
.L38:
	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	"OK"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$4096, %rsp
	.cfi_def_cfa_offset 4136
	orq	$0, (%rsp)
	subq	$344, %rsp
	.cfi_def_cfa_offset 4480
	leaq	.LC0(%rip), %r13
	xorl	%ebp, %ebp
	movq	%r13, %rdi
	movq	%fs:40, %rax
	movq	%rax, 4424(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	leaq	416(%rsp), %rbx
	movq	%rbx, %r12
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %r11d
	testl	%r11d, %r11d
	jle	.L2
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r12, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addl	$1, %ebp
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %r11d
	addq	$4, %r12
	cmpl	%ebp, %r11d
	jg	.L3
.L2:
	movq	%rbx, %r9
	movl	$1, %edi
	leaq	16(%rsp), %rbp
	xorl	%r10d, %r10d
	.p2align 4,,10
	.p2align 3
.L13:
	movl	(%r9), %edx
	testl	%edx, %edx
	jle	.L4
	xorl	%ebx, %ebx
	testl	%r10d, %r10d
	jne	.L37
.L5:
	movl	%edx, 16(%rsp,%rbx,4)
	addl	$1, %r10d
	movl	%edi, %r8d
.L11:
	addq	$4, %r9
	addl	$1, %edi
	cmpl	%r8d, %r11d
	jne	.L13
	leaq	.LC1(%rip), %rdi
	call	puts@PLT
	jmp	.L14
	.p2align 4,,10
	.p2align 3
.L4:
	movl	%edi, %r8d
	je	.L11
	testl	%r10d, %r10d
	je	.L8
	subl	$1, %r10d
	movslq	%r10d, %rbx
	addl	16(%rsp,%rbx,4), %edx
	je	.L11
	.p2align 4,,10
	.p2align 3
.L8:
	movl	%r8d, %edx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L14:
	movq	4424(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L38
	addq	$4440, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L37:
	.cfi_restore_state
	movslq	%r10d, %rbx
	leal	-2(%r10), %esi
	xorl	%r8d, %r8d
	leaq	0(%rbp,%rbx,4), %rcx
	movl	-4(%rcx), %eax
	cmpl	%eax, %edx
	je	.L39
	.p2align 4,,10
	.p2align 3
.L6:
	addl	%edx, %eax
	jne	.L40
.L9:
	testl	%r8d, %r8d
	jne	.L8
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L40:
	cmpl	$-1, %esi
	je	.L9
.L7:
	movl	-8(%rcx), %eax
	subq	$4, %rcx
	subl	$1, %esi
	cmpl	%eax, %edx
	jne	.L6
.L39:
	movl	%edi, %r8d
	cmpl	$-1, %esi
	jne	.L7
	jmp	.L8
.L38:
	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 l[1000], neko_stack[100];
	int i, j, k, n, err;
	
	scanf( "%d", &n );
	for( i = 0; i < n; i++ )
	{
		scanf( "%d", &l[i] );
	}

	i = 0;
	j = 0;
	err = 0;
	do
	{
		//printf( "l[%d]=%d,", i, l[i] );
		if( l[i] > 0 )
		{
			if( j > 0 )
			{
				for( k = j - 1; k >= 0; k-- )
				{
					if( l[i] == neko_stack[k] )
					{
						err = i+1;
					}
					else if( l[i] + neko_stack[k] == 0 )
					{
						k = 0;
					}
				}
			}
			if( err == 0 )
			{
				neko_stack[j] = l[i];
				//printf( "neko_stack[%d]=%d\n", j, neko_stack[j] );
				j++;
			}
			else
			{
				//printf( "error_p=%d\n", err );
			}
		}
		else if( l[i] < 0 )
		{
			if( j > 0 )
			{
				if( l[i] + neko_stack[j-1] != 0 )
				{
					err = i+1;
				}
			}
			else if( j == 0 )
			{
				err = i+1;
			}
			if( err == 0 )
			{
				j--;
				//printf( "neko_stack[%d]=%d\n", j-1, neko_stack[j-1] );
			}
			else
			{
				//printf( "error_n=%d\n", err );
			}
		}
		i++;
		if( err == 0 && n == i )
		{
			err = 9999;
		}
	}
	while( err == 0 );

	if( err == 9999 )
	{
		printf( "OK\n" );
	}
	else
	{
		printf( "%d\n", err );
	}

	return 0;
}

4
1 2 -3 -1

3

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 l[1000], neko_stack[100];
	int i, j, k, n, err;
	
	scanf( "%d", &n );
	for( i = 0; i < n; i++ )
	{
		scanf( "%d", &l[i] );
	}

	i = 0;
	j = 0;
	err = 0;
	do
	{
		//printf( "l[%d]=%d,", i, l[i] );
		if( l[i] > 0 )
		{
			if( j > 0 )
			{
				for( k = j - 1; k >= 0; k-- )
				{
					if( l[i] == neko_stack[k] )
					{
						err = i+1;
					}
					else if( l[i] + neko_stack[k] == 0 )
					{
						k = 0;
					}
				}
			}
			if( err == 0 )
			{
				neko_stack[j] = l[i];
				//printf( "neko_stack[%d]=%d\n", j, neko_stack[j] );
				j++;
			}
			else
			{
				//printf( "error_p=%d\n", err );
			}
		}
		else if( l[i] < 0 )
		{
			if( j > 0 )
			{
				if( l[i] + neko_stack[j-1] != 0 )
				{
					err = i+1;
				}
			}
			else if( j == 0 )
			{
				err = i+1;
			}
			if( err == 0 )
			{
				j--;
				//printf( "neko_stack[%d]=%d\n", j-1, neko_stack[j-1] );
			}
			else
			{
				//printf( "error_n=%d\n", err );
			}
		}
		i++;
		if( err == 0 && n == i )
		{
			err = 9999;
		}
	}
	while( err == 0 );

	if( err == 9999 )
	{
		printf( "OK\n" );
	}
	else
	{
		printf( "%d\n", err );
	}

	return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"OK"
.LC2:
	.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	$4096, %rsp
	orq	$0, (%rsp)
	subq	$352, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-4436(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -4432(%rbp)
	jmp	.L2
.L3:
	leaq	-4016(%rbp), %rdx
	movl	-4432(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -4432(%rbp)
.L2:
	movl	-4436(%rbp), %eax
	cmpl	%eax, -4432(%rbp)
	jl	.L3
	movl	$0, -4432(%rbp)
	movl	$0, -4428(%rbp)
	movl	$0, -4420(%rbp)
.L14:
	movl	-4432(%rbp), %eax
	cltq
	movl	-4016(%rbp,%rax,4), %eax
	testl	%eax, %eax
	jle	.L4
	cmpl	$0, -4428(%rbp)
	jle	.L5
	movl	-4428(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -4424(%rbp)
	jmp	.L6
.L9:
	movl	-4432(%rbp), %eax
	cltq
	movl	-4016(%rbp,%rax,4), %edx
	movl	-4424(%rbp), %eax
	cltq
	movl	-4416(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jne	.L7
	movl	-4432(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -4420(%rbp)
	jmp	.L8
.L7:
	movl	-4432(%rbp), %eax
	cltq
	movl	-4016(%rbp,%rax,4), %edx
	movl	-4424(%rbp), %eax
	cltq
	movl	-4416(%rbp,%rax,4), %eax
	addl	%edx, %eax
	testl	%eax, %eax
	jne	.L8
	movl	$0, -4424(%rbp)
.L8:
	subl	$1, -4424(%rbp)
.L6:
	cmpl	$0, -4424(%rbp)
	jns	.L9
.L5:
	cmpl	$0, -4420(%rbp)
	jne	.L10
	movl	-4432(%rbp), %eax
	cltq
	movl	-4016(%rbp,%rax,4), %edx
	movl	-4428(%rbp), %eax
	cltq
	movl	%edx, -4416(%rbp,%rax,4)
	addl	$1, -4428(%rbp)
	jmp	.L10
.L4:
	movl	-4432(%rbp), %eax
	cltq
	movl	-4016(%rbp,%rax,4), %eax
	testl	%eax, %eax
	jns	.L10
	cmpl	$0, -4428(%rbp)
	jle	.L11
	movl	-4432(%rbp), %eax
	cltq
	movl	-4016(%rbp,%rax,4), %edx
	movl	-4428(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-4416(%rbp,%rax,4), %eax
	addl	%edx, %eax
	testl	%eax, %eax
	je	.L12
	movl	-4432(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -4420(%rbp)
	jmp	.L12
.L11:
	cmpl	$0, -4428(%rbp)
	jne	.L12
	movl	-4432(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -4420(%rbp)
.L12:
	cmpl	$0, -4420(%rbp)
	jne	.L10
	subl	$1, -4428(%rbp)
.L10:
	addl	$1, -4432(%rbp)
	cmpl	$0, -4420(%rbp)
	jne	.L13
	movl	-4436(%rbp), %eax
	cmpl	%eax, -4432(%rbp)
	jne	.L13
	movl	$9999, -4420(%rbp)
.L13:
	cmpl	$0, -4420(%rbp)
	je	.L14
	cmpl	$9999, -4420(%rbp)
	jne	.L15
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L16
.L15:
	movl	-4420(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L16:
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L18
	call	__stack_chk_fail@PLT
.L18:
	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	"OK"
.LC2:
	.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	$4096, %rsp
	orq	$0, (%rsp)
	subq	$352, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-4436(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -4432(%rbp)
	jmp	.L2
.L3:
	leaq	-4016(%rbp), %rdx
	movl	-4432(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -4432(%rbp)
.L2:
	movl	-4436(%rbp), %eax
	cmpl	%eax, -4432(%rbp)
	jl	.L3
	movl	$0, -4432(%rbp)
	movl	$0, -4428(%rbp)
	movl	$0, -4420(%rbp)
.L14:
	movl	-4432(%rbp), %eax
	cltq
	movl	-4016(%rbp,%rax,4), %eax
	testl	%eax, %eax
	jle	.L4
	cmpl	$0, -4428(%rbp)
	jle	.L5
	movl	-4428(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -4424(%rbp)
	jmp	.L6
.L9:
	movl	-4432(%rbp), %eax
	cltq
	movl	-4016(%rbp,%rax,4), %edx
	movl	-4424(%rbp), %eax
	cltq
	movl	-4416(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jne	.L7
	movl	-4432(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -4420(%rbp)
	jmp	.L8
.L7:
	movl	-4432(%rbp), %eax
	cltq
	movl	-4016(%rbp,%rax,4), %edx
	movl	-4424(%rbp), %eax
	cltq
	movl	-4416(%rbp,%rax,4), %eax
	addl	%edx, %eax
	testl	%eax, %eax
	jne	.L8
	movl	$0, -4424(%rbp)
.L8:
	subl	$1, -4424(%rbp)
.L6:
	cmpl	$0, -4424(%rbp)
	jns	.L9
.L5:
	cmpl	$0, -4420(%rbp)
	jne	.L10
	movl	-4432(%rbp), %eax
	cltq
	movl	-4016(%rbp,%rax,4), %edx
	movl	-4428(%rbp), %eax
	cltq
	movl	%edx, -4416(%rbp,%rax,4)
	addl	$1, -4428(%rbp)
	jmp	.L10
.L4:
	movl	-4432(%rbp), %eax
	cltq
	movl	-4016(%rbp,%rax,4), %eax
	testl	%eax, %eax
	jns	.L10
	cmpl	$0, -4428(%rbp)
	jle	.L11
	movl	-4432(%rbp), %eax
	cltq
	movl	-4016(%rbp,%rax,4), %edx
	movl	-4428(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-4416(%rbp,%rax,4), %eax
	addl	%edx, %eax
	testl	%eax, %eax
	je	.L12
	movl	-4432(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -4420(%rbp)
	jmp	.L12
.L11:
	cmpl	$0, -4428(%rbp)
	jne	.L12
	movl	-4432(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -4420(%rbp)
.L12:
	cmpl	$0, -4420(%rbp)
	jne	.L10
	subl	$1, -4428(%rbp)
.L10:
	addl	$1, -4432(%rbp)
	cmpl	$0, -4420(%rbp)
	jne	.L13
	movl	-4436(%rbp), %eax
	cmpl	%eax, -4432(%rbp)
	jne	.L13
	movl	$9999, -4420(%rbp)
.L13:
	cmpl	$0, -4420(%rbp)
	je	.L14
	cmpl	$9999, -4420(%rbp)
	jne	.L15
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L16
.L15:
	movl	-4420(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L16:
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L18
	call	__stack_chk_fail@PLT
.L18:
	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:
