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>
void tos(int a[]){
    int t=a[0];
    a[0]=a[4];
    a[4]=a[5];
    a[5]=a[1];
    a[1]=t;
}
void ton(int a[]){
    int t=a[0];
    a[0]=a[1];
    a[1]=a[5];
    a[5]=a[4];
    a[4]=t;
}
void toe(int a[]){
    int t=a[0];
    a[0]=a[3];
    a[3]=a[5];
    a[5]=a[2];
    a[2]=t;
}
void tow(int a[]){
    int t=a[0];
    a[0]=a[2];
    a[2]=a[5];
    a[5]=a[3];
    a[3]=t;
}
void tor(int a[]){
    int t=a[1];
    a[1]=a[2];
    a[2]=a[4];
    a[4]=a[3];
    a[3]=t;
}
void tol(int a[]){
  int t=a[1];
  a[1]=a[3];
  a[3]=a[4];
  a[4]=a[2];
  a[2]=t;
}
int main(void){
  int a[6],s,i,n;
  char o[10];
  while(scanf("%d",&n),n){
    for(i=0;i<6;i++)
      a[i]=i+1;
    s=1;
    while(n--){
      scanf("%s",o);
      if(strcmp(o,"North")==0){
	ton(a);
	s+=a[0];
      }
      if(strcmp(o,"East")==0){
	toe(a);
	s+=a[0];
      }
      if(strcmp(o,"South")==0){
	tos(a);
	s+=a[0];
      }
      if(strcmp(o,"West")==0){
	tow(a);
	s+=a[0];
      }
      if(strcmp(o,"Right")==0){
	tor(a);
	s+=a[0];
      }
      if(strcmp(o,"Left")==0){
	tol(a);
	s+=a[0];
      }
    }
    printf("%d\n",s);
  }
  return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	tos
	.type	tos, @function
tos:
.LFB0:
	.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
	leaq	16(%rax), %rdx
	movq	-24(%rbp), %rax
	movl	20(%rax), %eax
	movl	%eax, (%rdx)
	movq	-24(%rbp), %rax
	leaq	20(%rax), %rdx
	movq	-24(%rbp), %rax
	movl	4(%rax), %eax
	movl	%eax, (%rdx)
	movq	-24(%rbp), %rax
	leaq	4(%rax), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rdx)
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	tos, .-tos
	.globl	ton
	.type	ton, @function
ton:
.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	4(%rax), %edx
	movq	-24(%rbp), %rax
	movl	%edx, (%rax)
	movq	-24(%rbp), %rax
	leaq	4(%rax), %rdx
	movq	-24(%rbp), %rax
	movl	20(%rax), %eax
	movl	%eax, (%rdx)
	movq	-24(%rbp), %rax
	leaq	20(%rax), %rdx
	movq	-24(%rbp), %rax
	movl	16(%rax), %eax
	movl	%eax, (%rdx)
	movq	-24(%rbp), %rax
	leaq	16(%rax), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rdx)
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	ton, .-ton
	.globl	toe
	.type	toe, @function
toe:
.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	(%rax), %eax
	movl	%eax, -4(%rbp)
	movq	-24(%rbp), %rax
	movl	12(%rax), %edx
	movq	-24(%rbp), %rax
	movl	%edx, (%rax)
	movq	-24(%rbp), %rax
	leaq	12(%rax), %rdx
	movq	-24(%rbp), %rax
	movl	20(%rax), %eax
	movl	%eax, (%rdx)
	movq	-24(%rbp), %rax
	leaq	20(%rax), %rdx
	movq	-24(%rbp), %rax
	movl	8(%rax), %eax
	movl	%eax, (%rdx)
	movq	-24(%rbp), %rax
	leaq	8(%rax), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rdx)
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	toe, .-toe
	.globl	tow
	.type	tow, @function
tow:
.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
	leaq	8(%rax), %rdx
	movq	-24(%rbp), %rax
	movl	20(%rax), %eax
	movl	%eax, (%rdx)
	movq	-24(%rbp), %rax
	leaq	20(%rax), %rdx
	movq	-24(%rbp), %rax
	movl	12(%rax), %eax
	movl	%eax, (%rdx)
	movq	-24(%rbp), %rax
	leaq	12(%rax), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rdx)
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.size	tow, .-tow
	.globl	tor
	.type	tor, @function
tor:
.LFB4:
	.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
	leaq	4(%rax), %rdx
	movq	-24(%rbp), %rax
	movl	8(%rax), %eax
	movl	%eax, (%rdx)
	movq	-24(%rbp), %rax
	leaq	8(%rax), %rdx
	movq	-24(%rbp), %rax
	movl	16(%rax), %eax
	movl	%eax, (%rdx)
	movq	-24(%rbp), %rax
	leaq	16(%rax), %rdx
	movq	-24(%rbp), %rax
	movl	12(%rax), %eax
	movl	%eax, (%rdx)
	movq	-24(%rbp), %rax
	leaq	12(%rax), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rdx)
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE4:
	.size	tor, .-tor
	.globl	tol
	.type	tol, @function
tol:
.LFB5:
	.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
	leaq	4(%rax), %rdx
	movq	-24(%rbp), %rax
	movl	12(%rax), %eax
	movl	%eax, (%rdx)
	movq	-24(%rbp), %rax
	leaq	12(%rax), %rdx
	movq	-24(%rbp), %rax
	movl	16(%rax), %eax
	movl	%eax, (%rdx)
	movq	-24(%rbp), %rax
	leaq	16(%rax), %rdx
	movq	-24(%rbp), %rax
	movl	8(%rax), %eax
	movl	%eax, (%rdx)
	movq	-24(%rbp), %rax
	leaq	8(%rax), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rdx)
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE5:
	.size	tol, .-tol
	.section	.rodata
.LC0:
	.string	"%s"
.LC1:
	.string	"North"
.LC2:
	.string	"East"
.LC3:
	.string	"South"
.LC4:
	.string	"West"
.LC5:
	.string	"Right"
.LC6:
	.string	"Left"
.LC7:
	.string	"%d\n"
.LC8:
	.string	"%d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.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
	jmp	.L8
.L18:
	movl	$0, -52(%rbp)
	jmp	.L9
.L10:
	movl	-52(%rbp), %eax
	leal	1(%rax), %edx
	movl	-52(%rbp), %eax
	cltq
	movl	%edx, -48(%rbp,%rax,4)
	addl	$1, -52(%rbp)
.L9:
	cmpl	$5, -52(%rbp)
	jle	.L10
	movl	$1, -56(%rbp)
	jmp	.L11
.L17:
	leaq	-18(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-18(%rbp), %rax
	leaq	.LC1(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L12
	leaq	-48(%rbp), %rax
	movq	%rax, %rdi
	call	ton
	movl	-48(%rbp), %eax
	addl	%eax, -56(%rbp)
.L12:
	leaq	-18(%rbp), %rax
	leaq	.LC2(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L13
	leaq	-48(%rbp), %rax
	movq	%rax, %rdi
	call	toe
	movl	-48(%rbp), %eax
	addl	%eax, -56(%rbp)
.L13:
	leaq	-18(%rbp), %rax
	leaq	.LC3(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L14
	leaq	-48(%rbp), %rax
	movq	%rax, %rdi
	call	tos
	movl	-48(%rbp), %eax
	addl	%eax, -56(%rbp)
.L14:
	leaq	-18(%rbp), %rax
	leaq	.LC4(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L15
	leaq	-48(%rbp), %rax
	movq	%rax, %rdi
	call	tow
	movl	-48(%rbp), %eax
	addl	%eax, -56(%rbp)
.L15:
	leaq	-18(%rbp), %rax
	leaq	.LC5(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L16
	leaq	-48(%rbp), %rax
	movq	%rax, %rdi
	call	tor
	movl	-48(%rbp), %eax
	addl	%eax, -56(%rbp)
.L16:
	leaq	-18(%rbp), %rax
	leaq	.LC6(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L11
	leaq	-48(%rbp), %rax
	movq	%rax, %rdi
	call	tol
	movl	-48(%rbp), %eax
	addl	%eax, -56(%rbp)
.L11:
	movl	-60(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -60(%rbp)
	testl	%eax, %eax
	jne	.L17
	movl	-56(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC7(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L8:
	leaq	-60(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC8(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-60(%rbp), %eax
	testl	%eax, %eax
	jne	.L18
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L20
	call	__stack_chk_fail@PLT
.L20:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.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	tos
	.type	tos, @function
tos:
.LFB35:
	.cfi_startproc
	endbr64
	movq	16(%rdi), %xmm0
	movq	(%rdi), %xmm1
	movdqa	%xmm0, %xmm2
	punpckldq	%xmm1, %xmm0
	punpckldq	%xmm1, %xmm2
	movq	%xmm0, (%rdi)
	pshufd	$14, %xmm2, %xmm2
	movq	%xmm2, 16(%rdi)
	ret
	.cfi_endproc
.LFE35:
	.size	tos, .-tos
	.p2align 4
	.globl	ton
	.type	ton, @function
ton:
.LFB36:
	.cfi_startproc
	endbr64
	movq	(%rdi), %xmm0
	movq	16(%rdi), %xmm1
	movdqa	%xmm0, %xmm2
	punpckldq	%xmm1, %xmm0
	punpckldq	%xmm1, %xmm2
	movq	%xmm0, 16(%rdi)
	pshufd	$14, %xmm2, %xmm2
	movq	%xmm2, (%rdi)
	ret
	.cfi_endproc
.LFE36:
	.size	ton, .-ton
	.p2align 4
	.globl	toe
	.type	toe, @function
toe:
.LFB37:
	.cfi_startproc
	endbr64
	movl	12(%rdi), %eax
	movd	(%rdi), %xmm0
	movd	20(%rdi), %xmm1
	movl	%eax, (%rdi)
	movl	8(%rdi), %eax
	punpckldq	%xmm1, %xmm0
	movl	%eax, 20(%rdi)
	movq	%xmm0, 8(%rdi)
	ret
	.cfi_endproc
.LFE37:
	.size	toe, .-toe
	.p2align 4
	.globl	tow
	.type	tow, @function
tow:
.LFB38:
	.cfi_startproc
	endbr64
	movl	(%rdi), %eax
	movd	20(%rdi), %xmm0
	movl	8(%rdi), %edx
	movd	%eax, %xmm1
	movl	12(%rdi), %eax
	punpckldq	%xmm1, %xmm0
	movl	%edx, (%rdi)
	movl	%eax, 20(%rdi)
	movq	%xmm0, 8(%rdi)
	ret
	.cfi_endproc
.LFE38:
	.size	tow, .-tow
	.p2align 4
	.globl	tor
	.type	tor, @function
tor:
.LFB39:
	.cfi_startproc
	endbr64
	movdqu	4(%rdi), %xmm1
	pshufd	$141, %xmm1, %xmm0
	movups	%xmm0, 4(%rdi)
	ret
	.cfi_endproc
.LFE39:
	.size	tor, .-tor
	.p2align 4
	.globl	tol
	.type	tol, @function
tol:
.LFB40:
	.cfi_startproc
	endbr64
	movdqu	4(%rdi), %xmm1
	pshufd	$114, %xmm1, %xmm0
	movups	%xmm0, 4(%rdi)
	ret
	.cfi_endproc
.LFE40:
	.size	tol, .-tol
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%s"
.LC1:
	.string	"North"
.LC2:
	.string	"East"
.LC3:
	.string	"South"
.LC4:
	.string	"West"
.LC5:
	.string	"Right"
.LC6:
	.string	"Left"
.LC7:
	.string	"%d\n"
.LC8:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB41:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	.LC0(%rip), %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movq	%rax, 8(%rsp)
	.p2align 4,,10
	.p2align 3
.L9:
	movq	8(%rsp), %rsi
	leaq	.LC8(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	24(%rsp), %eax
	testl	%eax, %eax
	je	.L35
	movl	$6, %r14d
	movl	$3, %ebp
	movl	$1, %ebx
	movl	$5, 4(%rsp)
	movl	$2, (%rsp)
	movl	$4, %r13d
	movl	$1, %r12d
	jmp	.L27
	.p2align 4,,10
	.p2align 3
.L12:
	cmpl	$1953718597, 30(%rsp)
	je	.L36
.L15:
	cmpl	$1953853267, 30(%rsp)
	je	.L37
.L18:
	cmpl	$1953719639, 30(%rsp)
	je	.L38
.L21:
	cmpl	$1751607634, 30(%rsp)
	je	.L39
.L24:
	cmpl	$1952867660, 30(%rsp)
	je	.L40
.L25:
	movl	$1, %edx
	movl	24(%rsp), %eax
	testl	%edx, %edx
	je	.L41
.L27:
	leal	-1(%rax), %edx
	movl	%edx, 24(%rsp)
	testl	%eax, %eax
	je	.L42
.L28:
	xorl	%eax, %eax
	leaq	30(%rsp), %rsi
	movq	%r15, %rdi
	call	__isoc99_scanf@PLT
	cmpl	$1953656654, 30(%rsp)
	jne	.L12
	cmpw	$104, 34(%rsp)
	jne	.L12
	movl	(%rsp), %ecx
	movl	%ebx, %eax
	movl	%r14d, (%rsp)
	movl	4(%rsp), %r14d
	movl	%eax, 4(%rsp)
	addl	%ecx, %r12d
	cmpl	$1953718597, 30(%rsp)
	movl	%ecx, %ebx
	jne	.L15
	.p2align 4,,10
	.p2align 3
.L36:
	cmpb	$0, 34(%rsp)
	jne	.L15
	addl	%r13d, %r12d
	movl	%ebx, %eax
	cmpl	$1953853267, 30(%rsp)
	movl	%r13d, %ebx
	movl	%r14d, %r13d
	movl	%ebp, %r14d
	movl	%eax, %ebp
	jne	.L18
	.p2align 4,,10
	.p2align 3
.L37:
	cmpw	$104, 34(%rsp)
	jne	.L18
	movl	4(%rsp), %ecx
	movl	%ebx, %eax
	movl	%r14d, 4(%rsp)
	movl	(%rsp), %r14d
	movl	%eax, (%rsp)
	addl	%ecx, %r12d
	cmpl	$1953719639, 30(%rsp)
	movl	%ecx, %ebx
	jne	.L21
	.p2align 4,,10
	.p2align 3
.L38:
	cmpb	$0, 34(%rsp)
	jne	.L21
	addl	%ebp, %r12d
	movl	%ebx, %eax
	cmpl	$1751607634, 30(%rsp)
	movl	%ebp, %ebx
	movl	%r14d, %ebp
	movl	%r13d, %r14d
	movl	%eax, %r13d
	jne	.L24
	.p2align 4,,10
	.p2align 3
.L39:
	cmpw	$116, 34(%rsp)
	jne	.L24
	movl	(%rsp), %eax
	addl	%ebx, %r12d
	cmpl	$1952867660, 30(%rsp)
	movl	%ebp, (%rsp)
	movl	4(%rsp), %ebp
	movl	%r13d, 4(%rsp)
	movl	%eax, %r13d
	jne	.L25
	.p2align 4,,10
	.p2align 3
.L40:
	xorl	%edx, %edx
	cmpb	$0, 34(%rsp)
	jne	.L25
	movl	24(%rsp), %eax
	testl	%edx, %edx
	jne	.L27
	.p2align 4,,10
	.p2align 3
.L41:
	movl	(%rsp), %edx
	movl	%r13d, (%rsp)
	addl	%ebx, %r12d
	movl	4(%rsp), %r13d
	movl	%ebp, 4(%rsp)
	movl	%edx, %ebp
	leal	-1(%rax), %edx
	movl	%edx, 24(%rsp)
	testl	%eax, %eax
	jne	.L28
	.p2align 4,,10
	.p2align 3
.L42:
	movl	%r12d, %edx
	leaq	.LC7(%rip), %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	jmp	.L9
.L35:
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L43
	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
.L43:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE41:
	.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
	.p2align 4
	.globl	tos
	.type	tos, @function
tos:
.LFB35:
	.cfi_startproc
	endbr64
	movq	16(%rdi), %xmm0
	movq	(%rdi), %xmm1
	movdqa	%xmm0, %xmm2
	punpckldq	%xmm1, %xmm0
	punpckldq	%xmm1, %xmm2
	movq	%xmm0, (%rdi)
	pshufd	$14, %xmm2, %xmm2
	movq	%xmm2, 16(%rdi)
	ret
	.cfi_endproc
.LFE35:
	.size	tos, .-tos
	.p2align 4
	.globl	ton
	.type	ton, @function
ton:
.LFB36:
	.cfi_startproc
	endbr64
	movq	(%rdi), %xmm0
	movq	16(%rdi), %xmm1
	movdqa	%xmm0, %xmm2
	punpckldq	%xmm1, %xmm0
	punpckldq	%xmm1, %xmm2
	movq	%xmm0, 16(%rdi)
	pshufd	$14, %xmm2, %xmm2
	movq	%xmm2, (%rdi)
	ret
	.cfi_endproc
.LFE36:
	.size	ton, .-ton
	.p2align 4
	.globl	toe
	.type	toe, @function
toe:
.LFB37:
	.cfi_startproc
	endbr64
	movl	12(%rdi), %eax
	movd	(%rdi), %xmm0
	movd	20(%rdi), %xmm1
	movl	%eax, (%rdi)
	movl	8(%rdi), %eax
	punpckldq	%xmm1, %xmm0
	movl	%eax, 20(%rdi)
	movq	%xmm0, 8(%rdi)
	ret
	.cfi_endproc
.LFE37:
	.size	toe, .-toe
	.p2align 4
	.globl	tow
	.type	tow, @function
tow:
.LFB38:
	.cfi_startproc
	endbr64
	movl	(%rdi), %eax
	movd	20(%rdi), %xmm0
	movl	8(%rdi), %edx
	movd	%eax, %xmm1
	movl	12(%rdi), %eax
	punpckldq	%xmm1, %xmm0
	movl	%edx, (%rdi)
	movl	%eax, 20(%rdi)
	movq	%xmm0, 8(%rdi)
	ret
	.cfi_endproc
.LFE38:
	.size	tow, .-tow
	.p2align 4
	.globl	tor
	.type	tor, @function
tor:
.LFB39:
	.cfi_startproc
	endbr64
	movdqu	4(%rdi), %xmm1
	pshufd	$141, %xmm1, %xmm0
	movups	%xmm0, 4(%rdi)
	ret
	.cfi_endproc
.LFE39:
	.size	tor, .-tor
	.p2align 4
	.globl	tol
	.type	tol, @function
tol:
.LFB40:
	.cfi_startproc
	endbr64
	movdqu	4(%rdi), %xmm1
	pshufd	$114, %xmm1, %xmm0
	movups	%xmm0, 4(%rdi)
	ret
	.cfi_endproc
.LFE40:
	.size	tol, .-tol
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%s"
.LC1:
	.string	"North"
.LC2:
	.string	"East"
.LC3:
	.string	"South"
.LC4:
	.string	"West"
.LC5:
	.string	"Right"
.LC6:
	.string	"Left"
.LC7:
	.string	"%d\n"
.LC8:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB41:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	.LC0(%rip), %r15
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movq	%rax, 8(%rsp)
	.p2align 4,,10
	.p2align 3
.L9:
	movq	8(%rsp), %rsi
	leaq	.LC8(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	24(%rsp), %eax
	testl	%eax, %eax
	je	.L35
	movl	$6, %r14d
	movl	$3, %ebp
	movl	$1, %ebx
	movl	$5, 4(%rsp)
	movl	$2, (%rsp)
	movl	$4, %r13d
	movl	$1, %r12d
	jmp	.L27
	.p2align 4,,10
	.p2align 3
.L12:
	cmpl	$1953718597, 30(%rsp)
	je	.L36
.L15:
	cmpl	$1953853267, 30(%rsp)
	je	.L37
.L18:
	cmpl	$1953719639, 30(%rsp)
	je	.L38
.L21:
	cmpl	$1751607634, 30(%rsp)
	je	.L39
.L24:
	cmpl	$1952867660, 30(%rsp)
	je	.L40
.L25:
	movl	$1, %edx
	movl	24(%rsp), %eax
	testl	%edx, %edx
	je	.L41
.L27:
	leal	-1(%rax), %edx
	movl	%edx, 24(%rsp)
	testl	%eax, %eax
	je	.L42
.L28:
	xorl	%eax, %eax
	leaq	30(%rsp), %rsi
	movq	%r15, %rdi
	call	__isoc99_scanf@PLT
	cmpl	$1953656654, 30(%rsp)
	jne	.L12
	cmpw	$104, 34(%rsp)
	jne	.L12
	movl	(%rsp), %ecx
	movl	%ebx, %eax
	movl	%r14d, (%rsp)
	movl	4(%rsp), %r14d
	movl	%eax, 4(%rsp)
	addl	%ecx, %r12d
	cmpl	$1953718597, 30(%rsp)
	movl	%ecx, %ebx
	jne	.L15
	.p2align 4,,10
	.p2align 3
.L36:
	cmpb	$0, 34(%rsp)
	jne	.L15
	addl	%r13d, %r12d
	movl	%ebx, %eax
	cmpl	$1953853267, 30(%rsp)
	movl	%r13d, %ebx
	movl	%r14d, %r13d
	movl	%ebp, %r14d
	movl	%eax, %ebp
	jne	.L18
	.p2align 4,,10
	.p2align 3
.L37:
	cmpw	$104, 34(%rsp)
	jne	.L18
	movl	4(%rsp), %ecx
	movl	%ebx, %eax
	movl	%r14d, 4(%rsp)
	movl	(%rsp), %r14d
	movl	%eax, (%rsp)
	addl	%ecx, %r12d
	cmpl	$1953719639, 30(%rsp)
	movl	%ecx, %ebx
	jne	.L21
	.p2align 4,,10
	.p2align 3
.L38:
	cmpb	$0, 34(%rsp)
	jne	.L21
	addl	%ebp, %r12d
	movl	%ebx, %eax
	cmpl	$1751607634, 30(%rsp)
	movl	%ebp, %ebx
	movl	%r14d, %ebp
	movl	%r13d, %r14d
	movl	%eax, %r13d
	jne	.L24
	.p2align 4,,10
	.p2align 3
.L39:
	cmpw	$116, 34(%rsp)
	jne	.L24
	movl	(%rsp), %eax
	addl	%ebx, %r12d
	cmpl	$1952867660, 30(%rsp)
	movl	%ebp, (%rsp)
	movl	4(%rsp), %ebp
	movl	%r13d, 4(%rsp)
	movl	%eax, %r13d
	jne	.L25
	.p2align 4,,10
	.p2align 3
.L40:
	xorl	%edx, %edx
	cmpb	$0, 34(%rsp)
	jne	.L25
	movl	24(%rsp), %eax
	testl	%edx, %edx
	jne	.L27
	.p2align 4,,10
	.p2align 3
.L41:
	movl	(%rsp), %edx
	movl	%r13d, (%rsp)
	addl	%ebx, %r12d
	movl	4(%rsp), %r13d
	movl	%ebp, 4(%rsp)
	movl	%edx, %ebp
	leal	-1(%rax), %edx
	movl	%edx, 24(%rsp)
	testl	%eax, %eax
	jne	.L28
	.p2align 4,,10
	.p2align 3
.L42:
	movl	%r12d, %edx
	leaq	.LC7(%rip), %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	jmp	.L9
.L35:
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L43
	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
.L43:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE41:
	.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>
void tos(int a[]){
    int t=a[0];
    a[0]=a[4];
    a[4]=a[5];
    a[5]=a[1];
    a[1]=t;
}
void ton(int a[]){
    int t=a[0];
    a[0]=a[1];
    a[1]=a[5];
    a[5]=a[4];
    a[4]=t;
}
void toe(int a[]){
    int t=a[0];
    a[0]=a[3];
    a[3]=a[5];
    a[5]=a[2];
    a[2]=t;
}
void tow(int a[]){
    int t=a[0];
    a[0]=a[2];
    a[2]=a[5];
    a[5]=a[3];
    a[3]=t;
}
void tor(int a[]){
    int t=a[1];
    a[1]=a[2];
    a[2]=a[4];
    a[4]=a[3];
    a[3]=t;
}
void tol(int a[]){
  int t=a[1];
  a[1]=a[3];
  a[3]=a[4];
  a[4]=a[2];
  a[2]=t;
}
int main(void){
  int a[6],s,i,n;
  char o[10];
  while(scanf("%d",&n),n){
    for(i=0;i<6;i++)
      a[i]=i+1;
    s=1;
    while(n--){
      scanf("%s",o);
      if(strcmp(o,"North")==0){
	ton(a);
	s+=a[0];
      }
      if(strcmp(o,"East")==0){
	toe(a);
	s+=a[0];
      }
      if(strcmp(o,"South")==0){
	tos(a);
	s+=a[0];
      }
      if(strcmp(o,"West")==0){
	tow(a);
	s+=a[0];
      }
      if(strcmp(o,"Right")==0){
	tor(a);
	s+=a[0];
      }
      if(strcmp(o,"Left")==0){
	tol(a);
	s+=a[0];
      }
    }
    printf("%d\n",s);
  }
  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>
void tos(int a[]){
    int t=a[0];
    a[0]=a[4];
    a[4]=a[5];
    a[5]=a[1];
    a[1]=t;
}
void ton(int a[]){
    int t=a[0];
    a[0]=a[1];
    a[1]=a[5];
    a[5]=a[4];
    a[4]=t;
}
void toe(int a[]){
    int t=a[0];
    a[0]=a[3];
    a[3]=a[5];
    a[5]=a[2];
    a[2]=t;
}
void tow(int a[]){
    int t=a[0];
    a[0]=a[2];
    a[2]=a[5];
    a[5]=a[3];
    a[3]=t;
}
void tor(int a[]){
    int t=a[1];
    a[1]=a[2];
    a[2]=a[4];
    a[4]=a[3];
    a[3]=t;
}
void tol(int a[]){
  int t=a[1];
  a[1]=a[3];
  a[3]=a[4];
  a[4]=a[2];
  a[2]=t;
}
int main(void){
  int a[6],s,i,n;
  char o[10];
  while(scanf("%d",&n),n){
    for(i=0;i<6;i++)
      a[i]=i+1;
    s=1;
    while(n--){
      scanf("%s",o);
      if(strcmp(o,"North")==0){
	ton(a);
	s+=a[0];
      }
      if(strcmp(o,"East")==0){
	toe(a);
	s+=a[0];
      }
      if(strcmp(o,"South")==0){
	tos(a);
	s+=a[0];
      }
      if(strcmp(o,"West")==0){
	tow(a);
	s+=a[0];
      }
      if(strcmp(o,"Right")==0){
	tor(a);
	s+=a[0];
      }
      if(strcmp(o,"Left")==0){
	tol(a);
	s+=a[0];
      }
    }
    printf("%d\n",s);
  }
  return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	tos
	.type	tos, @function
tos:
.LFB0:
	.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
	leaq	16(%rax), %rdx
	movq	-24(%rbp), %rax
	movl	20(%rax), %eax
	movl	%eax, (%rdx)
	movq	-24(%rbp), %rax
	leaq	20(%rax), %rdx
	movq	-24(%rbp), %rax
	movl	4(%rax), %eax
	movl	%eax, (%rdx)
	movq	-24(%rbp), %rax
	leaq	4(%rax), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rdx)
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	tos, .-tos
	.globl	ton
	.type	ton, @function
ton:
.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	4(%rax), %edx
	movq	-24(%rbp), %rax
	movl	%edx, (%rax)
	movq	-24(%rbp), %rax
	leaq	4(%rax), %rdx
	movq	-24(%rbp), %rax
	movl	20(%rax), %eax
	movl	%eax, (%rdx)
	movq	-24(%rbp), %rax
	leaq	20(%rax), %rdx
	movq	-24(%rbp), %rax
	movl	16(%rax), %eax
	movl	%eax, (%rdx)
	movq	-24(%rbp), %rax
	leaq	16(%rax), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rdx)
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	ton, .-ton
	.globl	toe
	.type	toe, @function
toe:
.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	(%rax), %eax
	movl	%eax, -4(%rbp)
	movq	-24(%rbp), %rax
	movl	12(%rax), %edx
	movq	-24(%rbp), %rax
	movl	%edx, (%rax)
	movq	-24(%rbp), %rax
	leaq	12(%rax), %rdx
	movq	-24(%rbp), %rax
	movl	20(%rax), %eax
	movl	%eax, (%rdx)
	movq	-24(%rbp), %rax
	leaq	20(%rax), %rdx
	movq	-24(%rbp), %rax
	movl	8(%rax), %eax
	movl	%eax, (%rdx)
	movq	-24(%rbp), %rax
	leaq	8(%rax), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rdx)
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	toe, .-toe
	.globl	tow
	.type	tow, @function
tow:
.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
	leaq	8(%rax), %rdx
	movq	-24(%rbp), %rax
	movl	20(%rax), %eax
	movl	%eax, (%rdx)
	movq	-24(%rbp), %rax
	leaq	20(%rax), %rdx
	movq	-24(%rbp), %rax
	movl	12(%rax), %eax
	movl	%eax, (%rdx)
	movq	-24(%rbp), %rax
	leaq	12(%rax), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rdx)
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.size	tow, .-tow
	.globl	tor
	.type	tor, @function
tor:
.LFB4:
	.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
	leaq	4(%rax), %rdx
	movq	-24(%rbp), %rax
	movl	8(%rax), %eax
	movl	%eax, (%rdx)
	movq	-24(%rbp), %rax
	leaq	8(%rax), %rdx
	movq	-24(%rbp), %rax
	movl	16(%rax), %eax
	movl	%eax, (%rdx)
	movq	-24(%rbp), %rax
	leaq	16(%rax), %rdx
	movq	-24(%rbp), %rax
	movl	12(%rax), %eax
	movl	%eax, (%rdx)
	movq	-24(%rbp), %rax
	leaq	12(%rax), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rdx)
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE4:
	.size	tor, .-tor
	.globl	tol
	.type	tol, @function
tol:
.LFB5:
	.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
	leaq	4(%rax), %rdx
	movq	-24(%rbp), %rax
	movl	12(%rax), %eax
	movl	%eax, (%rdx)
	movq	-24(%rbp), %rax
	leaq	12(%rax), %rdx
	movq	-24(%rbp), %rax
	movl	16(%rax), %eax
	movl	%eax, (%rdx)
	movq	-24(%rbp), %rax
	leaq	16(%rax), %rdx
	movq	-24(%rbp), %rax
	movl	8(%rax), %eax
	movl	%eax, (%rdx)
	movq	-24(%rbp), %rax
	leaq	8(%rax), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rdx)
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE5:
	.size	tol, .-tol
	.section	.rodata
.LC0:
	.string	"%s"
.LC1:
	.string	"North"
.LC2:
	.string	"East"
.LC3:
	.string	"South"
.LC4:
	.string	"West"
.LC5:
	.string	"Right"
.LC6:
	.string	"Left"
.LC7:
	.string	"%d\n"
.LC8:
	.string	"%d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.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
	jmp	.L8
.L18:
	movl	$0, -52(%rbp)
	jmp	.L9
.L10:
	movl	-52(%rbp), %eax
	leal	1(%rax), %edx
	movl	-52(%rbp), %eax
	cltq
	movl	%edx, -48(%rbp,%rax,4)
	addl	$1, -52(%rbp)
.L9:
	cmpl	$5, -52(%rbp)
	jle	.L10
	movl	$1, -56(%rbp)
	jmp	.L11
.L17:
	leaq	-18(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-18(%rbp), %rax
	leaq	.LC1(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L12
	leaq	-48(%rbp), %rax
	movq	%rax, %rdi
	call	ton
	movl	-48(%rbp), %eax
	addl	%eax, -56(%rbp)
.L12:
	leaq	-18(%rbp), %rax
	leaq	.LC2(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L13
	leaq	-48(%rbp), %rax
	movq	%rax, %rdi
	call	toe
	movl	-48(%rbp), %eax
	addl	%eax, -56(%rbp)
.L13:
	leaq	-18(%rbp), %rax
	leaq	.LC3(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L14
	leaq	-48(%rbp), %rax
	movq	%rax, %rdi
	call	tos
	movl	-48(%rbp), %eax
	addl	%eax, -56(%rbp)
.L14:
	leaq	-18(%rbp), %rax
	leaq	.LC4(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L15
	leaq	-48(%rbp), %rax
	movq	%rax, %rdi
	call	tow
	movl	-48(%rbp), %eax
	addl	%eax, -56(%rbp)
.L15:
	leaq	-18(%rbp), %rax
	leaq	.LC5(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L16
	leaq	-48(%rbp), %rax
	movq	%rax, %rdi
	call	tor
	movl	-48(%rbp), %eax
	addl	%eax, -56(%rbp)
.L16:
	leaq	-18(%rbp), %rax
	leaq	.LC6(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L11
	leaq	-48(%rbp), %rax
	movq	%rax, %rdi
	call	tol
	movl	-48(%rbp), %eax
	addl	%eax, -56(%rbp)
.L11:
	movl	-60(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -60(%rbp)
	testl	%eax, %eax
	jne	.L17
	movl	-56(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC7(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L8:
	leaq	-60(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC8(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-60(%rbp), %eax
	testl	%eax, %eax
	jne	.L18
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L20
	call	__stack_chk_fail@PLT
.L20:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.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	tos
	.type	tos, @function
tos:
.LFB0:
	.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
	leaq	16(%rax), %rdx
	movq	-24(%rbp), %rax
	movl	20(%rax), %eax
	movl	%eax, (%rdx)
	movq	-24(%rbp), %rax
	leaq	20(%rax), %rdx
	movq	-24(%rbp), %rax
	movl	4(%rax), %eax
	movl	%eax, (%rdx)
	movq	-24(%rbp), %rax
	leaq	4(%rax), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rdx)
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	tos, .-tos
	.globl	ton
	.type	ton, @function
ton:
.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	4(%rax), %edx
	movq	-24(%rbp), %rax
	movl	%edx, (%rax)
	movq	-24(%rbp), %rax
	leaq	4(%rax), %rdx
	movq	-24(%rbp), %rax
	movl	20(%rax), %eax
	movl	%eax, (%rdx)
	movq	-24(%rbp), %rax
	leaq	20(%rax), %rdx
	movq	-24(%rbp), %rax
	movl	16(%rax), %eax
	movl	%eax, (%rdx)
	movq	-24(%rbp), %rax
	leaq	16(%rax), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rdx)
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	ton, .-ton
	.globl	toe
	.type	toe, @function
toe:
.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	(%rax), %eax
	movl	%eax, -4(%rbp)
	movq	-24(%rbp), %rax
	movl	12(%rax), %edx
	movq	-24(%rbp), %rax
	movl	%edx, (%rax)
	movq	-24(%rbp), %rax
	leaq	12(%rax), %rdx
	movq	-24(%rbp), %rax
	movl	20(%rax), %eax
	movl	%eax, (%rdx)
	movq	-24(%rbp), %rax
	leaq	20(%rax), %rdx
	movq	-24(%rbp), %rax
	movl	8(%rax), %eax
	movl	%eax, (%rdx)
	movq	-24(%rbp), %rax
	leaq	8(%rax), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rdx)
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	toe, .-toe
	.globl	tow
	.type	tow, @function
tow:
.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
	leaq	8(%rax), %rdx
	movq	-24(%rbp), %rax
	movl	20(%rax), %eax
	movl	%eax, (%rdx)
	movq	-24(%rbp), %rax
	leaq	20(%rax), %rdx
	movq	-24(%rbp), %rax
	movl	12(%rax), %eax
	movl	%eax, (%rdx)
	movq	-24(%rbp), %rax
	leaq	12(%rax), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rdx)
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.size	tow, .-tow
	.globl	tor
	.type	tor, @function
tor:
.LFB4:
	.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
	leaq	4(%rax), %rdx
	movq	-24(%rbp), %rax
	movl	8(%rax), %eax
	movl	%eax, (%rdx)
	movq	-24(%rbp), %rax
	leaq	8(%rax), %rdx
	movq	-24(%rbp), %rax
	movl	16(%rax), %eax
	movl	%eax, (%rdx)
	movq	-24(%rbp), %rax
	leaq	16(%rax), %rdx
	movq	-24(%rbp), %rax
	movl	12(%rax), %eax
	movl	%eax, (%rdx)
	movq	-24(%rbp), %rax
	leaq	12(%rax), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rdx)
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE4:
	.size	tor, .-tor
	.globl	tol
	.type	tol, @function
tol:
.LFB5:
	.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
	leaq	4(%rax), %rdx
	movq	-24(%rbp), %rax
	movl	12(%rax), %eax
	movl	%eax, (%rdx)
	movq	-24(%rbp), %rax
	leaq	12(%rax), %rdx
	movq	-24(%rbp), %rax
	movl	16(%rax), %eax
	movl	%eax, (%rdx)
	movq	-24(%rbp), %rax
	leaq	16(%rax), %rdx
	movq	-24(%rbp), %rax
	movl	8(%rax), %eax
	movl	%eax, (%rdx)
	movq	-24(%rbp), %rax
	leaq	8(%rax), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rdx)
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE5:
	.size	tol, .-tol
	.section	.rodata
.LC0:
	.string	"%s"
.LC1:
	.string	"North"
.LC2:
	.string	"East"
.LC3:
	.string	"South"
.LC4:
	.string	"West"
.LC5:
	.string	"Right"
.LC6:
	.string	"Left"
.LC7:
	.string	"%d\n"
.LC8:
	.string	"%d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.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
	jmp	.L8
.L18:
	movl	$0, -52(%rbp)
	jmp	.L9
.L10:
	movl	-52(%rbp), %eax
	leal	1(%rax), %edx
	movl	-52(%rbp), %eax
	cltq
	movl	%edx, -48(%rbp,%rax,4)
	addl	$1, -52(%rbp)
.L9:
	cmpl	$5, -52(%rbp)
	jle	.L10
	movl	$1, -56(%rbp)
	jmp	.L11
.L17:
	leaq	-18(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-18(%rbp), %rax
	leaq	.LC1(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L12
	leaq	-48(%rbp), %rax
	movq	%rax, %rdi
	call	ton
	movl	-48(%rbp), %eax
	addl	%eax, -56(%rbp)
.L12:
	leaq	-18(%rbp), %rax
	leaq	.LC2(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L13
	leaq	-48(%rbp), %rax
	movq	%rax, %rdi
	call	toe
	movl	-48(%rbp), %eax
	addl	%eax, -56(%rbp)
.L13:
	leaq	-18(%rbp), %rax
	leaq	.LC3(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L14
	leaq	-48(%rbp), %rax
	movq	%rax, %rdi
	call	tos
	movl	-48(%rbp), %eax
	addl	%eax, -56(%rbp)
.L14:
	leaq	-18(%rbp), %rax
	leaq	.LC4(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L15
	leaq	-48(%rbp), %rax
	movq	%rax, %rdi
	call	tow
	movl	-48(%rbp), %eax
	addl	%eax, -56(%rbp)
.L15:
	leaq	-18(%rbp), %rax
	leaq	.LC5(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L16
	leaq	-48(%rbp), %rax
	movq	%rax, %rdi
	call	tor
	movl	-48(%rbp), %eax
	addl	%eax, -56(%rbp)
.L16:
	leaq	-18(%rbp), %rax
	leaq	.LC6(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L11
	leaq	-48(%rbp), %rax
	movq	%rax, %rdi
	call	tol
	movl	-48(%rbp), %eax
	addl	%eax, -56(%rbp)
.L11:
	movl	-60(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -60(%rbp)
	testl	%eax, %eax
	jne	.L17
	movl	-56(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC7(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L8:
	leaq	-60(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC8(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-60(%rbp), %eax
	testl	%eax, %eax
	jne	.L18
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L20
	call	__stack_chk_fail@PLT
.L20:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.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:
