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 sortfnc(const void *a,const void *b){
	if(*(int *)a > *(int *)b){return 1;}
	if(*(int *)a == *(int *)b){return 0;}
	return -1;
}

int main(void) {
	int n,c[16],field,turn,i;
	char s[128];
	while(scanf("%d",&n) , n != 0){
		scanf("%s",s);
		for(i = 0;i < 16;i++){c[i] = 0;}
		field = 0;
		for(i = 0;i < 100;i++){
			turn = i % n;
			if(s[i] == 'M'){c[turn]++;}
			if(s[i] == 'S'){c[turn]++;field+=c[turn];c[turn] = 0;}
			if(s[i] == 'L'){c[turn]++;c[turn]+=field;field = 0;}
		}
		qsort(c,n,sizeof(int),sortfnc);
		for(i = 0;i < n;i++){printf("%d ",c[i]);}
		printf("%d\n",field);
	}
	return 0;
}```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.p2align 4
	.globl	sortfnc
	.type	sortfnc, @function
sortfnc:
.LFB39:
	.cfi_startproc
	endbr64
	movl	(%rsi), %edx
	movl	$1, %eax
	cmpl	%edx, (%rdi)
	jg	.L1
	setne	%al
	movzbl	%al, %eax
	negl	%eax
.L1:
	ret
	.cfi_endproc
.LFE39:
	.size	sortfnc, .-sortfnc
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%s"
.LC1:
	.string	"%d "
.LC2:
	.string	"%d\n"
.LC3:
	.string	"%d"
	.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
	leaq	.LC3(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	.LC1(%rip), %rbx
	subq	$232, %rsp
	.cfi_def_cfa_offset 288
	movq	%fs:40, %rax
	movq	%rax, 216(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %r12
	.p2align 4,,10
	.p2align 3
.L6:
	movq	%r12, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	je	.L19
	leaq	80(%rsp), %r14
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	xorl	%r13d, %r13d
	movq	%r14, %rsi
	call	__isoc99_scanf@PLT
	pxor	%xmm0, %xmm0
	movl	12(%rsp), %edi
	xorl	%ecx, %ecx
	movaps	%xmm0, 16(%rsp)
	movaps	%xmm0, 32(%rsp)
	movaps	%xmm0, 48(%rsp)
	movaps	%xmm0, 64(%rsp)
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L7:
	cmpb	$83, %al
	je	.L9
	cmpb	$76, %al
	jne	.L8
	movslq	%edx, %rdx
	movl	16(%rsp,%rdx,4), %eax
	leal	1(%r13,%rax), %eax
	xorl	%r13d, %r13d
	movl	%eax, 16(%rsp,%rdx,4)
.L8:
	addq	$1, %rcx
	cmpq	$100, %rcx
	je	.L20
.L11:
	movl	%ecx, %eax
	cltd
	idivl	%edi
	movzbl	(%r14,%rcx), %eax
	cmpb	$77, %al
	jne	.L7
	movslq	%edx, %rdx
	addq	$1, %rcx
	addl	$1, 16(%rsp,%rdx,4)
	cmpq	$100, %rcx
	jne	.L11
.L20:
	leaq	16(%rsp), %r15
	movslq	%edi, %rsi
	movl	$4, %edx
	leaq	sortfnc(%rip), %rcx
	movq	%r15, %rdi
	call	qsort@PLT
	movl	12(%rsp), %edx
	testl	%edx, %edx
	jle	.L12
	xorl	%r14d, %r14d
	.p2align 4,,10
	.p2align 3
.L13:
	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	.L13
.L12:
	movl	%r13d, %edx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L9:
	movslq	%edx, %rdx
	movl	16(%rsp,%rdx,4), %eax
	movl	$0, 16(%rsp,%rdx,4)
	leal	1(%r13,%rax), %r13d
	jmp	.L8
.L19:
	movq	216(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L21
	addq	$232, %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
.L21:
	.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	sortfnc
	.type	sortfnc, @function
sortfnc:
.LFB39:
	.cfi_startproc
	endbr64
	movl	(%rsi), %edx
	movl	$1, %eax
	cmpl	%edx, (%rdi)
	jg	.L1
	setne	%al
	movzbl	%al, %eax
	negl	%eax
.L1:
	ret
	.cfi_endproc
.LFE39:
	.size	sortfnc, .-sortfnc
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%s"
.LC1:
	.string	"%d "
.LC2:
	.string	"%d\n"
.LC3:
	.string	"%d"
	.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
	leaq	.LC3(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	.LC1(%rip), %rbx
	subq	$232, %rsp
	.cfi_def_cfa_offset 288
	movq	%fs:40, %rax
	movq	%rax, 216(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %r12
	.p2align 4,,10
	.p2align 3
.L6:
	movq	%r12, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	je	.L19
	leaq	80(%rsp), %r14
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	xorl	%r13d, %r13d
	movq	%r14, %rsi
	call	__isoc99_scanf@PLT
	pxor	%xmm0, %xmm0
	movl	12(%rsp), %edi
	xorl	%ecx, %ecx
	movaps	%xmm0, 16(%rsp)
	movaps	%xmm0, 32(%rsp)
	movaps	%xmm0, 48(%rsp)
	movaps	%xmm0, 64(%rsp)
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L7:
	cmpb	$83, %al
	je	.L9
	cmpb	$76, %al
	jne	.L8
	movslq	%edx, %rdx
	movl	16(%rsp,%rdx,4), %eax
	leal	1(%r13,%rax), %eax
	xorl	%r13d, %r13d
	movl	%eax, 16(%rsp,%rdx,4)
.L8:
	addq	$1, %rcx
	cmpq	$100, %rcx
	je	.L20
.L11:
	movl	%ecx, %eax
	cltd
	idivl	%edi
	movzbl	(%r14,%rcx), %eax
	cmpb	$77, %al
	jne	.L7
	movslq	%edx, %rdx
	addq	$1, %rcx
	addl	$1, 16(%rsp,%rdx,4)
	cmpq	$100, %rcx
	jne	.L11
.L20:
	leaq	16(%rsp), %r15
	movslq	%edi, %rsi
	movl	$4, %edx
	leaq	sortfnc(%rip), %rcx
	movq	%r15, %rdi
	call	qsort@PLT
	movl	12(%rsp), %edx
	testl	%edx, %edx
	jle	.L12
	xorl	%r14d, %r14d
	.p2align 4,,10
	.p2align 3
.L13:
	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	.L13
.L12:
	movl	%r13d, %edx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L9:
	movslq	%edx, %rdx
	movl	16(%rsp,%rdx,4), %eax
	movl	$0, 16(%rsp,%rdx,4)
	leal	1(%r13,%rax), %r13d
	jmp	.L8
.L19:
	movq	216(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L21
	addq	$232, %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
.L21:
	.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	sortfnc
	.type	sortfnc, @function
sortfnc:
.LFB39:
	.cfi_startproc
	endbr64
	movl	(%rsi), %edx
	movl	$1, %eax
	cmpl	%edx, (%rdi)
	jg	.L1
	setne	%al
	movzbl	%al, %eax
	negl	%eax
.L1:
	ret
	.cfi_endproc
.LFE39:
	.size	sortfnc, .-sortfnc
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%s"
.LC1:
	.string	"%d "
.LC2:
	.string	"%d\n"
.LC3:
	.string	"%d"
	.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
	leaq	.LC3(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	.LC1(%rip), %rbx
	subq	$232, %rsp
	.cfi_def_cfa_offset 288
	movq	%fs:40, %rax
	movq	%rax, 216(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %r12
	.p2align 4,,10
	.p2align 3
.L6:
	movq	%r12, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	je	.L19
	leaq	80(%rsp), %r14
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	xorl	%r13d, %r13d
	movq	%r14, %rsi
	call	__isoc99_scanf@PLT
	pxor	%xmm0, %xmm0
	movl	12(%rsp), %edi
	xorl	%ecx, %ecx
	movaps	%xmm0, 16(%rsp)
	movaps	%xmm0, 32(%rsp)
	movaps	%xmm0, 48(%rsp)
	movaps	%xmm0, 64(%rsp)
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L7:
	cmpb	$83, %al
	je	.L9
	cmpb	$76, %al
	jne	.L8
	movslq	%edx, %rdx
	movl	16(%rsp,%rdx,4), %eax
	leal	1(%r13,%rax), %eax
	xorl	%r13d, %r13d
	movl	%eax, 16(%rsp,%rdx,4)
.L8:
	addq	$1, %rcx
	cmpq	$100, %rcx
	je	.L20
.L11:
	movl	%ecx, %eax
	cltd
	idivl	%edi
	movzbl	(%r14,%rcx), %eax
	cmpb	$77, %al
	jne	.L7
	movslq	%edx, %rdx
	addq	$1, %rcx
	addl	$1, 16(%rsp,%rdx,4)
	cmpq	$100, %rcx
	jne	.L11
.L20:
	leaq	16(%rsp), %r15
	movslq	%edi, %rsi
	movl	$4, %edx
	leaq	sortfnc(%rip), %rcx
	movq	%r15, %rdi
	call	qsort@PLT
	movl	12(%rsp), %edx
	testl	%edx, %edx
	jle	.L12
	xorl	%r14d, %r14d
	.p2align 4,,10
	.p2align 3
.L13:
	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	.L13
.L12:
	movl	%r13d, %edx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L9:
	movslq	%edx, %rdx
	movl	16(%rsp,%rdx,4), %eax
	movl	$0, 16(%rsp,%rdx,4)
	leal	1(%r13,%rax), %r13d
	jmp	.L8
.L19:
	movq	216(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L21
	addq	$232, %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
.L21:
	.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 sortfnc(const void *a,const void *b){
	if(*(int *)a > *(int *)b){return 1;}
	if(*(int *)a == *(int *)b){return 0;}
	return -1;
}

int main(void) {
	int n,c[16],field,turn,i;
	char s[128];
	while(scanf("%d",&n) , n != 0){
		scanf("%s",s);
		for(i = 0;i < 16;i++){c[i] = 0;}
		field = 0;
		for(i = 0;i < 100;i++){
			turn = i % n;
			if(s[i] == 'M'){c[turn]++;}
			if(s[i] == 'S'){c[turn]++;field+=c[turn];c[turn] = 0;}
			if(s[i] == 'L'){c[turn]++;c[turn]+=field;field = 0;}
		}
		qsort(c,n,sizeof(int),sortfnc);
		for(i = 0;i < n;i++){printf("%d ",c[i]);}
		printf("%d\n",field);
	}
	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 sortfnc(const void *a,const void *b){
	if(*(int *)a > *(int *)b){return 1;}
	if(*(int *)a == *(int *)b){return 0;}
	return -1;
}

int main(void) {
	int n,c[16],field,turn,i;
	char s[128];
	while(scanf("%d",&n) , n != 0){
		scanf("%s",s);
		for(i = 0;i < 16;i++){c[i] = 0;}
		field = 0;
		for(i = 0;i < 100;i++){
			turn = i % n;
			if(s[i] == 'M'){c[turn]++;}
			if(s[i] == 'S'){c[turn]++;field+=c[turn];c[turn] = 0;}
			if(s[i] == 'L'){c[turn]++;c[turn]+=field;field = 0;}
		}
		qsort(c,n,sizeof(int),sortfnc);
		for(i = 0;i < n;i++){printf("%d ",c[i]);}
		printf("%d\n",field);
	}
	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
SSSSSSSSSSSSSSLLLLLLLLLLLLLLLLLLLLMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMSL
5
MMMMMMSLSLLMMMSMMSLMMMLMMMMLSLLLLMLSMMLMMLLMSSSLMMMMLMLSSLMSMMMMMMMMMMMMMMLMMMMMSMMMLMMLMMMMMMMMMSSM
0
 2
SSSSSSSSSSSSSSSLLLLLLLLLLLLLLLLLLLLLMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
2
SSSSSSSSSSSSSSLLLLLLLLLLLLLLLLLLLLMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMLMMMMMMSL
5
MMMMMMSLSLLMMMSMMSLMMMLMMMMLSLLLLMLSMMLMMLLMSSSLMMMMLMLSMLMSMMMMMMMSMMMMMMLMMMMMSMMMLMMLMMMMMMMMMSSM
0
 2
SSSSSSSSSSSSSSSLLLLLLLLLLLLLLLLLLLLLMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM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MMLMMLLMSSSLMMMMLMLSMLMSMMMMMMMSMMMMMMLMMMMMSMMMLMMLMMMMMMMMMSSM
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 assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

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

int sortfnc(const void *a,const void *b){
	if(*(int *)a > *(int *)b){return 1;}
	if(*(int *)a == *(int *)b){return 0;}
	return -1;
}

int main(void) {
	int n,c[16],field,turn,i;
	char s[128];
	while(scanf("%d",&n) , n != 0){
		scanf("%s",s);
		for(i = 0;i < 16;i++){c[i] = 0;}
		field = 0;
		for(i = 0;i < 100;i++){
			turn = i % n;
			if(s[i] == 'M'){c[turn]++;}
			if(s[i] == 'S'){c[turn]++;field+=c[turn];c[turn] = 0;}
			if(s[i] == 'L'){c[turn]++;c[turn]+=field;field = 0;}
		}
		qsort(c,n,sizeof(int),sortfnc);
		for(i = 0;i < n;i++){printf("%d ",c[i]);}
		printf("%d\n",field);
	}
	return 0;
}```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.p2align 4
	.globl	sortfnc
	.type	sortfnc, @function
sortfnc:
.LFB39:
	.cfi_startproc
	endbr64
	movl	(%rsi), %edx
	movl	$1, %eax
	cmpl	%edx, (%rdi)
	jg	.L1
	setne	%al
	movzbl	%al, %eax
	negl	%eax
.L1:
	ret
	.cfi_endproc
.LFE39:
	.size	sortfnc, .-sortfnc
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%s"
.LC1:
	.string	"%d "
.LC2:
	.string	"%d\n"
.LC3:
	.string	"%d"
	.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
	leaq	.LC3(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	.LC1(%rip), %rbx
	subq	$232, %rsp
	.cfi_def_cfa_offset 288
	movq	%fs:40, %rax
	movq	%rax, 216(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %r12
	.p2align 4,,10
	.p2align 3
.L6:
	movq	%r12, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	je	.L19
	leaq	80(%rsp), %r14
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	xorl	%r13d, %r13d
	movq	%r14, %rsi
	call	__isoc99_scanf@PLT
	pxor	%xmm0, %xmm0
	movl	12(%rsp), %edi
	xorl	%ecx, %ecx
	movaps	%xmm0, 16(%rsp)
	movaps	%xmm0, 32(%rsp)
	movaps	%xmm0, 48(%rsp)
	movaps	%xmm0, 64(%rsp)
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L7:
	cmpb	$83, %al
	je	.L9
	cmpb	$76, %al
	jne	.L8
	movslq	%edx, %rdx
	movl	16(%rsp,%rdx,4), %eax
	leal	1(%r13,%rax), %eax
	xorl	%r13d, %r13d
	movl	%eax, 16(%rsp,%rdx,4)
.L8:
	addq	$1, %rcx
	cmpq	$100, %rcx
	je	.L20
.L11:
	movl	%ecx, %eax
	cltd
	idivl	%edi
	movzbl	(%r14,%rcx), %eax
	cmpb	$77, %al
	jne	.L7
	movslq	%edx, %rdx
	addq	$1, %rcx
	addl	$1, 16(%rsp,%rdx,4)
	cmpq	$100, %rcx
	jne	.L11
.L20:
	leaq	16(%rsp), %r15
	movslq	%edi, %rsi
	movl	$4, %edx
	leaq	sortfnc(%rip), %rcx
	movq	%r15, %rdi
	call	qsort@PLT
	movl	12(%rsp), %edx
	testl	%edx, %edx
	jle	.L12
	xorl	%r14d, %r14d
	.p2align 4,,10
	.p2align 3
.L13:
	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	.L13
.L12:
	movl	%r13d, %edx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L9:
	movslq	%edx, %rdx
	movl	16(%rsp,%rdx,4), %eax
	movl	$0, 16(%rsp,%rdx,4)
	leal	1(%r13,%rax), %r13d
	jmp	.L8
.L19:
	movq	216(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L21
	addq	$232, %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
.L21:
	.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	sortfnc
	.type	sortfnc, @function
sortfnc:
.LFB39:
	.cfi_startproc
	endbr64
	movl	(%rsi), %edx
	movl	$1, %eax
	cmpl	%edx, (%rdi)
	jg	.L1
	setne	%al
	movzbl	%al, %eax
	negl	%eax
.L1:
	ret
	.cfi_endproc
.LFE39:
	.size	sortfnc, .-sortfnc
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%s"
.LC1:
	.string	"%d "
.LC2:
	.string	"%d\n"
.LC3:
	.string	"%d"
	.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
	leaq	.LC3(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	.LC1(%rip), %rbx
	subq	$232, %rsp
	.cfi_def_cfa_offset 288
	movq	%fs:40, %rax
	movq	%rax, 216(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %r12
	.p2align 4,,10
	.p2align 3
.L6:
	movq	%r12, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	je	.L19
	leaq	80(%rsp), %r14
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	xorl	%r13d, %r13d
	movq	%r14, %rsi
	call	__isoc99_scanf@PLT
	pxor	%xmm0, %xmm0
	movl	12(%rsp), %edi
	xorl	%ecx, %ecx
	movaps	%xmm0, 16(%rsp)
	movaps	%xmm0, 32(%rsp)
	movaps	%xmm0, 48(%rsp)
	movaps	%xmm0, 64(%rsp)
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L7:
	cmpb	$83, %al
	je	.L9
	cmpb	$76, %al
	jne	.L8
	movslq	%edx, %rdx
	movl	16(%rsp,%rdx,4), %eax
	leal	1(%r13,%rax), %eax
	xorl	%r13d, %r13d
	movl	%eax, 16(%rsp,%rdx,4)
.L8:
	addq	$1, %rcx
	cmpq	$100, %rcx
	je	.L20
.L11:
	movl	%ecx, %eax
	cltd
	idivl	%edi
	movzbl	(%r14,%rcx), %eax
	cmpb	$77, %al
	jne	.L7
	movslq	%edx, %rdx
	addq	$1, %rcx
	addl	$1, 16(%rsp,%rdx,4)
	cmpq	$100, %rcx
	jne	.L11
.L20:
	leaq	16(%rsp), %r15
	movslq	%edi, %rsi
	movl	$4, %edx
	leaq	sortfnc(%rip), %rcx
	movq	%r15, %rdi
	call	qsort@PLT
	movl	12(%rsp), %edx
	testl	%edx, %edx
	jle	.L12
	xorl	%r14d, %r14d
	.p2align 4,,10
	.p2align 3
.L13:
	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	.L13
.L12:
	movl	%r13d, %edx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L9:
	movslq	%edx, %rdx
	movl	16(%rsp,%rdx,4), %eax
	movl	$0, 16(%rsp,%rdx,4)
	leal	1(%r13,%rax), %r13d
	jmp	.L8
.L19:
	movq	216(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L21
	addq	$232, %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
.L21:
	.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:
```