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

```c
#include<stdio.h>
#include<string.h>
int main(){
    int kaisu;
    int i,j,k;
    char muki[10];
    int daisu[6]; //上下北東南西
    int tmp;
    int ans;

    while(1) {
       scanf("%d", &kaisu);

        if(kaisu == 0) {
            break;
        }
	
	ans = 0;
	daisu[0] = 1;
	daisu[1] = 6;
	daisu[2] = 5;
	daisu[3] = 3;
	daisu[4] = 2;
	daisu[5] = 4;
	
        for(i = 0; i < kaisu; i++){
	  scanf("%s", muki);

	  if(strcmp(muki,"North") == 0){
	    tmp = daisu[0];
	    daisu[0]=daisu[4];
	    daisu[4]=daisu[1];
	    daisu[1]=daisu[2];
	    daisu[2]=tmp;
	  }
	  
	  if(strcmp(muki,"East" ) == 0){
	    tmp = daisu[0];
	    daisu[0]=daisu[5];
	    daisu[5]=daisu[1];
	    daisu[1]=daisu[3];
	    daisu[3]=tmp;
	  }
	  
	  if(strcmp(muki,"South") == 0){
	    tmp = daisu[0];
	    daisu[0]=daisu[2];
	    daisu[2]=daisu[1];
	    daisu[1]=daisu[4];
	    daisu[4]=tmp;
	  }
	  
	  if(strcmp(muki,"West") == 0){
	    tmp = daisu[0];
	    daisu[0]=daisu[3];
	    daisu[3]=daisu[1];
	    daisu[1]=daisu[5];
	    daisu[5]=tmp;
	  }
	  
	  if(strcmp(muki,"Left") == 0){
	    tmp = daisu[2];
	    daisu[2]=daisu[3];
	    daisu[3]=daisu[4];
	    daisu[4]=daisu[5];
	    daisu[5]=tmp;
	  }
	  
	  if(strcmp(muki,"Right") == 0){
	    tmp = daisu[2];
	    daisu[2]=daisu[5];
	    daisu[5]=daisu[4];
	    daisu[4]=daisu[3];
	    daisu[3]=tmp;
	  }
	  
	  /* printf("%d ",daisu[0]); */
	  ans+=daisu[0];
	  /* printf("daisu ="); */
	  /* for(k = 0; k < 6; k++) { */
	  /*   printf("%d ", daisu[k]); */
	  /* } */
	  /* printf("\n"); */
	}
	/* printf("\n"); */
	
	

	printf("%d\n", ans+1);
    }

    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%s"
.LC2:
	.string	"North"
.LC3:
	.string	"East"
.LC4:
	.string	"South"
.LC5:
	.string	"West"
.LC6:
	.string	"Left"
.LC7:
	.string	"Right"
.LC8:
	.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
	subq	$64, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L12:
	leaq	-64(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-64(%rbp), %eax
	testl	%eax, %eax
	je	.L16
	movl	$0, -56(%rbp)
	movl	$1, -48(%rbp)
	movl	$6, -44(%rbp)
	movl	$5, -40(%rbp)
	movl	$3, -36(%rbp)
	movl	$2, -32(%rbp)
	movl	$4, -28(%rbp)
	movl	$0, -60(%rbp)
	jmp	.L4
.L11:
	leaq	-18(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-18(%rbp), %rax
	leaq	.LC2(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L5
	movl	-48(%rbp), %eax
	movl	%eax, -52(%rbp)
	movl	-32(%rbp), %eax
	movl	%eax, -48(%rbp)
	movl	-44(%rbp), %eax
	movl	%eax, -32(%rbp)
	movl	-40(%rbp), %eax
	movl	%eax, -44(%rbp)
	movl	-52(%rbp), %eax
	movl	%eax, -40(%rbp)
.L5:
	leaq	-18(%rbp), %rax
	leaq	.LC3(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L6
	movl	-48(%rbp), %eax
	movl	%eax, -52(%rbp)
	movl	-28(%rbp), %eax
	movl	%eax, -48(%rbp)
	movl	-44(%rbp), %eax
	movl	%eax, -28(%rbp)
	movl	-36(%rbp), %eax
	movl	%eax, -44(%rbp)
	movl	-52(%rbp), %eax
	movl	%eax, -36(%rbp)
.L6:
	leaq	-18(%rbp), %rax
	leaq	.LC4(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L7
	movl	-48(%rbp), %eax
	movl	%eax, -52(%rbp)
	movl	-40(%rbp), %eax
	movl	%eax, -48(%rbp)
	movl	-44(%rbp), %eax
	movl	%eax, -40(%rbp)
	movl	-32(%rbp), %eax
	movl	%eax, -44(%rbp)
	movl	-52(%rbp), %eax
	movl	%eax, -32(%rbp)
.L7:
	leaq	-18(%rbp), %rax
	leaq	.LC5(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L8
	movl	-48(%rbp), %eax
	movl	%eax, -52(%rbp)
	movl	-36(%rbp), %eax
	movl	%eax, -48(%rbp)
	movl	-44(%rbp), %eax
	movl	%eax, -36(%rbp)
	movl	-28(%rbp), %eax
	movl	%eax, -44(%rbp)
	movl	-52(%rbp), %eax
	movl	%eax, -28(%rbp)
.L8:
	leaq	-18(%rbp), %rax
	leaq	.LC6(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L9
	movl	-40(%rbp), %eax
	movl	%eax, -52(%rbp)
	movl	-36(%rbp), %eax
	movl	%eax, -40(%rbp)
	movl	-32(%rbp), %eax
	movl	%eax, -36(%rbp)
	movl	-28(%rbp), %eax
	movl	%eax, -32(%rbp)
	movl	-52(%rbp), %eax
	movl	%eax, -28(%rbp)
.L9:
	leaq	-18(%rbp), %rax
	leaq	.LC7(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L10
	movl	-40(%rbp), %eax
	movl	%eax, -52(%rbp)
	movl	-28(%rbp), %eax
	movl	%eax, -40(%rbp)
	movl	-32(%rbp), %eax
	movl	%eax, -28(%rbp)
	movl	-36(%rbp), %eax
	movl	%eax, -32(%rbp)
	movl	-52(%rbp), %eax
	movl	%eax, -36(%rbp)
.L10:
	movl	-48(%rbp), %eax
	addl	%eax, -56(%rbp)
	addl	$1, -60(%rbp)
.L4:
	movl	-64(%rbp), %eax
	cmpl	%eax, -60(%rbp)
	jl	.L11
	movl	-56(%rbp), %eax
	addl	$1, %eax
	movl	%eax, %esi
	leaq	.LC8(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L12
.L16:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L14
	call	__stack_chk_fail@PLT
.L14:
	leave
	.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	"%s"
.LC2:
	.string	"North"
.LC3:
	.string	"East"
.LC4:
	.string	"South"
.LC5:
	.string	"West"
.LC6:
	.string	"Left"
.LC7:
	.string	"Right"
.LC8:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB35:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	leaq	.LC1(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$72, %rsp
	.cfi_def_cfa_offset 128
	movq	%fs:40, %rax
	movq	%rax, 56(%rsp)
	xorl	%eax, %eax
	leaq	40(%rsp), %rax
	movq	%rax, 24(%rsp)
	.p2align 4,,10
	.p2align 3
.L23:
	movq	24(%rsp), %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	40(%rsp), %eax
	testl	%eax, %eax
	je	.L2
	jle	.L25
	leaq	46(%rsp), %r15
	movl	$1, %ebp
	xorl	%ebx, %ebx
	xorl	%r13d, %r13d
	movq	%r15, %rax
	movl	$2, 20(%rsp)
	movl	%ebp, %r15d
	movl	$4, %r12d
	movl	$3, 8(%rsp)
	movq	%rax, %rbp
	movl	$5, 16(%rsp)
	movl	$6, 12(%rsp)
	jmp	.L22
	.p2align 4,,10
	.p2align 3
.L6:
	cmpl	$1953718597, 0(%rbp)
	je	.L29
.L9:
	cmpl	$1953853267, 0(%rbp)
	je	.L30
.L12:
	cmpl	$1953719639, 0(%rbp)
	je	.L31
.L15:
	cmpl	$1952867660, 0(%rbp)
	je	.L32
.L18:
	cmpl	$1751607634, 0(%rbp)
	je	.L33
.L21:
	addl	%r15d, %ebx
	addl	$1, %r13d
	cmpl	%r13d, 40(%rsp)
	jle	.L34
.L22:
	xorl	%eax, %eax
	movq	%rbp, %rsi
	movq	%r14, %rdi
	call	__isoc99_scanf@PLT
	cmpl	$1953656654, 0(%rbp)
	jne	.L6
	cmpw	$104, 4(%rbp)
	jne	.L6
	movl	12(%rsp), %edx
	movl	%r15d, %eax
	movl	20(%rsp), %r15d
	cmpl	$1953718597, 0(%rbp)
	movl	%edx, 20(%rsp)
	movl	16(%rsp), %edx
	movl	%eax, 16(%rsp)
	movl	%edx, 12(%rsp)
	jne	.L9
	.p2align 4,,10
	.p2align 3
.L29:
	cmpb	$0, 4(%rbp)
	jne	.L9
	movl	8(%rsp), %ecx
	movl	%r15d, %eax
	cmpl	$1953853267, 0(%rbp)
	movl	%r12d, %r15d
	movl	%eax, 8(%rsp)
	movl	12(%rsp), %r12d
	movl	%ecx, 12(%rsp)
	jne	.L12
	.p2align 4,,10
	.p2align 3
.L30:
	cmpw	$104, 4(%rbp)
	jne	.L12
	movl	12(%rsp), %ecx
	movl	20(%rsp), %edx
	movl	%r15d, %eax
	cmpl	$1953719639, 0(%rbp)
	movl	16(%rsp), %r15d
	movl	%eax, 20(%rsp)
	movl	%ecx, 16(%rsp)
	movl	%edx, 12(%rsp)
	jne	.L15
	.p2align 4,,10
	.p2align 3
.L31:
	cmpb	$0, 4(%rbp)
	jne	.L15
	movl	12(%rsp), %ecx
	movl	%r15d, %eax
	cmpl	$1952867660, 0(%rbp)
	movl	%r12d, 12(%rsp)
	movl	8(%rsp), %r15d
	movl	%eax, %r12d
	movl	%ecx, 8(%rsp)
	jne	.L18
	.p2align 4,,10
	.p2align 3
.L32:
	cmpb	$0, 4(%rbp)
	jne	.L18
	movl	16(%rsp), %eax
	movl	8(%rsp), %edx
	movl	20(%rsp), %ecx
	cmpl	$1751607634, 0(%rbp)
	movl	%r12d, 20(%rsp)
	movl	%edx, 16(%rsp)
	movl	%eax, %r12d
	movl	%ecx, 8(%rsp)
	jne	.L21
	.p2align 4,,10
	.p2align 3
.L33:
	cmpw	$116, 4(%rbp)
	jne	.L21
	movl	16(%rsp), %eax
	movl	8(%rsp), %ecx
	movl	%r12d, 16(%rsp)
	addl	%r15d, %ebx
	movl	20(%rsp), %r12d
	addl	$1, %r13d
	movl	%ecx, 20(%rsp)
	movl	%eax, 8(%rsp)
	cmpl	%r13d, 40(%rsp)
	jg	.L22
	.p2align 4,,10
	.p2align 3
.L34:
	leal	1(%rbx), %edx
.L3:
	leaq	.LC8(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L23
	.p2align 4,,10
	.p2align 3
.L2:
	movq	56(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L35
	addq	$72, %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
.L25:
	.cfi_restore_state
	movl	$1, %edx
	jmp	.L3
.L35:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE35:
	.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	"%s"
.LC2:
	.string	"North"
.LC3:
	.string	"East"
.LC4:
	.string	"South"
.LC5:
	.string	"West"
.LC6:
	.string	"Left"
.LC7:
	.string	"Right"
.LC8:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB35:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	leaq	.LC1(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$72, %rsp
	.cfi_def_cfa_offset 128
	movq	%fs:40, %rax
	movq	%rax, 56(%rsp)
	xorl	%eax, %eax
	leaq	40(%rsp), %rax
	movq	%rax, 24(%rsp)
	.p2align 4,,10
	.p2align 3
.L23:
	movq	24(%rsp), %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	40(%rsp), %eax
	testl	%eax, %eax
	je	.L2
	jle	.L25
	leaq	46(%rsp), %r15
	movl	$1, %ebp
	xorl	%ebx, %ebx
	xorl	%r13d, %r13d
	movq	%r15, %rax
	movl	$2, 20(%rsp)
	movl	%ebp, %r15d
	movl	$4, %r12d
	movl	$3, 8(%rsp)
	movq	%rax, %rbp
	movl	$5, 16(%rsp)
	movl	$6, 12(%rsp)
	jmp	.L22
	.p2align 4,,10
	.p2align 3
.L6:
	cmpl	$1953718597, 0(%rbp)
	je	.L29
.L9:
	cmpl	$1953853267, 0(%rbp)
	je	.L30
.L12:
	cmpl	$1953719639, 0(%rbp)
	je	.L31
.L15:
	cmpl	$1952867660, 0(%rbp)
	je	.L32
.L18:
	cmpl	$1751607634, 0(%rbp)
	je	.L33
.L21:
	addl	%r15d, %ebx
	addl	$1, %r13d
	cmpl	%r13d, 40(%rsp)
	jle	.L34
.L22:
	xorl	%eax, %eax
	movq	%rbp, %rsi
	movq	%r14, %rdi
	call	__isoc99_scanf@PLT
	cmpl	$1953656654, 0(%rbp)
	jne	.L6
	cmpw	$104, 4(%rbp)
	jne	.L6
	movl	12(%rsp), %edx
	movl	%r15d, %eax
	movl	20(%rsp), %r15d
	cmpl	$1953718597, 0(%rbp)
	movl	%edx, 20(%rsp)
	movl	16(%rsp), %edx
	movl	%eax, 16(%rsp)
	movl	%edx, 12(%rsp)
	jne	.L9
	.p2align 4,,10
	.p2align 3
.L29:
	cmpb	$0, 4(%rbp)
	jne	.L9
	movl	8(%rsp), %ecx
	movl	%r15d, %eax
	cmpl	$1953853267, 0(%rbp)
	movl	%r12d, %r15d
	movl	%eax, 8(%rsp)
	movl	12(%rsp), %r12d
	movl	%ecx, 12(%rsp)
	jne	.L12
	.p2align 4,,10
	.p2align 3
.L30:
	cmpw	$104, 4(%rbp)
	jne	.L12
	movl	12(%rsp), %ecx
	movl	20(%rsp), %edx
	movl	%r15d, %eax
	cmpl	$1953719639, 0(%rbp)
	movl	16(%rsp), %r15d
	movl	%eax, 20(%rsp)
	movl	%ecx, 16(%rsp)
	movl	%edx, 12(%rsp)
	jne	.L15
	.p2align 4,,10
	.p2align 3
.L31:
	cmpb	$0, 4(%rbp)
	jne	.L15
	movl	12(%rsp), %ecx
	movl	%r15d, %eax
	cmpl	$1952867660, 0(%rbp)
	movl	%r12d, 12(%rsp)
	movl	8(%rsp), %r15d
	movl	%eax, %r12d
	movl	%ecx, 8(%rsp)
	jne	.L18
	.p2align 4,,10
	.p2align 3
.L32:
	cmpb	$0, 4(%rbp)
	jne	.L18
	movl	16(%rsp), %eax
	movl	8(%rsp), %edx
	movl	20(%rsp), %ecx
	cmpl	$1751607634, 0(%rbp)
	movl	%r12d, 20(%rsp)
	movl	%edx, 16(%rsp)
	movl	%eax, %r12d
	movl	%ecx, 8(%rsp)
	jne	.L21
	.p2align 4,,10
	.p2align 3
.L33:
	cmpw	$116, 4(%rbp)
	jne	.L21
	movl	16(%rsp), %eax
	movl	8(%rsp), %ecx
	movl	%r12d, 16(%rsp)
	addl	%r15d, %ebx
	movl	20(%rsp), %r12d
	addl	$1, %r13d
	movl	%ecx, 20(%rsp)
	movl	%eax, 8(%rsp)
	cmpl	%r13d, 40(%rsp)
	jg	.L22
	.p2align 4,,10
	.p2align 3
.L34:
	leal	1(%rbx), %edx
.L3:
	leaq	.LC8(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L23
	.p2align 4,,10
	.p2align 3
.L2:
	movq	56(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L35
	addq	$72, %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
.L25:
	.cfi_restore_state
	movl	$1, %edx
	jmp	.L3
.L35:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE35:
	.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>
#include<string.h>
int main(){
    int kaisu;
    int i,j,k;
    char muki[10];
    int daisu[6]; //上下北東南西
    int tmp;
    int ans;

    while(1) {
       scanf("%d", &kaisu);

        if(kaisu == 0) {
            break;
        }
	
	ans = 0;
	daisu[0] = 1;
	daisu[1] = 6;
	daisu[2] = 5;
	daisu[3] = 3;
	daisu[4] = 2;
	daisu[5] = 4;
	
        for(i = 0; i < kaisu; i++){
	  scanf("%s", muki);

	  if(strcmp(muki,"North") == 0){
	    tmp = daisu[0];
	    daisu[0]=daisu[4];
	    daisu[4]=daisu[1];
	    daisu[1]=daisu[2];
	    daisu[2]=tmp;
	  }
	  
	  if(strcmp(muki,"East" ) == 0){
	    tmp = daisu[0];
	    daisu[0]=daisu[5];
	    daisu[5]=daisu[1];
	    daisu[1]=daisu[3];
	    daisu[3]=tmp;
	  }
	  
	  if(strcmp(muki,"South") == 0){
	    tmp = daisu[0];
	    daisu[0]=daisu[2];
	    daisu[2]=daisu[1];
	    daisu[1]=daisu[4];
	    daisu[4]=tmp;
	  }
	  
	  if(strcmp(muki,"West") == 0){
	    tmp = daisu[0];
	    daisu[0]=daisu[3];
	    daisu[3]=daisu[1];
	    daisu[1]=daisu[5];
	    daisu[5]=tmp;
	  }
	  
	  if(strcmp(muki,"Left") == 0){
	    tmp = daisu[2];
	    daisu[2]=daisu[3];
	    daisu[3]=daisu[4];
	    daisu[4]=daisu[5];
	    daisu[5]=tmp;
	  }
	  
	  if(strcmp(muki,"Right") == 0){
	    tmp = daisu[2];
	    daisu[2]=daisu[5];
	    daisu[5]=daisu[4];
	    daisu[4]=daisu[3];
	    daisu[3]=tmp;
	  }
	  
	  /* printf("%d ",daisu[0]); */
	  ans+=daisu[0];
	  /* printf("daisu ="); */
	  /* for(k = 0; k < 6; k++) { */
	  /*   printf("%d ", daisu[k]); */
	  /* } */
	  /* printf("\n"); */
	}
	/* printf("\n"); */
	
	

	printf("%d\n", ans+1);
    }

    return 0;
}
5
North
North
East
South
West
8
West
North
Left
South
Right
North
Left
East
0
 5
North
North
East
South
West
8
West
North
Left
South
Right
North
Left
East
0

21
34
 21
34

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

```c
#include<stdio.h>
#include<string.h>
int main(){
    int kaisu;
    int i,j,k;
    char muki[10];
    int daisu[6]; //上下北東南西
    int tmp;
    int ans;

    while(1) {
       scanf("%d", &kaisu);

        if(kaisu == 0) {
            break;
        }
	
	ans = 0;
	daisu[0] = 1;
	daisu[1] = 6;
	daisu[2] = 5;
	daisu[3] = 3;
	daisu[4] = 2;
	daisu[5] = 4;
	
        for(i = 0; i < kaisu; i++){
	  scanf("%s", muki);

	  if(strcmp(muki,"North") == 0){
	    tmp = daisu[0];
	    daisu[0]=daisu[4];
	    daisu[4]=daisu[1];
	    daisu[1]=daisu[2];
	    daisu[2]=tmp;
	  }
	  
	  if(strcmp(muki,"East" ) == 0){
	    tmp = daisu[0];
	    daisu[0]=daisu[5];
	    daisu[5]=daisu[1];
	    daisu[1]=daisu[3];
	    daisu[3]=tmp;
	  }
	  
	  if(strcmp(muki,"South") == 0){
	    tmp = daisu[0];
	    daisu[0]=daisu[2];
	    daisu[2]=daisu[1];
	    daisu[1]=daisu[4];
	    daisu[4]=tmp;
	  }
	  
	  if(strcmp(muki,"West") == 0){
	    tmp = daisu[0];
	    daisu[0]=daisu[3];
	    daisu[3]=daisu[1];
	    daisu[1]=daisu[5];
	    daisu[5]=tmp;
	  }
	  
	  if(strcmp(muki,"Left") == 0){
	    tmp = daisu[2];
	    daisu[2]=daisu[3];
	    daisu[3]=daisu[4];
	    daisu[4]=daisu[5];
	    daisu[5]=tmp;
	  }
	  
	  if(strcmp(muki,"Right") == 0){
	    tmp = daisu[2];
	    daisu[2]=daisu[5];
	    daisu[5]=daisu[4];
	    daisu[4]=daisu[3];
	    daisu[3]=tmp;
	  }
	  
	  /* printf("%d ",daisu[0]); */
	  ans+=daisu[0];
	  /* printf("daisu ="); */
	  /* for(k = 0; k < 6; k++) { */
	  /*   printf("%d ", daisu[k]); */
	  /* } */
	  /* printf("\n"); */
	}
	/* printf("\n"); */
	
	

	printf("%d\n", ans+1);
    }

    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%s"
.LC2:
	.string	"North"
.LC3:
	.string	"East"
.LC4:
	.string	"South"
.LC5:
	.string	"West"
.LC6:
	.string	"Left"
.LC7:
	.string	"Right"
.LC8:
	.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
	subq	$64, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L12:
	leaq	-64(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-64(%rbp), %eax
	testl	%eax, %eax
	je	.L16
	movl	$0, -56(%rbp)
	movl	$1, -48(%rbp)
	movl	$6, -44(%rbp)
	movl	$5, -40(%rbp)
	movl	$3, -36(%rbp)
	movl	$2, -32(%rbp)
	movl	$4, -28(%rbp)
	movl	$0, -60(%rbp)
	jmp	.L4
.L11:
	leaq	-18(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-18(%rbp), %rax
	leaq	.LC2(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L5
	movl	-48(%rbp), %eax
	movl	%eax, -52(%rbp)
	movl	-32(%rbp), %eax
	movl	%eax, -48(%rbp)
	movl	-44(%rbp), %eax
	movl	%eax, -32(%rbp)
	movl	-40(%rbp), %eax
	movl	%eax, -44(%rbp)
	movl	-52(%rbp), %eax
	movl	%eax, -40(%rbp)
.L5:
	leaq	-18(%rbp), %rax
	leaq	.LC3(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L6
	movl	-48(%rbp), %eax
	movl	%eax, -52(%rbp)
	movl	-28(%rbp), %eax
	movl	%eax, -48(%rbp)
	movl	-44(%rbp), %eax
	movl	%eax, -28(%rbp)
	movl	-36(%rbp), %eax
	movl	%eax, -44(%rbp)
	movl	-52(%rbp), %eax
	movl	%eax, -36(%rbp)
.L6:
	leaq	-18(%rbp), %rax
	leaq	.LC4(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L7
	movl	-48(%rbp), %eax
	movl	%eax, -52(%rbp)
	movl	-40(%rbp), %eax
	movl	%eax, -48(%rbp)
	movl	-44(%rbp), %eax
	movl	%eax, -40(%rbp)
	movl	-32(%rbp), %eax
	movl	%eax, -44(%rbp)
	movl	-52(%rbp), %eax
	movl	%eax, -32(%rbp)
.L7:
	leaq	-18(%rbp), %rax
	leaq	.LC5(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L8
	movl	-48(%rbp), %eax
	movl	%eax, -52(%rbp)
	movl	-36(%rbp), %eax
	movl	%eax, -48(%rbp)
	movl	-44(%rbp), %eax
	movl	%eax, -36(%rbp)
	movl	-28(%rbp), %eax
	movl	%eax, -44(%rbp)
	movl	-52(%rbp), %eax
	movl	%eax, -28(%rbp)
.L8:
	leaq	-18(%rbp), %rax
	leaq	.LC6(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L9
	movl	-40(%rbp), %eax
	movl	%eax, -52(%rbp)
	movl	-36(%rbp), %eax
	movl	%eax, -40(%rbp)
	movl	-32(%rbp), %eax
	movl	%eax, -36(%rbp)
	movl	-28(%rbp), %eax
	movl	%eax, -32(%rbp)
	movl	-52(%rbp), %eax
	movl	%eax, -28(%rbp)
.L9:
	leaq	-18(%rbp), %rax
	leaq	.LC7(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L10
	movl	-40(%rbp), %eax
	movl	%eax, -52(%rbp)
	movl	-28(%rbp), %eax
	movl	%eax, -40(%rbp)
	movl	-32(%rbp), %eax
	movl	%eax, -28(%rbp)
	movl	-36(%rbp), %eax
	movl	%eax, -32(%rbp)
	movl	-52(%rbp), %eax
	movl	%eax, -36(%rbp)
.L10:
	movl	-48(%rbp), %eax
	addl	%eax, -56(%rbp)
	addl	$1, -60(%rbp)
.L4:
	movl	-64(%rbp), %eax
	cmpl	%eax, -60(%rbp)
	jl	.L11
	movl	-56(%rbp), %eax
	addl	$1, %eax
	movl	%eax, %esi
	leaq	.LC8(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L12
.L16:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L14
	call	__stack_chk_fail@PLT
.L14:
	leave
	.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	"%s"
.LC2:
	.string	"North"
.LC3:
	.string	"East"
.LC4:
	.string	"South"
.LC5:
	.string	"West"
.LC6:
	.string	"Left"
.LC7:
	.string	"Right"
.LC8:
	.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
	subq	$64, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L12:
	leaq	-64(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-64(%rbp), %eax
	testl	%eax, %eax
	je	.L16
	movl	$0, -56(%rbp)
	movl	$1, -48(%rbp)
	movl	$6, -44(%rbp)
	movl	$5, -40(%rbp)
	movl	$3, -36(%rbp)
	movl	$2, -32(%rbp)
	movl	$4, -28(%rbp)
	movl	$0, -60(%rbp)
	jmp	.L4
.L11:
	leaq	-18(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-18(%rbp), %rax
	leaq	.LC2(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L5
	movl	-48(%rbp), %eax
	movl	%eax, -52(%rbp)
	movl	-32(%rbp), %eax
	movl	%eax, -48(%rbp)
	movl	-44(%rbp), %eax
	movl	%eax, -32(%rbp)
	movl	-40(%rbp), %eax
	movl	%eax, -44(%rbp)
	movl	-52(%rbp), %eax
	movl	%eax, -40(%rbp)
.L5:
	leaq	-18(%rbp), %rax
	leaq	.LC3(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L6
	movl	-48(%rbp), %eax
	movl	%eax, -52(%rbp)
	movl	-28(%rbp), %eax
	movl	%eax, -48(%rbp)
	movl	-44(%rbp), %eax
	movl	%eax, -28(%rbp)
	movl	-36(%rbp), %eax
	movl	%eax, -44(%rbp)
	movl	-52(%rbp), %eax
	movl	%eax, -36(%rbp)
.L6:
	leaq	-18(%rbp), %rax
	leaq	.LC4(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L7
	movl	-48(%rbp), %eax
	movl	%eax, -52(%rbp)
	movl	-40(%rbp), %eax
	movl	%eax, -48(%rbp)
	movl	-44(%rbp), %eax
	movl	%eax, -40(%rbp)
	movl	-32(%rbp), %eax
	movl	%eax, -44(%rbp)
	movl	-52(%rbp), %eax
	movl	%eax, -32(%rbp)
.L7:
	leaq	-18(%rbp), %rax
	leaq	.LC5(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L8
	movl	-48(%rbp), %eax
	movl	%eax, -52(%rbp)
	movl	-36(%rbp), %eax
	movl	%eax, -48(%rbp)
	movl	-44(%rbp), %eax
	movl	%eax, -36(%rbp)
	movl	-28(%rbp), %eax
	movl	%eax, -44(%rbp)
	movl	-52(%rbp), %eax
	movl	%eax, -28(%rbp)
.L8:
	leaq	-18(%rbp), %rax
	leaq	.LC6(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L9
	movl	-40(%rbp), %eax
	movl	%eax, -52(%rbp)
	movl	-36(%rbp), %eax
	movl	%eax, -40(%rbp)
	movl	-32(%rbp), %eax
	movl	%eax, -36(%rbp)
	movl	-28(%rbp), %eax
	movl	%eax, -32(%rbp)
	movl	-52(%rbp), %eax
	movl	%eax, -28(%rbp)
.L9:
	leaq	-18(%rbp), %rax
	leaq	.LC7(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L10
	movl	-40(%rbp), %eax
	movl	%eax, -52(%rbp)
	movl	-28(%rbp), %eax
	movl	%eax, -40(%rbp)
	movl	-32(%rbp), %eax
	movl	%eax, -28(%rbp)
	movl	-36(%rbp), %eax
	movl	%eax, -32(%rbp)
	movl	-52(%rbp), %eax
	movl	%eax, -36(%rbp)
.L10:
	movl	-48(%rbp), %eax
	addl	%eax, -56(%rbp)
	addl	$1, -60(%rbp)
.L4:
	movl	-64(%rbp), %eax
	cmpl	%eax, -60(%rbp)
	jl	.L11
	movl	-56(%rbp), %eax
	addl	$1, %eax
	movl	%eax, %esi
	leaq	.LC8(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L12
.L16:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L14
	call	__stack_chk_fail@PLT
.L14:
	leave
	.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:
