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 cube_all;
int cube_num[100];
int cube_map[100][100];
int cube_where[100];

/* syo-zyun */
int qsort_comp(const void* x,const void* y) {
	int* a=(int*)x;
	int* b=(int*)y;
	if(*a>*b)return 1;
	if(*a<*b)return -1;
	return 0;
}

int main(void) {
	int i,j;
	int which,where;
	int which_x,which_y,where_x,where_y;
	while(1) {
		scanf("%d",&cube_all);
		if(cube_all==0)break;
		for(i=0;i<cube_all;i++) {
			cube_num[i]=1;
			cube_map[i][0]=i+1;
		}
		while(1) {
			scanf("%d%d",&which,&where);
			if(which==0 && where==0)break;
			if(which==where)continue;
			which_x=which_y=where_x=where_y=0;
			for(i=0;i<cube_all;i++) {
				for(j=0;j<cube_num[i];j++) {
					if(cube_map[i][j]==which) {
						which_x=i;
						which_y=j;
					} else if(cube_map[i][j]==where) {
						where_x=i;
						where_y=j;
					}
				}
			}
			if(where==0) {
				if(which_y>0) {
					for(i=which_y;i<cube_num[which_x];i++) {
						for(j=0;j<cube_all;j++) {
							if(cube_num[j]<=0) {
								cube_num[j]=1;
								cube_map[j][0]=cube_map[which_x][i];
								break;
							}
						}
					}
					cube_num[which_x]=which_y;
				}
			} else {
				if(which_x!=where_x) {
					for(i=which_y+1;i<cube_num[which_x];i++) {
						for(j=0;j<cube_all;j++) {
							if(cube_num[j]<=0) {
								cube_num[j]=1;
								cube_map[j][0]=cube_map[which_x][i];
								break;
							}
						}
					}
					cube_num[which_x]=which_y;
					cube_map[where_x][cube_num[where_x]++]=which;
				} else if(which_y<where_y) {
					for(i=which_y+1;i<cube_num[which_x];i++) {
						for(j=0;j<cube_all;j++) {
							if(cube_num[j]<=0) {
								cube_num[j]=1;
								cube_map[j][0]=cube_map[which_x][i];
								if(cube_map[j][0]==where) {
									where_x=j;
								}
								break;
							}
						}
					}
					cube_num[which_x]=which_y;
					cube_map[where_x][cube_num[where_x]++]=which;
				}
			}
		}
		qsort(cube_num,cube_all,sizeof(int),qsort_comp);
		for(i=0;i<cube_all;i++) {
			if(cube_num[i]>0)printf("%d\n",cube_num[i]);
		}
		puts("end");
	}
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	cube_all
	.bss
	.align 4
	.type	cube_all, @object
	.size	cube_all, 4
cube_all:
	.zero	4
	.globl	cube_num
	.align 32
	.type	cube_num, @object
	.size	cube_num, 400
cube_num:
	.zero	400
	.globl	cube_map
	.align 32
	.type	cube_map, @object
	.size	cube_map, 40000
cube_map:
	.zero	40000
	.globl	cube_where
	.align 32
	.type	cube_where, @object
	.size	cube_where, 400
cube_where:
	.zero	400
	.text
	.globl	qsort_comp
	.type	qsort_comp, @function
qsort_comp:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movq	-24(%rbp), %rax
	movq	%rax, -16(%rbp)
	movq	-32(%rbp), %rax
	movq	%rax, -8(%rbp)
	movq	-16(%rbp), %rax
	movl	(%rax), %edx
	movq	-8(%rbp), %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jle	.L2
	movl	$1, %eax
	jmp	.L3
.L2:
	movq	-16(%rbp), %rax
	movl	(%rax), %edx
	movq	-8(%rbp), %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jge	.L4
	movl	$-1, %eax
	jmp	.L3
.L4:
	movl	$0, %eax
.L3:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	qsort_comp, .-qsort_comp
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d%d"
.LC2:
	.string	"%d\n"
.LC3:
	.string	"end"
	.text
	.globl	main
	.type	main, @function
main:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L45:
	leaq	cube_all(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	cube_all(%rip), %eax
	testl	%eax, %eax
	je	.L50
	movl	$0, -32(%rbp)
	jmp	.L8
.L9:
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cube_num(%rip), %rax
	movl	$1, (%rdx,%rax)
	movl	-32(%rbp), %eax
	leal	1(%rax), %ecx
	movl	-32(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	cube_map(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	addl	$1, -32(%rbp)
.L8:
	movl	cube_all(%rip), %eax
	cmpl	%eax, -32(%rbp)
	jl	.L9
.L41:
	leaq	-36(%rbp), %rdx
	leaq	-40(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-40(%rbp), %eax
	testl	%eax, %eax
	jne	.L10
	movl	-36(%rbp), %eax
	testl	%eax, %eax
	je	.L51
.L10:
	movl	-40(%rbp), %edx
	movl	-36(%rbp), %eax
	cmpl	%eax, %edx
	je	.L52
	movl	$0, -12(%rbp)
	movl	-12(%rbp), %eax
	movl	%eax, -16(%rbp)
	movl	-16(%rbp), %eax
	movl	%eax, -20(%rbp)
	movl	-20(%rbp), %eax
	movl	%eax, -24(%rbp)
	movl	$0, -32(%rbp)
	jmp	.L14
.L19:
	movl	$0, -28(%rbp)
	jmp	.L15
.L18:
	movl	-28(%rbp), %eax
	movslq	%eax, %rcx
	movl	-32(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	cube_map(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-40(%rbp), %eax
	cmpl	%eax, %edx
	jne	.L16
	movl	-32(%rbp), %eax
	movl	%eax, -24(%rbp)
	movl	-28(%rbp), %eax
	movl	%eax, -20(%rbp)
	jmp	.L17
.L16:
	movl	-28(%rbp), %eax
	movslq	%eax, %rcx
	movl	-32(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	cube_map(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-36(%rbp), %eax
	cmpl	%eax, %edx
	jne	.L17
	movl	-32(%rbp), %eax
	movl	%eax, -16(%rbp)
	movl	-28(%rbp), %eax
	movl	%eax, -12(%rbp)
.L17:
	addl	$1, -28(%rbp)
.L15:
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cube_num(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L18
	addl	$1, -32(%rbp)
.L14:
	movl	cube_all(%rip), %eax
	cmpl	%eax, -32(%rbp)
	jl	.L19
	movl	-36(%rbp), %eax
	testl	%eax, %eax
	jne	.L20
	cmpl	$0, -20(%rbp)
	jle	.L41
	movl	-20(%rbp), %eax
	movl	%eax, -32(%rbp)
	jmp	.L21
.L26:
	movl	$0, -28(%rbp)
	jmp	.L22
.L25:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cube_num(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	jg	.L23
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cube_num(%rip), %rax
	movl	$1, (%rdx,%rax)
	movl	-32(%rbp), %eax
	movslq	%eax, %rcx
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	cube_map(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-28(%rbp), %eax
	movslq	%eax, %rcx
	movq	%rcx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rcx
	addq	%rcx, %rax
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	cube_map(%rip), %rax
	movl	%edx, (%rcx,%rax)
	jmp	.L24
.L23:
	addl	$1, -28(%rbp)
.L22:
	movl	cube_all(%rip), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L25
.L24:
	addl	$1, -32(%rbp)
.L21:
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cube_num(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -32(%rbp)
	jl	.L26
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	cube_num(%rip), %rdx
	movl	-20(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	jmp	.L41
.L20:
	movl	-24(%rbp), %eax
	cmpl	-16(%rbp), %eax
	je	.L27
	movl	-20(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -32(%rbp)
	jmp	.L28
.L33:
	movl	$0, -28(%rbp)
	jmp	.L29
.L32:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cube_num(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	jg	.L30
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cube_num(%rip), %rax
	movl	$1, (%rdx,%rax)
	movl	-32(%rbp), %eax
	movslq	%eax, %rcx
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	cube_map(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-28(%rbp), %eax
	movslq	%eax, %rcx
	movq	%rcx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rcx
	addq	%rcx, %rax
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	cube_map(%rip), %rax
	movl	%edx, (%rcx,%rax)
	jmp	.L31
.L30:
	addl	$1, -28(%rbp)
.L29:
	movl	cube_all(%rip), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L32
.L31:
	addl	$1, -32(%rbp)
.L28:
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cube_num(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -32(%rbp)
	jl	.L33
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	cube_num(%rip), %rdx
	movl	-20(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cube_num(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	1(%rax), %edx
	movl	-16(%rbp), %ecx
	movslq	%ecx, %rcx
	leaq	0(,%rcx,4), %rsi
	leaq	cube_num(%rip), %rcx
	movl	%edx, (%rsi,%rcx)
	movl	-40(%rbp), %edx
	movslq	%eax, %rsi
	movl	-16(%rbp), %eax
	movslq	%eax, %rcx
	movq	%rcx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rcx
	addq	%rcx, %rax
	salq	$2, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rcx
	leaq	cube_map(%rip), %rax
	movl	%edx, (%rcx,%rax)
	jmp	.L41
.L27:
	movl	-20(%rbp), %eax
	cmpl	-12(%rbp), %eax
	jge	.L41
	movl	-20(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -32(%rbp)
	jmp	.L34
.L40:
	movl	$0, -28(%rbp)
	jmp	.L35
.L39:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cube_num(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	jg	.L36
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cube_num(%rip), %rax
	movl	$1, (%rdx,%rax)
	movl	-32(%rbp), %eax
	movslq	%eax, %rcx
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	cube_map(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-28(%rbp), %eax
	movslq	%eax, %rcx
	movq	%rcx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rcx
	addq	%rcx, %rax
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	cube_map(%rip), %rax
	movl	%edx, (%rcx,%rax)
	movl	-28(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	cube_map(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-36(%rbp), %eax
	cmpl	%eax, %edx
	jne	.L53
	movl	-28(%rbp), %eax
	movl	%eax, -16(%rbp)
	jmp	.L53
.L36:
	addl	$1, -28(%rbp)
.L35:
	movl	cube_all(%rip), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L39
	jmp	.L38
.L53:
	nop
.L38:
	addl	$1, -32(%rbp)
.L34:
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cube_num(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -32(%rbp)
	jl	.L40
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	cube_num(%rip), %rdx
	movl	-20(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cube_num(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	1(%rax), %edx
	movl	-16(%rbp), %ecx
	movslq	%ecx, %rcx
	leaq	0(,%rcx,4), %rsi
	leaq	cube_num(%rip), %rcx
	movl	%edx, (%rsi,%rcx)
	movl	-40(%rbp), %edx
	movslq	%eax, %rsi
	movl	-16(%rbp), %eax
	movslq	%eax, %rcx
	movq	%rcx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rcx
	addq	%rcx, %rax
	salq	$2, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rcx
	leaq	cube_map(%rip), %rax
	movl	%edx, (%rcx,%rax)
	jmp	.L41
.L52:
	nop
	jmp	.L41
.L51:
	nop
	movl	cube_all(%rip), %eax
	cltq
	leaq	qsort_comp(%rip), %rdx
	movq	%rdx, %rcx
	movl	$4, %edx
	movq	%rax, %rsi
	leaq	cube_num(%rip), %rax
	movq	%rax, %rdi
	call	qsort@PLT
	movl	$0, -32(%rbp)
	jmp	.L42
.L44:
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cube_num(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	jle	.L43
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cube_num(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L43:
	addl	$1, -32(%rbp)
.L42:
	movl	cube_all(%rip), %eax
	cmpl	%eax, -32(%rbp)
	jl	.L44
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L45
.L50:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L47
	call	__stack_chk_fail@PLT
.L47:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.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
	.p2align 4
	.globl	qsort_comp
	.type	qsort_comp, @function
qsort_comp:
.LFB39:
	.cfi_startproc
	endbr64
	movl	(%rsi), %edx
	movl	$1, %eax
	cmpl	%edx, (%rdi)
	jg	.L1
	setl	%al
	movzbl	%al, %eax
	negl	%eax
.L1:
	ret
	.cfi_endproc
.LFE39:
	.size	qsort_comp, .-qsort_comp
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC2:
	.string	"%d"
.LC5:
	.string	"%d%d"
.LC6:
	.string	"end"
.LC7:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB40:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$104, %rsp
	.cfi_def_cfa_offset 160
	movq	%fs:40, %rax
	movq	%rax, 88(%rsp)
	xorl	%eax, %eax
.L60:
	leaq	cube_all(%rip), %rsi
	leaq	.LC2(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	cube_all(%rip), %esi
	testl	%esi, %esi
	je	.L6
	movdqa	.LC3(%rip), %xmm15
	jle	.L85
	leal	-1(%rsi), %eax
	cmpl	$2, %eax
	jbe	.L65
	movl	%esi, %ecx
	leaq	cube_num(%rip), %r13
	leaq	cube_map(%rip), %rdi
	movdqa	.LC0(%rip), %xmm1
	shrl	$2, %ecx
	leaq	16(%r13), %r8
	movq	%r13, %rdx
	movq	%rdi, %rax
	subl	$1, %ecx
	salq	$4, %rcx
	addq	%r8, %rcx
.L10:
	movdqa	.LC4(%rip), %xmm7
	movdqa	%xmm1, %xmm0
	addq	$16, %rdx
	paddd	%xmm15, %xmm1
	addq	$1600, %rax
	paddd	%xmm7, %xmm0
	movaps	%xmm7, -16(%rdx)
	pshufd	$85, %xmm0, %xmm2
	movd	%xmm0, -1600(%rax)
	movd	%xmm2, -1200(%rax)
	movdqa	%xmm0, %xmm2
	punpckhdq	%xmm0, %xmm2
	pshufd	$255, %xmm0, %xmm0
	movd	%xmm2, -800(%rax)
	movd	%xmm0, -400(%rax)
	cmpq	%rcx, %rdx
	jne	.L10
	movl	%esi, %eax
	andl	$-4, %eax
	testb	$3, %sil
	je	.L12
.L9:
	movslq	%eax, %rdx
	leal	1(%rax), %ecx
	movl	$1, 0(%r13,%rdx,4)
	leaq	(%rdx,%rdx,4), %rdx
	leaq	(%rdx,%rdx,4), %rdx
	salq	$4, %rdx
	movl	%ecx, (%rdi,%rdx)
	cmpl	%ecx, %esi
	jle	.L12
	movslq	%ecx, %rcx
	leal	2(%rax), %edx
	movl	$1, 0(%r13,%rcx,4)
	leaq	(%rcx,%rcx,4), %rcx
	leaq	(%rcx,%rcx,4), %rcx
	salq	$4, %rcx
	movl	%edx, (%rdi,%rcx)
	cmpl	%edx, %esi
	jle	.L12
	movslq	%edx, %rdx
	addl	$3, %eax
	movl	$1, 0(%r13,%rdx,4)
	leaq	(%rdx,%rdx,4), %rdx
	leaq	(%rdx,%rdx,4), %rdx
	salq	$4, %rdx
	movl	%eax, (%rdi,%rdx)
.L12:
	leaq	84(%rsp), %rax
	movq	%rax, 72(%rsp)
	leaq	80(%rsp), %rax
	movq	%rax, 64(%rsp)
	.p2align 4,,10
	.p2align 3
.L8:
	movq	72(%rsp), %rdx
	movq	64(%rsp), %rsi
	xorl	%eax, %eax
	leaq	.LC5(%rip), %rdi
	call	__isoc99_scanf@PLT
	movl	80(%rsp), %ebp
	movl	84(%rsp), %eax
	movdqa	.LC3(%rip), %xmm15
	testl	%ebp, %ebp
	movl	%eax, 44(%rsp)
	jne	.L14
	testl	%eax, %eax
	je	.L86
.L16:
	movslq	cube_all(%rip), %r11
	testl	%r11d, %r11d
	jle	.L8
	movd	%ebp, %xmm7
	leaq	cube_map(%rip), %r12
	xorl	%esi, %esi
	xorl	%ebx, %ebx
	pshufd	$0, %xmm7, %xmm7
	movq	%r11, 48(%rsp)
	xorl	%r9d, %r9d
	xorl	%eax, %eax
	movaps	%xmm7, (%rsp)
	movd	44(%rsp), %xmm7
	xorl	%ecx, %ecx
	movq	%r12, %r11
	movq	%r13, 56(%rsp)
	movl	%esi, %r13d
	pshufd	$0, %xmm7, %xmm7
	movaps	%xmm7, 16(%rsp)
	.p2align 4,,10
	.p2align 3
.L18:
	movq	56(%rsp), %rdi
	movl	%ebx, %r10d
	movl	(%rdi,%rbx,4), %edx
	testl	%edx, %edx
	jle	.L40
	leal	-1(%rdx), %esi
	cmpl	$6, %esi
	jbe	.L66
	movd	%ecx, %xmm7
	pxor	%xmm4, %xmm4
	pcmpeqd	%xmm11, %xmm11
	movdqa	.LC0(%rip), %xmm8
	pshufd	$0, %xmm7, %xmm5
	movd	%eax, %xmm7
	movdqa	%xmm4, %xmm3
	movl	%edx, %eax
	pshufd	$0, %xmm7, %xmm6
	shrl	$2, %eax
	movd	%r10d, %xmm7
	movdqa	%xmm11, %xmm10
	pshufd	$0, %xmm7, %xmm12
	subl	$1, %eax
	movdqa	.LC1(%rip), %xmm7
	salq	$4, %rax
	leaq	16(%r11,%rax), %rcx
	movdqa	%xmm7, %xmm9
	movq	%r11, %rax
	.p2align 4,,10
	.p2align 3
.L20:
	movdqa	(%rsp), %xmm1
	movdqa	16(%rsp), %xmm13
	pxor	%xmm0, %xmm0
	movdqa	%xmm8, %xmm2
	addq	$16, %rax
	paddd	%xmm15, %xmm8
	pcmpeqd	-16(%rax), %xmm1
	pcmpeqd	-16(%rax), %xmm13
	pcmpeqd	%xmm1, %xmm0
	movdqa	%xmm1, %xmm14
	pandn	%xmm5, %xmm14
	movdqa	%xmm14, %xmm5
	movdqa	%xmm1, %xmm14
	pand	%xmm13, %xmm0
	movdqa	%xmm12, %xmm13
	pandn	%xmm10, %xmm14
	pand	%xmm1, %xmm13
	movdqa	%xmm14, %xmm10
	movdqa	%xmm0, %xmm14
	por	%xmm13, %xmm5
	movdqa	%xmm2, %xmm13
	pandn	%xmm6, %xmm14
	pand	%xmm1, %xmm13
	movdqa	%xmm14, %xmm6
	pand	%xmm0, %xmm2
	por	%xmm13, %xmm10
	movdqa	%xmm12, %xmm13
	pand	%xmm0, %xmm13
	por	%xmm13, %xmm6
	movdqa	%xmm0, %xmm13
	pandn	%xmm11, %xmm13
	movdqa	%xmm13, %xmm11
	por	%xmm2, %xmm11
	movdqa	%xmm9, %xmm2
	paddd	%xmm15, %xmm9
	pand	%xmm1, %xmm2
	pandn	%xmm3, %xmm1
	movdqa	%xmm1, %xmm3
	movdqa	%xmm7, %xmm1
	paddd	%xmm15, %xmm7
	pand	%xmm0, %xmm1
	pandn	%xmm4, %xmm0
	por	%xmm2, %xmm3
	movdqa	%xmm0, %xmm4
	por	%xmm1, %xmm4
	cmpq	%rcx, %rax
	jne	.L20
	movdqa	%xmm11, %xmm0
	movd	%xmm4, %r8d
	psrldq	$8, %xmm0
	movdqa	%xmm0, %xmm1
	pcmpgtd	%xmm11, %xmm1
	pand	%xmm1, %xmm0
	pandn	%xmm11, %xmm1
	por	%xmm0, %xmm1
	movdqa	%xmm1, %xmm2
	psrldq	$4, %xmm2
	movdqa	%xmm2, %xmm0
	pcmpgtd	%xmm1, %xmm0
	pand	%xmm0, %xmm2
	pandn	%xmm1, %xmm0
	por	%xmm2, %xmm0
	movd	%xmm0, %eax
	pshufd	$85, %xmm4, %xmm0
	cmpl	$-1, %eax
	movd	%xmm0, %edi
	movd	%xmm0, %ecx
	cmovne	%eax, %r9d
	movdqa	%xmm4, %xmm0
	cmpl	%edi, %r8d
	punpckhdq	%xmm4, %xmm0
	cmovnb	%r8d, %ecx
	movd	%xmm0, %esi
	cmpl	%esi, %ecx
	jb	.L21
	pshufd	$85, %xmm6, %xmm0
	movd	%xmm6, %eax
	cmpl	%edi, %r8d
	movd	%xmm0, %r14d
	cmovb	%r14d, %eax
.L22:
	movdqa	%xmm10, %xmm0
	pshufd	$255, %xmm4, %xmm4
	cmpl	%esi, %ecx
	psrldq	$8, %xmm0
	cmovb	%esi, %ecx
	pshufd	$255, %xmm6, %xmm6
	movdqa	%xmm0, %xmm1
	movd	%xmm4, %esi
	pcmpgtd	%xmm10, %xmm1
	movd	%xmm6, %edi
	movd	%xmm3, %r14d
	cmpl	%esi, %ecx
	cmovb	%edi, %eax
	pand	%xmm1, %xmm0
	pandn	%xmm10, %xmm1
	por	%xmm0, %xmm1
	movdqa	%xmm1, %xmm2
	psrldq	$4, %xmm2
	movdqa	%xmm2, %xmm0
	pcmpgtd	%xmm1, %xmm0
	pand	%xmm0, %xmm2
	pandn	%xmm1, %xmm0
	por	%xmm2, %xmm0
	movd	%xmm0, %ecx
	pshufd	$85, %xmm3, %xmm0
	cmpl	$-1, %ecx
	movd	%xmm0, %r8d
	movd	%xmm0, %esi
	cmovne	%ecx, %r13d
	movdqa	%xmm3, %xmm0
	cmpl	%r8d, %r14d
	punpckhdq	%xmm3, %xmm0
	cmovnb	%r14d, %esi
	movd	%xmm0, %edi
	cmpl	%edi, %esi
	jb	.L25
	pshufd	$85, %xmm5, %xmm0
	movd	%xmm5, %ecx
	cmpl	%r8d, %r14d
	movd	%xmm0, %r15d
	cmovb	%r15d, %ecx
.L26:
	pshufd	$255, %xmm3, %xmm3
	pshufd	$255, %xmm5, %xmm5
	cmpl	%edi, %esi
	cmovb	%edi, %esi
	movd	%xmm3, %edi
	movd	%xmm5, %r8d
	cmpl	%edi, %esi
	movl	%edx, %edi
	cmovb	%r8d, %ecx
	andl	$-4, %edi
	testb	$3, %dl
	je	.L40
.L19:
	movslq	%r10d, %rsi
	movslq	%edi, %r8
	leaq	(%rsi,%rsi,4), %r14
	leaq	(%r14,%r14,4), %r14
	leaq	(%r8,%r14,4), %r8
	movl	(%r12,%r8,4), %r8d
	cmpl	%r8d, %ebp
	je	.L67
	cmpl	%r8d, 44(%rsp)
	cmove	%edi, %r9d
	cmove	%r10d, %eax
.L30:
	leal	1(%rdi), %r8d
	cmpl	%edx, %r8d
	jge	.L40
	leaq	(%rsi,%rsi,4), %r15
	movslq	%r8d, %r14
	leaq	(%r15,%r15,4), %r15
	leaq	(%r14,%r15,4), %r14
	movl	(%r12,%r14,4), %r14d
	cmpl	%r14d, %ebp
	je	.L68
	cmpl	%r14d, 44(%rsp)
	cmove	%r8d, %r9d
	cmove	%r10d, %eax
.L31:
	leal	2(%rdi), %r8d
	cmpl	%r8d, %edx
	jle	.L40
	leaq	(%rsi,%rsi,4), %r15
	movslq	%r8d, %r14
	leaq	(%r15,%r15,4), %r15
	leaq	(%r14,%r15,4), %r14
	movl	(%r12,%r14,4), %r14d
	cmpl	%r14d, %ebp
	je	.L69
	cmpl	%r14d, 44(%rsp)
	cmove	%r8d, %r9d
	cmove	%r10d, %eax
.L32:
	leal	3(%rdi), %r8d
	cmpl	%edx, %r8d
	jge	.L40
	leaq	(%rsi,%rsi,4), %r15
	movslq	%r8d, %r14
	leaq	(%r15,%r15,4), %r15
	leaq	(%r14,%r15,4), %r14
	movl	(%r12,%r14,4), %r14d
	cmpl	%r14d, %ebp
	je	.L70
	cmpl	%r14d, 44(%rsp)
	cmove	%r8d, %r9d
	cmove	%r10d, %eax
.L33:
	leal	4(%rdi), %r8d
	cmpl	%edx, %r8d
	jge	.L40
	leaq	(%rsi,%rsi,4), %r15
	movslq	%r8d, %r14
	leaq	(%r15,%r15,4), %r15
	leaq	(%r14,%r15,4), %r14
	movl	(%r12,%r14,4), %r14d
	cmpl	%r14d, %ebp
	je	.L71
	cmpl	%r14d, 44(%rsp)
	cmove	%r8d, %r9d
	cmove	%r10d, %eax
.L34:
	leal	5(%rdi), %r8d
	cmpl	%r8d, %edx
	jle	.L40
	leaq	(%rsi,%rsi,4), %r15
	movslq	%r8d, %r14
	leaq	(%r15,%r15,4), %r15
	leaq	(%r14,%r15,4), %r14
	movl	(%r12,%r14,4), %r14d
	cmpl	%r14d, %ebp
	je	.L72
	cmpl	%r14d, 44(%rsp)
	cmove	%r8d, %r9d
	cmove	%r10d, %eax
.L35:
	addl	$6, %edi
	cmpl	%edi, %edx
	jle	.L40
	leaq	(%rsi,%rsi,4), %rsi
	movslq	%edi, %rdx
	leaq	(%rsi,%rsi,4), %rsi
	leaq	(%rdx,%rsi,4), %rdx
	movl	(%r12,%rdx,4), %edx
	cmpl	%edx, %ebp
	je	.L87
	cmpl	%edx, 44(%rsp)
	cmove	%edi, %r9d
	cmove	%r10d, %eax
.L40:
	addq	$1, %rbx
	addq	$400, %r11
	cmpq	48(%rsp), %rbx
	jne	.L18
	movl	44(%rsp), %r10d
	movl	%r13d, %ebx
	movq	48(%rsp), %r11
	movq	56(%rsp), %r13
	testl	%r10d, %r10d
	jne	.L41
	testl	%ebx, %ebx
	jle	.L8
	movslq	%ecx, %rcx
	cmpl	%ebx, 0(%r13,%rcx,4)
	jle	.L42
	leaq	(%rcx,%rcx,4), %rax
	movslq	%ebx, %rsi
	leaq	(%rax,%rax,4), %rdi
	salq	$4, %rdi
	addq	%r12, %rdi
	.p2align 4,,10
	.p2align 3
.L43:
	xorl	%eax, %eax
	jmp	.L46
	.p2align 4,,10
	.p2align 3
.L44:
	addq	$1, %rax
	cmpq	%r11, %rax
	je	.L45
.L46:
	movl	0(%r13,%rax,4), %r8d
	movslq	%eax, %rdx
	testl	%r8d, %r8d
	jg	.L44
	leaq	(%rdx,%rdx,4), %rax
	movl	(%rdi,%rsi,4), %r8d
	movl	$1, 0(%r13,%rdx,4)
	leaq	(%rax,%rax,4), %rax
	salq	$4, %rax
	movl	%r8d, (%r12,%rax)
.L45:
	addq	$1, %rsi
	cmpl	%esi, 0(%r13,%rcx,4)
	jg	.L43
.L42:
	movl	%ebx, 0(%r13,%rcx,4)
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L25:
	movdqa	%xmm5, %xmm0
	punpckhdq	%xmm5, %xmm0
	movd	%xmm0, %ecx
	jmp	.L26
	.p2align 4,,10
	.p2align 3
.L21:
	movdqa	%xmm6, %xmm0
	punpckhdq	%xmm6, %xmm0
	movd	%xmm0, %eax
	jmp	.L22
	.p2align 4,,10
	.p2align 3
.L67:
	movl	%edi, %r13d
	movl	%r10d, %ecx
	jmp	.L30
	.p2align 4,,10
	.p2align 3
.L68:
	movl	%r8d, %r13d
	movl	%r10d, %ecx
	jmp	.L31
	.p2align 4,,10
	.p2align 3
.L69:
	movl	%r8d, %r13d
	movl	%r10d, %ecx
	jmp	.L32
	.p2align 4,,10
	.p2align 3
.L70:
	movl	%r8d, %r13d
	movl	%r10d, %ecx
	jmp	.L33
	.p2align 4,,10
	.p2align 3
.L71:
	movl	%r8d, %r13d
	movl	%r10d, %ecx
	jmp	.L34
	.p2align 4,,10
	.p2align 3
.L72:
	movl	%r8d, %r13d
	movl	%r10d, %ecx
	jmp	.L35
	.p2align 4,,10
	.p2align 3
.L87:
	movl	%edi, %r13d
	movl	%r10d, %ecx
	jmp	.L40
	.p2align 4,,10
	.p2align 3
.L14:
	cmpl	%eax, %ebp
	je	.L8
	jmp	.L16
.L66:
	xorl	%edi, %edi
	jmp	.L19
.L41:
	cmpl	%eax, %ecx
	jne	.L88
	cmpl	%r9d, %ebx
	jge	.L8
	movslq	%eax, %rcx
	leal	1(%rbx), %edi
	movl	0(%r13,%rcx,4), %r9d
	cmpl	%r9d, %edi
	jge	.L53
	leaq	(%rcx,%rcx,4), %rdx
	movl	44(%rsp), %r10d
	movslq	%edi, %rdi
	leaq	(%rdx,%rdx,4), %r8
	salq	$4, %r8
	addq	%r12, %r8
.L54:
	xorl	%edx, %edx
	jmp	.L58
	.p2align 4,,10
	.p2align 3
.L55:
	addq	$1, %rdx
	cmpq	%r11, %rdx
	je	.L57
.L58:
	movl	0(%r13,%rdx,4), %r14d
	movslq	%edx, %rsi
	testl	%r14d, %r14d
	jg	.L55
	movl	$1, 0(%r13,%rsi,4)
	movl	(%r8,%rdi,4), %r9d
	leaq	(%rsi,%rsi,4), %rsi
	leaq	(%rsi,%rsi,4), %rsi
	salq	$4, %rsi
	cmpl	%r10d, %r9d
	movl	%r9d, (%r12,%rsi)
	movl	0(%r13,%rcx,4), %r9d
	jne	.L57
	movl	%edx, %eax
.L57:
	addq	$1, %rdi
	cmpl	%edi, %r9d
	jg	.L54
.L53:
	cltq
	movl	%ebx, 0(%r13,%rcx,4)
	movslq	0(%r13,%rax,4), %rdx
	leal	1(%rdx), %ecx
	movl	%ecx, 0(%r13,%rax,4)
	leaq	(%rax,%rax,4), %rax
	leaq	(%rax,%rax,4), %rax
	leaq	(%rdx,%rax,4), %rax
	movl	%ebp, (%r12,%rax,4)
	jmp	.L8
.L88:
	movslq	%ecx, %rcx
	leal	1(%rbx), %edi
	movl	0(%r13,%rcx,4), %r9d
	cmpl	%edi, %r9d
	jle	.L53
	leaq	(%rcx,%rcx,4), %rdx
	movslq	%edi, %rdi
	leaq	(%rdx,%rdx,4), %r8
	salq	$4, %r8
	addq	%r12, %r8
	.p2align 4,,10
	.p2align 3
.L49:
	xorl	%edx, %edx
	jmp	.L52
	.p2align 4,,10
	.p2align 3
.L50:
	addq	$1, %rdx
	cmpq	%r11, %rdx
	je	.L51
.L52:
	movl	0(%r13,%rdx,4), %r15d
	movslq	%edx, %rsi
	testl	%r15d, %r15d
	jg	.L50
	leaq	(%rsi,%rsi,4), %rdx
	movl	(%r8,%rdi,4), %r9d
	movl	$1, 0(%r13,%rsi,4)
	leaq	(%rdx,%rdx,4), %rdx
	salq	$4, %rdx
	movl	%r9d, (%r12,%rdx)
	movl	0(%r13,%rcx,4), %r9d
.L51:
	addq	$1, %rdi
	cmpl	%edi, %r9d
	jg	.L49
	jmp	.L53
.L86:
	movslq	cube_all(%rip), %rsi
	leaq	qsort_comp(%rip), %rcx
	movq	%r13, %rdi
	xorl	%ebx, %ebx
	movl	$4, %edx
	leaq	.LC7(%rip), %rbp
	call	qsort@PLT
	movl	cube_all(%rip), %eax
	testl	%eax, %eax
	jle	.L63
	.p2align 4,,10
	.p2align 3
.L59:
	movl	0(%r13,%rbx,4), %edx
	testl	%edx, %edx
	jg	.L89
	addq	$1, %rbx
	cmpl	%ebx, %eax
	jg	.L59
.L63:
	leaq	.LC6(%rip), %rdi
	call	puts@PLT
	jmp	.L60
.L89:
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addq	$1, %rbx
	call	__printf_chk@PLT
	movl	cube_all(%rip), %eax
	cmpl	%ebx, %eax
	jg	.L59
	leaq	.LC6(%rip), %rdi
	call	puts@PLT
	jmp	.L60
.L6:
	movq	88(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L90
	addq	$104, %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
.L65:
	.cfi_restore_state
	xorl	%eax, %eax
	leaq	cube_num(%rip), %r13
	leaq	cube_map(%rip), %rdi
	jmp	.L9
.L85:
	leaq	cube_num(%rip), %r13
	jmp	.L12
.L90:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE40:
	.size	main, .-main
	.globl	cube_where
	.bss
	.align 32
	.type	cube_where, @object
	.size	cube_where, 400
cube_where:
	.zero	400
	.globl	cube_map
	.align 32
	.type	cube_map, @object
	.size	cube_map, 40000
cube_map:
	.zero	40000
	.globl	cube_num
	.align 32
	.type	cube_num, @object
	.size	cube_num, 400
cube_num:
	.zero	400
	.globl	cube_all
	.align 4
	.type	cube_all, @object
	.size	cube_all, 4
cube_all:
	.zero	4
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.long	0
	.long	1
	.long	2
	.long	3
	.align 16
.LC1:
	.long	1
	.long	2
	.long	3
	.long	4
	.align 16
.LC3:
	.long	4
	.long	4
	.long	4
	.long	4
	.align 16
.LC4:
	.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
	.p2align 4
	.globl	qsort_comp
	.type	qsort_comp, @function
qsort_comp:
.LFB39:
	.cfi_startproc
	endbr64
	movl	(%rsi), %edx
	movl	$1, %eax
	cmpl	%edx, (%rdi)
	jg	.L1
	setl	%al
	movzbl	%al, %eax
	negl	%eax
.L1:
	ret
	.cfi_endproc
.LFE39:
	.size	qsort_comp, .-qsort_comp
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC2:
	.string	"%d"
.LC5:
	.string	"%d%d"
.LC6:
	.string	"end"
.LC7:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB40:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$104, %rsp
	.cfi_def_cfa_offset 160
	movq	%fs:40, %rax
	movq	%rax, 88(%rsp)
	xorl	%eax, %eax
.L60:
	leaq	cube_all(%rip), %rsi
	leaq	.LC2(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	cube_all(%rip), %esi
	testl	%esi, %esi
	je	.L6
	movdqa	.LC3(%rip), %xmm15
	jle	.L85
	leal	-1(%rsi), %eax
	cmpl	$2, %eax
	jbe	.L65
	movl	%esi, %ecx
	leaq	cube_num(%rip), %r13
	leaq	cube_map(%rip), %rdi
	movdqa	.LC0(%rip), %xmm1
	shrl	$2, %ecx
	leaq	16(%r13), %r8
	movq	%r13, %rdx
	movq	%rdi, %rax
	subl	$1, %ecx
	salq	$4, %rcx
	addq	%r8, %rcx
.L10:
	movdqa	.LC4(%rip), %xmm7
	movdqa	%xmm1, %xmm0
	addq	$16, %rdx
	paddd	%xmm15, %xmm1
	addq	$1600, %rax
	paddd	%xmm7, %xmm0
	movaps	%xmm7, -16(%rdx)
	pshufd	$85, %xmm0, %xmm2
	movd	%xmm0, -1600(%rax)
	movd	%xmm2, -1200(%rax)
	movdqa	%xmm0, %xmm2
	punpckhdq	%xmm0, %xmm2
	pshufd	$255, %xmm0, %xmm0
	movd	%xmm2, -800(%rax)
	movd	%xmm0, -400(%rax)
	cmpq	%rcx, %rdx
	jne	.L10
	movl	%esi, %eax
	andl	$-4, %eax
	testb	$3, %sil
	je	.L12
.L9:
	movslq	%eax, %rdx
	leal	1(%rax), %ecx
	movl	$1, 0(%r13,%rdx,4)
	leaq	(%rdx,%rdx,4), %rdx
	leaq	(%rdx,%rdx,4), %rdx
	salq	$4, %rdx
	movl	%ecx, (%rdi,%rdx)
	cmpl	%ecx, %esi
	jle	.L12
	movslq	%ecx, %rcx
	leal	2(%rax), %edx
	movl	$1, 0(%r13,%rcx,4)
	leaq	(%rcx,%rcx,4), %rcx
	leaq	(%rcx,%rcx,4), %rcx
	salq	$4, %rcx
	movl	%edx, (%rdi,%rcx)
	cmpl	%edx, %esi
	jle	.L12
	movslq	%edx, %rdx
	addl	$3, %eax
	movl	$1, 0(%r13,%rdx,4)
	leaq	(%rdx,%rdx,4), %rdx
	leaq	(%rdx,%rdx,4), %rdx
	salq	$4, %rdx
	movl	%eax, (%rdi,%rdx)
.L12:
	leaq	84(%rsp), %rax
	movq	%rax, 72(%rsp)
	leaq	80(%rsp), %rax
	movq	%rax, 64(%rsp)
	.p2align 4,,10
	.p2align 3
.L8:
	movq	72(%rsp), %rdx
	movq	64(%rsp), %rsi
	xorl	%eax, %eax
	leaq	.LC5(%rip), %rdi
	call	__isoc99_scanf@PLT
	movl	80(%rsp), %ebp
	movl	84(%rsp), %eax
	movdqa	.LC3(%rip), %xmm15
	testl	%ebp, %ebp
	movl	%eax, 44(%rsp)
	jne	.L14
	testl	%eax, %eax
	je	.L86
.L16:
	movslq	cube_all(%rip), %r11
	testl	%r11d, %r11d
	jle	.L8
	movd	%ebp, %xmm7
	leaq	cube_map(%rip), %r12
	xorl	%esi, %esi
	xorl	%ebx, %ebx
	pshufd	$0, %xmm7, %xmm7
	movq	%r11, 48(%rsp)
	xorl	%r9d, %r9d
	xorl	%eax, %eax
	movaps	%xmm7, (%rsp)
	movd	44(%rsp), %xmm7
	xorl	%ecx, %ecx
	movq	%r12, %r11
	movq	%r13, 56(%rsp)
	movl	%esi, %r13d
	pshufd	$0, %xmm7, %xmm7
	movaps	%xmm7, 16(%rsp)
	.p2align 4,,10
	.p2align 3
.L18:
	movq	56(%rsp), %rdi
	movl	%ebx, %r10d
	movl	(%rdi,%rbx,4), %edx
	testl	%edx, %edx
	jle	.L40
	leal	-1(%rdx), %esi
	cmpl	$6, %esi
	jbe	.L66
	movd	%ecx, %xmm7
	pxor	%xmm4, %xmm4
	pcmpeqd	%xmm11, %xmm11
	movdqa	.LC0(%rip), %xmm8
	pshufd	$0, %xmm7, %xmm5
	movd	%eax, %xmm7
	movdqa	%xmm4, %xmm3
	movl	%edx, %eax
	pshufd	$0, %xmm7, %xmm6
	shrl	$2, %eax
	movd	%r10d, %xmm7
	movdqa	%xmm11, %xmm10
	pshufd	$0, %xmm7, %xmm12
	subl	$1, %eax
	movdqa	.LC1(%rip), %xmm7
	salq	$4, %rax
	leaq	16(%r11,%rax), %rcx
	movdqa	%xmm7, %xmm9
	movq	%r11, %rax
	.p2align 4,,10
	.p2align 3
.L20:
	movdqa	(%rsp), %xmm1
	movdqa	16(%rsp), %xmm13
	pxor	%xmm0, %xmm0
	movdqa	%xmm8, %xmm2
	addq	$16, %rax
	paddd	%xmm15, %xmm8
	pcmpeqd	-16(%rax), %xmm1
	pcmpeqd	-16(%rax), %xmm13
	pcmpeqd	%xmm1, %xmm0
	movdqa	%xmm1, %xmm14
	pandn	%xmm5, %xmm14
	movdqa	%xmm14, %xmm5
	movdqa	%xmm1, %xmm14
	pand	%xmm13, %xmm0
	movdqa	%xmm12, %xmm13
	pandn	%xmm10, %xmm14
	pand	%xmm1, %xmm13
	movdqa	%xmm14, %xmm10
	movdqa	%xmm0, %xmm14
	por	%xmm13, %xmm5
	movdqa	%xmm2, %xmm13
	pandn	%xmm6, %xmm14
	pand	%xmm1, %xmm13
	movdqa	%xmm14, %xmm6
	pand	%xmm0, %xmm2
	por	%xmm13, %xmm10
	movdqa	%xmm12, %xmm13
	pand	%xmm0, %xmm13
	por	%xmm13, %xmm6
	movdqa	%xmm0, %xmm13
	pandn	%xmm11, %xmm13
	movdqa	%xmm13, %xmm11
	por	%xmm2, %xmm11
	movdqa	%xmm9, %xmm2
	paddd	%xmm15, %xmm9
	pand	%xmm1, %xmm2
	pandn	%xmm3, %xmm1
	movdqa	%xmm1, %xmm3
	movdqa	%xmm7, %xmm1
	paddd	%xmm15, %xmm7
	pand	%xmm0, %xmm1
	pandn	%xmm4, %xmm0
	por	%xmm2, %xmm3
	movdqa	%xmm0, %xmm4
	por	%xmm1, %xmm4
	cmpq	%rcx, %rax
	jne	.L20
	movdqa	%xmm11, %xmm0
	movd	%xmm4, %r8d
	psrldq	$8, %xmm0
	movdqa	%xmm0, %xmm1
	pcmpgtd	%xmm11, %xmm1
	pand	%xmm1, %xmm0
	pandn	%xmm11, %xmm1
	por	%xmm0, %xmm1
	movdqa	%xmm1, %xmm2
	psrldq	$4, %xmm2
	movdqa	%xmm2, %xmm0
	pcmpgtd	%xmm1, %xmm0
	pand	%xmm0, %xmm2
	pandn	%xmm1, %xmm0
	por	%xmm2, %xmm0
	movd	%xmm0, %eax
	pshufd	$85, %xmm4, %xmm0
	cmpl	$-1, %eax
	movd	%xmm0, %edi
	movd	%xmm0, %ecx
	cmovne	%eax, %r9d
	movdqa	%xmm4, %xmm0
	cmpl	%edi, %r8d
	punpckhdq	%xmm4, %xmm0
	cmovnb	%r8d, %ecx
	movd	%xmm0, %esi
	cmpl	%esi, %ecx
	jb	.L21
	pshufd	$85, %xmm6, %xmm0
	movd	%xmm6, %eax
	cmpl	%edi, %r8d
	movd	%xmm0, %r14d
	cmovb	%r14d, %eax
.L22:
	movdqa	%xmm10, %xmm0
	pshufd	$255, %xmm4, %xmm4
	cmpl	%esi, %ecx
	psrldq	$8, %xmm0
	cmovb	%esi, %ecx
	pshufd	$255, %xmm6, %xmm6
	movdqa	%xmm0, %xmm1
	movd	%xmm4, %esi
	pcmpgtd	%xmm10, %xmm1
	movd	%xmm6, %edi
	movd	%xmm3, %r14d
	cmpl	%esi, %ecx
	cmovb	%edi, %eax
	pand	%xmm1, %xmm0
	pandn	%xmm10, %xmm1
	por	%xmm0, %xmm1
	movdqa	%xmm1, %xmm2
	psrldq	$4, %xmm2
	movdqa	%xmm2, %xmm0
	pcmpgtd	%xmm1, %xmm0
	pand	%xmm0, %xmm2
	pandn	%xmm1, %xmm0
	por	%xmm2, %xmm0
	movd	%xmm0, %ecx
	pshufd	$85, %xmm3, %xmm0
	cmpl	$-1, %ecx
	movd	%xmm0, %r8d
	movd	%xmm0, %esi
	cmovne	%ecx, %r13d
	movdqa	%xmm3, %xmm0
	cmpl	%r8d, %r14d
	punpckhdq	%xmm3, %xmm0
	cmovnb	%r14d, %esi
	movd	%xmm0, %edi
	cmpl	%edi, %esi
	jb	.L25
	pshufd	$85, %xmm5, %xmm0
	movd	%xmm5, %ecx
	cmpl	%r8d, %r14d
	movd	%xmm0, %r15d
	cmovb	%r15d, %ecx
.L26:
	pshufd	$255, %xmm3, %xmm3
	pshufd	$255, %xmm5, %xmm5
	cmpl	%edi, %esi
	cmovb	%edi, %esi
	movd	%xmm3, %edi
	movd	%xmm5, %r8d
	cmpl	%edi, %esi
	movl	%edx, %edi
	cmovb	%r8d, %ecx
	andl	$-4, %edi
	testb	$3, %dl
	je	.L40
.L19:
	movslq	%r10d, %rsi
	movslq	%edi, %r8
	leaq	(%rsi,%rsi,4), %r14
	leaq	(%r14,%r14,4), %r14
	leaq	(%r8,%r14,4), %r8
	movl	(%r12,%r8,4), %r8d
	cmpl	%r8d, %ebp
	je	.L67
	cmpl	%r8d, 44(%rsp)
	cmove	%edi, %r9d
	cmove	%r10d, %eax
.L30:
	leal	1(%rdi), %r8d
	cmpl	%edx, %r8d
	jge	.L40
	leaq	(%rsi,%rsi,4), %r15
	movslq	%r8d, %r14
	leaq	(%r15,%r15,4), %r15
	leaq	(%r14,%r15,4), %r14
	movl	(%r12,%r14,4), %r14d
	cmpl	%r14d, %ebp
	je	.L68
	cmpl	%r14d, 44(%rsp)
	cmove	%r8d, %r9d
	cmove	%r10d, %eax
.L31:
	leal	2(%rdi), %r8d
	cmpl	%r8d, %edx
	jle	.L40
	leaq	(%rsi,%rsi,4), %r15
	movslq	%r8d, %r14
	leaq	(%r15,%r15,4), %r15
	leaq	(%r14,%r15,4), %r14
	movl	(%r12,%r14,4), %r14d
	cmpl	%r14d, %ebp
	je	.L69
	cmpl	%r14d, 44(%rsp)
	cmove	%r8d, %r9d
	cmove	%r10d, %eax
.L32:
	leal	3(%rdi), %r8d
	cmpl	%edx, %r8d
	jge	.L40
	leaq	(%rsi,%rsi,4), %r15
	movslq	%r8d, %r14
	leaq	(%r15,%r15,4), %r15
	leaq	(%r14,%r15,4), %r14
	movl	(%r12,%r14,4), %r14d
	cmpl	%r14d, %ebp
	je	.L70
	cmpl	%r14d, 44(%rsp)
	cmove	%r8d, %r9d
	cmove	%r10d, %eax
.L33:
	leal	4(%rdi), %r8d
	cmpl	%edx, %r8d
	jge	.L40
	leaq	(%rsi,%rsi,4), %r15
	movslq	%r8d, %r14
	leaq	(%r15,%r15,4), %r15
	leaq	(%r14,%r15,4), %r14
	movl	(%r12,%r14,4), %r14d
	cmpl	%r14d, %ebp
	je	.L71
	cmpl	%r14d, 44(%rsp)
	cmove	%r8d, %r9d
	cmove	%r10d, %eax
.L34:
	leal	5(%rdi), %r8d
	cmpl	%r8d, %edx
	jle	.L40
	leaq	(%rsi,%rsi,4), %r15
	movslq	%r8d, %r14
	leaq	(%r15,%r15,4), %r15
	leaq	(%r14,%r15,4), %r14
	movl	(%r12,%r14,4), %r14d
	cmpl	%r14d, %ebp
	je	.L72
	cmpl	%r14d, 44(%rsp)
	cmove	%r8d, %r9d
	cmove	%r10d, %eax
.L35:
	addl	$6, %edi
	cmpl	%edi, %edx
	jle	.L40
	leaq	(%rsi,%rsi,4), %rsi
	movslq	%edi, %rdx
	leaq	(%rsi,%rsi,4), %rsi
	leaq	(%rdx,%rsi,4), %rdx
	movl	(%r12,%rdx,4), %edx
	cmpl	%edx, %ebp
	je	.L87
	cmpl	%edx, 44(%rsp)
	cmove	%edi, %r9d
	cmove	%r10d, %eax
.L40:
	addq	$1, %rbx
	addq	$400, %r11
	cmpq	48(%rsp), %rbx
	jne	.L18
	movl	44(%rsp), %r10d
	movl	%r13d, %ebx
	movq	48(%rsp), %r11
	movq	56(%rsp), %r13
	testl	%r10d, %r10d
	jne	.L41
	testl	%ebx, %ebx
	jle	.L8
	movslq	%ecx, %rcx
	cmpl	%ebx, 0(%r13,%rcx,4)
	jle	.L42
	leaq	(%rcx,%rcx,4), %rax
	movslq	%ebx, %rsi
	leaq	(%rax,%rax,4), %rdi
	salq	$4, %rdi
	addq	%r12, %rdi
	.p2align 4,,10
	.p2align 3
.L43:
	xorl	%eax, %eax
	jmp	.L46
	.p2align 4,,10
	.p2align 3
.L44:
	addq	$1, %rax
	cmpq	%r11, %rax
	je	.L45
.L46:
	movl	0(%r13,%rax,4), %r8d
	movslq	%eax, %rdx
	testl	%r8d, %r8d
	jg	.L44
	leaq	(%rdx,%rdx,4), %rax
	movl	(%rdi,%rsi,4), %r8d
	movl	$1, 0(%r13,%rdx,4)
	leaq	(%rax,%rax,4), %rax
	salq	$4, %rax
	movl	%r8d, (%r12,%rax)
.L45:
	addq	$1, %rsi
	cmpl	%esi, 0(%r13,%rcx,4)
	jg	.L43
.L42:
	movl	%ebx, 0(%r13,%rcx,4)
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L25:
	movdqa	%xmm5, %xmm0
	punpckhdq	%xmm5, %xmm0
	movd	%xmm0, %ecx
	jmp	.L26
	.p2align 4,,10
	.p2align 3
.L21:
	movdqa	%xmm6, %xmm0
	punpckhdq	%xmm6, %xmm0
	movd	%xmm0, %eax
	jmp	.L22
	.p2align 4,,10
	.p2align 3
.L67:
	movl	%edi, %r13d
	movl	%r10d, %ecx
	jmp	.L30
	.p2align 4,,10
	.p2align 3
.L68:
	movl	%r8d, %r13d
	movl	%r10d, %ecx
	jmp	.L31
	.p2align 4,,10
	.p2align 3
.L69:
	movl	%r8d, %r13d
	movl	%r10d, %ecx
	jmp	.L32
	.p2align 4,,10
	.p2align 3
.L70:
	movl	%r8d, %r13d
	movl	%r10d, %ecx
	jmp	.L33
	.p2align 4,,10
	.p2align 3
.L71:
	movl	%r8d, %r13d
	movl	%r10d, %ecx
	jmp	.L34
	.p2align 4,,10
	.p2align 3
.L72:
	movl	%r8d, %r13d
	movl	%r10d, %ecx
	jmp	.L35
	.p2align 4,,10
	.p2align 3
.L87:
	movl	%edi, %r13d
	movl	%r10d, %ecx
	jmp	.L40
	.p2align 4,,10
	.p2align 3
.L14:
	cmpl	%eax, %ebp
	je	.L8
	jmp	.L16
.L66:
	xorl	%edi, %edi
	jmp	.L19
.L41:
	cmpl	%eax, %ecx
	jne	.L88
	cmpl	%r9d, %ebx
	jge	.L8
	movslq	%eax, %rcx
	leal	1(%rbx), %edi
	movl	0(%r13,%rcx,4), %r9d
	cmpl	%r9d, %edi
	jge	.L53
	leaq	(%rcx,%rcx,4), %rdx
	movl	44(%rsp), %r10d
	movslq	%edi, %rdi
	leaq	(%rdx,%rdx,4), %r8
	salq	$4, %r8
	addq	%r12, %r8
.L54:
	xorl	%edx, %edx
	jmp	.L58
	.p2align 4,,10
	.p2align 3
.L55:
	addq	$1, %rdx
	cmpq	%r11, %rdx
	je	.L57
.L58:
	movl	0(%r13,%rdx,4), %r14d
	movslq	%edx, %rsi
	testl	%r14d, %r14d
	jg	.L55
	movl	$1, 0(%r13,%rsi,4)
	movl	(%r8,%rdi,4), %r9d
	leaq	(%rsi,%rsi,4), %rsi
	leaq	(%rsi,%rsi,4), %rsi
	salq	$4, %rsi
	cmpl	%r10d, %r9d
	movl	%r9d, (%r12,%rsi)
	movl	0(%r13,%rcx,4), %r9d
	jne	.L57
	movl	%edx, %eax
.L57:
	addq	$1, %rdi
	cmpl	%edi, %r9d
	jg	.L54
.L53:
	cltq
	movl	%ebx, 0(%r13,%rcx,4)
	movslq	0(%r13,%rax,4), %rdx
	leal	1(%rdx), %ecx
	movl	%ecx, 0(%r13,%rax,4)
	leaq	(%rax,%rax,4), %rax
	leaq	(%rax,%rax,4), %rax
	leaq	(%rdx,%rax,4), %rax
	movl	%ebp, (%r12,%rax,4)
	jmp	.L8
.L88:
	movslq	%ecx, %rcx
	leal	1(%rbx), %edi
	movl	0(%r13,%rcx,4), %r9d
	cmpl	%edi, %r9d
	jle	.L53
	leaq	(%rcx,%rcx,4), %rdx
	movslq	%edi, %rdi
	leaq	(%rdx,%rdx,4), %r8
	salq	$4, %r8
	addq	%r12, %r8
	.p2align 4,,10
	.p2align 3
.L49:
	xorl	%edx, %edx
	jmp	.L52
	.p2align 4,,10
	.p2align 3
.L50:
	addq	$1, %rdx
	cmpq	%r11, %rdx
	je	.L51
.L52:
	movl	0(%r13,%rdx,4), %r15d
	movslq	%edx, %rsi
	testl	%r15d, %r15d
	jg	.L50
	leaq	(%rsi,%rsi,4), %rdx
	movl	(%r8,%rdi,4), %r9d
	movl	$1, 0(%r13,%rsi,4)
	leaq	(%rdx,%rdx,4), %rdx
	salq	$4, %rdx
	movl	%r9d, (%r12,%rdx)
	movl	0(%r13,%rcx,4), %r9d
.L51:
	addq	$1, %rdi
	cmpl	%edi, %r9d
	jg	.L49
	jmp	.L53
.L86:
	movslq	cube_all(%rip), %rsi
	leaq	qsort_comp(%rip), %rcx
	movq	%r13, %rdi
	xorl	%ebx, %ebx
	movl	$4, %edx
	leaq	.LC7(%rip), %rbp
	call	qsort@PLT
	movl	cube_all(%rip), %eax
	testl	%eax, %eax
	jle	.L63
	.p2align 4,,10
	.p2align 3
.L59:
	movl	0(%r13,%rbx,4), %edx
	testl	%edx, %edx
	jg	.L89
	addq	$1, %rbx
	cmpl	%ebx, %eax
	jg	.L59
.L63:
	leaq	.LC6(%rip), %rdi
	call	puts@PLT
	jmp	.L60
.L89:
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addq	$1, %rbx
	call	__printf_chk@PLT
	movl	cube_all(%rip), %eax
	cmpl	%ebx, %eax
	jg	.L59
	leaq	.LC6(%rip), %rdi
	call	puts@PLT
	jmp	.L60
.L6:
	movq	88(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L90
	addq	$104, %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
.L65:
	.cfi_restore_state
	xorl	%eax, %eax
	leaq	cube_num(%rip), %r13
	leaq	cube_map(%rip), %rdi
	jmp	.L9
.L85:
	leaq	cube_num(%rip), %r13
	jmp	.L12
.L90:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE40:
	.size	main, .-main
	.globl	cube_where
	.bss
	.align 32
	.type	cube_where, @object
	.size	cube_where, 400
cube_where:
	.zero	400
	.globl	cube_map
	.align 32
	.type	cube_map, @object
	.size	cube_map, 40000
cube_map:
	.zero	40000
	.globl	cube_num
	.align 32
	.type	cube_num, @object
	.size	cube_num, 400
cube_num:
	.zero	400
	.globl	cube_all
	.align 4
	.type	cube_all, @object
	.size	cube_all, 4
cube_all:
	.zero	4
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.long	0
	.long	1
	.long	2
	.long	3
	.align 16
.LC1:
	.long	1
	.long	2
	.long	3
	.long	4
	.align 16
.LC3:
	.long	4
	.long	4
	.long	4
	.long	4
	.align 16
.LC4:
	.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>
#include <stdlib.h>

int cube_all;
int cube_num[100];
int cube_map[100][100];
int cube_where[100];

/* syo-zyun */
int qsort_comp(const void* x,const void* y) {
	int* a=(int*)x;
	int* b=(int*)y;
	if(*a>*b)return 1;
	if(*a<*b)return -1;
	return 0;
}

int main(void) {
	int i,j;
	int which,where;
	int which_x,which_y,where_x,where_y;
	while(1) {
		scanf("%d",&cube_all);
		if(cube_all==0)break;
		for(i=0;i<cube_all;i++) {
			cube_num[i]=1;
			cube_map[i][0]=i+1;
		}
		while(1) {
			scanf("%d%d",&which,&where);
			if(which==0 && where==0)break;
			if(which==where)continue;
			which_x=which_y=where_x=where_y=0;
			for(i=0;i<cube_all;i++) {
				for(j=0;j<cube_num[i];j++) {
					if(cube_map[i][j]==which) {
						which_x=i;
						which_y=j;
					} else if(cube_map[i][j]==where) {
						where_x=i;
						where_y=j;
					}
				}
			}
			if(where==0) {
				if(which_y>0) {
					for(i=which_y;i<cube_num[which_x];i++) {
						for(j=0;j<cube_all;j++) {
							if(cube_num[j]<=0) {
								cube_num[j]=1;
								cube_map[j][0]=cube_map[which_x][i];
								break;
							}
						}
					}
					cube_num[which_x]=which_y;
				}
			} else {
				if(which_x!=where_x) {
					for(i=which_y+1;i<cube_num[which_x];i++) {
						for(j=0;j<cube_all;j++) {
							if(cube_num[j]<=0) {
								cube_num[j]=1;
								cube_map[j][0]=cube_map[which_x][i];
								break;
							}
						}
					}
					cube_num[which_x]=which_y;
					cube_map[where_x][cube_num[where_x]++]=which;
				} else if(which_y<where_y) {
					for(i=which_y+1;i<cube_num[which_x];i++) {
						for(j=0;j<cube_all;j++) {
							if(cube_num[j]<=0) {
								cube_num[j]=1;
								cube_map[j][0]=cube_map[which_x][i];
								if(cube_map[j][0]==where) {
									where_x=j;
								}
								break;
							}
						}
					}
					cube_num[which_x]=which_y;
					cube_map[where_x][cube_num[where_x]++]=which;
				}
			}
		}
		qsort(cube_num,cube_all,sizeof(int),qsort_comp);
		for(i=0;i<cube_all;i++) {
			if(cube_num[i]>0)printf("%d\n",cube_num[i]);
		}
		puts("end");
	}
	return 0;
}
3
1 3
2 0
0 0
4
4 1
3 1
1 0
0 0
5
2 1
3 1
4 1
3 2
1 1
0 0
0
 3
1 3
2 0
0 0
4
4 1
3 1
1 2
0 0
5
2 2
3 1
4 1
3 2
1 1
0 0
0
 3
1 3
2 0
0 0
4
1 1
3 1
1 2
0 0
5
2 1
3 1
4 1
3 2
1 1
0 0
0
 3
1 3
2 0
0 0
4
4 1
3 1
1 2
0 0
5
2 2
3 1
4 0
5 2
1 1
0 0
0
 3
1 3
2 0
0 0
4
4 1
3 2
1 3
0 0
5
2 2
3 1
4 1
3 2
2 1
0 0
0
 3
1 3
2 0
0 0
4
4 1
3 1
1 2
0 0
5
2 2
3 1
4 2
3 2
1 1
0 0
0
 3
1 3
2 0
0 0
4
4 1
3 2
1 3
0 0
6
2 2
3 1
4 1
3 2
2 1
0 0
0
 3
1 3
2 0
0 0
4
4 1
3 1
1 2
0 0
10
2 2
2 1
4 0
3 2
1 1
0 0
0
 3
1 3
2 0
0 0
4
4 2
3 0
1 2
0 0
9
2 1
4 1
4 1
3 2
1 1
0 0
0
 3
1 3
0 0
0 0
4
4 1
3 1
1 3
0 0
5
2 2
3 1
4 1
3 2
2 1
0 0
0

1
2
end
1
3
end
1
4
end
 1
2
end
1
1
2
end
1
1
1
2
end
 1
2
end
1
1
2
end
1
4
end
 1
2
end
1
1
2
end
1
2
2
end
 1
2
end
1
3
end
1
1
1
2
end
 1
2
end
1
1
2
end
1
1
3
end
 1
2
end
1
3
end
1
1
1
1
2
end
 1
2
end
1
1
2
end
1
1
1
1
1
1
1
3
end
 1
2
end
1
3
end
1
1
1
1
1
4
end
 1
2
end

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 cube_all;
int cube_num[100];
int cube_map[100][100];
int cube_where[100];

/* syo-zyun */
int qsort_comp(const void* x,const void* y) {
	int* a=(int*)x;
	int* b=(int*)y;
	if(*a>*b)return 1;
	if(*a<*b)return -1;
	return 0;
}

int main(void) {
	int i,j;
	int which,where;
	int which_x,which_y,where_x,where_y;
	while(1) {
		scanf("%d",&cube_all);
		if(cube_all==0)break;
		for(i=0;i<cube_all;i++) {
			cube_num[i]=1;
			cube_map[i][0]=i+1;
		}
		while(1) {
			scanf("%d%d",&which,&where);
			if(which==0 && where==0)break;
			if(which==where)continue;
			which_x=which_y=where_x=where_y=0;
			for(i=0;i<cube_all;i++) {
				for(j=0;j<cube_num[i];j++) {
					if(cube_map[i][j]==which) {
						which_x=i;
						which_y=j;
					} else if(cube_map[i][j]==where) {
						where_x=i;
						where_y=j;
					}
				}
			}
			if(where==0) {
				if(which_y>0) {
					for(i=which_y;i<cube_num[which_x];i++) {
						for(j=0;j<cube_all;j++) {
							if(cube_num[j]<=0) {
								cube_num[j]=1;
								cube_map[j][0]=cube_map[which_x][i];
								break;
							}
						}
					}
					cube_num[which_x]=which_y;
				}
			} else {
				if(which_x!=where_x) {
					for(i=which_y+1;i<cube_num[which_x];i++) {
						for(j=0;j<cube_all;j++) {
							if(cube_num[j]<=0) {
								cube_num[j]=1;
								cube_map[j][0]=cube_map[which_x][i];
								break;
							}
						}
					}
					cube_num[which_x]=which_y;
					cube_map[where_x][cube_num[where_x]++]=which;
				} else if(which_y<where_y) {
					for(i=which_y+1;i<cube_num[which_x];i++) {
						for(j=0;j<cube_all;j++) {
							if(cube_num[j]<=0) {
								cube_num[j]=1;
								cube_map[j][0]=cube_map[which_x][i];
								if(cube_map[j][0]==where) {
									where_x=j;
								}
								break;
							}
						}
					}
					cube_num[which_x]=which_y;
					cube_map[where_x][cube_num[where_x]++]=which;
				}
			}
		}
		qsort(cube_num,cube_all,sizeof(int),qsort_comp);
		for(i=0;i<cube_all;i++) {
			if(cube_num[i]>0)printf("%d\n",cube_num[i]);
		}
		puts("end");
	}
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	cube_all
	.bss
	.align 4
	.type	cube_all, @object
	.size	cube_all, 4
cube_all:
	.zero	4
	.globl	cube_num
	.align 32
	.type	cube_num, @object
	.size	cube_num, 400
cube_num:
	.zero	400
	.globl	cube_map
	.align 32
	.type	cube_map, @object
	.size	cube_map, 40000
cube_map:
	.zero	40000
	.globl	cube_where
	.align 32
	.type	cube_where, @object
	.size	cube_where, 400
cube_where:
	.zero	400
	.text
	.globl	qsort_comp
	.type	qsort_comp, @function
qsort_comp:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movq	-24(%rbp), %rax
	movq	%rax, -16(%rbp)
	movq	-32(%rbp), %rax
	movq	%rax, -8(%rbp)
	movq	-16(%rbp), %rax
	movl	(%rax), %edx
	movq	-8(%rbp), %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jle	.L2
	movl	$1, %eax
	jmp	.L3
.L2:
	movq	-16(%rbp), %rax
	movl	(%rax), %edx
	movq	-8(%rbp), %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jge	.L4
	movl	$-1, %eax
	jmp	.L3
.L4:
	movl	$0, %eax
.L3:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	qsort_comp, .-qsort_comp
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d%d"
.LC2:
	.string	"%d\n"
.LC3:
	.string	"end"
	.text
	.globl	main
	.type	main, @function
main:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L45:
	leaq	cube_all(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	cube_all(%rip), %eax
	testl	%eax, %eax
	je	.L50
	movl	$0, -32(%rbp)
	jmp	.L8
.L9:
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cube_num(%rip), %rax
	movl	$1, (%rdx,%rax)
	movl	-32(%rbp), %eax
	leal	1(%rax), %ecx
	movl	-32(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	cube_map(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	addl	$1, -32(%rbp)
.L8:
	movl	cube_all(%rip), %eax
	cmpl	%eax, -32(%rbp)
	jl	.L9
.L41:
	leaq	-36(%rbp), %rdx
	leaq	-40(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-40(%rbp), %eax
	testl	%eax, %eax
	jne	.L10
	movl	-36(%rbp), %eax
	testl	%eax, %eax
	je	.L51
.L10:
	movl	-40(%rbp), %edx
	movl	-36(%rbp), %eax
	cmpl	%eax, %edx
	je	.L52
	movl	$0, -12(%rbp)
	movl	-12(%rbp), %eax
	movl	%eax, -16(%rbp)
	movl	-16(%rbp), %eax
	movl	%eax, -20(%rbp)
	movl	-20(%rbp), %eax
	movl	%eax, -24(%rbp)
	movl	$0, -32(%rbp)
	jmp	.L14
.L19:
	movl	$0, -28(%rbp)
	jmp	.L15
.L18:
	movl	-28(%rbp), %eax
	movslq	%eax, %rcx
	movl	-32(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	cube_map(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-40(%rbp), %eax
	cmpl	%eax, %edx
	jne	.L16
	movl	-32(%rbp), %eax
	movl	%eax, -24(%rbp)
	movl	-28(%rbp), %eax
	movl	%eax, -20(%rbp)
	jmp	.L17
.L16:
	movl	-28(%rbp), %eax
	movslq	%eax, %rcx
	movl	-32(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	cube_map(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-36(%rbp), %eax
	cmpl	%eax, %edx
	jne	.L17
	movl	-32(%rbp), %eax
	movl	%eax, -16(%rbp)
	movl	-28(%rbp), %eax
	movl	%eax, -12(%rbp)
.L17:
	addl	$1, -28(%rbp)
.L15:
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cube_num(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L18
	addl	$1, -32(%rbp)
.L14:
	movl	cube_all(%rip), %eax
	cmpl	%eax, -32(%rbp)
	jl	.L19
	movl	-36(%rbp), %eax
	testl	%eax, %eax
	jne	.L20
	cmpl	$0, -20(%rbp)
	jle	.L41
	movl	-20(%rbp), %eax
	movl	%eax, -32(%rbp)
	jmp	.L21
.L26:
	movl	$0, -28(%rbp)
	jmp	.L22
.L25:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cube_num(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	jg	.L23
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cube_num(%rip), %rax
	movl	$1, (%rdx,%rax)
	movl	-32(%rbp), %eax
	movslq	%eax, %rcx
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	cube_map(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-28(%rbp), %eax
	movslq	%eax, %rcx
	movq	%rcx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rcx
	addq	%rcx, %rax
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	cube_map(%rip), %rax
	movl	%edx, (%rcx,%rax)
	jmp	.L24
.L23:
	addl	$1, -28(%rbp)
.L22:
	movl	cube_all(%rip), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L25
.L24:
	addl	$1, -32(%rbp)
.L21:
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cube_num(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -32(%rbp)
	jl	.L26
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	cube_num(%rip), %rdx
	movl	-20(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	jmp	.L41
.L20:
	movl	-24(%rbp), %eax
	cmpl	-16(%rbp), %eax
	je	.L27
	movl	-20(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -32(%rbp)
	jmp	.L28
.L33:
	movl	$0, -28(%rbp)
	jmp	.L29
.L32:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cube_num(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	jg	.L30
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cube_num(%rip), %rax
	movl	$1, (%rdx,%rax)
	movl	-32(%rbp), %eax
	movslq	%eax, %rcx
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	cube_map(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-28(%rbp), %eax
	movslq	%eax, %rcx
	movq	%rcx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rcx
	addq	%rcx, %rax
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	cube_map(%rip), %rax
	movl	%edx, (%rcx,%rax)
	jmp	.L31
.L30:
	addl	$1, -28(%rbp)
.L29:
	movl	cube_all(%rip), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L32
.L31:
	addl	$1, -32(%rbp)
.L28:
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cube_num(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -32(%rbp)
	jl	.L33
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	cube_num(%rip), %rdx
	movl	-20(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cube_num(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	1(%rax), %edx
	movl	-16(%rbp), %ecx
	movslq	%ecx, %rcx
	leaq	0(,%rcx,4), %rsi
	leaq	cube_num(%rip), %rcx
	movl	%edx, (%rsi,%rcx)
	movl	-40(%rbp), %edx
	movslq	%eax, %rsi
	movl	-16(%rbp), %eax
	movslq	%eax, %rcx
	movq	%rcx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rcx
	addq	%rcx, %rax
	salq	$2, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rcx
	leaq	cube_map(%rip), %rax
	movl	%edx, (%rcx,%rax)
	jmp	.L41
.L27:
	movl	-20(%rbp), %eax
	cmpl	-12(%rbp), %eax
	jge	.L41
	movl	-20(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -32(%rbp)
	jmp	.L34
.L40:
	movl	$0, -28(%rbp)
	jmp	.L35
.L39:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cube_num(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	jg	.L36
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cube_num(%rip), %rax
	movl	$1, (%rdx,%rax)
	movl	-32(%rbp), %eax
	movslq	%eax, %rcx
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	cube_map(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-28(%rbp), %eax
	movslq	%eax, %rcx
	movq	%rcx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rcx
	addq	%rcx, %rax
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	cube_map(%rip), %rax
	movl	%edx, (%rcx,%rax)
	movl	-28(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	cube_map(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-36(%rbp), %eax
	cmpl	%eax, %edx
	jne	.L53
	movl	-28(%rbp), %eax
	movl	%eax, -16(%rbp)
	jmp	.L53
.L36:
	addl	$1, -28(%rbp)
.L35:
	movl	cube_all(%rip), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L39
	jmp	.L38
.L53:
	nop
.L38:
	addl	$1, -32(%rbp)
.L34:
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cube_num(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -32(%rbp)
	jl	.L40
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	cube_num(%rip), %rdx
	movl	-20(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cube_num(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	1(%rax), %edx
	movl	-16(%rbp), %ecx
	movslq	%ecx, %rcx
	leaq	0(,%rcx,4), %rsi
	leaq	cube_num(%rip), %rcx
	movl	%edx, (%rsi,%rcx)
	movl	-40(%rbp), %edx
	movslq	%eax, %rsi
	movl	-16(%rbp), %eax
	movslq	%eax, %rcx
	movq	%rcx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rcx
	addq	%rcx, %rax
	salq	$2, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rcx
	leaq	cube_map(%rip), %rax
	movl	%edx, (%rcx,%rax)
	jmp	.L41
.L52:
	nop
	jmp	.L41
.L51:
	nop
	movl	cube_all(%rip), %eax
	cltq
	leaq	qsort_comp(%rip), %rdx
	movq	%rdx, %rcx
	movl	$4, %edx
	movq	%rax, %rsi
	leaq	cube_num(%rip), %rax
	movq	%rax, %rdi
	call	qsort@PLT
	movl	$0, -32(%rbp)
	jmp	.L42
.L44:
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cube_num(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	jle	.L43
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cube_num(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L43:
	addl	$1, -32(%rbp)
.L42:
	movl	cube_all(%rip), %eax
	cmpl	%eax, -32(%rbp)
	jl	.L44
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L45
.L50:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L47
	call	__stack_chk_fail@PLT
.L47:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.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
	.globl	cube_all
	.bss
	.align 4
	.type	cube_all, @object
	.size	cube_all, 4
cube_all:
	.zero	4
	.globl	cube_num
	.align 32
	.type	cube_num, @object
	.size	cube_num, 400
cube_num:
	.zero	400
	.globl	cube_map
	.align 32
	.type	cube_map, @object
	.size	cube_map, 40000
cube_map:
	.zero	40000
	.globl	cube_where
	.align 32
	.type	cube_where, @object
	.size	cube_where, 400
cube_where:
	.zero	400
	.text
	.globl	qsort_comp
	.type	qsort_comp, @function
qsort_comp:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movq	-24(%rbp), %rax
	movq	%rax, -16(%rbp)
	movq	-32(%rbp), %rax
	movq	%rax, -8(%rbp)
	movq	-16(%rbp), %rax
	movl	(%rax), %edx
	movq	-8(%rbp), %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jle	.L2
	movl	$1, %eax
	jmp	.L3
.L2:
	movq	-16(%rbp), %rax
	movl	(%rax), %edx
	movq	-8(%rbp), %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jge	.L4
	movl	$-1, %eax
	jmp	.L3
.L4:
	movl	$0, %eax
.L3:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	qsort_comp, .-qsort_comp
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d%d"
.LC2:
	.string	"%d\n"
.LC3:
	.string	"end"
	.text
	.globl	main
	.type	main, @function
main:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L45:
	leaq	cube_all(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	cube_all(%rip), %eax
	testl	%eax, %eax
	je	.L50
	movl	$0, -32(%rbp)
	jmp	.L8
.L9:
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cube_num(%rip), %rax
	movl	$1, (%rdx,%rax)
	movl	-32(%rbp), %eax
	leal	1(%rax), %ecx
	movl	-32(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	cube_map(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	addl	$1, -32(%rbp)
.L8:
	movl	cube_all(%rip), %eax
	cmpl	%eax, -32(%rbp)
	jl	.L9
.L41:
	leaq	-36(%rbp), %rdx
	leaq	-40(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-40(%rbp), %eax
	testl	%eax, %eax
	jne	.L10
	movl	-36(%rbp), %eax
	testl	%eax, %eax
	je	.L51
.L10:
	movl	-40(%rbp), %edx
	movl	-36(%rbp), %eax
	cmpl	%eax, %edx
	je	.L52
	movl	$0, -12(%rbp)
	movl	-12(%rbp), %eax
	movl	%eax, -16(%rbp)
	movl	-16(%rbp), %eax
	movl	%eax, -20(%rbp)
	movl	-20(%rbp), %eax
	movl	%eax, -24(%rbp)
	movl	$0, -32(%rbp)
	jmp	.L14
.L19:
	movl	$0, -28(%rbp)
	jmp	.L15
.L18:
	movl	-28(%rbp), %eax
	movslq	%eax, %rcx
	movl	-32(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	cube_map(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-40(%rbp), %eax
	cmpl	%eax, %edx
	jne	.L16
	movl	-32(%rbp), %eax
	movl	%eax, -24(%rbp)
	movl	-28(%rbp), %eax
	movl	%eax, -20(%rbp)
	jmp	.L17
.L16:
	movl	-28(%rbp), %eax
	movslq	%eax, %rcx
	movl	-32(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	cube_map(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-36(%rbp), %eax
	cmpl	%eax, %edx
	jne	.L17
	movl	-32(%rbp), %eax
	movl	%eax, -16(%rbp)
	movl	-28(%rbp), %eax
	movl	%eax, -12(%rbp)
.L17:
	addl	$1, -28(%rbp)
.L15:
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cube_num(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L18
	addl	$1, -32(%rbp)
.L14:
	movl	cube_all(%rip), %eax
	cmpl	%eax, -32(%rbp)
	jl	.L19
	movl	-36(%rbp), %eax
	testl	%eax, %eax
	jne	.L20
	cmpl	$0, -20(%rbp)
	jle	.L41
	movl	-20(%rbp), %eax
	movl	%eax, -32(%rbp)
	jmp	.L21
.L26:
	movl	$0, -28(%rbp)
	jmp	.L22
.L25:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cube_num(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	jg	.L23
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cube_num(%rip), %rax
	movl	$1, (%rdx,%rax)
	movl	-32(%rbp), %eax
	movslq	%eax, %rcx
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	cube_map(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-28(%rbp), %eax
	movslq	%eax, %rcx
	movq	%rcx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rcx
	addq	%rcx, %rax
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	cube_map(%rip), %rax
	movl	%edx, (%rcx,%rax)
	jmp	.L24
.L23:
	addl	$1, -28(%rbp)
.L22:
	movl	cube_all(%rip), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L25
.L24:
	addl	$1, -32(%rbp)
.L21:
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cube_num(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -32(%rbp)
	jl	.L26
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	cube_num(%rip), %rdx
	movl	-20(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	jmp	.L41
.L20:
	movl	-24(%rbp), %eax
	cmpl	-16(%rbp), %eax
	je	.L27
	movl	-20(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -32(%rbp)
	jmp	.L28
.L33:
	movl	$0, -28(%rbp)
	jmp	.L29
.L32:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cube_num(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	jg	.L30
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cube_num(%rip), %rax
	movl	$1, (%rdx,%rax)
	movl	-32(%rbp), %eax
	movslq	%eax, %rcx
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	cube_map(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-28(%rbp), %eax
	movslq	%eax, %rcx
	movq	%rcx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rcx
	addq	%rcx, %rax
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	cube_map(%rip), %rax
	movl	%edx, (%rcx,%rax)
	jmp	.L31
.L30:
	addl	$1, -28(%rbp)
.L29:
	movl	cube_all(%rip), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L32
.L31:
	addl	$1, -32(%rbp)
.L28:
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cube_num(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -32(%rbp)
	jl	.L33
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	cube_num(%rip), %rdx
	movl	-20(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cube_num(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	1(%rax), %edx
	movl	-16(%rbp), %ecx
	movslq	%ecx, %rcx
	leaq	0(,%rcx,4), %rsi
	leaq	cube_num(%rip), %rcx
	movl	%edx, (%rsi,%rcx)
	movl	-40(%rbp), %edx
	movslq	%eax, %rsi
	movl	-16(%rbp), %eax
	movslq	%eax, %rcx
	movq	%rcx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rcx
	addq	%rcx, %rax
	salq	$2, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rcx
	leaq	cube_map(%rip), %rax
	movl	%edx, (%rcx,%rax)
	jmp	.L41
.L27:
	movl	-20(%rbp), %eax
	cmpl	-12(%rbp), %eax
	jge	.L41
	movl	-20(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -32(%rbp)
	jmp	.L34
.L40:
	movl	$0, -28(%rbp)
	jmp	.L35
.L39:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cube_num(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	jg	.L36
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cube_num(%rip), %rax
	movl	$1, (%rdx,%rax)
	movl	-32(%rbp), %eax
	movslq	%eax, %rcx
	movl	-24(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	cube_map(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-28(%rbp), %eax
	movslq	%eax, %rcx
	movq	%rcx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rcx
	addq	%rcx, %rax
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	cube_map(%rip), %rax
	movl	%edx, (%rcx,%rax)
	movl	-28(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	addq	%rdx, %rax
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	cube_map(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-36(%rbp), %eax
	cmpl	%eax, %edx
	jne	.L53
	movl	-28(%rbp), %eax
	movl	%eax, -16(%rbp)
	jmp	.L53
.L36:
	addl	$1, -28(%rbp)
.L35:
	movl	cube_all(%rip), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L39
	jmp	.L38
.L53:
	nop
.L38:
	addl	$1, -32(%rbp)
.L34:
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cube_num(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -32(%rbp)
	jl	.L40
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	cube_num(%rip), %rdx
	movl	-20(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cube_num(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	1(%rax), %edx
	movl	-16(%rbp), %ecx
	movslq	%ecx, %rcx
	leaq	0(,%rcx,4), %rsi
	leaq	cube_num(%rip), %rcx
	movl	%edx, (%rsi,%rcx)
	movl	-40(%rbp), %edx
	movslq	%eax, %rsi
	movl	-16(%rbp), %eax
	movslq	%eax, %rcx
	movq	%rcx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rcx
	addq	%rcx, %rax
	salq	$2, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rcx
	leaq	cube_map(%rip), %rax
	movl	%edx, (%rcx,%rax)
	jmp	.L41
.L52:
	nop
	jmp	.L41
.L51:
	nop
	movl	cube_all(%rip), %eax
	cltq
	leaq	qsort_comp(%rip), %rdx
	movq	%rdx, %rcx
	movl	$4, %edx
	movq	%rax, %rsi
	leaq	cube_num(%rip), %rax
	movq	%rax, %rdi
	call	qsort@PLT
	movl	$0, -32(%rbp)
	jmp	.L42
.L44:
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cube_num(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	jle	.L43
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	cube_num(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L43:
	addl	$1, -32(%rbp)
.L42:
	movl	cube_all(%rip), %eax
	cmpl	%eax, -32(%rbp)
	jl	.L44
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L45
.L50:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L47
	call	__stack_chk_fail@PLT
.L47:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.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:
