Given the following C code and unoptimized assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c

#include <stdio.h>

int rot[5][7] = {
{0,1,2,3,4,5,6},{0,2,6,3,4,1,5},{0,4,2,1,6,5,3},{0,3,2,6,1,5,4},{0,5,1,3,4,6,2}};
int assign[7];		// サイコロの1～6の各面に割り当てる数字
int tr['Z'];

void dice_init(int *a)
{
	int i;
	int t[5] = {0,'N','E','W','S'};
	for (i = 1; i <= 6; i++) assign[i] = a[i];
	for (i = 1; i <= 4; i++) tr[t[i]] = i;
}

char s[102];
int main()
{
	int i, k1, k2;
	int a[7], dice[2][7];
	char *p;

	for (i = 1; i <= 6; i++) scanf("%d", a+i);
	dice_init(a);
	scanf("%s", p=s);
	for (i = 1; i <= 6; i++) dice[0][i] = rot[0][i];
	for (k1 = 0, k2 = 1; *p; k1 = k2, k2 = !k2) {
		for (i = 1; i <= 6; i++) dice[k2][i] = dice[k1][rot[tr[*p]][i]];
		p++;
	}
	printf("%d\n", assign[dice[k1][1]]);
	return 0;
}

```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	rot
	.data
	.align 32
	.type	rot, @object
	.size	rot, 140
rot:
	.long	0
	.long	1
	.long	2
	.long	3
	.long	4
	.long	5
	.long	6
	.long	0
	.long	2
	.long	6
	.long	3
	.long	4
	.long	1
	.long	5
	.long	0
	.long	4
	.long	2
	.long	1
	.long	6
	.long	5
	.long	3
	.long	0
	.long	3
	.long	2
	.long	6
	.long	1
	.long	5
	.long	4
	.long	0
	.long	5
	.long	1
	.long	3
	.long	4
	.long	6
	.long	2
	.globl	assign
	.bss
	.align 16
	.type	assign, @object
	.size	assign, 28
assign:
	.zero	28
	.globl	tr
	.align 32
	.type	tr, @object
	.size	tr, 360
tr:
	.zero	360
	.text
	.globl	dice_init
	.type	dice_init, @function
dice_init:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$64, %rsp
	movq	%rdi, -56(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -32(%rbp)
	movl	$78, -28(%rbp)
	movl	$69, -24(%rbp)
	movl	$87, -20(%rbp)
	movl	$83, -16(%rbp)
	movl	$1, -36(%rbp)
	jmp	.L2
.L3:
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-56(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	-36(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	assign(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	addl	$1, -36(%rbp)
.L2:
	cmpl	$6, -36(%rbp)
	jle	.L3
	movl	$1, -36(%rbp)
	jmp	.L4
.L5:
	movl	-36(%rbp), %eax
	cltq
	movl	-32(%rbp,%rax,4), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	tr(%rip), %rdx
	movl	-36(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	addl	$1, -36(%rbp)
.L4:
	cmpl	$4, -36(%rbp)
	jle	.L5
	nop
	movq	-8(%rbp), %rax
	subq	%fs:40, %rax
	je	.L6
	call	__stack_chk_fail@PLT
.L6:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	dice_init, .-dice_init
	.globl	s
	.bss
	.align 32
	.type	s, @object
	.size	s, 102
s:
	.zero	102
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%s"
.LC2:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	addq	$-128, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$1, -116(%rbp)
	jmp	.L8
.L9:
	movl	-116(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	-96(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -116(%rbp)
.L8:
	cmpl	$6, -116(%rbp)
	jle	.L9
	leaq	-96(%rbp), %rax
	movq	%rax, %rdi
	call	dice_init
	leaq	s(%rip), %rax
	movq	%rax, -104(%rbp)
	movq	-104(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, -116(%rbp)
	jmp	.L10
.L11:
	movl	-116(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	rot(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-116(%rbp), %eax
	cltq
	movl	%edx, -64(%rbp,%rax,4)
	addl	$1, -116(%rbp)
.L10:
	cmpl	$6, -116(%rbp)
	jle	.L11
	movl	$0, -112(%rbp)
	movl	$1, -108(%rbp)
	jmp	.L12
.L15:
	movl	$1, -116(%rbp)
	jmp	.L13
.L14:
	movq	-104(%rbp), %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	tr(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-116(%rbp), %edx
	movslq	%edx, %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$3, %rax
	subq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	rot(%rip), %rax
	movl	(%rdx,%rax), %eax
	movslq	%eax, %rcx
	movl	-112(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$3, %rax
	subq	%rdx, %rax
	addq	%rcx, %rax
	movl	-64(%rbp,%rax,4), %edx
	movl	-116(%rbp), %eax
	movslq	%eax, %rsi
	movl	-108(%rbp), %eax
	movslq	%eax, %rcx
	movq	%rcx, %rax
	salq	$3, %rax
	subq	%rcx, %rax
	addq	%rsi, %rax
	movl	%edx, -64(%rbp,%rax,4)
	addl	$1, -116(%rbp)
.L13:
	cmpl	$6, -116(%rbp)
	jle	.L14
	addq	$1, -104(%rbp)
	movl	-108(%rbp), %eax
	movl	%eax, -112(%rbp)
	cmpl	$0, -108(%rbp)
	sete	%al
	movzbl	%al, %eax
	movl	%eax, -108(%rbp)
.L12:
	movq	-104(%rbp), %rax
	movzbl	(%rax), %eax
	testb	%al, %al
	jne	.L15
	movl	-112(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$3, %rax
	subq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$60, %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	assign(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L17
	call	__stack_chk_fail@PLT
.L17:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.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	dice_init
	.type	dice_init, @function
dice_init:
.LFB23:
	.cfi_startproc
	endbr64
	leaq	-4+assign(%rip), %rax
	subq	%rdi, %rax
	cmpq	$8, %rax
	jbe	.L2
	movq	20(%rdi), %rax
	movdqu	4(%rdi), %xmm0
	movq	%rax, 20+assign(%rip)
	movups	%xmm0, 4+assign(%rip)
.L3:
	movl	$1, 312+tr(%rip)
	movl	$2, 276+tr(%rip)
	movl	$3, 348+tr(%rip)
	movl	$4, 332+tr(%rip)
	ret
	.p2align 4,,10
	.p2align 3
.L2:
	movl	4(%rdi), %eax
	movl	%eax, 4+assign(%rip)
	movl	8(%rdi), %eax
	movl	%eax, 8+assign(%rip)
	movl	12(%rdi), %eax
	movl	%eax, 12+assign(%rip)
	movl	16(%rdi), %eax
	movl	%eax, 16+assign(%rip)
	movl	20(%rdi), %eax
	movl	%eax, 20+assign(%rip)
	movl	24(%rdi), %eax
	movl	%eax, 24+assign(%rip)
	jmp	.L3
	.cfi_endproc
.LFE23:
	.size	dice_init, .-dice_init
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%s"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB24:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	leaq	.LC0(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	subq	$96, %rsp
	.cfi_def_cfa_offset 128
	movq	%fs:40, %rax
	movq	%rax, 88(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rbx
	leaq	28(%rsp), %r12
	.p2align 4,,10
	.p2align 3
.L6:
	movq	%rbx, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	addq	$4, %rbx
	call	__isoc99_scanf@PLT
	cmpq	%rbx, %r12
	jne	.L6
	movq	%rsp, %rdi
	leaq	s(%rip), %rbx
	call	dice_init
	movq	%rbx, %rsi
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	20+rot(%rip), %rax
	movdqu	4+rot(%rip), %xmm0
	movq	%rax, 52(%rsp)
	movsbq	s(%rip), %rax
	movups	%xmm0, 36(%rsp)
	testb	%al, %al
	je	.L10
	movq	%rbx, %r8
	movl	$1, %esi
	xorl	%edx, %edx
	leaq	tr(%rip), %r10
	leaq	rot(%rip), %r9
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L11:
	movl	%ecx, %esi
.L8:
	movslq	(%r10,%rax,4), %rcx
	movslq	%esi, %r11
	addq	$1, %r8
	leaq	0(,%rcx,8), %rax
	subq	%rcx, %rax
	leaq	(%r9,%rax,4), %rcx
	movslq	%edx, %rax
	movslq	4(%rcx), %rdi
	leaq	0(,%rax,8), %rdx
	subq	%rax, %rdx
	leaq	(%rdx,%rdi), %rax
	movl	32(%rsp,%rax,4), %edi
	leaq	0(,%r11,8), %rax
	subq	%r11, %rax
	salq	$2, %rax
	movl	%edi, 36(%rsp,%rax)
	movslq	8(%rcx), %rdi
	addq	%rdx, %rdi
	movl	32(%rsp,%rdi,4), %edi
	movl	%edi, 40(%rsp,%rax)
	movslq	12(%rcx), %rdi
	addq	%rdx, %rdi
	movl	32(%rsp,%rdi,4), %edi
	movl	%edi, 44(%rsp,%rax)
	movslq	16(%rcx), %rdi
	addq	%rdx, %rdi
	movl	32(%rsp,%rdi,4), %edi
	movl	%edi, 48(%rsp,%rax)
	movslq	20(%rcx), %rdi
	movslq	24(%rcx), %rcx
	addq	%rdx, %rdi
	movl	32(%rsp,%rdi,4), %edi
	addq	%rcx, %rdx
	movl	%esi, %ecx
	xorl	$1, %ecx
	movl	%edi, 52(%rsp,%rax)
	movl	32(%rsp,%rdx,4), %edx
	movl	%edx, 56(%rsp,%rax)
	movsbq	(%r8), %rax
	movl	%esi, %edx
	testb	%al, %al
	jne	.L11
.L7:
	leaq	0(,%r11,8), %rax
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	subq	%r11, %rax
	movslq	36(%rsp,%rax,4), %rdx
	leaq	assign(%rip), %rax
	movl	(%rax,%rdx,4), %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	88(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L14
	addq	$96, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L10:
	.cfi_restore_state
	xorl	%r11d, %r11d
	jmp	.L7
.L14:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE24:
	.size	main, .-main
	.globl	s
	.bss
	.align 32
	.type	s, @object
	.size	s, 102
s:
	.zero	102
	.globl	tr
	.align 32
	.type	tr, @object
	.size	tr, 360
tr:
	.zero	360
	.globl	assign
	.align 16
	.type	assign, @object
	.size	assign, 28
assign:
	.zero	28
	.globl	rot
	.data
	.align 32
	.type	rot, @object
	.size	rot, 140
rot:
	.long	0
	.long	1
	.long	2
	.long	3
	.long	4
	.long	5
	.long	6
	.long	0
	.long	2
	.long	6
	.long	3
	.long	4
	.long	1
	.long	5
	.long	0
	.long	4
	.long	2
	.long	1
	.long	6
	.long	5
	.long	3
	.long	0
	.long	3
	.long	2
	.long	6
	.long	1
	.long	5
	.long	4
	.long	0
	.long	5
	.long	1
	.long	3
	.long	4
	.long	6
	.long	2
	.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	dice_init
	.type	dice_init, @function
dice_init:
.LFB23:
	.cfi_startproc
	endbr64
	leaq	-4+assign(%rip), %rax
	subq	%rdi, %rax
	cmpq	$8, %rax
	jbe	.L2
	movq	20(%rdi), %rax
	movdqu	4(%rdi), %xmm0
	movq	%rax, 20+assign(%rip)
	movups	%xmm0, 4+assign(%rip)
.L3:
	movl	$1, 312+tr(%rip)
	movl	$2, 276+tr(%rip)
	movl	$3, 348+tr(%rip)
	movl	$4, 332+tr(%rip)
	ret
	.p2align 4,,10
	.p2align 3
.L2:
	movl	4(%rdi), %eax
	movl	%eax, 4+assign(%rip)
	movl	8(%rdi), %eax
	movl	%eax, 8+assign(%rip)
	movl	12(%rdi), %eax
	movl	%eax, 12+assign(%rip)
	movl	16(%rdi), %eax
	movl	%eax, 16+assign(%rip)
	movl	20(%rdi), %eax
	movl	%eax, 20+assign(%rip)
	movl	24(%rdi), %eax
	movl	%eax, 24+assign(%rip)
	jmp	.L3
	.cfi_endproc
.LFE23:
	.size	dice_init, .-dice_init
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%s"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB24:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	leaq	.LC0(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	subq	$96, %rsp
	.cfi_def_cfa_offset 128
	movq	%fs:40, %rax
	movq	%rax, 88(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rbx
	leaq	28(%rsp), %r12
	.p2align 4,,10
	.p2align 3
.L6:
	movq	%rbx, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	addq	$4, %rbx
	call	__isoc99_scanf@PLT
	cmpq	%rbx, %r12
	jne	.L6
	movq	%rsp, %rdi
	leaq	s(%rip), %rbx
	call	dice_init
	movq	%rbx, %rsi
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	20+rot(%rip), %rax
	movdqu	4+rot(%rip), %xmm0
	movq	%rax, 52(%rsp)
	movsbq	s(%rip), %rax
	movups	%xmm0, 36(%rsp)
	testb	%al, %al
	je	.L10
	movq	%rbx, %r8
	movl	$1, %esi
	xorl	%edx, %edx
	leaq	tr(%rip), %r10
	leaq	rot(%rip), %r9
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L11:
	movl	%ecx, %esi
.L8:
	movslq	(%r10,%rax,4), %rcx
	movslq	%esi, %r11
	addq	$1, %r8
	leaq	0(,%rcx,8), %rax
	subq	%rcx, %rax
	leaq	(%r9,%rax,4), %rcx
	movslq	%edx, %rax
	movslq	4(%rcx), %rdi
	leaq	0(,%rax,8), %rdx
	subq	%rax, %rdx
	leaq	(%rdx,%rdi), %rax
	movl	32(%rsp,%rax,4), %edi
	leaq	0(,%r11,8), %rax
	subq	%r11, %rax
	salq	$2, %rax
	movl	%edi, 36(%rsp,%rax)
	movslq	8(%rcx), %rdi
	addq	%rdx, %rdi
	movl	32(%rsp,%rdi,4), %edi
	movl	%edi, 40(%rsp,%rax)
	movslq	12(%rcx), %rdi
	addq	%rdx, %rdi
	movl	32(%rsp,%rdi,4), %edi
	movl	%edi, 44(%rsp,%rax)
	movslq	16(%rcx), %rdi
	addq	%rdx, %rdi
	movl	32(%rsp,%rdi,4), %edi
	movl	%edi, 48(%rsp,%rax)
	movslq	20(%rcx), %rdi
	movslq	24(%rcx), %rcx
	addq	%rdx, %rdi
	movl	32(%rsp,%rdi,4), %edi
	addq	%rcx, %rdx
	movl	%esi, %ecx
	xorl	$1, %ecx
	movl	%edi, 52(%rsp,%rax)
	movl	32(%rsp,%rdx,4), %edx
	movl	%edx, 56(%rsp,%rax)
	movsbq	(%r8), %rax
	movl	%esi, %edx
	testb	%al, %al
	jne	.L11
.L7:
	leaq	0(,%r11,8), %rax
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	subq	%r11, %rax
	movslq	36(%rsp,%rax,4), %rdx
	leaq	assign(%rip), %rax
	movl	(%rax,%rdx,4), %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	88(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L14
	addq	$96, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L10:
	.cfi_restore_state
	xorl	%r11d, %r11d
	jmp	.L7
.L14:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE24:
	.size	main, .-main
	.globl	s
	.bss
	.align 32
	.type	s, @object
	.size	s, 102
s:
	.zero	102
	.globl	tr
	.align 32
	.type	tr, @object
	.size	tr, 360
tr:
	.zero	360
	.globl	assign
	.align 16
	.type	assign, @object
	.size	assign, 28
assign:
	.zero	28
	.globl	rot
	.data
	.align 32
	.type	rot, @object
	.size	rot, 140
rot:
	.long	0
	.long	1
	.long	2
	.long	3
	.long	4
	.long	5
	.long	6
	.long	0
	.long	2
	.long	6
	.long	3
	.long	4
	.long	1
	.long	5
	.long	0
	.long	4
	.long	2
	.long	1
	.long	6
	.long	5
	.long	3
	.long	0
	.long	3
	.long	2
	.long	6
	.long	1
	.long	5
	.long	4
	.long	0
	.long	5
	.long	1
	.long	3
	.long	4
	.long	6
	.long	2
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:


#include <stdio.h>

int rot[5][7] = {
{0,1,2,3,4,5,6},{0,2,6,3,4,1,5},{0,4,2,1,6,5,3},{0,3,2,6,1,5,4},{0,5,1,3,4,6,2}};
int assign[7];		// サイコロの1～6の各面に割り当てる数字
int tr['Z'];

void dice_init(int *a)
{
	int i;
	int t[5] = {0,'N','E','W','S'};
	for (i = 1; i <= 6; i++) assign[i] = a[i];
	for (i = 1; i <= 4; i++) tr[t[i]] = i;
}

char s[102];
int main()
{
	int i, k1, k2;
	int a[7], dice[2][7];
	char *p;

	for (i = 1; i <= 6; i++) scanf("%d", a+i);
	dice_init(a);
	scanf("%s", p=s);
	for (i = 1; i <= 6; i++) dice[0][i] = rot[0][i];
	for (k1 = 0, k2 = 1; *p; k1 = k2, k2 = !k2) {
		for (i = 1; i <= 6; i++) dice[k2][i] = dice[k1][rot[tr[*p]][i]];
		p++;
	}
	printf("%d\n", assign[dice[k1][1]]);
	return 0;
}


0 2 4 8 16 32
EESWN
 1 2 4 6 16 32
SE
 0 2 4 8 16 30
EESWN
 1 2 4 0 16 32
SE
 1 2 4 -1 16 32
SE
 0 2 0 8 16 23
EESWN
 1 2 4 8 16 32
ES
 1 2 4 8 27 32
ES
 0 4 4 8 16 5
EESWN
 1 4 4 -1 24 32
ES

32
 6
 30
 0
 -1
 23
 16
 27
 5
 24

Given the following C code and unoptimized assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c

#include <stdio.h>

int rot[5][7] = {
{0,1,2,3,4,5,6},{0,2,6,3,4,1,5},{0,4,2,1,6,5,3},{0,3,2,6,1,5,4},{0,5,1,3,4,6,2}};
int assign[7];		// サイコロの1～6の各面に割り当てる数字
int tr['Z'];

void dice_init(int *a)
{
	int i;
	int t[5] = {0,'N','E','W','S'};
	for (i = 1; i <= 6; i++) assign[i] = a[i];
	for (i = 1; i <= 4; i++) tr[t[i]] = i;
}

char s[102];
int main()
{
	int i, k1, k2;
	int a[7], dice[2][7];
	char *p;

	for (i = 1; i <= 6; i++) scanf("%d", a+i);
	dice_init(a);
	scanf("%s", p=s);
	for (i = 1; i <= 6; i++) dice[0][i] = rot[0][i];
	for (k1 = 0, k2 = 1; *p; k1 = k2, k2 = !k2) {
		for (i = 1; i <= 6; i++) dice[k2][i] = dice[k1][rot[tr[*p]][i]];
		p++;
	}
	printf("%d\n", assign[dice[k1][1]]);
	return 0;
}

```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	rot
	.data
	.align 32
	.type	rot, @object
	.size	rot, 140
rot:
	.long	0
	.long	1
	.long	2
	.long	3
	.long	4
	.long	5
	.long	6
	.long	0
	.long	2
	.long	6
	.long	3
	.long	4
	.long	1
	.long	5
	.long	0
	.long	4
	.long	2
	.long	1
	.long	6
	.long	5
	.long	3
	.long	0
	.long	3
	.long	2
	.long	6
	.long	1
	.long	5
	.long	4
	.long	0
	.long	5
	.long	1
	.long	3
	.long	4
	.long	6
	.long	2
	.globl	assign
	.bss
	.align 16
	.type	assign, @object
	.size	assign, 28
assign:
	.zero	28
	.globl	tr
	.align 32
	.type	tr, @object
	.size	tr, 360
tr:
	.zero	360
	.text
	.globl	dice_init
	.type	dice_init, @function
dice_init:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$64, %rsp
	movq	%rdi, -56(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -32(%rbp)
	movl	$78, -28(%rbp)
	movl	$69, -24(%rbp)
	movl	$87, -20(%rbp)
	movl	$83, -16(%rbp)
	movl	$1, -36(%rbp)
	jmp	.L2
.L3:
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-56(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	-36(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	assign(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	addl	$1, -36(%rbp)
.L2:
	cmpl	$6, -36(%rbp)
	jle	.L3
	movl	$1, -36(%rbp)
	jmp	.L4
.L5:
	movl	-36(%rbp), %eax
	cltq
	movl	-32(%rbp,%rax,4), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	tr(%rip), %rdx
	movl	-36(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	addl	$1, -36(%rbp)
.L4:
	cmpl	$4, -36(%rbp)
	jle	.L5
	nop
	movq	-8(%rbp), %rax
	subq	%fs:40, %rax
	je	.L6
	call	__stack_chk_fail@PLT
.L6:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	dice_init, .-dice_init
	.globl	s
	.bss
	.align 32
	.type	s, @object
	.size	s, 102
s:
	.zero	102
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%s"
.LC2:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	addq	$-128, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$1, -116(%rbp)
	jmp	.L8
.L9:
	movl	-116(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	-96(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -116(%rbp)
.L8:
	cmpl	$6, -116(%rbp)
	jle	.L9
	leaq	-96(%rbp), %rax
	movq	%rax, %rdi
	call	dice_init
	leaq	s(%rip), %rax
	movq	%rax, -104(%rbp)
	movq	-104(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, -116(%rbp)
	jmp	.L10
.L11:
	movl	-116(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	rot(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-116(%rbp), %eax
	cltq
	movl	%edx, -64(%rbp,%rax,4)
	addl	$1, -116(%rbp)
.L10:
	cmpl	$6, -116(%rbp)
	jle	.L11
	movl	$0, -112(%rbp)
	movl	$1, -108(%rbp)
	jmp	.L12
.L15:
	movl	$1, -116(%rbp)
	jmp	.L13
.L14:
	movq	-104(%rbp), %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	tr(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-116(%rbp), %edx
	movslq	%edx, %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$3, %rax
	subq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	rot(%rip), %rax
	movl	(%rdx,%rax), %eax
	movslq	%eax, %rcx
	movl	-112(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$3, %rax
	subq	%rdx, %rax
	addq	%rcx, %rax
	movl	-64(%rbp,%rax,4), %edx
	movl	-116(%rbp), %eax
	movslq	%eax, %rsi
	movl	-108(%rbp), %eax
	movslq	%eax, %rcx
	movq	%rcx, %rax
	salq	$3, %rax
	subq	%rcx, %rax
	addq	%rsi, %rax
	movl	%edx, -64(%rbp,%rax,4)
	addl	$1, -116(%rbp)
.L13:
	cmpl	$6, -116(%rbp)
	jle	.L14
	addq	$1, -104(%rbp)
	movl	-108(%rbp), %eax
	movl	%eax, -112(%rbp)
	cmpl	$0, -108(%rbp)
	sete	%al
	movzbl	%al, %eax
	movl	%eax, -108(%rbp)
.L12:
	movq	-104(%rbp), %rax
	movzbl	(%rax), %eax
	testb	%al, %al
	jne	.L15
	movl	-112(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$3, %rax
	subq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$60, %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	assign(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L17
	call	__stack_chk_fail@PLT
.L17:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.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	rot
	.data
	.align 32
	.type	rot, @object
	.size	rot, 140
rot:
	.long	0
	.long	1
	.long	2
	.long	3
	.long	4
	.long	5
	.long	6
	.long	0
	.long	2
	.long	6
	.long	3
	.long	4
	.long	1
	.long	5
	.long	0
	.long	4
	.long	2
	.long	1
	.long	6
	.long	5
	.long	3
	.long	0
	.long	3
	.long	2
	.long	6
	.long	1
	.long	5
	.long	4
	.long	0
	.long	5
	.long	1
	.long	3
	.long	4
	.long	6
	.long	2
	.globl	assign
	.bss
	.align 16
	.type	assign, @object
	.size	assign, 28
assign:
	.zero	28
	.globl	tr
	.align 32
	.type	tr, @object
	.size	tr, 360
tr:
	.zero	360
	.text
	.globl	dice_init
	.type	dice_init, @function
dice_init:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$64, %rsp
	movq	%rdi, -56(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -32(%rbp)
	movl	$78, -28(%rbp)
	movl	$69, -24(%rbp)
	movl	$87, -20(%rbp)
	movl	$83, -16(%rbp)
	movl	$1, -36(%rbp)
	jmp	.L2
.L3:
	movl	-36(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-56(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	-36(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	assign(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	addl	$1, -36(%rbp)
.L2:
	cmpl	$6, -36(%rbp)
	jle	.L3
	movl	$1, -36(%rbp)
	jmp	.L4
.L5:
	movl	-36(%rbp), %eax
	cltq
	movl	-32(%rbp,%rax,4), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	tr(%rip), %rdx
	movl	-36(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	addl	$1, -36(%rbp)
.L4:
	cmpl	$4, -36(%rbp)
	jle	.L5
	nop
	movq	-8(%rbp), %rax
	subq	%fs:40, %rax
	je	.L6
	call	__stack_chk_fail@PLT
.L6:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	dice_init, .-dice_init
	.globl	s
	.bss
	.align 32
	.type	s, @object
	.size	s, 102
s:
	.zero	102
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%s"
.LC2:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	addq	$-128, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$1, -116(%rbp)
	jmp	.L8
.L9:
	movl	-116(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	-96(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -116(%rbp)
.L8:
	cmpl	$6, -116(%rbp)
	jle	.L9
	leaq	-96(%rbp), %rax
	movq	%rax, %rdi
	call	dice_init
	leaq	s(%rip), %rax
	movq	%rax, -104(%rbp)
	movq	-104(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, -116(%rbp)
	jmp	.L10
.L11:
	movl	-116(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	rot(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-116(%rbp), %eax
	cltq
	movl	%edx, -64(%rbp,%rax,4)
	addl	$1, -116(%rbp)
.L10:
	cmpl	$6, -116(%rbp)
	jle	.L11
	movl	$0, -112(%rbp)
	movl	$1, -108(%rbp)
	jmp	.L12
.L15:
	movl	$1, -116(%rbp)
	jmp	.L13
.L14:
	movq	-104(%rbp), %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	tr(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-116(%rbp), %edx
	movslq	%edx, %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$3, %rax
	subq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	rot(%rip), %rax
	movl	(%rdx,%rax), %eax
	movslq	%eax, %rcx
	movl	-112(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$3, %rax
	subq	%rdx, %rax
	addq	%rcx, %rax
	movl	-64(%rbp,%rax,4), %edx
	movl	-116(%rbp), %eax
	movslq	%eax, %rsi
	movl	-108(%rbp), %eax
	movslq	%eax, %rcx
	movq	%rcx, %rax
	salq	$3, %rax
	subq	%rcx, %rax
	addq	%rsi, %rax
	movl	%edx, -64(%rbp,%rax,4)
	addl	$1, -116(%rbp)
.L13:
	cmpl	$6, -116(%rbp)
	jle	.L14
	addq	$1, -104(%rbp)
	movl	-108(%rbp), %eax
	movl	%eax, -112(%rbp)
	cmpl	$0, -108(%rbp)
	sete	%al
	movzbl	%al, %eax
	movl	%eax, -108(%rbp)
.L12:
	movq	-104(%rbp), %rax
	movzbl	(%rax), %eax
	testb	%al, %al
	jne	.L15
	movl	-112(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$3, %rax
	subq	%rdx, %rax
	salq	$2, %rax
	addq	%rbp, %rax
	subq	$60, %rax
	movl	(%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	assign(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L17
	call	__stack_chk_fail@PLT
.L17:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.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:
