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>
#include <stdlib.h>
#include <string.h>

int main()
{
	int n,i;
	int* list;
	while(scanf("%d",&n),n)
	{
		list = (int*)malloc(sizeof(int)*n*2);
		for(i = 0;i < n*2;i++)
		{
			list[i] = 0;
		}
		for(i = 0;i < n;i++)
		{
			int a;
			scanf("%d",&a);
			list[a-1] = 1;
		}
		int table = 0;
		int j = table;
		int t = 0;
		int h = 0;
		while(1)
		{
			while(list[j] != 1 && j < n*2)j++;
			
			if(j >= n*2)
				j = 0;
			else
			{
				table = j;
				list[j] = -1;
				t++;
				if(t == n)break;
			}
			while(list[j] != 0 && j < n*2)j++;
			if(j >= n*2)
				j = 0;
			else
			{
				table = j;
				list[j] = -1;
				h++;
				if(h == n)break;
			}
		}
		if(t == n)
		{
			printf("%d\n%d\n",n-h,0);
		}
		else
		{
			printf("%d\n%d\n",0,n-t);
		}
	}
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	jmp	.L2
.L20:
	movl	-44(%rbp), %eax
	cltq
	salq	$3, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -16(%rbp)
	movl	$0, -36(%rbp)
	jmp	.L3
.L4:
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	$0, (%rax)
	addl	$1, -36(%rbp)
.L3:
	movl	-44(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -36(%rbp)
	jl	.L4
	movl	$0, -36(%rbp)
	jmp	.L5
.L6:
	leaq	-40(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-40(%rbp), %eax
	cltq
	salq	$2, %rax
	leaq	-4(%rax), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	$1, (%rax)
	addl	$1, -36(%rbp)
.L5:
	movl	-44(%rbp), %eax
	cmpl	%eax, -36(%rbp)
	jl	.L6
	movl	$0, -20(%rbp)
	movl	-20(%rbp), %eax
	movl	%eax, -32(%rbp)
	movl	$0, -28(%rbp)
	movl	$0, -24(%rbp)
	jmp	.L7
.L9:
	addl	$1, -32(%rbp)
.L7:
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	$1, %eax
	je	.L8
	movl	-44(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -32(%rbp)
	jl	.L9
.L8:
	movl	-44(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -32(%rbp)
	jl	.L10
	movl	$0, -32(%rbp)
	jmp	.L13
.L10:
	movl	-32(%rbp), %eax
	movl	%eax, -20(%rbp)
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	$-1, (%rax)
	addl	$1, -28(%rbp)
	movl	-44(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	je	.L23
	jmp	.L13
.L15:
	addl	$1, -32(%rbp)
.L13:
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	testl	%eax, %eax
	je	.L14
	movl	-44(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -32(%rbp)
	jl	.L15
.L14:
	movl	-44(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -32(%rbp)
	jl	.L16
	movl	$0, -32(%rbp)
	jmp	.L7
.L16:
	movl	-32(%rbp), %eax
	movl	%eax, -20(%rbp)
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	$-1, (%rax)
	addl	$1, -24(%rbp)
	movl	-44(%rbp), %eax
	cmpl	%eax, -24(%rbp)
	je	.L24
	jmp	.L7
.L23:
	nop
	jmp	.L12
.L24:
	nop
.L12:
	movl	-44(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jne	.L19
	movl	-44(%rbp), %eax
	subl	-24(%rbp), %eax
	movl	$0, %edx
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L2
.L19:
	movl	-44(%rbp), %eax
	subl	-28(%rbp), %eax
	movl	%eax, %edx
	movl	$0, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L2:
	leaq	-44(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-44(%rbp), %eax
	testl	%eax, %eax
	jne	.L20
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L22
	call	__stack_chk_fail@PLT
.L22:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.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%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB51:
	.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	.LC0(%rip), %rbx
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %r12
	leaq	4(%rsp), %rbp
.L2:
	movq	%r12, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	(%rsp), %r15d
	testl	%r15d, %r15d
	je	.L32
	movslq	%r15d, %rdi
	salq	$3, %rdi
	call	malloc@PLT
	movq	%rax, %r14
	leal	(%r15,%r15), %eax
	testl	%eax, %eax
	jle	.L6
	cltq
	xorl	%esi, %esi
	movq	%r14, %rdi
	leaq	0(,%rax,4), %rdx
	call	memset@PLT
.L6:
	xorl	%r13d, %r13d
	testl	%r15d, %r15d
	jle	.L5
	.p2align 4,,10
	.p2align 3
.L4:
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	addl	$1, %r13d
	call	__isoc99_scanf@PLT
	movslq	4(%rsp), %rax
	movl	(%rsp), %r15d
	movl	$1, -4(%r14,%rax,4)
	cmpl	%r13d, %r15d
	jg	.L4
.L5:
	movl	(%r14), %eax
	leal	(%r15,%r15), %esi
	xorl	%ecx, %ecx
	xorl	%r8d, %r8d
	xorl	%edx, %edx
	.p2align 4,,10
	.p2align 3
.L7:
	cmpl	$1, %eax
	jne	.L18
	cmpl	%edx, %esi
	jle	.L10
	movslq	%edx, %rax
	addl	$1, %r8d
	movl	$-1, (%r14,%rax,4)
	cmpl	%r15d, %r8d
	je	.L11
.L14:
	leaq	4(%r14,%rax,4), %rax
	jmp	.L16
	.p2align 4,,10
	.p2align 3
.L12:
	addq	$4, %rax
	cmpl	%edx, %esi
	jle	.L30
.L16:
	movl	(%rax), %r9d
	addl	$1, %edx
	movq	%rax, %rdi
	testl	%r9d, %r9d
	jne	.L12
.L13:
	cmpl	%edx, %esi
	jle	.L30
	addl	$1, %ecx
	movl	$-1, (%rdi)
	cmpl	%r15d, %ecx
	je	.L33
.L18:
	cmpl	%edx, %esi
	jle	.L10
	addl	$1, %edx
	movslq	%edx, %rax
	movl	(%r14,%rax,4), %eax
	jmp	.L7
.L33:
	cmpl	%r8d, %ecx
	je	.L11
	subl	%r8d, %ecx
	xorl	%edx, %edx
	leaq	.LC1(%rip), %rsi
	xorl	%eax, %eax
	movl	$1, %edi
	call	__printf_chk@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L10:
	movl	(%r14), %edx
	testl	%edx, %edx
	je	.L24
	movl	%edx, %eax
	xorl	%edx, %edx
	testl	%esi, %esi
	jle	.L7
	xorl	%edx, %edx
	xorl	%eax, %eax
	jmp	.L14
	.p2align 4,,10
	.p2align 3
.L30:
	movl	(%r14), %eax
	xorl	%edx, %edx
	jmp	.L7
.L24:
	movq	%r14, %rdi
	jmp	.L13
.L11:
	movl	%r15d, %edx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	subl	%ecx, %edx
	xorl	%ecx, %ecx
	call	__printf_chk@PLT
	jmp	.L2
.L32:
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L34
	addq	$24, %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
.L34:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE51:
	.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%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB51:
	.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	.LC0(%rip), %rbx
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	movq	%rsp, %r12
	leaq	4(%rsp), %rbp
.L2:
	movq	%r12, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	(%rsp), %r15d
	testl	%r15d, %r15d
	je	.L32
	movslq	%r15d, %rdi
	salq	$3, %rdi
	call	malloc@PLT
	movq	%rax, %r14
	leal	(%r15,%r15), %eax
	testl	%eax, %eax
	jle	.L6
	cltq
	xorl	%esi, %esi
	movq	%r14, %rdi
	leaq	0(,%rax,4), %rdx
	call	memset@PLT
.L6:
	xorl	%r13d, %r13d
	testl	%r15d, %r15d
	jle	.L5
	.p2align 4,,10
	.p2align 3
.L4:
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	addl	$1, %r13d
	call	__isoc99_scanf@PLT
	movslq	4(%rsp), %rax
	movl	(%rsp), %r15d
	movl	$1, -4(%r14,%rax,4)
	cmpl	%r13d, %r15d
	jg	.L4
.L5:
	movl	(%r14), %eax
	leal	(%r15,%r15), %esi
	xorl	%ecx, %ecx
	xorl	%r8d, %r8d
	xorl	%edx, %edx
	.p2align 4,,10
	.p2align 3
.L7:
	cmpl	$1, %eax
	jne	.L18
	cmpl	%edx, %esi
	jle	.L10
	movslq	%edx, %rax
	addl	$1, %r8d
	movl	$-1, (%r14,%rax,4)
	cmpl	%r15d, %r8d
	je	.L11
.L14:
	leaq	4(%r14,%rax,4), %rax
	jmp	.L16
	.p2align 4,,10
	.p2align 3
.L12:
	addq	$4, %rax
	cmpl	%edx, %esi
	jle	.L30
.L16:
	movl	(%rax), %r9d
	addl	$1, %edx
	movq	%rax, %rdi
	testl	%r9d, %r9d
	jne	.L12
.L13:
	cmpl	%edx, %esi
	jle	.L30
	addl	$1, %ecx
	movl	$-1, (%rdi)
	cmpl	%r15d, %ecx
	je	.L33
.L18:
	cmpl	%edx, %esi
	jle	.L10
	addl	$1, %edx
	movslq	%edx, %rax
	movl	(%r14,%rax,4), %eax
	jmp	.L7
.L33:
	cmpl	%r8d, %ecx
	je	.L11
	subl	%r8d, %ecx
	xorl	%edx, %edx
	leaq	.LC1(%rip), %rsi
	xorl	%eax, %eax
	movl	$1, %edi
	call	__printf_chk@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L10:
	movl	(%r14), %edx
	testl	%edx, %edx
	je	.L24
	movl	%edx, %eax
	xorl	%edx, %edx
	testl	%esi, %esi
	jle	.L7
	xorl	%edx, %edx
	xorl	%eax, %eax
	jmp	.L14
	.p2align 4,,10
	.p2align 3
.L30:
	movl	(%r14), %eax
	xorl	%edx, %edx
	jmp	.L7
.L24:
	movq	%r14, %rdi
	jmp	.L13
.L11:
	movl	%r15d, %edx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	subl	%ecx, %edx
	xorl	%ecx, %ecx
	call	__printf_chk@PLT
	jmp	.L2
.L32:
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L34
	addq	$24, %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
.L34:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE51:
	.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>
#include <stdlib.h>
#include <string.h>

int main()
{
	int n,i;
	int* list;
	while(scanf("%d",&n),n)
	{
		list = (int*)malloc(sizeof(int)*n*2);
		for(i = 0;i < n*2;i++)
		{
			list[i] = 0;
		}
		for(i = 0;i < n;i++)
		{
			int a;
			scanf("%d",&a);
			list[a-1] = 1;
		}
		int table = 0;
		int j = table;
		int t = 0;
		int h = 0;
		while(1)
		{
			while(list[j] != 1 && j < n*2)j++;
			
			if(j >= n*2)
				j = 0;
			else
			{
				table = j;
				list[j] = -1;
				t++;
				if(t == n)break;
			}
			while(list[j] != 0 && j < n*2)j++;
			if(j >= n*2)
				j = 0;
			else
			{
				table = j;
				list[j] = -1;
				h++;
				if(h == n)break;
			}
		}
		if(t == n)
		{
			printf("%d\n%d\n",n-h,0);
		}
		else
		{
			printf("%d\n%d\n",0,n-t);
		}
	}
	return 0;
}
5
1
7
9
6
10
10
8
7
14
18
2
11
3
17
5
19
0
 5
1
7
9
6
5
10
8
7
14
18
4
11
6
17
5
19
0
 5
1
7
9
6
10
10
4
7
14
18
2
11
3
17
5
19
0
 5
1
7
9
6
5
10
8
7
13
18
1
11
6
17
5
19
0
 5
1
7
9
6
10
10
8
7
14
18
2
11
3
1
5
19
0
 5
1
2
9
6
10
10
8
7
14
18
4
11
6
17
5
19
0
 5
1
7
9
6
10
10
8
7
14
18
2
17
3
1
5
19
0
 5
2
7
9
6
8
10
8
7
14
18
2
17
3
1
5
19
0
 5
1
7
9
6
5
10
8
7
13
18
1
11
6
16
5
19
0
 5
1
7
9
6
4
10
10
7
13
18
1
11
12
17
5
19
0

3
0
1
0
 1
0
1
0
 3
0
2
0
 1
0
2
0
 3
0
0
2
 2
0
1
0
 3
0
0
1
 2
0
0
1
 1
0
0
1
 0
1
2
0

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>
#include <stdlib.h>
#include <string.h>

int main()
{
	int n,i;
	int* list;
	while(scanf("%d",&n),n)
	{
		list = (int*)malloc(sizeof(int)*n*2);
		for(i = 0;i < n*2;i++)
		{
			list[i] = 0;
		}
		for(i = 0;i < n;i++)
		{
			int a;
			scanf("%d",&a);
			list[a-1] = 1;
		}
		int table = 0;
		int j = table;
		int t = 0;
		int h = 0;
		while(1)
		{
			while(list[j] != 1 && j < n*2)j++;
			
			if(j >= n*2)
				j = 0;
			else
			{
				table = j;
				list[j] = -1;
				t++;
				if(t == n)break;
			}
			while(list[j] != 0 && j < n*2)j++;
			if(j >= n*2)
				j = 0;
			else
			{
				table = j;
				list[j] = -1;
				h++;
				if(h == n)break;
			}
		}
		if(t == n)
		{
			printf("%d\n%d\n",n-h,0);
		}
		else
		{
			printf("%d\n%d\n",0,n-t);
		}
	}
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	jmp	.L2
.L20:
	movl	-44(%rbp), %eax
	cltq
	salq	$3, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -16(%rbp)
	movl	$0, -36(%rbp)
	jmp	.L3
.L4:
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	$0, (%rax)
	addl	$1, -36(%rbp)
.L3:
	movl	-44(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -36(%rbp)
	jl	.L4
	movl	$0, -36(%rbp)
	jmp	.L5
.L6:
	leaq	-40(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-40(%rbp), %eax
	cltq
	salq	$2, %rax
	leaq	-4(%rax), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	$1, (%rax)
	addl	$1, -36(%rbp)
.L5:
	movl	-44(%rbp), %eax
	cmpl	%eax, -36(%rbp)
	jl	.L6
	movl	$0, -20(%rbp)
	movl	-20(%rbp), %eax
	movl	%eax, -32(%rbp)
	movl	$0, -28(%rbp)
	movl	$0, -24(%rbp)
	jmp	.L7
.L9:
	addl	$1, -32(%rbp)
.L7:
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	$1, %eax
	je	.L8
	movl	-44(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -32(%rbp)
	jl	.L9
.L8:
	movl	-44(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -32(%rbp)
	jl	.L10
	movl	$0, -32(%rbp)
	jmp	.L13
.L10:
	movl	-32(%rbp), %eax
	movl	%eax, -20(%rbp)
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	$-1, (%rax)
	addl	$1, -28(%rbp)
	movl	-44(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	je	.L23
	jmp	.L13
.L15:
	addl	$1, -32(%rbp)
.L13:
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	testl	%eax, %eax
	je	.L14
	movl	-44(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -32(%rbp)
	jl	.L15
.L14:
	movl	-44(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -32(%rbp)
	jl	.L16
	movl	$0, -32(%rbp)
	jmp	.L7
.L16:
	movl	-32(%rbp), %eax
	movl	%eax, -20(%rbp)
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	$-1, (%rax)
	addl	$1, -24(%rbp)
	movl	-44(%rbp), %eax
	cmpl	%eax, -24(%rbp)
	je	.L24
	jmp	.L7
.L23:
	nop
	jmp	.L12
.L24:
	nop
.L12:
	movl	-44(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jne	.L19
	movl	-44(%rbp), %eax
	subl	-24(%rbp), %eax
	movl	$0, %edx
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L2
.L19:
	movl	-44(%rbp), %eax
	subl	-28(%rbp), %eax
	movl	%eax, %edx
	movl	$0, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L2:
	leaq	-44(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-44(%rbp), %eax
	testl	%eax, %eax
	jne	.L20
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L22
	call	__stack_chk_fail@PLT
.L22:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.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%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	jmp	.L2
.L20:
	movl	-44(%rbp), %eax
	cltq
	salq	$3, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -16(%rbp)
	movl	$0, -36(%rbp)
	jmp	.L3
.L4:
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	$0, (%rax)
	addl	$1, -36(%rbp)
.L3:
	movl	-44(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -36(%rbp)
	jl	.L4
	movl	$0, -36(%rbp)
	jmp	.L5
.L6:
	leaq	-40(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-40(%rbp), %eax
	cltq
	salq	$2, %rax
	leaq	-4(%rax), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	$1, (%rax)
	addl	$1, -36(%rbp)
.L5:
	movl	-44(%rbp), %eax
	cmpl	%eax, -36(%rbp)
	jl	.L6
	movl	$0, -20(%rbp)
	movl	-20(%rbp), %eax
	movl	%eax, -32(%rbp)
	movl	$0, -28(%rbp)
	movl	$0, -24(%rbp)
	jmp	.L7
.L9:
	addl	$1, -32(%rbp)
.L7:
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	$1, %eax
	je	.L8
	movl	-44(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -32(%rbp)
	jl	.L9
.L8:
	movl	-44(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -32(%rbp)
	jl	.L10
	movl	$0, -32(%rbp)
	jmp	.L13
.L10:
	movl	-32(%rbp), %eax
	movl	%eax, -20(%rbp)
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	$-1, (%rax)
	addl	$1, -28(%rbp)
	movl	-44(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	je	.L23
	jmp	.L13
.L15:
	addl	$1, -32(%rbp)
.L13:
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	testl	%eax, %eax
	je	.L14
	movl	-44(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -32(%rbp)
	jl	.L15
.L14:
	movl	-44(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -32(%rbp)
	jl	.L16
	movl	$0, -32(%rbp)
	jmp	.L7
.L16:
	movl	-32(%rbp), %eax
	movl	%eax, -20(%rbp)
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-16(%rbp), %rax
	addq	%rdx, %rax
	movl	$-1, (%rax)
	addl	$1, -24(%rbp)
	movl	-44(%rbp), %eax
	cmpl	%eax, -24(%rbp)
	je	.L24
	jmp	.L7
.L23:
	nop
	jmp	.L12
.L24:
	nop
.L12:
	movl	-44(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jne	.L19
	movl	-44(%rbp), %eax
	subl	-24(%rbp), %eax
	movl	$0, %edx
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L2
.L19:
	movl	-44(%rbp), %eax
	subl	-28(%rbp), %eax
	movl	%eax, %edx
	movl	$0, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L2:
	leaq	-44(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-44(%rbp), %eax
	testl	%eax, %eax
	jne	.L20
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L22
	call	__stack_chk_fail@PLT
.L22:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.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:
