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>

int main() {

	int N;
	int pInput[30];
	int** p;
	int pRowIndex;
	int i;
	int j;
	int k;
	int l;
	int pat;
	int pMovingType[5];
	int t[5];
	int curRow;
	int kai[30] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 4, 4, 4, 6, 6, 6, 5, 5, 5, 3, 3, 3, 3, 3, 3, 3, 3, 3 };

	p = (int**)malloc(sizeof(int*) * 65536);
	for (i = 0; i < 65536; i++) p[i] = (int*)malloc(sizeof(int) * 30);

	scanf("%d", &N);
	for (i = 0; i < N; i++) {
		for (j = 0; j < 30; j++) scanf("%d", &pInput[j]);
		for(j = 0; j < 30; j++) if(pInput[j] != kai[j]) break;
		if(j == 30){
			printf("0\n");
			goto next;
		}
		for (j = 0; j < 65536; j++) for (k = 0; k < 30; k++) p[j][k] = pInput[k];
		pRowIndex = 65536;
		pat = 1;
		for (j = 1; j <= 8; j++) {
			for (k = 1; k <= pat * 4; k++) {
				for (l = 1; l <= pRowIndex / 4; l++) {
					if (k % 4 == 1) {
						pMovingType[0] = 1;
						pMovingType[1] = 2;
						pMovingType[2] = 3;
						pMovingType[3] = 15;
						pMovingType[4] = 19;
					}
					else if (k % 4 == 2) {
						pMovingType[0] = 9;
						pMovingType[1] = 6;
						pMovingType[2] = 3;
						pMovingType[3] = 12;
						pMovingType[4] = 13;
					}
					else if (k % 4 == 3) {
						pMovingType[0] = 7;
						pMovingType[1] = 8;
						pMovingType[2] = 9;
						pMovingType[3] = 13;
						pMovingType[4] = 10;
					}
					else if (k % 4 == 0) {
						pMovingType[0] = 7;
						pMovingType[1] = 4;
						pMovingType[2] = 1;
						pMovingType[3] = 10;
						pMovingType[4] = 16;
					}

					curRow = l + (pRowIndex / 4) * (k - 1) - 1;

					t[0] = p[curRow][pMovingType[0] - 1];
					t[1] = p[curRow][pMovingType[1] - 1];
					t[2] = p[curRow][pMovingType[2] - 1];
					t[3] = p[curRow][pMovingType[3] - 1];
					t[4] = p[curRow][pMovingType[4] - 1];
					p[curRow][pMovingType[0] - 1] = p[curRow][30 - pMovingType[2]];
					p[curRow][pMovingType[1] - 1] = p[curRow][30 - pMovingType[1]];
					p[curRow][pMovingType[2] - 1] = p[curRow][30 - pMovingType[0]];
					p[curRow][pMovingType[3] - 1] = p[curRow][30 - pMovingType[3]];
					p[curRow][pMovingType[4] - 1] = p[curRow][pMovingType[4] + 1];
					p[curRow][30 - pMovingType[0]] = t[2];
					p[curRow][30 - pMovingType[1]] = t[1];
					p[curRow][30 - pMovingType[2]] = t[0];
					p[curRow][30 - pMovingType[3]] = t[3];
					p[curRow][pMovingType[4] + 1] = t[4];

				}
				for(l = 0; l < 30; l++) if(p[curRow][l] != kai[l]) break;
				if(l == 30){
					printf("%d\n", j);
					goto next;
				}
			}
			pRowIndex /= 4;
			pat *= 4;
		}
		next:
		;
	}
	for (i = 0; i < 65536; i++) free(p[i]);
	free(p);

	return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"0"
.LC2:
	.string	"%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
	pushq	%rbx
	subq	$376, %rsp
	.cfi_offset 3, -24
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
	movl	$1, -144(%rbp)
	movl	$1, -140(%rbp)
	movl	$1, -136(%rbp)
	movl	$1, -132(%rbp)
	movl	$1, -128(%rbp)
	movl	$1, -124(%rbp)
	movl	$1, -120(%rbp)
	movl	$1, -116(%rbp)
	movl	$1, -112(%rbp)
	movl	$2, -108(%rbp)
	movl	$2, -104(%rbp)
	movl	$2, -100(%rbp)
	movl	$4, -96(%rbp)
	movl	$4, -92(%rbp)
	movl	$4, -88(%rbp)
	movl	$6, -84(%rbp)
	movl	$6, -80(%rbp)
	movl	$6, -76(%rbp)
	movl	$5, -72(%rbp)
	movl	$5, -68(%rbp)
	movl	$5, -64(%rbp)
	movl	$3, -60(%rbp)
	movl	$3, -56(%rbp)
	movl	$3, -52(%rbp)
	movl	$3, -48(%rbp)
	movl	$3, -44(%rbp)
	movl	$3, -40(%rbp)
	movl	$3, -36(%rbp)
	movl	$3, -32(%rbp)
	movl	$3, -28(%rbp)
	movl	$524288, %edi
	call	malloc@PLT
	movq	%rax, -344(%rbp)
	movl	$0, -368(%rbp)
	jmp	.L2
.L3:
	movl	-368(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-344(%rbp), %rax
	leaq	(%rdx,%rax), %rbx
	movl	$120, %edi
	call	malloc@PLT
	movq	%rax, (%rbx)
	addl	$1, -368(%rbp)
.L2:
	cmpl	$65535, -368(%rbp)
	jle	.L3
	leaq	-376(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -368(%rbp)
	jmp	.L4
.L32:
	movl	$0, -364(%rbp)
	jmp	.L5
.L6:
	leaq	-272(%rbp), %rdx
	movl	-364(%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, -364(%rbp)
.L5:
	cmpl	$29, -364(%rbp)
	jle	.L6
	movl	$0, -364(%rbp)
	jmp	.L7
.L10:
	movl	-364(%rbp), %eax
	cltq
	movl	-272(%rbp,%rax,4), %edx
	movl	-364(%rbp), %eax
	cltq
	movl	-144(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jne	.L37
	addl	$1, -364(%rbp)
.L7:
	cmpl	$29, -364(%rbp)
	jle	.L10
	jmp	.L9
.L37:
	nop
.L9:
	cmpl	$30, -364(%rbp)
	jne	.L11
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L12
.L11:
	movl	$0, -364(%rbp)
	jmp	.L13
.L16:
	movl	$0, -360(%rbp)
	jmp	.L14
.L15:
	movl	-364(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-344(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-360(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rax, %rdx
	movl	-360(%rbp), %eax
	cltq
	movl	-272(%rbp,%rax,4), %eax
	movl	%eax, (%rdx)
	addl	$1, -360(%rbp)
.L14:
	cmpl	$29, -360(%rbp)
	jle	.L15
	addl	$1, -364(%rbp)
.L13:
	cmpl	$65535, -364(%rbp)
	jle	.L16
	movl	$65536, -372(%rbp)
	movl	$1, -352(%rbp)
	movl	$1, -364(%rbp)
	jmp	.L17
.L31:
	movl	$1, -360(%rbp)
	jmp	.L18
.L30:
	movl	$1, -356(%rbp)
	jmp	.L19
.L24:
	movl	-360(%rbp), %eax
	cltd
	shrl	$30, %edx
	addl	%edx, %eax
	andl	$3, %eax
	subl	%edx, %eax
	cmpl	$1, %eax
	jne	.L20
	movl	$1, -336(%rbp)
	movl	$2, -332(%rbp)
	movl	$3, -328(%rbp)
	movl	$15, -324(%rbp)
	movl	$19, -320(%rbp)
	jmp	.L21
.L20:
	movl	-360(%rbp), %eax
	cltd
	shrl	$30, %edx
	addl	%edx, %eax
	andl	$3, %eax
	subl	%edx, %eax
	cmpl	$2, %eax
	jne	.L22
	movl	$9, -336(%rbp)
	movl	$6, -332(%rbp)
	movl	$3, -328(%rbp)
	movl	$12, -324(%rbp)
	movl	$13, -320(%rbp)
	jmp	.L21
.L22:
	movl	-360(%rbp), %eax
	cltd
	shrl	$30, %edx
	addl	%edx, %eax
	andl	$3, %eax
	subl	%edx, %eax
	cmpl	$3, %eax
	jne	.L23
	movl	$7, -336(%rbp)
	movl	$8, -332(%rbp)
	movl	$9, -328(%rbp)
	movl	$13, -324(%rbp)
	movl	$10, -320(%rbp)
	jmp	.L21
.L23:
	movl	-360(%rbp), %eax
	andl	$3, %eax
	testl	%eax, %eax
	jne	.L21
	movl	$7, -336(%rbp)
	movl	$4, -332(%rbp)
	movl	$1, -328(%rbp)
	movl	$10, -324(%rbp)
	movl	$16, -320(%rbp)
.L21:
	movl	-372(%rbp), %eax
	leal	3(%rax), %edx
	testl	%eax, %eax
	cmovs	%edx, %eax
	sarl	$2, %eax
	movl	%eax, %edx
	movl	-360(%rbp), %eax
	subl	$1, %eax
	imull	%eax, %edx
	movl	-356(%rbp), %eax
	addl	%edx, %eax
	subl	$1, %eax
	movl	%eax, -348(%rbp)
	movl	-348(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-344(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-336(%rbp), %eax
	cltq
	salq	$2, %rax
	subq	$4, %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -304(%rbp)
	movl	-348(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-344(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-332(%rbp), %eax
	cltq
	salq	$2, %rax
	subq	$4, %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -300(%rbp)
	movl	-348(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-344(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-328(%rbp), %eax
	cltq
	salq	$2, %rax
	subq	$4, %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -296(%rbp)
	movl	-348(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-344(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-324(%rbp), %eax
	cltq
	salq	$2, %rax
	subq	$4, %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -292(%rbp)
	movl	-348(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-344(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-320(%rbp), %eax
	cltq
	salq	$2, %rax
	subq	$4, %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -288(%rbp)
	movl	-348(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-344(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-328(%rbp), %ecx
	movl	$30, %eax
	subl	%ecx, %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	-348(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	movq	-344(%rbp), %rdx
	addq	%rcx, %rdx
	movq	(%rdx), %rcx
	movl	-336(%rbp), %edx
	movslq	%edx, %rdx
	salq	$2, %rdx
	subq	$4, %rdx
	addq	%rcx, %rdx
	movl	(%rax), %eax
	movl	%eax, (%rdx)
	movl	-348(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-344(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-332(%rbp), %ecx
	movl	$30, %eax
	subl	%ecx, %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	-348(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	movq	-344(%rbp), %rdx
	addq	%rcx, %rdx
	movq	(%rdx), %rcx
	movl	-332(%rbp), %edx
	movslq	%edx, %rdx
	salq	$2, %rdx
	subq	$4, %rdx
	addq	%rcx, %rdx
	movl	(%rax), %eax
	movl	%eax, (%rdx)
	movl	-348(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-344(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-336(%rbp), %ecx
	movl	$30, %eax
	subl	%ecx, %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	-348(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	movq	-344(%rbp), %rdx
	addq	%rcx, %rdx
	movq	(%rdx), %rcx
	movl	-328(%rbp), %edx
	movslq	%edx, %rdx
	salq	$2, %rdx
	subq	$4, %rdx
	addq	%rcx, %rdx
	movl	(%rax), %eax
	movl	%eax, (%rdx)
	movl	-348(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-344(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-324(%rbp), %ecx
	movl	$30, %eax
	subl	%ecx, %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	-348(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	movq	-344(%rbp), %rdx
	addq	%rcx, %rdx
	movq	(%rdx), %rcx
	movl	-324(%rbp), %edx
	movslq	%edx, %rdx
	salq	$2, %rdx
	subq	$4, %rdx
	addq	%rcx, %rdx
	movl	(%rax), %eax
	movl	%eax, (%rdx)
	movl	-348(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-344(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-320(%rbp), %eax
	cltq
	addq	$1, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	movl	-348(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	movq	-344(%rbp), %rdx
	addq	%rcx, %rdx
	movq	(%rdx), %rcx
	movl	-320(%rbp), %edx
	movslq	%edx, %rdx
	salq	$2, %rdx
	subq	$4, %rdx
	addq	%rcx, %rdx
	movl	(%rax), %eax
	movl	%eax, (%rdx)
	movl	-348(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-344(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-336(%rbp), %ecx
	movl	$30, %eax
	subl	%ecx, %eax
	cltq
	salq	$2, %rax
	addq	%rax, %rdx
	movl	-296(%rbp), %eax
	movl	%eax, (%rdx)
	movl	-348(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-344(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-332(%rbp), %ecx
	movl	$30, %eax
	subl	%ecx, %eax
	cltq
	salq	$2, %rax
	addq	%rax, %rdx
	movl	-300(%rbp), %eax
	movl	%eax, (%rdx)
	movl	-348(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-344(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-328(%rbp), %ecx
	movl	$30, %eax
	subl	%ecx, %eax
	cltq
	salq	$2, %rax
	addq	%rax, %rdx
	movl	-304(%rbp), %eax
	movl	%eax, (%rdx)
	movl	-348(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-344(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-324(%rbp), %ecx
	movl	$30, %eax
	subl	%ecx, %eax
	cltq
	salq	$2, %rax
	addq	%rax, %rdx
	movl	-292(%rbp), %eax
	movl	%eax, (%rdx)
	movl	-348(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-344(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-320(%rbp), %eax
	cltq
	addq	$1, %rax
	salq	$2, %rax
	addq	%rax, %rdx
	movl	-288(%rbp), %eax
	movl	%eax, (%rdx)
	addl	$1, -356(%rbp)
.L19:
	movl	-372(%rbp), %eax
	leal	3(%rax), %edx
	testl	%eax, %eax
	cmovs	%edx, %eax
	sarl	$2, %eax
	cmpl	%eax, -356(%rbp)
	jle	.L24
	movl	$0, -356(%rbp)
	jmp	.L25
.L28:
	movl	-348(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-344(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-356(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movl	-356(%rbp), %eax
	cltq
	movl	-144(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jne	.L38
	addl	$1, -356(%rbp)
.L25:
	cmpl	$29, -356(%rbp)
	jle	.L28
	jmp	.L27
.L38:
	nop
.L27:
	cmpl	$30, -356(%rbp)
	jne	.L29
	movl	-364(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L12
.L29:
	addl	$1, -360(%rbp)
.L18:
	movl	-352(%rbp), %eax
	sall	$2, %eax
	cmpl	%eax, -360(%rbp)
	jle	.L30
	movl	-372(%rbp), %eax
	leal	3(%rax), %edx
	testl	%eax, %eax
	cmovs	%edx, %eax
	sarl	$2, %eax
	movl	%eax, -372(%rbp)
	sall	$2, -352(%rbp)
	addl	$1, -364(%rbp)
.L17:
	cmpl	$8, -364(%rbp)
	jle	.L31
	nop
.L12:
	addl	$1, -368(%rbp)
.L4:
	movl	-376(%rbp), %eax
	cmpl	%eax, -368(%rbp)
	jl	.L32
	movl	$0, -368(%rbp)
	jmp	.L33
.L34:
	movl	-368(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-344(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	movq	%rax, %rdi
	call	free@PLT
	addl	$1, -368(%rbp)
.L33:
	cmpl	$65535, -368(%rbp)
	jle	.L34
	movq	-344(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	movl	$0, %eax
	movq	-24(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L36
	call	__stack_chk_fail@PLT
.L36:
	movq	-8(%rbp), %rbx
	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
.LC7:
	.string	"%d"
.LC8:
	.string	"%d\n"
.LC9:
	.string	"0"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movl	$524288, %edi
	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	$424, %rsp
	.cfi_def_cfa_offset 480
	movdqa	.LC0(%rip), %xmm0
	movq	%fs:40, %rax
	movq	%rax, 408(%rsp)
	xorl	%eax, %eax
	movq	.LC6(%rip), %rax
	movaps	%xmm0, 288(%rsp)
	movaps	%xmm0, 304(%rsp)
	movdqa	.LC1(%rip), %xmm0
	movq	%rax, 400(%rsp)
	movaps	%xmm0, 320(%rsp)
	movdqa	.LC2(%rip), %xmm0
	movaps	%xmm0, 336(%rsp)
	movdqa	.LC3(%rip), %xmm0
	movaps	%xmm0, 352(%rsp)
	movdqa	.LC4(%rip), %xmm0
	movaps	%xmm0, 368(%rsp)
	movdqa	.LC5(%rip), %xmm0
	movaps	%xmm0, 384(%rsp)
	call	malloc@PLT
	leaq	524288(%rax), %r12
	movq	%rax, 80(%rsp)
	movq	%rax, %rbp
	movq	%rax, 120(%rsp)
	movq	%r12, 104(%rsp)
.L2:
	movl	$120, %edi
	addq	$8, %rbp
	call	malloc@PLT
	movq	%rax, -8(%rbp)
	cmpq	%rbp, %r12
	jne	.L2
	leaq	156(%rsp), %rsi
	leaq	.LC7(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	156(%rsp), %eax
	testl	%eax, %eax
	jle	.L44
	leaq	280(%rsp), %rax
	movl	$0, 112(%rsp)
	leaq	160(%rsp), %r12
	movq	%rax, 136(%rsp)
	leaq	288(%rsp), %rax
	movq	%rax, 88(%rsp)
.L3:
	movq	136(%rsp), %r13
	movq	%r12, %rbp
	.p2align 4,,10
	.p2align 3
.L5:
	movq	%rbp, %rsi
	leaq	.LC7(%rip), %rdi
	xorl	%eax, %eax
	addq	$4, %rbp
	call	__isoc99_scanf@PLT
	cmpq	%r13, %rbp
	jne	.L5
	movq	88(%rsp), %rdx
	xorl	%eax, %eax
	jmp	.L7
.L49:
	addq	$4, %rax
	cmpq	$120, %rax
	je	.L48
.L7:
	movl	(%rdx,%rax), %ecx
	cmpl	%ecx, (%r12,%rax)
	je	.L49
	movq	80(%rsp), %rdx
	movq	104(%rsp), %rsi
	.p2align 4,,10
	.p2align 3
.L6:
	movq	(%rdx), %rax
	movdqa	(%r12), %xmm1
	addq	$8, %rdx
	movdqa	16(%r12), %xmm2
	movdqa	32(%r12), %xmm3
	movdqa	48(%r12), %xmm4
	movq	112(%r12), %rcx
	movups	%xmm1, (%rax)
	movdqa	64(%r12), %xmm5
	movdqa	80(%r12), %xmm6
	movups	%xmm2, 16(%rax)
	movdqa	96(%r12), %xmm7
	movq	%rcx, 112(%rax)
	movups	%xmm3, 32(%rax)
	movups	%xmm4, 48(%rax)
	movups	%xmm5, 64(%rax)
	movups	%xmm6, 80(%rax)
	movups	%xmm7, 96(%rax)
	cmpq	%rdx, %rsi
	jne	.L6
	movl	$1, 116(%rsp)
	movl	$1, 96(%rsp)
	movl	$65536, 76(%rsp)
	movq	%r12, 128(%rsp)
.L9:
	movl	76(%rsp), %esi
	sall	$2, 116(%rsp)
	movl	116(%rsp), %ecx
	movl	$0, 72(%rsp)
	testl	%esi, %esi
	leal	3(%rsi), %eax
	movl	$1, 68(%rsp)
	cmovns	%esi, %eax
	sarl	$2, %eax
	movl	%eax, 36(%rsp)
	leal	1(%rcx), %eax
	movl	%eax, 100(%rsp)
.L18:
	cmpl	$3, 76(%rsp)
	jle	.L50
	movq	80(%rsp), %rbx
	movl	68(%rsp), %r13d
	movl	$1, %r12d
	movslq	72(%rsp), %rax
	andl	$3, %r13d
	leaq	(%rbx,%rax,8), %rax
	movl	%r13d, %ebx
	movq	%rax, 40(%rsp)
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L52:
	cmpl	$2, %ebx
	je	.L25
	cmpl	$3, %ebx
	je	.L26
	testl	%ebx, %ebx
	je	.L27
	movslq	52(%rsp), %rax
	movl	$30, %r11d
	movq	%rax, %r15
	leaq	-4(,%rax,4), %r10
	movslq	64(%rsp), %rax
	movq	%rax, %rcx
	leaq	-4(,%rax,4), %r9
	movslq	60(%rsp), %rax
	movq	%rax, %rdx
	leaq	-4(,%rax,4), %r8
	movslq	56(%rsp), %rax
	movq	%rax, %r14
	leaq	-4(,%rax,4), %rdi
	movslq	48(%rsp), %rax
	movq	%rax, %rbp
	leaq	-4(,%rax,4), %rsi
	movl	%r11d, %eax
	subl	%edx, %eax
	movl	%r11d, %edx
	subl	%ecx, %edx
	cltq
	movslq	%edx, %rdx
	salq	$2, %rax
	leaq	0(,%rdx,4), %rcx
	movq	%rcx, 8(%rsp)
	movl	%r11d, %ecx
	subl	%r14d, %r11d
	movslq	%r11d, %r11
	subl	%r15d, %ecx
	leaq	0(,%r11,4), %rdx
	leal	1(%rbp), %r11d
	movslq	%ecx, %rcx
	movslq	%r11d, %r11
	movq	%rdx, 16(%rsp)
	salq	$2, %rcx
	leaq	0(,%r11,4), %rdx
	movq	%rdx, 24(%rsp)
	.p2align 4,,10
	.p2align 3
.L10:
	movq	40(%rsp), %r14
	movq	-8(%r14,%r12,8), %rbp
	addq	$1, %r12
	addq	%rbp, %rdi
	addq	%rbp, %rax
	addq	%rbp, %r10
	addq	%rbp, %r9
	movl	(%rdi), %r11d
	movl	(%rax), %edx
	addq	%rbp, %r8
	addq	%rbp, %rsi
	movl	(%r10), %r13d
	movl	(%r9), %r14d
	addq	%rbp, %rcx
	movl	(%r8), %r15d
	movl	%r11d, 32(%rsp)
	movl	(%rsi), %r11d
	movl	%edx, (%r10)
	movq	8(%rsp), %rdx
	addq	%rbp, %rdx
	movl	(%rdx), %r10d
	movl	%r10d, (%r9)
	movl	(%rcx), %r9d
	movl	%r9d, (%r8)
	movq	16(%rsp), %r8
	addq	%rbp, %r8
	movl	(%r8), %r9d
	movl	%r9d, (%rdi)
	movq	24(%rsp), %rdi
	addq	%rbp, %rdi
	movl	(%rdi), %r9d
	movl	%r9d, (%rsi)
	movl	%r15d, (%rcx)
	movl	%r14d, (%rdx)
	movl	%r13d, (%rax)
	movl	32(%rsp), %eax
	movl	%eax, (%r8)
	movl	%r11d, (%rdi)
	cmpl	%r12d, 36(%rsp)
	jl	.L51
.L11:
	cmpl	$1, %ebx
	jne	.L52
	movl	$1, 52(%rsp)
	movl	$116, %ecx
	movl	$108, %eax
	movl	$72, %esi
	movl	$19, 48(%rsp)
	movl	$56, %edi
	xorl	%r10d, %r10d
	movl	$8, %r8d
	movq	$80, 24(%rsp)
	movl	$4, %r9d
	movq	$60, 16(%rsp)
	movq	$112, 8(%rsp)
	movl	$15, 56(%rsp)
	movl	$3, 60(%rsp)
	movl	$2, 64(%rsp)
	jmp	.L10
.L25:
	movq	$56, 24(%rsp)
	movl	$84, %ecx
	movl	$108, %eax
	movl	$48, %esi
	movq	$72, 16(%rsp)
	movl	$44, %edi
	movl	$8, %r8d
	movl	$20, %r9d
	movq	$96, 8(%rsp)
	movl	$32, %r10d
	movl	$13, 48(%rsp)
	movl	$12, 56(%rsp)
	movl	$3, 60(%rsp)
	movl	$6, 64(%rsp)
	movl	$9, 52(%rsp)
	jmp	.L10
.L26:
	movq	$44, 24(%rsp)
	movl	$92, %ecx
	movl	$84, %eax
	movl	$36, %esi
	movq	$68, 16(%rsp)
	movl	$48, %edi
	movl	$32, %r8d
	movl	$28, %r9d
	movq	$88, 8(%rsp)
	movl	$24, %r10d
	movl	$10, 48(%rsp)
	movl	$13, 56(%rsp)
	movl	$9, 60(%rsp)
	movl	$8, 64(%rsp)
	movl	$7, 52(%rsp)
	jmp	.L10
.L27:
	movl	$16, 48(%rsp)
	movl	$92, %ecx
	xorl	%r8d, %r8d
	movl	$116, %eax
	movq	$68, 24(%rsp)
	movl	$60, %esi
	movl	$36, %edi
	movl	$12, %r9d
	movq	$80, 16(%rsp)
	movl	$24, %r10d
	movq	$104, 8(%rsp)
	movl	$10, 56(%rsp)
	movl	$1, 60(%rsp)
	movl	$4, 64(%rsp)
	movl	$7, 52(%rsp)
	jmp	.L10
.L51:
	movl	36(%rsp), %eax
	xorl	%edx, %edx
	movl	72(%rsp), %ebx
	subl	$1, %eax
	cmpl	$3, 76(%rsp)
	cmovle	%edx, %eax
	addl	%eax, %ebx
.L16:
	movq	88(%rsp), %rdx
	xorl	%eax, %eax
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L54:
	addq	$4, %rax
	cmpq	$120, %rax
	je	.L53
.L13:
	movl	(%rdx,%rax), %esi
	cmpl	%esi, 0(%rbp,%rax)
	je	.L54
	addl	$1, 68(%rsp)
	movl	36(%rsp), %esi
	movl	68(%rsp), %eax
	addl	%esi, 72(%rsp)
	cmpl	100(%rsp), %eax
	jne	.L18
	addl	$1, 96(%rsp)
	movl	96(%rsp), %eax
	cmpl	$9, %eax
	je	.L45
	movl	%esi, 76(%rsp)
	jmp	.L9
.L53:
	movl	96(%rsp), %edx
	leaq	.LC8(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	movq	128(%rsp), %r12
	call	__printf_chk@PLT
.L17:
	addl	$1, 112(%rsp)
	movl	112(%rsp), %eax
	cmpl	%eax, 156(%rsp)
	jg	.L3
.L44:
	movq	104(%rsp), %rbp
	movq	120(%rsp), %rbx
.L4:
	movq	(%rbx), %rdi
	addq	$8, %rbx
	call	free@PLT
	cmpq	%rbx, %rbp
	jne	.L4
	movq	80(%rsp), %rdi
	call	free@PLT
	movq	408(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L55
	addq	$424, %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
.L50:
	.cfi_restore_state
	movq	80(%rsp), %rcx
	movslq	%ebx, %rax
	movq	(%rcx,%rax,8), %rbp
	jmp	.L16
.L45:
	movq	128(%rsp), %r12
	jmp	.L17
.L48:
	leaq	.LC9(%rip), %rdi
	call	puts@PLT
	jmp	.L17
.L55:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE39:
	.size	main, .-main
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.long	1
	.long	1
	.long	1
	.long	1
	.align 16
.LC1:
	.long	1
	.long	2
	.long	2
	.long	2
	.align 16
.LC2:
	.long	4
	.long	4
	.long	4
	.long	6
	.align 16
.LC3:
	.long	6
	.long	6
	.long	5
	.long	5
	.align 16
.LC4:
	.long	5
	.long	3
	.long	3
	.long	3
	.align 16
.LC5:
	.long	3
	.long	3
	.long	3
	.long	3
	.set	.LC6,.LC4+8
	.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
.LC7:
	.string	"%d"
.LC8:
	.string	"%d\n"
.LC9:
	.string	"0"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movl	$524288, %edi
	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	$424, %rsp
	.cfi_def_cfa_offset 480
	movdqa	.LC0(%rip), %xmm0
	movq	%fs:40, %rax
	movq	%rax, 408(%rsp)
	xorl	%eax, %eax
	movq	.LC6(%rip), %rax
	movaps	%xmm0, 288(%rsp)
	movaps	%xmm0, 304(%rsp)
	movdqa	.LC1(%rip), %xmm0
	movq	%rax, 400(%rsp)
	movaps	%xmm0, 320(%rsp)
	movdqa	.LC2(%rip), %xmm0
	movaps	%xmm0, 336(%rsp)
	movdqa	.LC3(%rip), %xmm0
	movaps	%xmm0, 352(%rsp)
	movdqa	.LC4(%rip), %xmm0
	movaps	%xmm0, 368(%rsp)
	movdqa	.LC5(%rip), %xmm0
	movaps	%xmm0, 384(%rsp)
	call	malloc@PLT
	leaq	524288(%rax), %r12
	movq	%rax, 80(%rsp)
	movq	%rax, %rbp
	movq	%rax, 120(%rsp)
	movq	%r12, 104(%rsp)
.L2:
	movl	$120, %edi
	addq	$8, %rbp
	call	malloc@PLT
	movq	%rax, -8(%rbp)
	cmpq	%rbp, %r12
	jne	.L2
	leaq	156(%rsp), %rsi
	leaq	.LC7(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	156(%rsp), %eax
	testl	%eax, %eax
	jle	.L44
	leaq	280(%rsp), %rax
	movl	$0, 112(%rsp)
	leaq	160(%rsp), %r12
	movq	%rax, 136(%rsp)
	leaq	288(%rsp), %rax
	movq	%rax, 88(%rsp)
.L3:
	movq	136(%rsp), %r13
	movq	%r12, %rbp
	.p2align 4,,10
	.p2align 3
.L5:
	movq	%rbp, %rsi
	leaq	.LC7(%rip), %rdi
	xorl	%eax, %eax
	addq	$4, %rbp
	call	__isoc99_scanf@PLT
	cmpq	%r13, %rbp
	jne	.L5
	movq	88(%rsp), %rdx
	xorl	%eax, %eax
	jmp	.L7
.L49:
	addq	$4, %rax
	cmpq	$120, %rax
	je	.L48
.L7:
	movl	(%rdx,%rax), %ecx
	cmpl	%ecx, (%r12,%rax)
	je	.L49
	movq	80(%rsp), %rdx
	movq	104(%rsp), %rsi
	.p2align 4,,10
	.p2align 3
.L6:
	movq	(%rdx), %rax
	movdqa	(%r12), %xmm1
	addq	$8, %rdx
	movdqa	16(%r12), %xmm2
	movdqa	32(%r12), %xmm3
	movdqa	48(%r12), %xmm4
	movq	112(%r12), %rcx
	movups	%xmm1, (%rax)
	movdqa	64(%r12), %xmm5
	movdqa	80(%r12), %xmm6
	movups	%xmm2, 16(%rax)
	movdqa	96(%r12), %xmm7
	movq	%rcx, 112(%rax)
	movups	%xmm3, 32(%rax)
	movups	%xmm4, 48(%rax)
	movups	%xmm5, 64(%rax)
	movups	%xmm6, 80(%rax)
	movups	%xmm7, 96(%rax)
	cmpq	%rdx, %rsi
	jne	.L6
	movl	$1, 116(%rsp)
	movl	$1, 96(%rsp)
	movl	$65536, 76(%rsp)
	movq	%r12, 128(%rsp)
.L9:
	movl	76(%rsp), %esi
	sall	$2, 116(%rsp)
	movl	116(%rsp), %ecx
	movl	$0, 72(%rsp)
	testl	%esi, %esi
	leal	3(%rsi), %eax
	movl	$1, 68(%rsp)
	cmovns	%esi, %eax
	sarl	$2, %eax
	movl	%eax, 36(%rsp)
	leal	1(%rcx), %eax
	movl	%eax, 100(%rsp)
.L18:
	cmpl	$3, 76(%rsp)
	jle	.L50
	movq	80(%rsp), %rbx
	movl	68(%rsp), %r13d
	movl	$1, %r12d
	movslq	72(%rsp), %rax
	andl	$3, %r13d
	leaq	(%rbx,%rax,8), %rax
	movl	%r13d, %ebx
	movq	%rax, 40(%rsp)
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L52:
	cmpl	$2, %ebx
	je	.L25
	cmpl	$3, %ebx
	je	.L26
	testl	%ebx, %ebx
	je	.L27
	movslq	52(%rsp), %rax
	movl	$30, %r11d
	movq	%rax, %r15
	leaq	-4(,%rax,4), %r10
	movslq	64(%rsp), %rax
	movq	%rax, %rcx
	leaq	-4(,%rax,4), %r9
	movslq	60(%rsp), %rax
	movq	%rax, %rdx
	leaq	-4(,%rax,4), %r8
	movslq	56(%rsp), %rax
	movq	%rax, %r14
	leaq	-4(,%rax,4), %rdi
	movslq	48(%rsp), %rax
	movq	%rax, %rbp
	leaq	-4(,%rax,4), %rsi
	movl	%r11d, %eax
	subl	%edx, %eax
	movl	%r11d, %edx
	subl	%ecx, %edx
	cltq
	movslq	%edx, %rdx
	salq	$2, %rax
	leaq	0(,%rdx,4), %rcx
	movq	%rcx, 8(%rsp)
	movl	%r11d, %ecx
	subl	%r14d, %r11d
	movslq	%r11d, %r11
	subl	%r15d, %ecx
	leaq	0(,%r11,4), %rdx
	leal	1(%rbp), %r11d
	movslq	%ecx, %rcx
	movslq	%r11d, %r11
	movq	%rdx, 16(%rsp)
	salq	$2, %rcx
	leaq	0(,%r11,4), %rdx
	movq	%rdx, 24(%rsp)
	.p2align 4,,10
	.p2align 3
.L10:
	movq	40(%rsp), %r14
	movq	-8(%r14,%r12,8), %rbp
	addq	$1, %r12
	addq	%rbp, %rdi
	addq	%rbp, %rax
	addq	%rbp, %r10
	addq	%rbp, %r9
	movl	(%rdi), %r11d
	movl	(%rax), %edx
	addq	%rbp, %r8
	addq	%rbp, %rsi
	movl	(%r10), %r13d
	movl	(%r9), %r14d
	addq	%rbp, %rcx
	movl	(%r8), %r15d
	movl	%r11d, 32(%rsp)
	movl	(%rsi), %r11d
	movl	%edx, (%r10)
	movq	8(%rsp), %rdx
	addq	%rbp, %rdx
	movl	(%rdx), %r10d
	movl	%r10d, (%r9)
	movl	(%rcx), %r9d
	movl	%r9d, (%r8)
	movq	16(%rsp), %r8
	addq	%rbp, %r8
	movl	(%r8), %r9d
	movl	%r9d, (%rdi)
	movq	24(%rsp), %rdi
	addq	%rbp, %rdi
	movl	(%rdi), %r9d
	movl	%r9d, (%rsi)
	movl	%r15d, (%rcx)
	movl	%r14d, (%rdx)
	movl	%r13d, (%rax)
	movl	32(%rsp), %eax
	movl	%eax, (%r8)
	movl	%r11d, (%rdi)
	cmpl	%r12d, 36(%rsp)
	jl	.L51
.L11:
	cmpl	$1, %ebx
	jne	.L52
	movl	$1, 52(%rsp)
	movl	$116, %ecx
	movl	$108, %eax
	movl	$72, %esi
	movl	$19, 48(%rsp)
	movl	$56, %edi
	xorl	%r10d, %r10d
	movl	$8, %r8d
	movq	$80, 24(%rsp)
	movl	$4, %r9d
	movq	$60, 16(%rsp)
	movq	$112, 8(%rsp)
	movl	$15, 56(%rsp)
	movl	$3, 60(%rsp)
	movl	$2, 64(%rsp)
	jmp	.L10
.L25:
	movq	$56, 24(%rsp)
	movl	$84, %ecx
	movl	$108, %eax
	movl	$48, %esi
	movq	$72, 16(%rsp)
	movl	$44, %edi
	movl	$8, %r8d
	movl	$20, %r9d
	movq	$96, 8(%rsp)
	movl	$32, %r10d
	movl	$13, 48(%rsp)
	movl	$12, 56(%rsp)
	movl	$3, 60(%rsp)
	movl	$6, 64(%rsp)
	movl	$9, 52(%rsp)
	jmp	.L10
.L26:
	movq	$44, 24(%rsp)
	movl	$92, %ecx
	movl	$84, %eax
	movl	$36, %esi
	movq	$68, 16(%rsp)
	movl	$48, %edi
	movl	$32, %r8d
	movl	$28, %r9d
	movq	$88, 8(%rsp)
	movl	$24, %r10d
	movl	$10, 48(%rsp)
	movl	$13, 56(%rsp)
	movl	$9, 60(%rsp)
	movl	$8, 64(%rsp)
	movl	$7, 52(%rsp)
	jmp	.L10
.L27:
	movl	$16, 48(%rsp)
	movl	$92, %ecx
	xorl	%r8d, %r8d
	movl	$116, %eax
	movq	$68, 24(%rsp)
	movl	$60, %esi
	movl	$36, %edi
	movl	$12, %r9d
	movq	$80, 16(%rsp)
	movl	$24, %r10d
	movq	$104, 8(%rsp)
	movl	$10, 56(%rsp)
	movl	$1, 60(%rsp)
	movl	$4, 64(%rsp)
	movl	$7, 52(%rsp)
	jmp	.L10
.L51:
	movl	36(%rsp), %eax
	xorl	%edx, %edx
	movl	72(%rsp), %ebx
	subl	$1, %eax
	cmpl	$3, 76(%rsp)
	cmovle	%edx, %eax
	addl	%eax, %ebx
.L16:
	movq	88(%rsp), %rdx
	xorl	%eax, %eax
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L54:
	addq	$4, %rax
	cmpq	$120, %rax
	je	.L53
.L13:
	movl	(%rdx,%rax), %esi
	cmpl	%esi, 0(%rbp,%rax)
	je	.L54
	addl	$1, 68(%rsp)
	movl	36(%rsp), %esi
	movl	68(%rsp), %eax
	addl	%esi, 72(%rsp)
	cmpl	100(%rsp), %eax
	jne	.L18
	addl	$1, 96(%rsp)
	movl	96(%rsp), %eax
	cmpl	$9, %eax
	je	.L45
	movl	%esi, 76(%rsp)
	jmp	.L9
.L53:
	movl	96(%rsp), %edx
	leaq	.LC8(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	movq	128(%rsp), %r12
	call	__printf_chk@PLT
.L17:
	addl	$1, 112(%rsp)
	movl	112(%rsp), %eax
	cmpl	%eax, 156(%rsp)
	jg	.L3
.L44:
	movq	104(%rsp), %rbp
	movq	120(%rsp), %rbx
.L4:
	movq	(%rbx), %rdi
	addq	$8, %rbx
	call	free@PLT
	cmpq	%rbx, %rbp
	jne	.L4
	movq	80(%rsp), %rdi
	call	free@PLT
	movq	408(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L55
	addq	$424, %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
.L50:
	.cfi_restore_state
	movq	80(%rsp), %rcx
	movslq	%ebx, %rax
	movq	(%rcx,%rax,8), %rbp
	jmp	.L16
.L45:
	movq	128(%rsp), %r12
	jmp	.L17
.L48:
	leaq	.LC9(%rip), %rdi
	call	puts@PLT
	jmp	.L17
.L55:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE39:
	.size	main, .-main
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.long	1
	.long	1
	.long	1
	.long	1
	.align 16
.LC1:
	.long	1
	.long	2
	.long	2
	.long	2
	.align 16
.LC2:
	.long	4
	.long	4
	.long	4
	.long	6
	.align 16
.LC3:
	.long	6
	.long	6
	.long	5
	.long	5
	.align 16
.LC4:
	.long	5
	.long	3
	.long	3
	.long	3
	.align 16
.LC5:
	.long	3
	.long	3
	.long	3
	.long	3
	.set	.LC6,.LC4+8
	.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>

int main() {

	int N;
	int pInput[30];
	int** p;
	int pRowIndex;
	int i;
	int j;
	int k;
	int l;
	int pat;
	int pMovingType[5];
	int t[5];
	int curRow;
	int kai[30] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 4, 4, 4, 6, 6, 6, 5, 5, 5, 3, 3, 3, 3, 3, 3, 3, 3, 3 };

	p = (int**)malloc(sizeof(int*) * 65536);
	for (i = 0; i < 65536; i++) p[i] = (int*)malloc(sizeof(int) * 30);

	scanf("%d", &N);
	for (i = 0; i < N; i++) {
		for (j = 0; j < 30; j++) scanf("%d", &pInput[j]);
		for(j = 0; j < 30; j++) if(pInput[j] != kai[j]) break;
		if(j == 30){
			printf("0\n");
			goto next;
		}
		for (j = 0; j < 65536; j++) for (k = 0; k < 30; k++) p[j][k] = pInput[k];
		pRowIndex = 65536;
		pat = 1;
		for (j = 1; j <= 8; j++) {
			for (k = 1; k <= pat * 4; k++) {
				for (l = 1; l <= pRowIndex / 4; l++) {
					if (k % 4 == 1) {
						pMovingType[0] = 1;
						pMovingType[1] = 2;
						pMovingType[2] = 3;
						pMovingType[3] = 15;
						pMovingType[4] = 19;
					}
					else if (k % 4 == 2) {
						pMovingType[0] = 9;
						pMovingType[1] = 6;
						pMovingType[2] = 3;
						pMovingType[3] = 12;
						pMovingType[4] = 13;
					}
					else if (k % 4 == 3) {
						pMovingType[0] = 7;
						pMovingType[1] = 8;
						pMovingType[2] = 9;
						pMovingType[3] = 13;
						pMovingType[4] = 10;
					}
					else if (k % 4 == 0) {
						pMovingType[0] = 7;
						pMovingType[1] = 4;
						pMovingType[2] = 1;
						pMovingType[3] = 10;
						pMovingType[4] = 16;
					}

					curRow = l + (pRowIndex / 4) * (k - 1) - 1;

					t[0] = p[curRow][pMovingType[0] - 1];
					t[1] = p[curRow][pMovingType[1] - 1];
					t[2] = p[curRow][pMovingType[2] - 1];
					t[3] = p[curRow][pMovingType[3] - 1];
					t[4] = p[curRow][pMovingType[4] - 1];
					p[curRow][pMovingType[0] - 1] = p[curRow][30 - pMovingType[2]];
					p[curRow][pMovingType[1] - 1] = p[curRow][30 - pMovingType[1]];
					p[curRow][pMovingType[2] - 1] = p[curRow][30 - pMovingType[0]];
					p[curRow][pMovingType[3] - 1] = p[curRow][30 - pMovingType[3]];
					p[curRow][pMovingType[4] - 1] = p[curRow][pMovingType[4] + 1];
					p[curRow][30 - pMovingType[0]] = t[2];
					p[curRow][30 - pMovingType[1]] = t[1];
					p[curRow][30 - pMovingType[2]] = t[0];
					p[curRow][30 - pMovingType[3]] = t[3];
					p[curRow][pMovingType[4] + 1] = t[4];

				}
				for(l = 0; l < 30; l++) if(p[curRow][l] != kai[l]) break;
				if(l == 30){
					printf("%d\n", j);
					goto next;
				}
			}
			pRowIndex /= 4;
			pat *= 4;
		}
		next:
		;
	}
	for (i = 0; i < 65536; i++) free(p[i]);
	free(p);

	return 0;
}

4
1 1 1 1 1 1 1 1 1 2 2 2 4 4 4 6 6 6 5 5 5 3 3 3 3 3 3 3 3 3
3 3 3 1 1 1 1 1 1 2 2 2 4 4 6 4 6 6 5 5 5 3 3 3 3 3 3 1 1 1
3 3 3 1 1 3 1 1 1 2 2 5 6 4 4 4 6 6 2 5 5 3 3 3 1 3 3 1 1 1
1 3 1 3 1 3 3 1 3 2 2 2 6 4 4 6 6 4 5 5 5 1 3 1 1 3 1 3 1 3

0
1
2
7

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>

int main() {

	int N;
	int pInput[30];
	int** p;
	int pRowIndex;
	int i;
	int j;
	int k;
	int l;
	int pat;
	int pMovingType[5];
	int t[5];
	int curRow;
	int kai[30] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 4, 4, 4, 6, 6, 6, 5, 5, 5, 3, 3, 3, 3, 3, 3, 3, 3, 3 };

	p = (int**)malloc(sizeof(int*) * 65536);
	for (i = 0; i < 65536; i++) p[i] = (int*)malloc(sizeof(int) * 30);

	scanf("%d", &N);
	for (i = 0; i < N; i++) {
		for (j = 0; j < 30; j++) scanf("%d", &pInput[j]);
		for(j = 0; j < 30; j++) if(pInput[j] != kai[j]) break;
		if(j == 30){
			printf("0\n");
			goto next;
		}
		for (j = 0; j < 65536; j++) for (k = 0; k < 30; k++) p[j][k] = pInput[k];
		pRowIndex = 65536;
		pat = 1;
		for (j = 1; j <= 8; j++) {
			for (k = 1; k <= pat * 4; k++) {
				for (l = 1; l <= pRowIndex / 4; l++) {
					if (k % 4 == 1) {
						pMovingType[0] = 1;
						pMovingType[1] = 2;
						pMovingType[2] = 3;
						pMovingType[3] = 15;
						pMovingType[4] = 19;
					}
					else if (k % 4 == 2) {
						pMovingType[0] = 9;
						pMovingType[1] = 6;
						pMovingType[2] = 3;
						pMovingType[3] = 12;
						pMovingType[4] = 13;
					}
					else if (k % 4 == 3) {
						pMovingType[0] = 7;
						pMovingType[1] = 8;
						pMovingType[2] = 9;
						pMovingType[3] = 13;
						pMovingType[4] = 10;
					}
					else if (k % 4 == 0) {
						pMovingType[0] = 7;
						pMovingType[1] = 4;
						pMovingType[2] = 1;
						pMovingType[3] = 10;
						pMovingType[4] = 16;
					}

					curRow = l + (pRowIndex / 4) * (k - 1) - 1;

					t[0] = p[curRow][pMovingType[0] - 1];
					t[1] = p[curRow][pMovingType[1] - 1];
					t[2] = p[curRow][pMovingType[2] - 1];
					t[3] = p[curRow][pMovingType[3] - 1];
					t[4] = p[curRow][pMovingType[4] - 1];
					p[curRow][pMovingType[0] - 1] = p[curRow][30 - pMovingType[2]];
					p[curRow][pMovingType[1] - 1] = p[curRow][30 - pMovingType[1]];
					p[curRow][pMovingType[2] - 1] = p[curRow][30 - pMovingType[0]];
					p[curRow][pMovingType[3] - 1] = p[curRow][30 - pMovingType[3]];
					p[curRow][pMovingType[4] - 1] = p[curRow][pMovingType[4] + 1];
					p[curRow][30 - pMovingType[0]] = t[2];
					p[curRow][30 - pMovingType[1]] = t[1];
					p[curRow][30 - pMovingType[2]] = t[0];
					p[curRow][30 - pMovingType[3]] = t[3];
					p[curRow][pMovingType[4] + 1] = t[4];

				}
				for(l = 0; l < 30; l++) if(p[curRow][l] != kai[l]) break;
				if(l == 30){
					printf("%d\n", j);
					goto next;
				}
			}
			pRowIndex /= 4;
			pat *= 4;
		}
		next:
		;
	}
	for (i = 0; i < 65536; i++) free(p[i]);
	free(p);

	return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"0"
.LC2:
	.string	"%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
	pushq	%rbx
	subq	$376, %rsp
	.cfi_offset 3, -24
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
	movl	$1, -144(%rbp)
	movl	$1, -140(%rbp)
	movl	$1, -136(%rbp)
	movl	$1, -132(%rbp)
	movl	$1, -128(%rbp)
	movl	$1, -124(%rbp)
	movl	$1, -120(%rbp)
	movl	$1, -116(%rbp)
	movl	$1, -112(%rbp)
	movl	$2, -108(%rbp)
	movl	$2, -104(%rbp)
	movl	$2, -100(%rbp)
	movl	$4, -96(%rbp)
	movl	$4, -92(%rbp)
	movl	$4, -88(%rbp)
	movl	$6, -84(%rbp)
	movl	$6, -80(%rbp)
	movl	$6, -76(%rbp)
	movl	$5, -72(%rbp)
	movl	$5, -68(%rbp)
	movl	$5, -64(%rbp)
	movl	$3, -60(%rbp)
	movl	$3, -56(%rbp)
	movl	$3, -52(%rbp)
	movl	$3, -48(%rbp)
	movl	$3, -44(%rbp)
	movl	$3, -40(%rbp)
	movl	$3, -36(%rbp)
	movl	$3, -32(%rbp)
	movl	$3, -28(%rbp)
	movl	$524288, %edi
	call	malloc@PLT
	movq	%rax, -344(%rbp)
	movl	$0, -368(%rbp)
	jmp	.L2
.L3:
	movl	-368(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-344(%rbp), %rax
	leaq	(%rdx,%rax), %rbx
	movl	$120, %edi
	call	malloc@PLT
	movq	%rax, (%rbx)
	addl	$1, -368(%rbp)
.L2:
	cmpl	$65535, -368(%rbp)
	jle	.L3
	leaq	-376(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -368(%rbp)
	jmp	.L4
.L32:
	movl	$0, -364(%rbp)
	jmp	.L5
.L6:
	leaq	-272(%rbp), %rdx
	movl	-364(%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, -364(%rbp)
.L5:
	cmpl	$29, -364(%rbp)
	jle	.L6
	movl	$0, -364(%rbp)
	jmp	.L7
.L10:
	movl	-364(%rbp), %eax
	cltq
	movl	-272(%rbp,%rax,4), %edx
	movl	-364(%rbp), %eax
	cltq
	movl	-144(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jne	.L37
	addl	$1, -364(%rbp)
.L7:
	cmpl	$29, -364(%rbp)
	jle	.L10
	jmp	.L9
.L37:
	nop
.L9:
	cmpl	$30, -364(%rbp)
	jne	.L11
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L12
.L11:
	movl	$0, -364(%rbp)
	jmp	.L13
.L16:
	movl	$0, -360(%rbp)
	jmp	.L14
.L15:
	movl	-364(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-344(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-360(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rax, %rdx
	movl	-360(%rbp), %eax
	cltq
	movl	-272(%rbp,%rax,4), %eax
	movl	%eax, (%rdx)
	addl	$1, -360(%rbp)
.L14:
	cmpl	$29, -360(%rbp)
	jle	.L15
	addl	$1, -364(%rbp)
.L13:
	cmpl	$65535, -364(%rbp)
	jle	.L16
	movl	$65536, -372(%rbp)
	movl	$1, -352(%rbp)
	movl	$1, -364(%rbp)
	jmp	.L17
.L31:
	movl	$1, -360(%rbp)
	jmp	.L18
.L30:
	movl	$1, -356(%rbp)
	jmp	.L19
.L24:
	movl	-360(%rbp), %eax
	cltd
	shrl	$30, %edx
	addl	%edx, %eax
	andl	$3, %eax
	subl	%edx, %eax
	cmpl	$1, %eax
	jne	.L20
	movl	$1, -336(%rbp)
	movl	$2, -332(%rbp)
	movl	$3, -328(%rbp)
	movl	$15, -324(%rbp)
	movl	$19, -320(%rbp)
	jmp	.L21
.L20:
	movl	-360(%rbp), %eax
	cltd
	shrl	$30, %edx
	addl	%edx, %eax
	andl	$3, %eax
	subl	%edx, %eax
	cmpl	$2, %eax
	jne	.L22
	movl	$9, -336(%rbp)
	movl	$6, -332(%rbp)
	movl	$3, -328(%rbp)
	movl	$12, -324(%rbp)
	movl	$13, -320(%rbp)
	jmp	.L21
.L22:
	movl	-360(%rbp), %eax
	cltd
	shrl	$30, %edx
	addl	%edx, %eax
	andl	$3, %eax
	subl	%edx, %eax
	cmpl	$3, %eax
	jne	.L23
	movl	$7, -336(%rbp)
	movl	$8, -332(%rbp)
	movl	$9, -328(%rbp)
	movl	$13, -324(%rbp)
	movl	$10, -320(%rbp)
	jmp	.L21
.L23:
	movl	-360(%rbp), %eax
	andl	$3, %eax
	testl	%eax, %eax
	jne	.L21
	movl	$7, -336(%rbp)
	movl	$4, -332(%rbp)
	movl	$1, -328(%rbp)
	movl	$10, -324(%rbp)
	movl	$16, -320(%rbp)
.L21:
	movl	-372(%rbp), %eax
	leal	3(%rax), %edx
	testl	%eax, %eax
	cmovs	%edx, %eax
	sarl	$2, %eax
	movl	%eax, %edx
	movl	-360(%rbp), %eax
	subl	$1, %eax
	imull	%eax, %edx
	movl	-356(%rbp), %eax
	addl	%edx, %eax
	subl	$1, %eax
	movl	%eax, -348(%rbp)
	movl	-348(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-344(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-336(%rbp), %eax
	cltq
	salq	$2, %rax
	subq	$4, %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -304(%rbp)
	movl	-348(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-344(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-332(%rbp), %eax
	cltq
	salq	$2, %rax
	subq	$4, %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -300(%rbp)
	movl	-348(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-344(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-328(%rbp), %eax
	cltq
	salq	$2, %rax
	subq	$4, %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -296(%rbp)
	movl	-348(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-344(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-324(%rbp), %eax
	cltq
	salq	$2, %rax
	subq	$4, %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -292(%rbp)
	movl	-348(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-344(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-320(%rbp), %eax
	cltq
	salq	$2, %rax
	subq	$4, %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -288(%rbp)
	movl	-348(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-344(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-328(%rbp), %ecx
	movl	$30, %eax
	subl	%ecx, %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	-348(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	movq	-344(%rbp), %rdx
	addq	%rcx, %rdx
	movq	(%rdx), %rcx
	movl	-336(%rbp), %edx
	movslq	%edx, %rdx
	salq	$2, %rdx
	subq	$4, %rdx
	addq	%rcx, %rdx
	movl	(%rax), %eax
	movl	%eax, (%rdx)
	movl	-348(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-344(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-332(%rbp), %ecx
	movl	$30, %eax
	subl	%ecx, %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	-348(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	movq	-344(%rbp), %rdx
	addq	%rcx, %rdx
	movq	(%rdx), %rcx
	movl	-332(%rbp), %edx
	movslq	%edx, %rdx
	salq	$2, %rdx
	subq	$4, %rdx
	addq	%rcx, %rdx
	movl	(%rax), %eax
	movl	%eax, (%rdx)
	movl	-348(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-344(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-336(%rbp), %ecx
	movl	$30, %eax
	subl	%ecx, %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	-348(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	movq	-344(%rbp), %rdx
	addq	%rcx, %rdx
	movq	(%rdx), %rcx
	movl	-328(%rbp), %edx
	movslq	%edx, %rdx
	salq	$2, %rdx
	subq	$4, %rdx
	addq	%rcx, %rdx
	movl	(%rax), %eax
	movl	%eax, (%rdx)
	movl	-348(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-344(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-324(%rbp), %ecx
	movl	$30, %eax
	subl	%ecx, %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	-348(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	movq	-344(%rbp), %rdx
	addq	%rcx, %rdx
	movq	(%rdx), %rcx
	movl	-324(%rbp), %edx
	movslq	%edx, %rdx
	salq	$2, %rdx
	subq	$4, %rdx
	addq	%rcx, %rdx
	movl	(%rax), %eax
	movl	%eax, (%rdx)
	movl	-348(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-344(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-320(%rbp), %eax
	cltq
	addq	$1, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	movl	-348(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	movq	-344(%rbp), %rdx
	addq	%rcx, %rdx
	movq	(%rdx), %rcx
	movl	-320(%rbp), %edx
	movslq	%edx, %rdx
	salq	$2, %rdx
	subq	$4, %rdx
	addq	%rcx, %rdx
	movl	(%rax), %eax
	movl	%eax, (%rdx)
	movl	-348(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-344(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-336(%rbp), %ecx
	movl	$30, %eax
	subl	%ecx, %eax
	cltq
	salq	$2, %rax
	addq	%rax, %rdx
	movl	-296(%rbp), %eax
	movl	%eax, (%rdx)
	movl	-348(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-344(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-332(%rbp), %ecx
	movl	$30, %eax
	subl	%ecx, %eax
	cltq
	salq	$2, %rax
	addq	%rax, %rdx
	movl	-300(%rbp), %eax
	movl	%eax, (%rdx)
	movl	-348(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-344(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-328(%rbp), %ecx
	movl	$30, %eax
	subl	%ecx, %eax
	cltq
	salq	$2, %rax
	addq	%rax, %rdx
	movl	-304(%rbp), %eax
	movl	%eax, (%rdx)
	movl	-348(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-344(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-324(%rbp), %ecx
	movl	$30, %eax
	subl	%ecx, %eax
	cltq
	salq	$2, %rax
	addq	%rax, %rdx
	movl	-292(%rbp), %eax
	movl	%eax, (%rdx)
	movl	-348(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-344(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-320(%rbp), %eax
	cltq
	addq	$1, %rax
	salq	$2, %rax
	addq	%rax, %rdx
	movl	-288(%rbp), %eax
	movl	%eax, (%rdx)
	addl	$1, -356(%rbp)
.L19:
	movl	-372(%rbp), %eax
	leal	3(%rax), %edx
	testl	%eax, %eax
	cmovs	%edx, %eax
	sarl	$2, %eax
	cmpl	%eax, -356(%rbp)
	jle	.L24
	movl	$0, -356(%rbp)
	jmp	.L25
.L28:
	movl	-348(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-344(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-356(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movl	-356(%rbp), %eax
	cltq
	movl	-144(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jne	.L38
	addl	$1, -356(%rbp)
.L25:
	cmpl	$29, -356(%rbp)
	jle	.L28
	jmp	.L27
.L38:
	nop
.L27:
	cmpl	$30, -356(%rbp)
	jne	.L29
	movl	-364(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L12
.L29:
	addl	$1, -360(%rbp)
.L18:
	movl	-352(%rbp), %eax
	sall	$2, %eax
	cmpl	%eax, -360(%rbp)
	jle	.L30
	movl	-372(%rbp), %eax
	leal	3(%rax), %edx
	testl	%eax, %eax
	cmovs	%edx, %eax
	sarl	$2, %eax
	movl	%eax, -372(%rbp)
	sall	$2, -352(%rbp)
	addl	$1, -364(%rbp)
.L17:
	cmpl	$8, -364(%rbp)
	jle	.L31
	nop
.L12:
	addl	$1, -368(%rbp)
.L4:
	movl	-376(%rbp), %eax
	cmpl	%eax, -368(%rbp)
	jl	.L32
	movl	$0, -368(%rbp)
	jmp	.L33
.L34:
	movl	-368(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-344(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	movq	%rax, %rdi
	call	free@PLT
	addl	$1, -368(%rbp)
.L33:
	cmpl	$65535, -368(%rbp)
	jle	.L34
	movq	-344(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	movl	$0, %eax
	movq	-24(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L36
	call	__stack_chk_fail@PLT
.L36:
	movq	-8(%rbp), %rbx
	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	"0"
.LC2:
	.string	"%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
	pushq	%rbx
	subq	$376, %rsp
	.cfi_offset 3, -24
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
	movl	$1, -144(%rbp)
	movl	$1, -140(%rbp)
	movl	$1, -136(%rbp)
	movl	$1, -132(%rbp)
	movl	$1, -128(%rbp)
	movl	$1, -124(%rbp)
	movl	$1, -120(%rbp)
	movl	$1, -116(%rbp)
	movl	$1, -112(%rbp)
	movl	$2, -108(%rbp)
	movl	$2, -104(%rbp)
	movl	$2, -100(%rbp)
	movl	$4, -96(%rbp)
	movl	$4, -92(%rbp)
	movl	$4, -88(%rbp)
	movl	$6, -84(%rbp)
	movl	$6, -80(%rbp)
	movl	$6, -76(%rbp)
	movl	$5, -72(%rbp)
	movl	$5, -68(%rbp)
	movl	$5, -64(%rbp)
	movl	$3, -60(%rbp)
	movl	$3, -56(%rbp)
	movl	$3, -52(%rbp)
	movl	$3, -48(%rbp)
	movl	$3, -44(%rbp)
	movl	$3, -40(%rbp)
	movl	$3, -36(%rbp)
	movl	$3, -32(%rbp)
	movl	$3, -28(%rbp)
	movl	$524288, %edi
	call	malloc@PLT
	movq	%rax, -344(%rbp)
	movl	$0, -368(%rbp)
	jmp	.L2
.L3:
	movl	-368(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-344(%rbp), %rax
	leaq	(%rdx,%rax), %rbx
	movl	$120, %edi
	call	malloc@PLT
	movq	%rax, (%rbx)
	addl	$1, -368(%rbp)
.L2:
	cmpl	$65535, -368(%rbp)
	jle	.L3
	leaq	-376(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -368(%rbp)
	jmp	.L4
.L32:
	movl	$0, -364(%rbp)
	jmp	.L5
.L6:
	leaq	-272(%rbp), %rdx
	movl	-364(%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, -364(%rbp)
.L5:
	cmpl	$29, -364(%rbp)
	jle	.L6
	movl	$0, -364(%rbp)
	jmp	.L7
.L10:
	movl	-364(%rbp), %eax
	cltq
	movl	-272(%rbp,%rax,4), %edx
	movl	-364(%rbp), %eax
	cltq
	movl	-144(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jne	.L37
	addl	$1, -364(%rbp)
.L7:
	cmpl	$29, -364(%rbp)
	jle	.L10
	jmp	.L9
.L37:
	nop
.L9:
	cmpl	$30, -364(%rbp)
	jne	.L11
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L12
.L11:
	movl	$0, -364(%rbp)
	jmp	.L13
.L16:
	movl	$0, -360(%rbp)
	jmp	.L14
.L15:
	movl	-364(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-344(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-360(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rax, %rdx
	movl	-360(%rbp), %eax
	cltq
	movl	-272(%rbp,%rax,4), %eax
	movl	%eax, (%rdx)
	addl	$1, -360(%rbp)
.L14:
	cmpl	$29, -360(%rbp)
	jle	.L15
	addl	$1, -364(%rbp)
.L13:
	cmpl	$65535, -364(%rbp)
	jle	.L16
	movl	$65536, -372(%rbp)
	movl	$1, -352(%rbp)
	movl	$1, -364(%rbp)
	jmp	.L17
.L31:
	movl	$1, -360(%rbp)
	jmp	.L18
.L30:
	movl	$1, -356(%rbp)
	jmp	.L19
.L24:
	movl	-360(%rbp), %eax
	cltd
	shrl	$30, %edx
	addl	%edx, %eax
	andl	$3, %eax
	subl	%edx, %eax
	cmpl	$1, %eax
	jne	.L20
	movl	$1, -336(%rbp)
	movl	$2, -332(%rbp)
	movl	$3, -328(%rbp)
	movl	$15, -324(%rbp)
	movl	$19, -320(%rbp)
	jmp	.L21
.L20:
	movl	-360(%rbp), %eax
	cltd
	shrl	$30, %edx
	addl	%edx, %eax
	andl	$3, %eax
	subl	%edx, %eax
	cmpl	$2, %eax
	jne	.L22
	movl	$9, -336(%rbp)
	movl	$6, -332(%rbp)
	movl	$3, -328(%rbp)
	movl	$12, -324(%rbp)
	movl	$13, -320(%rbp)
	jmp	.L21
.L22:
	movl	-360(%rbp), %eax
	cltd
	shrl	$30, %edx
	addl	%edx, %eax
	andl	$3, %eax
	subl	%edx, %eax
	cmpl	$3, %eax
	jne	.L23
	movl	$7, -336(%rbp)
	movl	$8, -332(%rbp)
	movl	$9, -328(%rbp)
	movl	$13, -324(%rbp)
	movl	$10, -320(%rbp)
	jmp	.L21
.L23:
	movl	-360(%rbp), %eax
	andl	$3, %eax
	testl	%eax, %eax
	jne	.L21
	movl	$7, -336(%rbp)
	movl	$4, -332(%rbp)
	movl	$1, -328(%rbp)
	movl	$10, -324(%rbp)
	movl	$16, -320(%rbp)
.L21:
	movl	-372(%rbp), %eax
	leal	3(%rax), %edx
	testl	%eax, %eax
	cmovs	%edx, %eax
	sarl	$2, %eax
	movl	%eax, %edx
	movl	-360(%rbp), %eax
	subl	$1, %eax
	imull	%eax, %edx
	movl	-356(%rbp), %eax
	addl	%edx, %eax
	subl	$1, %eax
	movl	%eax, -348(%rbp)
	movl	-348(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-344(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-336(%rbp), %eax
	cltq
	salq	$2, %rax
	subq	$4, %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -304(%rbp)
	movl	-348(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-344(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-332(%rbp), %eax
	cltq
	salq	$2, %rax
	subq	$4, %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -300(%rbp)
	movl	-348(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-344(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-328(%rbp), %eax
	cltq
	salq	$2, %rax
	subq	$4, %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -296(%rbp)
	movl	-348(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-344(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-324(%rbp), %eax
	cltq
	salq	$2, %rax
	subq	$4, %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -292(%rbp)
	movl	-348(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-344(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-320(%rbp), %eax
	cltq
	salq	$2, %rax
	subq	$4, %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -288(%rbp)
	movl	-348(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-344(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-328(%rbp), %ecx
	movl	$30, %eax
	subl	%ecx, %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	-348(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	movq	-344(%rbp), %rdx
	addq	%rcx, %rdx
	movq	(%rdx), %rcx
	movl	-336(%rbp), %edx
	movslq	%edx, %rdx
	salq	$2, %rdx
	subq	$4, %rdx
	addq	%rcx, %rdx
	movl	(%rax), %eax
	movl	%eax, (%rdx)
	movl	-348(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-344(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-332(%rbp), %ecx
	movl	$30, %eax
	subl	%ecx, %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	-348(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	movq	-344(%rbp), %rdx
	addq	%rcx, %rdx
	movq	(%rdx), %rcx
	movl	-332(%rbp), %edx
	movslq	%edx, %rdx
	salq	$2, %rdx
	subq	$4, %rdx
	addq	%rcx, %rdx
	movl	(%rax), %eax
	movl	%eax, (%rdx)
	movl	-348(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-344(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-336(%rbp), %ecx
	movl	$30, %eax
	subl	%ecx, %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	-348(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	movq	-344(%rbp), %rdx
	addq	%rcx, %rdx
	movq	(%rdx), %rcx
	movl	-328(%rbp), %edx
	movslq	%edx, %rdx
	salq	$2, %rdx
	subq	$4, %rdx
	addq	%rcx, %rdx
	movl	(%rax), %eax
	movl	%eax, (%rdx)
	movl	-348(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-344(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-324(%rbp), %ecx
	movl	$30, %eax
	subl	%ecx, %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	-348(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	movq	-344(%rbp), %rdx
	addq	%rcx, %rdx
	movq	(%rdx), %rcx
	movl	-324(%rbp), %edx
	movslq	%edx, %rdx
	salq	$2, %rdx
	subq	$4, %rdx
	addq	%rcx, %rdx
	movl	(%rax), %eax
	movl	%eax, (%rdx)
	movl	-348(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-344(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-320(%rbp), %eax
	cltq
	addq	$1, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	movl	-348(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	movq	-344(%rbp), %rdx
	addq	%rcx, %rdx
	movq	(%rdx), %rcx
	movl	-320(%rbp), %edx
	movslq	%edx, %rdx
	salq	$2, %rdx
	subq	$4, %rdx
	addq	%rcx, %rdx
	movl	(%rax), %eax
	movl	%eax, (%rdx)
	movl	-348(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-344(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-336(%rbp), %ecx
	movl	$30, %eax
	subl	%ecx, %eax
	cltq
	salq	$2, %rax
	addq	%rax, %rdx
	movl	-296(%rbp), %eax
	movl	%eax, (%rdx)
	movl	-348(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-344(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-332(%rbp), %ecx
	movl	$30, %eax
	subl	%ecx, %eax
	cltq
	salq	$2, %rax
	addq	%rax, %rdx
	movl	-300(%rbp), %eax
	movl	%eax, (%rdx)
	movl	-348(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-344(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-328(%rbp), %ecx
	movl	$30, %eax
	subl	%ecx, %eax
	cltq
	salq	$2, %rax
	addq	%rax, %rdx
	movl	-304(%rbp), %eax
	movl	%eax, (%rdx)
	movl	-348(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-344(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-324(%rbp), %ecx
	movl	$30, %eax
	subl	%ecx, %eax
	cltq
	salq	$2, %rax
	addq	%rax, %rdx
	movl	-292(%rbp), %eax
	movl	%eax, (%rdx)
	movl	-348(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-344(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-320(%rbp), %eax
	cltq
	addq	$1, %rax
	salq	$2, %rax
	addq	%rax, %rdx
	movl	-288(%rbp), %eax
	movl	%eax, (%rdx)
	addl	$1, -356(%rbp)
.L19:
	movl	-372(%rbp), %eax
	leal	3(%rax), %edx
	testl	%eax, %eax
	cmovs	%edx, %eax
	sarl	$2, %eax
	cmpl	%eax, -356(%rbp)
	jle	.L24
	movl	$0, -356(%rbp)
	jmp	.L25
.L28:
	movl	-348(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-344(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-356(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movl	-356(%rbp), %eax
	cltq
	movl	-144(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jne	.L38
	addl	$1, -356(%rbp)
.L25:
	cmpl	$29, -356(%rbp)
	jle	.L28
	jmp	.L27
.L38:
	nop
.L27:
	cmpl	$30, -356(%rbp)
	jne	.L29
	movl	-364(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L12
.L29:
	addl	$1, -360(%rbp)
.L18:
	movl	-352(%rbp), %eax
	sall	$2, %eax
	cmpl	%eax, -360(%rbp)
	jle	.L30
	movl	-372(%rbp), %eax
	leal	3(%rax), %edx
	testl	%eax, %eax
	cmovs	%edx, %eax
	sarl	$2, %eax
	movl	%eax, -372(%rbp)
	sall	$2, -352(%rbp)
	addl	$1, -364(%rbp)
.L17:
	cmpl	$8, -364(%rbp)
	jle	.L31
	nop
.L12:
	addl	$1, -368(%rbp)
.L4:
	movl	-376(%rbp), %eax
	cmpl	%eax, -368(%rbp)
	jl	.L32
	movl	$0, -368(%rbp)
	jmp	.L33
.L34:
	movl	-368(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-344(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	movq	%rax, %rdi
	call	free@PLT
	addl	$1, -368(%rbp)
.L33:
	cmpl	$65535, -368(%rbp)
	jle	.L34
	movq	-344(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	movl	$0, %eax
	movq	-24(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L36
	call	__stack_chk_fail@PLT
.L36:
	movq	-8(%rbp), %rbx
	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:
