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(){
    int n, i, j, k;
    char s[10];
    long long int m=0, a=0, r=0, c=0, h=0, head[5], cnt=0;
    int x[10] = {0,0,0,0,0,0,1,1,1,2};
    int y[10] = {1,1,1,2,2,3,2,2,3,3};
    int z[10] = {2,3,4,3,4,4,3,4,4,4};

    scanf("%d", &n);

    for(i=0; i<n; i++){
        scanf("%s", s);
        if(s[0] == 'M')
            m++;
        if(s[0] == 'A')
            a++;
        if(s[0] == 'R')
            r++;
        if(s[0] == 'C')
            c++;
        if(s[0] == 'H')
            h++;
    }

    head[0] = m;
    head[1] = a;
    head[2] = r;
    head[3] = c;
    head[4] = h;

    for(i=0; i<10; i++){
        cnt += head[x[i]] * head[y[i]] * head[z[i]];
    }

    printf("%lld\n", cnt);

    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%s"
.LC2:
	.string	"%lld\n"
	.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	$272, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movq	$0, -256(%rbp)
	movq	$0, -248(%rbp)
	movq	$0, -240(%rbp)
	movq	$0, -232(%rbp)
	movq	$0, -224(%rbp)
	movq	$0, -216(%rbp)
	movl	$0, -160(%rbp)
	movl	$0, -156(%rbp)
	movl	$0, -152(%rbp)
	movl	$0, -148(%rbp)
	movl	$0, -144(%rbp)
	movl	$0, -140(%rbp)
	movl	$1, -136(%rbp)
	movl	$1, -132(%rbp)
	movl	$1, -128(%rbp)
	movl	$2, -124(%rbp)
	movl	$1, -112(%rbp)
	movl	$1, -108(%rbp)
	movl	$1, -104(%rbp)
	movl	$2, -100(%rbp)
	movl	$2, -96(%rbp)
	movl	$3, -92(%rbp)
	movl	$2, -88(%rbp)
	movl	$2, -84(%rbp)
	movl	$3, -80(%rbp)
	movl	$3, -76(%rbp)
	movl	$2, -64(%rbp)
	movl	$3, -60(%rbp)
	movl	$4, -56(%rbp)
	movl	$3, -52(%rbp)
	movl	$4, -48(%rbp)
	movl	$4, -44(%rbp)
	movl	$3, -40(%rbp)
	movl	$4, -36(%rbp)
	movl	$4, -32(%rbp)
	movl	$4, -28(%rbp)
	leaq	-264(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -260(%rbp)
	jmp	.L2
.L8:
	leaq	-18(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movzbl	-18(%rbp), %eax
	cmpb	$77, %al
	jne	.L3
	addq	$1, -256(%rbp)
.L3:
	movzbl	-18(%rbp), %eax
	cmpb	$65, %al
	jne	.L4
	addq	$1, -248(%rbp)
.L4:
	movzbl	-18(%rbp), %eax
	cmpb	$82, %al
	jne	.L5
	addq	$1, -240(%rbp)
.L5:
	movzbl	-18(%rbp), %eax
	cmpb	$67, %al
	jne	.L6
	addq	$1, -232(%rbp)
.L6:
	movzbl	-18(%rbp), %eax
	cmpb	$72, %al
	jne	.L7
	addq	$1, -224(%rbp)
.L7:
	addl	$1, -260(%rbp)
.L2:
	movl	-264(%rbp), %eax
	cmpl	%eax, -260(%rbp)
	jl	.L8
	movq	-256(%rbp), %rax
	movq	%rax, -208(%rbp)
	movq	-248(%rbp), %rax
	movq	%rax, -200(%rbp)
	movq	-240(%rbp), %rax
	movq	%rax, -192(%rbp)
	movq	-232(%rbp), %rax
	movq	%rax, -184(%rbp)
	movq	-224(%rbp), %rax
	movq	%rax, -176(%rbp)
	movl	$0, -260(%rbp)
	jmp	.L9
.L10:
	movl	-260(%rbp), %eax
	cltq
	movl	-160(%rbp,%rax,4), %eax
	cltq
	movq	-208(%rbp,%rax,8), %rdx
	movl	-260(%rbp), %eax
	cltq
	movl	-112(%rbp,%rax,4), %eax
	cltq
	movq	-208(%rbp,%rax,8), %rax
	imulq	%rax, %rdx
	movl	-260(%rbp), %eax
	cltq
	movl	-64(%rbp,%rax,4), %eax
	cltq
	movq	-208(%rbp,%rax,8), %rax
	imulq	%rdx, %rax
	addq	%rax, -216(%rbp)
	addl	$1, -260(%rbp)
.L9:
	cmpl	$9, -260(%rbp)
	jle	.L10
	movq	-216(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L12
	call	__stack_chk_fail@PLT
.L12:
	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	"%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	%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
	xorl	%r13d, %r13d
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	xorl	%r12d, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	xorl	%ebx, %ebx
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	24(%rsp), %eax
	movq	$0, (%rsp)
	movq	$0, 8(%rsp)
	testl	%eax, %eax
	jle	.L2
	xorl	%ebp, %ebp
	leaq	30(%rsp), %r15
	leaq	.LC1(%rip), %r14
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L3:
	cmpb	$65, %al
	je	.L5
	cmpb	$82, %al
	jne	.L19
	addq	$1, %rbx
.L4:
	addl	$1, %ebp
	cmpl	%ebp, 24(%rsp)
	jle	.L2
.L11:
	movq	%r15, %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movzbl	30(%rsp), %eax
	cmpb	$77, %al
	jne	.L3
	addq	$1, 8(%rsp)
	addl	$1, %ebp
	cmpl	%ebp, 24(%rsp)
	jg	.L11
.L2:
	movq	8(%rsp), %rdi
	movq	(%rsp), %rsi
	leaq	(%rbx,%r13), %rdx
	leaq	(%r12,%rdx), %rcx
	movq	%rdi, %rax
	imulq	%rsi, %rax
	imulq	%rax, %rcx
	movq	%rdi, %rax
	imulq	%rbx, %rax
	imulq	%r13, %rdi
	movq	%rax, %rdx
	imulq	%r12, %rax
	imulq	%r13, %rdx
	movq	%rdi, %rbp
	movl	$1, %edi
	imulq	%r12, %rbp
	addq	%rcx, %rdx
	addq	%rdx, %rax
	movq	%r13, %rdx
	addq	%rax, %rbp
	movq	%rsi, %rax
	imulq	%rbx, %rax
	imulq	%r13, %rsi
	imulq	%r13, %rbx
	imulq	%rax, %rdx
	imulq	%r12, %rax
	imulq	%r12, %rbx
	addq	%rbp, %rdx
	addq	%rax, %rdx
	movq	%rsi, %rax
	leaq	.LC2(%rip), %rsi
	imulq	%r12, %rax
	addq	%rdx, %rax
	leaq	(%rbx,%rax), %rdx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L20
	addq	$56, %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
.L19:
	.cfi_restore_state
	cmpb	$67, %al
	jne	.L21
	addq	$1, %r13
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L5:
	addq	$1, (%rsp)
	jmp	.L4
.L21:
	cmpb	$72, %al
	jne	.L4
	addq	$1, %r12
	jmp	.L4
.L20:
	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	"%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	%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
	xorl	%r13d, %r13d
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	xorl	%r12d, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	xorl	%ebx, %ebx
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leaq	24(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	24(%rsp), %eax
	movq	$0, (%rsp)
	movq	$0, 8(%rsp)
	testl	%eax, %eax
	jle	.L2
	xorl	%ebp, %ebp
	leaq	30(%rsp), %r15
	leaq	.LC1(%rip), %r14
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L3:
	cmpb	$65, %al
	je	.L5
	cmpb	$82, %al
	jne	.L19
	addq	$1, %rbx
.L4:
	addl	$1, %ebp
	cmpl	%ebp, 24(%rsp)
	jle	.L2
.L11:
	movq	%r15, %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movzbl	30(%rsp), %eax
	cmpb	$77, %al
	jne	.L3
	addq	$1, 8(%rsp)
	addl	$1, %ebp
	cmpl	%ebp, 24(%rsp)
	jg	.L11
.L2:
	movq	8(%rsp), %rdi
	movq	(%rsp), %rsi
	leaq	(%rbx,%r13), %rdx
	leaq	(%r12,%rdx), %rcx
	movq	%rdi, %rax
	imulq	%rsi, %rax
	imulq	%rax, %rcx
	movq	%rdi, %rax
	imulq	%rbx, %rax
	imulq	%r13, %rdi
	movq	%rax, %rdx
	imulq	%r12, %rax
	imulq	%r13, %rdx
	movq	%rdi, %rbp
	movl	$1, %edi
	imulq	%r12, %rbp
	addq	%rcx, %rdx
	addq	%rdx, %rax
	movq	%r13, %rdx
	addq	%rax, %rbp
	movq	%rsi, %rax
	imulq	%rbx, %rax
	imulq	%r13, %rsi
	imulq	%r13, %rbx
	imulq	%rax, %rdx
	imulq	%r12, %rax
	imulq	%r12, %rbx
	addq	%rbp, %rdx
	addq	%rax, %rdx
	movq	%rsi, %rax
	leaq	.LC2(%rip), %rsi
	imulq	%r12, %rax
	addq	%rdx, %rax
	leaq	(%rbx,%rax), %rdx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L20
	addq	$56, %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
.L19:
	.cfi_restore_state
	cmpb	$67, %al
	jne	.L21
	addq	$1, %r13
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L5:
	addq	$1, (%rsp)
	jmp	.L4
.L21:
	cmpb	$72, %al
	jne	.L4
	addq	$1, %r12
	jmp	.L4
.L20:
	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(){
    int n, i, j, k;
    char s[10];
    long long int m=0, a=0, r=0, c=0, h=0, head[5], cnt=0;
    int x[10] = {0,0,0,0,0,0,1,1,1,2};
    int y[10] = {1,1,1,2,2,3,2,2,3,3};
    int z[10] = {2,3,4,3,4,4,3,4,4,4};

    scanf("%d", &n);

    for(i=0; i<n; i++){
        scanf("%s", s);
        if(s[0] == 'M')
            m++;
        if(s[0] == 'A')
            a++;
        if(s[0] == 'R')
            r++;
        if(s[0] == 'C')
            c++;
        if(s[0] == 'H')
            h++;
    }

    head[0] = m;
    head[1] = a;
    head[2] = r;
    head[3] = c;
    head[4] = h;

    for(i=0; i<10; i++){
        cnt += head[x[i]] * head[y[i]] * head[z[i]];
    }

    printf("%lld\n", cnt);

    return 0;
}
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 unoptimized assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c

#include <stdio.h>

int main(){
    int n, i, j, k;
    char s[10];
    long long int m=0, a=0, r=0, c=0, h=0, head[5], cnt=0;
    int x[10] = {0,0,0,0,0,0,1,1,1,2};
    int y[10] = {1,1,1,2,2,3,2,2,3,3};
    int z[10] = {2,3,4,3,4,4,3,4,4,4};

    scanf("%d", &n);

    for(i=0; i<n; i++){
        scanf("%s", s);
        if(s[0] == 'M')
            m++;
        if(s[0] == 'A')
            a++;
        if(s[0] == 'R')
            r++;
        if(s[0] == 'C')
            c++;
        if(s[0] == 'H')
            h++;
    }

    head[0] = m;
    head[1] = a;
    head[2] = r;
    head[3] = c;
    head[4] = h;

    for(i=0; i<10; i++){
        cnt += head[x[i]] * head[y[i]] * head[z[i]];
    }

    printf("%lld\n", cnt);

    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%s"
.LC2:
	.string	"%lld\n"
	.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	$272, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movq	$0, -256(%rbp)
	movq	$0, -248(%rbp)
	movq	$0, -240(%rbp)
	movq	$0, -232(%rbp)
	movq	$0, -224(%rbp)
	movq	$0, -216(%rbp)
	movl	$0, -160(%rbp)
	movl	$0, -156(%rbp)
	movl	$0, -152(%rbp)
	movl	$0, -148(%rbp)
	movl	$0, -144(%rbp)
	movl	$0, -140(%rbp)
	movl	$1, -136(%rbp)
	movl	$1, -132(%rbp)
	movl	$1, -128(%rbp)
	movl	$2, -124(%rbp)
	movl	$1, -112(%rbp)
	movl	$1, -108(%rbp)
	movl	$1, -104(%rbp)
	movl	$2, -100(%rbp)
	movl	$2, -96(%rbp)
	movl	$3, -92(%rbp)
	movl	$2, -88(%rbp)
	movl	$2, -84(%rbp)
	movl	$3, -80(%rbp)
	movl	$3, -76(%rbp)
	movl	$2, -64(%rbp)
	movl	$3, -60(%rbp)
	movl	$4, -56(%rbp)
	movl	$3, -52(%rbp)
	movl	$4, -48(%rbp)
	movl	$4, -44(%rbp)
	movl	$3, -40(%rbp)
	movl	$4, -36(%rbp)
	movl	$4, -32(%rbp)
	movl	$4, -28(%rbp)
	leaq	-264(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -260(%rbp)
	jmp	.L2
.L8:
	leaq	-18(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movzbl	-18(%rbp), %eax
	cmpb	$77, %al
	jne	.L3
	addq	$1, -256(%rbp)
.L3:
	movzbl	-18(%rbp), %eax
	cmpb	$65, %al
	jne	.L4
	addq	$1, -248(%rbp)
.L4:
	movzbl	-18(%rbp), %eax
	cmpb	$82, %al
	jne	.L5
	addq	$1, -240(%rbp)
.L5:
	movzbl	-18(%rbp), %eax
	cmpb	$67, %al
	jne	.L6
	addq	$1, -232(%rbp)
.L6:
	movzbl	-18(%rbp), %eax
	cmpb	$72, %al
	jne	.L7
	addq	$1, -224(%rbp)
.L7:
	addl	$1, -260(%rbp)
.L2:
	movl	-264(%rbp), %eax
	cmpl	%eax, -260(%rbp)
	jl	.L8
	movq	-256(%rbp), %rax
	movq	%rax, -208(%rbp)
	movq	-248(%rbp), %rax
	movq	%rax, -200(%rbp)
	movq	-240(%rbp), %rax
	movq	%rax, -192(%rbp)
	movq	-232(%rbp), %rax
	movq	%rax, -184(%rbp)
	movq	-224(%rbp), %rax
	movq	%rax, -176(%rbp)
	movl	$0, -260(%rbp)
	jmp	.L9
.L10:
	movl	-260(%rbp), %eax
	cltq
	movl	-160(%rbp,%rax,4), %eax
	cltq
	movq	-208(%rbp,%rax,8), %rdx
	movl	-260(%rbp), %eax
	cltq
	movl	-112(%rbp,%rax,4), %eax
	cltq
	movq	-208(%rbp,%rax,8), %rax
	imulq	%rax, %rdx
	movl	-260(%rbp), %eax
	cltq
	movl	-64(%rbp,%rax,4), %eax
	cltq
	movq	-208(%rbp,%rax,8), %rax
	imulq	%rdx, %rax
	addq	%rax, -216(%rbp)
	addl	$1, -260(%rbp)
.L9:
	cmpl	$9, -260(%rbp)
	jle	.L10
	movq	-216(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L12
	call	__stack_chk_fail@PLT
.L12:
	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	"%d"
.LC1:
	.string	"%s"
.LC2:
	.string	"%lld\n"
	.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	$272, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movq	$0, -256(%rbp)
	movq	$0, -248(%rbp)
	movq	$0, -240(%rbp)
	movq	$0, -232(%rbp)
	movq	$0, -224(%rbp)
	movq	$0, -216(%rbp)
	movl	$0, -160(%rbp)
	movl	$0, -156(%rbp)
	movl	$0, -152(%rbp)
	movl	$0, -148(%rbp)
	movl	$0, -144(%rbp)
	movl	$0, -140(%rbp)
	movl	$1, -136(%rbp)
	movl	$1, -132(%rbp)
	movl	$1, -128(%rbp)
	movl	$2, -124(%rbp)
	movl	$1, -112(%rbp)
	movl	$1, -108(%rbp)
	movl	$1, -104(%rbp)
	movl	$2, -100(%rbp)
	movl	$2, -96(%rbp)
	movl	$3, -92(%rbp)
	movl	$2, -88(%rbp)
	movl	$2, -84(%rbp)
	movl	$3, -80(%rbp)
	movl	$3, -76(%rbp)
	movl	$2, -64(%rbp)
	movl	$3, -60(%rbp)
	movl	$4, -56(%rbp)
	movl	$3, -52(%rbp)
	movl	$4, -48(%rbp)
	movl	$4, -44(%rbp)
	movl	$3, -40(%rbp)
	movl	$4, -36(%rbp)
	movl	$4, -32(%rbp)
	movl	$4, -28(%rbp)
	leaq	-264(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -260(%rbp)
	jmp	.L2
.L8:
	leaq	-18(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movzbl	-18(%rbp), %eax
	cmpb	$77, %al
	jne	.L3
	addq	$1, -256(%rbp)
.L3:
	movzbl	-18(%rbp), %eax
	cmpb	$65, %al
	jne	.L4
	addq	$1, -248(%rbp)
.L4:
	movzbl	-18(%rbp), %eax
	cmpb	$82, %al
	jne	.L5
	addq	$1, -240(%rbp)
.L5:
	movzbl	-18(%rbp), %eax
	cmpb	$67, %al
	jne	.L6
	addq	$1, -232(%rbp)
.L6:
	movzbl	-18(%rbp), %eax
	cmpb	$72, %al
	jne	.L7
	addq	$1, -224(%rbp)
.L7:
	addl	$1, -260(%rbp)
.L2:
	movl	-264(%rbp), %eax
	cmpl	%eax, -260(%rbp)
	jl	.L8
	movq	-256(%rbp), %rax
	movq	%rax, -208(%rbp)
	movq	-248(%rbp), %rax
	movq	%rax, -200(%rbp)
	movq	-240(%rbp), %rax
	movq	%rax, -192(%rbp)
	movq	-232(%rbp), %rax
	movq	%rax, -184(%rbp)
	movq	-224(%rbp), %rax
	movq	%rax, -176(%rbp)
	movl	$0, -260(%rbp)
	jmp	.L9
.L10:
	movl	-260(%rbp), %eax
	cltq
	movl	-160(%rbp,%rax,4), %eax
	cltq
	movq	-208(%rbp,%rax,8), %rdx
	movl	-260(%rbp), %eax
	cltq
	movl	-112(%rbp,%rax,4), %eax
	cltq
	movq	-208(%rbp,%rax,8), %rax
	imulq	%rax, %rdx
	movl	-260(%rbp), %eax
	cltq
	movl	-64(%rbp,%rax,4), %eax
	cltq
	movq	-208(%rbp,%rax,8), %rax
	imulq	%rdx, %rax
	addq	%rax, -216(%rbp)
	addl	$1, -260(%rbp)
.L9:
	cmpl	$9, -260(%rbp)
	jle	.L10
	movq	-216(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L12
	call	__stack_chk_fail@PLT
.L12:
	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:
