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 i,j,k,c,flag1,flag2,sheet,score1,score2;
	int n, card[200], t_card[100], h_card[100];

	while (1) {
		k = 0;
		score1 = 0;
		score2 = 0;
		scanf("%d", &n);
		if (n == 0)break;
		for (i = 0; i < 2 * n; i++) 
			card[i] = i + 1;
		
		for (i = 0; i < n; i++) {
			scanf("%d", &t_card[i]);
			for (j = 0; j < 2 * n; j++) {
				if (t_card[i] == card[j])
					card[j] = 0;
			}
		}
		for (i = 0; i < 2 * n; i++) {
			if (card[i] != 0)
				h_card[k++] = card[i];
		}
		for (i = 0; i < n; i++) {
			for (j = i + 1; j < n; j++) {
				if (t_card[i] > t_card[j]) {
					int temp = t_card[i];
					t_card[i] = t_card[j];
					t_card[j] = temp;
				}
			}
		}
		for (i = 0; i < k; i++) {
			for (j = i + 1; j < k; j++) {
				if (h_card[i] > h_card[j]) {
					int temp = h_card[i];
					h_card[i] = h_card[j];
					h_card[j] = temp;
				}
			}
		}
		c = t_card[0];
		t_card[0] = 0;
		sheet = n;
		while (n-1 != 0 && k != 0) {
			flag1 = 0, flag2 = 0;
			for (j = 0; j < sheet; j++) {
				if (c < h_card[j]) {
					c = h_card[j];
					h_card[j] = 0;
					k--;
					flag1 = 1;
					break;
				}
			}
			if (!flag1)c = 0;
	
			for (i = 0; i < sheet; i++) {
				if (c < t_card[i]) {
					c = t_card[i];
					t_card[i] = 0;
					n--;
					flag2 = 1;
					break;
				}
			}
			if (!flag2)c = 0;
		}
		for (i = 0; i < sheet; i++) {
			if (t_card[i] != 0) score2++;
			if (h_card[i] != 0)score1++;
		}
		printf("%d\n%d\n",score1,score2);
	}
	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:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$1664, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L40:
	movl	$0, -1652(%rbp)
	movl	$0, -1636(%rbp)
	movl	$0, -1632(%rbp)
	leaq	-1664(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-1664(%rbp), %eax
	testl	%eax, %eax
	je	.L44
	movl	$0, -1660(%rbp)
	jmp	.L4
.L5:
	movl	-1660(%rbp), %eax
	leal	1(%rax), %edx
	movl	-1660(%rbp), %eax
	cltq
	movl	%edx, -816(%rbp,%rax,4)
	addl	$1, -1660(%rbp)
.L4:
	movl	-1664(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -1660(%rbp)
	jl	.L5
	movl	$0, -1660(%rbp)
	jmp	.L6
.L10:
	leaq	-1616(%rbp), %rdx
	movl	-1660(%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
	movl	$0, -1656(%rbp)
	jmp	.L7
.L9:
	movl	-1660(%rbp), %eax
	cltq
	movl	-1616(%rbp,%rax,4), %edx
	movl	-1656(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jne	.L8
	movl	-1656(%rbp), %eax
	cltq
	movl	$0, -816(%rbp,%rax,4)
.L8:
	addl	$1, -1656(%rbp)
.L7:
	movl	-1664(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -1656(%rbp)
	jl	.L9
	addl	$1, -1660(%rbp)
.L6:
	movl	-1664(%rbp), %eax
	cmpl	%eax, -1660(%rbp)
	jl	.L10
	movl	$0, -1660(%rbp)
	jmp	.L11
.L13:
	movl	-1660(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %eax
	testl	%eax, %eax
	je	.L12
	movl	-1652(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -1652(%rbp)
	movl	-1660(%rbp), %edx
	movslq	%edx, %rdx
	movl	-816(%rbp,%rdx,4), %edx
	cltq
	movl	%edx, -1216(%rbp,%rax,4)
.L12:
	addl	$1, -1660(%rbp)
.L11:
	movl	-1664(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -1660(%rbp)
	jl	.L13
	movl	$0, -1660(%rbp)
	jmp	.L14
.L18:
	movl	-1660(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -1656(%rbp)
	jmp	.L15
.L17:
	movl	-1660(%rbp), %eax
	cltq
	movl	-1616(%rbp,%rax,4), %edx
	movl	-1656(%rbp), %eax
	cltq
	movl	-1616(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jle	.L16
	movl	-1660(%rbp), %eax
	cltq
	movl	-1616(%rbp,%rax,4), %eax
	movl	%eax, -1620(%rbp)
	movl	-1656(%rbp), %eax
	cltq
	movl	-1616(%rbp,%rax,4), %edx
	movl	-1660(%rbp), %eax
	cltq
	movl	%edx, -1616(%rbp,%rax,4)
	movl	-1656(%rbp), %eax
	cltq
	movl	-1620(%rbp), %edx
	movl	%edx, -1616(%rbp,%rax,4)
.L16:
	addl	$1, -1656(%rbp)
.L15:
	movl	-1664(%rbp), %eax
	cmpl	%eax, -1656(%rbp)
	jl	.L17
	addl	$1, -1660(%rbp)
.L14:
	movl	-1664(%rbp), %eax
	cmpl	%eax, -1660(%rbp)
	jl	.L18
	movl	$0, -1660(%rbp)
	jmp	.L19
.L23:
	movl	-1660(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -1656(%rbp)
	jmp	.L20
.L22:
	movl	-1660(%rbp), %eax
	cltq
	movl	-1216(%rbp,%rax,4), %edx
	movl	-1656(%rbp), %eax
	cltq
	movl	-1216(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jle	.L21
	movl	-1660(%rbp), %eax
	cltq
	movl	-1216(%rbp,%rax,4), %eax
	movl	%eax, -1624(%rbp)
	movl	-1656(%rbp), %eax
	cltq
	movl	-1216(%rbp,%rax,4), %edx
	movl	-1660(%rbp), %eax
	cltq
	movl	%edx, -1216(%rbp,%rax,4)
	movl	-1656(%rbp), %eax
	cltq
	movl	-1624(%rbp), %edx
	movl	%edx, -1216(%rbp,%rax,4)
.L21:
	addl	$1, -1656(%rbp)
.L20:
	movl	-1656(%rbp), %eax
	cmpl	-1652(%rbp), %eax
	jl	.L22
	addl	$1, -1660(%rbp)
.L19:
	movl	-1660(%rbp), %eax
	cmpl	-1652(%rbp), %eax
	jl	.L23
	movl	-1616(%rbp), %eax
	movl	%eax, -1648(%rbp)
	movl	$0, -1616(%rbp)
	movl	-1664(%rbp), %eax
	movl	%eax, -1628(%rbp)
	jmp	.L24
.L35:
	movl	$0, -1644(%rbp)
	movl	$0, -1640(%rbp)
	movl	$0, -1656(%rbp)
	jmp	.L25
.L28:
	movl	-1656(%rbp), %eax
	cltq
	movl	-1216(%rbp,%rax,4), %eax
	cmpl	%eax, -1648(%rbp)
	jge	.L26
	movl	-1656(%rbp), %eax
	cltq
	movl	-1216(%rbp,%rax,4), %eax
	movl	%eax, -1648(%rbp)
	movl	-1656(%rbp), %eax
	cltq
	movl	$0, -1216(%rbp,%rax,4)
	subl	$1, -1652(%rbp)
	movl	$1, -1644(%rbp)
	jmp	.L27
.L26:
	addl	$1, -1656(%rbp)
.L25:
	movl	-1656(%rbp), %eax
	cmpl	-1628(%rbp), %eax
	jl	.L28
.L27:
	cmpl	$0, -1644(%rbp)
	jne	.L29
	movl	$0, -1648(%rbp)
.L29:
	movl	$0, -1660(%rbp)
	jmp	.L30
.L33:
	movl	-1660(%rbp), %eax
	cltq
	movl	-1616(%rbp,%rax,4), %eax
	cmpl	%eax, -1648(%rbp)
	jge	.L31
	movl	-1660(%rbp), %eax
	cltq
	movl	-1616(%rbp,%rax,4), %eax
	movl	%eax, -1648(%rbp)
	movl	-1660(%rbp), %eax
	cltq
	movl	$0, -1616(%rbp,%rax,4)
	movl	-1664(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -1664(%rbp)
	movl	$1, -1640(%rbp)
	jmp	.L32
.L31:
	addl	$1, -1660(%rbp)
.L30:
	movl	-1660(%rbp), %eax
	cmpl	-1628(%rbp), %eax
	jl	.L33
.L32:
	cmpl	$0, -1640(%rbp)
	jne	.L24
	movl	$0, -1648(%rbp)
.L24:
	movl	-1664(%rbp), %eax
	cmpl	$1, %eax
	je	.L34
	cmpl	$0, -1652(%rbp)
	jne	.L35
.L34:
	movl	$0, -1660(%rbp)
	jmp	.L36
.L39:
	movl	-1660(%rbp), %eax
	cltq
	movl	-1616(%rbp,%rax,4), %eax
	testl	%eax, %eax
	je	.L37
	addl	$1, -1632(%rbp)
.L37:
	movl	-1660(%rbp), %eax
	cltq
	movl	-1216(%rbp,%rax,4), %eax
	testl	%eax, %eax
	je	.L38
	addl	$1, -1636(%rbp)
.L38:
	addl	$1, -1660(%rbp)
.L36:
	movl	-1660(%rbp), %eax
	cmpl	-1628(%rbp), %eax
	jl	.L39
	movl	-1632(%rbp), %edx
	movl	-1636(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L40
.L44:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L42
	call	__stack_chk_fail@PLT
.L42:
	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
.LC1:
	.string	"%d"
.LC4:
	.string	"%d\n%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
	leaq	.LC1(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	xorl	%ebx, %ebx
	subq	$1640, %rsp
	.cfi_def_cfa_offset 1696
	movq	%fs:40, %rax
	movq	%rax, 1624(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %r12
	.p2align 4,,10
	.p2align 3
.L65:
	movq	%r12, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %esi
	testl	%esi, %esi
	je	.L2
	leal	(%rsi,%rsi), %edx
	testl	%edx, %edx
	jle	.L9
	leal	-1(%rdx), %eax
	cmpl	$2, %eax
	jbe	.L6
	movl	%edx, %ecx
	movdqa	.LC0(%rip), %xmm1
	leaq	816(%rsp), %rax
	shrl	$2, %ecx
	subl	$1, %ecx
	salq	$4, %rcx
	leaq	832(%rsp,%rcx), %rcx
	.p2align 4,,10
	.p2align 3
.L7:
	movdqa	%xmm1, %xmm0
	paddd	.LC3(%rip), %xmm0
	addq	$16, %rax
	paddd	.LC2(%rip), %xmm1
	movaps	%xmm0, -16(%rax)
	cmpq	%rcx, %rax
	jne	.L7
	movl	%edx, %ecx
	andl	$-4, %ecx
	testb	$3, %dl
	je	.L9
	leal	1(%rcx), %eax
	movslq	%ecx, %rcx
	movl	%eax, 816(%rsp,%rcx,4)
	cmpl	%edx, %eax
	jge	.L9
.L68:
	leal	1(%rax), %ecx
	movslq	%eax, %rdi
	movl	%ecx, 816(%rsp,%rdi,4)
	cmpl	%edx, %ecx
	jge	.L9
	movslq	%ecx, %rcx
	addl	$2, %eax
	movl	%eax, 816(%rsp,%rcx,4)
.L9:
	leaq	16(%rsp), %r13
	xorl	%r14d, %r14d
	testl	%esi, %esi
	jle	.L110
	.p2align 4,,10
	.p2align 3
.L12:
	movq	%r13, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %esi
	leal	(%rsi,%rsi), %edx
	testl	%edx, %edx
	jle	.L17
	leal	-1(%rdx), %eax
	movl	0(%r13), %edi
	cmpl	$2, %eax
	jbe	.L70
	movl	%edx, %ecx
	movd	%edi, %xmm4
	leaq	816(%rsp), %rax
	shrl	$2, %ecx
	pshufd	$0, %xmm4, %xmm1
	subl	$1, %ecx
	salq	$4, %rcx
	leaq	832(%rsp,%rcx), %rcx
	.p2align 4,,10
	.p2align 3
.L15:
	movdqa	%xmm1, %xmm0
	addq	$16, %rax
	pcmpeqd	-16(%rax), %xmm0
	pandn	-16(%rax), %xmm0
	movaps	%xmm0, -16(%rax)
	cmpq	%rcx, %rax
	jne	.L15
	movl	%edx, %eax
	andl	$-4, %eax
	testb	$3, %dl
	je	.L17
.L14:
	movslq	%eax, %r8
	movl	816(%rsp,%r8,4), %ecx
	cmpl	%ecx, %edi
	cmove	%ebx, %ecx
	movl	%ecx, 816(%rsp,%r8,4)
	leal	1(%rax), %ecx
	cmpl	%ecx, %edx
	jle	.L17
	movslq	%ecx, %rcx
	movl	816(%rsp,%rcx,4), %r8d
	cmpl	%r8d, %edi
	cmove	%ebx, %r8d
	addl	$2, %eax
	movl	%r8d, 816(%rsp,%rcx,4)
	cmpl	%edx, %eax
	jge	.L17
	cltq
	movl	816(%rsp,%rax,4), %ecx
	cmpl	%ecx, %edi
	cmove	%ebx, %ecx
	movl	%ecx, 816(%rsp,%rax,4)
.L17:
	addl	$1, %r14d
	addq	$4, %r13
	cmpl	%esi, %r14d
	jl	.L12
	testl	%edx, %edx
	jle	.L22
.L67:
	subl	$1, %edx
	leaq	816(%rsp), %rax
	xorl	%edi, %edi
	leaq	820(%rsp,%rdx,4), %rcx
	.p2align 4,,10
	.p2align 3
.L24:
	movl	(%rax), %edx
	testl	%edx, %edx
	je	.L23
	movslq	%edi, %r8
	addl	$1, %edi
	movl	%edx, 416(%rsp,%r8,4)
.L23:
	addq	$4, %rax
	cmpq	%rcx, %rax
	jne	.L24
	cmpl	$1, %esi
	setne	%r8b
	testl	%edi, %edi
	setne	%al
	andl	%eax, %r8d
	testl	%esi, %esi
	jle	.L29
	cmpl	$1, %esi
	je	.L29
.L27:
	leaq	20(%rsp), %r10
	movl	$1, %r11d
	.p2align 4,,10
	.p2align 3
.L31:
	movq	%r10, %rax
	movl	%r11d, %edx
	.p2align 4,,10
	.p2align 3
.L33:
	movl	-4(%r10), %ecx
	movl	(%rax), %r9d
	cmpl	%r9d, %ecx
	jle	.L32
	movl	%r9d, -4(%r10)
	movl	%ecx, (%rax)
.L32:
	addl	$1, %edx
	addq	$4, %rax
	cmpl	%esi, %edx
	jl	.L33
	addl	$1, %r11d
	addq	$4, %r10
	cmpl	%esi, %r11d
	jne	.L31
.L29:
	testl	%edi, %edi
	je	.L40
	leal	-1(%rdi), %r15d
	leal	1(%rdi), %r13d
	movl	$1, %r11d
	leaq	416(%rsp), %r9
	leaq	420(%rsp), %r14
	.p2align 4,,10
	.p2align 3
.L39:
	cmpl	%r11d, %edi
	jle	.L43
	movl	%r15d, %eax
	subl	%r11d, %eax
	leaq	-1(%r11,%rax), %rax
	leaq	(%r14,%rax,4), %r10
	movq	%r9, %rax
	.p2align 4,,10
	.p2align 3
.L42:
	movl	(%r9), %edx
	movl	4(%rax), %ecx
	cmpl	%ecx, %edx
	jle	.L41
	movl	%ecx, (%r9)
	movl	%edx, 4(%rax)
.L41:
	addq	$4, %rax
	cmpq	%r10, %rax
	jne	.L42
.L43:
	addq	$1, %r11
	addq	$4, %r9
	cmpq	%r13, %r11
	jne	.L39
.L40:
	movl	16(%rsp), %edx
	movl	%esi, %r13d
	movl	%ebx, 16(%rsp)
	xorl	%r14d, %r14d
	movslq	%esi, %r9
	testb	%r8b, %r8b
	je	.L44
	.p2align 4,,10
	.p2align 3
.L36:
	xorl	%eax, %eax
	leaq	416(%rsp), %r10
	testl	%esi, %esi
	jg	.L47
	jmp	.L108
	.p2align 4,,10
	.p2align 3
.L45:
	addq	$1, %rax
	cmpq	%r9, %rax
	je	.L111
.L47:
	movl	(%r10,%rax,4), %ecx
	movslq	%eax, %r11
	cmpl	%edx, %ecx
	jle	.L45
	movl	$0, 416(%rsp,%r11,4)
	subl	$1, %edi
.L46:
	xorl	%eax, %eax
	leaq	16(%rsp), %r11
	jmp	.L50
	.p2align 4,,10
	.p2align 3
.L48:
	addq	$1, %rax
	cmpq	%rax, %r9
	je	.L108
.L50:
	movl	(%r11,%rax,4), %edx
	movslq	%eax, %r10
	cmpl	%ecx, %edx
	jle	.L48
	movl	$0, 16(%rsp,%r10,4)
	subl	$1, %r13d
	movl	%r8d, %r14d
.L49:
	testl	%edi, %edi
	je	.L51
	cmpl	$1, %r13d
	jne	.L36
.L51:
	testb	%r14b, %r14b
	je	.L44
	movl	%r13d, 12(%rsp)
.L44:
	testl	%esi, %esi
	jle	.L73
.L66:
	leal	-1(%rsi), %eax
	cmpl	$2, %eax
	jbe	.L74
	movl	%esi, %edx
	pxor	%xmm1, %xmm1
	leaq	16(%rsp), %r11
	xorl	%eax, %eax
	shrl	$2, %edx
	movdqa	%xmm1, %xmm0
	leaq	416(%rsp), %r10
	salq	$4, %rdx
	movdqa	%xmm1, %xmm2
	.p2align 4,,10
	.p2align 3
.L55:
	movdqa	%xmm2, %xmm3
	pcmpeqd	(%r11,%rax), %xmm3
	pcmpeqd	%xmm2, %xmm3
	psubd	%xmm3, %xmm1
	movdqa	%xmm2, %xmm3
	pcmpeqd	(%r10,%rax), %xmm3
	addq	$16, %rax
	pcmpeqd	%xmm2, %xmm3
	psubd	%xmm3, %xmm0
	cmpq	%rax, %rdx
	jne	.L55
	movdqa	%xmm0, %xmm2
	movl	%esi, %eax
	psrldq	$8, %xmm2
	andl	$-4, %eax
	paddd	%xmm2, %xmm0
	movdqa	%xmm0, %xmm2
	psrldq	$4, %xmm2
	paddd	%xmm2, %xmm0
	movd	%xmm0, %edx
	movdqa	%xmm1, %xmm0
	psrldq	$8, %xmm0
	paddd	%xmm0, %xmm1
	movdqa	%xmm1, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm1
	movd	%xmm1, %ecx
	testb	$3, %sil
	je	.L53
.L54:
	movslq	%eax, %rdi
	cmpl	$1, 16(%rsp,%rdi,4)
	sbbl	$-1, %ecx
	cmpl	$1, 416(%rsp,%rdi,4)
	leal	1(%rax), %edi
	sbbl	$-1, %edx
	cmpl	%esi, %edi
	jge	.L53
	movslq	%edi, %rdi
	cmpl	$1, 16(%rsp,%rdi,4)
	sbbl	$-1, %ecx
	cmpl	$1, 416(%rsp,%rdi,4)
	sbbl	$-1, %edx
	addl	$2, %eax
	cmpl	%esi, %eax
	jge	.L53
	cltq
	cmpl	$1, 16(%rsp,%rax,4)
	sbbl	$-1, %ecx
	cmpl	$1, 416(%rsp,%rax,4)
	sbbl	$-1, %edx
.L53:
	leaq	.LC4(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L65
	.p2align 4,,10
	.p2align 3
.L108:
	xorl	%edx, %edx
	jmp	.L49
	.p2align 4,,10
	.p2align 3
.L111:
	xorl	%ecx, %ecx
	jmp	.L46
.L70:
	xorl	%eax, %eax
	jmp	.L14
.L2:
	movq	1624(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L112
	addq	$1640, %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
.L110:
	.cfi_restore_state
	testl	%edx, %edx
	jg	.L67
.L26:
	movl	%ebx, 16(%rsp)
	xorl	%ecx, %ecx
	xorl	%edx, %edx
	jmp	.L53
.L22:
	testl	%esi, %esi
	jle	.L26
	xorl	%edi, %edi
	xorl	%r8d, %r8d
	cmpl	$1, %esi
	jne	.L27
	movl	%ebx, 16(%rsp)
	jmp	.L66
.L73:
	xorl	%ecx, %ecx
	xorl	%edx, %edx
	jmp	.L53
.L6:
	movl	$1, 816(%rsp)
	movl	$1, %eax
	jmp	.L68
.L74:
	xorl	%ecx, %ecx
	xorl	%edx, %edx
	xorl	%eax, %eax
	jmp	.L54
.L112:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.long	0
	.long	1
	.long	2
	.long	3
	.align 16
.LC2:
	.long	4
	.long	4
	.long	4
	.long	4
	.align 16
.LC3:
	.long	1
	.long	1
	.long	1
	.long	1
	.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
.LC1:
	.string	"%d"
.LC4:
	.string	"%d\n%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
	leaq	.LC1(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	xorl	%ebx, %ebx
	subq	$1640, %rsp
	.cfi_def_cfa_offset 1696
	movq	%fs:40, %rax
	movq	%rax, 1624(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %r12
	.p2align 4,,10
	.p2align 3
.L65:
	movq	%r12, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %esi
	testl	%esi, %esi
	je	.L2
	leal	(%rsi,%rsi), %edx
	testl	%edx, %edx
	jle	.L9
	leal	-1(%rdx), %eax
	cmpl	$2, %eax
	jbe	.L6
	movl	%edx, %ecx
	movdqa	.LC0(%rip), %xmm1
	leaq	816(%rsp), %rax
	shrl	$2, %ecx
	subl	$1, %ecx
	salq	$4, %rcx
	leaq	832(%rsp,%rcx), %rcx
	.p2align 4,,10
	.p2align 3
.L7:
	movdqa	%xmm1, %xmm0
	paddd	.LC3(%rip), %xmm0
	addq	$16, %rax
	paddd	.LC2(%rip), %xmm1
	movaps	%xmm0, -16(%rax)
	cmpq	%rcx, %rax
	jne	.L7
	movl	%edx, %ecx
	andl	$-4, %ecx
	testb	$3, %dl
	je	.L9
	leal	1(%rcx), %eax
	movslq	%ecx, %rcx
	movl	%eax, 816(%rsp,%rcx,4)
	cmpl	%edx, %eax
	jge	.L9
.L68:
	leal	1(%rax), %ecx
	movslq	%eax, %rdi
	movl	%ecx, 816(%rsp,%rdi,4)
	cmpl	%edx, %ecx
	jge	.L9
	movslq	%ecx, %rcx
	addl	$2, %eax
	movl	%eax, 816(%rsp,%rcx,4)
.L9:
	leaq	16(%rsp), %r13
	xorl	%r14d, %r14d
	testl	%esi, %esi
	jle	.L110
	.p2align 4,,10
	.p2align 3
.L12:
	movq	%r13, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %esi
	leal	(%rsi,%rsi), %edx
	testl	%edx, %edx
	jle	.L17
	leal	-1(%rdx), %eax
	movl	0(%r13), %edi
	cmpl	$2, %eax
	jbe	.L70
	movl	%edx, %ecx
	movd	%edi, %xmm4
	leaq	816(%rsp), %rax
	shrl	$2, %ecx
	pshufd	$0, %xmm4, %xmm1
	subl	$1, %ecx
	salq	$4, %rcx
	leaq	832(%rsp,%rcx), %rcx
	.p2align 4,,10
	.p2align 3
.L15:
	movdqa	%xmm1, %xmm0
	addq	$16, %rax
	pcmpeqd	-16(%rax), %xmm0
	pandn	-16(%rax), %xmm0
	movaps	%xmm0, -16(%rax)
	cmpq	%rcx, %rax
	jne	.L15
	movl	%edx, %eax
	andl	$-4, %eax
	testb	$3, %dl
	je	.L17
.L14:
	movslq	%eax, %r8
	movl	816(%rsp,%r8,4), %ecx
	cmpl	%ecx, %edi
	cmove	%ebx, %ecx
	movl	%ecx, 816(%rsp,%r8,4)
	leal	1(%rax), %ecx
	cmpl	%ecx, %edx
	jle	.L17
	movslq	%ecx, %rcx
	movl	816(%rsp,%rcx,4), %r8d
	cmpl	%r8d, %edi
	cmove	%ebx, %r8d
	addl	$2, %eax
	movl	%r8d, 816(%rsp,%rcx,4)
	cmpl	%edx, %eax
	jge	.L17
	cltq
	movl	816(%rsp,%rax,4), %ecx
	cmpl	%ecx, %edi
	cmove	%ebx, %ecx
	movl	%ecx, 816(%rsp,%rax,4)
.L17:
	addl	$1, %r14d
	addq	$4, %r13
	cmpl	%esi, %r14d
	jl	.L12
	testl	%edx, %edx
	jle	.L22
.L67:
	subl	$1, %edx
	leaq	816(%rsp), %rax
	xorl	%edi, %edi
	leaq	820(%rsp,%rdx,4), %rcx
	.p2align 4,,10
	.p2align 3
.L24:
	movl	(%rax), %edx
	testl	%edx, %edx
	je	.L23
	movslq	%edi, %r8
	addl	$1, %edi
	movl	%edx, 416(%rsp,%r8,4)
.L23:
	addq	$4, %rax
	cmpq	%rcx, %rax
	jne	.L24
	cmpl	$1, %esi
	setne	%r8b
	testl	%edi, %edi
	setne	%al
	andl	%eax, %r8d
	testl	%esi, %esi
	jle	.L29
	cmpl	$1, %esi
	je	.L29
.L27:
	leaq	20(%rsp), %r10
	movl	$1, %r11d
	.p2align 4,,10
	.p2align 3
.L31:
	movq	%r10, %rax
	movl	%r11d, %edx
	.p2align 4,,10
	.p2align 3
.L33:
	movl	-4(%r10), %ecx
	movl	(%rax), %r9d
	cmpl	%r9d, %ecx
	jle	.L32
	movl	%r9d, -4(%r10)
	movl	%ecx, (%rax)
.L32:
	addl	$1, %edx
	addq	$4, %rax
	cmpl	%esi, %edx
	jl	.L33
	addl	$1, %r11d
	addq	$4, %r10
	cmpl	%esi, %r11d
	jne	.L31
.L29:
	testl	%edi, %edi
	je	.L40
	leal	-1(%rdi), %r15d
	leal	1(%rdi), %r13d
	movl	$1, %r11d
	leaq	416(%rsp), %r9
	leaq	420(%rsp), %r14
	.p2align 4,,10
	.p2align 3
.L39:
	cmpl	%r11d, %edi
	jle	.L43
	movl	%r15d, %eax
	subl	%r11d, %eax
	leaq	-1(%r11,%rax), %rax
	leaq	(%r14,%rax,4), %r10
	movq	%r9, %rax
	.p2align 4,,10
	.p2align 3
.L42:
	movl	(%r9), %edx
	movl	4(%rax), %ecx
	cmpl	%ecx, %edx
	jle	.L41
	movl	%ecx, (%r9)
	movl	%edx, 4(%rax)
.L41:
	addq	$4, %rax
	cmpq	%r10, %rax
	jne	.L42
.L43:
	addq	$1, %r11
	addq	$4, %r9
	cmpq	%r13, %r11
	jne	.L39
.L40:
	movl	16(%rsp), %edx
	movl	%esi, %r13d
	movl	%ebx, 16(%rsp)
	xorl	%r14d, %r14d
	movslq	%esi, %r9
	testb	%r8b, %r8b
	je	.L44
	.p2align 4,,10
	.p2align 3
.L36:
	xorl	%eax, %eax
	leaq	416(%rsp), %r10
	testl	%esi, %esi
	jg	.L47
	jmp	.L108
	.p2align 4,,10
	.p2align 3
.L45:
	addq	$1, %rax
	cmpq	%r9, %rax
	je	.L111
.L47:
	movl	(%r10,%rax,4), %ecx
	movslq	%eax, %r11
	cmpl	%edx, %ecx
	jle	.L45
	movl	$0, 416(%rsp,%r11,4)
	subl	$1, %edi
.L46:
	xorl	%eax, %eax
	leaq	16(%rsp), %r11
	jmp	.L50
	.p2align 4,,10
	.p2align 3
.L48:
	addq	$1, %rax
	cmpq	%rax, %r9
	je	.L108
.L50:
	movl	(%r11,%rax,4), %edx
	movslq	%eax, %r10
	cmpl	%ecx, %edx
	jle	.L48
	movl	$0, 16(%rsp,%r10,4)
	subl	$1, %r13d
	movl	%r8d, %r14d
.L49:
	testl	%edi, %edi
	je	.L51
	cmpl	$1, %r13d
	jne	.L36
.L51:
	testb	%r14b, %r14b
	je	.L44
	movl	%r13d, 12(%rsp)
.L44:
	testl	%esi, %esi
	jle	.L73
.L66:
	leal	-1(%rsi), %eax
	cmpl	$2, %eax
	jbe	.L74
	movl	%esi, %edx
	pxor	%xmm1, %xmm1
	leaq	16(%rsp), %r11
	xorl	%eax, %eax
	shrl	$2, %edx
	movdqa	%xmm1, %xmm0
	leaq	416(%rsp), %r10
	salq	$4, %rdx
	movdqa	%xmm1, %xmm2
	.p2align 4,,10
	.p2align 3
.L55:
	movdqa	%xmm2, %xmm3
	pcmpeqd	(%r11,%rax), %xmm3
	pcmpeqd	%xmm2, %xmm3
	psubd	%xmm3, %xmm1
	movdqa	%xmm2, %xmm3
	pcmpeqd	(%r10,%rax), %xmm3
	addq	$16, %rax
	pcmpeqd	%xmm2, %xmm3
	psubd	%xmm3, %xmm0
	cmpq	%rax, %rdx
	jne	.L55
	movdqa	%xmm0, %xmm2
	movl	%esi, %eax
	psrldq	$8, %xmm2
	andl	$-4, %eax
	paddd	%xmm2, %xmm0
	movdqa	%xmm0, %xmm2
	psrldq	$4, %xmm2
	paddd	%xmm2, %xmm0
	movd	%xmm0, %edx
	movdqa	%xmm1, %xmm0
	psrldq	$8, %xmm0
	paddd	%xmm0, %xmm1
	movdqa	%xmm1, %xmm0
	psrldq	$4, %xmm0
	paddd	%xmm0, %xmm1
	movd	%xmm1, %ecx
	testb	$3, %sil
	je	.L53
.L54:
	movslq	%eax, %rdi
	cmpl	$1, 16(%rsp,%rdi,4)
	sbbl	$-1, %ecx
	cmpl	$1, 416(%rsp,%rdi,4)
	leal	1(%rax), %edi
	sbbl	$-1, %edx
	cmpl	%esi, %edi
	jge	.L53
	movslq	%edi, %rdi
	cmpl	$1, 16(%rsp,%rdi,4)
	sbbl	$-1, %ecx
	cmpl	$1, 416(%rsp,%rdi,4)
	sbbl	$-1, %edx
	addl	$2, %eax
	cmpl	%esi, %eax
	jge	.L53
	cltq
	cmpl	$1, 16(%rsp,%rax,4)
	sbbl	$-1, %ecx
	cmpl	$1, 416(%rsp,%rax,4)
	sbbl	$-1, %edx
.L53:
	leaq	.LC4(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L65
	.p2align 4,,10
	.p2align 3
.L108:
	xorl	%edx, %edx
	jmp	.L49
	.p2align 4,,10
	.p2align 3
.L111:
	xorl	%ecx, %ecx
	jmp	.L46
.L70:
	xorl	%eax, %eax
	jmp	.L14
.L2:
	movq	1624(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L112
	addq	$1640, %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
.L110:
	.cfi_restore_state
	testl	%edx, %edx
	jg	.L67
.L26:
	movl	%ebx, 16(%rsp)
	xorl	%ecx, %ecx
	xorl	%edx, %edx
	jmp	.L53
.L22:
	testl	%esi, %esi
	jle	.L26
	xorl	%edi, %edi
	xorl	%r8d, %r8d
	cmpl	$1, %esi
	jne	.L27
	movl	%ebx, 16(%rsp)
	jmp	.L66
.L73:
	xorl	%ecx, %ecx
	xorl	%edx, %edx
	jmp	.L53
.L6:
	movl	$1, 816(%rsp)
	movl	$1, %eax
	jmp	.L68
.L74:
	xorl	%ecx, %ecx
	xorl	%edx, %edx
	xorl	%eax, %eax
	jmp	.L54
.L112:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.long	0
	.long	1
	.long	2
	.long	3
	.align 16
.LC2:
	.long	4
	.long	4
	.long	4
	.long	4
	.align 16
.LC3:
	.long	1
	.long	1
	.long	1
	.long	1
	.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 i,j,k,c,flag1,flag2,sheet,score1,score2;
	int n, card[200], t_card[100], h_card[100];

	while (1) {
		k = 0;
		score1 = 0;
		score2 = 0;
		scanf("%d", &n);
		if (n == 0)break;
		for (i = 0; i < 2 * n; i++) 
			card[i] = i + 1;
		
		for (i = 0; i < n; i++) {
			scanf("%d", &t_card[i]);
			for (j = 0; j < 2 * n; j++) {
				if (t_card[i] == card[j])
					card[j] = 0;
			}
		}
		for (i = 0; i < 2 * n; i++) {
			if (card[i] != 0)
				h_card[k++] = card[i];
		}
		for (i = 0; i < n; i++) {
			for (j = i + 1; j < n; j++) {
				if (t_card[i] > t_card[j]) {
					int temp = t_card[i];
					t_card[i] = t_card[j];
					t_card[j] = temp;
				}
			}
		}
		for (i = 0; i < k; i++) {
			for (j = i + 1; j < k; j++) {
				if (h_card[i] > h_card[j]) {
					int temp = h_card[i];
					h_card[i] = h_card[j];
					h_card[j] = temp;
				}
			}
		}
		c = t_card[0];
		t_card[0] = 0;
		sheet = n;
		while (n-1 != 0 && k != 0) {
			flag1 = 0, flag2 = 0;
			for (j = 0; j < sheet; j++) {
				if (c < h_card[j]) {
					c = h_card[j];
					h_card[j] = 0;
					k--;
					flag1 = 1;
					break;
				}
			}
			if (!flag1)c = 0;
	
			for (i = 0; i < sheet; i++) {
				if (c < t_card[i]) {
					c = t_card[i];
					t_card[i] = 0;
					n--;
					flag2 = 1;
					break;
				}
			}
			if (!flag2)c = 0;
		}
		for (i = 0; i < sheet; i++) {
			if (t_card[i] != 0) score2++;
			if (h_card[i] != 0)score1++;
		}
		printf("%d\n%d\n",score1,score2);
	}
	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
0
 0
0
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>
int main(void)
{
	int i,j,k,c,flag1,flag2,sheet,score1,score2;
	int n, card[200], t_card[100], h_card[100];

	while (1) {
		k = 0;
		score1 = 0;
		score2 = 0;
		scanf("%d", &n);
		if (n == 0)break;
		for (i = 0; i < 2 * n; i++) 
			card[i] = i + 1;
		
		for (i = 0; i < n; i++) {
			scanf("%d", &t_card[i]);
			for (j = 0; j < 2 * n; j++) {
				if (t_card[i] == card[j])
					card[j] = 0;
			}
		}
		for (i = 0; i < 2 * n; i++) {
			if (card[i] != 0)
				h_card[k++] = card[i];
		}
		for (i = 0; i < n; i++) {
			for (j = i + 1; j < n; j++) {
				if (t_card[i] > t_card[j]) {
					int temp = t_card[i];
					t_card[i] = t_card[j];
					t_card[j] = temp;
				}
			}
		}
		for (i = 0; i < k; i++) {
			for (j = i + 1; j < k; j++) {
				if (h_card[i] > h_card[j]) {
					int temp = h_card[i];
					h_card[i] = h_card[j];
					h_card[j] = temp;
				}
			}
		}
		c = t_card[0];
		t_card[0] = 0;
		sheet = n;
		while (n-1 != 0 && k != 0) {
			flag1 = 0, flag2 = 0;
			for (j = 0; j < sheet; j++) {
				if (c < h_card[j]) {
					c = h_card[j];
					h_card[j] = 0;
					k--;
					flag1 = 1;
					break;
				}
			}
			if (!flag1)c = 0;
	
			for (i = 0; i < sheet; i++) {
				if (c < t_card[i]) {
					c = t_card[i];
					t_card[i] = 0;
					n--;
					flag2 = 1;
					break;
				}
			}
			if (!flag2)c = 0;
		}
		for (i = 0; i < sheet; i++) {
			if (t_card[i] != 0) score2++;
			if (h_card[i] != 0)score1++;
		}
		printf("%d\n%d\n",score1,score2);
	}
	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:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$1664, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L40:
	movl	$0, -1652(%rbp)
	movl	$0, -1636(%rbp)
	movl	$0, -1632(%rbp)
	leaq	-1664(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-1664(%rbp), %eax
	testl	%eax, %eax
	je	.L44
	movl	$0, -1660(%rbp)
	jmp	.L4
.L5:
	movl	-1660(%rbp), %eax
	leal	1(%rax), %edx
	movl	-1660(%rbp), %eax
	cltq
	movl	%edx, -816(%rbp,%rax,4)
	addl	$1, -1660(%rbp)
.L4:
	movl	-1664(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -1660(%rbp)
	jl	.L5
	movl	$0, -1660(%rbp)
	jmp	.L6
.L10:
	leaq	-1616(%rbp), %rdx
	movl	-1660(%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
	movl	$0, -1656(%rbp)
	jmp	.L7
.L9:
	movl	-1660(%rbp), %eax
	cltq
	movl	-1616(%rbp,%rax,4), %edx
	movl	-1656(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jne	.L8
	movl	-1656(%rbp), %eax
	cltq
	movl	$0, -816(%rbp,%rax,4)
.L8:
	addl	$1, -1656(%rbp)
.L7:
	movl	-1664(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -1656(%rbp)
	jl	.L9
	addl	$1, -1660(%rbp)
.L6:
	movl	-1664(%rbp), %eax
	cmpl	%eax, -1660(%rbp)
	jl	.L10
	movl	$0, -1660(%rbp)
	jmp	.L11
.L13:
	movl	-1660(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %eax
	testl	%eax, %eax
	je	.L12
	movl	-1652(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -1652(%rbp)
	movl	-1660(%rbp), %edx
	movslq	%edx, %rdx
	movl	-816(%rbp,%rdx,4), %edx
	cltq
	movl	%edx, -1216(%rbp,%rax,4)
.L12:
	addl	$1, -1660(%rbp)
.L11:
	movl	-1664(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -1660(%rbp)
	jl	.L13
	movl	$0, -1660(%rbp)
	jmp	.L14
.L18:
	movl	-1660(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -1656(%rbp)
	jmp	.L15
.L17:
	movl	-1660(%rbp), %eax
	cltq
	movl	-1616(%rbp,%rax,4), %edx
	movl	-1656(%rbp), %eax
	cltq
	movl	-1616(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jle	.L16
	movl	-1660(%rbp), %eax
	cltq
	movl	-1616(%rbp,%rax,4), %eax
	movl	%eax, -1620(%rbp)
	movl	-1656(%rbp), %eax
	cltq
	movl	-1616(%rbp,%rax,4), %edx
	movl	-1660(%rbp), %eax
	cltq
	movl	%edx, -1616(%rbp,%rax,4)
	movl	-1656(%rbp), %eax
	cltq
	movl	-1620(%rbp), %edx
	movl	%edx, -1616(%rbp,%rax,4)
.L16:
	addl	$1, -1656(%rbp)
.L15:
	movl	-1664(%rbp), %eax
	cmpl	%eax, -1656(%rbp)
	jl	.L17
	addl	$1, -1660(%rbp)
.L14:
	movl	-1664(%rbp), %eax
	cmpl	%eax, -1660(%rbp)
	jl	.L18
	movl	$0, -1660(%rbp)
	jmp	.L19
.L23:
	movl	-1660(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -1656(%rbp)
	jmp	.L20
.L22:
	movl	-1660(%rbp), %eax
	cltq
	movl	-1216(%rbp,%rax,4), %edx
	movl	-1656(%rbp), %eax
	cltq
	movl	-1216(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jle	.L21
	movl	-1660(%rbp), %eax
	cltq
	movl	-1216(%rbp,%rax,4), %eax
	movl	%eax, -1624(%rbp)
	movl	-1656(%rbp), %eax
	cltq
	movl	-1216(%rbp,%rax,4), %edx
	movl	-1660(%rbp), %eax
	cltq
	movl	%edx, -1216(%rbp,%rax,4)
	movl	-1656(%rbp), %eax
	cltq
	movl	-1624(%rbp), %edx
	movl	%edx, -1216(%rbp,%rax,4)
.L21:
	addl	$1, -1656(%rbp)
.L20:
	movl	-1656(%rbp), %eax
	cmpl	-1652(%rbp), %eax
	jl	.L22
	addl	$1, -1660(%rbp)
.L19:
	movl	-1660(%rbp), %eax
	cmpl	-1652(%rbp), %eax
	jl	.L23
	movl	-1616(%rbp), %eax
	movl	%eax, -1648(%rbp)
	movl	$0, -1616(%rbp)
	movl	-1664(%rbp), %eax
	movl	%eax, -1628(%rbp)
	jmp	.L24
.L35:
	movl	$0, -1644(%rbp)
	movl	$0, -1640(%rbp)
	movl	$0, -1656(%rbp)
	jmp	.L25
.L28:
	movl	-1656(%rbp), %eax
	cltq
	movl	-1216(%rbp,%rax,4), %eax
	cmpl	%eax, -1648(%rbp)
	jge	.L26
	movl	-1656(%rbp), %eax
	cltq
	movl	-1216(%rbp,%rax,4), %eax
	movl	%eax, -1648(%rbp)
	movl	-1656(%rbp), %eax
	cltq
	movl	$0, -1216(%rbp,%rax,4)
	subl	$1, -1652(%rbp)
	movl	$1, -1644(%rbp)
	jmp	.L27
.L26:
	addl	$1, -1656(%rbp)
.L25:
	movl	-1656(%rbp), %eax
	cmpl	-1628(%rbp), %eax
	jl	.L28
.L27:
	cmpl	$0, -1644(%rbp)
	jne	.L29
	movl	$0, -1648(%rbp)
.L29:
	movl	$0, -1660(%rbp)
	jmp	.L30
.L33:
	movl	-1660(%rbp), %eax
	cltq
	movl	-1616(%rbp,%rax,4), %eax
	cmpl	%eax, -1648(%rbp)
	jge	.L31
	movl	-1660(%rbp), %eax
	cltq
	movl	-1616(%rbp,%rax,4), %eax
	movl	%eax, -1648(%rbp)
	movl	-1660(%rbp), %eax
	cltq
	movl	$0, -1616(%rbp,%rax,4)
	movl	-1664(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -1664(%rbp)
	movl	$1, -1640(%rbp)
	jmp	.L32
.L31:
	addl	$1, -1660(%rbp)
.L30:
	movl	-1660(%rbp), %eax
	cmpl	-1628(%rbp), %eax
	jl	.L33
.L32:
	cmpl	$0, -1640(%rbp)
	jne	.L24
	movl	$0, -1648(%rbp)
.L24:
	movl	-1664(%rbp), %eax
	cmpl	$1, %eax
	je	.L34
	cmpl	$0, -1652(%rbp)
	jne	.L35
.L34:
	movl	$0, -1660(%rbp)
	jmp	.L36
.L39:
	movl	-1660(%rbp), %eax
	cltq
	movl	-1616(%rbp,%rax,4), %eax
	testl	%eax, %eax
	je	.L37
	addl	$1, -1632(%rbp)
.L37:
	movl	-1660(%rbp), %eax
	cltq
	movl	-1216(%rbp,%rax,4), %eax
	testl	%eax, %eax
	je	.L38
	addl	$1, -1636(%rbp)
.L38:
	addl	$1, -1660(%rbp)
.L36:
	movl	-1660(%rbp), %eax
	cmpl	-1628(%rbp), %eax
	jl	.L39
	movl	-1632(%rbp), %edx
	movl	-1636(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L40
.L44:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L42
	call	__stack_chk_fail@PLT
.L42:
	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%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	$1664, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L40:
	movl	$0, -1652(%rbp)
	movl	$0, -1636(%rbp)
	movl	$0, -1632(%rbp)
	leaq	-1664(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-1664(%rbp), %eax
	testl	%eax, %eax
	je	.L44
	movl	$0, -1660(%rbp)
	jmp	.L4
.L5:
	movl	-1660(%rbp), %eax
	leal	1(%rax), %edx
	movl	-1660(%rbp), %eax
	cltq
	movl	%edx, -816(%rbp,%rax,4)
	addl	$1, -1660(%rbp)
.L4:
	movl	-1664(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -1660(%rbp)
	jl	.L5
	movl	$0, -1660(%rbp)
	jmp	.L6
.L10:
	leaq	-1616(%rbp), %rdx
	movl	-1660(%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
	movl	$0, -1656(%rbp)
	jmp	.L7
.L9:
	movl	-1660(%rbp), %eax
	cltq
	movl	-1616(%rbp,%rax,4), %edx
	movl	-1656(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jne	.L8
	movl	-1656(%rbp), %eax
	cltq
	movl	$0, -816(%rbp,%rax,4)
.L8:
	addl	$1, -1656(%rbp)
.L7:
	movl	-1664(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -1656(%rbp)
	jl	.L9
	addl	$1, -1660(%rbp)
.L6:
	movl	-1664(%rbp), %eax
	cmpl	%eax, -1660(%rbp)
	jl	.L10
	movl	$0, -1660(%rbp)
	jmp	.L11
.L13:
	movl	-1660(%rbp), %eax
	cltq
	movl	-816(%rbp,%rax,4), %eax
	testl	%eax, %eax
	je	.L12
	movl	-1652(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -1652(%rbp)
	movl	-1660(%rbp), %edx
	movslq	%edx, %rdx
	movl	-816(%rbp,%rdx,4), %edx
	cltq
	movl	%edx, -1216(%rbp,%rax,4)
.L12:
	addl	$1, -1660(%rbp)
.L11:
	movl	-1664(%rbp), %eax
	addl	%eax, %eax
	cmpl	%eax, -1660(%rbp)
	jl	.L13
	movl	$0, -1660(%rbp)
	jmp	.L14
.L18:
	movl	-1660(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -1656(%rbp)
	jmp	.L15
.L17:
	movl	-1660(%rbp), %eax
	cltq
	movl	-1616(%rbp,%rax,4), %edx
	movl	-1656(%rbp), %eax
	cltq
	movl	-1616(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jle	.L16
	movl	-1660(%rbp), %eax
	cltq
	movl	-1616(%rbp,%rax,4), %eax
	movl	%eax, -1620(%rbp)
	movl	-1656(%rbp), %eax
	cltq
	movl	-1616(%rbp,%rax,4), %edx
	movl	-1660(%rbp), %eax
	cltq
	movl	%edx, -1616(%rbp,%rax,4)
	movl	-1656(%rbp), %eax
	cltq
	movl	-1620(%rbp), %edx
	movl	%edx, -1616(%rbp,%rax,4)
.L16:
	addl	$1, -1656(%rbp)
.L15:
	movl	-1664(%rbp), %eax
	cmpl	%eax, -1656(%rbp)
	jl	.L17
	addl	$1, -1660(%rbp)
.L14:
	movl	-1664(%rbp), %eax
	cmpl	%eax, -1660(%rbp)
	jl	.L18
	movl	$0, -1660(%rbp)
	jmp	.L19
.L23:
	movl	-1660(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -1656(%rbp)
	jmp	.L20
.L22:
	movl	-1660(%rbp), %eax
	cltq
	movl	-1216(%rbp,%rax,4), %edx
	movl	-1656(%rbp), %eax
	cltq
	movl	-1216(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jle	.L21
	movl	-1660(%rbp), %eax
	cltq
	movl	-1216(%rbp,%rax,4), %eax
	movl	%eax, -1624(%rbp)
	movl	-1656(%rbp), %eax
	cltq
	movl	-1216(%rbp,%rax,4), %edx
	movl	-1660(%rbp), %eax
	cltq
	movl	%edx, -1216(%rbp,%rax,4)
	movl	-1656(%rbp), %eax
	cltq
	movl	-1624(%rbp), %edx
	movl	%edx, -1216(%rbp,%rax,4)
.L21:
	addl	$1, -1656(%rbp)
.L20:
	movl	-1656(%rbp), %eax
	cmpl	-1652(%rbp), %eax
	jl	.L22
	addl	$1, -1660(%rbp)
.L19:
	movl	-1660(%rbp), %eax
	cmpl	-1652(%rbp), %eax
	jl	.L23
	movl	-1616(%rbp), %eax
	movl	%eax, -1648(%rbp)
	movl	$0, -1616(%rbp)
	movl	-1664(%rbp), %eax
	movl	%eax, -1628(%rbp)
	jmp	.L24
.L35:
	movl	$0, -1644(%rbp)
	movl	$0, -1640(%rbp)
	movl	$0, -1656(%rbp)
	jmp	.L25
.L28:
	movl	-1656(%rbp), %eax
	cltq
	movl	-1216(%rbp,%rax,4), %eax
	cmpl	%eax, -1648(%rbp)
	jge	.L26
	movl	-1656(%rbp), %eax
	cltq
	movl	-1216(%rbp,%rax,4), %eax
	movl	%eax, -1648(%rbp)
	movl	-1656(%rbp), %eax
	cltq
	movl	$0, -1216(%rbp,%rax,4)
	subl	$1, -1652(%rbp)
	movl	$1, -1644(%rbp)
	jmp	.L27
.L26:
	addl	$1, -1656(%rbp)
.L25:
	movl	-1656(%rbp), %eax
	cmpl	-1628(%rbp), %eax
	jl	.L28
.L27:
	cmpl	$0, -1644(%rbp)
	jne	.L29
	movl	$0, -1648(%rbp)
.L29:
	movl	$0, -1660(%rbp)
	jmp	.L30
.L33:
	movl	-1660(%rbp), %eax
	cltq
	movl	-1616(%rbp,%rax,4), %eax
	cmpl	%eax, -1648(%rbp)
	jge	.L31
	movl	-1660(%rbp), %eax
	cltq
	movl	-1616(%rbp,%rax,4), %eax
	movl	%eax, -1648(%rbp)
	movl	-1660(%rbp), %eax
	cltq
	movl	$0, -1616(%rbp,%rax,4)
	movl	-1664(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -1664(%rbp)
	movl	$1, -1640(%rbp)
	jmp	.L32
.L31:
	addl	$1, -1660(%rbp)
.L30:
	movl	-1660(%rbp), %eax
	cmpl	-1628(%rbp), %eax
	jl	.L33
.L32:
	cmpl	$0, -1640(%rbp)
	jne	.L24
	movl	$0, -1648(%rbp)
.L24:
	movl	-1664(%rbp), %eax
	cmpl	$1, %eax
	je	.L34
	cmpl	$0, -1652(%rbp)
	jne	.L35
.L34:
	movl	$0, -1660(%rbp)
	jmp	.L36
.L39:
	movl	-1660(%rbp), %eax
	cltq
	movl	-1616(%rbp,%rax,4), %eax
	testl	%eax, %eax
	je	.L37
	addl	$1, -1632(%rbp)
.L37:
	movl	-1660(%rbp), %eax
	cltq
	movl	-1216(%rbp,%rax,4), %eax
	testl	%eax, %eax
	je	.L38
	addl	$1, -1636(%rbp)
.L38:
	addl	$1, -1660(%rbp)
.L36:
	movl	-1660(%rbp), %eax
	cmpl	-1628(%rbp), %eax
	jl	.L39
	movl	-1632(%rbp), %edx
	movl	-1636(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L40
.L44:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L42
	call	__stack_chk_fail@PLT
.L42:
	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:
