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>
#include <string.h>
#define min(X, Y) ((X) < (Y) ? (X) : (Y))

int ch_string(char str[], char ch);

int n;
char str[55];
int ch[30];

int main()
{
	for (int i = 0; i < 30; i++) {
		ch[i] = 100000;
	}

	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%s", str);

		for (int j = 'a'; j <= 'z'; j++) {
			ch[j - 'a'] = min(ch[j - 'a'], ch_string(str, j));
		}
	}

	for (int i = 'a'; i <= 'z'; i++) {

		if (ch[i - 'a'] < 100000) {
			for (int j = 0; j < ch[i - 'a']; j++) {
				putchar(i);
			}
		}
	}

	return 0;
}

int ch_string(char str[], char ch)
{
	int res = 0;

	while (*str != '\0') {
		if (*str == ch) {
			res++;
		}
		str++;
	}

	return res;
}
```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC2:
	.string	"%d"
.LC3:
	.string	"%s"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB35:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	n(%rip), %rsi
	leaq	.LC2(%rip), %rdi
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	leaq	str(%rip), %r13
	xorl	%r12d, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	leaq	-388+ch(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	leaq	.LC3(%rip), %rbx
	subq	$8, %rsp
	.cfi_def_cfa_offset 48
	movq	.LC1(%rip), %rax
	movdqa	.LC0(%rip), %xmm0
	movq	%rax, 112+ch(%rip)
	xorl	%eax, %eax
	movaps	%xmm0, ch(%rip)
	movaps	%xmm0, 16+ch(%rip)
	movaps	%xmm0, 32+ch(%rip)
	movaps	%xmm0, 48+ch(%rip)
	movaps	%xmm0, 64+ch(%rip)
	movaps	%xmm0, 80+ch(%rip)
	movaps	%xmm0, 96+ch(%rip)
	call	__isoc99_scanf@PLT
	movl	n(%rip), %eax
	testl	%eax, %eax
	jle	.L12
.L2:
	movq	%r13, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movzbl	0(%r13), %r9d
	movl	$97, %esi
	.p2align 4,,10
	.p2align 3
.L11:
	movl	0(%rbp,%rsi,4), %edi
	testb	%r9b, %r9b
	je	.L4
	movl	%r9d, %edx
	leaq	str(%rip), %rax
	xorl	%ecx, %ecx
	movl	%esi, %r8d
	.p2align 4,,10
	.p2align 3
.L6:
	cmpb	%sil, %dl
	sete	%dl
	addq	$1, %rax
	movzbl	%dl, %edx
	addl	%edx, %ecx
	movzbl	(%rax), %edx
	testb	%dl, %dl
	jne	.L6
	cmpl	%ecx, %edi
	jge	.L31
.L8:
	movl	%edi, 0(%rbp,%rsi,4)
	addq	$1, %rsi
	cmpq	$123, %rsi
	jne	.L11
	addl	$1, %r12d
	cmpl	%r12d, n(%rip)
	jg	.L2
.L12:
	leaq	ch(%rip), %r12
	movl	$97, %ebp
	.p2align 4,,10
	.p2align 3
.L3:
	movl	(%r12), %eax
	xorl	%ebx, %ebx
	subl	$1, %eax
	cmpl	$99998, %eax
	ja	.L15
.L13:
	movq	stdout(%rip), %rsi
	movl	%ebp, %edi
	addl	$1, %ebx
	call	putc@PLT
	cmpl	%ebx, (%r12)
	jg	.L13
.L15:
	addl	$1, %ebp
	addq	$4, %r12
	cmpl	$123, %ebp
	jne	.L3
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L31:
	.cfi_restore_state
	movl	%r9d, %edx
	leaq	str(%rip), %rax
	xorl	%edi, %edi
	.p2align 4,,10
	.p2align 3
.L10:
	cmpb	%r8b, %dl
	sete	%dl
	addq	$1, %rax
	movzbl	%dl, %edx
	addl	%edx, %edi
	movzbl	(%rax), %edx
	testb	%dl, %dl
	jne	.L10
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L4:
	xorl	%eax, %eax
	testl	%edi, %edi
	cmovg	%eax, %edi
	jmp	.L8
	.cfi_endproc
.LFE35:
	.size	main, .-main
	.text
	.p2align 4
	.globl	ch_string
	.type	ch_string, @function
ch_string:
.LFB36:
	.cfi_startproc
	endbr64
	movzbl	(%rdi), %eax
	xorl	%r8d, %r8d
	testb	%al, %al
	je	.L32
	.p2align 4,,10
	.p2align 3
.L35:
	cmpb	%sil, %al
	sete	%al
	addq	$1, %rdi
	movzbl	%al, %eax
	addl	%eax, %r8d
	movzbl	(%rdi), %eax
	testb	%al, %al
	jne	.L35
.L32:
	movl	%r8d, %eax
	ret
	.cfi_endproc
.LFE36:
	.size	ch_string, .-ch_string
	.globl	ch
	.bss
	.align 32
	.type	ch, @object
	.size	ch, 120
ch:
	.zero	120
	.globl	str
	.align 32
	.type	str, @object
	.size	str, 55
str:
	.zero	55
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.long	100000
	.long	100000
	.long	100000
	.long	100000
	.set	.LC1,.LC0
	.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	"%s"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB35:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	n(%rip), %rsi
	leaq	.LC2(%rip), %rdi
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	leaq	str(%rip), %r13
	xorl	%r12d, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	leaq	-388+ch(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	leaq	.LC3(%rip), %rbx
	subq	$8, %rsp
	.cfi_def_cfa_offset 48
	movq	.LC1(%rip), %rax
	movdqa	.LC0(%rip), %xmm0
	movq	%rax, 112+ch(%rip)
	xorl	%eax, %eax
	movaps	%xmm0, ch(%rip)
	movaps	%xmm0, 16+ch(%rip)
	movaps	%xmm0, 32+ch(%rip)
	movaps	%xmm0, 48+ch(%rip)
	movaps	%xmm0, 64+ch(%rip)
	movaps	%xmm0, 80+ch(%rip)
	movaps	%xmm0, 96+ch(%rip)
	call	__isoc99_scanf@PLT
	movl	n(%rip), %eax
	testl	%eax, %eax
	jle	.L12
.L2:
	movq	%r13, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movzbl	0(%r13), %r9d
	movl	$97, %esi
	.p2align 4,,10
	.p2align 3
.L11:
	movl	0(%rbp,%rsi,4), %edi
	testb	%r9b, %r9b
	je	.L4
	movl	%r9d, %edx
	leaq	str(%rip), %rax
	xorl	%ecx, %ecx
	movl	%esi, %r8d
	.p2align 4,,10
	.p2align 3
.L6:
	cmpb	%sil, %dl
	sete	%dl
	addq	$1, %rax
	movzbl	%dl, %edx
	addl	%edx, %ecx
	movzbl	(%rax), %edx
	testb	%dl, %dl
	jne	.L6
	cmpl	%ecx, %edi
	jge	.L31
.L8:
	movl	%edi, 0(%rbp,%rsi,4)
	addq	$1, %rsi
	cmpq	$123, %rsi
	jne	.L11
	addl	$1, %r12d
	cmpl	%r12d, n(%rip)
	jg	.L2
.L12:
	leaq	ch(%rip), %r12
	movl	$97, %ebp
	.p2align 4,,10
	.p2align 3
.L3:
	movl	(%r12), %eax
	xorl	%ebx, %ebx
	subl	$1, %eax
	cmpl	$99998, %eax
	ja	.L15
.L13:
	movq	stdout(%rip), %rsi
	movl	%ebp, %edi
	addl	$1, %ebx
	call	putc@PLT
	cmpl	%ebx, (%r12)
	jg	.L13
.L15:
	addl	$1, %ebp
	addq	$4, %r12
	cmpl	$123, %ebp
	jne	.L3
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L31:
	.cfi_restore_state
	movl	%r9d, %edx
	leaq	str(%rip), %rax
	xorl	%edi, %edi
	.p2align 4,,10
	.p2align 3
.L10:
	cmpb	%r8b, %dl
	sete	%dl
	addq	$1, %rax
	movzbl	%dl, %edx
	addl	%edx, %edi
	movzbl	(%rax), %edx
	testb	%dl, %dl
	jne	.L10
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L4:
	xorl	%eax, %eax
	testl	%edi, %edi
	cmovg	%eax, %edi
	jmp	.L8
	.cfi_endproc
.LFE35:
	.size	main, .-main
	.text
	.p2align 4
	.globl	ch_string
	.type	ch_string, @function
ch_string:
.LFB36:
	.cfi_startproc
	endbr64
	movzbl	(%rdi), %eax
	xorl	%r8d, %r8d
	testb	%al, %al
	je	.L32
	.p2align 4,,10
	.p2align 3
.L35:
	cmpb	%sil, %al
	sete	%al
	addq	$1, %rdi
	movzbl	%al, %eax
	addl	%eax, %r8d
	movzbl	(%rdi), %eax
	testb	%al, %al
	jne	.L35
.L32:
	movl	%r8d, %eax
	ret
	.cfi_endproc
.LFE36:
	.size	ch_string, .-ch_string
	.globl	ch
	.bss
	.align 32
	.type	ch, @object
	.size	ch, 120
ch:
	.zero	120
	.globl	str
	.align 32
	.type	str, @object
	.size	str, 55
str:
	.zero	55
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.long	100000
	.long	100000
	.long	100000
	.long	100000
	.set	.LC1,.LC0
	.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	"%s"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB35:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	n(%rip), %rsi
	leaq	.LC2(%rip), %rdi
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	leaq	str(%rip), %r13
	xorl	%r12d, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	leaq	-388+ch(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	leaq	.LC3(%rip), %rbx
	subq	$8, %rsp
	.cfi_def_cfa_offset 48
	movq	.LC1(%rip), %rax
	movdqa	.LC0(%rip), %xmm0
	movq	%rax, 112+ch(%rip)
	xorl	%eax, %eax
	movaps	%xmm0, ch(%rip)
	movaps	%xmm0, 16+ch(%rip)
	movaps	%xmm0, 32+ch(%rip)
	movaps	%xmm0, 48+ch(%rip)
	movaps	%xmm0, 64+ch(%rip)
	movaps	%xmm0, 80+ch(%rip)
	movaps	%xmm0, 96+ch(%rip)
	call	__isoc99_scanf@PLT
	movl	n(%rip), %eax
	testl	%eax, %eax
	jle	.L12
.L2:
	movq	%r13, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movzbl	0(%r13), %r9d
	movl	$97, %esi
	.p2align 4,,10
	.p2align 3
.L11:
	movl	0(%rbp,%rsi,4), %edi
	testb	%r9b, %r9b
	je	.L4
	movl	%r9d, %edx
	leaq	str(%rip), %rax
	xorl	%ecx, %ecx
	movl	%esi, %r8d
	.p2align 4,,10
	.p2align 3
.L6:
	cmpb	%sil, %dl
	sete	%dl
	addq	$1, %rax
	movzbl	%dl, %edx
	addl	%edx, %ecx
	movzbl	(%rax), %edx
	testb	%dl, %dl
	jne	.L6
	cmpl	%ecx, %edi
	jge	.L31
.L8:
	movl	%edi, 0(%rbp,%rsi,4)
	addq	$1, %rsi
	cmpq	$123, %rsi
	jne	.L11
	addl	$1, %r12d
	cmpl	%r12d, n(%rip)
	jg	.L2
.L12:
	leaq	ch(%rip), %r12
	movl	$97, %ebp
	.p2align 4,,10
	.p2align 3
.L3:
	movl	(%r12), %eax
	xorl	%ebx, %ebx
	subl	$1, %eax
	cmpl	$99998, %eax
	ja	.L15
.L13:
	movq	stdout(%rip), %rsi
	movl	%ebp, %edi
	addl	$1, %ebx
	call	putc@PLT
	cmpl	%ebx, (%r12)
	jg	.L13
.L15:
	addl	$1, %ebp
	addq	$4, %r12
	cmpl	$123, %ebp
	jne	.L3
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L31:
	.cfi_restore_state
	movl	%r9d, %edx
	leaq	str(%rip), %rax
	xorl	%edi, %edi
	.p2align 4,,10
	.p2align 3
.L10:
	cmpb	%r8b, %dl
	sete	%dl
	addq	$1, %rax
	movzbl	%dl, %edx
	addl	%edx, %edi
	movzbl	(%rax), %edx
	testb	%dl, %dl
	jne	.L10
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L4:
	xorl	%eax, %eax
	testl	%edi, %edi
	cmovg	%eax, %edi
	jmp	.L8
	.cfi_endproc
.LFE35:
	.size	main, .-main
	.text
	.p2align 4
	.globl	ch_string
	.type	ch_string, @function
ch_string:
.LFB36:
	.cfi_startproc
	endbr64
	movzbl	(%rdi), %eax
	xorl	%r8d, %r8d
	testb	%al, %al
	je	.L32
	.p2align 4,,10
	.p2align 3
.L35:
	cmpb	%sil, %al
	sete	%al
	addq	$1, %rdi
	movzbl	%al, %eax
	addl	%eax, %r8d
	movzbl	(%rdi), %eax
	testb	%al, %al
	jne	.L35
.L32:
	movl	%r8d, %eax
	ret
	.cfi_endproc
.LFE36:
	.size	ch_string, .-ch_string
	.globl	ch
	.bss
	.align 32
	.type	ch, @object
	.size	ch, 120
ch:
	.zero	120
	.globl	str
	.align 32
	.type	str, @object
	.size	str, 55
str:
	.zero	55
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.long	100000
	.long	100000
	.long	100000
	.long	100000
	.set	.LC1,.LC0
	.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>
#include <string.h>
#define min(X, Y) ((X) < (Y) ? (X) : (Y))

int ch_string(char str[], char ch);

int n;
char str[55];
int ch[30];

int main()
{
	for (int i = 0; i < 30; i++) {
		ch[i] = 100000;
	}

	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%s", str);

		for (int j = 'a'; j <= 'z'; j++) {
			ch[j - 'a'] = min(ch[j - 'a'], ch_string(str, j));
		}
	}

	for (int i = 'a'; i <= 'z'; i++) {

		if (ch[i - 'a'] < 100000) {
			for (int j = 0; j < ch[i - 'a']; j++) {
				putchar(i);
			}
		}
	}

	return 0;
}

int ch_string(char str[], char ch)
{
	int res = 0;

	while (*str != '\0') {
		if (*str == ch) {
			res++;
		}
		str++;
	}

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

```c
#include <stdio.h>
#include <string.h>
#define min(X, Y) ((X) < (Y) ? (X) : (Y))

int ch_string(char str[], char ch);

int n;
char str[55];
int ch[30];

int main()
{
	for (int i = 0; i < 30; i++) {
		ch[i] = 100000;
	}

	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%s", str);

		for (int j = 'a'; j <= 'z'; j++) {
			ch[j - 'a'] = min(ch[j - 'a'], ch_string(str, j));
		}
	}

	for (int i = 'a'; i <= 'z'; i++) {

		if (ch[i - 'a'] < 100000) {
			for (int j = 0; j < ch[i - 'a']; j++) {
				putchar(i);
			}
		}
	}

	return 0;
}

int ch_string(char str[], char ch)
{
	int res = 0;

	while (*str != '\0') {
		if (*str == ch) {
			res++;
		}
		str++;
	}

	return res;
}
```

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:

3
cbaa
daacc
acacac

aac
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>
#include <string.h>
#define min(X, Y) ((X) < (Y) ? (X) : (Y))

int ch_string(char str[], char ch);

int n;
char str[55];
int ch[30];

int main()
{
	for (int i = 0; i < 30; i++) {
		ch[i] = 100000;
	}

	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%s", str);

		for (int j = 'a'; j <= 'z'; j++) {
			ch[j - 'a'] = min(ch[j - 'a'], ch_string(str, j));
		}
	}

	for (int i = 'a'; i <= 'z'; i++) {

		if (ch[i - 'a'] < 100000) {
			for (int j = 0; j < ch[i - 'a']; j++) {
				putchar(i);
			}
		}
	}

	return 0;
}

int ch_string(char str[], char ch)
{
	int res = 0;

	while (*str != '\0') {
		if (*str == ch) {
			res++;
		}
		str++;
	}

	return res;
}
```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC2:
	.string	"%d"
.LC3:
	.string	"%s"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB35:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	n(%rip), %rsi
	leaq	.LC2(%rip), %rdi
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	leaq	str(%rip), %r13
	xorl	%r12d, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	leaq	-388+ch(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	leaq	.LC3(%rip), %rbx
	subq	$8, %rsp
	.cfi_def_cfa_offset 48
	movq	.LC1(%rip), %rax
	movdqa	.LC0(%rip), %xmm0
	movq	%rax, 112+ch(%rip)
	xorl	%eax, %eax
	movaps	%xmm0, ch(%rip)
	movaps	%xmm0, 16+ch(%rip)
	movaps	%xmm0, 32+ch(%rip)
	movaps	%xmm0, 48+ch(%rip)
	movaps	%xmm0, 64+ch(%rip)
	movaps	%xmm0, 80+ch(%rip)
	movaps	%xmm0, 96+ch(%rip)
	call	__isoc99_scanf@PLT
	movl	n(%rip), %eax
	testl	%eax, %eax
	jle	.L12
.L2:
	movq	%r13, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movzbl	0(%r13), %r9d
	movl	$97, %esi
	.p2align 4,,10
	.p2align 3
.L11:
	movl	0(%rbp,%rsi,4), %edi
	testb	%r9b, %r9b
	je	.L4
	movl	%r9d, %edx
	leaq	str(%rip), %rax
	xorl	%ecx, %ecx
	movl	%esi, %r8d
	.p2align 4,,10
	.p2align 3
.L6:
	cmpb	%sil, %dl
	sete	%dl
	addq	$1, %rax
	movzbl	%dl, %edx
	addl	%edx, %ecx
	movzbl	(%rax), %edx
	testb	%dl, %dl
	jne	.L6
	cmpl	%ecx, %edi
	jge	.L31
.L8:
	movl	%edi, 0(%rbp,%rsi,4)
	addq	$1, %rsi
	cmpq	$123, %rsi
	jne	.L11
	addl	$1, %r12d
	cmpl	%r12d, n(%rip)
	jg	.L2
.L12:
	leaq	ch(%rip), %r12
	movl	$97, %ebp
	.p2align 4,,10
	.p2align 3
.L3:
	movl	(%r12), %eax
	xorl	%ebx, %ebx
	subl	$1, %eax
	cmpl	$99998, %eax
	ja	.L15
.L13:
	movq	stdout(%rip), %rsi
	movl	%ebp, %edi
	addl	$1, %ebx
	call	putc@PLT
	cmpl	%ebx, (%r12)
	jg	.L13
.L15:
	addl	$1, %ebp
	addq	$4, %r12
	cmpl	$123, %ebp
	jne	.L3
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L31:
	.cfi_restore_state
	movl	%r9d, %edx
	leaq	str(%rip), %rax
	xorl	%edi, %edi
	.p2align 4,,10
	.p2align 3
.L10:
	cmpb	%r8b, %dl
	sete	%dl
	addq	$1, %rax
	movzbl	%dl, %edx
	addl	%edx, %edi
	movzbl	(%rax), %edx
	testb	%dl, %dl
	jne	.L10
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L4:
	xorl	%eax, %eax
	testl	%edi, %edi
	cmovg	%eax, %edi
	jmp	.L8
	.cfi_endproc
.LFE35:
	.size	main, .-main
	.text
	.p2align 4
	.globl	ch_string
	.type	ch_string, @function
ch_string:
.LFB36:
	.cfi_startproc
	endbr64
	movzbl	(%rdi), %eax
	xorl	%r8d, %r8d
	testb	%al, %al
	je	.L32
	.p2align 4,,10
	.p2align 3
.L35:
	cmpb	%sil, %al
	sete	%al
	addq	$1, %rdi
	movzbl	%al, %eax
	addl	%eax, %r8d
	movzbl	(%rdi), %eax
	testb	%al, %al
	jne	.L35
.L32:
	movl	%r8d, %eax
	ret
	.cfi_endproc
.LFE36:
	.size	ch_string, .-ch_string
	.globl	ch
	.bss
	.align 32
	.type	ch, @object
	.size	ch, 120
ch:
	.zero	120
	.globl	str
	.align 32
	.type	str, @object
	.size	str, 55
str:
	.zero	55
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.long	100000
	.long	100000
	.long	100000
	.long	100000
	.set	.LC1,.LC0
	.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	"%s"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB35:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	n(%rip), %rsi
	leaq	.LC2(%rip), %rdi
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	leaq	str(%rip), %r13
	xorl	%r12d, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	leaq	-388+ch(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	leaq	.LC3(%rip), %rbx
	subq	$8, %rsp
	.cfi_def_cfa_offset 48
	movq	.LC1(%rip), %rax
	movdqa	.LC0(%rip), %xmm0
	movq	%rax, 112+ch(%rip)
	xorl	%eax, %eax
	movaps	%xmm0, ch(%rip)
	movaps	%xmm0, 16+ch(%rip)
	movaps	%xmm0, 32+ch(%rip)
	movaps	%xmm0, 48+ch(%rip)
	movaps	%xmm0, 64+ch(%rip)
	movaps	%xmm0, 80+ch(%rip)
	movaps	%xmm0, 96+ch(%rip)
	call	__isoc99_scanf@PLT
	movl	n(%rip), %eax
	testl	%eax, %eax
	jle	.L12
.L2:
	movq	%r13, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movzbl	0(%r13), %r9d
	movl	$97, %esi
	.p2align 4,,10
	.p2align 3
.L11:
	movl	0(%rbp,%rsi,4), %edi
	testb	%r9b, %r9b
	je	.L4
	movl	%r9d, %edx
	leaq	str(%rip), %rax
	xorl	%ecx, %ecx
	movl	%esi, %r8d
	.p2align 4,,10
	.p2align 3
.L6:
	cmpb	%sil, %dl
	sete	%dl
	addq	$1, %rax
	movzbl	%dl, %edx
	addl	%edx, %ecx
	movzbl	(%rax), %edx
	testb	%dl, %dl
	jne	.L6
	cmpl	%ecx, %edi
	jge	.L31
.L8:
	movl	%edi, 0(%rbp,%rsi,4)
	addq	$1, %rsi
	cmpq	$123, %rsi
	jne	.L11
	addl	$1, %r12d
	cmpl	%r12d, n(%rip)
	jg	.L2
.L12:
	leaq	ch(%rip), %r12
	movl	$97, %ebp
	.p2align 4,,10
	.p2align 3
.L3:
	movl	(%r12), %eax
	xorl	%ebx, %ebx
	subl	$1, %eax
	cmpl	$99998, %eax
	ja	.L15
.L13:
	movq	stdout(%rip), %rsi
	movl	%ebp, %edi
	addl	$1, %ebx
	call	putc@PLT
	cmpl	%ebx, (%r12)
	jg	.L13
.L15:
	addl	$1, %ebp
	addq	$4, %r12
	cmpl	$123, %ebp
	jne	.L3
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L31:
	.cfi_restore_state
	movl	%r9d, %edx
	leaq	str(%rip), %rax
	xorl	%edi, %edi
	.p2align 4,,10
	.p2align 3
.L10:
	cmpb	%r8b, %dl
	sete	%dl
	addq	$1, %rax
	movzbl	%dl, %edx
	addl	%edx, %edi
	movzbl	(%rax), %edx
	testb	%dl, %dl
	jne	.L10
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L4:
	xorl	%eax, %eax
	testl	%edi, %edi
	cmovg	%eax, %edi
	jmp	.L8
	.cfi_endproc
.LFE35:
	.size	main, .-main
	.text
	.p2align 4
	.globl	ch_string
	.type	ch_string, @function
ch_string:
.LFB36:
	.cfi_startproc
	endbr64
	movzbl	(%rdi), %eax
	xorl	%r8d, %r8d
	testb	%al, %al
	je	.L32
	.p2align 4,,10
	.p2align 3
.L35:
	cmpb	%sil, %al
	sete	%al
	addq	$1, %rdi
	movzbl	%al, %eax
	addl	%eax, %r8d
	movzbl	(%rdi), %eax
	testb	%al, %al
	jne	.L35
.L32:
	movl	%r8d, %eax
	ret
	.cfi_endproc
.LFE36:
	.size	ch_string, .-ch_string
	.globl	ch
	.bss
	.align 32
	.type	ch, @object
	.size	ch, 120
ch:
	.zero	120
	.globl	str
	.align 32
	.type	str, @object
	.size	str, 55
str:
	.zero	55
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.long	100000
	.long	100000
	.long	100000
	.long	100000
	.set	.LC1,.LC0
	.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:
```