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

```c
#include <limits.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <math.h>

#define もし if(
#define そうでなくてもし }else if(
#define ならば ){
#define そうでないならば }else{
#define を実行する }

#define 文字列を読み込む(s) scanf("%s", s)
#define 整数を読み込む(x) int x; scanf("%d", &x)
#define 文字を読み込む(c) char c; scanf(" %c", &c)

#define 文字列を書き出す(s) printf("%s", (s))
#define 文字を書き出す(c) printf("%c", (c))
#define 改行する putchar(10)

#define 文字列の長さ(s) (strlen(s))

typedef int 整数;
typedef char 文字;

int main(void){
	文字 s[500001];
	文字列を読み込む(s+200000);
	整数 l=200000, r=200000+文字列の長さ(s+200000);
	整数 f=1;

	整数 i;
	整数を読み込む(q);
	for(i=0; i<q; i++){
		整数 Q;
		scanf("%d", &Q);
		もし Q==1 ならば
			f=(f==1?2:1);
		そうでないならば
			整数を読み込む(F);
			文字を読み込む(c);
			もし F==f ならば
				s[--l]=c;
			そうでないならば
				s[r++]=c;
			を実行する
		を実行する
	}
	もし f==1 ならば
		s[r]=0;
		文字列を書き出す(s+l);
		改行する;
	そうでないならば
		for(i=r-1; i>=l; i--){
			文字を書き出す(s[i]);
		}
		改行する;
	を実行する
}

```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%s"
.LC1:
	.string	"%d"
.LC2:
	.string	" %c"
	.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
	leaq	-499712(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$336, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-500016(%rbp), %rax
	addq	$200000, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$200000, -500032(%rbp)
	leaq	-500016(%rbp), %rax
	addq	$200000, %rax
	movq	%rax, %rdi
	call	strlen@PLT
	addl	$200000, %eax
	movl	%eax, -500028(%rbp)
	movl	$1, -500024(%rbp)
	leaq	-500044(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -500020(%rbp)
	jmp	.L2
.L9:
	leaq	-500040(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-500040(%rbp), %eax
	cmpl	$1, %eax
	jne	.L3
	cmpl	$1, -500024(%rbp)
	jne	.L4
	movl	$2, %eax
	jmp	.L5
.L4:
	movl	$1, %eax
.L5:
	movl	%eax, -500024(%rbp)
	jmp	.L6
.L3:
	leaq	-500036(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-500045(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-500036(%rbp), %eax
	cmpl	%eax, -500024(%rbp)
	jne	.L7
	subl	$1, -500032(%rbp)
	movzbl	-500045(%rbp), %edx
	movl	-500032(%rbp), %eax
	cltq
	movb	%dl, -500016(%rbp,%rax)
	jmp	.L6
.L7:
	movl	-500028(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -500028(%rbp)
	movzbl	-500045(%rbp), %edx
	cltq
	movb	%dl, -500016(%rbp,%rax)
.L6:
	addl	$1, -500020(%rbp)
.L2:
	movl	-500044(%rbp), %eax
	cmpl	%eax, -500020(%rbp)
	jl	.L9
	cmpl	$1, -500024(%rbp)
	jne	.L10
	movl	-500028(%rbp), %eax
	cltq
	movb	$0, -500016(%rbp,%rax)
	movl	-500032(%rbp), %eax
	cltq
	leaq	-500016(%rbp), %rdx
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$10, %edi
	call	putchar@PLT
	jmp	.L11
.L10:
	movl	-500028(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -500020(%rbp)
	jmp	.L12
.L13:
	movl	-500020(%rbp), %eax
	cltq
	movzbl	-500016(%rbp,%rax), %eax
	movsbl	%al, %eax
	movl	%eax, %edi
	call	putchar@PLT
	subl	$1, -500020(%rbp)
.L12:
	movl	-500020(%rbp), %eax
	cmpl	-500032(%rbp), %eax
	jge	.L13
	movl	$10, %edi
	call	putchar@PLT
.L11:
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L15
	call	__stack_chk_fail@PLT
.L15:
	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
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%s"
.LC1:
	.string	"%d"
.LC2:
	.string	" %c"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB63:
	.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
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	-499712(%rsp), %r11
	.cfi_def_cfa 11, 499768
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$328, %rsp
	.cfi_def_cfa_offset 500096
	leaq	.LC0(%rip), %rdi
	leaq	.LC1(%rip), %r12
	movq	%fs:40, %rax
	movq	%rax, 500024(%rsp)
	xorl	%eax, %eax
	leaq	200016(%rsp), %rbp
	movq	%rbp, %rsi
	call	__isoc99_scanf@PLT
	movq	%rbp, %rdi
	call	strlen@PLT
	leaq	4(%rsp), %rsi
	movq	%r12, %rdi
	leal	200000(%rax), %ebx
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %eax
	testl	%eax, %eax
	jle	.L13
	xorl	%ebp, %ebp
	movl	$1, %r13d
	movl	$200000, %r14d
	leaq	8(%rsp), %r15
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L19:
	movl	$3, %eax
	subl	%r13d, %eax
	movl	%eax, %r13d
.L4:
	addl	$1, %ebp
	cmpl	%ebp, 4(%rsp)
	jle	.L18
.L7:
	xorl	%eax, %eax
	movq	%r15, %rsi
	movq	%r12, %rdi
	call	__isoc99_scanf@PLT
	cmpl	$1, 8(%rsp)
	je	.L19
	leaq	12(%rsp), %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	xorl	%eax, %eax
	leaq	3(%rsp), %rsi
	leaq	.LC2(%rip), %rdi
	call	__isoc99_scanf@PLT
	cmpl	%r13d, 12(%rsp)
	je	.L20
	movzbl	3(%rsp), %edx
	movslq	%ebx, %rax
	addl	$1, %ebp
	addl	$1, %ebx
	movb	%dl, 16(%rsp,%rax)
	cmpl	%ebp, 4(%rsp)
	jg	.L7
.L18:
	cmpl	$1, %r13d
	je	.L2
	subl	$1, %ebx
	cmpl	%ebx, %r14d
	jg	.L10
	movslq	%ebx, %rbx
	leaq	16(%rsp), %rbp
	.p2align 4,,10
	.p2align 3
.L11:
	movsbl	0(%rbp,%rbx), %edi
	subq	$1, %rbx
	call	putchar@PLT
	cmpl	%ebx, %r14d
	jle	.L11
.L10:
	movq	stdout(%rip), %rsi
	movl	$10, %edi
	call	putc@PLT
.L9:
	movq	500024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L21
	addq	$500040, %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
.L20:
	.cfi_restore_state
	movzbl	3(%rsp), %edx
	subl	$1, %r14d
	movslq	%r14d, %rax
	movb	%dl, 16(%rsp,%rax)
	jmp	.L4
.L13:
	movl	$200000, %r14d
.L2:
	movslq	%r14d, %r14
	movslq	%ebx, %rbx
	leaq	.LC0(%rip), %rsi
	xorl	%eax, %eax
	leaq	16(%rsp,%r14), %rdx
	movl	$1, %edi
	movb	$0, 16(%rsp,%rbx)
	call	__printf_chk@PLT
	movq	stdout(%rip), %rsi
	movl	$10, %edi
	call	putc@PLT
	jmp	.L9
.L21:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE63:
	.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"
.LC1:
	.string	"%d"
.LC2:
	.string	" %c"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB63:
	.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
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	-499712(%rsp), %r11
	.cfi_def_cfa 11, 499768
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$328, %rsp
	.cfi_def_cfa_offset 500096
	leaq	.LC0(%rip), %rdi
	leaq	.LC1(%rip), %r12
	movq	%fs:40, %rax
	movq	%rax, 500024(%rsp)
	xorl	%eax, %eax
	leaq	200016(%rsp), %rbp
	movq	%rbp, %rsi
	call	__isoc99_scanf@PLT
	movq	%rbp, %rdi
	call	strlen@PLT
	leaq	4(%rsp), %rsi
	movq	%r12, %rdi
	leal	200000(%rax), %ebx
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %eax
	testl	%eax, %eax
	jle	.L13
	xorl	%ebp, %ebp
	movl	$1, %r13d
	movl	$200000, %r14d
	leaq	8(%rsp), %r15
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L19:
	movl	$3, %eax
	subl	%r13d, %eax
	movl	%eax, %r13d
.L4:
	addl	$1, %ebp
	cmpl	%ebp, 4(%rsp)
	jle	.L18
.L7:
	xorl	%eax, %eax
	movq	%r15, %rsi
	movq	%r12, %rdi
	call	__isoc99_scanf@PLT
	cmpl	$1, 8(%rsp)
	je	.L19
	leaq	12(%rsp), %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	xorl	%eax, %eax
	leaq	3(%rsp), %rsi
	leaq	.LC2(%rip), %rdi
	call	__isoc99_scanf@PLT
	cmpl	%r13d, 12(%rsp)
	je	.L20
	movzbl	3(%rsp), %edx
	movslq	%ebx, %rax
	addl	$1, %ebp
	addl	$1, %ebx
	movb	%dl, 16(%rsp,%rax)
	cmpl	%ebp, 4(%rsp)
	jg	.L7
.L18:
	cmpl	$1, %r13d
	je	.L2
	subl	$1, %ebx
	cmpl	%ebx, %r14d
	jg	.L10
	movslq	%ebx, %rbx
	leaq	16(%rsp), %rbp
	.p2align 4,,10
	.p2align 3
.L11:
	movsbl	0(%rbp,%rbx), %edi
	subq	$1, %rbx
	call	putchar@PLT
	cmpl	%ebx, %r14d
	jle	.L11
.L10:
	movq	stdout(%rip), %rsi
	movl	$10, %edi
	call	putc@PLT
.L9:
	movq	500024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L21
	addq	$500040, %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
.L20:
	.cfi_restore_state
	movzbl	3(%rsp), %edx
	subl	$1, %r14d
	movslq	%r14d, %rax
	movb	%dl, 16(%rsp,%rax)
	jmp	.L4
.L13:
	movl	$200000, %r14d
.L2:
	movslq	%r14d, %r14
	movslq	%ebx, %rbx
	leaq	.LC0(%rip), %rsi
	xorl	%eax, %eax
	leaq	16(%rsp,%r14), %rdx
	movl	$1, %edi
	movb	$0, 16(%rsp,%rbx)
	call	__printf_chk@PLT
	movq	stdout(%rip), %rsi
	movl	$10, %edi
	call	putc@PLT
	jmp	.L9
.L21:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE63:
	.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 <limits.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <math.h>

#define もし if(
#define そうでなくてもし }else if(
#define ならば ){
#define そうでないならば }else{
#define を実行する }

#define 文字列を読み込む(s) scanf("%s", s)
#define 整数を読み込む(x) int x; scanf("%d", &x)
#define 文字を読み込む(c) char c; scanf(" %c", &c)

#define 文字列を書き出す(s) printf("%s", (s))
#define 文字を書き出す(c) printf("%c", (c))
#define 改行する putchar(10)

#define 文字列の長さ(s) (strlen(s))

typedef int 整数;
typedef char 文字;

int main(void){
	文字 s[500001];
	文字列を読み込む(s+200000);
	整数 l=200000, r=200000+文字列の長さ(s+200000);
	整数 f=1;

	整数 i;
	整数を読み込む(q);
	for(i=0; i<q; i++){
		整数 Q;
		scanf("%d", &Q);
		もし Q==1 ならば
			f=(f==1?2:1);
		そうでないならば
			整数を読み込む(F);
			文字を読み込む(c);
			もし F==f ならば
				s[--l]=c;
			そうでないならば
				s[r++]=c;
			を実行する
		を実行する
	}
	もし f==1 ならば
		s[r]=0;
		文字列を書き出す(s+l);
		改行する;
	そうでないならば
		for(i=r-1; i>=l; i--){
			文字を書き出す(s[i]);
		}
		改行する;
	を実行する
}


a
6
2 2 a
2 1 b
1
2 2 d
1
1
 a
6
2 2 b
2 1 b
1
2 2 d
1
1
 b
4
2 1 p
1
2 2 c
1
 a
6
2 2 a
2 1 b
1
2 1 c
1
1
 a
6
2 2 a
2 1 b
1
2 1 b
1
1
 `
4
2 1 p
1
2 2 c
1
 a
6
2 2 b
2 1 b
1
2 2 c
1
1
 b
6
2 2 a
2 1 b
1
2 2 c
1
1
 a
6
2 2 b
2 1 b
1
2 1 c
1
1
 y
0
1 1 x

aabd
 babd
 cpb
 caab
 baab
 cp`
 babc
 abbc
 cbab
 y

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

```c
#include <limits.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <math.h>

#define もし if(
#define そうでなくてもし }else if(
#define ならば ){
#define そうでないならば }else{
#define を実行する }

#define 文字列を読み込む(s) scanf("%s", s)
#define 整数を読み込む(x) int x; scanf("%d", &x)
#define 文字を読み込む(c) char c; scanf(" %c", &c)

#define 文字列を書き出す(s) printf("%s", (s))
#define 文字を書き出す(c) printf("%c", (c))
#define 改行する putchar(10)

#define 文字列の長さ(s) (strlen(s))

typedef int 整数;
typedef char 文字;

int main(void){
	文字 s[500001];
	文字列を読み込む(s+200000);
	整数 l=200000, r=200000+文字列の長さ(s+200000);
	整数 f=1;

	整数 i;
	整数を読み込む(q);
	for(i=0; i<q; i++){
		整数 Q;
		scanf("%d", &Q);
		もし Q==1 ならば
			f=(f==1?2:1);
		そうでないならば
			整数を読み込む(F);
			文字を読み込む(c);
			もし F==f ならば
				s[--l]=c;
			そうでないならば
				s[r++]=c;
			を実行する
		を実行する
	}
	もし f==1 ならば
		s[r]=0;
		文字列を書き出す(s+l);
		改行する;
	そうでないならば
		for(i=r-1; i>=l; i--){
			文字を書き出す(s[i]);
		}
		改行する;
	を実行する
}

```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%s"
.LC1:
	.string	"%d"
.LC2:
	.string	" %c"
	.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
	leaq	-499712(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$336, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-500016(%rbp), %rax
	addq	$200000, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$200000, -500032(%rbp)
	leaq	-500016(%rbp), %rax
	addq	$200000, %rax
	movq	%rax, %rdi
	call	strlen@PLT
	addl	$200000, %eax
	movl	%eax, -500028(%rbp)
	movl	$1, -500024(%rbp)
	leaq	-500044(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -500020(%rbp)
	jmp	.L2
.L9:
	leaq	-500040(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-500040(%rbp), %eax
	cmpl	$1, %eax
	jne	.L3
	cmpl	$1, -500024(%rbp)
	jne	.L4
	movl	$2, %eax
	jmp	.L5
.L4:
	movl	$1, %eax
.L5:
	movl	%eax, -500024(%rbp)
	jmp	.L6
.L3:
	leaq	-500036(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-500045(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-500036(%rbp), %eax
	cmpl	%eax, -500024(%rbp)
	jne	.L7
	subl	$1, -500032(%rbp)
	movzbl	-500045(%rbp), %edx
	movl	-500032(%rbp), %eax
	cltq
	movb	%dl, -500016(%rbp,%rax)
	jmp	.L6
.L7:
	movl	-500028(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -500028(%rbp)
	movzbl	-500045(%rbp), %edx
	cltq
	movb	%dl, -500016(%rbp,%rax)
.L6:
	addl	$1, -500020(%rbp)
.L2:
	movl	-500044(%rbp), %eax
	cmpl	%eax, -500020(%rbp)
	jl	.L9
	cmpl	$1, -500024(%rbp)
	jne	.L10
	movl	-500028(%rbp), %eax
	cltq
	movb	$0, -500016(%rbp,%rax)
	movl	-500032(%rbp), %eax
	cltq
	leaq	-500016(%rbp), %rdx
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$10, %edi
	call	putchar@PLT
	jmp	.L11
.L10:
	movl	-500028(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -500020(%rbp)
	jmp	.L12
.L13:
	movl	-500020(%rbp), %eax
	cltq
	movzbl	-500016(%rbp,%rax), %eax
	movsbl	%al, %eax
	movl	%eax, %edi
	call	putchar@PLT
	subl	$1, -500020(%rbp)
.L12:
	movl	-500020(%rbp), %eax
	cmpl	-500032(%rbp), %eax
	jge	.L13
	movl	$10, %edi
	call	putchar@PLT
.L11:
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L15
	call	__stack_chk_fail@PLT
.L15:
	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
	.section	.rodata
.LC0:
	.string	"%s"
.LC1:
	.string	"%d"
.LC2:
	.string	" %c"
	.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
	leaq	-499712(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$336, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-500016(%rbp), %rax
	addq	$200000, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$200000, -500032(%rbp)
	leaq	-500016(%rbp), %rax
	addq	$200000, %rax
	movq	%rax, %rdi
	call	strlen@PLT
	addl	$200000, %eax
	movl	%eax, -500028(%rbp)
	movl	$1, -500024(%rbp)
	leaq	-500044(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -500020(%rbp)
	jmp	.L2
.L9:
	leaq	-500040(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-500040(%rbp), %eax
	cmpl	$1, %eax
	jne	.L3
	cmpl	$1, -500024(%rbp)
	jne	.L4
	movl	$2, %eax
	jmp	.L5
.L4:
	movl	$1, %eax
.L5:
	movl	%eax, -500024(%rbp)
	jmp	.L6
.L3:
	leaq	-500036(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-500045(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-500036(%rbp), %eax
	cmpl	%eax, -500024(%rbp)
	jne	.L7
	subl	$1, -500032(%rbp)
	movzbl	-500045(%rbp), %edx
	movl	-500032(%rbp), %eax
	cltq
	movb	%dl, -500016(%rbp,%rax)
	jmp	.L6
.L7:
	movl	-500028(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -500028(%rbp)
	movzbl	-500045(%rbp), %edx
	cltq
	movb	%dl, -500016(%rbp,%rax)
.L6:
	addl	$1, -500020(%rbp)
.L2:
	movl	-500044(%rbp), %eax
	cmpl	%eax, -500020(%rbp)
	jl	.L9
	cmpl	$1, -500024(%rbp)
	jne	.L10
	movl	-500028(%rbp), %eax
	cltq
	movb	$0, -500016(%rbp,%rax)
	movl	-500032(%rbp), %eax
	cltq
	leaq	-500016(%rbp), %rdx
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$10, %edi
	call	putchar@PLT
	jmp	.L11
.L10:
	movl	-500028(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -500020(%rbp)
	jmp	.L12
.L13:
	movl	-500020(%rbp), %eax
	cltq
	movzbl	-500016(%rbp,%rax), %eax
	movsbl	%al, %eax
	movl	%eax, %edi
	call	putchar@PLT
	subl	$1, -500020(%rbp)
.L12:
	movl	-500020(%rbp), %eax
	cmpl	-500032(%rbp), %eax
	jge	.L13
	movl	$10, %edi
	call	putchar@PLT
.L11:
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L15
	call	__stack_chk_fail@PLT
.L15:
	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:
