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

```c
#include<stdio.h>
#define M 1000000
int main(){
  int X[]={0,1,0,-1};
  int Y[]={1,0,-1,0};
  int w,h,d,a,x,y;
  char s;
  while(scanf("%d %d",&w,&h),w||h){
    d=0;
    x=y=1;
    while(scanf(" %c%*s",&s)){
      if(s=='F'){
	scanf("%d",&a);
	x+=X[d]*a;
	y+=Y[d]*a;
      }
      if(s=='B'){
	scanf("%d",&a);
	x-=X[d]*a;
	y-=Y[d]*a;
      }
      if(s=='L')d--;
      if(s=='R')d++;
      if(s=='S'){
	printf("%d %d\n",x,y);
	break;
      }
      d+=4;
      d%=4;
      if(x<1)x=1;
      if(w<x)x=w;
      if(y<1)y=1;
      if(h<y)y=h;
    }
  }
  return 0;
}

      ```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC2:
	.string	"%d"
.LC3:
	.string	"%d %d\n"
.LC4:
	.string	" %c%*s"
.LC5:
	.string	"%d %d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	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
	leaq	.LC2(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	leaq	.LC4(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$88, %rsp
	.cfi_def_cfa_offset 144
	movdqa	.LC0(%rip), %xmm0
	movq	%fs:40, %rax
	movq	%rax, 72(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movq	%rax, 8(%rsp)
	leaq	20(%rsp), %rax
	movaps	%xmm0, 32(%rsp)
	movdqa	.LC1(%rip), %xmm0
	movq	%rax, (%rsp)
	movaps	%xmm0, 48(%rsp)
	.p2align 4,,10
	.p2align 3
.L2:
	leaq	19(%rsp), %rbx
.L10:
	movq	8(%rsp), %rdx
	movq	(%rsp), %rsi
	xorl	%eax, %eax
	leaq	.LC5(%rip), %rdi
	call	__isoc99_scanf@PLT
	movl	20(%rsp), %eax
	orl	24(%rsp), %eax
	je	.L16
	movl	$1, %r14d
	movl	$1, %r13d
	xorl	%r15d, %r15d
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L5:
	cmpb	$82, %al
	je	.L7
	cmpb	$83, %al
	je	.L17
.L6:
	andl	$3, %r15d
	movl	$1, %eax
	testl	%r13d, %r13d
	movl	20(%rsp), %edx
	cmovg	%r13d, %eax
	movl	24(%rsp), %ecx
	cmpl	%edx, %eax
	cmovle	%eax, %edx
	testl	%r14d, %r14d
	movl	$1, %eax
	cmovg	%r14d, %eax
	movl	%edx, %r13d
	cmpl	%ecx, %eax
	cmovle	%eax, %ecx
	movl	%ecx, %r14d
.L11:
	xorl	%eax, %eax
	movq	%rbx, %rsi
	movq	%rbp, %rdi
	call	__isoc99_scanf@PLT
	testl	%eax, %eax
	je	.L10
	movzbl	19(%rsp), %eax
	cmpb	$70, %al
	je	.L18
.L3:
	cmpb	$66, %al
	je	.L19
.L4:
	cmpb	$76, %al
	jne	.L5
	subl	$1, %r15d
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L7:
	addl	$1, %r15d
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L19:
	leaq	28(%rsp), %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	%r15d, %rsi
	movl	28(%rsp), %eax
	movl	32(%rsp,%rsi,4), %edi
	imull	%eax, %edi
	imull	48(%rsp,%rsi,4), %eax
	subl	%edi, %r13d
	subl	%eax, %r14d
	movzbl	19(%rsp), %eax
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L18:
	leaq	28(%rsp), %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	%r15d, %rsi
	movl	28(%rsp), %eax
	movl	32(%rsp,%rsi,4), %edi
	imull	%eax, %edi
	imull	48(%rsp,%rsi,4), %eax
	addl	%edi, %r13d
	addl	%eax, %r14d
	movzbl	19(%rsp), %eax
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L17:
	movl	%r14d, %ecx
	movl	%r13d, %edx
	leaq	.LC3(%rip), %rsi
	xorl	%eax, %eax
	movl	$1, %edi
	call	__printf_chk@PLT
	jmp	.L2
.L16:
	movq	72(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L20
	addq	$88, %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
.L20:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.long	0
	.long	1
	.long	0
	.long	-1
	.align 16
.LC1:
	.long	1
	.long	0
	.long	-1
	.long	0
	.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.
Optimized Assembly Code:

user
```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC2:
	.string	"%d"
.LC3:
	.string	"%d %d\n"
.LC4:
	.string	" %c%*s"
.LC5:
	.string	"%d %d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	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
	leaq	.LC2(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	leaq	.LC4(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$88, %rsp
	.cfi_def_cfa_offset 144
	movdqa	.LC0(%rip), %xmm0
	movq	%fs:40, %rax
	movq	%rax, 72(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movq	%rax, 8(%rsp)
	leaq	20(%rsp), %rax
	movaps	%xmm0, 32(%rsp)
	movdqa	.LC1(%rip), %xmm0
	movq	%rax, (%rsp)
	movaps	%xmm0, 48(%rsp)
	.p2align 4,,10
	.p2align 3
.L2:
	leaq	19(%rsp), %rbx
.L10:
	movq	8(%rsp), %rdx
	movq	(%rsp), %rsi
	xorl	%eax, %eax
	leaq	.LC5(%rip), %rdi
	call	__isoc99_scanf@PLT
	movl	20(%rsp), %eax
	orl	24(%rsp), %eax
	je	.L16
	movl	$1, %r14d
	movl	$1, %r13d
	xorl	%r15d, %r15d
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L5:
	cmpb	$82, %al
	je	.L7
	cmpb	$83, %al
	je	.L17
.L6:
	andl	$3, %r15d
	movl	$1, %eax
	testl	%r13d, %r13d
	movl	20(%rsp), %edx
	cmovg	%r13d, %eax
	movl	24(%rsp), %ecx
	cmpl	%edx, %eax
	cmovle	%eax, %edx
	testl	%r14d, %r14d
	movl	$1, %eax
	cmovg	%r14d, %eax
	movl	%edx, %r13d
	cmpl	%ecx, %eax
	cmovle	%eax, %ecx
	movl	%ecx, %r14d
.L11:
	xorl	%eax, %eax
	movq	%rbx, %rsi
	movq	%rbp, %rdi
	call	__isoc99_scanf@PLT
	testl	%eax, %eax
	je	.L10
	movzbl	19(%rsp), %eax
	cmpb	$70, %al
	je	.L18
.L3:
	cmpb	$66, %al
	je	.L19
.L4:
	cmpb	$76, %al
	jne	.L5
	subl	$1, %r15d
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L7:
	addl	$1, %r15d
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L19:
	leaq	28(%rsp), %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	%r15d, %rsi
	movl	28(%rsp), %eax
	movl	32(%rsp,%rsi,4), %edi
	imull	%eax, %edi
	imull	48(%rsp,%rsi,4), %eax
	subl	%edi, %r13d
	subl	%eax, %r14d
	movzbl	19(%rsp), %eax
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L18:
	leaq	28(%rsp), %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	%r15d, %rsi
	movl	28(%rsp), %eax
	movl	32(%rsp,%rsi,4), %edi
	imull	%eax, %edi
	imull	48(%rsp,%rsi,4), %eax
	addl	%edi, %r13d
	addl	%eax, %r14d
	movzbl	19(%rsp), %eax
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L17:
	movl	%r14d, %ecx
	movl	%r13d, %edx
	leaq	.LC3(%rip), %rsi
	xorl	%eax, %eax
	movl	$1, %edi
	call	__printf_chk@PLT
	jmp	.L2
.L16:
	movq	72(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L20
	addq	$88, %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
.L20:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.long	0
	.long	1
	.long	0
	.long	-1
	.align 16
.LC1:
	.long	1
	.long	0
	.long	-1
	.long	0
	.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
```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC2:
	.string	"%d"
.LC3:
	.string	"%d %d\n"
.LC4:
	.string	" %c%*s"
.LC5:
	.string	"%d %d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	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
	leaq	.LC2(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	leaq	.LC4(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$88, %rsp
	.cfi_def_cfa_offset 144
	movdqa	.LC0(%rip), %xmm0
	movq	%fs:40, %rax
	movq	%rax, 72(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movq	%rax, 8(%rsp)
	leaq	20(%rsp), %rax
	movaps	%xmm0, 32(%rsp)
	movdqa	.LC1(%rip), %xmm0
	movq	%rax, (%rsp)
	movaps	%xmm0, 48(%rsp)
	.p2align 4,,10
	.p2align 3
.L2:
	leaq	19(%rsp), %rbx
.L10:
	movq	8(%rsp), %rdx
	movq	(%rsp), %rsi
	xorl	%eax, %eax
	leaq	.LC5(%rip), %rdi
	call	__isoc99_scanf@PLT
	movl	20(%rsp), %eax
	orl	24(%rsp), %eax
	je	.L16
	movl	$1, %r14d
	movl	$1, %r13d
	xorl	%r15d, %r15d
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L5:
	cmpb	$82, %al
	je	.L7
	cmpb	$83, %al
	je	.L17
.L6:
	andl	$3, %r15d
	movl	$1, %eax
	testl	%r13d, %r13d
	movl	20(%rsp), %edx
	cmovg	%r13d, %eax
	movl	24(%rsp), %ecx
	cmpl	%edx, %eax
	cmovle	%eax, %edx
	testl	%r14d, %r14d
	movl	$1, %eax
	cmovg	%r14d, %eax
	movl	%edx, %r13d
	cmpl	%ecx, %eax
	cmovle	%eax, %ecx
	movl	%ecx, %r14d
.L11:
	xorl	%eax, %eax
	movq	%rbx, %rsi
	movq	%rbp, %rdi
	call	__isoc99_scanf@PLT
	testl	%eax, %eax
	je	.L10
	movzbl	19(%rsp), %eax
	cmpb	$70, %al
	je	.L18
.L3:
	cmpb	$66, %al
	je	.L19
.L4:
	cmpb	$76, %al
	jne	.L5
	subl	$1, %r15d
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L7:
	addl	$1, %r15d
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L19:
	leaq	28(%rsp), %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	%r15d, %rsi
	movl	28(%rsp), %eax
	movl	32(%rsp,%rsi,4), %edi
	imull	%eax, %edi
	imull	48(%rsp,%rsi,4), %eax
	subl	%edi, %r13d
	subl	%eax, %r14d
	movzbl	19(%rsp), %eax
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L18:
	leaq	28(%rsp), %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	%r15d, %rsi
	movl	28(%rsp), %eax
	movl	32(%rsp,%rsi,4), %edi
	imull	%eax, %edi
	imull	48(%rsp,%rsi,4), %eax
	addl	%edi, %r13d
	addl	%eax, %r14d
	movzbl	19(%rsp), %eax
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L17:
	movl	%r14d, %ecx
	movl	%r13d, %edx
	leaq	.LC3(%rip), %rsi
	xorl	%eax, %eax
	movl	$1, %edi
	call	__printf_chk@PLT
	jmp	.L2
.L16:
	movq	72(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L20
	addq	$88, %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
.L20:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.long	0
	.long	1
	.long	0
	.long	-1
	.align 16
.LC1:
	.long	1
	.long	0
	.long	-1
	.long	0
	.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:
```
```c
#include<stdio.h>
#define M 1000000
int main(){
  int X[]={0,1,0,-1};
  int Y[]={1,0,-1,0};
  int w,h,d,a,x,y;
  char s;
  while(scanf("%d %d",&w,&h),w||h){
    d=0;
    x=y=1;
    while(scanf(" %c%*s",&s)){
      if(s=='F'){
	scanf("%d",&a);
	x+=X[d]*a;
	y+=Y[d]*a;
      }
      if(s=='B'){
	scanf("%d",&a);
	x-=X[d]*a;
	y-=Y[d]*a;
      }
      if(s=='L')d--;
      if(s=='R')d++;
      if(s=='S'){
	printf("%d %d\n",x,y);
	break;
      }
      d+=4;
      d%=4;
      if(x<1)x=1;
      if(w<x)x=w;
      if(y<1)y=1;
      if(h<y)y=h;
    }
  }
  return 0;
}

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

```c
#include<stdio.h>
#define M 1000000
int main(){
  int X[]={0,1,0,-1};
  int Y[]={1,0,-1,0};
  int w,h,d,a,x,y;
  char s;
  while(scanf("%d %d",&w,&h),w||h){
    d=0;
    x=y=1;
    while(scanf(" %c%*s",&s)){
      if(s=='F'){
	scanf("%d",&a);
	x+=X[d]*a;
	y+=Y[d]*a;
      }
      if(s=='B'){
	scanf("%d",&a);
	x-=X[d]*a;
	y-=Y[d]*a;
      }
      if(s=='L')d--;
      if(s=='R')d++;
      if(s=='S'){
	printf("%d %d\n",x,y);
	break;
      }
      d+=4;
      d%=4;
      if(x<1)x=1;
      if(w<x)x=w;
      if(y<1)y=1;
      if(h<y)y=h;
    }
  }
  return 0;
}

      ```

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.
Optimized Assembly Code:

6 5
FORWARD 3
RIGHT
FORWARD 5
LEFT
BACKWARD 2
STOP
5 1
FORWARD 2
STOP
0 0
 6 5
FORWARD 3
RIGHT
FORWARD 5
LEFT
BACKWARD 3
STOP
3 1
FORWARD 2
STOP
0 0
 6 6
FORDARW 1
RIGHT
FORWARD 5
LEFT
BACKWARD 3
STOP
3 2
FORWARD 2
STOP
0 0

6 2
1 1
 6 1
1 1
 6 1
1 2

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

```c
#include<stdio.h>
#define M 1000000
int main(){
  int X[]={0,1,0,-1};
  int Y[]={1,0,-1,0};
  int w,h,d,a,x,y;
  char s;
  while(scanf("%d %d",&w,&h),w||h){
    d=0;
    x=y=1;
    while(scanf(" %c%*s",&s)){
      if(s=='F'){
	scanf("%d",&a);
	x+=X[d]*a;
	y+=Y[d]*a;
      }
      if(s=='B'){
	scanf("%d",&a);
	x-=X[d]*a;
	y-=Y[d]*a;
      }
      if(s=='L')d--;
      if(s=='R')d++;
      if(s=='S'){
	printf("%d %d\n",x,y);
	break;
      }
      d+=4;
      d%=4;
      if(x<1)x=1;
      if(w<x)x=w;
      if(y<1)y=1;
      if(h<y)y=h;
    }
  }
  return 0;
}

      ```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC2:
	.string	"%d"
.LC3:
	.string	"%d %d\n"
.LC4:
	.string	" %c%*s"
.LC5:
	.string	"%d %d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	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
	leaq	.LC2(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	leaq	.LC4(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$88, %rsp
	.cfi_def_cfa_offset 144
	movdqa	.LC0(%rip), %xmm0
	movq	%fs:40, %rax
	movq	%rax, 72(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movq	%rax, 8(%rsp)
	leaq	20(%rsp), %rax
	movaps	%xmm0, 32(%rsp)
	movdqa	.LC1(%rip), %xmm0
	movq	%rax, (%rsp)
	movaps	%xmm0, 48(%rsp)
	.p2align 4,,10
	.p2align 3
.L2:
	leaq	19(%rsp), %rbx
.L10:
	movq	8(%rsp), %rdx
	movq	(%rsp), %rsi
	xorl	%eax, %eax
	leaq	.LC5(%rip), %rdi
	call	__isoc99_scanf@PLT
	movl	20(%rsp), %eax
	orl	24(%rsp), %eax
	je	.L16
	movl	$1, %r14d
	movl	$1, %r13d
	xorl	%r15d, %r15d
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L5:
	cmpb	$82, %al
	je	.L7
	cmpb	$83, %al
	je	.L17
.L6:
	andl	$3, %r15d
	movl	$1, %eax
	testl	%r13d, %r13d
	movl	20(%rsp), %edx
	cmovg	%r13d, %eax
	movl	24(%rsp), %ecx
	cmpl	%edx, %eax
	cmovle	%eax, %edx
	testl	%r14d, %r14d
	movl	$1, %eax
	cmovg	%r14d, %eax
	movl	%edx, %r13d
	cmpl	%ecx, %eax
	cmovle	%eax, %ecx
	movl	%ecx, %r14d
.L11:
	xorl	%eax, %eax
	movq	%rbx, %rsi
	movq	%rbp, %rdi
	call	__isoc99_scanf@PLT
	testl	%eax, %eax
	je	.L10
	movzbl	19(%rsp), %eax
	cmpb	$70, %al
	je	.L18
.L3:
	cmpb	$66, %al
	je	.L19
.L4:
	cmpb	$76, %al
	jne	.L5
	subl	$1, %r15d
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L7:
	addl	$1, %r15d
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L19:
	leaq	28(%rsp), %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	%r15d, %rsi
	movl	28(%rsp), %eax
	movl	32(%rsp,%rsi,4), %edi
	imull	%eax, %edi
	imull	48(%rsp,%rsi,4), %eax
	subl	%edi, %r13d
	subl	%eax, %r14d
	movzbl	19(%rsp), %eax
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L18:
	leaq	28(%rsp), %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	%r15d, %rsi
	movl	28(%rsp), %eax
	movl	32(%rsp,%rsi,4), %edi
	imull	%eax, %edi
	imull	48(%rsp,%rsi,4), %eax
	addl	%edi, %r13d
	addl	%eax, %r14d
	movzbl	19(%rsp), %eax
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L17:
	movl	%r14d, %ecx
	movl	%r13d, %edx
	leaq	.LC3(%rip), %rsi
	xorl	%eax, %eax
	movl	$1, %edi
	call	__printf_chk@PLT
	jmp	.L2
.L16:
	movq	72(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L20
	addq	$88, %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
.L20:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.long	0
	.long	1
	.long	0
	.long	-1
	.align 16
.LC1:
	.long	1
	.long	0
	.long	-1
	.long	0
	.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.
Optimized Assembly Code:

train
```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC2:
	.string	"%d"
.LC3:
	.string	"%d %d\n"
.LC4:
	.string	" %c%*s"
.LC5:
	.string	"%d %d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	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
	leaq	.LC2(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	leaq	.LC4(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$88, %rsp
	.cfi_def_cfa_offset 144
	movdqa	.LC0(%rip), %xmm0
	movq	%fs:40, %rax
	movq	%rax, 72(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rax
	movq	%rax, 8(%rsp)
	leaq	20(%rsp), %rax
	movaps	%xmm0, 32(%rsp)
	movdqa	.LC1(%rip), %xmm0
	movq	%rax, (%rsp)
	movaps	%xmm0, 48(%rsp)
	.p2align 4,,10
	.p2align 3
.L2:
	leaq	19(%rsp), %rbx
.L10:
	movq	8(%rsp), %rdx
	movq	(%rsp), %rsi
	xorl	%eax, %eax
	leaq	.LC5(%rip), %rdi
	call	__isoc99_scanf@PLT
	movl	20(%rsp), %eax
	orl	24(%rsp), %eax
	je	.L16
	movl	$1, %r14d
	movl	$1, %r13d
	xorl	%r15d, %r15d
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L5:
	cmpb	$82, %al
	je	.L7
	cmpb	$83, %al
	je	.L17
.L6:
	andl	$3, %r15d
	movl	$1, %eax
	testl	%r13d, %r13d
	movl	20(%rsp), %edx
	cmovg	%r13d, %eax
	movl	24(%rsp), %ecx
	cmpl	%edx, %eax
	cmovle	%eax, %edx
	testl	%r14d, %r14d
	movl	$1, %eax
	cmovg	%r14d, %eax
	movl	%edx, %r13d
	cmpl	%ecx, %eax
	cmovle	%eax, %ecx
	movl	%ecx, %r14d
.L11:
	xorl	%eax, %eax
	movq	%rbx, %rsi
	movq	%rbp, %rdi
	call	__isoc99_scanf@PLT
	testl	%eax, %eax
	je	.L10
	movzbl	19(%rsp), %eax
	cmpb	$70, %al
	je	.L18
.L3:
	cmpb	$66, %al
	je	.L19
.L4:
	cmpb	$76, %al
	jne	.L5
	subl	$1, %r15d
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L7:
	addl	$1, %r15d
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L19:
	leaq	28(%rsp), %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	%r15d, %rsi
	movl	28(%rsp), %eax
	movl	32(%rsp,%rsi,4), %edi
	imull	%eax, %edi
	imull	48(%rsp,%rsi,4), %eax
	subl	%edi, %r13d
	subl	%eax, %r14d
	movzbl	19(%rsp), %eax
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L18:
	leaq	28(%rsp), %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	%r15d, %rsi
	movl	28(%rsp), %eax
	movl	32(%rsp,%rsi,4), %edi
	imull	%eax, %edi
	imull	48(%rsp,%rsi,4), %eax
	addl	%edi, %r13d
	addl	%eax, %r14d
	movzbl	19(%rsp), %eax
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L17:
	movl	%r14d, %ecx
	movl	%r13d, %edx
	leaq	.LC3(%rip), %rsi
	xorl	%eax, %eax
	movl	$1, %edi
	call	__printf_chk@PLT
	jmp	.L2
.L16:
	movq	72(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L20
	addq	$88, %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
.L20:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.long	0
	.long	1
	.long	0
	.long	-1
	.align 16
.LC1:
	.long	1
	.long	0
	.long	-1
	.long	0
	.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:
```