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>

void swap_str(int *a, int *b){
  int temp = *a;
  *a = *b;
  *b = temp;
}

void sort_str(int *s, int n){
  int i, j;
  
  for(i = 0; i < n; i++){
    for(j = n - 1; j > i; j-- ){
      if(s[j - 1] > s[j])
        swap_str(&s[j - 1], &s[j]);
    }
  }
}

int main(){
  int n;
  int i;
  int a[101];
  int sum_a = 0;
  int sum_b = 0;
  int t = 0;
  
  scanf("%d", &n);
  
  for(i = 0; i < n; i++){
    scanf("%d", &a[i]);
  }
  
  sort_str(a, n);
  
  for(i = n - 1; i >= 0; i--){
    if(t == 0){
      sum_a += a[i];
      t = 1;
    }
    else if(t == 1){
      sum_b += a[i];
      t = 0;
    }
  }
  
  printf("%d\n", sum_a - sum_b);
  
  return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	swap_str
	.type	swap_str, @function
swap_str:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movq	-24(%rbp), %rax
	movl	(%rax), %eax
	movl	%eax, -4(%rbp)
	movq	-32(%rbp), %rax
	movl	(%rax), %edx
	movq	-24(%rbp), %rax
	movl	%edx, (%rax)
	movq	-32(%rbp), %rax
	movl	-4(%rbp), %edx
	movl	%edx, (%rax)
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	swap_str, .-swap_str
	.globl	sort_str
	.type	sort_str, @function
sort_str:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movq	%rdi, -24(%rbp)
	movl	%esi, -28(%rbp)
	movl	$0, -8(%rbp)
	jmp	.L3
.L7:
	movl	-28(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -4(%rbp)
	jmp	.L4
.L6:
	movl	-4(%rbp), %eax
	cltq
	salq	$2, %rax
	leaq	-4(%rax), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	movq	-24(%rbp), %rax
	addq	%rcx, %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jle	.L5
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rax, %rdx
	movl	-4(%rbp), %eax
	cltq
	salq	$2, %rax
	leaq	-4(%rax), %rcx
	movq	-24(%rbp), %rax
	addq	%rcx, %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	swap_str
.L5:
	subl	$1, -4(%rbp)
.L4:
	movl	-4(%rbp), %eax
	cmpl	-8(%rbp), %eax
	jg	.L6
	addl	$1, -8(%rbp)
.L3:
	movl	-8(%rbp), %eax
	cmpl	-28(%rbp), %eax
	jl	.L7
	nop
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	sort_str, .-sort_str
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB2:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$448, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -428(%rbp)
	movl	$0, -424(%rbp)
	movl	$0, -420(%rbp)
	leaq	-436(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -432(%rbp)
	jmp	.L9
.L10:
	leaq	-416(%rbp), %rdx
	movl	-432(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -432(%rbp)
.L9:
	movl	-436(%rbp), %eax
	cmpl	%eax, -432(%rbp)
	jl	.L10
	movl	-436(%rbp), %edx
	leaq	-416(%rbp), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	sort_str
	movl	-436(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -432(%rbp)
	jmp	.L11
.L14:
	cmpl	$0, -420(%rbp)
	jne	.L12
	movl	-432(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	addl	%eax, -428(%rbp)
	movl	$1, -420(%rbp)
	jmp	.L13
.L12:
	cmpl	$1, -420(%rbp)
	jne	.L13
	movl	-432(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	addl	%eax, -424(%rbp)
	movl	$0, -420(%rbp)
.L13:
	subl	$1, -432(%rbp)
.L11:
	cmpl	$0, -432(%rbp)
	jns	.L14
	movl	-428(%rbp), %eax
	subl	-424(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L16
	call	__stack_chk_fail@PLT
.L16:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.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	swap_str
	.type	swap_str, @function
swap_str:
.LFB23:
	.cfi_startproc
	endbr64
	movl	(%rdi), %eax
	movl	(%rsi), %edx
	movl	%edx, (%rdi)
	movl	%eax, (%rsi)
	ret
	.cfi_endproc
.LFE23:
	.size	swap_str, .-swap_str
	.p2align 4
	.globl	sort_str
	.type	sort_str, @function
sort_str:
.LFB24:
	.cfi_startproc
	endbr64
	testl	%esi, %esi
	jle	.L3
	subl	$1, %esi
	je	.L3
	xorl	%r8d, %r8d
	movslq	%esi, %r9
	.p2align 4,,10
	.p2align 3
.L7:
	movq	%r9, %rdx
	.p2align 4,,10
	.p2align 3
.L6:
	movq	-4(%rdi,%rdx,4), %xmm0
	pshufd	$0xe5, %xmm0, %xmm2
	movd	%xmm0, %eax
	movd	%xmm2, %ecx
	pshufd	$225, %xmm0, %xmm1
	cmpl	%eax, %ecx
	jge	.L9
	movq	%xmm1, -4(%rdi,%rdx,4)
.L9:
	subq	$1, %rdx
	cmpl	%edx, %r8d
	jl	.L6
	addl	$1, %r8d
	cmpl	%esi, %r8d
	jl	.L7
	ret
	.p2align 4,,10
	.p2align 3
.L3:
	ret
	.cfi_endproc
.LFE24:
	.size	sort_str, .-sort_str
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB25:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	.LC0(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	movq	%r13, %rdi
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$440, %rsp
	.cfi_def_cfa_offset 480
	movq	%fs:40, %rax
	movq	%rax, 424(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	jle	.L18
	leaq	16(%rsp), %rbx
	xorl	%ebp, %ebp
	movq	%rbx, %r12
	.p2align 4,,10
	.p2align 3
.L19:
	movq	%r12, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addl	$1, %ebp
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %r9d
	addq	$4, %r12
	cmpl	%ebp, %r9d
	jg	.L19
	leal	-1(%r9), %r8d
	testl	%r9d, %r9d
	jle	.L18
	movslq	%r8d, %r11
	testl	%r8d, %r8d
	jle	.L20
	leaq	-4(%rbx,%r11,4), %r10
	xorl	%edi, %edi
	.p2align 4,,10
	.p2align 3
.L22:
	movq	%r10, %rdx
	movl	%r8d, %ecx
	.p2align 4,,10
	.p2align 3
.L21:
	movq	(%rdx), %xmm0
	pshufd	$0xe5, %xmm0, %xmm2
	movd	%xmm0, %eax
	movd	%xmm2, %esi
	pshufd	$225, %xmm0, %xmm1
	cmpl	%eax, %esi
	jge	.L24
	movq	%xmm1, (%rdx)
.L24:
	subl	$1, %ecx
	subq	$4, %rdx
	cmpl	%edi, %ecx
	jg	.L21
	addl	$1, %edi
	cmpl	%r8d, %edi
	jl	.L22
.L20:
	andl	$-2, %r9d
	movl	%r8d, %ecx
	leaq	(%rbx,%r11,4), %rax
	xorl	%esi, %esi
	subl	%r9d, %ecx
	xorl	%edx, %edx
.L23:
	addl	(%rax), %edx
	cmpl	%r8d, %ecx
	je	.L27
	subl	$2, %r8d
	addl	-4(%rax), %esi
	subq	$8, %rax
	cmpl	$-1, %r8d
	jne	.L23
.L27:
	subl	%esi, %edx
	xorl	%eax, %eax
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	424(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L38
	addq	$440, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
.L18:
	.cfi_restore_state
	xorl	%esi, %esi
	xorl	%edx, %edx
	jmp	.L27
.L38:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE25:
	.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
	.p2align 4
	.globl	swap_str
	.type	swap_str, @function
swap_str:
.LFB23:
	.cfi_startproc
	endbr64
	movl	(%rdi), %eax
	movl	(%rsi), %edx
	movl	%edx, (%rdi)
	movl	%eax, (%rsi)
	ret
	.cfi_endproc
.LFE23:
	.size	swap_str, .-swap_str
	.p2align 4
	.globl	sort_str
	.type	sort_str, @function
sort_str:
.LFB24:
	.cfi_startproc
	endbr64
	testl	%esi, %esi
	jle	.L3
	subl	$1, %esi
	je	.L3
	xorl	%r8d, %r8d
	movslq	%esi, %r9
	.p2align 4,,10
	.p2align 3
.L7:
	movq	%r9, %rdx
	.p2align 4,,10
	.p2align 3
.L6:
	movq	-4(%rdi,%rdx,4), %xmm0
	pshufd	$0xe5, %xmm0, %xmm2
	movd	%xmm0, %eax
	movd	%xmm2, %ecx
	pshufd	$225, %xmm0, %xmm1
	cmpl	%eax, %ecx
	jge	.L9
	movq	%xmm1, -4(%rdi,%rdx,4)
.L9:
	subq	$1, %rdx
	cmpl	%edx, %r8d
	jl	.L6
	addl	$1, %r8d
	cmpl	%esi, %r8d
	jl	.L7
	ret
	.p2align 4,,10
	.p2align 3
.L3:
	ret
	.cfi_endproc
.LFE24:
	.size	sort_str, .-sort_str
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB25:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	.LC0(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	movq	%r13, %rdi
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$440, %rsp
	.cfi_def_cfa_offset 480
	movq	%fs:40, %rax
	movq	%rax, 424(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	jle	.L18
	leaq	16(%rsp), %rbx
	xorl	%ebp, %ebp
	movq	%rbx, %r12
	.p2align 4,,10
	.p2align 3
.L19:
	movq	%r12, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addl	$1, %ebp
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %r9d
	addq	$4, %r12
	cmpl	%ebp, %r9d
	jg	.L19
	leal	-1(%r9), %r8d
	testl	%r9d, %r9d
	jle	.L18
	movslq	%r8d, %r11
	testl	%r8d, %r8d
	jle	.L20
	leaq	-4(%rbx,%r11,4), %r10
	xorl	%edi, %edi
	.p2align 4,,10
	.p2align 3
.L22:
	movq	%r10, %rdx
	movl	%r8d, %ecx
	.p2align 4,,10
	.p2align 3
.L21:
	movq	(%rdx), %xmm0
	pshufd	$0xe5, %xmm0, %xmm2
	movd	%xmm0, %eax
	movd	%xmm2, %esi
	pshufd	$225, %xmm0, %xmm1
	cmpl	%eax, %esi
	jge	.L24
	movq	%xmm1, (%rdx)
.L24:
	subl	$1, %ecx
	subq	$4, %rdx
	cmpl	%edi, %ecx
	jg	.L21
	addl	$1, %edi
	cmpl	%r8d, %edi
	jl	.L22
.L20:
	andl	$-2, %r9d
	movl	%r8d, %ecx
	leaq	(%rbx,%r11,4), %rax
	xorl	%esi, %esi
	subl	%r9d, %ecx
	xorl	%edx, %edx
.L23:
	addl	(%rax), %edx
	cmpl	%r8d, %ecx
	je	.L27
	subl	$2, %r8d
	addl	-4(%rax), %esi
	subq	$8, %rax
	cmpl	$-1, %r8d
	jne	.L23
.L27:
	subl	%esi, %edx
	xorl	%eax, %eax
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	424(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L38
	addq	$440, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
.L18:
	.cfi_restore_state
	xorl	%esi, %esi
	xorl	%edx, %edx
	jmp	.L27
.L38:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE25:
	.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>

void swap_str(int *a, int *b){
  int temp = *a;
  *a = *b;
  *b = temp;
}

void sort_str(int *s, int n){
  int i, j;
  
  for(i = 0; i < n; i++){
    for(j = n - 1; j > i; j-- ){
      if(s[j - 1] > s[j])
        swap_str(&s[j - 1], &s[j]);
    }
  }
}

int main(){
  int n;
  int i;
  int a[101];
  int sum_a = 0;
  int sum_b = 0;
  int t = 0;
  
  scanf("%d", &n);
  
  for(i = 0; i < n; i++){
    scanf("%d", &a[i]);
  }
  
  sort_str(a, n);
  
  for(i = n - 1; i >= 0; i--){
    if(t == 0){
      sum_a += a[i];
      t = 1;
    }
    else if(t == 1){
      sum_b += a[i];
      t = 0;
    }
  }
  
  printf("%d\n", sum_a - sum_b);
  
  return 0;
}

4
20 18 2 12
 2
2 1
 3
3 7 4
 4
20 1 2 12
 2
2 0
 3
3 9 4
 4
20 1 4 12
 2
2 -1
 2
4 -1
 4
20 2 0 12

12
 1
 6
 9
 2
 8
 11
 3
 5
 10

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>

void swap_str(int *a, int *b){
  int temp = *a;
  *a = *b;
  *b = temp;
}

void sort_str(int *s, int n){
  int i, j;
  
  for(i = 0; i < n; i++){
    for(j = n - 1; j > i; j-- ){
      if(s[j - 1] > s[j])
        swap_str(&s[j - 1], &s[j]);
    }
  }
}

int main(){
  int n;
  int i;
  int a[101];
  int sum_a = 0;
  int sum_b = 0;
  int t = 0;
  
  scanf("%d", &n);
  
  for(i = 0; i < n; i++){
    scanf("%d", &a[i]);
  }
  
  sort_str(a, n);
  
  for(i = n - 1; i >= 0; i--){
    if(t == 0){
      sum_a += a[i];
      t = 1;
    }
    else if(t == 1){
      sum_b += a[i];
      t = 0;
    }
  }
  
  printf("%d\n", sum_a - sum_b);
  
  return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	swap_str
	.type	swap_str, @function
swap_str:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movq	-24(%rbp), %rax
	movl	(%rax), %eax
	movl	%eax, -4(%rbp)
	movq	-32(%rbp), %rax
	movl	(%rax), %edx
	movq	-24(%rbp), %rax
	movl	%edx, (%rax)
	movq	-32(%rbp), %rax
	movl	-4(%rbp), %edx
	movl	%edx, (%rax)
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	swap_str, .-swap_str
	.globl	sort_str
	.type	sort_str, @function
sort_str:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movq	%rdi, -24(%rbp)
	movl	%esi, -28(%rbp)
	movl	$0, -8(%rbp)
	jmp	.L3
.L7:
	movl	-28(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -4(%rbp)
	jmp	.L4
.L6:
	movl	-4(%rbp), %eax
	cltq
	salq	$2, %rax
	leaq	-4(%rax), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	movq	-24(%rbp), %rax
	addq	%rcx, %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jle	.L5
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rax, %rdx
	movl	-4(%rbp), %eax
	cltq
	salq	$2, %rax
	leaq	-4(%rax), %rcx
	movq	-24(%rbp), %rax
	addq	%rcx, %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	swap_str
.L5:
	subl	$1, -4(%rbp)
.L4:
	movl	-4(%rbp), %eax
	cmpl	-8(%rbp), %eax
	jg	.L6
	addl	$1, -8(%rbp)
.L3:
	movl	-8(%rbp), %eax
	cmpl	-28(%rbp), %eax
	jl	.L7
	nop
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	sort_str, .-sort_str
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB2:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$448, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -428(%rbp)
	movl	$0, -424(%rbp)
	movl	$0, -420(%rbp)
	leaq	-436(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -432(%rbp)
	jmp	.L9
.L10:
	leaq	-416(%rbp), %rdx
	movl	-432(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -432(%rbp)
.L9:
	movl	-436(%rbp), %eax
	cmpl	%eax, -432(%rbp)
	jl	.L10
	movl	-436(%rbp), %edx
	leaq	-416(%rbp), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	sort_str
	movl	-436(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -432(%rbp)
	jmp	.L11
.L14:
	cmpl	$0, -420(%rbp)
	jne	.L12
	movl	-432(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	addl	%eax, -428(%rbp)
	movl	$1, -420(%rbp)
	jmp	.L13
.L12:
	cmpl	$1, -420(%rbp)
	jne	.L13
	movl	-432(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	addl	%eax, -424(%rbp)
	movl	$0, -420(%rbp)
.L13:
	subl	$1, -432(%rbp)
.L11:
	cmpl	$0, -432(%rbp)
	jns	.L14
	movl	-428(%rbp), %eax
	subl	-424(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L16
	call	__stack_chk_fail@PLT
.L16:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.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	swap_str
	.type	swap_str, @function
swap_str:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movq	-24(%rbp), %rax
	movl	(%rax), %eax
	movl	%eax, -4(%rbp)
	movq	-32(%rbp), %rax
	movl	(%rax), %edx
	movq	-24(%rbp), %rax
	movl	%edx, (%rax)
	movq	-32(%rbp), %rax
	movl	-4(%rbp), %edx
	movl	%edx, (%rax)
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	swap_str, .-swap_str
	.globl	sort_str
	.type	sort_str, @function
sort_str:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movq	%rdi, -24(%rbp)
	movl	%esi, -28(%rbp)
	movl	$0, -8(%rbp)
	jmp	.L3
.L7:
	movl	-28(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -4(%rbp)
	jmp	.L4
.L6:
	movl	-4(%rbp), %eax
	cltq
	salq	$2, %rax
	leaq	-4(%rax), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	movq	-24(%rbp), %rax
	addq	%rcx, %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jle	.L5
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rax, %rdx
	movl	-4(%rbp), %eax
	cltq
	salq	$2, %rax
	leaq	-4(%rax), %rcx
	movq	-24(%rbp), %rax
	addq	%rcx, %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	swap_str
.L5:
	subl	$1, -4(%rbp)
.L4:
	movl	-4(%rbp), %eax
	cmpl	-8(%rbp), %eax
	jg	.L6
	addl	$1, -8(%rbp)
.L3:
	movl	-8(%rbp), %eax
	cmpl	-28(%rbp), %eax
	jl	.L7
	nop
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	sort_str, .-sort_str
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB2:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$448, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -428(%rbp)
	movl	$0, -424(%rbp)
	movl	$0, -420(%rbp)
	leaq	-436(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -432(%rbp)
	jmp	.L9
.L10:
	leaq	-416(%rbp), %rdx
	movl	-432(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -432(%rbp)
.L9:
	movl	-436(%rbp), %eax
	cmpl	%eax, -432(%rbp)
	jl	.L10
	movl	-436(%rbp), %edx
	leaq	-416(%rbp), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	sort_str
	movl	-436(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -432(%rbp)
	jmp	.L11
.L14:
	cmpl	$0, -420(%rbp)
	jne	.L12
	movl	-432(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	addl	%eax, -428(%rbp)
	movl	$1, -420(%rbp)
	jmp	.L13
.L12:
	cmpl	$1, -420(%rbp)
	jne	.L13
	movl	-432(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	addl	%eax, -424(%rbp)
	movl	$0, -420(%rbp)
.L13:
	subl	$1, -432(%rbp)
.L11:
	cmpl	$0, -432(%rbp)
	jns	.L14
	movl	-428(%rbp), %eax
	subl	-424(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L16
	call	__stack_chk_fail@PLT
.L16:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.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:
