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(void)
{
	int n,p[11],i,j,ba,cnt,temp;
	char y[101];
	while(1){
		scanf("%d",&n);
		if(n==0)break;
		for(i=1;i<=n;i++){
			p[i]=0;
		}
		scanf("%s",y);
		ba=0;
		cnt=0;
		for(i=0;i<100;i++){
			cnt++;
			if(cnt>n){
				cnt=1;
			}
			if(y[i]=='M'){
					p[cnt]++;
			}
			if(y[i]=='S'){
					ba+=p[cnt]+1;
					p[cnt]=0;
			}
			if(y[i]=='L'){
					p[cnt]+=ba+1;
					ba=0;
			}
		}
		for(i=1;i<n;i++){
			for(j=i+1;j<=n;j++){
				if(p[i]>p[j]){
					temp=p[i];
					p[i]=p[j];
					p[j]=temp;
				}
			}
		}
		for(i=1;i<=n;i++){
			printf("%d ",p[i]);
		}
		printf("%d\n",ba);
	}
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%s"
.LC2:
	.string	"%d "
.LC3:
	.string	"%d\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	$192, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L19:
	leaq	-184(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-184(%rbp), %eax
	testl	%eax, %eax
	je	.L23
	movl	$1, -180(%rbp)
	jmp	.L4
.L5:
	movl	-180(%rbp), %eax
	cltq
	movl	$0, -160(%rbp,%rax,4)
	addl	$1, -180(%rbp)
.L4:
	movl	-184(%rbp), %eax
	cmpl	%eax, -180(%rbp)
	jle	.L5
	leaq	-112(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -172(%rbp)
	movl	$0, -168(%rbp)
	movl	$0, -180(%rbp)
	jmp	.L6
.L11:
	addl	$1, -168(%rbp)
	movl	-184(%rbp), %eax
	cmpl	%eax, -168(%rbp)
	jle	.L7
	movl	$1, -168(%rbp)
.L7:
	movl	-180(%rbp), %eax
	cltq
	movzbl	-112(%rbp,%rax), %eax
	cmpb	$77, %al
	jne	.L8
	movl	-168(%rbp), %eax
	cltq
	movl	-160(%rbp,%rax,4), %eax
	leal	1(%rax), %edx
	movl	-168(%rbp), %eax
	cltq
	movl	%edx, -160(%rbp,%rax,4)
.L8:
	movl	-180(%rbp), %eax
	cltq
	movzbl	-112(%rbp,%rax), %eax
	cmpb	$83, %al
	jne	.L9
	movl	-168(%rbp), %eax
	cltq
	movl	-160(%rbp,%rax,4), %eax
	addl	$1, %eax
	addl	%eax, -172(%rbp)
	movl	-168(%rbp), %eax
	cltq
	movl	$0, -160(%rbp,%rax,4)
.L9:
	movl	-180(%rbp), %eax
	cltq
	movzbl	-112(%rbp,%rax), %eax
	cmpb	$76, %al
	jne	.L10
	movl	-168(%rbp), %eax
	cltq
	movl	-160(%rbp,%rax,4), %edx
	movl	-172(%rbp), %eax
	addl	$1, %eax
	addl	%eax, %edx
	movl	-168(%rbp), %eax
	cltq
	movl	%edx, -160(%rbp,%rax,4)
	movl	$0, -172(%rbp)
.L10:
	addl	$1, -180(%rbp)
.L6:
	cmpl	$99, -180(%rbp)
	jle	.L11
	movl	$1, -180(%rbp)
	jmp	.L12
.L16:
	movl	-180(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -176(%rbp)
	jmp	.L13
.L15:
	movl	-180(%rbp), %eax
	cltq
	movl	-160(%rbp,%rax,4), %edx
	movl	-176(%rbp), %eax
	cltq
	movl	-160(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jle	.L14
	movl	-180(%rbp), %eax
	cltq
	movl	-160(%rbp,%rax,4), %eax
	movl	%eax, -164(%rbp)
	movl	-176(%rbp), %eax
	cltq
	movl	-160(%rbp,%rax,4), %edx
	movl	-180(%rbp), %eax
	cltq
	movl	%edx, -160(%rbp,%rax,4)
	movl	-176(%rbp), %eax
	cltq
	movl	-164(%rbp), %edx
	movl	%edx, -160(%rbp,%rax,4)
.L14:
	addl	$1, -176(%rbp)
.L13:
	movl	-184(%rbp), %eax
	cmpl	%eax, -176(%rbp)
	jle	.L15
	addl	$1, -180(%rbp)
.L12:
	movl	-184(%rbp), %eax
	cmpl	%eax, -180(%rbp)
	jl	.L16
	movl	$1, -180(%rbp)
	jmp	.L17
.L18:
	movl	-180(%rbp), %eax
	cltq
	movl	-160(%rbp,%rax,4), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -180(%rbp)
.L17:
	movl	-184(%rbp), %eax
	cmpl	%eax, -180(%rbp)
	jle	.L18
	movl	-172(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L19
.L23:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L21
	call	__stack_chk_fail@PLT
.L21:
	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	"%d "
.LC3:
	.string	"%d\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
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	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
	leaq	.LC0(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	.LC2(%rip), %rbx
	subq	$200, %rsp
	.cfi_def_cfa_offset 256
	movq	%fs:40, %rax
	movq	%rax, 184(%rsp)
	xorl	%eax, %eax
	leaq	36(%rsp), %rax
	leaq	28(%rsp), %r12
	movq	%rax, 8(%rsp)
	.p2align 4,,10
	.p2align 3
.L26:
	movq	%r12, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	28(%rsp), %rax
	testl	%eax, %eax
	je	.L2
	jle	.L3
	movq	8(%rsp), %rdi
	leaq	0(,%rax,4), %rdx
	xorl	%esi, %esi
	call	memset@PLT
.L3:
	leaq	80(%rsp), %r13
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	xorl	%r15d, %r15d
	movq	%r13, %rsi
	call	__isoc99_scanf@PLT
	movl	28(%rsp), %esi
	movq	%r13, %rdx
	xorl	%eax, %eax
	leaq	180(%rsp), %r9
	movl	$1, %edi
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L5:
	cmpb	$83, %cl
	je	.L7
	cmpb	$76, %cl
	jne	.L6
	movslq	%eax, %rcx
	movl	32(%rsp,%rcx,4), %r10d
	leal	1(%r15,%r10), %r8d
	xorl	%r15d, %r15d
	movl	%r8d, 32(%rsp,%rcx,4)
.L6:
	addq	$1, %rdx
	cmpq	%r9, %rdx
	je	.L36
.L9:
	addl	$1, %eax
	movzbl	(%rdx), %ecx
	cmpl	%eax, %esi
	cmovl	%edi, %eax
	cmpb	$77, %cl
	jne	.L5
	movslq	%eax, %rcx
	addq	$1, %rdx
	addl	$1, 32(%rsp,%rcx,4)
	cmpq	%r9, %rdx
	jne	.L9
.L36:
	cmpl	$1, %esi
	jle	.L10
	leaq	32(%rsp), %r13
	movl	$1, %edx
	movq	%r13, %rax
	jmp	.L23
	.p2align 4,,10
	.p2align 3
.L27:
	movl	%r9d, %edx
.L23:
	leal	1(%rdx), %r9d
	cmpl	%r9d, %esi
	jl	.L11
	movq	4(%rax), %xmm0
	pshufd	$0xe5, %xmm0, %xmm2
	movd	%xmm0, %r10d
	movd	%xmm2, %edi
	pshufd	$225, %xmm0, %xmm1
	cmpl	%edi, %r10d
	jle	.L12
	movq	%xmm1, 4(%rax)
.L12:
	leal	2(%rdx), %edi
	cmpl	%edi, %esi
	jl	.L13
	movl	4(%rax), %edi
	movl	12(%rax), %r10d
	cmpl	%edi, %r10d
	jge	.L14
	movl	%r10d, 4(%rax)
	movl	%edi, 12(%rax)
.L14:
	leal	3(%rdx), %edi
	cmpl	%edi, %esi
	jl	.L13
	movl	4(%rax), %edi
	movl	16(%rax), %r10d
	cmpl	%edi, %r10d
	jge	.L15
	movl	%r10d, 4(%rax)
	movl	%edi, 16(%rax)
.L15:
	leal	4(%rdx), %edi
	cmpl	%edi, %esi
	jl	.L13
	movl	4(%rax), %edi
	movl	20(%rax), %r10d
	cmpl	%r10d, %edi
	jle	.L16
	movl	%r10d, 4(%rax)
	movl	%edi, 20(%rax)
.L16:
	leal	5(%rdx), %edi
	cmpl	%edi, %esi
	jl	.L13
	movl	4(%rax), %edi
	movl	24(%rax), %r10d
	cmpl	%r10d, %edi
	jle	.L17
	movl	%r10d, 4(%rax)
	movl	%edi, 24(%rax)
.L17:
	leal	6(%rdx), %edi
	cmpl	%edi, %esi
	jl	.L13
	movl	4(%rax), %edi
	movl	28(%rax), %r10d
	cmpl	%r10d, %edi
	jle	.L18
	movl	%r10d, 4(%rax)
	movl	%edi, 28(%rax)
.L18:
	leal	7(%rdx), %edi
	cmpl	%edi, %esi
	jl	.L13
	movl	4(%rax), %edi
	movl	32(%rax), %r10d
	cmpl	%r10d, %edi
	jle	.L19
	movl	%r10d, 4(%rax)
	movl	%edi, 32(%rax)
.L19:
	leal	8(%rdx), %edi
	cmpl	%edi, %esi
	jl	.L13
	movl	4(%rax), %edi
	movl	36(%rax), %r10d
	cmpl	%r10d, %edi
	jle	.L20
	movl	%r10d, 4(%rax)
	movl	%edi, 36(%rax)
.L20:
	addl	$9, %edx
	cmpl	%edx, %esi
	jl	.L13
	movl	4(%rax), %edx
	movl	40(%rax), %edi
	cmpl	%edi, %edx
	jle	.L13
	movl	%edi, 4(%rax)
	movl	%edx, 40(%rax)
	.p2align 4,,10
	.p2align 3
.L13:
	addq	$4, %rax
	cmpl	%r9d, %esi
	jne	.L27
.L22:
	movl	$1, %r14d
	.p2align 4,,10
	.p2align 3
.L24:
	movl	0(%r13,%r14,4), %edx
	movq	%rbx, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addq	$1, %r14
	call	__printf_chk@PLT
	cmpl	%r14d, 28(%rsp)
	jge	.L24
.L25:
	movl	%r15d, %edx
	leaq	.LC3(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L26
	.p2align 4,,10
	.p2align 3
.L7:
	movslq	%eax, %rcx
	movl	32(%rsp,%rcx,4), %r10d
	movl	$0, 32(%rsp,%rcx,4)
	leal	1(%r15,%r10), %r15d
	jmp	.L6
.L11:
	addq	$4, %rax
	jmp	.L27
.L2:
	movq	184(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L37
	addq	$200, %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
.L10:
	.cfi_restore_state
	jne	.L25
	leaq	32(%rsp), %r13
	jmp	.L22
.L37:
	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	"%d "
.LC3:
	.string	"%d\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
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	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
	leaq	.LC0(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	.LC2(%rip), %rbx
	subq	$200, %rsp
	.cfi_def_cfa_offset 256
	movq	%fs:40, %rax
	movq	%rax, 184(%rsp)
	xorl	%eax, %eax
	leaq	36(%rsp), %rax
	leaq	28(%rsp), %r12
	movq	%rax, 8(%rsp)
	.p2align 4,,10
	.p2align 3
.L26:
	movq	%r12, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	28(%rsp), %rax
	testl	%eax, %eax
	je	.L2
	jle	.L3
	movq	8(%rsp), %rdi
	leaq	0(,%rax,4), %rdx
	xorl	%esi, %esi
	call	memset@PLT
.L3:
	leaq	80(%rsp), %r13
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	xorl	%r15d, %r15d
	movq	%r13, %rsi
	call	__isoc99_scanf@PLT
	movl	28(%rsp), %esi
	movq	%r13, %rdx
	xorl	%eax, %eax
	leaq	180(%rsp), %r9
	movl	$1, %edi
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L5:
	cmpb	$83, %cl
	je	.L7
	cmpb	$76, %cl
	jne	.L6
	movslq	%eax, %rcx
	movl	32(%rsp,%rcx,4), %r10d
	leal	1(%r15,%r10), %r8d
	xorl	%r15d, %r15d
	movl	%r8d, 32(%rsp,%rcx,4)
.L6:
	addq	$1, %rdx
	cmpq	%r9, %rdx
	je	.L36
.L9:
	addl	$1, %eax
	movzbl	(%rdx), %ecx
	cmpl	%eax, %esi
	cmovl	%edi, %eax
	cmpb	$77, %cl
	jne	.L5
	movslq	%eax, %rcx
	addq	$1, %rdx
	addl	$1, 32(%rsp,%rcx,4)
	cmpq	%r9, %rdx
	jne	.L9
.L36:
	cmpl	$1, %esi
	jle	.L10
	leaq	32(%rsp), %r13
	movl	$1, %edx
	movq	%r13, %rax
	jmp	.L23
	.p2align 4,,10
	.p2align 3
.L27:
	movl	%r9d, %edx
.L23:
	leal	1(%rdx), %r9d
	cmpl	%r9d, %esi
	jl	.L11
	movq	4(%rax), %xmm0
	pshufd	$0xe5, %xmm0, %xmm2
	movd	%xmm0, %r10d
	movd	%xmm2, %edi
	pshufd	$225, %xmm0, %xmm1
	cmpl	%edi, %r10d
	jle	.L12
	movq	%xmm1, 4(%rax)
.L12:
	leal	2(%rdx), %edi
	cmpl	%edi, %esi
	jl	.L13
	movl	4(%rax), %edi
	movl	12(%rax), %r10d
	cmpl	%edi, %r10d
	jge	.L14
	movl	%r10d, 4(%rax)
	movl	%edi, 12(%rax)
.L14:
	leal	3(%rdx), %edi
	cmpl	%edi, %esi
	jl	.L13
	movl	4(%rax), %edi
	movl	16(%rax), %r10d
	cmpl	%edi, %r10d
	jge	.L15
	movl	%r10d, 4(%rax)
	movl	%edi, 16(%rax)
.L15:
	leal	4(%rdx), %edi
	cmpl	%edi, %esi
	jl	.L13
	movl	4(%rax), %edi
	movl	20(%rax), %r10d
	cmpl	%r10d, %edi
	jle	.L16
	movl	%r10d, 4(%rax)
	movl	%edi, 20(%rax)
.L16:
	leal	5(%rdx), %edi
	cmpl	%edi, %esi
	jl	.L13
	movl	4(%rax), %edi
	movl	24(%rax), %r10d
	cmpl	%r10d, %edi
	jle	.L17
	movl	%r10d, 4(%rax)
	movl	%edi, 24(%rax)
.L17:
	leal	6(%rdx), %edi
	cmpl	%edi, %esi
	jl	.L13
	movl	4(%rax), %edi
	movl	28(%rax), %r10d
	cmpl	%r10d, %edi
	jle	.L18
	movl	%r10d, 4(%rax)
	movl	%edi, 28(%rax)
.L18:
	leal	7(%rdx), %edi
	cmpl	%edi, %esi
	jl	.L13
	movl	4(%rax), %edi
	movl	32(%rax), %r10d
	cmpl	%r10d, %edi
	jle	.L19
	movl	%r10d, 4(%rax)
	movl	%edi, 32(%rax)
.L19:
	leal	8(%rdx), %edi
	cmpl	%edi, %esi
	jl	.L13
	movl	4(%rax), %edi
	movl	36(%rax), %r10d
	cmpl	%r10d, %edi
	jle	.L20
	movl	%r10d, 4(%rax)
	movl	%edi, 36(%rax)
.L20:
	addl	$9, %edx
	cmpl	%edx, %esi
	jl	.L13
	movl	4(%rax), %edx
	movl	40(%rax), %edi
	cmpl	%edi, %edx
	jle	.L13
	movl	%edi, 4(%rax)
	movl	%edx, 40(%rax)
	.p2align 4,,10
	.p2align 3
.L13:
	addq	$4, %rax
	cmpl	%r9d, %esi
	jne	.L27
.L22:
	movl	$1, %r14d
	.p2align 4,,10
	.p2align 3
.L24:
	movl	0(%r13,%r14,4), %edx
	movq	%rbx, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addq	$1, %r14
	call	__printf_chk@PLT
	cmpl	%r14d, 28(%rsp)
	jge	.L24
.L25:
	movl	%r15d, %edx
	leaq	.LC3(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L26
	.p2align 4,,10
	.p2align 3
.L7:
	movslq	%eax, %rcx
	movl	32(%rsp,%rcx,4), %r10d
	movl	$0, 32(%rsp,%rcx,4)
	leal	1(%r15,%r10), %r15d
	jmp	.L6
.L11:
	addq	$4, %rax
	jmp	.L27
.L2:
	movq	184(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L37
	addq	$200, %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
.L10:
	.cfi_restore_state
	jne	.L25
	leaq	32(%rsp), %r13
	jmp	.L22
.L37:
	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(void)
{
	int n,p[11],i,j,ba,cnt,temp;
	char y[101];
	while(1){
		scanf("%d",&n);
		if(n==0)break;
		for(i=1;i<=n;i++){
			p[i]=0;
		}
		scanf("%s",y);
		ba=0;
		cnt=0;
		for(i=0;i<100;i++){
			cnt++;
			if(cnt>n){
				cnt=1;
			}
			if(y[i]=='M'){
					p[cnt]++;
			}
			if(y[i]=='S'){
					ba+=p[cnt]+1;
					p[cnt]=0;
			}
			if(y[i]=='L'){
					p[cnt]+=ba+1;
					ba=0;
			}
		}
		for(i=1;i<n;i++){
			for(j=i+1;j<=n;j++){
				if(p[i]>p[j]){
					temp=p[i];
					p[i]=p[j];
					p[j]=temp;
				}
			}
		}
		for(i=1;i<=n;i++){
			printf("%d ",p[i]);
		}
		printf("%d\n",ba);
	}
	return 0;
}
2
SSSSSSSSSSSSSSSLLLLLLLLLLLLLLLLLLLLLMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
2
SSSSSSSSSSSSSSLLLLLLLLLLLLLLLLLLLLMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMSL
5
MMMMMMSLSLLMMMSMMSLMMMLMMMMLSLLLLMLSMMLMMLLMSSSLMMMMLMLSSLMSMMMMMMMMMMMMMMLMMMMMSMMMLMMLMMMMMMMMMSSM
0
 2
SSSSSSSSSSSSSSSLLLLLLLLLLLLLLLLLLLLLMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
2
SSSSSSSSSSSSSSLLLLLLLLLLLLLLLLLLLLMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMLMMMMMMSL
5
MMMMMMSLSLLMMMSMMSLMMMLMMMMLSLLLLMLSMMLMMLLMSSSLMMMMLMLSMLMSMMMMMMMSMMMMMMLMMMMMSMMMLMMLMMMMMMMMMSSM
0
 2
SSSSSSSSSSSSSSSLLLLLLLLLLLLLLLLLLLLLMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM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MLMMLLMSSSLMMMMLMLSMLMSMMMMMMMSMMMMMMLMMMMMSMMMLMMLMMMMMMMMMSSM
0
 2
SSSSSSSSSSSSSSSLLLLLLLLLLLLLLLLLLLLLMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
5
SSSSSSSSSSSSSSLLLLLLLLLLLLLLLLLLLLMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMSL
5
MMMMMMSLSLLMMMSMMSLMMMLMMMMLSLLLLMLSMMLMMLLMSSSLMMMMLMLSSLMSMMMMMMMMMMMMMMLMMMMMSMMMLMMLMMMMMMMMMSSM
0

42 58 0
0 100 0
0 0 3 8 16 73
 42 58 0
0 100 0
0 0 3 10 59 28
 42 58 0
0 100 0
1 99
 42 58 0
0 0 100
0 0 3 10 59 28
 42 58 0
0 0 100
 42 58 0
0 100 0
 42 58 0
0 21 21 58 0
0 0 3 8 16 73
 42 58 0
0 100 0
1 1 2 7 81 8
 42 58 0
0 100 0
0 0 2 4 5 6 6 15 62
 42 58 0
0 17 17 17 49 0
0 0 3 8 16 73

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(void)
{
	int n,p[11],i,j,ba,cnt,temp;
	char y[101];
	while(1){
		scanf("%d",&n);
		if(n==0)break;
		for(i=1;i<=n;i++){
			p[i]=0;
		}
		scanf("%s",y);
		ba=0;
		cnt=0;
		for(i=0;i<100;i++){
			cnt++;
			if(cnt>n){
				cnt=1;
			}
			if(y[i]=='M'){
					p[cnt]++;
			}
			if(y[i]=='S'){
					ba+=p[cnt]+1;
					p[cnt]=0;
			}
			if(y[i]=='L'){
					p[cnt]+=ba+1;
					ba=0;
			}
		}
		for(i=1;i<n;i++){
			for(j=i+1;j<=n;j++){
				if(p[i]>p[j]){
					temp=p[i];
					p[i]=p[j];
					p[j]=temp;
				}
			}
		}
		for(i=1;i<=n;i++){
			printf("%d ",p[i]);
		}
		printf("%d\n",ba);
	}
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%s"
.LC2:
	.string	"%d "
.LC3:
	.string	"%d\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	$192, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L19:
	leaq	-184(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-184(%rbp), %eax
	testl	%eax, %eax
	je	.L23
	movl	$1, -180(%rbp)
	jmp	.L4
.L5:
	movl	-180(%rbp), %eax
	cltq
	movl	$0, -160(%rbp,%rax,4)
	addl	$1, -180(%rbp)
.L4:
	movl	-184(%rbp), %eax
	cmpl	%eax, -180(%rbp)
	jle	.L5
	leaq	-112(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -172(%rbp)
	movl	$0, -168(%rbp)
	movl	$0, -180(%rbp)
	jmp	.L6
.L11:
	addl	$1, -168(%rbp)
	movl	-184(%rbp), %eax
	cmpl	%eax, -168(%rbp)
	jle	.L7
	movl	$1, -168(%rbp)
.L7:
	movl	-180(%rbp), %eax
	cltq
	movzbl	-112(%rbp,%rax), %eax
	cmpb	$77, %al
	jne	.L8
	movl	-168(%rbp), %eax
	cltq
	movl	-160(%rbp,%rax,4), %eax
	leal	1(%rax), %edx
	movl	-168(%rbp), %eax
	cltq
	movl	%edx, -160(%rbp,%rax,4)
.L8:
	movl	-180(%rbp), %eax
	cltq
	movzbl	-112(%rbp,%rax), %eax
	cmpb	$83, %al
	jne	.L9
	movl	-168(%rbp), %eax
	cltq
	movl	-160(%rbp,%rax,4), %eax
	addl	$1, %eax
	addl	%eax, -172(%rbp)
	movl	-168(%rbp), %eax
	cltq
	movl	$0, -160(%rbp,%rax,4)
.L9:
	movl	-180(%rbp), %eax
	cltq
	movzbl	-112(%rbp,%rax), %eax
	cmpb	$76, %al
	jne	.L10
	movl	-168(%rbp), %eax
	cltq
	movl	-160(%rbp,%rax,4), %edx
	movl	-172(%rbp), %eax
	addl	$1, %eax
	addl	%eax, %edx
	movl	-168(%rbp), %eax
	cltq
	movl	%edx, -160(%rbp,%rax,4)
	movl	$0, -172(%rbp)
.L10:
	addl	$1, -180(%rbp)
.L6:
	cmpl	$99, -180(%rbp)
	jle	.L11
	movl	$1, -180(%rbp)
	jmp	.L12
.L16:
	movl	-180(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -176(%rbp)
	jmp	.L13
.L15:
	movl	-180(%rbp), %eax
	cltq
	movl	-160(%rbp,%rax,4), %edx
	movl	-176(%rbp), %eax
	cltq
	movl	-160(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jle	.L14
	movl	-180(%rbp), %eax
	cltq
	movl	-160(%rbp,%rax,4), %eax
	movl	%eax, -164(%rbp)
	movl	-176(%rbp), %eax
	cltq
	movl	-160(%rbp,%rax,4), %edx
	movl	-180(%rbp), %eax
	cltq
	movl	%edx, -160(%rbp,%rax,4)
	movl	-176(%rbp), %eax
	cltq
	movl	-164(%rbp), %edx
	movl	%edx, -160(%rbp,%rax,4)
.L14:
	addl	$1, -176(%rbp)
.L13:
	movl	-184(%rbp), %eax
	cmpl	%eax, -176(%rbp)
	jle	.L15
	addl	$1, -180(%rbp)
.L12:
	movl	-184(%rbp), %eax
	cmpl	%eax, -180(%rbp)
	jl	.L16
	movl	$1, -180(%rbp)
	jmp	.L17
.L18:
	movl	-180(%rbp), %eax
	cltq
	movl	-160(%rbp,%rax,4), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -180(%rbp)
.L17:
	movl	-184(%rbp), %eax
	cmpl	%eax, -180(%rbp)
	jle	.L18
	movl	-172(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L19
.L23:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L21
	call	__stack_chk_fail@PLT
.L21:
	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	"%d "
.LC3:
	.string	"%d\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	$192, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L19:
	leaq	-184(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-184(%rbp), %eax
	testl	%eax, %eax
	je	.L23
	movl	$1, -180(%rbp)
	jmp	.L4
.L5:
	movl	-180(%rbp), %eax
	cltq
	movl	$0, -160(%rbp,%rax,4)
	addl	$1, -180(%rbp)
.L4:
	movl	-184(%rbp), %eax
	cmpl	%eax, -180(%rbp)
	jle	.L5
	leaq	-112(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -172(%rbp)
	movl	$0, -168(%rbp)
	movl	$0, -180(%rbp)
	jmp	.L6
.L11:
	addl	$1, -168(%rbp)
	movl	-184(%rbp), %eax
	cmpl	%eax, -168(%rbp)
	jle	.L7
	movl	$1, -168(%rbp)
.L7:
	movl	-180(%rbp), %eax
	cltq
	movzbl	-112(%rbp,%rax), %eax
	cmpb	$77, %al
	jne	.L8
	movl	-168(%rbp), %eax
	cltq
	movl	-160(%rbp,%rax,4), %eax
	leal	1(%rax), %edx
	movl	-168(%rbp), %eax
	cltq
	movl	%edx, -160(%rbp,%rax,4)
.L8:
	movl	-180(%rbp), %eax
	cltq
	movzbl	-112(%rbp,%rax), %eax
	cmpb	$83, %al
	jne	.L9
	movl	-168(%rbp), %eax
	cltq
	movl	-160(%rbp,%rax,4), %eax
	addl	$1, %eax
	addl	%eax, -172(%rbp)
	movl	-168(%rbp), %eax
	cltq
	movl	$0, -160(%rbp,%rax,4)
.L9:
	movl	-180(%rbp), %eax
	cltq
	movzbl	-112(%rbp,%rax), %eax
	cmpb	$76, %al
	jne	.L10
	movl	-168(%rbp), %eax
	cltq
	movl	-160(%rbp,%rax,4), %edx
	movl	-172(%rbp), %eax
	addl	$1, %eax
	addl	%eax, %edx
	movl	-168(%rbp), %eax
	cltq
	movl	%edx, -160(%rbp,%rax,4)
	movl	$0, -172(%rbp)
.L10:
	addl	$1, -180(%rbp)
.L6:
	cmpl	$99, -180(%rbp)
	jle	.L11
	movl	$1, -180(%rbp)
	jmp	.L12
.L16:
	movl	-180(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -176(%rbp)
	jmp	.L13
.L15:
	movl	-180(%rbp), %eax
	cltq
	movl	-160(%rbp,%rax,4), %edx
	movl	-176(%rbp), %eax
	cltq
	movl	-160(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jle	.L14
	movl	-180(%rbp), %eax
	cltq
	movl	-160(%rbp,%rax,4), %eax
	movl	%eax, -164(%rbp)
	movl	-176(%rbp), %eax
	cltq
	movl	-160(%rbp,%rax,4), %edx
	movl	-180(%rbp), %eax
	cltq
	movl	%edx, -160(%rbp,%rax,4)
	movl	-176(%rbp), %eax
	cltq
	movl	-164(%rbp), %edx
	movl	%edx, -160(%rbp,%rax,4)
.L14:
	addl	$1, -176(%rbp)
.L13:
	movl	-184(%rbp), %eax
	cmpl	%eax, -176(%rbp)
	jle	.L15
	addl	$1, -180(%rbp)
.L12:
	movl	-184(%rbp), %eax
	cmpl	%eax, -180(%rbp)
	jl	.L16
	movl	$1, -180(%rbp)
	jmp	.L17
.L18:
	movl	-180(%rbp), %eax
	cltq
	movl	-160(%rbp,%rax,4), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -180(%rbp)
.L17:
	movl	-184(%rbp), %eax
	cmpl	%eax, -180(%rbp)
	jle	.L18
	movl	-172(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L19
.L23:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L21
	call	__stack_chk_fail@PLT
.L21:
	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:
