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>

int main() {
	static int kk[5];
	int n, i, j, k;
	long long ans;

	scanf("%d", &n);
	while (n--) {
		static char s[11];
		char c;

		scanf("%s", s);
		c = s[0];
		if (c == 'M')
			kk[0]++;
		else if (c == 'A')
			kk[1]++;
		else if (c == 'R')
			kk[2]++;
		else if (c == 'C')
			kk[3]++;
		else if (c == 'H')
			kk[4]++;
	}
	ans = 0;
	for (i = 0; i < 5; i++)
		for (j = i + 1; j < 5; j++)
			for (k = j + 1; k < 5; k++)
				ans += (long long) kk[i] * kk[j] * kk[k];
	printf("%lld\n", ans);
	return 0;
}
```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%s"
.LC2:
	.string	"%lld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	leaq	.LC0(%rip), %rdi
	leaq	.LC1(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	leaq	s.1(%rip), %rbx
	subq	$24, %rsp
	.cfi_def_cfa_offset 48
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %eax
	leal	-1(%rax), %edx
	movl	%edx, 4(%rsp)
	testl	%eax, %eax
	jne	.L2
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L4:
	cmpb	$65, %al
	je	.L27
	cmpb	$82, %al
	je	.L28
	cmpb	$67, %al
	je	.L29
	cmpb	$72, %al
	jne	.L5
	addl	$1, 16+kk.0(%rip)
	.p2align 4,,10
	.p2align 3
.L5:
	movl	4(%rsp), %eax
	leal	-1(%rax), %edx
	movl	%edx, 4(%rsp)
	testl	%eax, %eax
	je	.L9
.L2:
	movq	%rbx, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movzbl	(%rbx), %eax
	cmpb	$77, %al
	jne	.L4
	movl	4(%rsp), %eax
	addl	$1, kk.0(%rip)
	leal	-1(%rax), %edx
	movl	%edx, 4(%rsp)
	testl	%eax, %eax
	jne	.L2
.L9:
	xorl	%r9d, %r9d
	movl	$1, %r10d
	xorl	%r8d, %r8d
	movl	$1, %eax
	leaq	kk.0(%rip), %rsi
.L3:
	leal	1(%rax), %edi
	cmpl	$4, %eax
	je	.L10
	.p2align 4,,10
	.p2align 3
.L30:
	movslq	%r9d, %rdx
	movslq	%eax, %rcx
	movslq	(%rsi,%rcx,4), %rcx
	movslq	(%rsi,%rdx,4), %rdx
	imulq	%rcx, %rdx
	movslq	%edi, %rcx
	movslq	(%rsi,%rcx,4), %rcx
	imulq	%rdx, %rcx
	addq	%rcx, %r8
	leal	2(%rax), %ecx
	cmpl	$3, %eax
	je	.L11
	movslq	%ecx, %rax
	movslq	(%rsi,%rax,4), %rax
	imulq	%rdx, %rax
	addq	%rax, %r8
	cmpl	$3, %ecx
	jne	.L11
	movslq	16+kk.0(%rip), %rax
	imulq	%rdx, %rax
	addq	%rax, %r8
.L11:
	movl	%edi, %eax
	leal	1(%rax), %edi
	cmpl	$4, %eax
	jne	.L30
.L10:
	leal	1(%r10), %eax
	cmpl	$4, %r10d
	je	.L31
	movl	%r10d, %r9d
	movl	%eax, %r10d
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L27:
	addl	$1, 4+kk.0(%rip)
	jmp	.L5
.L28:
	addl	$1, 8+kk.0(%rip)
	jmp	.L5
.L31:
	xorl	%eax, %eax
	movq	%r8, %rdx
	movl	$1, %edi
	leaq	.LC2(%rip), %rsi
	call	__printf_chk@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L32
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
.L29:
	.cfi_restore_state
	addl	$1, 12+kk.0(%rip)
	jmp	.L5
.L32:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.local	kk.0
	.comm	kk.0,20,16
	.local	s.1
	.comm	s.1,11,8
	.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
.LC0:
	.string	"%d"
.LC1:
	.string	"%s"
.LC2:
	.string	"%lld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	leaq	.LC0(%rip), %rdi
	leaq	.LC1(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	leaq	s.1(%rip), %rbx
	subq	$24, %rsp
	.cfi_def_cfa_offset 48
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %eax
	leal	-1(%rax), %edx
	movl	%edx, 4(%rsp)
	testl	%eax, %eax
	jne	.L2
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L4:
	cmpb	$65, %al
	je	.L27
	cmpb	$82, %al
	je	.L28
	cmpb	$67, %al
	je	.L29
	cmpb	$72, %al
	jne	.L5
	addl	$1, 16+kk.0(%rip)
	.p2align 4,,10
	.p2align 3
.L5:
	movl	4(%rsp), %eax
	leal	-1(%rax), %edx
	movl	%edx, 4(%rsp)
	testl	%eax, %eax
	je	.L9
.L2:
	movq	%rbx, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movzbl	(%rbx), %eax
	cmpb	$77, %al
	jne	.L4
	movl	4(%rsp), %eax
	addl	$1, kk.0(%rip)
	leal	-1(%rax), %edx
	movl	%edx, 4(%rsp)
	testl	%eax, %eax
	jne	.L2
.L9:
	xorl	%r9d, %r9d
	movl	$1, %r10d
	xorl	%r8d, %r8d
	movl	$1, %eax
	leaq	kk.0(%rip), %rsi
.L3:
	leal	1(%rax), %edi
	cmpl	$4, %eax
	je	.L10
	.p2align 4,,10
	.p2align 3
.L30:
	movslq	%r9d, %rdx
	movslq	%eax, %rcx
	movslq	(%rsi,%rcx,4), %rcx
	movslq	(%rsi,%rdx,4), %rdx
	imulq	%rcx, %rdx
	movslq	%edi, %rcx
	movslq	(%rsi,%rcx,4), %rcx
	imulq	%rdx, %rcx
	addq	%rcx, %r8
	leal	2(%rax), %ecx
	cmpl	$3, %eax
	je	.L11
	movslq	%ecx, %rax
	movslq	(%rsi,%rax,4), %rax
	imulq	%rdx, %rax
	addq	%rax, %r8
	cmpl	$3, %ecx
	jne	.L11
	movslq	16+kk.0(%rip), %rax
	imulq	%rdx, %rax
	addq	%rax, %r8
.L11:
	movl	%edi, %eax
	leal	1(%rax), %edi
	cmpl	$4, %eax
	jne	.L30
.L10:
	leal	1(%r10), %eax
	cmpl	$4, %r10d
	je	.L31
	movl	%r10d, %r9d
	movl	%eax, %r10d
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L27:
	addl	$1, 4+kk.0(%rip)
	jmp	.L5
.L28:
	addl	$1, 8+kk.0(%rip)
	jmp	.L5
.L31:
	xorl	%eax, %eax
	movq	%r8, %rdx
	movl	$1, %edi
	leaq	.LC2(%rip), %rsi
	call	__printf_chk@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L32
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
.L29:
	.cfi_restore_state
	addl	$1, 12+kk.0(%rip)
	jmp	.L5
.L32:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.local	kk.0
	.comm	kk.0,20,16
	.local	s.1
	.comm	s.1,11,8
	.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
.LC0:
	.string	"%d"
.LC1:
	.string	"%s"
.LC2:
	.string	"%lld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	leaq	.LC0(%rip), %rdi
	leaq	.LC1(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	leaq	s.1(%rip), %rbx
	subq	$24, %rsp
	.cfi_def_cfa_offset 48
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %eax
	leal	-1(%rax), %edx
	movl	%edx, 4(%rsp)
	testl	%eax, %eax
	jne	.L2
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L4:
	cmpb	$65, %al
	je	.L27
	cmpb	$82, %al
	je	.L28
	cmpb	$67, %al
	je	.L29
	cmpb	$72, %al
	jne	.L5
	addl	$1, 16+kk.0(%rip)
	.p2align 4,,10
	.p2align 3
.L5:
	movl	4(%rsp), %eax
	leal	-1(%rax), %edx
	movl	%edx, 4(%rsp)
	testl	%eax, %eax
	je	.L9
.L2:
	movq	%rbx, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movzbl	(%rbx), %eax
	cmpb	$77, %al
	jne	.L4
	movl	4(%rsp), %eax
	addl	$1, kk.0(%rip)
	leal	-1(%rax), %edx
	movl	%edx, 4(%rsp)
	testl	%eax, %eax
	jne	.L2
.L9:
	xorl	%r9d, %r9d
	movl	$1, %r10d
	xorl	%r8d, %r8d
	movl	$1, %eax
	leaq	kk.0(%rip), %rsi
.L3:
	leal	1(%rax), %edi
	cmpl	$4, %eax
	je	.L10
	.p2align 4,,10
	.p2align 3
.L30:
	movslq	%r9d, %rdx
	movslq	%eax, %rcx
	movslq	(%rsi,%rcx,4), %rcx
	movslq	(%rsi,%rdx,4), %rdx
	imulq	%rcx, %rdx
	movslq	%edi, %rcx
	movslq	(%rsi,%rcx,4), %rcx
	imulq	%rdx, %rcx
	addq	%rcx, %r8
	leal	2(%rax), %ecx
	cmpl	$3, %eax
	je	.L11
	movslq	%ecx, %rax
	movslq	(%rsi,%rax,4), %rax
	imulq	%rdx, %rax
	addq	%rax, %r8
	cmpl	$3, %ecx
	jne	.L11
	movslq	16+kk.0(%rip), %rax
	imulq	%rdx, %rax
	addq	%rax, %r8
.L11:
	movl	%edi, %eax
	leal	1(%rax), %edi
	cmpl	$4, %eax
	jne	.L30
.L10:
	leal	1(%r10), %eax
	cmpl	$4, %r10d
	je	.L31
	movl	%r10d, %r9d
	movl	%eax, %r10d
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L27:
	addl	$1, 4+kk.0(%rip)
	jmp	.L5
.L28:
	addl	$1, 8+kk.0(%rip)
	jmp	.L5
.L31:
	xorl	%eax, %eax
	movq	%r8, %rdx
	movl	$1, %edi
	leaq	.LC2(%rip), %rsi
	call	__printf_chk@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L32
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
.L29:
	.cfi_restore_state
	addl	$1, 12+kk.0(%rip)
	jmp	.L5
.L32:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.local	kk.0
	.comm	kk.0,20,16
	.local	s.1
	.comm	s.1,11,8
	.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>

int main() {
	static int kk[5];
	int n, i, j, k;
	long long ans;

	scanf("%d", &n);
	while (n--) {
		static char s[11];
		char c;

		scanf("%s", s);
		c = s[0];
		if (c == 'M')
			kk[0]++;
		else if (c == 'A')
			kk[1]++;
		else if (c == 'R')
			kk[2]++;
		else if (c == 'C')
			kk[3]++;
		else if (c == 'H')
			kk[4]++;
	}
	ans = 0;
	for (i = 0; i < 5; i++)
		for (j = i + 1; j < 5; j++)
			for (k = j + 1; k < 5; k++)
				ans += (long long) kk[i] * kk[j] * kk[k];
	printf("%lld\n", ans);
	return 0;
}
```
Given the following C code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include <stdio.h>

int main() {
	static int kk[5];
	int n, i, j, k;
	long long ans;

	scanf("%d", &n);
	while (n--) {
		static char s[11];
		char c;

		scanf("%s", s);
		c = s[0];
		if (c == 'M')
			kk[0]++;
		else if (c == 'A')
			kk[1]++;
		else if (c == 'R')
			kk[2]++;
		else if (c == 'C')
			kk[3]++;
		else if (c == 'H')
			kk[4]++;
	}
	ans = 0;
	for (i = 0; i < 5; i++)
		for (j = i + 1; j < 5; j++)
			for (k = j + 1; k < 5; k++)
				ans += (long long) kk[i] * kk[j] * kk[k];
	printf("%lld\n", ans);
	return 0;
}
```

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:

5
MASHIKE
RUMOI
OBIRA
OROBAH
HOROKANAI
 5
CHOKUD@I
RNG
MAKOTO
AOKI
RINGO
 4
ZY
ZZZ
Z
ZZZZZZZZZZ
 5
DHOKUD@I
RNG
MAKOTO
AOKI
RINGN
 5
I@DUKOGE
HNR
MTAOKP
AINK
RINGN
 5
MASHIKE
IOMUR
OBIRA
OROBAH
HOROKANAI
 5
CHOKUD@I
RNG
MAKOTO
AOKI
RINGN
 4
ZY
ZZY
Z
ZZZZZZZZZZ
 5
MASHIKE
IOMUR
ARIBO
OROBAH
HOROKANAI
 4
ZY
YZZ
Z
ZZZZZZZZZZ

1
 7
 0
 2
 4
 0
 7
 0
 1
 0

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>

int main() {
	static int kk[5];
	int n, i, j, k;
	long long ans;

	scanf("%d", &n);
	while (n--) {
		static char s[11];
		char c;

		scanf("%s", s);
		c = s[0];
		if (c == 'M')
			kk[0]++;
		else if (c == 'A')
			kk[1]++;
		else if (c == 'R')
			kk[2]++;
		else if (c == 'C')
			kk[3]++;
		else if (c == 'H')
			kk[4]++;
	}
	ans = 0;
	for (i = 0; i < 5; i++)
		for (j = i + 1; j < 5; j++)
			for (k = j + 1; k < 5; k++)
				ans += (long long) kk[i] * kk[j] * kk[k];
	printf("%lld\n", ans);
	return 0;
}
```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%s"
.LC2:
	.string	"%lld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	leaq	.LC0(%rip), %rdi
	leaq	.LC1(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	leaq	s.1(%rip), %rbx
	subq	$24, %rsp
	.cfi_def_cfa_offset 48
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %eax
	leal	-1(%rax), %edx
	movl	%edx, 4(%rsp)
	testl	%eax, %eax
	jne	.L2
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L4:
	cmpb	$65, %al
	je	.L27
	cmpb	$82, %al
	je	.L28
	cmpb	$67, %al
	je	.L29
	cmpb	$72, %al
	jne	.L5
	addl	$1, 16+kk.0(%rip)
	.p2align 4,,10
	.p2align 3
.L5:
	movl	4(%rsp), %eax
	leal	-1(%rax), %edx
	movl	%edx, 4(%rsp)
	testl	%eax, %eax
	je	.L9
.L2:
	movq	%rbx, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movzbl	(%rbx), %eax
	cmpb	$77, %al
	jne	.L4
	movl	4(%rsp), %eax
	addl	$1, kk.0(%rip)
	leal	-1(%rax), %edx
	movl	%edx, 4(%rsp)
	testl	%eax, %eax
	jne	.L2
.L9:
	xorl	%r9d, %r9d
	movl	$1, %r10d
	xorl	%r8d, %r8d
	movl	$1, %eax
	leaq	kk.0(%rip), %rsi
.L3:
	leal	1(%rax), %edi
	cmpl	$4, %eax
	je	.L10
	.p2align 4,,10
	.p2align 3
.L30:
	movslq	%r9d, %rdx
	movslq	%eax, %rcx
	movslq	(%rsi,%rcx,4), %rcx
	movslq	(%rsi,%rdx,4), %rdx
	imulq	%rcx, %rdx
	movslq	%edi, %rcx
	movslq	(%rsi,%rcx,4), %rcx
	imulq	%rdx, %rcx
	addq	%rcx, %r8
	leal	2(%rax), %ecx
	cmpl	$3, %eax
	je	.L11
	movslq	%ecx, %rax
	movslq	(%rsi,%rax,4), %rax
	imulq	%rdx, %rax
	addq	%rax, %r8
	cmpl	$3, %ecx
	jne	.L11
	movslq	16+kk.0(%rip), %rax
	imulq	%rdx, %rax
	addq	%rax, %r8
.L11:
	movl	%edi, %eax
	leal	1(%rax), %edi
	cmpl	$4, %eax
	jne	.L30
.L10:
	leal	1(%r10), %eax
	cmpl	$4, %r10d
	je	.L31
	movl	%r10d, %r9d
	movl	%eax, %r10d
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L27:
	addl	$1, 4+kk.0(%rip)
	jmp	.L5
.L28:
	addl	$1, 8+kk.0(%rip)
	jmp	.L5
.L31:
	xorl	%eax, %eax
	movq	%r8, %rdx
	movl	$1, %edi
	leaq	.LC2(%rip), %rsi
	call	__printf_chk@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L32
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
.L29:
	.cfi_restore_state
	addl	$1, 12+kk.0(%rip)
	jmp	.L5
.L32:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.local	kk.0
	.comm	kk.0,20,16
	.local	s.1
	.comm	s.1,11,8
	.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
.LC0:
	.string	"%d"
.LC1:
	.string	"%s"
.LC2:
	.string	"%lld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	leaq	.LC0(%rip), %rdi
	leaq	.LC1(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	leaq	s.1(%rip), %rbx
	subq	$24, %rsp
	.cfi_def_cfa_offset 48
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %eax
	leal	-1(%rax), %edx
	movl	%edx, 4(%rsp)
	testl	%eax, %eax
	jne	.L2
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L4:
	cmpb	$65, %al
	je	.L27
	cmpb	$82, %al
	je	.L28
	cmpb	$67, %al
	je	.L29
	cmpb	$72, %al
	jne	.L5
	addl	$1, 16+kk.0(%rip)
	.p2align 4,,10
	.p2align 3
.L5:
	movl	4(%rsp), %eax
	leal	-1(%rax), %edx
	movl	%edx, 4(%rsp)
	testl	%eax, %eax
	je	.L9
.L2:
	movq	%rbx, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movzbl	(%rbx), %eax
	cmpb	$77, %al
	jne	.L4
	movl	4(%rsp), %eax
	addl	$1, kk.0(%rip)
	leal	-1(%rax), %edx
	movl	%edx, 4(%rsp)
	testl	%eax, %eax
	jne	.L2
.L9:
	xorl	%r9d, %r9d
	movl	$1, %r10d
	xorl	%r8d, %r8d
	movl	$1, %eax
	leaq	kk.0(%rip), %rsi
.L3:
	leal	1(%rax), %edi
	cmpl	$4, %eax
	je	.L10
	.p2align 4,,10
	.p2align 3
.L30:
	movslq	%r9d, %rdx
	movslq	%eax, %rcx
	movslq	(%rsi,%rcx,4), %rcx
	movslq	(%rsi,%rdx,4), %rdx
	imulq	%rcx, %rdx
	movslq	%edi, %rcx
	movslq	(%rsi,%rcx,4), %rcx
	imulq	%rdx, %rcx
	addq	%rcx, %r8
	leal	2(%rax), %ecx
	cmpl	$3, %eax
	je	.L11
	movslq	%ecx, %rax
	movslq	(%rsi,%rax,4), %rax
	imulq	%rdx, %rax
	addq	%rax, %r8
	cmpl	$3, %ecx
	jne	.L11
	movslq	16+kk.0(%rip), %rax
	imulq	%rdx, %rax
	addq	%rax, %r8
.L11:
	movl	%edi, %eax
	leal	1(%rax), %edi
	cmpl	$4, %eax
	jne	.L30
.L10:
	leal	1(%r10), %eax
	cmpl	$4, %r10d
	je	.L31
	movl	%r10d, %r9d
	movl	%eax, %r10d
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L27:
	addl	$1, 4+kk.0(%rip)
	jmp	.L5
.L28:
	addl	$1, 8+kk.0(%rip)
	jmp	.L5
.L31:
	xorl	%eax, %eax
	movq	%r8, %rdx
	movl	$1, %edi
	leaq	.LC2(%rip), %rsi
	call	__printf_chk@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L32
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
.L29:
	.cfi_restore_state
	addl	$1, 12+kk.0(%rip)
	jmp	.L5
.L32:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.local	kk.0
	.comm	kk.0,20,16
	.local	s.1
	.comm	s.1,11,8
	.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:
```