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>
#include <memory.h>
int cmp(const void *a,const void *b){
	return *(int*)a-*(int*)b;
}
int main(void){
	int n,i,p[10],b;
	char c[101];
	while(scanf("%d",&n),n){
		scanf("%s",c);
		b=0;
		memset(p,0,sizeof(p));
		for(i=0;i<100;i++){
			p[i%n]++;
			if(c[i]=='L'){
				p[i%n]+=b;
				b=0;
			}
			else if(c[i]=='S'){
				b+=p[i%n];
				p[i%n]=0;
			}
		}
		qsort(p,n,sizeof(int),cmp);
		for(i=0;i<n;i++){
			printf("%d ",p[i]);
		}
		printf("%d\n",b);
	}
	return 0;
}```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.p2align 4
	.globl	cmp
	.type	cmp, @function
cmp:
.LFB51:
	.cfi_startproc
	endbr64
	movl	(%rdi), %eax
	subl	(%rsi), %eax
	ret
	.cfi_endproc
.LFE51:
	.size	cmp, .-cmp
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%s"
.LC1:
	.string	"%d\n"
.LC2:
	.string	"%d "
.LC3:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB52:
	.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	.LC3(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	.LC2(%rip), %rbx
	subq	$184, %rsp
	.cfi_def_cfa_offset 240
	movq	%fs:40, %rax
	movq	%rax, 168(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %r12
	.p2align 4,,10
	.p2align 3
.L4:
	movq	%r12, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	je	.L17
	leaq	64(%rsp), %r13
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	movq	%r13, %rsi
	leaq	16(%rsp), %r15
	call	__isoc99_scanf@PLT
	pxor	%xmm0, %xmm0
	movq	%r13, %rdi
	xorl	%r10d, %r10d
	movslq	12(%rsp), %rsi
	movaps	%xmm0, 16(%rsp)
	xorl	%r13d, %r13d
	xorl	%ecx, %ecx
	movq	$0, 48(%rsp)
	movaps	%xmm0, 32(%rsp)
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L5:
	cmpb	$83, %r10b
	jne	.L6
	movl	$0, 16(%rsp,%rdx,4)
	addl	%eax, %r13d
.L6:
	addl	$1, %ecx
	addq	$1, %rdi
	cmpl	$100, %ecx
	je	.L7
.L18:
	movl	%ecx, %eax
	cltd
	idivl	%esi
	movslq	%edx, %rdx
	movl	16(%rsp,%rdx,4), %r10d
.L8:
	movl	%ecx, %eax
	cltd
	idivl	%esi
	leal	1(%r10), %eax
	movzbl	(%rdi), %r10d
	movslq	%edx, %rdx
	movl	%eax, 16(%rsp,%rdx,4)
	cmpb	$76, %r10b
	jne	.L5
	addl	%r13d, %eax
	addl	$1, %ecx
	xorl	%r13d, %r13d
	addq	$1, %rdi
	movl	%eax, 16(%rsp,%rdx,4)
	cmpl	$100, %ecx
	jne	.L18
.L7:
	movl	$4, %edx
	leaq	cmp(%rip), %rcx
	movq	%r15, %rdi
	xorl	%r14d, %r14d
	call	qsort@PLT
	movl	12(%rsp), %edx
	testl	%edx, %edx
	jle	.L10
	.p2align 4,,10
	.p2align 3
.L9:
	movl	(%r15,%r14,4), %edx
	movq	%rbx, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addq	$1, %r14
	call	__printf_chk@PLT
	cmpl	%r14d, 12(%rsp)
	jg	.L9
.L10:
	movl	%r13d, %edx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L4
.L17:
	movq	168(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L19
	addq	$184, %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
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE52:
	.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:
.LFB51:
	.cfi_startproc
	endbr64
	movl	(%rdi), %eax
	subl	(%rsi), %eax
	ret
	.cfi_endproc
.LFE51:
	.size	cmp, .-cmp
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%s"
.LC1:
	.string	"%d\n"
.LC2:
	.string	"%d "
.LC3:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB52:
	.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	.LC3(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	.LC2(%rip), %rbx
	subq	$184, %rsp
	.cfi_def_cfa_offset 240
	movq	%fs:40, %rax
	movq	%rax, 168(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %r12
	.p2align 4,,10
	.p2align 3
.L4:
	movq	%r12, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	je	.L17
	leaq	64(%rsp), %r13
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	movq	%r13, %rsi
	leaq	16(%rsp), %r15
	call	__isoc99_scanf@PLT
	pxor	%xmm0, %xmm0
	movq	%r13, %rdi
	xorl	%r10d, %r10d
	movslq	12(%rsp), %rsi
	movaps	%xmm0, 16(%rsp)
	xorl	%r13d, %r13d
	xorl	%ecx, %ecx
	movq	$0, 48(%rsp)
	movaps	%xmm0, 32(%rsp)
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L5:
	cmpb	$83, %r10b
	jne	.L6
	movl	$0, 16(%rsp,%rdx,4)
	addl	%eax, %r13d
.L6:
	addl	$1, %ecx
	addq	$1, %rdi
	cmpl	$100, %ecx
	je	.L7
.L18:
	movl	%ecx, %eax
	cltd
	idivl	%esi
	movslq	%edx, %rdx
	movl	16(%rsp,%rdx,4), %r10d
.L8:
	movl	%ecx, %eax
	cltd
	idivl	%esi
	leal	1(%r10), %eax
	movzbl	(%rdi), %r10d
	movslq	%edx, %rdx
	movl	%eax, 16(%rsp,%rdx,4)
	cmpb	$76, %r10b
	jne	.L5
	addl	%r13d, %eax
	addl	$1, %ecx
	xorl	%r13d, %r13d
	addq	$1, %rdi
	movl	%eax, 16(%rsp,%rdx,4)
	cmpl	$100, %ecx
	jne	.L18
.L7:
	movl	$4, %edx
	leaq	cmp(%rip), %rcx
	movq	%r15, %rdi
	xorl	%r14d, %r14d
	call	qsort@PLT
	movl	12(%rsp), %edx
	testl	%edx, %edx
	jle	.L10
	.p2align 4,,10
	.p2align 3
.L9:
	movl	(%r15,%r14,4), %edx
	movq	%rbx, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addq	$1, %r14
	call	__printf_chk@PLT
	cmpl	%r14d, 12(%rsp)
	jg	.L9
.L10:
	movl	%r13d, %edx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L4
.L17:
	movq	168(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L19
	addq	$184, %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
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE52:
	.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:
.LFB51:
	.cfi_startproc
	endbr64
	movl	(%rdi), %eax
	subl	(%rsi), %eax
	ret
	.cfi_endproc
.LFE51:
	.size	cmp, .-cmp
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%s"
.LC1:
	.string	"%d\n"
.LC2:
	.string	"%d "
.LC3:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB52:
	.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	.LC3(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	.LC2(%rip), %rbx
	subq	$184, %rsp
	.cfi_def_cfa_offset 240
	movq	%fs:40, %rax
	movq	%rax, 168(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %r12
	.p2align 4,,10
	.p2align 3
.L4:
	movq	%r12, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	je	.L17
	leaq	64(%rsp), %r13
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	movq	%r13, %rsi
	leaq	16(%rsp), %r15
	call	__isoc99_scanf@PLT
	pxor	%xmm0, %xmm0
	movq	%r13, %rdi
	xorl	%r10d, %r10d
	movslq	12(%rsp), %rsi
	movaps	%xmm0, 16(%rsp)
	xorl	%r13d, %r13d
	xorl	%ecx, %ecx
	movq	$0, 48(%rsp)
	movaps	%xmm0, 32(%rsp)
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L5:
	cmpb	$83, %r10b
	jne	.L6
	movl	$0, 16(%rsp,%rdx,4)
	addl	%eax, %r13d
.L6:
	addl	$1, %ecx
	addq	$1, %rdi
	cmpl	$100, %ecx
	je	.L7
.L18:
	movl	%ecx, %eax
	cltd
	idivl	%esi
	movslq	%edx, %rdx
	movl	16(%rsp,%rdx,4), %r10d
.L8:
	movl	%ecx, %eax
	cltd
	idivl	%esi
	leal	1(%r10), %eax
	movzbl	(%rdi), %r10d
	movslq	%edx, %rdx
	movl	%eax, 16(%rsp,%rdx,4)
	cmpb	$76, %r10b
	jne	.L5
	addl	%r13d, %eax
	addl	$1, %ecx
	xorl	%r13d, %r13d
	addq	$1, %rdi
	movl	%eax, 16(%rsp,%rdx,4)
	cmpl	$100, %ecx
	jne	.L18
.L7:
	movl	$4, %edx
	leaq	cmp(%rip), %rcx
	movq	%r15, %rdi
	xorl	%r14d, %r14d
	call	qsort@PLT
	movl	12(%rsp), %edx
	testl	%edx, %edx
	jle	.L10
	.p2align 4,,10
	.p2align 3
.L9:
	movl	(%r15,%r14,4), %edx
	movq	%rbx, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addq	$1, %r14
	call	__printf_chk@PLT
	cmpl	%r14d, 12(%rsp)
	jg	.L9
.L10:
	movl	%r13d, %edx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L4
.L17:
	movq	168(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L19
	addq	$184, %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
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE52:
	.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>
#include <memory.h>
int cmp(const void *a,const void *b){
	return *(int*)a-*(int*)b;
}
int main(void){
	int n,i,p[10],b;
	char c[101];
	while(scanf("%d",&n),n){
		scanf("%s",c);
		b=0;
		memset(p,0,sizeof(p));
		for(i=0;i<100;i++){
			p[i%n]++;
			if(c[i]=='L'){
				p[i%n]+=b;
				b=0;
			}
			else if(c[i]=='S'){
				b+=p[i%n];
				p[i%n]=0;
			}
		}
		qsort(p,n,sizeof(int),cmp);
		for(i=0;i<n;i++){
			printf("%d ",p[i]);
		}
		printf("%d\n",b);
	}
	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>
#include <memory.h>
int cmp(const void *a,const void *b){
	return *(int*)a-*(int*)b;
}
int main(void){
	int n,i,p[10],b;
	char c[101];
	while(scanf("%d",&n),n){
		scanf("%s",c);
		b=0;
		memset(p,0,sizeof(p));
		for(i=0;i<100;i++){
			p[i%n]++;
			if(c[i]=='L'){
				p[i%n]+=b;
				b=0;
			}
			else if(c[i]=='S'){
				b+=p[i%n];
				p[i%n]=0;
			}
		}
		qsort(p,n,sizeof(int),cmp);
		for(i=0;i<n;i++){
			printf("%d ",p[i]);
		}
		printf("%d\n",b);
	}
	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
SSSSSSSSSSSSSSLLLLLLLLLLLLLLLLLLLLMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM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 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>
#include <memory.h>
int cmp(const void *a,const void *b){
	return *(int*)a-*(int*)b;
}
int main(void){
	int n,i,p[10],b;
	char c[101];
	while(scanf("%d",&n),n){
		scanf("%s",c);
		b=0;
		memset(p,0,sizeof(p));
		for(i=0;i<100;i++){
			p[i%n]++;
			if(c[i]=='L'){
				p[i%n]+=b;
				b=0;
			}
			else if(c[i]=='S'){
				b+=p[i%n];
				p[i%n]=0;
			}
		}
		qsort(p,n,sizeof(int),cmp);
		for(i=0;i<n;i++){
			printf("%d ",p[i]);
		}
		printf("%d\n",b);
	}
	return 0;
}```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.p2align 4
	.globl	cmp
	.type	cmp, @function
cmp:
.LFB51:
	.cfi_startproc
	endbr64
	movl	(%rdi), %eax
	subl	(%rsi), %eax
	ret
	.cfi_endproc
.LFE51:
	.size	cmp, .-cmp
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%s"
.LC1:
	.string	"%d\n"
.LC2:
	.string	"%d "
.LC3:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB52:
	.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	.LC3(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	.LC2(%rip), %rbx
	subq	$184, %rsp
	.cfi_def_cfa_offset 240
	movq	%fs:40, %rax
	movq	%rax, 168(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %r12
	.p2align 4,,10
	.p2align 3
.L4:
	movq	%r12, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	je	.L17
	leaq	64(%rsp), %r13
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	movq	%r13, %rsi
	leaq	16(%rsp), %r15
	call	__isoc99_scanf@PLT
	pxor	%xmm0, %xmm0
	movq	%r13, %rdi
	xorl	%r10d, %r10d
	movslq	12(%rsp), %rsi
	movaps	%xmm0, 16(%rsp)
	xorl	%r13d, %r13d
	xorl	%ecx, %ecx
	movq	$0, 48(%rsp)
	movaps	%xmm0, 32(%rsp)
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L5:
	cmpb	$83, %r10b
	jne	.L6
	movl	$0, 16(%rsp,%rdx,4)
	addl	%eax, %r13d
.L6:
	addl	$1, %ecx
	addq	$1, %rdi
	cmpl	$100, %ecx
	je	.L7
.L18:
	movl	%ecx, %eax
	cltd
	idivl	%esi
	movslq	%edx, %rdx
	movl	16(%rsp,%rdx,4), %r10d
.L8:
	movl	%ecx, %eax
	cltd
	idivl	%esi
	leal	1(%r10), %eax
	movzbl	(%rdi), %r10d
	movslq	%edx, %rdx
	movl	%eax, 16(%rsp,%rdx,4)
	cmpb	$76, %r10b
	jne	.L5
	addl	%r13d, %eax
	addl	$1, %ecx
	xorl	%r13d, %r13d
	addq	$1, %rdi
	movl	%eax, 16(%rsp,%rdx,4)
	cmpl	$100, %ecx
	jne	.L18
.L7:
	movl	$4, %edx
	leaq	cmp(%rip), %rcx
	movq	%r15, %rdi
	xorl	%r14d, %r14d
	call	qsort@PLT
	movl	12(%rsp), %edx
	testl	%edx, %edx
	jle	.L10
	.p2align 4,,10
	.p2align 3
.L9:
	movl	(%r15,%r14,4), %edx
	movq	%rbx, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addq	$1, %r14
	call	__printf_chk@PLT
	cmpl	%r14d, 12(%rsp)
	jg	.L9
.L10:
	movl	%r13d, %edx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L4
.L17:
	movq	168(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L19
	addq	$184, %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
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE52:
	.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:
.LFB51:
	.cfi_startproc
	endbr64
	movl	(%rdi), %eax
	subl	(%rsi), %eax
	ret
	.cfi_endproc
.LFE51:
	.size	cmp, .-cmp
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%s"
.LC1:
	.string	"%d\n"
.LC2:
	.string	"%d "
.LC3:
	.string	"%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB52:
	.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	.LC3(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	.LC2(%rip), %rbx
	subq	$184, %rsp
	.cfi_def_cfa_offset 240
	movq	%fs:40, %rax
	movq	%rax, 168(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %r12
	.p2align 4,,10
	.p2align 3
.L4:
	movq	%r12, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	je	.L17
	leaq	64(%rsp), %r13
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	movq	%r13, %rsi
	leaq	16(%rsp), %r15
	call	__isoc99_scanf@PLT
	pxor	%xmm0, %xmm0
	movq	%r13, %rdi
	xorl	%r10d, %r10d
	movslq	12(%rsp), %rsi
	movaps	%xmm0, 16(%rsp)
	xorl	%r13d, %r13d
	xorl	%ecx, %ecx
	movq	$0, 48(%rsp)
	movaps	%xmm0, 32(%rsp)
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L5:
	cmpb	$83, %r10b
	jne	.L6
	movl	$0, 16(%rsp,%rdx,4)
	addl	%eax, %r13d
.L6:
	addl	$1, %ecx
	addq	$1, %rdi
	cmpl	$100, %ecx
	je	.L7
.L18:
	movl	%ecx, %eax
	cltd
	idivl	%esi
	movslq	%edx, %rdx
	movl	16(%rsp,%rdx,4), %r10d
.L8:
	movl	%ecx, %eax
	cltd
	idivl	%esi
	leal	1(%r10), %eax
	movzbl	(%rdi), %r10d
	movslq	%edx, %rdx
	movl	%eax, 16(%rsp,%rdx,4)
	cmpb	$76, %r10b
	jne	.L5
	addl	%r13d, %eax
	addl	$1, %ecx
	xorl	%r13d, %r13d
	addq	$1, %rdi
	movl	%eax, 16(%rsp,%rdx,4)
	cmpl	$100, %ecx
	jne	.L18
.L7:
	movl	$4, %edx
	leaq	cmp(%rip), %rcx
	movq	%r15, %rdi
	xorl	%r14d, %r14d
	call	qsort@PLT
	movl	12(%rsp), %edx
	testl	%edx, %edx
	jle	.L10
	.p2align 4,,10
	.p2align 3
.L9:
	movl	(%r15,%r14,4), %edx
	movq	%rbx, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addq	$1, %r14
	call	__printf_chk@PLT
	cmpl	%r14d, 12(%rsp)
	jg	.L9
.L10:
	movl	%r13d, %edx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L4
.L17:
	movq	168(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L19
	addq	$184, %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
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE52:
	.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:
```