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 N;
	int syougen[16][16] = {{0}};
	int i, j;
	int answer = 0;
	int search;
	if (scanf("%d", &N) != 1) return 1;
	for (i = 0; i < N; i++) {
		int A;
		if (scanf("%d", &A) != 1) return 1;
		for (j = 0; j < A; j++) {
			int x, y;
			if (scanf("%d%d", &x, &y) != 2) return 1;
			syougen[i][x - 1] = (y == 1 ? 1 : -1);
		}
	}
	for (search = 0; search < (1 << N); search++) {
		int score = 0;
		int ok = 1;
		for (i = 0; ok && i < N; i++) {
			if ((search >> i) & 1) {
				score++;
				for (j = 0; ok && j < N; j++) {
					if (syougen[i][j] != 0) {
						if (((search >> j) & 1) != (syougen[i][j] == 1)) ok = 0;
					}
				}
			}
		}
		if (ok && score > answer) answer = score;
	}
	printf("%d\n", answer);
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d%d"
.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	$1088, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-1040(%rbp), %rdx
	movl	$0, %eax
	movl	$128, %ecx
	movq	%rdx, %rdi
	rep stosq
	movl	$0, -1056(%rbp)
	leaq	-1080(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$1, %eax
	je	.L2
	movl	$1, %eax
	jmp	.L23
.L2:
	movl	$0, -1064(%rbp)
	jmp	.L4
.L12:
	leaq	-1076(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$1, %eax
	je	.L5
	movl	$1, %eax
	jmp	.L23
.L5:
	movl	$0, -1060(%rbp)
	jmp	.L7
.L11:
	leaq	-1068(%rbp), %rdx
	leaq	-1072(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$2, %eax
	je	.L8
	movl	$1, %eax
	jmp	.L23
.L8:
	movl	-1068(%rbp), %eax
	cmpl	$1, %eax
	jne	.L9
	movl	$1, %edx
	jmp	.L10
.L9:
	movl	$-1, %edx
.L10:
	movl	-1072(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rcx
	movl	-1064(%rbp), %eax
	cltq
	salq	$4, %rax
	addq	%rcx, %rax
	movl	%edx, -1040(%rbp,%rax,4)
	addl	$1, -1060(%rbp)
.L7:
	movl	-1076(%rbp), %eax
	cmpl	%eax, -1060(%rbp)
	jl	.L11
	addl	$1, -1064(%rbp)
.L4:
	movl	-1080(%rbp), %eax
	cmpl	%eax, -1064(%rbp)
	jl	.L12
	movl	$0, -1052(%rbp)
	jmp	.L13
.L22:
	movl	$0, -1048(%rbp)
	movl	$1, -1044(%rbp)
	movl	$0, -1064(%rbp)
	jmp	.L14
.L20:
	movl	-1064(%rbp), %eax
	movl	-1052(%rbp), %edx
	movl	%eax, %ecx
	sarl	%cl, %edx
	movl	%edx, %eax
	andl	$1, %eax
	testl	%eax, %eax
	je	.L15
	addl	$1, -1048(%rbp)
	movl	$0, -1060(%rbp)
	jmp	.L16
.L18:
	movl	-1060(%rbp), %eax
	movslq	%eax, %rdx
	movl	-1064(%rbp), %eax
	cltq
	salq	$4, %rax
	addq	%rdx, %rax
	movl	-1040(%rbp,%rax,4), %eax
	testl	%eax, %eax
	je	.L17
	movl	-1060(%rbp), %eax
	movl	-1052(%rbp), %edx
	movl	%eax, %ecx
	sarl	%cl, %edx
	movl	%edx, %eax
	andl	$1, %eax
	movl	-1060(%rbp), %edx
	movslq	%edx, %rcx
	movl	-1064(%rbp), %edx
	movslq	%edx, %rdx
	salq	$4, %rdx
	addq	%rcx, %rdx
	movl	-1040(%rbp,%rdx,4), %edx
	cmpl	$1, %edx
	sete	%dl
	xorl	%edx, %eax
	testb	%al, %al
	je	.L17
	movl	$0, -1044(%rbp)
.L17:
	addl	$1, -1060(%rbp)
.L16:
	cmpl	$0, -1044(%rbp)
	je	.L15
	movl	-1080(%rbp), %eax
	cmpl	%eax, -1060(%rbp)
	jl	.L18
.L15:
	addl	$1, -1064(%rbp)
.L14:
	cmpl	$0, -1044(%rbp)
	je	.L19
	movl	-1080(%rbp), %eax
	cmpl	%eax, -1064(%rbp)
	jl	.L20
.L19:
	cmpl	$0, -1044(%rbp)
	je	.L21
	movl	-1048(%rbp), %eax
	cmpl	-1056(%rbp), %eax
	jle	.L21
	movl	-1048(%rbp), %eax
	movl	%eax, -1056(%rbp)
.L21:
	addl	$1, -1052(%rbp)
.L13:
	movl	-1080(%rbp), %eax
	movl	$1, %edx
	movl	%eax, %ecx
	sall	%cl, %edx
	movl	%edx, %eax
	cmpl	%eax, -1052(%rbp)
	jl	.L22
	movl	-1056(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
.L23:
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L24
	call	__stack_chk_fail@PLT
.L24:
	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	"%d%d"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movl	$128, %ecx
	leaq	.LC0(%rip), %r15
	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
	subq	$1096, %rsp
	.cfi_def_cfa_offset 1152
	movq	%fs:40, %rax
	movq	%rax, 1080(%rsp)
	xorl	%eax, %eax
	leaq	48(%rsp), %rdi
	leaq	32(%rsp), %rsi
	movq	%rdi, 24(%rsp)
	rep stosq
	movq	%r15, %rdi
	call	__isoc99_scanf@PLT
	movl	%eax, 12(%rsp)
	cmpl	$1, %eax
	je	.L37
	movl	$1, 12(%rsp)
.L1:
	movq	1080(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L38
	movl	12(%rsp), %eax
	addq	$1096, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	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
.L37:
	.cfi_restore_state
	movl	32(%rsp), %r9d
	leaq	36(%rsp), %rax
	movl	$0, 8(%rsp)
	leaq	.LC1(%rip), %r12
	movq	%rax, 16(%rsp)
	testl	%r9d, %r9d
	jle	.L11
.L10:
	movq	16(%rsp), %rsi
	xorl	%eax, %eax
	movq	%r15, %rdi
	call	__isoc99_scanf@PLT
	cmpl	$1, %eax
	jne	.L1
	movl	36(%rsp), %eax
	testl	%eax, %eax
	jle	.L5
	movslq	8(%rsp), %r13
	xorl	%r14d, %r14d
	leaq	44(%rsp), %rbp
	leaq	40(%rsp), %rbx
	.p2align 4,,10
	.p2align 3
.L9:
	xorl	%eax, %eax
	movq	%rbp, %rdx
	movq	%rbx, %rsi
	movq	%r12, %rdi
	call	__isoc99_scanf@PLT
	cmpl	$2, %eax
	jne	.L1
	movl	40(%rsp), %eax
	movq	%r13, %rdx
	salq	$4, %rdx
	subl	$1, %eax
	cltq
	addq	%rdx, %rax
	cmpl	$1, 44(%rsp)
	je	.L39
	movl	$-1, 48(%rsp,%rax,4)
	addl	$1, %r14d
	cmpl	%r14d, 36(%rsp)
	jg	.L9
.L5:
	addl	$1, 8(%rsp)
	movl	32(%rsp), %r9d
	movl	8(%rsp), %eax
	cmpl	%eax, %r9d
	jg	.L10
.L11:
	movl	$1, %ebx
	movl	%r9d, %ecx
	xorl	%r8d, %r8d
	xorl	%r12d, %r12d
	sall	%cl, %ebx
	movslq	%r9d, %r10
.L12:
	cmpl	%r8d, %ebx
	jle	.L19
	movq	24(%rsp), %rsi
	xorl	%edi, %edi
	xorl	%r11d, %r11d
	jmp	.L20
	.p2align 4,,10
	.p2align 3
.L13:
	addl	$1, %edi
	addq	$64, %rsi
.L20:
	cmpl	%edi, %r9d
	jle	.L40
	btl	%edi, %r8d
	jnc	.L13
	xorl	%ecx, %ecx
	.p2align 4,,10
	.p2align 3
.L16:
	movl	(%rsi,%rcx,4), %eax
	testl	%eax, %eax
	je	.L14
	movl	%r8d, %edx
	sarl	%cl, %edx
	andl	$1, %edx
	cmpl	$1, %eax
	sete	%al
	cmpb	%al, %dl
	je	.L14
.L15:
	addl	$1, %r8d
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L39:
	movl	$1, 48(%rsp,%rax,4)
	addl	$1, %r14d
	cmpl	%r14d, 36(%rsp)
	jg	.L9
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L14:
	addq	$1, %rcx
	cmpq	%rcx, %r10
	jne	.L16
	addl	$1, %r11d
	jmp	.L13
.L40:
	cmpl	%r11d, %r12d
	cmovl	%r11d, %r12d
	jmp	.L15
.L19:
	movl	%r12d, %edx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	$0, 12(%rsp)
	jmp	.L1
.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	"%d%d"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movl	$128, %ecx
	leaq	.LC0(%rip), %r15
	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
	subq	$1096, %rsp
	.cfi_def_cfa_offset 1152
	movq	%fs:40, %rax
	movq	%rax, 1080(%rsp)
	xorl	%eax, %eax
	leaq	48(%rsp), %rdi
	leaq	32(%rsp), %rsi
	movq	%rdi, 24(%rsp)
	rep stosq
	movq	%r15, %rdi
	call	__isoc99_scanf@PLT
	movl	%eax, 12(%rsp)
	cmpl	$1, %eax
	je	.L37
	movl	$1, 12(%rsp)
.L1:
	movq	1080(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L38
	movl	12(%rsp), %eax
	addq	$1096, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	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
.L37:
	.cfi_restore_state
	movl	32(%rsp), %r9d
	leaq	36(%rsp), %rax
	movl	$0, 8(%rsp)
	leaq	.LC1(%rip), %r12
	movq	%rax, 16(%rsp)
	testl	%r9d, %r9d
	jle	.L11
.L10:
	movq	16(%rsp), %rsi
	xorl	%eax, %eax
	movq	%r15, %rdi
	call	__isoc99_scanf@PLT
	cmpl	$1, %eax
	jne	.L1
	movl	36(%rsp), %eax
	testl	%eax, %eax
	jle	.L5
	movslq	8(%rsp), %r13
	xorl	%r14d, %r14d
	leaq	44(%rsp), %rbp
	leaq	40(%rsp), %rbx
	.p2align 4,,10
	.p2align 3
.L9:
	xorl	%eax, %eax
	movq	%rbp, %rdx
	movq	%rbx, %rsi
	movq	%r12, %rdi
	call	__isoc99_scanf@PLT
	cmpl	$2, %eax
	jne	.L1
	movl	40(%rsp), %eax
	movq	%r13, %rdx
	salq	$4, %rdx
	subl	$1, %eax
	cltq
	addq	%rdx, %rax
	cmpl	$1, 44(%rsp)
	je	.L39
	movl	$-1, 48(%rsp,%rax,4)
	addl	$1, %r14d
	cmpl	%r14d, 36(%rsp)
	jg	.L9
.L5:
	addl	$1, 8(%rsp)
	movl	32(%rsp), %r9d
	movl	8(%rsp), %eax
	cmpl	%eax, %r9d
	jg	.L10
.L11:
	movl	$1, %ebx
	movl	%r9d, %ecx
	xorl	%r8d, %r8d
	xorl	%r12d, %r12d
	sall	%cl, %ebx
	movslq	%r9d, %r10
.L12:
	cmpl	%r8d, %ebx
	jle	.L19
	movq	24(%rsp), %rsi
	xorl	%edi, %edi
	xorl	%r11d, %r11d
	jmp	.L20
	.p2align 4,,10
	.p2align 3
.L13:
	addl	$1, %edi
	addq	$64, %rsi
.L20:
	cmpl	%edi, %r9d
	jle	.L40
	btl	%edi, %r8d
	jnc	.L13
	xorl	%ecx, %ecx
	.p2align 4,,10
	.p2align 3
.L16:
	movl	(%rsi,%rcx,4), %eax
	testl	%eax, %eax
	je	.L14
	movl	%r8d, %edx
	sarl	%cl, %edx
	andl	$1, %edx
	cmpl	$1, %eax
	sete	%al
	cmpb	%al, %dl
	je	.L14
.L15:
	addl	$1, %r8d
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L39:
	movl	$1, 48(%rsp,%rax,4)
	addl	$1, %r14d
	cmpl	%r14d, 36(%rsp)
	jg	.L9
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L14:
	addq	$1, %rcx
	cmpq	%rcx, %r10
	jne	.L16
	addl	$1, %r11d
	jmp	.L13
.L40:
	cmpl	%r11d, %r12d
	cmovl	%r11d, %r12d
	jmp	.L15
.L19:
	movl	%r12d, %edx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	$0, 12(%rsp)
	jmp	.L1
.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 N;
	int syougen[16][16] = {{0}};
	int i, j;
	int answer = 0;
	int search;
	if (scanf("%d", &N) != 1) return 1;
	for (i = 0; i < N; i++) {
		int A;
		if (scanf("%d", &A) != 1) return 1;
		for (j = 0; j < A; j++) {
			int x, y;
			if (scanf("%d%d", &x, &y) != 2) return 1;
			syougen[i][x - 1] = (y == 1 ? 1 : -1);
		}
	}
	for (search = 0; search < (1 << N); search++) {
		int score = 0;
		int ok = 1;
		for (i = 0; ok && i < N; i++) {
			if ((search >> i) & 1) {
				score++;
				for (j = 0; ok && j < N; j++) {
					if (syougen[i][j] != 0) {
						if (((search >> j) & 1) != (syougen[i][j] == 1)) ok = 0;
					}
				}
			}
		}
		if (ok && score > answer) answer = score;
	}
	printf("%d\n", answer);
	return 0;
}
3
2
2 1
3 0
2
3 1
1 0
2
1 1
2 -1
 2
1
2 0
1
1 1
 3
1
3 1
1
1 1
1
2 0
 3
1
3 1
1
1 1
0
2 0
 3
2
2 1
3 0
2
3 1
1 0
2
1 0
2 0
 3
1
1 1
1
1 1
0
2 0
 3
2
2 0
3 0
2
3 1
1 0
2
1 1
2 0
 3
1
2 1
1
2 1
1
2 0
 3
2
2 0
3 0
2
3 1
1 0
2
1 1
2 -1
 3
1
3 0
1
1 1
1
2 0

0
 1
 2
 3
 1
 3
 1
 2
 1
 2

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 N;
	int syougen[16][16] = {{0}};
	int i, j;
	int answer = 0;
	int search;
	if (scanf("%d", &N) != 1) return 1;
	for (i = 0; i < N; i++) {
		int A;
		if (scanf("%d", &A) != 1) return 1;
		for (j = 0; j < A; j++) {
			int x, y;
			if (scanf("%d%d", &x, &y) != 2) return 1;
			syougen[i][x - 1] = (y == 1 ? 1 : -1);
		}
	}
	for (search = 0; search < (1 << N); search++) {
		int score = 0;
		int ok = 1;
		for (i = 0; ok && i < N; i++) {
			if ((search >> i) & 1) {
				score++;
				for (j = 0; ok && j < N; j++) {
					if (syougen[i][j] != 0) {
						if (((search >> j) & 1) != (syougen[i][j] == 1)) ok = 0;
					}
				}
			}
		}
		if (ok && score > answer) answer = score;
	}
	printf("%d\n", answer);
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d%d"
.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	$1088, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-1040(%rbp), %rdx
	movl	$0, %eax
	movl	$128, %ecx
	movq	%rdx, %rdi
	rep stosq
	movl	$0, -1056(%rbp)
	leaq	-1080(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$1, %eax
	je	.L2
	movl	$1, %eax
	jmp	.L23
.L2:
	movl	$0, -1064(%rbp)
	jmp	.L4
.L12:
	leaq	-1076(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$1, %eax
	je	.L5
	movl	$1, %eax
	jmp	.L23
.L5:
	movl	$0, -1060(%rbp)
	jmp	.L7
.L11:
	leaq	-1068(%rbp), %rdx
	leaq	-1072(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$2, %eax
	je	.L8
	movl	$1, %eax
	jmp	.L23
.L8:
	movl	-1068(%rbp), %eax
	cmpl	$1, %eax
	jne	.L9
	movl	$1, %edx
	jmp	.L10
.L9:
	movl	$-1, %edx
.L10:
	movl	-1072(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rcx
	movl	-1064(%rbp), %eax
	cltq
	salq	$4, %rax
	addq	%rcx, %rax
	movl	%edx, -1040(%rbp,%rax,4)
	addl	$1, -1060(%rbp)
.L7:
	movl	-1076(%rbp), %eax
	cmpl	%eax, -1060(%rbp)
	jl	.L11
	addl	$1, -1064(%rbp)
.L4:
	movl	-1080(%rbp), %eax
	cmpl	%eax, -1064(%rbp)
	jl	.L12
	movl	$0, -1052(%rbp)
	jmp	.L13
.L22:
	movl	$0, -1048(%rbp)
	movl	$1, -1044(%rbp)
	movl	$0, -1064(%rbp)
	jmp	.L14
.L20:
	movl	-1064(%rbp), %eax
	movl	-1052(%rbp), %edx
	movl	%eax, %ecx
	sarl	%cl, %edx
	movl	%edx, %eax
	andl	$1, %eax
	testl	%eax, %eax
	je	.L15
	addl	$1, -1048(%rbp)
	movl	$0, -1060(%rbp)
	jmp	.L16
.L18:
	movl	-1060(%rbp), %eax
	movslq	%eax, %rdx
	movl	-1064(%rbp), %eax
	cltq
	salq	$4, %rax
	addq	%rdx, %rax
	movl	-1040(%rbp,%rax,4), %eax
	testl	%eax, %eax
	je	.L17
	movl	-1060(%rbp), %eax
	movl	-1052(%rbp), %edx
	movl	%eax, %ecx
	sarl	%cl, %edx
	movl	%edx, %eax
	andl	$1, %eax
	movl	-1060(%rbp), %edx
	movslq	%edx, %rcx
	movl	-1064(%rbp), %edx
	movslq	%edx, %rdx
	salq	$4, %rdx
	addq	%rcx, %rdx
	movl	-1040(%rbp,%rdx,4), %edx
	cmpl	$1, %edx
	sete	%dl
	xorl	%edx, %eax
	testb	%al, %al
	je	.L17
	movl	$0, -1044(%rbp)
.L17:
	addl	$1, -1060(%rbp)
.L16:
	cmpl	$0, -1044(%rbp)
	je	.L15
	movl	-1080(%rbp), %eax
	cmpl	%eax, -1060(%rbp)
	jl	.L18
.L15:
	addl	$1, -1064(%rbp)
.L14:
	cmpl	$0, -1044(%rbp)
	je	.L19
	movl	-1080(%rbp), %eax
	cmpl	%eax, -1064(%rbp)
	jl	.L20
.L19:
	cmpl	$0, -1044(%rbp)
	je	.L21
	movl	-1048(%rbp), %eax
	cmpl	-1056(%rbp), %eax
	jle	.L21
	movl	-1048(%rbp), %eax
	movl	%eax, -1056(%rbp)
.L21:
	addl	$1, -1052(%rbp)
.L13:
	movl	-1080(%rbp), %eax
	movl	$1, %edx
	movl	%eax, %ecx
	sall	%cl, %edx
	movl	%edx, %eax
	cmpl	%eax, -1052(%rbp)
	jl	.L22
	movl	-1056(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
.L23:
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L24
	call	__stack_chk_fail@PLT
.L24:
	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%d"
.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	$1088, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-1040(%rbp), %rdx
	movl	$0, %eax
	movl	$128, %ecx
	movq	%rdx, %rdi
	rep stosq
	movl	$0, -1056(%rbp)
	leaq	-1080(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$1, %eax
	je	.L2
	movl	$1, %eax
	jmp	.L23
.L2:
	movl	$0, -1064(%rbp)
	jmp	.L4
.L12:
	leaq	-1076(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$1, %eax
	je	.L5
	movl	$1, %eax
	jmp	.L23
.L5:
	movl	$0, -1060(%rbp)
	jmp	.L7
.L11:
	leaq	-1068(%rbp), %rdx
	leaq	-1072(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$2, %eax
	je	.L8
	movl	$1, %eax
	jmp	.L23
.L8:
	movl	-1068(%rbp), %eax
	cmpl	$1, %eax
	jne	.L9
	movl	$1, %edx
	jmp	.L10
.L9:
	movl	$-1, %edx
.L10:
	movl	-1072(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rcx
	movl	-1064(%rbp), %eax
	cltq
	salq	$4, %rax
	addq	%rcx, %rax
	movl	%edx, -1040(%rbp,%rax,4)
	addl	$1, -1060(%rbp)
.L7:
	movl	-1076(%rbp), %eax
	cmpl	%eax, -1060(%rbp)
	jl	.L11
	addl	$1, -1064(%rbp)
.L4:
	movl	-1080(%rbp), %eax
	cmpl	%eax, -1064(%rbp)
	jl	.L12
	movl	$0, -1052(%rbp)
	jmp	.L13
.L22:
	movl	$0, -1048(%rbp)
	movl	$1, -1044(%rbp)
	movl	$0, -1064(%rbp)
	jmp	.L14
.L20:
	movl	-1064(%rbp), %eax
	movl	-1052(%rbp), %edx
	movl	%eax, %ecx
	sarl	%cl, %edx
	movl	%edx, %eax
	andl	$1, %eax
	testl	%eax, %eax
	je	.L15
	addl	$1, -1048(%rbp)
	movl	$0, -1060(%rbp)
	jmp	.L16
.L18:
	movl	-1060(%rbp), %eax
	movslq	%eax, %rdx
	movl	-1064(%rbp), %eax
	cltq
	salq	$4, %rax
	addq	%rdx, %rax
	movl	-1040(%rbp,%rax,4), %eax
	testl	%eax, %eax
	je	.L17
	movl	-1060(%rbp), %eax
	movl	-1052(%rbp), %edx
	movl	%eax, %ecx
	sarl	%cl, %edx
	movl	%edx, %eax
	andl	$1, %eax
	movl	-1060(%rbp), %edx
	movslq	%edx, %rcx
	movl	-1064(%rbp), %edx
	movslq	%edx, %rdx
	salq	$4, %rdx
	addq	%rcx, %rdx
	movl	-1040(%rbp,%rdx,4), %edx
	cmpl	$1, %edx
	sete	%dl
	xorl	%edx, %eax
	testb	%al, %al
	je	.L17
	movl	$0, -1044(%rbp)
.L17:
	addl	$1, -1060(%rbp)
.L16:
	cmpl	$0, -1044(%rbp)
	je	.L15
	movl	-1080(%rbp), %eax
	cmpl	%eax, -1060(%rbp)
	jl	.L18
.L15:
	addl	$1, -1064(%rbp)
.L14:
	cmpl	$0, -1044(%rbp)
	je	.L19
	movl	-1080(%rbp), %eax
	cmpl	%eax, -1064(%rbp)
	jl	.L20
.L19:
	cmpl	$0, -1044(%rbp)
	je	.L21
	movl	-1048(%rbp), %eax
	cmpl	-1056(%rbp), %eax
	jle	.L21
	movl	-1048(%rbp), %eax
	movl	%eax, -1056(%rbp)
.L21:
	addl	$1, -1052(%rbp)
.L13:
	movl	-1080(%rbp), %eax
	movl	$1, %edx
	movl	%eax, %ecx
	sall	%cl, %edx
	movl	%edx, %eax
	cmpl	%eax, -1052(%rbp)
	jl	.L22
	movl	-1056(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
.L23:
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L24
	call	__stack_chk_fail@PLT
.L24:
	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:
