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() {
	char ch[250] = { 0 };
	char a[250] = { 0 };
	int h;
	int i, j, k, l, n, m;

	while (1) {
		i = 0;
		while (1) {
			scanf("%c", &ch[i]);
			if (ch[i] == '\n') {
				break;
			}
			i++;
		}
		if (i == 1 && ch[0] == '-') break;

		scanf("%d", &m);

		for (j = 0; j<m; j++) {
			scanf("%d", &h);
			for (k = 0; k<i - h; k++) {
				a[k] = ch[h + k];
			}
			for (k = 0; k<h; k++) {
				a[i - h + k] = ch[k];
			}
			for (k = 0; k<i; k++) {
				ch[k] = a[k];
			}
		}
		for (k = 0; k<i; k++) {
			printf("%c", ch[k]);
		}
		printf("\n");
		scanf("%c", &ch[0]);
	}

	return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%c"
.LC1:
	.string	"%d"
	.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	$560, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movq	$0, -528(%rbp)
	movq	$0, -520(%rbp)
	leaq	-512(%rbp), %rdx
	movl	$0, %eax
	movl	$29, %ecx
	movq	%rdx, %rdi
	rep stosq
	movq	%rdi, %rdx
	movw	%ax, (%rdx)
	addq	$2, %rdx
	movq	$0, -272(%rbp)
	movq	$0, -264(%rbp)
	leaq	-256(%rbp), %rdx
	movl	$0, %eax
	movl	$29, %ecx
	movq	%rdx, %rdi
	rep stosq
	movq	%rdi, %rdx
	movw	%ax, (%rdx)
	addq	$2, %rdx
.L17:
	movl	$0, -540(%rbp)
.L4:
	leaq	-528(%rbp), %rdx
	movl	-540(%rbp), %eax
	cltq
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-540(%rbp), %eax
	cltq
	movzbl	-528(%rbp,%rax), %eax
	cmpb	$10, %al
	je	.L22
	addl	$1, -540(%rbp)
	jmp	.L4
.L22:
	nop
	cmpl	$1, -540(%rbp)
	jne	.L5
	movzbl	-528(%rbp), %eax
	cmpb	$45, %al
	je	.L23
.L5:
	leaq	-544(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -536(%rbp)
	jmp	.L7
.L14:
	leaq	-548(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -532(%rbp)
	jmp	.L8
.L9:
	movl	-548(%rbp), %edx
	movl	-532(%rbp), %eax
	addl	%edx, %eax
	cltq
	movzbl	-528(%rbp,%rax), %edx
	movl	-532(%rbp), %eax
	cltq
	movb	%dl, -272(%rbp,%rax)
	addl	$1, -532(%rbp)
.L8:
	movl	-548(%rbp), %edx
	movl	-540(%rbp), %eax
	subl	%edx, %eax
	cmpl	%eax, -532(%rbp)
	jl	.L9
	movl	$0, -532(%rbp)
	jmp	.L10
.L11:
	movl	-548(%rbp), %edx
	movl	-540(%rbp), %eax
	subl	%edx, %eax
	movl	%eax, %ecx
	movl	-532(%rbp), %eax
	addl	%eax, %ecx
	movl	-532(%rbp), %eax
	cltq
	movzbl	-528(%rbp,%rax), %edx
	movslq	%ecx, %rax
	movb	%dl, -272(%rbp,%rax)
	addl	$1, -532(%rbp)
.L10:
	movl	-548(%rbp), %eax
	cmpl	%eax, -532(%rbp)
	jl	.L11
	movl	$0, -532(%rbp)
	jmp	.L12
.L13:
	movl	-532(%rbp), %eax
	cltq
	movzbl	-272(%rbp,%rax), %edx
	movl	-532(%rbp), %eax
	cltq
	movb	%dl, -528(%rbp,%rax)
	addl	$1, -532(%rbp)
.L12:
	movl	-532(%rbp), %eax
	cmpl	-540(%rbp), %eax
	jl	.L13
	addl	$1, -536(%rbp)
.L7:
	movl	-544(%rbp), %eax
	cmpl	%eax, -536(%rbp)
	jl	.L14
	movl	$0, -532(%rbp)
	jmp	.L15
.L16:
	movl	-532(%rbp), %eax
	cltq
	movzbl	-528(%rbp,%rax), %eax
	movsbl	%al, %eax
	movl	%eax, %edi
	call	putchar@PLT
	addl	$1, -532(%rbp)
.L15:
	movl	-532(%rbp), %eax
	cmpl	-540(%rbp), %eax
	jl	.L16
	movl	$10, %edi
	call	putchar@PLT
	leaq	-528(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	jmp	.L17
.L23:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L19
	call	__stack_chk_fail@PLT
.L19:
	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	"%c"
.LC1:
	.string	"%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
	movl	$29, %ecx
	xorl	%esi, %esi
	pxor	%xmm0, %xmm0
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	leaq	.LC1(%rip), %r15
	leaq	.LC0(%rip), %r14
	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	$568, %rsp
	.cfi_def_cfa_offset 624
	movq	%fs:40, %rax
	movq	%rax, 552(%rsp)
	xorl	%eax, %eax
	leaq	48(%rsp), %rdi
	movaps	%xmm0, 32(%rsp)
	leaq	32(%rsp), %r12
	movaps	%xmm0, 288(%rsp)
	leaq	288(%rsp), %r13
	rep stosq
	xorl	%ecx, %ecx
	movw	%cx, (%rdi)
	leaq	304(%rsp), %rdi
	movl	$29, %ecx
	rep stosq
	leaq	24(%rsp), %rax
	movq	%rax, 8(%rsp)
	movw	%si, (%rdi)
	.p2align 4,,10
	.p2align 3
.L20:
	movq	%r12, %rbp
	xorl	%ebx, %ebx
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L40:
	addl	$1, %ebx
.L3:
	movq	%rbp, %rsi
	xorl	%eax, %eax
	movq	%r14, %rdi
	addq	$1, %rbp
	call	__isoc99_scanf@PLT
	cmpb	$10, -1(%rbp)
	jne	.L40
	cmpl	$1, %ebx
	jne	.L4
	cmpb	$45, 32(%rsp)
	je	.L41
	leaq	28(%rsp), %rsi
	movq	%r15, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	28(%rsp), %eax
	testl	%eax, %eax
	jle	.L42
.L21:
	xorl	%ebp, %ebp
	.p2align 4,,10
	.p2align 3
.L18:
	movq	8(%rsp), %rsi
	movq	%r15, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	24(%rsp), %r8d
	movl	%ebx, %ecx
	subl	%r8d, %ecx
	testl	%ecx, %ecx
	jle	.L8
	movslq	%r8d, %rsi
	movslq	%ecx, %rdx
	movq	%r13, %rdi
	movl	%ecx, 4(%rsp)
	addq	%r12, %rsi
	movl	%r8d, (%rsp)
	call	memcpy@PLT
	movl	4(%rsp), %ecx
	movl	(%rsp), %r8d
.L8:
	testl	%r8d, %r8d
	jle	.L9
	movslq	%ecx, %rdi
	movslq	%r8d, %rdx
	movq	%r12, %rsi
	addq	%r13, %rdi
	call	memcpy@PLT
.L9:
	testl	%ebx, %ebx
	je	.L10
	movq	%r12, %rdi
	movq	%r13, %rsi
	cmpl	$8, %ebx
	jb	.L11
	movl	%ebx, %ecx
	shrl	$3, %ecx
	rep movsq
.L11:
	xorl	%eax, %eax
	testb	$4, %bl
	je	.L12
	movl	(%rsi), %eax
	movl	%eax, (%rdi)
	movl	$4, %eax
.L12:
	testb	$2, %bl
	je	.L13
	movzwl	(%rsi,%rax), %edx
	movw	%dx, (%rdi,%rax)
	addq	$2, %rax
.L13:
	testb	$1, %bl
	je	.L14
	movzbl	(%rsi,%rax), %edx
	movb	%dl, (%rdi,%rax)
.L14:
	addl	$1, %ebp
	cmpl	%ebp, 28(%rsp)
	jg	.L18
.L16:
	xorl	%ebp, %ebp
	.p2align 4,,10
	.p2align 3
.L19:
	movsbl	(%r12,%rbp), %edi
	addq	$1, %rbp
	call	putchar@PLT
	cmpl	%ebp, %ebx
	jg	.L19
.L17:
	movl	$10, %edi
	call	putchar@PLT
	movq	%r12, %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	jmp	.L20
.L42:
	movsbl	32(%rsp), %edi
	call	putchar@PLT
	jmp	.L17
	.p2align 4,,10
	.p2align 3
.L10:
	addl	$1, %ebp
	cmpl	%ebp, 28(%rsp)
	jg	.L18
	jmp	.L17
.L4:
	leaq	28(%rsp), %rsi
	movq	%r15, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	28(%rsp), %edx
	testl	%edx, %edx
	jg	.L21
	testl	%ebx, %ebx
	jne	.L16
	jmp	.L17
	.p2align 4,,10
	.p2align 3
.L41:
	movq	552(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L43
	addq	$568, %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
.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	"%c"
.LC1:
	.string	"%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
	movl	$29, %ecx
	xorl	%esi, %esi
	pxor	%xmm0, %xmm0
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	leaq	.LC1(%rip), %r15
	leaq	.LC0(%rip), %r14
	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	$568, %rsp
	.cfi_def_cfa_offset 624
	movq	%fs:40, %rax
	movq	%rax, 552(%rsp)
	xorl	%eax, %eax
	leaq	48(%rsp), %rdi
	movaps	%xmm0, 32(%rsp)
	leaq	32(%rsp), %r12
	movaps	%xmm0, 288(%rsp)
	leaq	288(%rsp), %r13
	rep stosq
	xorl	%ecx, %ecx
	movw	%cx, (%rdi)
	leaq	304(%rsp), %rdi
	movl	$29, %ecx
	rep stosq
	leaq	24(%rsp), %rax
	movq	%rax, 8(%rsp)
	movw	%si, (%rdi)
	.p2align 4,,10
	.p2align 3
.L20:
	movq	%r12, %rbp
	xorl	%ebx, %ebx
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L40:
	addl	$1, %ebx
.L3:
	movq	%rbp, %rsi
	xorl	%eax, %eax
	movq	%r14, %rdi
	addq	$1, %rbp
	call	__isoc99_scanf@PLT
	cmpb	$10, -1(%rbp)
	jne	.L40
	cmpl	$1, %ebx
	jne	.L4
	cmpb	$45, 32(%rsp)
	je	.L41
	leaq	28(%rsp), %rsi
	movq	%r15, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	28(%rsp), %eax
	testl	%eax, %eax
	jle	.L42
.L21:
	xorl	%ebp, %ebp
	.p2align 4,,10
	.p2align 3
.L18:
	movq	8(%rsp), %rsi
	movq	%r15, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	24(%rsp), %r8d
	movl	%ebx, %ecx
	subl	%r8d, %ecx
	testl	%ecx, %ecx
	jle	.L8
	movslq	%r8d, %rsi
	movslq	%ecx, %rdx
	movq	%r13, %rdi
	movl	%ecx, 4(%rsp)
	addq	%r12, %rsi
	movl	%r8d, (%rsp)
	call	memcpy@PLT
	movl	4(%rsp), %ecx
	movl	(%rsp), %r8d
.L8:
	testl	%r8d, %r8d
	jle	.L9
	movslq	%ecx, %rdi
	movslq	%r8d, %rdx
	movq	%r12, %rsi
	addq	%r13, %rdi
	call	memcpy@PLT
.L9:
	testl	%ebx, %ebx
	je	.L10
	movq	%r12, %rdi
	movq	%r13, %rsi
	cmpl	$8, %ebx
	jb	.L11
	movl	%ebx, %ecx
	shrl	$3, %ecx
	rep movsq
.L11:
	xorl	%eax, %eax
	testb	$4, %bl
	je	.L12
	movl	(%rsi), %eax
	movl	%eax, (%rdi)
	movl	$4, %eax
.L12:
	testb	$2, %bl
	je	.L13
	movzwl	(%rsi,%rax), %edx
	movw	%dx, (%rdi,%rax)
	addq	$2, %rax
.L13:
	testb	$1, %bl
	je	.L14
	movzbl	(%rsi,%rax), %edx
	movb	%dl, (%rdi,%rax)
.L14:
	addl	$1, %ebp
	cmpl	%ebp, 28(%rsp)
	jg	.L18
.L16:
	xorl	%ebp, %ebp
	.p2align 4,,10
	.p2align 3
.L19:
	movsbl	(%r12,%rbp), %edi
	addq	$1, %rbp
	call	putchar@PLT
	cmpl	%ebp, %ebx
	jg	.L19
.L17:
	movl	$10, %edi
	call	putchar@PLT
	movq	%r12, %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	jmp	.L20
.L42:
	movsbl	32(%rsp), %edi
	call	putchar@PLT
	jmp	.L17
	.p2align 4,,10
	.p2align 3
.L10:
	addl	$1, %ebp
	cmpl	%ebp, 28(%rsp)
	jg	.L18
	jmp	.L17
.L4:
	leaq	28(%rsp), %rsi
	movq	%r15, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	28(%rsp), %edx
	testl	%edx, %edx
	jg	.L21
	testl	%ebx, %ebx
	jne	.L16
	jmp	.L17
	.p2align 4,,10
	.p2align 3
.L41:
	movq	552(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L43
	addq	$568, %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
.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() {
	char ch[250] = { 0 };
	char a[250] = { 0 };
	int h;
	int i, j, k, l, n, m;

	while (1) {
		i = 0;
		while (1) {
			scanf("%c", &ch[i]);
			if (ch[i] == '\n') {
				break;
			}
			i++;
		}
		if (i == 1 && ch[0] == '-') break;

		scanf("%d", &m);

		for (j = 0; j<m; j++) {
			scanf("%d", &h);
			for (k = 0; k<i - h; k++) {
				a[k] = ch[h + k];
			}
			for (k = 0; k<h; k++) {
				a[i - h + k] = ch[k];
			}
			for (k = 0; k<i; k++) {
				ch[k] = a[k];
			}
		}
		for (k = 0; k<i; k++) {
			printf("%c", ch[k]);
		}
		printf("\n");
		scanf("%c", &ch[0]);
	}

	return 0;
}

aaac
3
1
2
1
vwxyz
2
3
4
-
 caaa
3
1
2
1
vwxyz
2
3
4
-
 caaa
3
1
2
2
vxxyz
2
3
4
-
 ca`a
3
1
2
2
vwxyz
2
3
4
-
 caaa
3
1
0
2
vwxyz
2
3
4
-
 caaa
3
1
-1
2
vwxyz
2
3
4
-
 aaac
3
1
2
1
vwxyz
2
2
4
-
 ca`a
3
1
2
1
vwxyz
2
3
4
-
 ca`a
3
1
2
2
vwxyz
2
2
4
-
 caaa
3
1
0
2
vwxyz
2
3
2
-

aaac
xyzvw
 caaa
xyzvw
 aaac
xyzvx
 a`ac
xyzvw
 acaa
xyzvw
 aaa
xyzvw
 aaac
wxyzv
 ca`a
xyzvw
 a`ac
wxyzv
 acaa
vwxyz

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() {
	char ch[250] = { 0 };
	char a[250] = { 0 };
	int h;
	int i, j, k, l, n, m;

	while (1) {
		i = 0;
		while (1) {
			scanf("%c", &ch[i]);
			if (ch[i] == '\n') {
				break;
			}
			i++;
		}
		if (i == 1 && ch[0] == '-') break;

		scanf("%d", &m);

		for (j = 0; j<m; j++) {
			scanf("%d", &h);
			for (k = 0; k<i - h; k++) {
				a[k] = ch[h + k];
			}
			for (k = 0; k<h; k++) {
				a[i - h + k] = ch[k];
			}
			for (k = 0; k<i; k++) {
				ch[k] = a[k];
			}
		}
		for (k = 0; k<i; k++) {
			printf("%c", ch[k]);
		}
		printf("\n");
		scanf("%c", &ch[0]);
	}

	return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%c"
.LC1:
	.string	"%d"
	.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	$560, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movq	$0, -528(%rbp)
	movq	$0, -520(%rbp)
	leaq	-512(%rbp), %rdx
	movl	$0, %eax
	movl	$29, %ecx
	movq	%rdx, %rdi
	rep stosq
	movq	%rdi, %rdx
	movw	%ax, (%rdx)
	addq	$2, %rdx
	movq	$0, -272(%rbp)
	movq	$0, -264(%rbp)
	leaq	-256(%rbp), %rdx
	movl	$0, %eax
	movl	$29, %ecx
	movq	%rdx, %rdi
	rep stosq
	movq	%rdi, %rdx
	movw	%ax, (%rdx)
	addq	$2, %rdx
.L17:
	movl	$0, -540(%rbp)
.L4:
	leaq	-528(%rbp), %rdx
	movl	-540(%rbp), %eax
	cltq
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-540(%rbp), %eax
	cltq
	movzbl	-528(%rbp,%rax), %eax
	cmpb	$10, %al
	je	.L22
	addl	$1, -540(%rbp)
	jmp	.L4
.L22:
	nop
	cmpl	$1, -540(%rbp)
	jne	.L5
	movzbl	-528(%rbp), %eax
	cmpb	$45, %al
	je	.L23
.L5:
	leaq	-544(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -536(%rbp)
	jmp	.L7
.L14:
	leaq	-548(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -532(%rbp)
	jmp	.L8
.L9:
	movl	-548(%rbp), %edx
	movl	-532(%rbp), %eax
	addl	%edx, %eax
	cltq
	movzbl	-528(%rbp,%rax), %edx
	movl	-532(%rbp), %eax
	cltq
	movb	%dl, -272(%rbp,%rax)
	addl	$1, -532(%rbp)
.L8:
	movl	-548(%rbp), %edx
	movl	-540(%rbp), %eax
	subl	%edx, %eax
	cmpl	%eax, -532(%rbp)
	jl	.L9
	movl	$0, -532(%rbp)
	jmp	.L10
.L11:
	movl	-548(%rbp), %edx
	movl	-540(%rbp), %eax
	subl	%edx, %eax
	movl	%eax, %ecx
	movl	-532(%rbp), %eax
	addl	%eax, %ecx
	movl	-532(%rbp), %eax
	cltq
	movzbl	-528(%rbp,%rax), %edx
	movslq	%ecx, %rax
	movb	%dl, -272(%rbp,%rax)
	addl	$1, -532(%rbp)
.L10:
	movl	-548(%rbp), %eax
	cmpl	%eax, -532(%rbp)
	jl	.L11
	movl	$0, -532(%rbp)
	jmp	.L12
.L13:
	movl	-532(%rbp), %eax
	cltq
	movzbl	-272(%rbp,%rax), %edx
	movl	-532(%rbp), %eax
	cltq
	movb	%dl, -528(%rbp,%rax)
	addl	$1, -532(%rbp)
.L12:
	movl	-532(%rbp), %eax
	cmpl	-540(%rbp), %eax
	jl	.L13
	addl	$1, -536(%rbp)
.L7:
	movl	-544(%rbp), %eax
	cmpl	%eax, -536(%rbp)
	jl	.L14
	movl	$0, -532(%rbp)
	jmp	.L15
.L16:
	movl	-532(%rbp), %eax
	cltq
	movzbl	-528(%rbp,%rax), %eax
	movsbl	%al, %eax
	movl	%eax, %edi
	call	putchar@PLT
	addl	$1, -532(%rbp)
.L15:
	movl	-532(%rbp), %eax
	cmpl	-540(%rbp), %eax
	jl	.L16
	movl	$10, %edi
	call	putchar@PLT
	leaq	-528(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	jmp	.L17
.L23:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L19
	call	__stack_chk_fail@PLT
.L19:
	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	"%c"
.LC1:
	.string	"%d"
	.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	$560, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movq	$0, -528(%rbp)
	movq	$0, -520(%rbp)
	leaq	-512(%rbp), %rdx
	movl	$0, %eax
	movl	$29, %ecx
	movq	%rdx, %rdi
	rep stosq
	movq	%rdi, %rdx
	movw	%ax, (%rdx)
	addq	$2, %rdx
	movq	$0, -272(%rbp)
	movq	$0, -264(%rbp)
	leaq	-256(%rbp), %rdx
	movl	$0, %eax
	movl	$29, %ecx
	movq	%rdx, %rdi
	rep stosq
	movq	%rdi, %rdx
	movw	%ax, (%rdx)
	addq	$2, %rdx
.L17:
	movl	$0, -540(%rbp)
.L4:
	leaq	-528(%rbp), %rdx
	movl	-540(%rbp), %eax
	cltq
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-540(%rbp), %eax
	cltq
	movzbl	-528(%rbp,%rax), %eax
	cmpb	$10, %al
	je	.L22
	addl	$1, -540(%rbp)
	jmp	.L4
.L22:
	nop
	cmpl	$1, -540(%rbp)
	jne	.L5
	movzbl	-528(%rbp), %eax
	cmpb	$45, %al
	je	.L23
.L5:
	leaq	-544(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -536(%rbp)
	jmp	.L7
.L14:
	leaq	-548(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -532(%rbp)
	jmp	.L8
.L9:
	movl	-548(%rbp), %edx
	movl	-532(%rbp), %eax
	addl	%edx, %eax
	cltq
	movzbl	-528(%rbp,%rax), %edx
	movl	-532(%rbp), %eax
	cltq
	movb	%dl, -272(%rbp,%rax)
	addl	$1, -532(%rbp)
.L8:
	movl	-548(%rbp), %edx
	movl	-540(%rbp), %eax
	subl	%edx, %eax
	cmpl	%eax, -532(%rbp)
	jl	.L9
	movl	$0, -532(%rbp)
	jmp	.L10
.L11:
	movl	-548(%rbp), %edx
	movl	-540(%rbp), %eax
	subl	%edx, %eax
	movl	%eax, %ecx
	movl	-532(%rbp), %eax
	addl	%eax, %ecx
	movl	-532(%rbp), %eax
	cltq
	movzbl	-528(%rbp,%rax), %edx
	movslq	%ecx, %rax
	movb	%dl, -272(%rbp,%rax)
	addl	$1, -532(%rbp)
.L10:
	movl	-548(%rbp), %eax
	cmpl	%eax, -532(%rbp)
	jl	.L11
	movl	$0, -532(%rbp)
	jmp	.L12
.L13:
	movl	-532(%rbp), %eax
	cltq
	movzbl	-272(%rbp,%rax), %edx
	movl	-532(%rbp), %eax
	cltq
	movb	%dl, -528(%rbp,%rax)
	addl	$1, -532(%rbp)
.L12:
	movl	-532(%rbp), %eax
	cmpl	-540(%rbp), %eax
	jl	.L13
	addl	$1, -536(%rbp)
.L7:
	movl	-544(%rbp), %eax
	cmpl	%eax, -536(%rbp)
	jl	.L14
	movl	$0, -532(%rbp)
	jmp	.L15
.L16:
	movl	-532(%rbp), %eax
	cltq
	movzbl	-528(%rbp,%rax), %eax
	movsbl	%al, %eax
	movl	%eax, %edi
	call	putchar@PLT
	addl	$1, -532(%rbp)
.L15:
	movl	-532(%rbp), %eax
	cmpl	-540(%rbp), %eax
	jl	.L16
	movl	$10, %edi
	call	putchar@PLT
	leaq	-528(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	jmp	.L17
.L23:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L19
	call	__stack_chk_fail@PLT
.L19:
	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:
