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<stdlib.h>

int cmp(const void *a,const void *b){
    return *(int *)a-*(int *)b;
}

int main(){
    int board,n,i,j,m[100];
    char s[101];

    while(scanf("%d%s",&n,s),n){
        for(i=0;i<n;i++)m[i]=0;
        board=0;

        for(i=0,j=0;j!=100;i++,j++){
            if(i==n)i=0;
            
            m[i]++;
            switch(s[j]){
                case 'M':
                    break;
                case 'S':
                    board+=m[i];
                    m[i]=0;
                    break;
                case 'L':
                    m[i]+=board;
                    board=0;
                    break;
            }
        }
        qsort(m,n,sizeof(int),cmp);
        for(i=0;i<n;i++)printf("%d ",m[i]);
        printf("%d\n",board);
    }
    return 0;
}```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.p2align 4
	.globl	cmp
	.type	cmp, @function
cmp:
.LFB39:
	.cfi_startproc
	endbr64
	movl	(%rdi), %eax
	subl	(%rsi), %eax
	ret
	.cfi_endproc
.LFE39:
	.size	cmp, .-cmp
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d\n"
.LC1:
	.string	"%d "
.LC2:
	.string	"%d%s"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB40:
	.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
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	.LC1(%rip), %rbx
	subq	$552, %rsp
	.cfi_def_cfa_offset 608
	movq	%fs:40, %rax
	movq	%rax, 536(%rsp)
	xorl	%eax, %eax
	leaq	432(%rsp), %rbp
	leaq	28(%rsp), %r13
	.p2align 4,,10
	.p2align 3
.L4:
	movq	%rbp, %rdx
	movq	%r13, %rsi
	leaq	.LC2(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	28(%rsp), %ecx
	testl	%ecx, %ecx
	je	.L11
	movslq	%ecx, %r9
	leaq	32(%rsp), %r14
	jle	.L13
	leaq	32(%rsp), %r14
	leaq	0(,%r9,4), %rdx
	xorl	%esi, %esi
	movl	%ecx, 12(%rsp)
	movq	%r14, %rdi
	movq	%r9, (%rsp)
	call	memset@PLT
	movl	12(%rsp), %ecx
	movq	(%rsp), %r9
.L13:
	movq	%rbp, %rsi
	leaq	532(%rsp), %r10
	xorl	%edi, %edi
	xorl	%r15d, %r15d
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L22:
	movslq	%edi, %rax
	addl	$1, %edi
.L5:
	movl	32(%rsp,%rax,4), %edx
	movzbl	(%rsi), %r11d
	addl	$1, %edx
	movl	%edx, 32(%rsp,%rax,4)
	cmpb	$76, %r11b
	je	.L6
	cmpb	$83, %r11b
	jne	.L7
	movl	$0, 32(%rsp,%rax,4)
	addl	%edx, %r15d
.L7:
	addq	$1, %rsi
	cmpq	%r10, %rsi
	je	.L21
.L8:
	cmpl	%edi, %ecx
	jne	.L22
	movl	$1, %edi
	xorl	%eax, %eax
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L6:
	addl	%r15d, %edx
	addq	$1, %rsi
	xorl	%r15d, %r15d
	movl	%edx, 32(%rsp,%rax,4)
	cmpq	%r10, %rsi
	jne	.L8
.L21:
	leaq	cmp(%rip), %rcx
	movq	%r9, %rsi
	movq	%r14, %rdi
	xorl	%r12d, %r12d
	movl	$4, %edx
	call	qsort@PLT
	movl	28(%rsp), %eax
	testl	%eax, %eax
	jle	.L10
	.p2align 4,,10
	.p2align 3
.L9:
	movl	(%r14,%r12,4), %edx
	movq	%rbx, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addq	$1, %r12
	call	__printf_chk@PLT
	cmpl	%r12d, 28(%rsp)
	jg	.L9
.L10:
	movl	%r15d, %edx
	leaq	.LC0(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L4
.L11:
	movq	536(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L23
	addq	$552, %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
.L23:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE40:
	.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.
Optimized Assembly Code:

user
```assembly
	.file	"temp.c"
	.text
	.p2align 4
	.globl	cmp
	.type	cmp, @function
cmp:
.LFB39:
	.cfi_startproc
	endbr64
	movl	(%rdi), %eax
	subl	(%rsi), %eax
	ret
	.cfi_endproc
.LFE39:
	.size	cmp, .-cmp
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d\n"
.LC1:
	.string	"%d "
.LC2:
	.string	"%d%s"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB40:
	.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
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	.LC1(%rip), %rbx
	subq	$552, %rsp
	.cfi_def_cfa_offset 608
	movq	%fs:40, %rax
	movq	%rax, 536(%rsp)
	xorl	%eax, %eax
	leaq	432(%rsp), %rbp
	leaq	28(%rsp), %r13
	.p2align 4,,10
	.p2align 3
.L4:
	movq	%rbp, %rdx
	movq	%r13, %rsi
	leaq	.LC2(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	28(%rsp), %ecx
	testl	%ecx, %ecx
	je	.L11
	movslq	%ecx, %r9
	leaq	32(%rsp), %r14
	jle	.L13
	leaq	32(%rsp), %r14
	leaq	0(,%r9,4), %rdx
	xorl	%esi, %esi
	movl	%ecx, 12(%rsp)
	movq	%r14, %rdi
	movq	%r9, (%rsp)
	call	memset@PLT
	movl	12(%rsp), %ecx
	movq	(%rsp), %r9
.L13:
	movq	%rbp, %rsi
	leaq	532(%rsp), %r10
	xorl	%edi, %edi
	xorl	%r15d, %r15d
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L22:
	movslq	%edi, %rax
	addl	$1, %edi
.L5:
	movl	32(%rsp,%rax,4), %edx
	movzbl	(%rsi), %r11d
	addl	$1, %edx
	movl	%edx, 32(%rsp,%rax,4)
	cmpb	$76, %r11b
	je	.L6
	cmpb	$83, %r11b
	jne	.L7
	movl	$0, 32(%rsp,%rax,4)
	addl	%edx, %r15d
.L7:
	addq	$1, %rsi
	cmpq	%r10, %rsi
	je	.L21
.L8:
	cmpl	%edi, %ecx
	jne	.L22
	movl	$1, %edi
	xorl	%eax, %eax
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L6:
	addl	%r15d, %edx
	addq	$1, %rsi
	xorl	%r15d, %r15d
	movl	%edx, 32(%rsp,%rax,4)
	cmpq	%r10, %rsi
	jne	.L8
.L21:
	leaq	cmp(%rip), %rcx
	movq	%r9, %rsi
	movq	%r14, %rdi
	xorl	%r12d, %r12d
	movl	$4, %edx
	call	qsort@PLT
	movl	28(%rsp), %eax
	testl	%eax, %eax
	jle	.L10
	.p2align 4,,10
	.p2align 3
.L9:
	movl	(%r14,%r12,4), %edx
	movq	%rbx, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addq	$1, %r12
	call	__printf_chk@PLT
	cmpl	%r12d, 28(%rsp)
	jg	.L9
.L10:
	movl	%r15d, %edx
	leaq	.LC0(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L4
.L11:
	movq	536(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L23
	addq	$552, %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
.L23:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE40:
	.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
```assembly
	.file	"temp.c"
	.text
	.p2align 4
	.globl	cmp
	.type	cmp, @function
cmp:
.LFB39:
	.cfi_startproc
	endbr64
	movl	(%rdi), %eax
	subl	(%rsi), %eax
	ret
	.cfi_endproc
.LFE39:
	.size	cmp, .-cmp
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d\n"
.LC1:
	.string	"%d "
.LC2:
	.string	"%d%s"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB40:
	.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
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	.LC1(%rip), %rbx
	subq	$552, %rsp
	.cfi_def_cfa_offset 608
	movq	%fs:40, %rax
	movq	%rax, 536(%rsp)
	xorl	%eax, %eax
	leaq	432(%rsp), %rbp
	leaq	28(%rsp), %r13
	.p2align 4,,10
	.p2align 3
.L4:
	movq	%rbp, %rdx
	movq	%r13, %rsi
	leaq	.LC2(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	28(%rsp), %ecx
	testl	%ecx, %ecx
	je	.L11
	movslq	%ecx, %r9
	leaq	32(%rsp), %r14
	jle	.L13
	leaq	32(%rsp), %r14
	leaq	0(,%r9,4), %rdx
	xorl	%esi, %esi
	movl	%ecx, 12(%rsp)
	movq	%r14, %rdi
	movq	%r9, (%rsp)
	call	memset@PLT
	movl	12(%rsp), %ecx
	movq	(%rsp), %r9
.L13:
	movq	%rbp, %rsi
	leaq	532(%rsp), %r10
	xorl	%edi, %edi
	xorl	%r15d, %r15d
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L22:
	movslq	%edi, %rax
	addl	$1, %edi
.L5:
	movl	32(%rsp,%rax,4), %edx
	movzbl	(%rsi), %r11d
	addl	$1, %edx
	movl	%edx, 32(%rsp,%rax,4)
	cmpb	$76, %r11b
	je	.L6
	cmpb	$83, %r11b
	jne	.L7
	movl	$0, 32(%rsp,%rax,4)
	addl	%edx, %r15d
.L7:
	addq	$1, %rsi
	cmpq	%r10, %rsi
	je	.L21
.L8:
	cmpl	%edi, %ecx
	jne	.L22
	movl	$1, %edi
	xorl	%eax, %eax
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L6:
	addl	%r15d, %edx
	addq	$1, %rsi
	xorl	%r15d, %r15d
	movl	%edx, 32(%rsp,%rax,4)
	cmpq	%r10, %rsi
	jne	.L8
.L21:
	leaq	cmp(%rip), %rcx
	movq	%r9, %rsi
	movq	%r14, %rdi
	xorl	%r12d, %r12d
	movl	$4, %edx
	call	qsort@PLT
	movl	28(%rsp), %eax
	testl	%eax, %eax
	jle	.L10
	.p2align 4,,10
	.p2align 3
.L9:
	movl	(%r14,%r12,4), %edx
	movq	%rbx, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addq	$1, %r12
	call	__printf_chk@PLT
	cmpl	%r12d, 28(%rsp)
	jg	.L9
.L10:
	movl	%r15d, %edx
	leaq	.LC0(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L4
.L11:
	movq	536(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L23
	addq	$552, %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
.L23:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE40:
	.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:
```
```c
#include<stdio.h>
#include<stdlib.h>

int cmp(const void *a,const void *b){
    return *(int *)a-*(int *)b;
}

int main(){
    int board,n,i,j,m[100];
    char s[101];

    while(scanf("%d%s",&n,s),n){
        for(i=0;i<n;i++)m[i]=0;
        board=0;

        for(i=0,j=0;j!=100;i++,j++){
            if(i==n)i=0;
            
            m[i]++;
            switch(s[j]){
                case 'M':
                    break;
                case 'S':
                    board+=m[i];
                    m[i]=0;
                    break;
                case 'L':
                    m[i]+=board;
                    board=0;
                    break;
            }
        }
        qsort(m,n,sizeof(int),cmp);
        for(i=0;i<n;i++)printf("%d ",m[i]);
        printf("%d\n",board);
    }
    return 0;
}```
Given the following C code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include<stdio.h>
#include<stdlib.h>

int cmp(const void *a,const void *b){
    return *(int *)a-*(int *)b;
}

int main(){
    int board,n,i,j,m[100];
    char s[101];

    while(scanf("%d%s",&n,s),n){
        for(i=0;i<n;i++)m[i]=0;
        board=0;

        for(i=0,j=0;j!=100;i++,j++){
            if(i==n)i=0;
            
            m[i]++;
            switch(s[j]){
                case 'M':
                    break;
                case 'S':
                    board+=m[i];
                    m[i]=0;
                    break;
                case 'L':
                    m[i]+=board;
                    board=0;
                    break;
            }
        }
        qsort(m,n,sizeof(int),cmp);
        for(i=0;i<n;i++)printf("%d ",m[i]);
        printf("%d\n",board);
    }
    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:

2
SSSSSSSSSSSSSSSLLLLLLLLLLLLLLLLLLLLLMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
2
SSSSSSS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
 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 assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include<stdio.h>
#include<stdlib.h>

int cmp(const void *a,const void *b){
    return *(int *)a-*(int *)b;
}

int main(){
    int board,n,i,j,m[100];
    char s[101];

    while(scanf("%d%s",&n,s),n){
        for(i=0;i<n;i++)m[i]=0;
        board=0;

        for(i=0,j=0;j!=100;i++,j++){
            if(i==n)i=0;
            
            m[i]++;
            switch(s[j]){
                case 'M':
                    break;
                case 'S':
                    board+=m[i];
                    m[i]=0;
                    break;
                case 'L':
                    m[i]+=board;
                    board=0;
                    break;
            }
        }
        qsort(m,n,sizeof(int),cmp);
        for(i=0;i<n;i++)printf("%d ",m[i]);
        printf("%d\n",board);
    }
    return 0;
}```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.p2align 4
	.globl	cmp
	.type	cmp, @function
cmp:
.LFB39:
	.cfi_startproc
	endbr64
	movl	(%rdi), %eax
	subl	(%rsi), %eax
	ret
	.cfi_endproc
.LFE39:
	.size	cmp, .-cmp
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d\n"
.LC1:
	.string	"%d "
.LC2:
	.string	"%d%s"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB40:
	.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
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	.LC1(%rip), %rbx
	subq	$552, %rsp
	.cfi_def_cfa_offset 608
	movq	%fs:40, %rax
	movq	%rax, 536(%rsp)
	xorl	%eax, %eax
	leaq	432(%rsp), %rbp
	leaq	28(%rsp), %r13
	.p2align 4,,10
	.p2align 3
.L4:
	movq	%rbp, %rdx
	movq	%r13, %rsi
	leaq	.LC2(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	28(%rsp), %ecx
	testl	%ecx, %ecx
	je	.L11
	movslq	%ecx, %r9
	leaq	32(%rsp), %r14
	jle	.L13
	leaq	32(%rsp), %r14
	leaq	0(,%r9,4), %rdx
	xorl	%esi, %esi
	movl	%ecx, 12(%rsp)
	movq	%r14, %rdi
	movq	%r9, (%rsp)
	call	memset@PLT
	movl	12(%rsp), %ecx
	movq	(%rsp), %r9
.L13:
	movq	%rbp, %rsi
	leaq	532(%rsp), %r10
	xorl	%edi, %edi
	xorl	%r15d, %r15d
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L22:
	movslq	%edi, %rax
	addl	$1, %edi
.L5:
	movl	32(%rsp,%rax,4), %edx
	movzbl	(%rsi), %r11d
	addl	$1, %edx
	movl	%edx, 32(%rsp,%rax,4)
	cmpb	$76, %r11b
	je	.L6
	cmpb	$83, %r11b
	jne	.L7
	movl	$0, 32(%rsp,%rax,4)
	addl	%edx, %r15d
.L7:
	addq	$1, %rsi
	cmpq	%r10, %rsi
	je	.L21
.L8:
	cmpl	%edi, %ecx
	jne	.L22
	movl	$1, %edi
	xorl	%eax, %eax
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L6:
	addl	%r15d, %edx
	addq	$1, %rsi
	xorl	%r15d, %r15d
	movl	%edx, 32(%rsp,%rax,4)
	cmpq	%r10, %rsi
	jne	.L8
.L21:
	leaq	cmp(%rip), %rcx
	movq	%r9, %rsi
	movq	%r14, %rdi
	xorl	%r12d, %r12d
	movl	$4, %edx
	call	qsort@PLT
	movl	28(%rsp), %eax
	testl	%eax, %eax
	jle	.L10
	.p2align 4,,10
	.p2align 3
.L9:
	movl	(%r14,%r12,4), %edx
	movq	%rbx, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addq	$1, %r12
	call	__printf_chk@PLT
	cmpl	%r12d, 28(%rsp)
	jg	.L9
.L10:
	movl	%r15d, %edx
	leaq	.LC0(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L4
.L11:
	movq	536(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L23
	addq	$552, %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
.L23:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE40:
	.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.
Optimized Assembly Code:

train
```assembly
	.file	"temp.c"
	.text
	.p2align 4
	.globl	cmp
	.type	cmp, @function
cmp:
.LFB39:
	.cfi_startproc
	endbr64
	movl	(%rdi), %eax
	subl	(%rsi), %eax
	ret
	.cfi_endproc
.LFE39:
	.size	cmp, .-cmp
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d\n"
.LC1:
	.string	"%d "
.LC2:
	.string	"%d%s"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB40:
	.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
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	.LC1(%rip), %rbx
	subq	$552, %rsp
	.cfi_def_cfa_offset 608
	movq	%fs:40, %rax
	movq	%rax, 536(%rsp)
	xorl	%eax, %eax
	leaq	432(%rsp), %rbp
	leaq	28(%rsp), %r13
	.p2align 4,,10
	.p2align 3
.L4:
	movq	%rbp, %rdx
	movq	%r13, %rsi
	leaq	.LC2(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	28(%rsp), %ecx
	testl	%ecx, %ecx
	je	.L11
	movslq	%ecx, %r9
	leaq	32(%rsp), %r14
	jle	.L13
	leaq	32(%rsp), %r14
	leaq	0(,%r9,4), %rdx
	xorl	%esi, %esi
	movl	%ecx, 12(%rsp)
	movq	%r14, %rdi
	movq	%r9, (%rsp)
	call	memset@PLT
	movl	12(%rsp), %ecx
	movq	(%rsp), %r9
.L13:
	movq	%rbp, %rsi
	leaq	532(%rsp), %r10
	xorl	%edi, %edi
	xorl	%r15d, %r15d
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L22:
	movslq	%edi, %rax
	addl	$1, %edi
.L5:
	movl	32(%rsp,%rax,4), %edx
	movzbl	(%rsi), %r11d
	addl	$1, %edx
	movl	%edx, 32(%rsp,%rax,4)
	cmpb	$76, %r11b
	je	.L6
	cmpb	$83, %r11b
	jne	.L7
	movl	$0, 32(%rsp,%rax,4)
	addl	%edx, %r15d
.L7:
	addq	$1, %rsi
	cmpq	%r10, %rsi
	je	.L21
.L8:
	cmpl	%edi, %ecx
	jne	.L22
	movl	$1, %edi
	xorl	%eax, %eax
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L6:
	addl	%r15d, %edx
	addq	$1, %rsi
	xorl	%r15d, %r15d
	movl	%edx, 32(%rsp,%rax,4)
	cmpq	%r10, %rsi
	jne	.L8
.L21:
	leaq	cmp(%rip), %rcx
	movq	%r9, %rsi
	movq	%r14, %rdi
	xorl	%r12d, %r12d
	movl	$4, %edx
	call	qsort@PLT
	movl	28(%rsp), %eax
	testl	%eax, %eax
	jle	.L10
	.p2align 4,,10
	.p2align 3
.L9:
	movl	(%r14,%r12,4), %edx
	movq	%rbx, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addq	$1, %r12
	call	__printf_chk@PLT
	cmpl	%r12d, 28(%rsp)
	jg	.L9
.L10:
	movl	%r15d, %edx
	leaq	.LC0(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L4
.L11:
	movq	536(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L23
	addq	$552, %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
.L23:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE40:
	.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:
```