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>

typedef struct {
	short surf[6];
	short top;
	short top_add;
	short front;
	short front_add;
} dice;

int main(void){

	dice dice1 = {0,0};

	short q;
	register short i,j;

	for(i = 0;i < 6;i++){
		scanf("%d",&dice1.surf[i]);
	}
	scanf("%d",&q);
	for(i = 0;i < q;i++){
		scanf("%d",&dice1.top);
		for(j = 0;j < 6;j++){
			if(dice1.top == dice1.surf[j]){
				dice1.top_add = j;
				break;
			}
		}
		scanf("%d",&dice1.front);
		for(j = 0;j < 6;j++){
			if(dice1.front == dice1.surf[j]){
				dice1.front_add = j;
				break;
			}
		}
		
		switch(dice1.top_add){
			case 0:
				switch(dice1.front_add){
					case 1:
						printf("%d\n",dice1.surf[2]);
						break;
					case 2:
						printf("%d\n",dice1.surf[4]);
						break;
					case 3:
						printf("%d\n",dice1.surf[1]);
						break;
					case 4:
						printf("%d\n",dice1.surf[3]);
						break;
					default:
						break;
				}
				break;
			case 1:
				switch(dice1.front_add){
					case 0:
						printf("%d\n",dice1.surf[3]);
						break;
					case 2:
						printf("%d\n",dice1.surf[0]);
						break;
					case 3:
						printf("%d\n",dice1.surf[5]);
						break;
					case 5:
						printf("%d\n",dice1.surf[2]);
						break;
					default:
						break;
				}
				break;
			case 2:
				switch(dice1.front_add){
					case 0:
						printf("%d\n",dice1.surf[1]);
						break;
					case 1:
						printf("%d\n",dice1.surf[5]);
						break;
					case 4:
						printf("%d\n",dice1.surf[0]);
						break;
					case 5:
						printf("%d\n",dice1.surf[4]);
						break;
					default:
						break;
				}
				break;
			case 3:
				switch(dice1.front_add){
					case 0:
						printf("%d\n",dice1.surf[4]);
						break;
					case 1:
						printf("%d\n",dice1.surf[0]);
						break;
					case 4:
						printf("%d\n",dice1.surf[5]);
						break;
					case 5:
						printf("%d\n",dice1.surf[1]);
						break;
					default:
						break;
				}
				break;
			case 4:
				switch(dice1.front_add){
					case 0:
						printf("%d\n",dice1.surf[2]);
						break;
					case 2:
						printf("%d\n",dice1.surf[5]);
						break;
					case 3:
						printf("%d\n",dice1.surf[0]);
						break;
					case 5:
						printf("%d\n",dice1.surf[3]);
						break;
					default:
						break;
				}
				break;
			case 5:
				switch(dice1.front_add){
					case 1:
						printf("%d\n",dice1.surf[3]);
						break;
					case 2:
						printf("%d\n",dice1.surf[1]);
						break;
					case 3:
						printf("%d\n",dice1.surf[4]);
						break;
					case 4:
						printf("%d\n",dice1.surf[2]);
						break;
					default:
						break;
				}
				break;
			default:
				break;
		}
	}

	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r12
	pushq	%rbx
	subq	$48, %rsp
	.cfi_offset 12, -24
	.cfi_offset 3, -32
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
	movq	$0, -48(%rbp)
	movq	$0, -40(%rbp)
	movl	$0, -32(%rbp)
	movl	$0, %r12d
	jmp	.L2
.L3:
	movswl	%r12w, %eax
	leaq	-48(%rbp), %rdx
	cltq
	addq	%rax, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	%r12d, %eax
	addl	$1, %eax
	movl	%eax, %r12d
.L2:
	cmpw	$5, %r12w
	jle	.L3
	leaq	-50(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, %r12d
	jmp	.L4
.L58:
	leaq	-48(%rbp), %rax
	addq	$12, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, %ebx
	jmp	.L5
.L8:
	movzwl	-36(%rbp), %edx
	movswl	%bx, %eax
	cltq
	movzwl	-48(%rbp,%rax,2), %eax
	cmpw	%ax, %dx
	jne	.L6
	movw	%bx, -34(%rbp)
	jmp	.L7
.L6:
	movl	%ebx, %eax
	addl	$1, %eax
	movl	%eax, %ebx
.L5:
	cmpw	$5, %bx
	jle	.L8
.L7:
	leaq	-48(%rbp), %rax
	addq	$16, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, %ebx
	jmp	.L9
.L12:
	movzwl	-32(%rbp), %edx
	movswl	%bx, %eax
	cltq
	movzwl	-48(%rbp,%rax,2), %eax
	cmpw	%ax, %dx
	jne	.L10
	movw	%bx, -30(%rbp)
	jmp	.L11
.L10:
	movl	%ebx, %eax
	addl	$1, %eax
	movl	%eax, %ebx
.L9:
	cmpw	$5, %bx
	jle	.L12
.L11:
	movzwl	-34(%rbp), %eax
	cwtl
	cmpl	$5, %eax
	ja	.L61
	movl	%eax, %eax
	leaq	0(,%rax,4), %rdx
	leaq	.L15(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	leaq	.L15(%rip), %rdx
	addq	%rdx, %rax
	notrack jmp	*%rax
	.section	.rodata
	.align 4
	.align 4
.L15:
	.long	.L20-.L15
	.long	.L19-.L15
	.long	.L18-.L15
	.long	.L17-.L15
	.long	.L16-.L15
	.long	.L14-.L15
	.text
.L20:
	movzwl	-30(%rbp), %eax
	cwtl
	cmpl	$4, %eax
	je	.L21
	cmpl	$4, %eax
	jg	.L62
	cmpl	$3, %eax
	je	.L23
	cmpl	$3, %eax
	jg	.L62
	cmpl	$1, %eax
	je	.L24
	cmpl	$2, %eax
	je	.L25
	jmp	.L62
.L24:
	movzwl	-44(%rbp), %eax
	cwtl
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L26
.L25:
	movzwl	-40(%rbp), %eax
	cwtl
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L26
.L23:
	movzwl	-46(%rbp), %eax
	cwtl
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L26
.L21:
	movzwl	-42(%rbp), %eax
	cwtl
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L26
.L62:
	nop
.L26:
	jmp	.L27
.L19:
	movzwl	-30(%rbp), %eax
	cwtl
	cmpl	$5, %eax
	je	.L28
	cmpl	$5, %eax
	jg	.L63
	cmpl	$3, %eax
	je	.L30
	cmpl	$3, %eax
	jg	.L63
	testl	%eax, %eax
	je	.L31
	cmpl	$2, %eax
	je	.L32
	jmp	.L63
.L31:
	movzwl	-42(%rbp), %eax
	cwtl
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L33
.L32:
	movzwl	-48(%rbp), %eax
	cwtl
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L33
.L30:
	movzwl	-38(%rbp), %eax
	cwtl
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L33
.L28:
	movzwl	-44(%rbp), %eax
	cwtl
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L33
.L63:
	nop
.L33:
	jmp	.L27
.L18:
	movzwl	-30(%rbp), %eax
	cwtl
	cmpl	$5, %eax
	je	.L34
	cmpl	$5, %eax
	jg	.L64
	cmpl	$4, %eax
	je	.L36
	cmpl	$4, %eax
	jg	.L64
	testl	%eax, %eax
	je	.L37
	cmpl	$1, %eax
	je	.L38
	jmp	.L64
.L37:
	movzwl	-46(%rbp), %eax
	cwtl
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L39
.L38:
	movzwl	-38(%rbp), %eax
	cwtl
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L39
.L36:
	movzwl	-48(%rbp), %eax
	cwtl
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L39
.L34:
	movzwl	-40(%rbp), %eax
	cwtl
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L39
.L64:
	nop
.L39:
	jmp	.L27
.L17:
	movzwl	-30(%rbp), %eax
	cwtl
	cmpl	$5, %eax
	je	.L40
	cmpl	$5, %eax
	jg	.L65
	cmpl	$4, %eax
	je	.L42
	cmpl	$4, %eax
	jg	.L65
	testl	%eax, %eax
	je	.L43
	cmpl	$1, %eax
	je	.L44
	jmp	.L65
.L43:
	movzwl	-40(%rbp), %eax
	cwtl
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L45
.L44:
	movzwl	-48(%rbp), %eax
	cwtl
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L45
.L42:
	movzwl	-38(%rbp), %eax
	cwtl
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L45
.L40:
	movzwl	-46(%rbp), %eax
	cwtl
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L45
.L65:
	nop
.L45:
	jmp	.L27
.L16:
	movzwl	-30(%rbp), %eax
	cwtl
	cmpl	$5, %eax
	je	.L46
	cmpl	$5, %eax
	jg	.L66
	cmpl	$3, %eax
	je	.L48
	cmpl	$3, %eax
	jg	.L66
	testl	%eax, %eax
	je	.L49
	cmpl	$2, %eax
	je	.L50
	jmp	.L66
.L49:
	movzwl	-44(%rbp), %eax
	cwtl
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L51
.L50:
	movzwl	-38(%rbp), %eax
	cwtl
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L51
.L48:
	movzwl	-48(%rbp), %eax
	cwtl
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L51
.L46:
	movzwl	-42(%rbp), %eax
	cwtl
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L51
.L66:
	nop
.L51:
	jmp	.L27
.L14:
	movzwl	-30(%rbp), %eax
	cwtl
	cmpl	$4, %eax
	je	.L52
	cmpl	$4, %eax
	jg	.L67
	cmpl	$3, %eax
	je	.L54
	cmpl	$3, %eax
	jg	.L67
	cmpl	$1, %eax
	je	.L55
	cmpl	$2, %eax
	je	.L56
	jmp	.L67
.L55:
	movzwl	-42(%rbp), %eax
	cwtl
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L57
.L56:
	movzwl	-46(%rbp), %eax
	cwtl
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L57
.L54:
	movzwl	-40(%rbp), %eax
	cwtl
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L57
.L52:
	movzwl	-44(%rbp), %eax
	cwtl
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L57
.L67:
	nop
.L57:
	jmp	.L27
.L61:
	nop
.L27:
	movl	%r12d, %eax
	addl	$1, %eax
	movl	%eax, %r12d
.L4:
	movzwl	-50(%rbp), %eax
	cmpw	%ax, %r12w
	jl	.L58
	movl	$0, %eax
	movq	-24(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L60
	call	__stack_chk_fail@PLT
.L60:
	addq	$48, %rsp
	popq	%rbx
	popq	%r12
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
user
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pxor	%xmm0, %xmm0
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	leaq	.LC0(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	movl	$0, 32(%rsp)
	leaq	16(%rsp), %rbx
	leaq	28(%rsp), %r13
	movaps	%xmm0, 16(%rsp)
	.p2align 4,,10
	.p2align 3
.L2:
	movq	%rbx, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	addq	$2, %rbx
	call	__isoc99_scanf@PLT
	cmpq	%rbx, %r13
	jne	.L2
	xorl	%eax, %eax
	leaq	14(%rsp), %rsi
	movq	%rbp, %rdi
	call	__isoc99_scanf@PLT
	cmpw	$0, 14(%rsp)
	jle	.L3
	xorl	%ebx, %ebx
	leaq	32(%rsp), %r14
	leaq	.L10(%rip), %r12
	leaq	.LC1(%rip), %r15
	.p2align 4,,10
	.p2align 3
.L31:
	movq	%r13, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movzwl	28(%rsp), %eax
	cmpw	16(%rsp), %ax
	je	.L33
	cmpw	18(%rsp), %ax
	je	.L34
	cmpw	20(%rsp), %ax
	je	.L35
	cmpw	22(%rsp), %ax
	je	.L36
	cmpw	24(%rsp), %ax
	je	.L37
	cmpw	26(%rsp), %ax
	je	.L107
.L5:
	movq	%r14, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movzwl	32(%rsp), %eax
	movswl	16(%rsp), %edx
	cmpw	%dx, %ax
	je	.L38
	cmpw	18(%rsp), %ax
	je	.L39
	cmpw	20(%rsp), %ax
	je	.L40
	cmpw	22(%rsp), %ax
	je	.L41
	cmpw	24(%rsp), %ax
	je	.L42
	cmpw	26(%rsp), %ax
	je	.L108
.L7:
	cmpw	$5, 30(%rsp)
	ja	.L8
	movzwl	30(%rsp), %eax
	movslq	(%r12,%rax,4), %rax
	addq	%r12, %rax
	notrack jmp	*%rax
	.section	.rodata
	.align 4
	.align 4
.L10:
	.long	.L15-.L10
	.long	.L14-.L10
	.long	.L13-.L10
	.long	.L12-.L10
	.long	.L11-.L10
	.long	.L9-.L10
	.section	.text.startup
	.p2align 4,,10
	.p2align 3
.L11:
	movzwl	34(%rsp), %eax
	cmpw	$3, %ax
	je	.L28
	jg	.L29
	testw	%ax, %ax
	je	.L18
	cmpw	$2, %ax
	jne	.L8
.L21:
	movswl	26(%rsp), %edx
	movq	%r15, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	.p2align 4,,10
	.p2align 3
.L8:
	addl	$1, %ebx
	cmpw	%bx, 14(%rsp)
	jg	.L31
.L3:
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L109
	addq	$56, %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
	.p2align 4,,10
	.p2align 3
.L15:
	.cfi_restore_state
	movzwl	34(%rsp), %eax
	cmpw	$3, %ax
	je	.L16
	jg	.L17
	cmpw	$1, %ax
	je	.L18
	cmpw	$2, %ax
	jne	.L8
.L19:
	movswl	24(%rsp), %edx
	movq	%r15, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L9:
	movzwl	34(%rsp), %eax
	cmpw	$3, %ax
	je	.L19
	jg	.L30
	cmpw	$1, %ax
	je	.L20
	cmpw	$2, %ax
	jne	.L8
.L16:
	movswl	18(%rsp), %edx
	movq	%r15, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L13:
	movzwl	34(%rsp), %eax
	cmpw	$4, %ax
	je	.L28
	jg	.L25
	testw	%ax, %ax
	je	.L16
	cmpw	$1, %ax
	je	.L21
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L14:
	movzwl	34(%rsp), %eax
	cmpw	$3, %ax
	je	.L21
	jg	.L22
	testw	%ax, %ax
	je	.L20
	cmpw	$2, %ax
	jne	.L8
.L28:
	movq	%r15, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L12:
	movzwl	34(%rsp), %eax
	cmpw	$4, %ax
	je	.L21
	jg	.L26
	testw	%ax, %ax
	je	.L19
	cmpw	$1, %ax
	je	.L28
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L29:
	cmpw	$5, %ax
	jne	.L8
.L20:
	movswl	22(%rsp), %edx
	movq	%r15, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L25:
	cmpw	$5, %ax
	je	.L19
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L17:
	cmpw	$4, %ax
	je	.L20
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L30:
	cmpw	$4, %ax
	jne	.L8
.L18:
	movswl	20(%rsp), %edx
	movq	%r15, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L22:
	cmpw	$5, %ax
	je	.L18
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L26:
	cmpw	$5, %ax
	je	.L16
	jmp	.L8
.L33:
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L4:
	movw	%ax, 30(%rsp)
	jmp	.L5
.L38:
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L6:
	movw	%ax, 34(%rsp)
	jmp	.L7
.L39:
	movl	$1, %eax
	jmp	.L6
.L34:
	movl	$1, %eax
	jmp	.L4
.L35:
	movl	$2, %eax
	jmp	.L4
.L40:
	movl	$2, %eax
	jmp	.L6
.L36:
	movl	$3, %eax
	jmp	.L4
.L41:
	movl	$3, %eax
	jmp	.L6
.L42:
	movl	$4, %eax
	jmp	.L6
.L37:
	movl	$4, %eax
	jmp	.L4
.L107:
	movl	$5, %eax
	jmp	.L4
.L108:
	movl	$5, %eax
	jmp	.L6
.L109:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

rule
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pxor	%xmm0, %xmm0
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	leaq	.LC0(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	movl	$0, 32(%rsp)
	leaq	16(%rsp), %rbx
	leaq	28(%rsp), %r13
	movaps	%xmm0, 16(%rsp)
	.p2align 4,,10
	.p2align 3
.L2:
	movq	%rbx, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	addq	$2, %rbx
	call	__isoc99_scanf@PLT
	cmpq	%rbx, %r13
	jne	.L2
	xorl	%eax, %eax
	leaq	14(%rsp), %rsi
	movq	%rbp, %rdi
	call	__isoc99_scanf@PLT
	cmpw	$0, 14(%rsp)
	jle	.L3
	xorl	%ebx, %ebx
	leaq	32(%rsp), %r14
	leaq	.L10(%rip), %r12
	leaq	.LC1(%rip), %r15
	.p2align 4,,10
	.p2align 3
.L31:
	movq	%r13, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movzwl	28(%rsp), %eax
	cmpw	16(%rsp), %ax
	je	.L33
	cmpw	18(%rsp), %ax
	je	.L34
	cmpw	20(%rsp), %ax
	je	.L35
	cmpw	22(%rsp), %ax
	je	.L36
	cmpw	24(%rsp), %ax
	je	.L37
	cmpw	26(%rsp), %ax
	je	.L107
.L5:
	movq	%r14, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movzwl	32(%rsp), %eax
	movswl	16(%rsp), %edx
	cmpw	%dx, %ax
	je	.L38
	cmpw	18(%rsp), %ax
	je	.L39
	cmpw	20(%rsp), %ax
	je	.L40
	cmpw	22(%rsp), %ax
	je	.L41
	cmpw	24(%rsp), %ax
	je	.L42
	cmpw	26(%rsp), %ax
	je	.L108
.L7:
	cmpw	$5, 30(%rsp)
	ja	.L8
	movzwl	30(%rsp), %eax
	movslq	(%r12,%rax,4), %rax
	addq	%r12, %rax
	notrack jmp	*%rax
	.section	.rodata
	.align 4
	.align 4
.L10:
	.long	.L15-.L10
	.long	.L14-.L10
	.long	.L13-.L10
	.long	.L12-.L10
	.long	.L11-.L10
	.long	.L9-.L10
	.section	.text.startup
	.p2align 4,,10
	.p2align 3
.L11:
	movzwl	34(%rsp), %eax
	cmpw	$3, %ax
	je	.L28
	jg	.L29
	testw	%ax, %ax
	je	.L18
	cmpw	$2, %ax
	jne	.L8
.L21:
	movswl	26(%rsp), %edx
	movq	%r15, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	.p2align 4,,10
	.p2align 3
.L8:
	addl	$1, %ebx
	cmpw	%bx, 14(%rsp)
	jg	.L31
.L3:
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L109
	addq	$56, %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
	.p2align 4,,10
	.p2align 3
.L15:
	.cfi_restore_state
	movzwl	34(%rsp), %eax
	cmpw	$3, %ax
	je	.L16
	jg	.L17
	cmpw	$1, %ax
	je	.L18
	cmpw	$2, %ax
	jne	.L8
.L19:
	movswl	24(%rsp), %edx
	movq	%r15, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L9:
	movzwl	34(%rsp), %eax
	cmpw	$3, %ax
	je	.L19
	jg	.L30
	cmpw	$1, %ax
	je	.L20
	cmpw	$2, %ax
	jne	.L8
.L16:
	movswl	18(%rsp), %edx
	movq	%r15, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L13:
	movzwl	34(%rsp), %eax
	cmpw	$4, %ax
	je	.L28
	jg	.L25
	testw	%ax, %ax
	je	.L16
	cmpw	$1, %ax
	je	.L21
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L14:
	movzwl	34(%rsp), %eax
	cmpw	$3, %ax
	je	.L21
	jg	.L22
	testw	%ax, %ax
	je	.L20
	cmpw	$2, %ax
	jne	.L8
.L28:
	movq	%r15, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L12:
	movzwl	34(%rsp), %eax
	cmpw	$4, %ax
	je	.L21
	jg	.L26
	testw	%ax, %ax
	je	.L19
	cmpw	$1, %ax
	je	.L28
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L29:
	cmpw	$5, %ax
	jne	.L8
.L20:
	movswl	22(%rsp), %edx
	movq	%r15, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L25:
	cmpw	$5, %ax
	je	.L19
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L17:
	cmpw	$4, %ax
	je	.L20
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L30:
	cmpw	$4, %ax
	jne	.L8
.L18:
	movswl	20(%rsp), %edx
	movq	%r15, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L22:
	cmpw	$5, %ax
	je	.L18
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L26:
	cmpw	$5, %ax
	je	.L16
	jmp	.L8
.L33:
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L4:
	movw	%ax, 30(%rsp)
	jmp	.L5
.L38:
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L6:
	movw	%ax, 34(%rsp)
	jmp	.L7
.L39:
	movl	$1, %eax
	jmp	.L6
.L34:
	movl	$1, %eax
	jmp	.L4
.L35:
	movl	$2, %eax
	jmp	.L4
.L40:
	movl	$2, %eax
	jmp	.L6
.L36:
	movl	$3, %eax
	jmp	.L4
.L41:
	movl	$3, %eax
	jmp	.L6
.L42:
	movl	$4, %eax
	jmp	.L6
.L37:
	movl	$4, %eax
	jmp	.L4
.L107:
	movl	$5, %eax
	jmp	.L4
.L108:
	movl	$5, %eax
	jmp	.L6
.L109:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

#include <stdio.h>

typedef struct {
	short surf[6];
	short top;
	short top_add;
	short front;
	short front_add;
} dice;

int main(void){

	dice dice1 = {0,0};

	short q;
	register short i,j;

	for(i = 0;i < 6;i++){
		scanf("%d",&dice1.surf[i]);
	}
	scanf("%d",&q);
	for(i = 0;i < q;i++){
		scanf("%d",&dice1.top);
		for(j = 0;j < 6;j++){
			if(dice1.top == dice1.surf[j]){
				dice1.top_add = j;
				break;
			}
		}
		scanf("%d",&dice1.front);
		for(j = 0;j < 6;j++){
			if(dice1.front == dice1.surf[j]){
				dice1.front_add = j;
				break;
			}
		}
		
		switch(dice1.top_add){
			case 0:
				switch(dice1.front_add){
					case 1:
						printf("%d\n",dice1.surf[2]);
						break;
					case 2:
						printf("%d\n",dice1.surf[4]);
						break;
					case 3:
						printf("%d\n",dice1.surf[1]);
						break;
					case 4:
						printf("%d\n",dice1.surf[3]);
						break;
					default:
						break;
				}
				break;
			case 1:
				switch(dice1.front_add){
					case 0:
						printf("%d\n",dice1.surf[3]);
						break;
					case 2:
						printf("%d\n",dice1.surf[0]);
						break;
					case 3:
						printf("%d\n",dice1.surf[5]);
						break;
					case 5:
						printf("%d\n",dice1.surf[2]);
						break;
					default:
						break;
				}
				break;
			case 2:
				switch(dice1.front_add){
					case 0:
						printf("%d\n",dice1.surf[1]);
						break;
					case 1:
						printf("%d\n",dice1.surf[5]);
						break;
					case 4:
						printf("%d\n",dice1.surf[0]);
						break;
					case 5:
						printf("%d\n",dice1.surf[4]);
						break;
					default:
						break;
				}
				break;
			case 3:
				switch(dice1.front_add){
					case 0:
						printf("%d\n",dice1.surf[4]);
						break;
					case 1:
						printf("%d\n",dice1.surf[0]);
						break;
					case 4:
						printf("%d\n",dice1.surf[5]);
						break;
					case 5:
						printf("%d\n",dice1.surf[1]);
						break;
					default:
						break;
				}
				break;
			case 4:
				switch(dice1.front_add){
					case 0:
						printf("%d\n",dice1.surf[2]);
						break;
					case 2:
						printf("%d\n",dice1.surf[5]);
						break;
					case 3:
						printf("%d\n",dice1.surf[0]);
						break;
					case 5:
						printf("%d\n",dice1.surf[3]);
						break;
					default:
						break;
				}
				break;
			case 5:
				switch(dice1.front_add){
					case 1:
						printf("%d\n",dice1.surf[3]);
						break;
					case 2:
						printf("%d\n",dice1.surf[1]);
						break;
					case 3:
						printf("%d\n",dice1.surf[4]);
						break;
					case 4:
						printf("%d\n",dice1.surf[2]);
						break;
					default:
						break;
				}
				break;
			default:
				break;
		}
	}

	return 0;
}
1 2 3 4 5 6
3
4 5
1 3
3 2
 1 2 3 4 5 6
3
4 5
1 3
6 2
 1 2 3 4 5 6
3
4 5
2 3
6 2
 1 2 3 4 5 6
3
6 5
2 3
6 2
 1 2 3 4 5 6
3
6 3
1 3
3 2
 1 2 3 4 5 6
3
4 2
1 3
3 2
 1 2 3 4 5 6
3
4 5
2 3
4 2
 1 2 3 4 5 6
3
6 5
2 6
6 2
 1 2 3 4 5 6
3
6 4
1 3
3 2
 1 2 3 4 5 6
3
4 5
1 4
6 2

6
5
6
 6
5
4
 6
0
4
 3
0
4
 2
5
6
 0
5
6
 6
0
0
 3
3
4
 5
5
6
 6
2
4

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>

typedef struct {
	short surf[6];
	short top;
	short top_add;
	short front;
	short front_add;
} dice;

int main(void){

	dice dice1 = {0,0};

	short q;
	register short i,j;

	for(i = 0;i < 6;i++){
		scanf("%d",&dice1.surf[i]);
	}
	scanf("%d",&q);
	for(i = 0;i < q;i++){
		scanf("%d",&dice1.top);
		for(j = 0;j < 6;j++){
			if(dice1.top == dice1.surf[j]){
				dice1.top_add = j;
				break;
			}
		}
		scanf("%d",&dice1.front);
		for(j = 0;j < 6;j++){
			if(dice1.front == dice1.surf[j]){
				dice1.front_add = j;
				break;
			}
		}
		
		switch(dice1.top_add){
			case 0:
				switch(dice1.front_add){
					case 1:
						printf("%d\n",dice1.surf[2]);
						break;
					case 2:
						printf("%d\n",dice1.surf[4]);
						break;
					case 3:
						printf("%d\n",dice1.surf[1]);
						break;
					case 4:
						printf("%d\n",dice1.surf[3]);
						break;
					default:
						break;
				}
				break;
			case 1:
				switch(dice1.front_add){
					case 0:
						printf("%d\n",dice1.surf[3]);
						break;
					case 2:
						printf("%d\n",dice1.surf[0]);
						break;
					case 3:
						printf("%d\n",dice1.surf[5]);
						break;
					case 5:
						printf("%d\n",dice1.surf[2]);
						break;
					default:
						break;
				}
				break;
			case 2:
				switch(dice1.front_add){
					case 0:
						printf("%d\n",dice1.surf[1]);
						break;
					case 1:
						printf("%d\n",dice1.surf[5]);
						break;
					case 4:
						printf("%d\n",dice1.surf[0]);
						break;
					case 5:
						printf("%d\n",dice1.surf[4]);
						break;
					default:
						break;
				}
				break;
			case 3:
				switch(dice1.front_add){
					case 0:
						printf("%d\n",dice1.surf[4]);
						break;
					case 1:
						printf("%d\n",dice1.surf[0]);
						break;
					case 4:
						printf("%d\n",dice1.surf[5]);
						break;
					case 5:
						printf("%d\n",dice1.surf[1]);
						break;
					default:
						break;
				}
				break;
			case 4:
				switch(dice1.front_add){
					case 0:
						printf("%d\n",dice1.surf[2]);
						break;
					case 2:
						printf("%d\n",dice1.surf[5]);
						break;
					case 3:
						printf("%d\n",dice1.surf[0]);
						break;
					case 5:
						printf("%d\n",dice1.surf[3]);
						break;
					default:
						break;
				}
				break;
			case 5:
				switch(dice1.front_add){
					case 1:
						printf("%d\n",dice1.surf[3]);
						break;
					case 2:
						printf("%d\n",dice1.surf[1]);
						break;
					case 3:
						printf("%d\n",dice1.surf[4]);
						break;
					case 4:
						printf("%d\n",dice1.surf[2]);
						break;
					default:
						break;
				}
				break;
			default:
				break;
		}
	}

	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r12
	pushq	%rbx
	subq	$48, %rsp
	.cfi_offset 12, -24
	.cfi_offset 3, -32
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
	movq	$0, -48(%rbp)
	movq	$0, -40(%rbp)
	movl	$0, -32(%rbp)
	movl	$0, %r12d
	jmp	.L2
.L3:
	movswl	%r12w, %eax
	leaq	-48(%rbp), %rdx
	cltq
	addq	%rax, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	%r12d, %eax
	addl	$1, %eax
	movl	%eax, %r12d
.L2:
	cmpw	$5, %r12w
	jle	.L3
	leaq	-50(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, %r12d
	jmp	.L4
.L58:
	leaq	-48(%rbp), %rax
	addq	$12, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, %ebx
	jmp	.L5
.L8:
	movzwl	-36(%rbp), %edx
	movswl	%bx, %eax
	cltq
	movzwl	-48(%rbp,%rax,2), %eax
	cmpw	%ax, %dx
	jne	.L6
	movw	%bx, -34(%rbp)
	jmp	.L7
.L6:
	movl	%ebx, %eax
	addl	$1, %eax
	movl	%eax, %ebx
.L5:
	cmpw	$5, %bx
	jle	.L8
.L7:
	leaq	-48(%rbp), %rax
	addq	$16, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, %ebx
	jmp	.L9
.L12:
	movzwl	-32(%rbp), %edx
	movswl	%bx, %eax
	cltq
	movzwl	-48(%rbp,%rax,2), %eax
	cmpw	%ax, %dx
	jne	.L10
	movw	%bx, -30(%rbp)
	jmp	.L11
.L10:
	movl	%ebx, %eax
	addl	$1, %eax
	movl	%eax, %ebx
.L9:
	cmpw	$5, %bx
	jle	.L12
.L11:
	movzwl	-34(%rbp), %eax
	cwtl
	cmpl	$5, %eax
	ja	.L61
	movl	%eax, %eax
	leaq	0(,%rax,4), %rdx
	leaq	.L15(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	leaq	.L15(%rip), %rdx
	addq	%rdx, %rax
	notrack jmp	*%rax
	.section	.rodata
	.align 4
	.align 4
.L15:
	.long	.L20-.L15
	.long	.L19-.L15
	.long	.L18-.L15
	.long	.L17-.L15
	.long	.L16-.L15
	.long	.L14-.L15
	.text
.L20:
	movzwl	-30(%rbp), %eax
	cwtl
	cmpl	$4, %eax
	je	.L21
	cmpl	$4, %eax
	jg	.L62
	cmpl	$3, %eax
	je	.L23
	cmpl	$3, %eax
	jg	.L62
	cmpl	$1, %eax
	je	.L24
	cmpl	$2, %eax
	je	.L25
	jmp	.L62
.L24:
	movzwl	-44(%rbp), %eax
	cwtl
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L26
.L25:
	movzwl	-40(%rbp), %eax
	cwtl
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L26
.L23:
	movzwl	-46(%rbp), %eax
	cwtl
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L26
.L21:
	movzwl	-42(%rbp), %eax
	cwtl
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L26
.L62:
	nop
.L26:
	jmp	.L27
.L19:
	movzwl	-30(%rbp), %eax
	cwtl
	cmpl	$5, %eax
	je	.L28
	cmpl	$5, %eax
	jg	.L63
	cmpl	$3, %eax
	je	.L30
	cmpl	$3, %eax
	jg	.L63
	testl	%eax, %eax
	je	.L31
	cmpl	$2, %eax
	je	.L32
	jmp	.L63
.L31:
	movzwl	-42(%rbp), %eax
	cwtl
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L33
.L32:
	movzwl	-48(%rbp), %eax
	cwtl
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L33
.L30:
	movzwl	-38(%rbp), %eax
	cwtl
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L33
.L28:
	movzwl	-44(%rbp), %eax
	cwtl
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L33
.L63:
	nop
.L33:
	jmp	.L27
.L18:
	movzwl	-30(%rbp), %eax
	cwtl
	cmpl	$5, %eax
	je	.L34
	cmpl	$5, %eax
	jg	.L64
	cmpl	$4, %eax
	je	.L36
	cmpl	$4, %eax
	jg	.L64
	testl	%eax, %eax
	je	.L37
	cmpl	$1, %eax
	je	.L38
	jmp	.L64
.L37:
	movzwl	-46(%rbp), %eax
	cwtl
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L39
.L38:
	movzwl	-38(%rbp), %eax
	cwtl
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L39
.L36:
	movzwl	-48(%rbp), %eax
	cwtl
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L39
.L34:
	movzwl	-40(%rbp), %eax
	cwtl
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L39
.L64:
	nop
.L39:
	jmp	.L27
.L17:
	movzwl	-30(%rbp), %eax
	cwtl
	cmpl	$5, %eax
	je	.L40
	cmpl	$5, %eax
	jg	.L65
	cmpl	$4, %eax
	je	.L42
	cmpl	$4, %eax
	jg	.L65
	testl	%eax, %eax
	je	.L43
	cmpl	$1, %eax
	je	.L44
	jmp	.L65
.L43:
	movzwl	-40(%rbp), %eax
	cwtl
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L45
.L44:
	movzwl	-48(%rbp), %eax
	cwtl
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L45
.L42:
	movzwl	-38(%rbp), %eax
	cwtl
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L45
.L40:
	movzwl	-46(%rbp), %eax
	cwtl
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L45
.L65:
	nop
.L45:
	jmp	.L27
.L16:
	movzwl	-30(%rbp), %eax
	cwtl
	cmpl	$5, %eax
	je	.L46
	cmpl	$5, %eax
	jg	.L66
	cmpl	$3, %eax
	je	.L48
	cmpl	$3, %eax
	jg	.L66
	testl	%eax, %eax
	je	.L49
	cmpl	$2, %eax
	je	.L50
	jmp	.L66
.L49:
	movzwl	-44(%rbp), %eax
	cwtl
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L51
.L50:
	movzwl	-38(%rbp), %eax
	cwtl
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L51
.L48:
	movzwl	-48(%rbp), %eax
	cwtl
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L51
.L46:
	movzwl	-42(%rbp), %eax
	cwtl
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L51
.L66:
	nop
.L51:
	jmp	.L27
.L14:
	movzwl	-30(%rbp), %eax
	cwtl
	cmpl	$4, %eax
	je	.L52
	cmpl	$4, %eax
	jg	.L67
	cmpl	$3, %eax
	je	.L54
	cmpl	$3, %eax
	jg	.L67
	cmpl	$1, %eax
	je	.L55
	cmpl	$2, %eax
	je	.L56
	jmp	.L67
.L55:
	movzwl	-42(%rbp), %eax
	cwtl
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L57
.L56:
	movzwl	-46(%rbp), %eax
	cwtl
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L57
.L54:
	movzwl	-40(%rbp), %eax
	cwtl
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L57
.L52:
	movzwl	-44(%rbp), %eax
	cwtl
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L57
.L67:
	nop
.L57:
	jmp	.L27
.L61:
	nop
.L27:
	movl	%r12d, %eax
	addl	$1, %eax
	movl	%eax, %r12d
.L4:
	movzwl	-50(%rbp), %eax
	cmpw	%ax, %r12w
	jl	.L58
	movl	$0, %eax
	movq	-24(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L60
	call	__stack_chk_fail@PLT
.L60:
	addq	$48, %rsp
	popq	%rbx
	popq	%r12
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
train
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r12
	pushq	%rbx
	subq	$48, %rsp
	.cfi_offset 12, -24
	.cfi_offset 3, -32
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
	movq	$0, -48(%rbp)
	movq	$0, -40(%rbp)
	movl	$0, -32(%rbp)
	movl	$0, %r12d
	jmp	.L2
.L3:
	movswl	%r12w, %eax
	leaq	-48(%rbp), %rdx
	cltq
	addq	%rax, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	%r12d, %eax
	addl	$1, %eax
	movl	%eax, %r12d
.L2:
	cmpw	$5, %r12w
	jle	.L3
	leaq	-50(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, %r12d
	jmp	.L4
.L58:
	leaq	-48(%rbp), %rax
	addq	$12, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, %ebx
	jmp	.L5
.L8:
	movzwl	-36(%rbp), %edx
	movswl	%bx, %eax
	cltq
	movzwl	-48(%rbp,%rax,2), %eax
	cmpw	%ax, %dx
	jne	.L6
	movw	%bx, -34(%rbp)
	jmp	.L7
.L6:
	movl	%ebx, %eax
	addl	$1, %eax
	movl	%eax, %ebx
.L5:
	cmpw	$5, %bx
	jle	.L8
.L7:
	leaq	-48(%rbp), %rax
	addq	$16, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, %ebx
	jmp	.L9
.L12:
	movzwl	-32(%rbp), %edx
	movswl	%bx, %eax
	cltq
	movzwl	-48(%rbp,%rax,2), %eax
	cmpw	%ax, %dx
	jne	.L10
	movw	%bx, -30(%rbp)
	jmp	.L11
.L10:
	movl	%ebx, %eax
	addl	$1, %eax
	movl	%eax, %ebx
.L9:
	cmpw	$5, %bx
	jle	.L12
.L11:
	movzwl	-34(%rbp), %eax
	cwtl
	cmpl	$5, %eax
	ja	.L61
	movl	%eax, %eax
	leaq	0(,%rax,4), %rdx
	leaq	.L15(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	leaq	.L15(%rip), %rdx
	addq	%rdx, %rax
	notrack jmp	*%rax
	.section	.rodata
	.align 4
	.align 4
.L15:
	.long	.L20-.L15
	.long	.L19-.L15
	.long	.L18-.L15
	.long	.L17-.L15
	.long	.L16-.L15
	.long	.L14-.L15
	.text
.L20:
	movzwl	-30(%rbp), %eax
	cwtl
	cmpl	$4, %eax
	je	.L21
	cmpl	$4, %eax
	jg	.L62
	cmpl	$3, %eax
	je	.L23
	cmpl	$3, %eax
	jg	.L62
	cmpl	$1, %eax
	je	.L24
	cmpl	$2, %eax
	je	.L25
	jmp	.L62
.L24:
	movzwl	-44(%rbp), %eax
	cwtl
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L26
.L25:
	movzwl	-40(%rbp), %eax
	cwtl
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L26
.L23:
	movzwl	-46(%rbp), %eax
	cwtl
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L26
.L21:
	movzwl	-42(%rbp), %eax
	cwtl
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L26
.L62:
	nop
.L26:
	jmp	.L27
.L19:
	movzwl	-30(%rbp), %eax
	cwtl
	cmpl	$5, %eax
	je	.L28
	cmpl	$5, %eax
	jg	.L63
	cmpl	$3, %eax
	je	.L30
	cmpl	$3, %eax
	jg	.L63
	testl	%eax, %eax
	je	.L31
	cmpl	$2, %eax
	je	.L32
	jmp	.L63
.L31:
	movzwl	-42(%rbp), %eax
	cwtl
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L33
.L32:
	movzwl	-48(%rbp), %eax
	cwtl
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L33
.L30:
	movzwl	-38(%rbp), %eax
	cwtl
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L33
.L28:
	movzwl	-44(%rbp), %eax
	cwtl
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L33
.L63:
	nop
.L33:
	jmp	.L27
.L18:
	movzwl	-30(%rbp), %eax
	cwtl
	cmpl	$5, %eax
	je	.L34
	cmpl	$5, %eax
	jg	.L64
	cmpl	$4, %eax
	je	.L36
	cmpl	$4, %eax
	jg	.L64
	testl	%eax, %eax
	je	.L37
	cmpl	$1, %eax
	je	.L38
	jmp	.L64
.L37:
	movzwl	-46(%rbp), %eax
	cwtl
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L39
.L38:
	movzwl	-38(%rbp), %eax
	cwtl
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L39
.L36:
	movzwl	-48(%rbp), %eax
	cwtl
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L39
.L34:
	movzwl	-40(%rbp), %eax
	cwtl
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L39
.L64:
	nop
.L39:
	jmp	.L27
.L17:
	movzwl	-30(%rbp), %eax
	cwtl
	cmpl	$5, %eax
	je	.L40
	cmpl	$5, %eax
	jg	.L65
	cmpl	$4, %eax
	je	.L42
	cmpl	$4, %eax
	jg	.L65
	testl	%eax, %eax
	je	.L43
	cmpl	$1, %eax
	je	.L44
	jmp	.L65
.L43:
	movzwl	-40(%rbp), %eax
	cwtl
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L45
.L44:
	movzwl	-48(%rbp), %eax
	cwtl
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L45
.L42:
	movzwl	-38(%rbp), %eax
	cwtl
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L45
.L40:
	movzwl	-46(%rbp), %eax
	cwtl
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L45
.L65:
	nop
.L45:
	jmp	.L27
.L16:
	movzwl	-30(%rbp), %eax
	cwtl
	cmpl	$5, %eax
	je	.L46
	cmpl	$5, %eax
	jg	.L66
	cmpl	$3, %eax
	je	.L48
	cmpl	$3, %eax
	jg	.L66
	testl	%eax, %eax
	je	.L49
	cmpl	$2, %eax
	je	.L50
	jmp	.L66
.L49:
	movzwl	-44(%rbp), %eax
	cwtl
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L51
.L50:
	movzwl	-38(%rbp), %eax
	cwtl
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L51
.L48:
	movzwl	-48(%rbp), %eax
	cwtl
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L51
.L46:
	movzwl	-42(%rbp), %eax
	cwtl
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L51
.L66:
	nop
.L51:
	jmp	.L27
.L14:
	movzwl	-30(%rbp), %eax
	cwtl
	cmpl	$4, %eax
	je	.L52
	cmpl	$4, %eax
	jg	.L67
	cmpl	$3, %eax
	je	.L54
	cmpl	$3, %eax
	jg	.L67
	cmpl	$1, %eax
	je	.L55
	cmpl	$2, %eax
	je	.L56
	jmp	.L67
.L55:
	movzwl	-42(%rbp), %eax
	cwtl
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L57
.L56:
	movzwl	-46(%rbp), %eax
	cwtl
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L57
.L54:
	movzwl	-40(%rbp), %eax
	cwtl
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L57
.L52:
	movzwl	-44(%rbp), %eax
	cwtl
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L57
.L67:
	nop
.L57:
	jmp	.L27
.L61:
	nop
.L27:
	movl	%r12d, %eax
	addl	$1, %eax
	movl	%eax, %r12d
.L4:
	movzwl	-50(%rbp), %eax
	cmpw	%ax, %r12w
	jl	.L58
	movl	$0, %eax
	movq	-24(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L60
	call	__stack_chk_fail@PLT
.L60:
	addq	$48, %rsp
	popq	%rbx
	popq	%r12
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
