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
{
	int n, e, w, s, t, b;
} dice;

void dice_scan(dice *x)
{
	scanf("%d %d %d %d %d %d", &x->t, &x->s, &x->e, &x->w, &x->n, &x->b);
}

void dice_rorate_n(dice *x)
{
	int temp;
	temp = x->n;
	x->n = x->t;
	x->t = x->s;
	x->s = x->b;
	x->b = temp;
}

void dice_rorate_e(dice *x)
{
	int temp;
	temp = x->e;
	x->e = x->t;
	x->t = x->w;
	x->w = x->b;
	x->b = temp;
}

void dice_rorate_r(dice *x)
{
	int temp;
	temp = x->n;
	x->n = x->w;
	x->w = x->s;
	x->s = x->e;
	x->e = temp;
}

void dice_normalize(dice *x, int t, int s)
{
	for(int i = 0; i < 3; ++i)
	{
		if(t == x->t) { break; }
		dice_rorate_e(x);
	}
	for(int i = 0; i < 3; ++i)
	{
		if(t == x->t) { break; }
		dice_rorate_n(x);
	}
	for(int i = 0; i < 3; ++i)
	{
		if(s == x->s) { break; }
		dice_rorate_r(x);
	}
}

int main()
{
	dice d;
	int q, t, s;

	dice_scan(&d);
	scanf("%d", &q);

	for(int i = 0; i < q; ++i)
	{
		scanf("%d %d", &t, &s);
		dice_normalize(&d, t, s);
		printf("%d\n", d.e);
	}

	return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d %d %d %d %d %d"
	.text
	.globl	dice_scan
	.type	dice_scan, @function
dice_scan:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movq	%rdi, -8(%rbp)
	movq	-8(%rbp), %rax
	leaq	20(%rax), %rsi
	movq	-8(%rbp), %rdi
	movq	-8(%rbp), %rax
	leaq	8(%rax), %r8
	movq	-8(%rbp), %rax
	leaq	4(%rax), %rcx
	movq	-8(%rbp), %rax
	leaq	12(%rax), %rdx
	movq	-8(%rbp), %rax
	addq	$16, %rax
	subq	$8, %rsp
	pushq	%rsi
	movq	%rdi, %r9
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addq	$16, %rsp
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	dice_scan, .-dice_scan
	.globl	dice_rorate_n
	.type	dice_rorate_n, @function
dice_rorate_n:
.LFB1:
	.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	-24(%rbp), %rax
	movl	(%rax), %eax
	movl	%eax, -4(%rbp)
	movq	-24(%rbp), %rax
	movl	16(%rax), %edx
	movq	-24(%rbp), %rax
	movl	%edx, (%rax)
	movq	-24(%rbp), %rax
	movl	12(%rax), %edx
	movq	-24(%rbp), %rax
	movl	%edx, 16(%rax)
	movq	-24(%rbp), %rax
	movl	20(%rax), %edx
	movq	-24(%rbp), %rax
	movl	%edx, 12(%rax)
	movq	-24(%rbp), %rax
	movl	-4(%rbp), %edx
	movl	%edx, 20(%rax)
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	dice_rorate_n, .-dice_rorate_n
	.globl	dice_rorate_e
	.type	dice_rorate_e, @function
dice_rorate_e:
.LFB2:
	.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	-24(%rbp), %rax
	movl	4(%rax), %eax
	movl	%eax, -4(%rbp)
	movq	-24(%rbp), %rax
	movl	16(%rax), %edx
	movq	-24(%rbp), %rax
	movl	%edx, 4(%rax)
	movq	-24(%rbp), %rax
	movl	8(%rax), %edx
	movq	-24(%rbp), %rax
	movl	%edx, 16(%rax)
	movq	-24(%rbp), %rax
	movl	20(%rax), %edx
	movq	-24(%rbp), %rax
	movl	%edx, 8(%rax)
	movq	-24(%rbp), %rax
	movl	-4(%rbp), %edx
	movl	%edx, 20(%rax)
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	dice_rorate_e, .-dice_rorate_e
	.globl	dice_rorate_r
	.type	dice_rorate_r, @function
dice_rorate_r:
.LFB3:
	.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	-24(%rbp), %rax
	movl	(%rax), %eax
	movl	%eax, -4(%rbp)
	movq	-24(%rbp), %rax
	movl	8(%rax), %edx
	movq	-24(%rbp), %rax
	movl	%edx, (%rax)
	movq	-24(%rbp), %rax
	movl	12(%rax), %edx
	movq	-24(%rbp), %rax
	movl	%edx, 8(%rax)
	movq	-24(%rbp), %rax
	movl	4(%rax), %edx
	movq	-24(%rbp), %rax
	movl	%edx, 12(%rax)
	movq	-24(%rbp), %rax
	movl	-4(%rbp), %edx
	movl	%edx, 4(%rax)
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.size	dice_rorate_r, .-dice_rorate_r
	.globl	dice_normalize
	.type	dice_normalize, @function
dice_normalize:
.LFB4:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movq	%rdi, -24(%rbp)
	movl	%esi, -28(%rbp)
	movl	%edx, -32(%rbp)
	movl	$0, -12(%rbp)
	jmp	.L6
.L9:
	movq	-24(%rbp), %rax
	movl	16(%rax), %eax
	cmpl	%eax, -28(%rbp)
	je	.L18
	movq	-24(%rbp), %rax
	movq	%rax, %rdi
	call	dice_rorate_e
	addl	$1, -12(%rbp)
.L6:
	cmpl	$2, -12(%rbp)
	jle	.L9
	jmp	.L8
.L18:
	nop
.L8:
	movl	$0, -8(%rbp)
	jmp	.L10
.L13:
	movq	-24(%rbp), %rax
	movl	16(%rax), %eax
	cmpl	%eax, -28(%rbp)
	je	.L19
	movq	-24(%rbp), %rax
	movq	%rax, %rdi
	call	dice_rorate_n
	addl	$1, -8(%rbp)
.L10:
	cmpl	$2, -8(%rbp)
	jle	.L13
	jmp	.L12
.L19:
	nop
.L12:
	movl	$0, -4(%rbp)
	jmp	.L14
.L17:
	movq	-24(%rbp), %rax
	movl	12(%rax), %eax
	cmpl	%eax, -32(%rbp)
	je	.L20
	movq	-24(%rbp), %rax
	movq	%rax, %rdi
	call	dice_rorate_r
	addl	$1, -4(%rbp)
.L14:
	cmpl	$2, -4(%rbp)
	jle	.L17
	jmp	.L21
.L20:
	nop
.L21:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE4:
	.size	dice_normalize, .-dice_normalize
	.section	.rodata
.LC1:
	.string	"%d"
.LC2:
	.string	"%d %d"
.LC3:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB5:
	.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
	leaq	-32(%rbp), %rax
	movq	%rax, %rdi
	call	dice_scan
	leaq	-48(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -36(%rbp)
	jmp	.L23
.L24:
	leaq	-40(%rbp), %rdx
	leaq	-44(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-40(%rbp), %edx
	movl	-44(%rbp), %ecx
	leaq	-32(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	dice_normalize
	movl	-28(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -36(%rbp)
.L23:
	movl	-48(%rbp), %eax
	cmpl	%eax, -36(%rbp)
	jl	.L24
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L26
	call	__stack_chk_fail@PLT
.L26:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE5:
	.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 %d %d %d %d %d"
	.text
	.p2align 4
	.globl	dice_scan
	.type	dice_scan, @function
dice_scan:
.LFB23:
	.cfi_startproc
	endbr64
	subq	$16, %rsp
	.cfi_def_cfa_offset 24
	leaq	20(%rdi), %rax
	leaq	4(%rdi), %rcx
	movq	%rdi, %r9
	pushq	%rax
	.cfi_def_cfa_offset 32
	leaq	12(%rdi), %rdx
	leaq	16(%rdi), %rsi
	xorl	%eax, %eax
	leaq	8(%rdi), %r8
	leaq	.LC0(%rip), %rdi
	call	__isoc99_scanf@PLT
	addq	$24, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE23:
	.size	dice_scan, .-dice_scan
	.p2align 4
	.globl	dice_rorate_n
	.type	dice_rorate_n, @function
dice_rorate_n:
.LFB24:
	.cfi_startproc
	endbr64
	movq	16(%rdi), %xmm0
	movq	8(%rdi), %xmm1
	movl	(%rdi), %eax
	movl	16(%rdi), %edx
	punpckldq	%xmm1, %xmm0
	pshufd	$14, %xmm0, %xmm0
	movl	%edx, (%rdi)
	movl	%eax, 20(%rdi)
	movq	%xmm0, 12(%rdi)
	ret
	.cfi_endproc
.LFE24:
	.size	dice_rorate_n, .-dice_rorate_n
	.p2align 4
	.globl	dice_rorate_e
	.type	dice_rorate_e, @function
dice_rorate_e:
.LFB25:
	.cfi_startproc
	endbr64
	movq	4(%rdi), %xmm0
	movq	16(%rdi), %rax
	pshufd	$225, %xmm0, %xmm0
	movq	%rax, 4(%rdi)
	movq	%xmm0, 16(%rdi)
	ret
	.cfi_endproc
.LFE25:
	.size	dice_rorate_e, .-dice_rorate_e
	.p2align 4
	.globl	dice_rorate_r
	.type	dice_rorate_r, @function
dice_rorate_r:
.LFB26:
	.cfi_startproc
	endbr64
	movdqu	(%rdi), %xmm1
	pshufd	$114, %xmm1, %xmm0
	movups	%xmm0, (%rdi)
	ret
	.cfi_endproc
.LFE26:
	.size	dice_rorate_r, .-dice_rorate_r
	.p2align 4
	.globl	dice_normalize
	.type	dice_normalize, @function
dice_normalize:
.LFB27:
	.cfi_startproc
	endbr64
	movq	%rdi, %rax
	movl	16(%rdi), %edi
	movl	%esi, %ecx
	movl	%edx, %esi
	cmpl	%edi, %ecx
	je	.L8
	movq	4(%rax), %xmm0
	movl	20(%rax), %r8d
	movd	%edi, %xmm6
	movq	16(%rax), %r10
	movl	8(%rax), %r9d
	pshufd	$225, %xmm0, %xmm1
	movd	%r8d, %xmm2
	movl	4(%rax), %edx
	punpckldq	%xmm6, %xmm2
	movq	%r10, 4(%rax)
	movq	%xmm1, 16(%rax)
	cmpl	%r9d, %ecx
	je	.L8
	movq	%xmm1, 4(%rax)
	movq	%xmm2, 16(%rax)
	cmpl	%r8d, %ecx
	je	.L8
	movl	%r8d, 4(%rax)
	movl	12(%rax), %r8d
	movl	%edi, 8(%rax)
	movq	%xmm0, 16(%rax)
	cmpl	%edx, %ecx
	je	.L21
	movl	(%rax), %r9d
	movl	20(%rax), %edi
	movd	%edx, %xmm2
	movl	%edx, (%rax)
	movd	%r9d, %xmm7
	movd	%edi, %xmm0
	movd	%edi, %xmm6
	movl	%r9d, 20(%rax)
	punpckldq	%xmm7, %xmm2
	movd	%r8d, %xmm7
	movd	%r9d, %xmm1
	punpckldq	%xmm7, %xmm0
	punpckldq	%xmm6, %xmm1
	movq	%xmm0, 12(%rax)
	cmpl	%r8d, %ecx
	je	.L16
	movl	%r8d, (%rax)
	movl	%edx, 20(%rax)
	movq	%xmm1, 12(%rax)
	cmpl	%edi, %ecx
	je	.L22
	movl	%edi, (%rax)
	movl	%r8d, 20(%rax)
	movq	%xmm2, 12(%rax)
.L15:
	cmpl	%esi, %edx
	je	.L7
	movd	4(%rax), %xmm1
	movd	(%rax), %xmm2
	movd	%edx, %xmm6
	movd	%edx, %xmm3
	movd	8(%rax), %xmm0
	movdqa	%xmm2, %xmm5
	movdqa	%xmm1, %xmm4
	movd	%xmm1, %ecx
	punpckldq	%xmm0, %xmm5
	punpckldq	%xmm6, %xmm4
	punpckldq	%xmm0, %xmm3
	punpcklqdq	%xmm5, %xmm4
	movdqa	%xmm1, %xmm5
	punpckldq	%xmm2, %xmm0
	punpckldq	%xmm2, %xmm5
	punpcklqdq	%xmm5, %xmm3
	movd	%edx, %xmm5
	punpckldq	%xmm1, %xmm5
	punpcklqdq	%xmm5, %xmm0
	movups	%xmm0, (%rax)
	cmpl	%ecx, %esi
	je	.L7
	movd	%xmm2, %ecx
	movups	%xmm3, (%rax)
	cmpl	%esi, %ecx
	je	.L23
	movups	%xmm4, (%rax)
	ret
	.p2align 4,,10
	.p2align 3
.L7:
	ret
	.p2align 4,,10
	.p2align 3
.L8:
	movl	12(%rax), %edx
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L16:
	movl	%edi, %edx
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L23:
	ret
	.p2align 4,,10
	.p2align 3
.L22:
	movl	%r9d, %edx
	jmp	.L15
.L21:
	movl	%r8d, %edx
	jmp	.L15
	.cfi_endproc
.LFE27:
	.size	dice_normalize, .-dice_normalize
	.section	.rodata.str1.1
.LC1:
	.string	"%d"
.LC2:
	.string	"%d %d"
.LC3:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB28:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	leaq	.LC0(%rip), %rdi
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	subq	$48, %rsp
	.cfi_def_cfa_offset 96
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leaq	20(%rsp), %rcx
	leaq	28(%rsp), %rdx
	leaq	32(%rsp), %rsi
	subq	$8, %rsp
	.cfi_def_cfa_offset 104
	leaq	44(%rsp), %rax
	pushq	%rax
	.cfi_def_cfa_offset 112
	xorl	%eax, %eax
	leaq	32(%rsp), %r9
	leaq	40(%rsp), %r8
	call	__isoc99_scanf@PLT
	leaq	20(%rsp), %rsi
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	popq	%rax
	.cfi_def_cfa_offset 104
	popq	%rdx
	.cfi_def_cfa_offset 96
	movl	4(%rsp), %ecx
	testl	%ecx, %ecx
	jle	.L29
	xorl	%ebx, %ebx
	leaq	12(%rsp), %r14
	leaq	8(%rsp), %r13
	leaq	.LC2(%rip), %r12
	leaq	.LC3(%rip), %rbp
	.p2align 4,,10
	.p2align 3
.L25:
	movq	%r13, %rsi
	movq	%r12, %rdi
	movq	%r14, %rdx
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	8(%rsp), %ecx
	movl	32(%rsp), %esi
	movl	12(%rsp), %r8d
	movl	28(%rsp), %edi
	cmpl	%esi, %ecx
	je	.L26
	movl	20(%rsp), %edx
	movl	24(%rsp), %eax
	movd	%esi, %xmm1
	movd	%esi, %xmm7
	movd	36(%rsp), %xmm0
	movl	28(%rsp), %edi
	movl	%eax, 32(%rsp)
	movdqa	%xmm0, %xmm2
	punpckldq	%xmm0, %xmm1
	movl	%edx, 36(%rsp)
	punpckldq	%xmm7, %xmm2
	movq	%xmm1, 20(%rsp)
	cmpl	%eax, %ecx
	je	.L26
	movd	%xmm0, %r10d
	movl	%eax, 20(%rsp)
	movl	%edx, 24(%rsp)
	movq	%xmm2, 32(%rsp)
	cmpl	%r10d, %ecx
	je	.L26
	movl	%edx, 32(%rsp)
	movl	%esi, 24(%rsp)
	movl	%eax, 36(%rsp)
	movd	%xmm0, 20(%rsp)
	cmpl	%edx, %ecx
	je	.L32
	movl	16(%rsp), %esi
	movd	%edx, %xmm1
	movl	%edx, 16(%rsp)
	movl	%edi, 32(%rsp)
	movd	%esi, %xmm7
	movl	%eax, 28(%rsp)
	movl	%esi, 36(%rsp)
	punpckldq	%xmm7, %xmm1
	cmpl	%edi, %ecx
	je	.L33
	movl	%eax, 16(%rsp)
	movl	%edi, 36(%rsp)
	movq	%xmm1, 28(%rsp)
.L27:
	cmpl	%edx, %r8d
	je	.L34
.L43:
	movd	16(%rsp), %xmm1
	movdqa	%xmm0, %xmm5
	movd	%edx, %xmm7
	movdqa	%xmm0, %xmm6
	movd	24(%rsp), %xmm2
	punpckldq	%xmm7, %xmm5
	movd	%xmm0, %eax
	movdqa	%xmm1, %xmm4
	punpckldq	%xmm1, %xmm6
	punpckldq	%xmm2, %xmm4
	movdqa	%xmm2, %xmm3
	punpcklqdq	%xmm4, %xmm5
	movd	%edx, %xmm4
	punpckldq	%xmm1, %xmm3
	punpckldq	%xmm2, %xmm4
	punpcklqdq	%xmm6, %xmm4
	movd	%edx, %xmm6
	punpckldq	%xmm0, %xmm6
	punpcklqdq	%xmm6, %xmm3
	movaps	%xmm3, 16(%rsp)
	cmpl	%eax, %r8d
	je	.L35
	movd	%xmm1, %eax
	movaps	%xmm4, 16(%rsp)
	cmpl	%eax, %r8d
	je	.L36
	movaps	%xmm5, 16(%rsp)
.L28:
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__printf_chk@PLT
	cmpl	%ebx, 4(%rsp)
	jg	.L25
.L29:
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L42
	addq	$48, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L26:
	.cfi_restore_state
	movl	%edi, %edx
	movd	20(%rsp), %xmm0
	cmpl	%edx, %r8d
	jne	.L43
.L34:
	movd	%xmm0, %edx
	jmp	.L28
.L33:
	movl	%eax, %edx
	jmp	.L27
.L35:
	movd	%xmm1, %edx
	jmp	.L28
.L36:
	movd	%xmm2, %edx
	jmp	.L28
.L32:
	movl	%edi, %edx
	jmp	.L27
.L42:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE28:
	.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 %d %d %d %d %d"
	.text
	.p2align 4
	.globl	dice_scan
	.type	dice_scan, @function
dice_scan:
.LFB23:
	.cfi_startproc
	endbr64
	subq	$16, %rsp
	.cfi_def_cfa_offset 24
	leaq	20(%rdi), %rax
	leaq	4(%rdi), %rcx
	movq	%rdi, %r9
	pushq	%rax
	.cfi_def_cfa_offset 32
	leaq	12(%rdi), %rdx
	leaq	16(%rdi), %rsi
	xorl	%eax, %eax
	leaq	8(%rdi), %r8
	leaq	.LC0(%rip), %rdi
	call	__isoc99_scanf@PLT
	addq	$24, %rsp
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE23:
	.size	dice_scan, .-dice_scan
	.p2align 4
	.globl	dice_rorate_n
	.type	dice_rorate_n, @function
dice_rorate_n:
.LFB24:
	.cfi_startproc
	endbr64
	movq	16(%rdi), %xmm0
	movq	8(%rdi), %xmm1
	movl	(%rdi), %eax
	movl	16(%rdi), %edx
	punpckldq	%xmm1, %xmm0
	pshufd	$14, %xmm0, %xmm0
	movl	%edx, (%rdi)
	movl	%eax, 20(%rdi)
	movq	%xmm0, 12(%rdi)
	ret
	.cfi_endproc
.LFE24:
	.size	dice_rorate_n, .-dice_rorate_n
	.p2align 4
	.globl	dice_rorate_e
	.type	dice_rorate_e, @function
dice_rorate_e:
.LFB25:
	.cfi_startproc
	endbr64
	movq	4(%rdi), %xmm0
	movq	16(%rdi), %rax
	pshufd	$225, %xmm0, %xmm0
	movq	%rax, 4(%rdi)
	movq	%xmm0, 16(%rdi)
	ret
	.cfi_endproc
.LFE25:
	.size	dice_rorate_e, .-dice_rorate_e
	.p2align 4
	.globl	dice_rorate_r
	.type	dice_rorate_r, @function
dice_rorate_r:
.LFB26:
	.cfi_startproc
	endbr64
	movdqu	(%rdi), %xmm1
	pshufd	$114, %xmm1, %xmm0
	movups	%xmm0, (%rdi)
	ret
	.cfi_endproc
.LFE26:
	.size	dice_rorate_r, .-dice_rorate_r
	.p2align 4
	.globl	dice_normalize
	.type	dice_normalize, @function
dice_normalize:
.LFB27:
	.cfi_startproc
	endbr64
	movq	%rdi, %rax
	movl	16(%rdi), %edi
	movl	%esi, %ecx
	movl	%edx, %esi
	cmpl	%edi, %ecx
	je	.L8
	movq	4(%rax), %xmm0
	movl	20(%rax), %r8d
	movd	%edi, %xmm6
	movq	16(%rax), %r10
	movl	8(%rax), %r9d
	pshufd	$225, %xmm0, %xmm1
	movd	%r8d, %xmm2
	movl	4(%rax), %edx
	punpckldq	%xmm6, %xmm2
	movq	%r10, 4(%rax)
	movq	%xmm1, 16(%rax)
	cmpl	%r9d, %ecx
	je	.L8
	movq	%xmm1, 4(%rax)
	movq	%xmm2, 16(%rax)
	cmpl	%r8d, %ecx
	je	.L8
	movl	%r8d, 4(%rax)
	movl	12(%rax), %r8d
	movl	%edi, 8(%rax)
	movq	%xmm0, 16(%rax)
	cmpl	%edx, %ecx
	je	.L21
	movl	(%rax), %r9d
	movl	20(%rax), %edi
	movd	%edx, %xmm2
	movl	%edx, (%rax)
	movd	%r9d, %xmm7
	movd	%edi, %xmm0
	movd	%edi, %xmm6
	movl	%r9d, 20(%rax)
	punpckldq	%xmm7, %xmm2
	movd	%r8d, %xmm7
	movd	%r9d, %xmm1
	punpckldq	%xmm7, %xmm0
	punpckldq	%xmm6, %xmm1
	movq	%xmm0, 12(%rax)
	cmpl	%r8d, %ecx
	je	.L16
	movl	%r8d, (%rax)
	movl	%edx, 20(%rax)
	movq	%xmm1, 12(%rax)
	cmpl	%edi, %ecx
	je	.L22
	movl	%edi, (%rax)
	movl	%r8d, 20(%rax)
	movq	%xmm2, 12(%rax)
.L15:
	cmpl	%esi, %edx
	je	.L7
	movd	4(%rax), %xmm1
	movd	(%rax), %xmm2
	movd	%edx, %xmm6
	movd	%edx, %xmm3
	movd	8(%rax), %xmm0
	movdqa	%xmm2, %xmm5
	movdqa	%xmm1, %xmm4
	movd	%xmm1, %ecx
	punpckldq	%xmm0, %xmm5
	punpckldq	%xmm6, %xmm4
	punpckldq	%xmm0, %xmm3
	punpcklqdq	%xmm5, %xmm4
	movdqa	%xmm1, %xmm5
	punpckldq	%xmm2, %xmm0
	punpckldq	%xmm2, %xmm5
	punpcklqdq	%xmm5, %xmm3
	movd	%edx, %xmm5
	punpckldq	%xmm1, %xmm5
	punpcklqdq	%xmm5, %xmm0
	movups	%xmm0, (%rax)
	cmpl	%ecx, %esi
	je	.L7
	movd	%xmm2, %ecx
	movups	%xmm3, (%rax)
	cmpl	%esi, %ecx
	je	.L23
	movups	%xmm4, (%rax)
	ret
	.p2align 4,,10
	.p2align 3
.L7:
	ret
	.p2align 4,,10
	.p2align 3
.L8:
	movl	12(%rax), %edx
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L16:
	movl	%edi, %edx
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L23:
	ret
	.p2align 4,,10
	.p2align 3
.L22:
	movl	%r9d, %edx
	jmp	.L15
.L21:
	movl	%r8d, %edx
	jmp	.L15
	.cfi_endproc
.LFE27:
	.size	dice_normalize, .-dice_normalize
	.section	.rodata.str1.1
.LC1:
	.string	"%d"
.LC2:
	.string	"%d %d"
.LC3:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB28:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	leaq	.LC0(%rip), %rdi
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	subq	$48, %rsp
	.cfi_def_cfa_offset 96
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leaq	20(%rsp), %rcx
	leaq	28(%rsp), %rdx
	leaq	32(%rsp), %rsi
	subq	$8, %rsp
	.cfi_def_cfa_offset 104
	leaq	44(%rsp), %rax
	pushq	%rax
	.cfi_def_cfa_offset 112
	xorl	%eax, %eax
	leaq	32(%rsp), %r9
	leaq	40(%rsp), %r8
	call	__isoc99_scanf@PLT
	leaq	20(%rsp), %rsi
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	popq	%rax
	.cfi_def_cfa_offset 104
	popq	%rdx
	.cfi_def_cfa_offset 96
	movl	4(%rsp), %ecx
	testl	%ecx, %ecx
	jle	.L29
	xorl	%ebx, %ebx
	leaq	12(%rsp), %r14
	leaq	8(%rsp), %r13
	leaq	.LC2(%rip), %r12
	leaq	.LC3(%rip), %rbp
	.p2align 4,,10
	.p2align 3
.L25:
	movq	%r13, %rsi
	movq	%r12, %rdi
	movq	%r14, %rdx
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	8(%rsp), %ecx
	movl	32(%rsp), %esi
	movl	12(%rsp), %r8d
	movl	28(%rsp), %edi
	cmpl	%esi, %ecx
	je	.L26
	movl	20(%rsp), %edx
	movl	24(%rsp), %eax
	movd	%esi, %xmm1
	movd	%esi, %xmm7
	movd	36(%rsp), %xmm0
	movl	28(%rsp), %edi
	movl	%eax, 32(%rsp)
	movdqa	%xmm0, %xmm2
	punpckldq	%xmm0, %xmm1
	movl	%edx, 36(%rsp)
	punpckldq	%xmm7, %xmm2
	movq	%xmm1, 20(%rsp)
	cmpl	%eax, %ecx
	je	.L26
	movd	%xmm0, %r10d
	movl	%eax, 20(%rsp)
	movl	%edx, 24(%rsp)
	movq	%xmm2, 32(%rsp)
	cmpl	%r10d, %ecx
	je	.L26
	movl	%edx, 32(%rsp)
	movl	%esi, 24(%rsp)
	movl	%eax, 36(%rsp)
	movd	%xmm0, 20(%rsp)
	cmpl	%edx, %ecx
	je	.L32
	movl	16(%rsp), %esi
	movd	%edx, %xmm1
	movl	%edx, 16(%rsp)
	movl	%edi, 32(%rsp)
	movd	%esi, %xmm7
	movl	%eax, 28(%rsp)
	movl	%esi, 36(%rsp)
	punpckldq	%xmm7, %xmm1
	cmpl	%edi, %ecx
	je	.L33
	movl	%eax, 16(%rsp)
	movl	%edi, 36(%rsp)
	movq	%xmm1, 28(%rsp)
.L27:
	cmpl	%edx, %r8d
	je	.L34
.L43:
	movd	16(%rsp), %xmm1
	movdqa	%xmm0, %xmm5
	movd	%edx, %xmm7
	movdqa	%xmm0, %xmm6
	movd	24(%rsp), %xmm2
	punpckldq	%xmm7, %xmm5
	movd	%xmm0, %eax
	movdqa	%xmm1, %xmm4
	punpckldq	%xmm1, %xmm6
	punpckldq	%xmm2, %xmm4
	movdqa	%xmm2, %xmm3
	punpcklqdq	%xmm4, %xmm5
	movd	%edx, %xmm4
	punpckldq	%xmm1, %xmm3
	punpckldq	%xmm2, %xmm4
	punpcklqdq	%xmm6, %xmm4
	movd	%edx, %xmm6
	punpckldq	%xmm0, %xmm6
	punpcklqdq	%xmm6, %xmm3
	movaps	%xmm3, 16(%rsp)
	cmpl	%eax, %r8d
	je	.L35
	movd	%xmm1, %eax
	movaps	%xmm4, 16(%rsp)
	cmpl	%eax, %r8d
	je	.L36
	movaps	%xmm5, 16(%rsp)
.L28:
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__printf_chk@PLT
	cmpl	%ebx, 4(%rsp)
	jg	.L25
.L29:
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L42
	addq	$48, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L26:
	.cfi_restore_state
	movl	%edi, %edx
	movd	20(%rsp), %xmm0
	cmpl	%edx, %r8d
	jne	.L43
.L34:
	movd	%xmm0, %edx
	jmp	.L28
.L33:
	movl	%eax, %edx
	jmp	.L27
.L35:
	movd	%xmm1, %edx
	jmp	.L28
.L36:
	movd	%xmm2, %edx
	jmp	.L28
.L32:
	movl	%edi, %edx
	jmp	.L27
.L42:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE28:
	.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
{
	int n, e, w, s, t, b;
} dice;

void dice_scan(dice *x)
{
	scanf("%d %d %d %d %d %d", &x->t, &x->s, &x->e, &x->w, &x->n, &x->b);
}

void dice_rorate_n(dice *x)
{
	int temp;
	temp = x->n;
	x->n = x->t;
	x->t = x->s;
	x->s = x->b;
	x->b = temp;
}

void dice_rorate_e(dice *x)
{
	int temp;
	temp = x->e;
	x->e = x->t;
	x->t = x->w;
	x->w = x->b;
	x->b = temp;
}

void dice_rorate_r(dice *x)
{
	int temp;
	temp = x->n;
	x->n = x->w;
	x->w = x->s;
	x->s = x->e;
	x->e = temp;
}

void dice_normalize(dice *x, int t, int s)
{
	for(int i = 0; i < 3; ++i)
	{
		if(t == x->t) { break; }
		dice_rorate_e(x);
	}
	for(int i = 0; i < 3; ++i)
	{
		if(t == x->t) { break; }
		dice_rorate_n(x);
	}
	for(int i = 0; i < 3; ++i)
	{
		if(s == x->s) { break; }
		dice_rorate_r(x);
	}
}

int main()
{
	dice d;
	int q, t, s;

	dice_scan(&d);
	scanf("%d", &q);

	for(int i = 0; i < q; ++i)
	{
		scanf("%d %d", &t, &s);
		dice_normalize(&d, t, s);
		printf("%d\n", d.e);
	}

	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
1
4
 3
1
4
 2
5
6
 1
5
6
 6
1
1
 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
{
	int n, e, w, s, t, b;
} dice;

void dice_scan(dice *x)
{
	scanf("%d %d %d %d %d %d", &x->t, &x->s, &x->e, &x->w, &x->n, &x->b);
}

void dice_rorate_n(dice *x)
{
	int temp;
	temp = x->n;
	x->n = x->t;
	x->t = x->s;
	x->s = x->b;
	x->b = temp;
}

void dice_rorate_e(dice *x)
{
	int temp;
	temp = x->e;
	x->e = x->t;
	x->t = x->w;
	x->w = x->b;
	x->b = temp;
}

void dice_rorate_r(dice *x)
{
	int temp;
	temp = x->n;
	x->n = x->w;
	x->w = x->s;
	x->s = x->e;
	x->e = temp;
}

void dice_normalize(dice *x, int t, int s)
{
	for(int i = 0; i < 3; ++i)
	{
		if(t == x->t) { break; }
		dice_rorate_e(x);
	}
	for(int i = 0; i < 3; ++i)
	{
		if(t == x->t) { break; }
		dice_rorate_n(x);
	}
	for(int i = 0; i < 3; ++i)
	{
		if(s == x->s) { break; }
		dice_rorate_r(x);
	}
}

int main()
{
	dice d;
	int q, t, s;

	dice_scan(&d);
	scanf("%d", &q);

	for(int i = 0; i < q; ++i)
	{
		scanf("%d %d", &t, &s);
		dice_normalize(&d, t, s);
		printf("%d\n", d.e);
	}

	return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d %d %d %d %d %d"
	.text
	.globl	dice_scan
	.type	dice_scan, @function
dice_scan:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movq	%rdi, -8(%rbp)
	movq	-8(%rbp), %rax
	leaq	20(%rax), %rsi
	movq	-8(%rbp), %rdi
	movq	-8(%rbp), %rax
	leaq	8(%rax), %r8
	movq	-8(%rbp), %rax
	leaq	4(%rax), %rcx
	movq	-8(%rbp), %rax
	leaq	12(%rax), %rdx
	movq	-8(%rbp), %rax
	addq	$16, %rax
	subq	$8, %rsp
	pushq	%rsi
	movq	%rdi, %r9
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addq	$16, %rsp
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	dice_scan, .-dice_scan
	.globl	dice_rorate_n
	.type	dice_rorate_n, @function
dice_rorate_n:
.LFB1:
	.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	-24(%rbp), %rax
	movl	(%rax), %eax
	movl	%eax, -4(%rbp)
	movq	-24(%rbp), %rax
	movl	16(%rax), %edx
	movq	-24(%rbp), %rax
	movl	%edx, (%rax)
	movq	-24(%rbp), %rax
	movl	12(%rax), %edx
	movq	-24(%rbp), %rax
	movl	%edx, 16(%rax)
	movq	-24(%rbp), %rax
	movl	20(%rax), %edx
	movq	-24(%rbp), %rax
	movl	%edx, 12(%rax)
	movq	-24(%rbp), %rax
	movl	-4(%rbp), %edx
	movl	%edx, 20(%rax)
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	dice_rorate_n, .-dice_rorate_n
	.globl	dice_rorate_e
	.type	dice_rorate_e, @function
dice_rorate_e:
.LFB2:
	.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	-24(%rbp), %rax
	movl	4(%rax), %eax
	movl	%eax, -4(%rbp)
	movq	-24(%rbp), %rax
	movl	16(%rax), %edx
	movq	-24(%rbp), %rax
	movl	%edx, 4(%rax)
	movq	-24(%rbp), %rax
	movl	8(%rax), %edx
	movq	-24(%rbp), %rax
	movl	%edx, 16(%rax)
	movq	-24(%rbp), %rax
	movl	20(%rax), %edx
	movq	-24(%rbp), %rax
	movl	%edx, 8(%rax)
	movq	-24(%rbp), %rax
	movl	-4(%rbp), %edx
	movl	%edx, 20(%rax)
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	dice_rorate_e, .-dice_rorate_e
	.globl	dice_rorate_r
	.type	dice_rorate_r, @function
dice_rorate_r:
.LFB3:
	.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	-24(%rbp), %rax
	movl	(%rax), %eax
	movl	%eax, -4(%rbp)
	movq	-24(%rbp), %rax
	movl	8(%rax), %edx
	movq	-24(%rbp), %rax
	movl	%edx, (%rax)
	movq	-24(%rbp), %rax
	movl	12(%rax), %edx
	movq	-24(%rbp), %rax
	movl	%edx, 8(%rax)
	movq	-24(%rbp), %rax
	movl	4(%rax), %edx
	movq	-24(%rbp), %rax
	movl	%edx, 12(%rax)
	movq	-24(%rbp), %rax
	movl	-4(%rbp), %edx
	movl	%edx, 4(%rax)
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.size	dice_rorate_r, .-dice_rorate_r
	.globl	dice_normalize
	.type	dice_normalize, @function
dice_normalize:
.LFB4:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movq	%rdi, -24(%rbp)
	movl	%esi, -28(%rbp)
	movl	%edx, -32(%rbp)
	movl	$0, -12(%rbp)
	jmp	.L6
.L9:
	movq	-24(%rbp), %rax
	movl	16(%rax), %eax
	cmpl	%eax, -28(%rbp)
	je	.L18
	movq	-24(%rbp), %rax
	movq	%rax, %rdi
	call	dice_rorate_e
	addl	$1, -12(%rbp)
.L6:
	cmpl	$2, -12(%rbp)
	jle	.L9
	jmp	.L8
.L18:
	nop
.L8:
	movl	$0, -8(%rbp)
	jmp	.L10
.L13:
	movq	-24(%rbp), %rax
	movl	16(%rax), %eax
	cmpl	%eax, -28(%rbp)
	je	.L19
	movq	-24(%rbp), %rax
	movq	%rax, %rdi
	call	dice_rorate_n
	addl	$1, -8(%rbp)
.L10:
	cmpl	$2, -8(%rbp)
	jle	.L13
	jmp	.L12
.L19:
	nop
.L12:
	movl	$0, -4(%rbp)
	jmp	.L14
.L17:
	movq	-24(%rbp), %rax
	movl	12(%rax), %eax
	cmpl	%eax, -32(%rbp)
	je	.L20
	movq	-24(%rbp), %rax
	movq	%rax, %rdi
	call	dice_rorate_r
	addl	$1, -4(%rbp)
.L14:
	cmpl	$2, -4(%rbp)
	jle	.L17
	jmp	.L21
.L20:
	nop
.L21:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE4:
	.size	dice_normalize, .-dice_normalize
	.section	.rodata
.LC1:
	.string	"%d"
.LC2:
	.string	"%d %d"
.LC3:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB5:
	.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
	leaq	-32(%rbp), %rax
	movq	%rax, %rdi
	call	dice_scan
	leaq	-48(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -36(%rbp)
	jmp	.L23
.L24:
	leaq	-40(%rbp), %rdx
	leaq	-44(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-40(%rbp), %edx
	movl	-44(%rbp), %ecx
	leaq	-32(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	dice_normalize
	movl	-28(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -36(%rbp)
.L23:
	movl	-48(%rbp), %eax
	cmpl	%eax, -36(%rbp)
	jl	.L24
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L26
	call	__stack_chk_fail@PLT
.L26:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE5:
	.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 %d %d %d %d %d"
	.text
	.globl	dice_scan
	.type	dice_scan, @function
dice_scan:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movq	%rdi, -8(%rbp)
	movq	-8(%rbp), %rax
	leaq	20(%rax), %rsi
	movq	-8(%rbp), %rdi
	movq	-8(%rbp), %rax
	leaq	8(%rax), %r8
	movq	-8(%rbp), %rax
	leaq	4(%rax), %rcx
	movq	-8(%rbp), %rax
	leaq	12(%rax), %rdx
	movq	-8(%rbp), %rax
	addq	$16, %rax
	subq	$8, %rsp
	pushq	%rsi
	movq	%rdi, %r9
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addq	$16, %rsp
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	dice_scan, .-dice_scan
	.globl	dice_rorate_n
	.type	dice_rorate_n, @function
dice_rorate_n:
.LFB1:
	.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	-24(%rbp), %rax
	movl	(%rax), %eax
	movl	%eax, -4(%rbp)
	movq	-24(%rbp), %rax
	movl	16(%rax), %edx
	movq	-24(%rbp), %rax
	movl	%edx, (%rax)
	movq	-24(%rbp), %rax
	movl	12(%rax), %edx
	movq	-24(%rbp), %rax
	movl	%edx, 16(%rax)
	movq	-24(%rbp), %rax
	movl	20(%rax), %edx
	movq	-24(%rbp), %rax
	movl	%edx, 12(%rax)
	movq	-24(%rbp), %rax
	movl	-4(%rbp), %edx
	movl	%edx, 20(%rax)
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	dice_rorate_n, .-dice_rorate_n
	.globl	dice_rorate_e
	.type	dice_rorate_e, @function
dice_rorate_e:
.LFB2:
	.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	-24(%rbp), %rax
	movl	4(%rax), %eax
	movl	%eax, -4(%rbp)
	movq	-24(%rbp), %rax
	movl	16(%rax), %edx
	movq	-24(%rbp), %rax
	movl	%edx, 4(%rax)
	movq	-24(%rbp), %rax
	movl	8(%rax), %edx
	movq	-24(%rbp), %rax
	movl	%edx, 16(%rax)
	movq	-24(%rbp), %rax
	movl	20(%rax), %edx
	movq	-24(%rbp), %rax
	movl	%edx, 8(%rax)
	movq	-24(%rbp), %rax
	movl	-4(%rbp), %edx
	movl	%edx, 20(%rax)
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	dice_rorate_e, .-dice_rorate_e
	.globl	dice_rorate_r
	.type	dice_rorate_r, @function
dice_rorate_r:
.LFB3:
	.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	-24(%rbp), %rax
	movl	(%rax), %eax
	movl	%eax, -4(%rbp)
	movq	-24(%rbp), %rax
	movl	8(%rax), %edx
	movq	-24(%rbp), %rax
	movl	%edx, (%rax)
	movq	-24(%rbp), %rax
	movl	12(%rax), %edx
	movq	-24(%rbp), %rax
	movl	%edx, 8(%rax)
	movq	-24(%rbp), %rax
	movl	4(%rax), %edx
	movq	-24(%rbp), %rax
	movl	%edx, 12(%rax)
	movq	-24(%rbp), %rax
	movl	-4(%rbp), %edx
	movl	%edx, 4(%rax)
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.size	dice_rorate_r, .-dice_rorate_r
	.globl	dice_normalize
	.type	dice_normalize, @function
dice_normalize:
.LFB4:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movq	%rdi, -24(%rbp)
	movl	%esi, -28(%rbp)
	movl	%edx, -32(%rbp)
	movl	$0, -12(%rbp)
	jmp	.L6
.L9:
	movq	-24(%rbp), %rax
	movl	16(%rax), %eax
	cmpl	%eax, -28(%rbp)
	je	.L18
	movq	-24(%rbp), %rax
	movq	%rax, %rdi
	call	dice_rorate_e
	addl	$1, -12(%rbp)
.L6:
	cmpl	$2, -12(%rbp)
	jle	.L9
	jmp	.L8
.L18:
	nop
.L8:
	movl	$0, -8(%rbp)
	jmp	.L10
.L13:
	movq	-24(%rbp), %rax
	movl	16(%rax), %eax
	cmpl	%eax, -28(%rbp)
	je	.L19
	movq	-24(%rbp), %rax
	movq	%rax, %rdi
	call	dice_rorate_n
	addl	$1, -8(%rbp)
.L10:
	cmpl	$2, -8(%rbp)
	jle	.L13
	jmp	.L12
.L19:
	nop
.L12:
	movl	$0, -4(%rbp)
	jmp	.L14
.L17:
	movq	-24(%rbp), %rax
	movl	12(%rax), %eax
	cmpl	%eax, -32(%rbp)
	je	.L20
	movq	-24(%rbp), %rax
	movq	%rax, %rdi
	call	dice_rorate_r
	addl	$1, -4(%rbp)
.L14:
	cmpl	$2, -4(%rbp)
	jle	.L17
	jmp	.L21
.L20:
	nop
.L21:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE4:
	.size	dice_normalize, .-dice_normalize
	.section	.rodata
.LC1:
	.string	"%d"
.LC2:
	.string	"%d %d"
.LC3:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB5:
	.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
	leaq	-32(%rbp), %rax
	movq	%rax, %rdi
	call	dice_scan
	leaq	-48(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -36(%rbp)
	jmp	.L23
.L24:
	leaq	-40(%rbp), %rdx
	leaq	-44(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-40(%rbp), %edx
	movl	-44(%rbp), %ecx
	leaq	-32(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	dice_normalize
	movl	-28(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -36(%rbp)
.L23:
	movl	-48(%rbp), %eax
	cmpl	%eax, -36(%rbp)
	jl	.L24
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L26
	call	__stack_chk_fail@PLT
.L26:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE5:
	.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:
