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

```c
#include <stdio.h>


int main(void){
  char s[1001], order[8], ch[1001];
  int i, j, n, a, b;

  scanf("%s\n%d", s, &n);

  for(i=0;i<n;i++){
    scanf("%s %d %d", order, &a, &b);
    
    if(!strcmp(order, "reverse")){
      for(j=a;j<=b;j++)
        ch[b-j] = s[j];
      for(j=a;j<=b;j++)
        s[j] = ch[j-a];
    }

    if(!strcmp(order, "replace")){
      scanf("%s", ch);
      for(j=0;ch[j]!='\0';j++)
        s[a+j] = ch[j];
    }

    if(!strcmp(order, "print")){
      for(j=a;j<=b;j++)
        printf("%c", s[j]);
      printf("\n");
    }
  }

  return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%s\n%d"
.LC1:
	.string	"%s %d %d"
.LC2:
	.string	"reverse"
.LC3:
	.string	"replace"
.LC4:
	.string	"%s"
.LC5:
	.string	"print"
	.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	$2064, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-2060(%rbp), %rdx
	leaq	-2032(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -2048(%rbp)
	jmp	.L2
.L14:
	leaq	-2052(%rbp), %rcx
	leaq	-2056(%rbp), %rdx
	leaq	-2040(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-2040(%rbp), %rax
	leaq	.LC2(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L3
	movl	-2056(%rbp), %eax
	movl	%eax, -2044(%rbp)
	jmp	.L4
.L5:
	movl	-2052(%rbp), %eax
	subl	-2044(%rbp), %eax
	movl	%eax, %ecx
	movl	-2044(%rbp), %eax
	cltq
	movzbl	-2032(%rbp,%rax), %edx
	movslq	%ecx, %rax
	movb	%dl, -1024(%rbp,%rax)
	addl	$1, -2044(%rbp)
.L4:
	movl	-2052(%rbp), %eax
	cmpl	%eax, -2044(%rbp)
	jle	.L5
	movl	-2056(%rbp), %eax
	movl	%eax, -2044(%rbp)
	jmp	.L6
.L7:
	movl	-2056(%rbp), %edx
	movl	-2044(%rbp), %eax
	subl	%edx, %eax
	cltq
	movzbl	-1024(%rbp,%rax), %edx
	movl	-2044(%rbp), %eax
	cltq
	movb	%dl, -2032(%rbp,%rax)
	addl	$1, -2044(%rbp)
.L6:
	movl	-2052(%rbp), %eax
	cmpl	%eax, -2044(%rbp)
	jle	.L7
.L3:
	leaq	-2040(%rbp), %rax
	leaq	.LC3(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L8
	leaq	-1024(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC4(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -2044(%rbp)
	jmp	.L9
.L10:
	movl	-2056(%rbp), %edx
	movl	-2044(%rbp), %eax
	leal	(%rdx,%rax), %ecx
	movl	-2044(%rbp), %eax
	cltq
	movzbl	-1024(%rbp,%rax), %edx
	movslq	%ecx, %rax
	movb	%dl, -2032(%rbp,%rax)
	addl	$1, -2044(%rbp)
.L9:
	movl	-2044(%rbp), %eax
	cltq
	movzbl	-1024(%rbp,%rax), %eax
	testb	%al, %al
	jne	.L10
.L8:
	leaq	-2040(%rbp), %rax
	leaq	.LC5(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L11
	movl	-2056(%rbp), %eax
	movl	%eax, -2044(%rbp)
	jmp	.L12
.L13:
	movl	-2044(%rbp), %eax
	cltq
	movzbl	-2032(%rbp,%rax), %eax
	movsbl	%al, %eax
	movl	%eax, %edi
	call	putchar@PLT
	addl	$1, -2044(%rbp)
.L12:
	movl	-2052(%rbp), %eax
	cmpl	%eax, -2044(%rbp)
	jle	.L13
	movl	$10, %edi
	call	putchar@PLT
.L11:
	addl	$1, -2048(%rbp)
.L2:
	movl	-2060(%rbp), %eax
	cmpl	%eax, -2048(%rbp)
	jl	.L14
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L16
	call	__stack_chk_fail@PLT
.L16:
	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	"%s\n%d"
.LC1:
	.string	"%s %d %d"
.LC2:
	.string	"reverse"
.LC3:
	.string	"replace"
.LC4:
	.string	"%s"
.LC5:
	.string	"print"
	.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
	leaq	.LC0(%rip), %rdi
	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	$2072, %rsp
	.cfi_def_cfa_offset 2128
	movq	%fs:40, %rax
	movq	%rax, 2056(%rsp)
	xorl	%eax, %eax
	leaq	32(%rsp), %r12
	leaq	12(%rsp), %rdx
	movq	%r12, %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	jle	.L2
	xorl	%ebp, %ebp
	leaq	20(%rsp), %r15
	leaq	16(%rsp), %r14
	leaq	24(%rsp), %rbx
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L9:
	addl	$1, %ebp
	cmpl	%ebp, 12(%rsp)
	jle	.L2
.L12:
	movq	%rbx, %rsi
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	movq	%r15, %rcx
	movq	%r14, %rdx
	call	__isoc99_scanf@PLT
	leaq	.LC2(%rip), %rsi
	movq	%rbx, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	je	.L23
.L3:
	leaq	.LC3(%rip), %rsi
	movq	%rbx, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	je	.L24
.L5:
	cmpl	$1852404336, (%rbx)
	jne	.L9
	cmpw	$116, 4(%rbx)
	jne	.L9
	movslq	16(%rsp), %r13
	cmpl	20(%rsp), %r13d
	jg	.L10
	.p2align 4,,10
	.p2align 3
.L11:
	movsbl	(%r12,%r13), %edi
	addq	$1, %r13
	call	putchar@PLT
	cmpl	%r13d, 20(%rsp)
	jge	.L11
.L10:
	movl	$10, %edi
	addl	$1, %ebp
	call	putchar@PLT
	cmpl	%ebp, 12(%rsp)
	jg	.L12
.L2:
	movq	2056(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L25
	addq	$2072, %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
.L23:
	.cfi_restore_state
	movl	16(%rsp), %eax
	movl	20(%rsp), %edx
	cmpl	%edx, %eax
	jg	.L3
	subl	%eax, %edx
	movslq	%eax, %r8
	leaq	1040(%rsp), %r13
	movslq	%edx, %rsi
	addq	%r12, %r8
	movl	%edx, %edx
	leaq	1039(%rsp,%rsi), %rdi
	movq	%r8, %rcx
	leaq	0(%r13,%rsi), %rax
	subq	%rdx, %rdi
	.p2align 4,,10
	.p2align 3
.L4:
	movzbl	(%rcx), %esi
	subq	$1, %rax
	addq	$1, %rcx
	movb	%sil, 1(%rax)
	cmpq	%rdi, %rax
	jne	.L4
	addq	$1, %rdx
	movq	%r13, %rsi
	movq	%r8, %rdi
	call	memcpy@PLT
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L24:
	leaq	1040(%rsp), %r13
	leaq	.LC4(%rip), %rdi
	movq	%r13, %rsi
	call	__isoc99_scanf@PLT
	movzbl	1040(%rsp), %edx
	testb	%dl, %dl
	je	.L5
	movslq	16(%rsp), %rcx
	xorl	%eax, %eax
	addq	%r12, %rcx
	.p2align 4,,10
	.p2align 3
.L6:
	movb	%dl, (%rcx,%rax)
	addq	$1, %rax
	movzbl	0(%r13,%rax), %edx
	testb	%dl, %dl
	jne	.L6
	jmp	.L5
.L25:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.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	"%s\n%d"
.LC1:
	.string	"%s %d %d"
.LC2:
	.string	"reverse"
.LC3:
	.string	"replace"
.LC4:
	.string	"%s"
.LC5:
	.string	"print"
	.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
	leaq	.LC0(%rip), %rdi
	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	$2072, %rsp
	.cfi_def_cfa_offset 2128
	movq	%fs:40, %rax
	movq	%rax, 2056(%rsp)
	xorl	%eax, %eax
	leaq	32(%rsp), %r12
	leaq	12(%rsp), %rdx
	movq	%r12, %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	jle	.L2
	xorl	%ebp, %ebp
	leaq	20(%rsp), %r15
	leaq	16(%rsp), %r14
	leaq	24(%rsp), %rbx
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L9:
	addl	$1, %ebp
	cmpl	%ebp, 12(%rsp)
	jle	.L2
.L12:
	movq	%rbx, %rsi
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	movq	%r15, %rcx
	movq	%r14, %rdx
	call	__isoc99_scanf@PLT
	leaq	.LC2(%rip), %rsi
	movq	%rbx, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	je	.L23
.L3:
	leaq	.LC3(%rip), %rsi
	movq	%rbx, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	je	.L24
.L5:
	cmpl	$1852404336, (%rbx)
	jne	.L9
	cmpw	$116, 4(%rbx)
	jne	.L9
	movslq	16(%rsp), %r13
	cmpl	20(%rsp), %r13d
	jg	.L10
	.p2align 4,,10
	.p2align 3
.L11:
	movsbl	(%r12,%r13), %edi
	addq	$1, %r13
	call	putchar@PLT
	cmpl	%r13d, 20(%rsp)
	jge	.L11
.L10:
	movl	$10, %edi
	addl	$1, %ebp
	call	putchar@PLT
	cmpl	%ebp, 12(%rsp)
	jg	.L12
.L2:
	movq	2056(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L25
	addq	$2072, %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
.L23:
	.cfi_restore_state
	movl	16(%rsp), %eax
	movl	20(%rsp), %edx
	cmpl	%edx, %eax
	jg	.L3
	subl	%eax, %edx
	movslq	%eax, %r8
	leaq	1040(%rsp), %r13
	movslq	%edx, %rsi
	addq	%r12, %r8
	movl	%edx, %edx
	leaq	1039(%rsp,%rsi), %rdi
	movq	%r8, %rcx
	leaq	0(%r13,%rsi), %rax
	subq	%rdx, %rdi
	.p2align 4,,10
	.p2align 3
.L4:
	movzbl	(%rcx), %esi
	subq	$1, %rax
	addq	$1, %rcx
	movb	%sil, 1(%rax)
	cmpq	%rdi, %rax
	jne	.L4
	addq	$1, %rdx
	movq	%r13, %rsi
	movq	%r8, %rdi
	call	memcpy@PLT
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L24:
	leaq	1040(%rsp), %r13
	leaq	.LC4(%rip), %rdi
	movq	%r13, %rsi
	call	__isoc99_scanf@PLT
	movzbl	1040(%rsp), %edx
	testb	%dl, %dl
	je	.L5
	movslq	16(%rsp), %rcx
	xorl	%eax, %eax
	addq	%r12, %rcx
	.p2align 4,,10
	.p2align 3
.L6:
	movb	%dl, (%rcx,%rax)
	addq	$1, %rax
	movzbl	0(%r13,%rax), %edx
	testb	%dl, %dl
	jne	.L6
	jmp	.L5
.L25:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.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>


int main(void){
  char s[1001], order[8], ch[1001];
  int i, j, n, a, b;

  scanf("%s\n%d", s, &n);

  for(i=0;i<n;i++){
    scanf("%s %d %d", order, &a, &b);
    
    if(!strcmp(order, "reverse")){
      for(j=a;j<=b;j++)
        ch[b-j] = s[j];
      for(j=a;j<=b;j++)
        s[j] = ch[j-a];
    }

    if(!strcmp(order, "replace")){
      scanf("%s", ch);
      for(j=0;ch[j]!='\0';j++)
        s[a+j] = ch[j];
    }

    if(!strcmp(order, "print")){
      for(j=a;j<=b;j++)
        printf("%c", s[j]);
      printf("\n");
    }
  }

  return 0;
}

abcde
3
replace 1 3 xy{
reverse 0 2
print 1 4
 xyz
3
print 0 2
replace 1 2 abc
print 0 2
 abcde
3
replace 1 3 xy{
reverse 0 2
print 1 2
 abcde
3
replace 1 3 yy{
reverse 0 2
print 1 2
 abcde
3
replace 1 3 yy{
reverse 0 2
print 1 1
 xyz
1
print 0 2
replace 0 2 abc
print 0 2
 abcde
3
replace 1 3 xy{
reverse 0 2
print 1 3
 xyz
3
print 0 1
replace 1 2 abc
print 0 2
 abcde
3
replace 1 3 yy{
reverse -1 2
print 1 2
 abcde
3
replace 1 3 xy{
reverse 0 2
print 1 1

xa{e
 xyz
xab
 xa
 ya
 y
 xyz
 xa{
 xy
xab
 a
 x

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

```c
#include <stdio.h>


int main(void){
  char s[1001], order[8], ch[1001];
  int i, j, n, a, b;

  scanf("%s\n%d", s, &n);

  for(i=0;i<n;i++){
    scanf("%s %d %d", order, &a, &b);
    
    if(!strcmp(order, "reverse")){
      for(j=a;j<=b;j++)
        ch[b-j] = s[j];
      for(j=a;j<=b;j++)
        s[j] = ch[j-a];
    }

    if(!strcmp(order, "replace")){
      scanf("%s", ch);
      for(j=0;ch[j]!='\0';j++)
        s[a+j] = ch[j];
    }

    if(!strcmp(order, "print")){
      for(j=a;j<=b;j++)
        printf("%c", s[j]);
      printf("\n");
    }
  }

  return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%s\n%d"
.LC1:
	.string	"%s %d %d"
.LC2:
	.string	"reverse"
.LC3:
	.string	"replace"
.LC4:
	.string	"%s"
.LC5:
	.string	"print"
	.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	$2064, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-2060(%rbp), %rdx
	leaq	-2032(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -2048(%rbp)
	jmp	.L2
.L14:
	leaq	-2052(%rbp), %rcx
	leaq	-2056(%rbp), %rdx
	leaq	-2040(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-2040(%rbp), %rax
	leaq	.LC2(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L3
	movl	-2056(%rbp), %eax
	movl	%eax, -2044(%rbp)
	jmp	.L4
.L5:
	movl	-2052(%rbp), %eax
	subl	-2044(%rbp), %eax
	movl	%eax, %ecx
	movl	-2044(%rbp), %eax
	cltq
	movzbl	-2032(%rbp,%rax), %edx
	movslq	%ecx, %rax
	movb	%dl, -1024(%rbp,%rax)
	addl	$1, -2044(%rbp)
.L4:
	movl	-2052(%rbp), %eax
	cmpl	%eax, -2044(%rbp)
	jle	.L5
	movl	-2056(%rbp), %eax
	movl	%eax, -2044(%rbp)
	jmp	.L6
.L7:
	movl	-2056(%rbp), %edx
	movl	-2044(%rbp), %eax
	subl	%edx, %eax
	cltq
	movzbl	-1024(%rbp,%rax), %edx
	movl	-2044(%rbp), %eax
	cltq
	movb	%dl, -2032(%rbp,%rax)
	addl	$1, -2044(%rbp)
.L6:
	movl	-2052(%rbp), %eax
	cmpl	%eax, -2044(%rbp)
	jle	.L7
.L3:
	leaq	-2040(%rbp), %rax
	leaq	.LC3(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L8
	leaq	-1024(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC4(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -2044(%rbp)
	jmp	.L9
.L10:
	movl	-2056(%rbp), %edx
	movl	-2044(%rbp), %eax
	leal	(%rdx,%rax), %ecx
	movl	-2044(%rbp), %eax
	cltq
	movzbl	-1024(%rbp,%rax), %edx
	movslq	%ecx, %rax
	movb	%dl, -2032(%rbp,%rax)
	addl	$1, -2044(%rbp)
.L9:
	movl	-2044(%rbp), %eax
	cltq
	movzbl	-1024(%rbp,%rax), %eax
	testb	%al, %al
	jne	.L10
.L8:
	leaq	-2040(%rbp), %rax
	leaq	.LC5(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L11
	movl	-2056(%rbp), %eax
	movl	%eax, -2044(%rbp)
	jmp	.L12
.L13:
	movl	-2044(%rbp), %eax
	cltq
	movzbl	-2032(%rbp,%rax), %eax
	movsbl	%al, %eax
	movl	%eax, %edi
	call	putchar@PLT
	addl	$1, -2044(%rbp)
.L12:
	movl	-2052(%rbp), %eax
	cmpl	%eax, -2044(%rbp)
	jle	.L13
	movl	$10, %edi
	call	putchar@PLT
.L11:
	addl	$1, -2048(%rbp)
.L2:
	movl	-2060(%rbp), %eax
	cmpl	%eax, -2048(%rbp)
	jl	.L14
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L16
	call	__stack_chk_fail@PLT
.L16:
	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	"%s\n%d"
.LC1:
	.string	"%s %d %d"
.LC2:
	.string	"reverse"
.LC3:
	.string	"replace"
.LC4:
	.string	"%s"
.LC5:
	.string	"print"
	.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	$2064, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-2060(%rbp), %rdx
	leaq	-2032(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -2048(%rbp)
	jmp	.L2
.L14:
	leaq	-2052(%rbp), %rcx
	leaq	-2056(%rbp), %rdx
	leaq	-2040(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-2040(%rbp), %rax
	leaq	.LC2(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L3
	movl	-2056(%rbp), %eax
	movl	%eax, -2044(%rbp)
	jmp	.L4
.L5:
	movl	-2052(%rbp), %eax
	subl	-2044(%rbp), %eax
	movl	%eax, %ecx
	movl	-2044(%rbp), %eax
	cltq
	movzbl	-2032(%rbp,%rax), %edx
	movslq	%ecx, %rax
	movb	%dl, -1024(%rbp,%rax)
	addl	$1, -2044(%rbp)
.L4:
	movl	-2052(%rbp), %eax
	cmpl	%eax, -2044(%rbp)
	jle	.L5
	movl	-2056(%rbp), %eax
	movl	%eax, -2044(%rbp)
	jmp	.L6
.L7:
	movl	-2056(%rbp), %edx
	movl	-2044(%rbp), %eax
	subl	%edx, %eax
	cltq
	movzbl	-1024(%rbp,%rax), %edx
	movl	-2044(%rbp), %eax
	cltq
	movb	%dl, -2032(%rbp,%rax)
	addl	$1, -2044(%rbp)
.L6:
	movl	-2052(%rbp), %eax
	cmpl	%eax, -2044(%rbp)
	jle	.L7
.L3:
	leaq	-2040(%rbp), %rax
	leaq	.LC3(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L8
	leaq	-1024(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC4(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -2044(%rbp)
	jmp	.L9
.L10:
	movl	-2056(%rbp), %edx
	movl	-2044(%rbp), %eax
	leal	(%rdx,%rax), %ecx
	movl	-2044(%rbp), %eax
	cltq
	movzbl	-1024(%rbp,%rax), %edx
	movslq	%ecx, %rax
	movb	%dl, -2032(%rbp,%rax)
	addl	$1, -2044(%rbp)
.L9:
	movl	-2044(%rbp), %eax
	cltq
	movzbl	-1024(%rbp,%rax), %eax
	testb	%al, %al
	jne	.L10
.L8:
	leaq	-2040(%rbp), %rax
	leaq	.LC5(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L11
	movl	-2056(%rbp), %eax
	movl	%eax, -2044(%rbp)
	jmp	.L12
.L13:
	movl	-2044(%rbp), %eax
	cltq
	movzbl	-2032(%rbp,%rax), %eax
	movsbl	%al, %eax
	movl	%eax, %edi
	call	putchar@PLT
	addl	$1, -2044(%rbp)
.L12:
	movl	-2052(%rbp), %eax
	cmpl	%eax, -2044(%rbp)
	jle	.L13
	movl	$10, %edi
	call	putchar@PLT
.L11:
	addl	$1, -2048(%rbp)
.L2:
	movl	-2060(%rbp), %eax
	cmpl	%eax, -2048(%rbp)
	jl	.L14
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L16
	call	__stack_chk_fail@PLT
.L16:
	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:
