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>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#define FOR(n) for(int i=0;i<n;i++)
#define FORJ(n) for(int j=0;j<n;j++)
#define PRN(n) printf("%d\n",n)
#define PRF(n) printf("%lf\n",n)
#define PRL(n) printf("%lld\n",n)
#define PRS(s) printf("%s\n",s)
#define PRC(c) printf("%c",c)
#define mod 1000000007
typedef long long int ll;
int u(const void *a, const void *b){
    return *(ll*)a-*(ll*)b;
}
int d(const void *a, const void *b){
    return *(ll*)b-*(ll*)a;
}
int z(int a){
  if(a<1)a*=-1;
  return a;
}
int min(int a,int b){
  if(a>b)return b;
  return a;
}
int max(int a,int b){
  if(a>b)return a;
  return b;
}
int gcd(int a,int b){
  if(!b)return a;
  return gcd(b,a%b);
}
ll a[5];
int main(void){
  int n;
  scanf("%d",&n);
  char s[11],c[6]="MARCH";
  FOR(n){
    scanf("%s",s);
    FORJ(5)if(s[0]==c[j])a[j]++;
  }
  ll ans=0;
  FOR(3)for(int j=i+1;j<4;j++)for(int k=j+1;k<5;k++)ans+=a[i]*a[j]*a[k];
  PRL(ans);
  return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	u
	.type	u, @function
u:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-8(%rbp), %rax
	movq	(%rax), %rax
	movl	%eax, %edx
	movq	-16(%rbp), %rax
	movq	(%rax), %rax
	movl	%eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	u, .-u
	.globl	d
	.type	d, @function
d:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-16(%rbp), %rax
	movq	(%rax), %rax
	movl	%eax, %edx
	movq	-8(%rbp), %rax
	movq	(%rax), %rax
	movl	%eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	d, .-d
	.globl	z
	.type	z, @function
z:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -4(%rbp)
	cmpl	$0, -4(%rbp)
	jg	.L6
	negl	-4(%rbp)
.L6:
	movl	-4(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	z, .-z
	.globl	min
	.type	min, @function
min:
.LFB9:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	-4(%rbp), %eax
	cmpl	-8(%rbp), %eax
	jle	.L9
	movl	-8(%rbp), %eax
	jmp	.L10
.L9:
	movl	-4(%rbp), %eax
.L10:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	min, .-min
	.globl	max
	.type	max, @function
max:
.LFB10:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	-4(%rbp), %eax
	cmpl	-8(%rbp), %eax
	jle	.L12
	movl	-4(%rbp), %eax
	jmp	.L13
.L12:
	movl	-8(%rbp), %eax
.L13:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.size	max, .-max
	.globl	gcd
	.type	gcd, @function
gcd:
.LFB11:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	cmpl	$0, -8(%rbp)
	jne	.L15
	movl	-4(%rbp), %eax
	jmp	.L16
.L15:
	movl	-4(%rbp), %eax
	cltd
	idivl	-8(%rbp)
	movl	-8(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	gcd
.L16:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE11:
	.size	gcd, .-gcd
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 40
a:
	.zero	40
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%s"
.LC2:
	.string	"%lld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB12:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$64, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-64(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1129464141, -25(%rbp)
	movw	$72, -21(%rbp)
	movl	$0, -60(%rbp)
	jmp	.L18
.L22:
	leaq	-19(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -56(%rbp)
	jmp	.L19
.L21:
	movzbl	-19(%rbp), %edx
	movl	-56(%rbp), %eax
	cltq
	movzbl	-25(%rbp,%rax), %eax
	cmpb	%al, %dl
	jne	.L20
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rax
	leaq	1(%rax), %rcx
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	%rcx, (%rdx,%rax)
.L20:
	addl	$1, -56(%rbp)
.L19:
	cmpl	$4, -56(%rbp)
	jle	.L21
	addl	$1, -60(%rbp)
.L18:
	movl	-64(%rbp), %eax
	cmpl	%eax, -60(%rbp)
	jl	.L22
	movq	$0, -40(%rbp)
	movl	$0, -52(%rbp)
	jmp	.L23
.L28:
	movl	-52(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -48(%rbp)
	jmp	.L24
.L27:
	movl	-48(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -44(%rbp)
	jmp	.L25
.L26:
	movl	-52(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movl	-48(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	a(%rip), %rax
	movq	(%rcx,%rax), %rax
	imulq	%rax, %rdx
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	a(%rip), %rax
	movq	(%rcx,%rax), %rax
	imulq	%rdx, %rax
	addq	%rax, -40(%rbp)
	addl	$1, -44(%rbp)
.L25:
	cmpl	$4, -44(%rbp)
	jle	.L26
	addl	$1, -48(%rbp)
.L24:
	cmpl	$3, -48(%rbp)
	jle	.L27
	addl	$1, -52(%rbp)
.L23:
	cmpl	$2, -52(%rbp)
	jle	.L28
	movq	-40(%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	.L30
	call	__stack_chk_fail@PLT
.L30:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE12:
	.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
	.p2align 4
	.globl	u
	.type	u, @function
u:
.LFB51:
	.cfi_startproc
	endbr64
	movq	(%rdi), %rax
	subl	(%rsi), %eax
	ret
	.cfi_endproc
.LFE51:
	.size	u, .-u
	.p2align 4
	.globl	d
	.type	d, @function
d:
.LFB52:
	.cfi_startproc
	endbr64
	movq	(%rsi), %rax
	subl	(%rdi), %eax
	ret
	.cfi_endproc
.LFE52:
	.size	d, .-d
	.p2align 4
	.globl	z
	.type	z, @function
z:
.LFB53:
	.cfi_startproc
	endbr64
	movl	%edi, %eax
	negl	%eax
	cmovs	%edi, %eax
	ret
	.cfi_endproc
.LFE53:
	.size	z, .-z
	.p2align 4
	.globl	min
	.type	min, @function
min:
.LFB54:
	.cfi_startproc
	endbr64
	cmpl	%esi, %edi
	movl	%esi, %eax
	cmovle	%edi, %eax
	ret
	.cfi_endproc
.LFE54:
	.size	min, .-min
	.p2align 4
	.globl	max
	.type	max, @function
max:
.LFB55:
	.cfi_startproc
	endbr64
	cmpl	%esi, %edi
	movl	%esi, %eax
	cmovge	%edi, %eax
	ret
	.cfi_endproc
.LFE55:
	.size	max, .-max
	.p2align 4
	.globl	gcd
	.type	gcd, @function
gcd:
.LFB56:
	.cfi_startproc
	endbr64
	movl	%edi, %eax
	movl	%esi, %r8d
	testl	%esi, %esi
	jne	.L8
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L16:
	movl	%edx, %r8d
.L8:
	cltd
	idivl	%r8d
	movl	%r8d, %eax
	testl	%edx, %edx
	jne	.L16
	movl	%r8d, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L15:
	movl	%edi, %r8d
	movl	%r8d, %eax
	ret
	.cfi_endproc
.LFE56:
	.size	gcd, .-gcd
	.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:
.LFB57:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	leaq	.LC0(%rip), %rdi
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	subq	$32, %rsp
	.cfi_def_cfa_offset 64
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	8(%rsp), %eax
	testl	%eax, %eax
	jle	.L18
	xorl	%ebx, %ebx
	leaq	13(%rsp), %r12
	leaq	.LC1(%rip), %rbp
	jmp	.L27
	.p2align 4,,10
	.p2align 3
.L19:
	cmpb	$65, %al
	je	.L21
	cmpb	$82, %al
	jne	.L33
	addq	$1, 16+a(%rip)
.L20:
	addl	$1, %ebx
	cmpl	%ebx, 8(%rsp)
	jle	.L18
.L27:
	movq	%r12, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movzbl	13(%rsp), %eax
	cmpb	$77, %al
	jne	.L19
	addq	$1, a(%rip)
	addl	$1, %ebx
	cmpl	%ebx, 8(%rsp)
	jg	.L27
.L18:
	movq	a(%rip), %rcx
	movq	8+a(%rip), %rdx
	movq	24+a(%rip), %rdi
	movq	16+a(%rip), %rax
	movq	%rcx, %r8
	movq	32+a(%rip), %rsi
	imulq	%rdx, %r8
	leaq	(%rdi,%rax), %r9
	leaq	(%rsi,%r9), %r10
	movq	%rdi, %r9
	imulq	%r8, %r10
	movq	%rcx, %r8
	imulq	%rax, %r8
	imulq	%rdi, %rcx
	imulq	%r8, %r9
	imulq	%rsi, %r8
	imulq	%rsi, %rcx
	addq	%r10, %r9
	addq	%r9, %r8
	movq	%rdi, %r9
	addq	%r8, %rcx
	movq	%rdx, %r8
	imulq	%rax, %r8
	imulq	%rdi, %rdx
	imulq	%rdi, %rax
	movl	$1, %edi
	imulq	%r8, %r9
	imulq	%rsi, %r8
	imulq	%rsi, %rdx
	imulq	%rsi, %rax
	addq	%r9, %rcx
	leaq	.LC2(%rip), %rsi
	addq	%rcx, %r8
	addq	%r8, %rdx
	addq	%rax, %rdx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L34
	addq	$32, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L33:
	.cfi_restore_state
	cmpb	$67, %al
	jne	.L35
	addq	$1, 24+a(%rip)
	jmp	.L20
	.p2align 4,,10
	.p2align 3
.L21:
	addq	$1, 8+a(%rip)
	jmp	.L20
.L35:
	cmpb	$72, %al
	jne	.L20
	addq	$1, 32+a(%rip)
	jmp	.L20
.L34:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE57:
	.size	main, .-main
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 40
a:
	.zero	40
	.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
	.p2align 4
	.globl	u
	.type	u, @function
u:
.LFB51:
	.cfi_startproc
	endbr64
	movq	(%rdi), %rax
	subl	(%rsi), %eax
	ret
	.cfi_endproc
.LFE51:
	.size	u, .-u
	.p2align 4
	.globl	d
	.type	d, @function
d:
.LFB52:
	.cfi_startproc
	endbr64
	movq	(%rsi), %rax
	subl	(%rdi), %eax
	ret
	.cfi_endproc
.LFE52:
	.size	d, .-d
	.p2align 4
	.globl	z
	.type	z, @function
z:
.LFB53:
	.cfi_startproc
	endbr64
	movl	%edi, %eax
	negl	%eax
	cmovs	%edi, %eax
	ret
	.cfi_endproc
.LFE53:
	.size	z, .-z
	.p2align 4
	.globl	min
	.type	min, @function
min:
.LFB54:
	.cfi_startproc
	endbr64
	cmpl	%esi, %edi
	movl	%esi, %eax
	cmovle	%edi, %eax
	ret
	.cfi_endproc
.LFE54:
	.size	min, .-min
	.p2align 4
	.globl	max
	.type	max, @function
max:
.LFB55:
	.cfi_startproc
	endbr64
	cmpl	%esi, %edi
	movl	%esi, %eax
	cmovge	%edi, %eax
	ret
	.cfi_endproc
.LFE55:
	.size	max, .-max
	.p2align 4
	.globl	gcd
	.type	gcd, @function
gcd:
.LFB56:
	.cfi_startproc
	endbr64
	movl	%edi, %eax
	movl	%esi, %r8d
	testl	%esi, %esi
	jne	.L8
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L16:
	movl	%edx, %r8d
.L8:
	cltd
	idivl	%r8d
	movl	%r8d, %eax
	testl	%edx, %edx
	jne	.L16
	movl	%r8d, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L15:
	movl	%edi, %r8d
	movl	%r8d, %eax
	ret
	.cfi_endproc
.LFE56:
	.size	gcd, .-gcd
	.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:
.LFB57:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	leaq	.LC0(%rip), %rdi
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	subq	$32, %rsp
	.cfi_def_cfa_offset 64
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	8(%rsp), %eax
	testl	%eax, %eax
	jle	.L18
	xorl	%ebx, %ebx
	leaq	13(%rsp), %r12
	leaq	.LC1(%rip), %rbp
	jmp	.L27
	.p2align 4,,10
	.p2align 3
.L19:
	cmpb	$65, %al
	je	.L21
	cmpb	$82, %al
	jne	.L33
	addq	$1, 16+a(%rip)
.L20:
	addl	$1, %ebx
	cmpl	%ebx, 8(%rsp)
	jle	.L18
.L27:
	movq	%r12, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movzbl	13(%rsp), %eax
	cmpb	$77, %al
	jne	.L19
	addq	$1, a(%rip)
	addl	$1, %ebx
	cmpl	%ebx, 8(%rsp)
	jg	.L27
.L18:
	movq	a(%rip), %rcx
	movq	8+a(%rip), %rdx
	movq	24+a(%rip), %rdi
	movq	16+a(%rip), %rax
	movq	%rcx, %r8
	movq	32+a(%rip), %rsi
	imulq	%rdx, %r8
	leaq	(%rdi,%rax), %r9
	leaq	(%rsi,%r9), %r10
	movq	%rdi, %r9
	imulq	%r8, %r10
	movq	%rcx, %r8
	imulq	%rax, %r8
	imulq	%rdi, %rcx
	imulq	%r8, %r9
	imulq	%rsi, %r8
	imulq	%rsi, %rcx
	addq	%r10, %r9
	addq	%r9, %r8
	movq	%rdi, %r9
	addq	%r8, %rcx
	movq	%rdx, %r8
	imulq	%rax, %r8
	imulq	%rdi, %rdx
	imulq	%rdi, %rax
	movl	$1, %edi
	imulq	%r8, %r9
	imulq	%rsi, %r8
	imulq	%rsi, %rdx
	imulq	%rsi, %rax
	addq	%r9, %rcx
	leaq	.LC2(%rip), %rsi
	addq	%rcx, %r8
	addq	%r8, %rdx
	addq	%rax, %rdx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L34
	addq	$32, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L33:
	.cfi_restore_state
	cmpb	$67, %al
	jne	.L35
	addq	$1, 24+a(%rip)
	jmp	.L20
	.p2align 4,,10
	.p2align 3
.L21:
	addq	$1, 8+a(%rip)
	jmp	.L20
.L35:
	cmpb	$72, %al
	jne	.L20
	addq	$1, 32+a(%rip)
	jmp	.L20
.L34:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE57:
	.size	main, .-main
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 40
a:
	.zero	40
	.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>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#define FOR(n) for(int i=0;i<n;i++)
#define FORJ(n) for(int j=0;j<n;j++)
#define PRN(n) printf("%d\n",n)
#define PRF(n) printf("%lf\n",n)
#define PRL(n) printf("%lld\n",n)
#define PRS(s) printf("%s\n",s)
#define PRC(c) printf("%c",c)
#define mod 1000000007
typedef long long int ll;
int u(const void *a, const void *b){
    return *(ll*)a-*(ll*)b;
}
int d(const void *a, const void *b){
    return *(ll*)b-*(ll*)a;
}
int z(int a){
  if(a<1)a*=-1;
  return a;
}
int min(int a,int b){
  if(a>b)return b;
  return a;
}
int max(int a,int b){
  if(a>b)return a;
  return b;
}
int gcd(int a,int b){
  if(!b)return a;
  return gcd(b,a%b);
}
ll a[5];
int main(void){
  int n;
  scanf("%d",&n);
  char s[11],c[6]="MARCH";
  FOR(n){
    scanf("%s",s);
    FORJ(5)if(s[0]==c[j])a[j]++;
  }
  ll ans=0;
  FOR(3)for(int j=i+1;j<4;j++)for(int k=j+1;k<5;k++)ans+=a[i]*a[j]*a[k];
  PRL(ans);
  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>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#define FOR(n) for(int i=0;i<n;i++)
#define FORJ(n) for(int j=0;j<n;j++)
#define PRN(n) printf("%d\n",n)
#define PRF(n) printf("%lf\n",n)
#define PRL(n) printf("%lld\n",n)
#define PRS(s) printf("%s\n",s)
#define PRC(c) printf("%c",c)
#define mod 1000000007
typedef long long int ll;
int u(const void *a, const void *b){
    return *(ll*)a-*(ll*)b;
}
int d(const void *a, const void *b){
    return *(ll*)b-*(ll*)a;
}
int z(int a){
  if(a<1)a*=-1;
  return a;
}
int min(int a,int b){
  if(a>b)return b;
  return a;
}
int max(int a,int b){
  if(a>b)return a;
  return b;
}
int gcd(int a,int b){
  if(!b)return a;
  return gcd(b,a%b);
}
ll a[5];
int main(void){
  int n;
  scanf("%d",&n);
  char s[11],c[6]="MARCH";
  FOR(n){
    scanf("%s",s);
    FORJ(5)if(s[0]==c[j])a[j]++;
  }
  ll ans=0;
  FOR(3)for(int j=i+1;j<4;j++)for(int k=j+1;k<5;k++)ans+=a[i]*a[j]*a[k];
  PRL(ans);
  return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	u
	.type	u, @function
u:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-8(%rbp), %rax
	movq	(%rax), %rax
	movl	%eax, %edx
	movq	-16(%rbp), %rax
	movq	(%rax), %rax
	movl	%eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	u, .-u
	.globl	d
	.type	d, @function
d:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-16(%rbp), %rax
	movq	(%rax), %rax
	movl	%eax, %edx
	movq	-8(%rbp), %rax
	movq	(%rax), %rax
	movl	%eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	d, .-d
	.globl	z
	.type	z, @function
z:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -4(%rbp)
	cmpl	$0, -4(%rbp)
	jg	.L6
	negl	-4(%rbp)
.L6:
	movl	-4(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	z, .-z
	.globl	min
	.type	min, @function
min:
.LFB9:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	-4(%rbp), %eax
	cmpl	-8(%rbp), %eax
	jle	.L9
	movl	-8(%rbp), %eax
	jmp	.L10
.L9:
	movl	-4(%rbp), %eax
.L10:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	min, .-min
	.globl	max
	.type	max, @function
max:
.LFB10:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	-4(%rbp), %eax
	cmpl	-8(%rbp), %eax
	jle	.L12
	movl	-4(%rbp), %eax
	jmp	.L13
.L12:
	movl	-8(%rbp), %eax
.L13:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.size	max, .-max
	.globl	gcd
	.type	gcd, @function
gcd:
.LFB11:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	cmpl	$0, -8(%rbp)
	jne	.L15
	movl	-4(%rbp), %eax
	jmp	.L16
.L15:
	movl	-4(%rbp), %eax
	cltd
	idivl	-8(%rbp)
	movl	-8(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	gcd
.L16:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE11:
	.size	gcd, .-gcd
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 40
a:
	.zero	40
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%s"
.LC2:
	.string	"%lld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB12:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$64, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-64(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1129464141, -25(%rbp)
	movw	$72, -21(%rbp)
	movl	$0, -60(%rbp)
	jmp	.L18
.L22:
	leaq	-19(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -56(%rbp)
	jmp	.L19
.L21:
	movzbl	-19(%rbp), %edx
	movl	-56(%rbp), %eax
	cltq
	movzbl	-25(%rbp,%rax), %eax
	cmpb	%al, %dl
	jne	.L20
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rax
	leaq	1(%rax), %rcx
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	%rcx, (%rdx,%rax)
.L20:
	addl	$1, -56(%rbp)
.L19:
	cmpl	$4, -56(%rbp)
	jle	.L21
	addl	$1, -60(%rbp)
.L18:
	movl	-64(%rbp), %eax
	cmpl	%eax, -60(%rbp)
	jl	.L22
	movq	$0, -40(%rbp)
	movl	$0, -52(%rbp)
	jmp	.L23
.L28:
	movl	-52(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -48(%rbp)
	jmp	.L24
.L27:
	movl	-48(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -44(%rbp)
	jmp	.L25
.L26:
	movl	-52(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movl	-48(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	a(%rip), %rax
	movq	(%rcx,%rax), %rax
	imulq	%rax, %rdx
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	a(%rip), %rax
	movq	(%rcx,%rax), %rax
	imulq	%rdx, %rax
	addq	%rax, -40(%rbp)
	addl	$1, -44(%rbp)
.L25:
	cmpl	$4, -44(%rbp)
	jle	.L26
	addl	$1, -48(%rbp)
.L24:
	cmpl	$3, -48(%rbp)
	jle	.L27
	addl	$1, -52(%rbp)
.L23:
	cmpl	$2, -52(%rbp)
	jle	.L28
	movq	-40(%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	.L30
	call	__stack_chk_fail@PLT
.L30:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE12:
	.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
	.globl	u
	.type	u, @function
u:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-8(%rbp), %rax
	movq	(%rax), %rax
	movl	%eax, %edx
	movq	-16(%rbp), %rax
	movq	(%rax), %rax
	movl	%eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	u, .-u
	.globl	d
	.type	d, @function
d:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	-16(%rbp), %rax
	movq	(%rax), %rax
	movl	%eax, %edx
	movq	-8(%rbp), %rax
	movq	(%rax), %rax
	movl	%eax, %ecx
	movl	%edx, %eax
	subl	%ecx, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	d, .-d
	.globl	z
	.type	z, @function
z:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -4(%rbp)
	cmpl	$0, -4(%rbp)
	jg	.L6
	negl	-4(%rbp)
.L6:
	movl	-4(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	z, .-z
	.globl	min
	.type	min, @function
min:
.LFB9:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	-4(%rbp), %eax
	cmpl	-8(%rbp), %eax
	jle	.L9
	movl	-8(%rbp), %eax
	jmp	.L10
.L9:
	movl	-4(%rbp), %eax
.L10:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	min, .-min
	.globl	max
	.type	max, @function
max:
.LFB10:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	-4(%rbp), %eax
	cmpl	-8(%rbp), %eax
	jle	.L12
	movl	-4(%rbp), %eax
	jmp	.L13
.L12:
	movl	-8(%rbp), %eax
.L13:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.size	max, .-max
	.globl	gcd
	.type	gcd, @function
gcd:
.LFB11:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	cmpl	$0, -8(%rbp)
	jne	.L15
	movl	-4(%rbp), %eax
	jmp	.L16
.L15:
	movl	-4(%rbp), %eax
	cltd
	idivl	-8(%rbp)
	movl	-8(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	gcd
.L16:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE11:
	.size	gcd, .-gcd
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 40
a:
	.zero	40
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%s"
.LC2:
	.string	"%lld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB12:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$64, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-64(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1129464141, -25(%rbp)
	movw	$72, -21(%rbp)
	movl	$0, -60(%rbp)
	jmp	.L18
.L22:
	leaq	-19(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -56(%rbp)
	jmp	.L19
.L21:
	movzbl	-19(%rbp), %edx
	movl	-56(%rbp), %eax
	cltq
	movzbl	-25(%rbp,%rax), %eax
	cmpb	%al, %dl
	jne	.L20
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rax
	leaq	1(%rax), %rcx
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	%rcx, (%rdx,%rax)
.L20:
	addl	$1, -56(%rbp)
.L19:
	cmpl	$4, -56(%rbp)
	jle	.L21
	addl	$1, -60(%rbp)
.L18:
	movl	-64(%rbp), %eax
	cmpl	%eax, -60(%rbp)
	jl	.L22
	movq	$0, -40(%rbp)
	movl	$0, -52(%rbp)
	jmp	.L23
.L28:
	movl	-52(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -48(%rbp)
	jmp	.L24
.L27:
	movl	-48(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -44(%rbp)
	jmp	.L25
.L26:
	movl	-52(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	a(%rip), %rax
	movq	(%rdx,%rax), %rdx
	movl	-48(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	a(%rip), %rax
	movq	(%rcx,%rax), %rax
	imulq	%rax, %rdx
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	a(%rip), %rax
	movq	(%rcx,%rax), %rax
	imulq	%rdx, %rax
	addq	%rax, -40(%rbp)
	addl	$1, -44(%rbp)
.L25:
	cmpl	$4, -44(%rbp)
	jle	.L26
	addl	$1, -48(%rbp)
.L24:
	cmpl	$3, -48(%rbp)
	jle	.L27
	addl	$1, -52(%rbp)
.L23:
	cmpl	$2, -52(%rbp)
	jle	.L28
	movq	-40(%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	.L30
	call	__stack_chk_fail@PLT
.L30:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE12:
	.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:
