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

```c
#include <math.h>
// r:グー s:チョキ p:パー
int main(){
  int N,K,R,S,P,i;
  char T[100002];
  scanf("%d %d",&N,&K);
  scanf("%d %d %d",&R,&S,&P);
  scanf("%s",T);
  int A[100002] = {0};
  int tmp = 0;
  for(i=0; i<N; i++){
    // 全部勝った場合の得点を計算
    if(T[i]=='r'){
      if(i>=K&&T[i-K]=='r'){
		T[i] = '0';
      }else{
        tmp += P;
        A[i] = tmp; 
      }
    }else if(T[i]=='s'){
      if(i>=K&&T[i-K]=='s'){
		T[i] = '0';
      }else{
        tmp += R;
        A[i] = tmp; 
      }
    }else if(T[i]=='p'){
      if(i>=K&&T[i-K]=='p'){
        T[i] = '0';
      }else{
        tmp += S;
        A[i] = tmp;
      }
    }
  }
  printf("%d\n",tmp);
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d %d %d"
.LC2:
	.string	"%s"
.LC3:
	.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
	leaq	-499712(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$352, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-500056(%rbp), %rdx
	leaq	-500060(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	leaq	-500044(%rbp), %rcx
	leaq	-500048(%rbp), %rdx
	leaq	-500052(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	leaq	-100016(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	leaq	-500032(%rbp), %rax
	movl	$400008, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, -500036(%rbp)
	movl	$0, -500040(%rbp)
	jmp	.L2
.L11:
	movl	-500040(%rbp), %eax
	cltq
	movzbl	-100016(%rbp,%rax), %eax
	cmpb	$114, %al
	jne	.L3
	movl	-500056(%rbp), %eax
	cmpl	%eax, -500040(%rbp)
	jl	.L4
	movl	-500056(%rbp), %edx
	movl	-500040(%rbp), %eax
	subl	%edx, %eax
	cltq
	movzbl	-100016(%rbp,%rax), %eax
	cmpb	$114, %al
	jne	.L4
	movl	-500040(%rbp), %eax
	cltq
	movb	$48, -100016(%rbp,%rax)
	jmp	.L6
.L4:
	movl	-500044(%rbp), %eax
	addl	%eax, -500036(%rbp)
	movl	-500040(%rbp), %eax
	cltq
	movl	-500036(%rbp), %edx
	movl	%edx, -500032(%rbp,%rax,4)
	jmp	.L6
.L3:
	movl	-500040(%rbp), %eax
	cltq
	movzbl	-100016(%rbp,%rax), %eax
	cmpb	$115, %al
	jne	.L7
	movl	-500056(%rbp), %eax
	cmpl	%eax, -500040(%rbp)
	jl	.L8
	movl	-500056(%rbp), %edx
	movl	-500040(%rbp), %eax
	subl	%edx, %eax
	cltq
	movzbl	-100016(%rbp,%rax), %eax
	cmpb	$115, %al
	jne	.L8
	movl	-500040(%rbp), %eax
	cltq
	movb	$48, -100016(%rbp,%rax)
	jmp	.L6
.L8:
	movl	-500052(%rbp), %eax
	addl	%eax, -500036(%rbp)
	movl	-500040(%rbp), %eax
	cltq
	movl	-500036(%rbp), %edx
	movl	%edx, -500032(%rbp,%rax,4)
	jmp	.L6
.L7:
	movl	-500040(%rbp), %eax
	cltq
	movzbl	-100016(%rbp,%rax), %eax
	cmpb	$112, %al
	jne	.L6
	movl	-500056(%rbp), %eax
	cmpl	%eax, -500040(%rbp)
	jl	.L10
	movl	-500056(%rbp), %edx
	movl	-500040(%rbp), %eax
	subl	%edx, %eax
	cltq
	movzbl	-100016(%rbp,%rax), %eax
	cmpb	$112, %al
	jne	.L10
	movl	-500040(%rbp), %eax
	cltq
	movb	$48, -100016(%rbp,%rax)
	jmp	.L6
.L10:
	movl	-500048(%rbp), %eax
	addl	%eax, -500036(%rbp)
	movl	-500040(%rbp), %eax
	cltq
	movl	-500036(%rbp), %edx
	movl	%edx, -500032(%rbp,%rax,4)
.L6:
	addl	$1, -500040(%rbp)
.L2:
	movl	-500060(%rbp), %eax
	cmpl	%eax, -500040(%rbp)
	jl	.L11
	movl	-500036(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L13
	call	__stack_chk_fail@PLT
.L13:
	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 %d"
.LC1:
	.string	"%d %d %d"
.LC2:
	.string	"%s"
.LC3:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB0:
	.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
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	leaq	-98304(%rsp), %r11
	.cfi_def_cfa 11, 98336
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$1744, %rsp
	.cfi_def_cfa_offset 100080
	leaq	.LC0(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 100040(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %rdx
	leaq	12(%rsp), %rsi
	leaq	32(%rsp), %rbx
	call	scanf@PLT
	leaq	28(%rsp), %rcx
	xorl	%eax, %eax
	leaq	24(%rsp), %rdx
	leaq	20(%rsp), %rsi
	leaq	.LC1(%rip), %rdi
	call	scanf@PLT
	movq	%rbx, %rsi
	leaq	.LC2(%rip), %rdi
	xorl	%eax, %eax
	call	scanf@PLT
	movl	12(%rsp), %r9d
	testl	%r9d, %r9d
	jle	.L19
	movl	16(%rsp), %r8d
	movl	24(%rsp), %r12d
	movl	20(%rsp), %ebp
	movl	28(%rsp), %r11d
	testl	%r8d, %r8d
	jle	.L20
	cmpl	%r9d, %r8d
	movl	%r9d, %r10d
	movl	%r8d, %edi
	movq	%rbx, %rdx
	cmovle	%r8d, %r10d
	negl	%edi
	xorl	%esi, %esi
	xorl	%eax, %eax
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L4:
	cmpb	$115, %cl
	je	.L27
	cmpb	$112, %cl
	je	.L28
.L6:
	addl	$1, %eax
	addq	$1, %rdx
	addl	$1, %edi
	cmpl	%r10d, %eax
	jge	.L29
.L9:
	movzbl	(%rdx), %ecx
	cmpb	$114, %cl
	jne	.L4
	cmpl	%eax, %r8d
	jg	.L5
	movslq	%edi, %rcx
	cmpb	$114, 32(%rsp,%rcx)
	je	.L24
.L5:
	addl	$1, %eax
	addl	%r11d, %esi
	addq	$1, %rdx
	addl	$1, %edi
	cmpl	%r10d, %eax
	jl	.L9
.L29:
	cmpl	%r9d, %eax
	jl	.L3
	.p2align 4,,10
	.p2align 3
.L2:
	xorl	%eax, %eax
	leaq	.LC3(%rip), %rdi
	call	printf@PLT
	movq	100040(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L30
	addq	$100048, %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
	.p2align 4,,10
	.p2align 3
.L27:
	.cfi_restore_state
	addl	%ebp, %esi
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L28:
	cmpl	%eax, %r8d
	jg	.L8
	movslq	%edi, %rcx
	cmpb	$112, 32(%rsp,%rcx)
	je	.L24
.L8:
	addl	%r12d, %esi
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L24:
	movb	$48, (%rdx)
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L20:
	xorl	%esi, %esi
	xorl	%eax, %eax
.L3:
	movslq	%eax, %rdx
	movl	%eax, %edi
	addq	%rbx, %rdx
	subl	%r8d, %edi
	jmp	.L16
	.p2align 4,,10
	.p2align 3
.L10:
	cmpb	$115, %cl
	je	.L31
	cmpb	$112, %cl
	je	.L32
.L12:
	addl	$1, %eax
	addq	$1, %rdx
	addl	$1, %edi
	cmpl	%eax, %r9d
	jle	.L2
.L16:
	movzbl	(%rdx), %ecx
	cmpb	$114, %cl
	jne	.L10
	cmpl	%r8d, %eax
	jl	.L11
	movslq	%edi, %rcx
	cmpb	$114, 32(%rsp,%rcx)
	je	.L25
.L11:
	addl	%r11d, %esi
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L32:
	cmpl	%r8d, %eax
	jl	.L15
	movslq	%edi, %rcx
	cmpb	$112, 32(%rsp,%rcx)
	je	.L25
.L15:
	addl	%r12d, %esi
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L25:
	movb	$48, (%rdx)
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L31:
	movslq	%edi, %rcx
	cmpb	$115, 32(%rsp,%rcx)
	je	.L25
	addl	%ebp, %esi
	jmp	.L12
.L19:
	xorl	%esi, %esi
	jmp	.L2
.L30:
	call	__stack_chk_fail@PLT
	.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:

rule
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d %d %d"
.LC2:
	.string	"%s"
.LC3:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB0:
	.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
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	leaq	-98304(%rsp), %r11
	.cfi_def_cfa 11, 98336
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$1744, %rsp
	.cfi_def_cfa_offset 100080
	leaq	.LC0(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 100040(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %rdx
	leaq	12(%rsp), %rsi
	leaq	32(%rsp), %rbx
	call	scanf@PLT
	leaq	28(%rsp), %rcx
	xorl	%eax, %eax
	leaq	24(%rsp), %rdx
	leaq	20(%rsp), %rsi
	leaq	.LC1(%rip), %rdi
	call	scanf@PLT
	movq	%rbx, %rsi
	leaq	.LC2(%rip), %rdi
	xorl	%eax, %eax
	call	scanf@PLT
	movl	12(%rsp), %r9d
	testl	%r9d, %r9d
	jle	.L19
	movl	16(%rsp), %r8d
	movl	24(%rsp), %r12d
	movl	20(%rsp), %ebp
	movl	28(%rsp), %r11d
	testl	%r8d, %r8d
	jle	.L20
	cmpl	%r9d, %r8d
	movl	%r9d, %r10d
	movl	%r8d, %edi
	movq	%rbx, %rdx
	cmovle	%r8d, %r10d
	negl	%edi
	xorl	%esi, %esi
	xorl	%eax, %eax
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L4:
	cmpb	$115, %cl
	je	.L27
	cmpb	$112, %cl
	je	.L28
.L6:
	addl	$1, %eax
	addq	$1, %rdx
	addl	$1, %edi
	cmpl	%r10d, %eax
	jge	.L29
.L9:
	movzbl	(%rdx), %ecx
	cmpb	$114, %cl
	jne	.L4
	cmpl	%eax, %r8d
	jg	.L5
	movslq	%edi, %rcx
	cmpb	$114, 32(%rsp,%rcx)
	je	.L24
.L5:
	addl	$1, %eax
	addl	%r11d, %esi
	addq	$1, %rdx
	addl	$1, %edi
	cmpl	%r10d, %eax
	jl	.L9
.L29:
	cmpl	%r9d, %eax
	jl	.L3
	.p2align 4,,10
	.p2align 3
.L2:
	xorl	%eax, %eax
	leaq	.LC3(%rip), %rdi
	call	printf@PLT
	movq	100040(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L30
	addq	$100048, %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
	.p2align 4,,10
	.p2align 3
.L27:
	.cfi_restore_state
	addl	%ebp, %esi
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L28:
	cmpl	%eax, %r8d
	jg	.L8
	movslq	%edi, %rcx
	cmpb	$112, 32(%rsp,%rcx)
	je	.L24
.L8:
	addl	%r12d, %esi
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L24:
	movb	$48, (%rdx)
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L20:
	xorl	%esi, %esi
	xorl	%eax, %eax
.L3:
	movslq	%eax, %rdx
	movl	%eax, %edi
	addq	%rbx, %rdx
	subl	%r8d, %edi
	jmp	.L16
	.p2align 4,,10
	.p2align 3
.L10:
	cmpb	$115, %cl
	je	.L31
	cmpb	$112, %cl
	je	.L32
.L12:
	addl	$1, %eax
	addq	$1, %rdx
	addl	$1, %edi
	cmpl	%eax, %r9d
	jle	.L2
.L16:
	movzbl	(%rdx), %ecx
	cmpb	$114, %cl
	jne	.L10
	cmpl	%r8d, %eax
	jl	.L11
	movslq	%edi, %rcx
	cmpb	$114, 32(%rsp,%rcx)
	je	.L25
.L11:
	addl	%r11d, %esi
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L32:
	cmpl	%r8d, %eax
	jl	.L15
	movslq	%edi, %rcx
	cmpb	$112, 32(%rsp,%rcx)
	je	.L25
.L15:
	addl	%r12d, %esi
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L25:
	movb	$48, (%rdx)
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L31:
	movslq	%edi, %rcx
	cmpb	$115, 32(%rsp,%rcx)
	je	.L25
	addl	%ebp, %esi
	jmp	.L12
.L19:
	xorl	%esi, %esi
	jmp	.L2
.L30:
	call	__stack_chk_fail@PLT
	.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:

#include <math.h>
// r:グー s:チョキ p:パー
int main(){
  int N,K,R,S,P,i;
  char T[100002];
  scanf("%d %d",&N,&K);
  scanf("%d %d %d",&R,&S,&P);
  scanf("%s",T);
  int A[100002] = {0};
  int tmp = 0;
  for(i=0; i<N; i++){
    // 全部勝った場合の得点を計算
    if(T[i]=='r'){
      if(i>=K&&T[i-K]=='r'){
		T[i] = '0';
      }else{
        tmp += P;
        A[i] = tmp; 
      }
    }else if(T[i]=='s'){
      if(i>=K&&T[i-K]=='s'){
		T[i] = '0';
      }else{
        tmp += R;
        A[i] = tmp; 
      }
    }else if(T[i]=='p'){
      if(i>=K&&T[i-K]=='p'){
        T[i] = '0';
      }else{
        tmp += S;
        A[i] = tmp;
      }
    }
  }
  printf("%d\n",tmp);
}
30 6
325 234 123
rspsspspsrpspsppprpsprpssprpsr
 30 6
42 234 123
rspsspspsrpspsppprpsprpssprpsr
 30 6
30 234 123
rspsspspsrpspsppprpsprpssprpsr
 30 6
30 234 123
rspsspspsrpspsppprpsprpssprpss
 30 6
30 234 165
rspsspspsrpspsppprpsprpssprpss
 30 9
30 234 165
rspsspspsrpspsppprpsprpssprpss
 30 9
30 234 88
rspsspspsrpspsppprpsprpssprpss
 30 9
30 234 88
rrpsspspsrpspsppprpsprpssprpss
 30 9
30 234 21
rrpsspspsrpspsppprpsprpssprpss
 30 3
30 234 21
rrpsspspsrpspsppprpsprpssprpss

6328
 3498
 3378
 3255
 3465
 3135
 2904
 2962
 2694
 2502

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

```c
#include <math.h>
// r:グー s:チョキ p:パー
int main(){
  int N,K,R,S,P,i;
  char T[100002];
  scanf("%d %d",&N,&K);
  scanf("%d %d %d",&R,&S,&P);
  scanf("%s",T);
  int A[100002] = {0};
  int tmp = 0;
  for(i=0; i<N; i++){
    // 全部勝った場合の得点を計算
    if(T[i]=='r'){
      if(i>=K&&T[i-K]=='r'){
		T[i] = '0';
      }else{
        tmp += P;
        A[i] = tmp; 
      }
    }else if(T[i]=='s'){
      if(i>=K&&T[i-K]=='s'){
		T[i] = '0';
      }else{
        tmp += R;
        A[i] = tmp; 
      }
    }else if(T[i]=='p'){
      if(i>=K&&T[i-K]=='p'){
        T[i] = '0';
      }else{
        tmp += S;
        A[i] = tmp;
      }
    }
  }
  printf("%d\n",tmp);
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%d %d %d"
.LC2:
	.string	"%s"
.LC3:
	.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
	leaq	-499712(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$352, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-500056(%rbp), %rdx
	leaq	-500060(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	leaq	-500044(%rbp), %rcx
	leaq	-500048(%rbp), %rdx
	leaq	-500052(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	leaq	-100016(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	leaq	-500032(%rbp), %rax
	movl	$400008, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, -500036(%rbp)
	movl	$0, -500040(%rbp)
	jmp	.L2
.L11:
	movl	-500040(%rbp), %eax
	cltq
	movzbl	-100016(%rbp,%rax), %eax
	cmpb	$114, %al
	jne	.L3
	movl	-500056(%rbp), %eax
	cmpl	%eax, -500040(%rbp)
	jl	.L4
	movl	-500056(%rbp), %edx
	movl	-500040(%rbp), %eax
	subl	%edx, %eax
	cltq
	movzbl	-100016(%rbp,%rax), %eax
	cmpb	$114, %al
	jne	.L4
	movl	-500040(%rbp), %eax
	cltq
	movb	$48, -100016(%rbp,%rax)
	jmp	.L6
.L4:
	movl	-500044(%rbp), %eax
	addl	%eax, -500036(%rbp)
	movl	-500040(%rbp), %eax
	cltq
	movl	-500036(%rbp), %edx
	movl	%edx, -500032(%rbp,%rax,4)
	jmp	.L6
.L3:
	movl	-500040(%rbp), %eax
	cltq
	movzbl	-100016(%rbp,%rax), %eax
	cmpb	$115, %al
	jne	.L7
	movl	-500056(%rbp), %eax
	cmpl	%eax, -500040(%rbp)
	jl	.L8
	movl	-500056(%rbp), %edx
	movl	-500040(%rbp), %eax
	subl	%edx, %eax
	cltq
	movzbl	-100016(%rbp,%rax), %eax
	cmpb	$115, %al
	jne	.L8
	movl	-500040(%rbp), %eax
	cltq
	movb	$48, -100016(%rbp,%rax)
	jmp	.L6
.L8:
	movl	-500052(%rbp), %eax
	addl	%eax, -500036(%rbp)
	movl	-500040(%rbp), %eax
	cltq
	movl	-500036(%rbp), %edx
	movl	%edx, -500032(%rbp,%rax,4)
	jmp	.L6
.L7:
	movl	-500040(%rbp), %eax
	cltq
	movzbl	-100016(%rbp,%rax), %eax
	cmpb	$112, %al
	jne	.L6
	movl	-500056(%rbp), %eax
	cmpl	%eax, -500040(%rbp)
	jl	.L10
	movl	-500056(%rbp), %edx
	movl	-500040(%rbp), %eax
	subl	%edx, %eax
	cltq
	movzbl	-100016(%rbp,%rax), %eax
	cmpb	$112, %al
	jne	.L10
	movl	-500040(%rbp), %eax
	cltq
	movb	$48, -100016(%rbp,%rax)
	jmp	.L6
.L10:
	movl	-500048(%rbp), %eax
	addl	%eax, -500036(%rbp)
	movl	-500040(%rbp), %eax
	cltq
	movl	-500036(%rbp), %edx
	movl	%edx, -500032(%rbp,%rax,4)
.L6:
	addl	$1, -500040(%rbp)
.L2:
	movl	-500060(%rbp), %eax
	cmpl	%eax, -500040(%rbp)
	jl	.L11
	movl	-500036(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L13
	call	__stack_chk_fail@PLT
.L13:
	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 %d"
.LC1:
	.string	"%d %d %d"
.LC2:
	.string	"%s"
.LC3:
	.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
	leaq	-499712(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$352, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-500056(%rbp), %rdx
	leaq	-500060(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	leaq	-500044(%rbp), %rcx
	leaq	-500048(%rbp), %rdx
	leaq	-500052(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	leaq	-100016(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	leaq	-500032(%rbp), %rax
	movl	$400008, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, -500036(%rbp)
	movl	$0, -500040(%rbp)
	jmp	.L2
.L11:
	movl	-500040(%rbp), %eax
	cltq
	movzbl	-100016(%rbp,%rax), %eax
	cmpb	$114, %al
	jne	.L3
	movl	-500056(%rbp), %eax
	cmpl	%eax, -500040(%rbp)
	jl	.L4
	movl	-500056(%rbp), %edx
	movl	-500040(%rbp), %eax
	subl	%edx, %eax
	cltq
	movzbl	-100016(%rbp,%rax), %eax
	cmpb	$114, %al
	jne	.L4
	movl	-500040(%rbp), %eax
	cltq
	movb	$48, -100016(%rbp,%rax)
	jmp	.L6
.L4:
	movl	-500044(%rbp), %eax
	addl	%eax, -500036(%rbp)
	movl	-500040(%rbp), %eax
	cltq
	movl	-500036(%rbp), %edx
	movl	%edx, -500032(%rbp,%rax,4)
	jmp	.L6
.L3:
	movl	-500040(%rbp), %eax
	cltq
	movzbl	-100016(%rbp,%rax), %eax
	cmpb	$115, %al
	jne	.L7
	movl	-500056(%rbp), %eax
	cmpl	%eax, -500040(%rbp)
	jl	.L8
	movl	-500056(%rbp), %edx
	movl	-500040(%rbp), %eax
	subl	%edx, %eax
	cltq
	movzbl	-100016(%rbp,%rax), %eax
	cmpb	$115, %al
	jne	.L8
	movl	-500040(%rbp), %eax
	cltq
	movb	$48, -100016(%rbp,%rax)
	jmp	.L6
.L8:
	movl	-500052(%rbp), %eax
	addl	%eax, -500036(%rbp)
	movl	-500040(%rbp), %eax
	cltq
	movl	-500036(%rbp), %edx
	movl	%edx, -500032(%rbp,%rax,4)
	jmp	.L6
.L7:
	movl	-500040(%rbp), %eax
	cltq
	movzbl	-100016(%rbp,%rax), %eax
	cmpb	$112, %al
	jne	.L6
	movl	-500056(%rbp), %eax
	cmpl	%eax, -500040(%rbp)
	jl	.L10
	movl	-500056(%rbp), %edx
	movl	-500040(%rbp), %eax
	subl	%edx, %eax
	cltq
	movzbl	-100016(%rbp,%rax), %eax
	cmpb	$112, %al
	jne	.L10
	movl	-500040(%rbp), %eax
	cltq
	movb	$48, -100016(%rbp,%rax)
	jmp	.L6
.L10:
	movl	-500048(%rbp), %eax
	addl	%eax, -500036(%rbp)
	movl	-500040(%rbp), %eax
	cltq
	movl	-500036(%rbp), %edx
	movl	%edx, -500032(%rbp,%rax,4)
.L6:
	addl	$1, -500040(%rbp)
.L2:
	movl	-500060(%rbp), %eax
	cmpl	%eax, -500040(%rbp)
	jl	.L11
	movl	-500036(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L13
	call	__stack_chk_fail@PLT
.L13:
	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:
