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>

typedef struct {
  char mark;
  int number;
}card;

void BubbleSort(card C[], int N);
void SelectionSort(card C[], int N);

int main(){
  int N,i;
  card C[36];
  card D[36];

  scanf("%d",&N);

  for(i=0;i<N;i++){
    scanf(" %c",&C[i].mark);
    scanf("%d",&C[i].number);
    D[i] = C[i];
  }

  BubbleSort(C,N);
  SelectionSort(D,N);

    for(i=0;i<N-1;i++){
      printf("%c%d ",C[i].mark,C[i].number);
    }
    printf("%c%d\n",C[N-1].mark,C[N-1].number);
    printf("Stable\n");

    for(i=0;i<N-1;i++){
      printf("%c%d ",D[i].mark,D[i].number);
    }
    printf("%c%d\n",D[N-1].mark,D[N-1].number);

    for(i=0;i<N;i++){
      if(i == N-1){
        printf("Stable\n");
      }
      if((C[i].number != D[i].number) || (C[i].mark != D[i].mark)){
          printf("Not stable\n");
          break;
        }
    }
    return 0;
}


void BubbleSort(card C[], int N){
  int i,j;
  card tmp;

  for(i=0;i<N-1;i++){
    for(j=N-1;j>i;j--){
      if(C[j].number < C[j-1].number){
        tmp = C[j];
        C[j] = C[j-1];
        C[j-1] = tmp;
      }
    }
  }
}

void SelectionSort(card C[],int N){
  card tmp;
  int minj,i,j;

  for(i=0;i<N;i++){
    minj = i;
    for(j=i;j<N;j++){
      if(C[j].number < C[minj].number){
        minj = j;
      }
    }
    tmp = C[i];
    C[i] = C[minj];
    C[minj] = tmp; 
      
  }

  return;
}




```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	" %c"
.LC2:
	.string	"%c%d "
.LC3:
	.string	"%c%d\n"
.LC4:
	.string	"Stable"
.LC5:
	.string	"Not stable"
	.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	$608, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-600(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -596(%rbp)
	jmp	.L2
.L3:
	leaq	-592(%rbp), %rdx
	movl	-596(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-592(%rbp), %rdx
	movl	-596(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	addq	$4, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-596(%rbp), %eax
	cltq
	movl	-596(%rbp), %edx
	movslq	%edx, %rdx
	movq	-592(%rbp,%rdx,8), %rdx
	movq	%rdx, -304(%rbp,%rax,8)
	addl	$1, -596(%rbp)
.L2:
	movl	-600(%rbp), %eax
	cmpl	%eax, -596(%rbp)
	jl	.L3
	movl	-600(%rbp), %edx
	leaq	-592(%rbp), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	BubbleSort
	movl	-600(%rbp), %edx
	leaq	-304(%rbp), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	SelectionSort
	movl	$0, -596(%rbp)
	jmp	.L4
.L5:
	movl	-596(%rbp), %eax
	cltq
	movl	-588(%rbp,%rax,8), %edx
	movl	-596(%rbp), %eax
	cltq
	movzbl	-592(%rbp,%rax,8), %eax
	movsbl	%al, %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -596(%rbp)
.L4:
	movl	-600(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -596(%rbp)
	jl	.L5
	movl	-600(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-588(%rbp,%rax,8), %edx
	movl	-600(%rbp), %eax
	subl	$1, %eax
	cltq
	movzbl	-592(%rbp,%rax,8), %eax
	movsbl	%al, %eax
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	leaq	.LC4(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$0, -596(%rbp)
	jmp	.L6
.L7:
	movl	-596(%rbp), %eax
	cltq
	movl	-300(%rbp,%rax,8), %edx
	movl	-596(%rbp), %eax
	cltq
	movzbl	-304(%rbp,%rax,8), %eax
	movsbl	%al, %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -596(%rbp)
.L6:
	movl	-600(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -596(%rbp)
	jl	.L7
	movl	-600(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-300(%rbp,%rax,8), %edx
	movl	-600(%rbp), %eax
	subl	$1, %eax
	cltq
	movzbl	-304(%rbp,%rax,8), %eax
	movsbl	%al, %eax
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, -596(%rbp)
	jmp	.L8
.L13:
	movl	-600(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -596(%rbp)
	jne	.L9
	leaq	.LC4(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L9:
	movl	-596(%rbp), %eax
	cltq
	movl	-588(%rbp,%rax,8), %edx
	movl	-596(%rbp), %eax
	cltq
	movl	-300(%rbp,%rax,8), %eax
	cmpl	%eax, %edx
	jne	.L10
	movl	-596(%rbp), %eax
	cltq
	movzbl	-592(%rbp,%rax,8), %edx
	movl	-596(%rbp), %eax
	cltq
	movzbl	-304(%rbp,%rax,8), %eax
	cmpb	%al, %dl
	je	.L11
.L10:
	leaq	.LC5(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L12
.L11:
	addl	$1, -596(%rbp)
.L8:
	movl	-600(%rbp), %eax
	cmpl	%eax, -596(%rbp)
	jl	.L13
.L12:
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L15
	call	__stack_chk_fail@PLT
.L15:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	BubbleSort
	.type	BubbleSort, @function
BubbleSort:
.LFB1:
	.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)
	movl	%esi, -28(%rbp)
	movl	$0, -16(%rbp)
	jmp	.L17
.L21:
	movl	-28(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -12(%rbp)
	jmp	.L18
.L20:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	4(%rax), %edx
	movl	-12(%rbp), %eax
	cltq
	salq	$3, %rax
	leaq	-8(%rax), %rcx
	movq	-24(%rbp), %rax
	addq	%rcx, %rax
	movl	4(%rax), %eax
	cmpl	%eax, %edx
	jge	.L19
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	movq	%rax, -8(%rbp)
	movl	-12(%rbp), %eax
	cltq
	salq	$3, %rax
	leaq	-8(%rax), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	-12(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	movq	-24(%rbp), %rdx
	addq	%rcx, %rdx
	movq	(%rax), %rax
	movq	%rax, (%rdx)
	movl	-12(%rbp), %eax
	cltq
	salq	$3, %rax
	leaq	-8(%rax), %rdx
	movq	-24(%rbp), %rax
	addq	%rax, %rdx
	movq	-8(%rbp), %rax
	movq	%rax, (%rdx)
.L19:
	subl	$1, -12(%rbp)
.L18:
	movl	-12(%rbp), %eax
	cmpl	-16(%rbp), %eax
	jg	.L20
	addl	$1, -16(%rbp)
.L17:
	movl	-28(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -16(%rbp)
	jl	.L21
	nop
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	BubbleSort, .-BubbleSort
	.globl	SelectionSort
	.type	SelectionSort, @function
SelectionSort:
.LFB2:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -40(%rbp)
	movl	%esi, -44(%rbp)
	movl	$0, -16(%rbp)
	jmp	.L23
.L27:
	movl	-16(%rbp), %eax
	movl	%eax, -20(%rbp)
	movl	-16(%rbp), %eax
	movl	%eax, -12(%rbp)
	jmp	.L24
.L26:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	4(%rax), %edx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	movq	-40(%rbp), %rax
	addq	%rcx, %rax
	movl	4(%rax), %eax
	cmpl	%eax, %edx
	jge	.L25
	movl	-12(%rbp), %eax
	movl	%eax, -20(%rbp)
.L25:
	addl	$1, -12(%rbp)
.L24:
	movl	-12(%rbp), %eax
	cmpl	-44(%rbp), %eax
	jl	.L26
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	movq	%rax, -8(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	-16(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	movq	-40(%rbp), %rdx
	addq	%rcx, %rdx
	movq	(%rax), %rax
	movq	%rax, (%rdx)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-40(%rbp), %rax
	addq	%rax, %rdx
	movq	-8(%rbp), %rax
	movq	%rax, (%rdx)
	addl	$1, -16(%rbp)
.L23:
	movl	-16(%rbp), %eax
	cmpl	-44(%rbp), %eax
	jl	.L27
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	SelectionSort, .-SelectionSort
	.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	BubbleSort
	.type	BubbleSort, @function
BubbleSort:
.LFB24:
	.cfi_startproc
	endbr64
	leal	-1(%rsi), %r9d
	testl	%r9d, %r9d
	jle	.L1
	movslq	%esi, %rsi
	leaq	(%rdi,%rsi,8), %r10
	xorl	%esi, %esi
	.p2align 4,,10
	.p2align 3
.L5:
	movq	%r10, %rax
	movl	%r9d, %edx
	.p2align 4,,10
	.p2align 3
.L4:
	movl	-4(%rax), %ecx
	cmpl	-12(%rax), %ecx
	jge	.L3
	movq	-16(%rax), %r8
	movzbl	-8(%rax), %edi
	movl	%ecx, -12(%rax)
	movq	%r8, -8(%rax)
	movb	%dil, -16(%rax)
.L3:
	subl	$1, %edx
	subq	$8, %rax
	cmpl	%esi, %edx
	jg	.L4
	addl	$1, %esi
	cmpl	%esi, %r9d
	jne	.L5
.L1:
	ret
	.cfi_endproc
.LFE24:
	.size	BubbleSort, .-BubbleSort
	.p2align 4
	.globl	SelectionSort
	.type	SelectionSort, @function
SelectionSort:
.LFB25:
	.cfi_startproc
	endbr64
	testl	%esi, %esi
	jle	.L20
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rdi, %r10
	xorl	%r11d, %r11d
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	movq	%rdi, %rbx
	.p2align 4,,10
	.p2align 3
.L13:
	movl	4(%r10), %ebp
	movq	%r10, %rax
	movl	%r11d, %edx
	movl	%r11d, %r9d
	movl	%ebp, %r8d
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L24:
	movslq	%r9d, %rcx
	addl	$1, %edx
	addq	$8, %rax
	leaq	(%rbx,%rcx,8), %rdi
	cmpl	%edx, %esi
	jle	.L23
.L12:
	movl	4(%rax), %ecx
	movq	%rax, %rdi
	cmpl	%ecx, %r8d
	jle	.L24
	movl	%edx, %r9d
	addl	$1, %edx
	movl	%ecx, %r8d
	addq	$8, %rax
	cmpl	%edx, %esi
	jg	.L12
.L23:
	movzbl	(%r10), %eax
	movq	(%rdi), %rdx
	addl	$1, %r11d
	addq	$8, %r10
	movq	%rdx, -8(%r10)
	movb	%al, (%rdi)
	movl	%ebp, 4(%rdi)
	cmpl	%r11d, %esi
	jne	.L13
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
.L20:
	.cfi_restore 3
	.cfi_restore 6
	ret
	.cfi_endproc
.LFE25:
	.size	SelectionSort, .-SelectionSort
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	" %c"
.LC2:
	.string	"%c%d "
.LC3:
	.string	"%c%d\n"
.LC4:
	.string	"Stable"
.LC5:
	.string	"Not stable"
	.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
	leaq	.LC0(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movq	%r14, %rdi
	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
	subq	$616, %rsp
	.cfi_def_cfa_offset 672
	movq	%fs:40, %rax
	movq	%rax, 600(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	leaq	16(%rsp), %r12
	leaq	304(%rsp), %rbp
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %esi
	testl	%esi, %esi
	jle	.L26
	movq	%r12, %rbx
	xorl	%r13d, %r13d
	leaq	.LC1(%rip), %r15
	leaq	304(%rsp), %rbp
	.p2align 4,,10
	.p2align 3
.L27:
	movq	%rbx, %rsi
	movq	%r15, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	leaq	4(%rbx), %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	(%rbx), %rax
	movl	12(%rsp), %esi
	addq	$8, %rbx
	movq	%rax, 0(%rbp,%r13,8)
	addq	$1, %r13
	cmpl	%r13d, %esi
	jg	.L27
.L26:
	movq	%r12, %rdi
	call	BubbleSort
	movl	12(%rsp), %esi
	movq	%rbp, %rdi
	call	SelectionSort
	movl	12(%rsp), %eax
	subl	$1, %eax
	testl	%eax, %eax
	jle	.L28
	leaq	20(%rsp), %r13
	xorl	%r14d, %r14d
	leaq	.LC2(%rip), %rbx
	.p2align 4,,10
	.p2align 3
.L29:
	movsbl	-4(%r13), %edx
	movl	0(%r13), %ecx
	movq	%rbx, %rsi
	xorl	%eax, %eax
	movl	$1, %edi
	addl	$1, %r14d
	addq	$8, %r13
	call	__printf_chk@PLT
	movl	12(%rsp), %eax
	subl	$1, %eax
	cmpl	%r14d, %eax
	jg	.L29
.L28:
	cltq
	leaq	.LC3(%rip), %rsi
	movl	$1, %edi
	movl	20(%rsp,%rax,8), %ecx
	movsbl	16(%rsp,%rax,8), %edx
	leaq	.LC4(%rip), %r13
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	%r13, %rdi
	call	puts@PLT
	movl	12(%rsp), %eax
	subl	$1, %eax
	testl	%eax, %eax
	jle	.L30
	leaq	308(%rsp), %r15
	xorl	%r14d, %r14d
	leaq	.LC2(%rip), %rbx
	.p2align 4,,10
	.p2align 3
.L31:
	movsbl	-4(%r15), %edx
	movl	(%r15), %ecx
	movq	%rbx, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addl	$1, %r14d
	addq	$8, %r15
	call	__printf_chk@PLT
	movl	12(%rsp), %eax
	subl	$1, %eax
	cmpl	%r14d, %eax
	jg	.L31
.L30:
	cltq
	leaq	.LC3(%rip), %rsi
	movl	$1, %edi
	xorl	%ebx, %ebx
	movl	308(%rsp,%rax,8), %ecx
	movsbl	304(%rsp,%rax,8), %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	jg	.L32
	jmp	.L33
	.p2align 4,,10
	.p2align 3
.L34:
	movl	4(%rbp,%rbx,8), %eax
	cmpl	%eax, 4(%r12,%rbx,8)
	jne	.L35
.L48:
	movzbl	0(%rbp,%rbx,8), %eax
	cmpb	%al, (%r12,%rbx,8)
	jne	.L35
	movl	12(%rsp), %eax
	addq	$1, %rbx
	cmpl	%ebx, %eax
	jle	.L33
.L32:
	subl	$1, %eax
	cmpl	%ebx, %eax
	jne	.L34
	movq	%r13, %rdi
	call	puts@PLT
	movl	4(%rbp,%rbx,8), %eax
	cmpl	%eax, 4(%r12,%rbx,8)
	je	.L48
.L35:
	leaq	.LC5(%rip), %rdi
	call	puts@PLT
.L33:
	movq	600(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L49
	addq	$616, %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
.L49:
	.cfi_restore_state
	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
	.p2align 4
	.globl	BubbleSort
	.type	BubbleSort, @function
BubbleSort:
.LFB24:
	.cfi_startproc
	endbr64
	leal	-1(%rsi), %r9d
	testl	%r9d, %r9d
	jle	.L1
	movslq	%esi, %rsi
	leaq	(%rdi,%rsi,8), %r10
	xorl	%esi, %esi
	.p2align 4,,10
	.p2align 3
.L5:
	movq	%r10, %rax
	movl	%r9d, %edx
	.p2align 4,,10
	.p2align 3
.L4:
	movl	-4(%rax), %ecx
	cmpl	-12(%rax), %ecx
	jge	.L3
	movq	-16(%rax), %r8
	movzbl	-8(%rax), %edi
	movl	%ecx, -12(%rax)
	movq	%r8, -8(%rax)
	movb	%dil, -16(%rax)
.L3:
	subl	$1, %edx
	subq	$8, %rax
	cmpl	%esi, %edx
	jg	.L4
	addl	$1, %esi
	cmpl	%esi, %r9d
	jne	.L5
.L1:
	ret
	.cfi_endproc
.LFE24:
	.size	BubbleSort, .-BubbleSort
	.p2align 4
	.globl	SelectionSort
	.type	SelectionSort, @function
SelectionSort:
.LFB25:
	.cfi_startproc
	endbr64
	testl	%esi, %esi
	jle	.L20
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rdi, %r10
	xorl	%r11d, %r11d
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	movq	%rdi, %rbx
	.p2align 4,,10
	.p2align 3
.L13:
	movl	4(%r10), %ebp
	movq	%r10, %rax
	movl	%r11d, %edx
	movl	%r11d, %r9d
	movl	%ebp, %r8d
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L24:
	movslq	%r9d, %rcx
	addl	$1, %edx
	addq	$8, %rax
	leaq	(%rbx,%rcx,8), %rdi
	cmpl	%edx, %esi
	jle	.L23
.L12:
	movl	4(%rax), %ecx
	movq	%rax, %rdi
	cmpl	%ecx, %r8d
	jle	.L24
	movl	%edx, %r9d
	addl	$1, %edx
	movl	%ecx, %r8d
	addq	$8, %rax
	cmpl	%edx, %esi
	jg	.L12
.L23:
	movzbl	(%r10), %eax
	movq	(%rdi), %rdx
	addl	$1, %r11d
	addq	$8, %r10
	movq	%rdx, -8(%r10)
	movb	%al, (%rdi)
	movl	%ebp, 4(%rdi)
	cmpl	%r11d, %esi
	jne	.L13
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
.L20:
	.cfi_restore 3
	.cfi_restore 6
	ret
	.cfi_endproc
.LFE25:
	.size	SelectionSort, .-SelectionSort
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	" %c"
.LC2:
	.string	"%c%d "
.LC3:
	.string	"%c%d\n"
.LC4:
	.string	"Stable"
.LC5:
	.string	"Not stable"
	.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
	leaq	.LC0(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movq	%r14, %rdi
	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
	subq	$616, %rsp
	.cfi_def_cfa_offset 672
	movq	%fs:40, %rax
	movq	%rax, 600(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rsi
	leaq	16(%rsp), %r12
	leaq	304(%rsp), %rbp
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %esi
	testl	%esi, %esi
	jle	.L26
	movq	%r12, %rbx
	xorl	%r13d, %r13d
	leaq	.LC1(%rip), %r15
	leaq	304(%rsp), %rbp
	.p2align 4,,10
	.p2align 3
.L27:
	movq	%rbx, %rsi
	movq	%r15, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	leaq	4(%rbx), %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	(%rbx), %rax
	movl	12(%rsp), %esi
	addq	$8, %rbx
	movq	%rax, 0(%rbp,%r13,8)
	addq	$1, %r13
	cmpl	%r13d, %esi
	jg	.L27
.L26:
	movq	%r12, %rdi
	call	BubbleSort
	movl	12(%rsp), %esi
	movq	%rbp, %rdi
	call	SelectionSort
	movl	12(%rsp), %eax
	subl	$1, %eax
	testl	%eax, %eax
	jle	.L28
	leaq	20(%rsp), %r13
	xorl	%r14d, %r14d
	leaq	.LC2(%rip), %rbx
	.p2align 4,,10
	.p2align 3
.L29:
	movsbl	-4(%r13), %edx
	movl	0(%r13), %ecx
	movq	%rbx, %rsi
	xorl	%eax, %eax
	movl	$1, %edi
	addl	$1, %r14d
	addq	$8, %r13
	call	__printf_chk@PLT
	movl	12(%rsp), %eax
	subl	$1, %eax
	cmpl	%r14d, %eax
	jg	.L29
.L28:
	cltq
	leaq	.LC3(%rip), %rsi
	movl	$1, %edi
	movl	20(%rsp,%rax,8), %ecx
	movsbl	16(%rsp,%rax,8), %edx
	leaq	.LC4(%rip), %r13
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	%r13, %rdi
	call	puts@PLT
	movl	12(%rsp), %eax
	subl	$1, %eax
	testl	%eax, %eax
	jle	.L30
	leaq	308(%rsp), %r15
	xorl	%r14d, %r14d
	leaq	.LC2(%rip), %rbx
	.p2align 4,,10
	.p2align 3
.L31:
	movsbl	-4(%r15), %edx
	movl	(%r15), %ecx
	movq	%rbx, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addl	$1, %r14d
	addq	$8, %r15
	call	__printf_chk@PLT
	movl	12(%rsp), %eax
	subl	$1, %eax
	cmpl	%r14d, %eax
	jg	.L31
.L30:
	cltq
	leaq	.LC3(%rip), %rsi
	movl	$1, %edi
	xorl	%ebx, %ebx
	movl	308(%rsp,%rax,8), %ecx
	movsbl	304(%rsp,%rax,8), %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	12(%rsp), %eax
	testl	%eax, %eax
	jg	.L32
	jmp	.L33
	.p2align 4,,10
	.p2align 3
.L34:
	movl	4(%rbp,%rbx,8), %eax
	cmpl	%eax, 4(%r12,%rbx,8)
	jne	.L35
.L48:
	movzbl	0(%rbp,%rbx,8), %eax
	cmpb	%al, (%r12,%rbx,8)
	jne	.L35
	movl	12(%rsp), %eax
	addq	$1, %rbx
	cmpl	%ebx, %eax
	jle	.L33
.L32:
	subl	$1, %eax
	cmpl	%ebx, %eax
	jne	.L34
	movq	%r13, %rdi
	call	puts@PLT
	movl	4(%rbp,%rbx,8), %eax
	cmpl	%eax, 4(%r12,%rbx,8)
	je	.L48
.L35:
	leaq	.LC5(%rip), %rdi
	call	puts@PLT
.L33:
	movq	600(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L49
	addq	$616, %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
.L49:
	.cfi_restore_state
	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>

typedef struct {
  char mark;
  int number;
}card;

void BubbleSort(card C[], int N);
void SelectionSort(card C[], int N);

int main(){
  int N,i;
  card C[36];
  card D[36];

  scanf("%d",&N);

  for(i=0;i<N;i++){
    scanf(" %c",&C[i].mark);
    scanf("%d",&C[i].number);
    D[i] = C[i];
  }

  BubbleSort(C,N);
  SelectionSort(D,N);

    for(i=0;i<N-1;i++){
      printf("%c%d ",C[i].mark,C[i].number);
    }
    printf("%c%d\n",C[N-1].mark,C[N-1].number);
    printf("Stable\n");

    for(i=0;i<N-1;i++){
      printf("%c%d ",D[i].mark,D[i].number);
    }
    printf("%c%d\n",D[N-1].mark,D[N-1].number);

    for(i=0;i<N;i++){
      if(i == N-1){
        printf("Stable\n");
      }
      if((C[i].number != D[i].number) || (C[i].mark != D[i].mark)){
          printf("Not stable\n");
          break;
        }
    }
    return 0;
}


void BubbleSort(card C[], int N){
  int i,j;
  card tmp;

  for(i=0;i<N-1;i++){
    for(j=N-1;j>i;j--){
      if(C[j].number < C[j-1].number){
        tmp = C[j];
        C[j] = C[j-1];
        C[j-1] = tmp;
      }
    }
  }
}

void SelectionSort(card C[],int N){
  card tmp;
  int minj,i,j;

  for(i=0;i<N;i++){
    minj = i;
    for(j=i;j<N;j++){
      if(C[j].number < C[minj].number){
        minj = j;
      }
    }
    tmp = C[i];
    C[i] = C[minj];
    C[minj] = tmp; 
      
  }

  return;
}





5
H4 B9 S4 D2 C3
 5
H4 C9 S4 D2 C2
 5
H4 B9 S4 E2 C3
 5
I4 C9 S4 D2 C2
 5
H3 B9 S4 E2 C3
 5
H3 B9 S4 E2 B3
 5
H3 B9 S4 E3 B3
 5
H3 A9 S4 E3 B3
 5
H4 C9 S4 C2 C3
 5
H4 B9 T4 D2 C3

D2 C3 H4 S4 B9
Stable
D2 C3 S4 H4 B9
Not stable
 D2 C2 H4 S4 C9
Stable
D2 C2 S4 H4 C9
Not stable
 E2 C3 H4 S4 B9
Stable
E2 C3 S4 H4 B9
Not stable
 D2 C2 I4 S4 C9
Stable
D2 C2 S4 I4 C9
Not stable
 E2 H3 C3 S4 B9
Stable
E2 H3 C3 S4 B9
Stable
 E2 H3 B3 S4 B9
Stable
E2 H3 B3 S4 B9
Stable
 H3 E3 B3 S4 B9
Stable
H3 E3 B3 S4 B9
Stable
 H3 E3 B3 S4 A9
Stable
H3 E3 B3 S4 A9
Stable
 C2 C3 H4 S4 C9
Stable
C2 C3 S4 H4 C9
Not stable
 D2 C3 H4 T4 B9
Stable
D2 C3 T4 H4 B9
Not stable

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>

typedef struct {
  char mark;
  int number;
}card;

void BubbleSort(card C[], int N);
void SelectionSort(card C[], int N);

int main(){
  int N,i;
  card C[36];
  card D[36];

  scanf("%d",&N);

  for(i=0;i<N;i++){
    scanf(" %c",&C[i].mark);
    scanf("%d",&C[i].number);
    D[i] = C[i];
  }

  BubbleSort(C,N);
  SelectionSort(D,N);

    for(i=0;i<N-1;i++){
      printf("%c%d ",C[i].mark,C[i].number);
    }
    printf("%c%d\n",C[N-1].mark,C[N-1].number);
    printf("Stable\n");

    for(i=0;i<N-1;i++){
      printf("%c%d ",D[i].mark,D[i].number);
    }
    printf("%c%d\n",D[N-1].mark,D[N-1].number);

    for(i=0;i<N;i++){
      if(i == N-1){
        printf("Stable\n");
      }
      if((C[i].number != D[i].number) || (C[i].mark != D[i].mark)){
          printf("Not stable\n");
          break;
        }
    }
    return 0;
}


void BubbleSort(card C[], int N){
  int i,j;
  card tmp;

  for(i=0;i<N-1;i++){
    for(j=N-1;j>i;j--){
      if(C[j].number < C[j-1].number){
        tmp = C[j];
        C[j] = C[j-1];
        C[j-1] = tmp;
      }
    }
  }
}

void SelectionSort(card C[],int N){
  card tmp;
  int minj,i,j;

  for(i=0;i<N;i++){
    minj = i;
    for(j=i;j<N;j++){
      if(C[j].number < C[minj].number){
        minj = j;
      }
    }
    tmp = C[i];
    C[i] = C[minj];
    C[minj] = tmp; 
      
  }

  return;
}




```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	" %c"
.LC2:
	.string	"%c%d "
.LC3:
	.string	"%c%d\n"
.LC4:
	.string	"Stable"
.LC5:
	.string	"Not stable"
	.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	$608, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-600(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -596(%rbp)
	jmp	.L2
.L3:
	leaq	-592(%rbp), %rdx
	movl	-596(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-592(%rbp), %rdx
	movl	-596(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	addq	$4, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-596(%rbp), %eax
	cltq
	movl	-596(%rbp), %edx
	movslq	%edx, %rdx
	movq	-592(%rbp,%rdx,8), %rdx
	movq	%rdx, -304(%rbp,%rax,8)
	addl	$1, -596(%rbp)
.L2:
	movl	-600(%rbp), %eax
	cmpl	%eax, -596(%rbp)
	jl	.L3
	movl	-600(%rbp), %edx
	leaq	-592(%rbp), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	BubbleSort
	movl	-600(%rbp), %edx
	leaq	-304(%rbp), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	SelectionSort
	movl	$0, -596(%rbp)
	jmp	.L4
.L5:
	movl	-596(%rbp), %eax
	cltq
	movl	-588(%rbp,%rax,8), %edx
	movl	-596(%rbp), %eax
	cltq
	movzbl	-592(%rbp,%rax,8), %eax
	movsbl	%al, %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -596(%rbp)
.L4:
	movl	-600(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -596(%rbp)
	jl	.L5
	movl	-600(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-588(%rbp,%rax,8), %edx
	movl	-600(%rbp), %eax
	subl	$1, %eax
	cltq
	movzbl	-592(%rbp,%rax,8), %eax
	movsbl	%al, %eax
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	leaq	.LC4(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$0, -596(%rbp)
	jmp	.L6
.L7:
	movl	-596(%rbp), %eax
	cltq
	movl	-300(%rbp,%rax,8), %edx
	movl	-596(%rbp), %eax
	cltq
	movzbl	-304(%rbp,%rax,8), %eax
	movsbl	%al, %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -596(%rbp)
.L6:
	movl	-600(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -596(%rbp)
	jl	.L7
	movl	-600(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-300(%rbp,%rax,8), %edx
	movl	-600(%rbp), %eax
	subl	$1, %eax
	cltq
	movzbl	-304(%rbp,%rax,8), %eax
	movsbl	%al, %eax
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, -596(%rbp)
	jmp	.L8
.L13:
	movl	-600(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -596(%rbp)
	jne	.L9
	leaq	.LC4(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L9:
	movl	-596(%rbp), %eax
	cltq
	movl	-588(%rbp,%rax,8), %edx
	movl	-596(%rbp), %eax
	cltq
	movl	-300(%rbp,%rax,8), %eax
	cmpl	%eax, %edx
	jne	.L10
	movl	-596(%rbp), %eax
	cltq
	movzbl	-592(%rbp,%rax,8), %edx
	movl	-596(%rbp), %eax
	cltq
	movzbl	-304(%rbp,%rax,8), %eax
	cmpb	%al, %dl
	je	.L11
.L10:
	leaq	.LC5(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L12
.L11:
	addl	$1, -596(%rbp)
.L8:
	movl	-600(%rbp), %eax
	cmpl	%eax, -596(%rbp)
	jl	.L13
.L12:
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L15
	call	__stack_chk_fail@PLT
.L15:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	BubbleSort
	.type	BubbleSort, @function
BubbleSort:
.LFB1:
	.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)
	movl	%esi, -28(%rbp)
	movl	$0, -16(%rbp)
	jmp	.L17
.L21:
	movl	-28(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -12(%rbp)
	jmp	.L18
.L20:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	4(%rax), %edx
	movl	-12(%rbp), %eax
	cltq
	salq	$3, %rax
	leaq	-8(%rax), %rcx
	movq	-24(%rbp), %rax
	addq	%rcx, %rax
	movl	4(%rax), %eax
	cmpl	%eax, %edx
	jge	.L19
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	movq	%rax, -8(%rbp)
	movl	-12(%rbp), %eax
	cltq
	salq	$3, %rax
	leaq	-8(%rax), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	-12(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	movq	-24(%rbp), %rdx
	addq	%rcx, %rdx
	movq	(%rax), %rax
	movq	%rax, (%rdx)
	movl	-12(%rbp), %eax
	cltq
	salq	$3, %rax
	leaq	-8(%rax), %rdx
	movq	-24(%rbp), %rax
	addq	%rax, %rdx
	movq	-8(%rbp), %rax
	movq	%rax, (%rdx)
.L19:
	subl	$1, -12(%rbp)
.L18:
	movl	-12(%rbp), %eax
	cmpl	-16(%rbp), %eax
	jg	.L20
	addl	$1, -16(%rbp)
.L17:
	movl	-28(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -16(%rbp)
	jl	.L21
	nop
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	BubbleSort, .-BubbleSort
	.globl	SelectionSort
	.type	SelectionSort, @function
SelectionSort:
.LFB2:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -40(%rbp)
	movl	%esi, -44(%rbp)
	movl	$0, -16(%rbp)
	jmp	.L23
.L27:
	movl	-16(%rbp), %eax
	movl	%eax, -20(%rbp)
	movl	-16(%rbp), %eax
	movl	%eax, -12(%rbp)
	jmp	.L24
.L26:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	4(%rax), %edx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	movq	-40(%rbp), %rax
	addq	%rcx, %rax
	movl	4(%rax), %eax
	cmpl	%eax, %edx
	jge	.L25
	movl	-12(%rbp), %eax
	movl	%eax, -20(%rbp)
.L25:
	addl	$1, -12(%rbp)
.L24:
	movl	-12(%rbp), %eax
	cmpl	-44(%rbp), %eax
	jl	.L26
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	movq	%rax, -8(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	-16(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	movq	-40(%rbp), %rdx
	addq	%rcx, %rdx
	movq	(%rax), %rax
	movq	%rax, (%rdx)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-40(%rbp), %rax
	addq	%rax, %rdx
	movq	-8(%rbp), %rax
	movq	%rax, (%rdx)
	addl	$1, -16(%rbp)
.L23:
	movl	-16(%rbp), %eax
	cmpl	-44(%rbp), %eax
	jl	.L27
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	SelectionSort, .-SelectionSort
	.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	" %c"
.LC2:
	.string	"%c%d "
.LC3:
	.string	"%c%d\n"
.LC4:
	.string	"Stable"
.LC5:
	.string	"Not stable"
	.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	$608, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-600(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -596(%rbp)
	jmp	.L2
.L3:
	leaq	-592(%rbp), %rdx
	movl	-596(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-592(%rbp), %rdx
	movl	-596(%rbp), %eax
	cltq
	salq	$3, %rax
	addq	%rdx, %rax
	addq	$4, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-596(%rbp), %eax
	cltq
	movl	-596(%rbp), %edx
	movslq	%edx, %rdx
	movq	-592(%rbp,%rdx,8), %rdx
	movq	%rdx, -304(%rbp,%rax,8)
	addl	$1, -596(%rbp)
.L2:
	movl	-600(%rbp), %eax
	cmpl	%eax, -596(%rbp)
	jl	.L3
	movl	-600(%rbp), %edx
	leaq	-592(%rbp), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	BubbleSort
	movl	-600(%rbp), %edx
	leaq	-304(%rbp), %rax
	movl	%edx, %esi
	movq	%rax, %rdi
	call	SelectionSort
	movl	$0, -596(%rbp)
	jmp	.L4
.L5:
	movl	-596(%rbp), %eax
	cltq
	movl	-588(%rbp,%rax,8), %edx
	movl	-596(%rbp), %eax
	cltq
	movzbl	-592(%rbp,%rax,8), %eax
	movsbl	%al, %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -596(%rbp)
.L4:
	movl	-600(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -596(%rbp)
	jl	.L5
	movl	-600(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-588(%rbp,%rax,8), %edx
	movl	-600(%rbp), %eax
	subl	$1, %eax
	cltq
	movzbl	-592(%rbp,%rax,8), %eax
	movsbl	%al, %eax
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	leaq	.LC4(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$0, -596(%rbp)
	jmp	.L6
.L7:
	movl	-596(%rbp), %eax
	cltq
	movl	-300(%rbp,%rax,8), %edx
	movl	-596(%rbp), %eax
	cltq
	movzbl	-304(%rbp,%rax,8), %eax
	movsbl	%al, %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -596(%rbp)
.L6:
	movl	-600(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -596(%rbp)
	jl	.L7
	movl	-600(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-300(%rbp,%rax,8), %edx
	movl	-600(%rbp), %eax
	subl	$1, %eax
	cltq
	movzbl	-304(%rbp,%rax,8), %eax
	movsbl	%al, %eax
	movl	%eax, %esi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, -596(%rbp)
	jmp	.L8
.L13:
	movl	-600(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -596(%rbp)
	jne	.L9
	leaq	.LC4(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L9:
	movl	-596(%rbp), %eax
	cltq
	movl	-588(%rbp,%rax,8), %edx
	movl	-596(%rbp), %eax
	cltq
	movl	-300(%rbp,%rax,8), %eax
	cmpl	%eax, %edx
	jne	.L10
	movl	-596(%rbp), %eax
	cltq
	movzbl	-592(%rbp,%rax,8), %edx
	movl	-596(%rbp), %eax
	cltq
	movzbl	-304(%rbp,%rax,8), %eax
	cmpb	%al, %dl
	je	.L11
.L10:
	leaq	.LC5(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L12
.L11:
	addl	$1, -596(%rbp)
.L8:
	movl	-600(%rbp), %eax
	cmpl	%eax, -596(%rbp)
	jl	.L13
.L12:
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L15
	call	__stack_chk_fail@PLT
.L15:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	BubbleSort
	.type	BubbleSort, @function
BubbleSort:
.LFB1:
	.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)
	movl	%esi, -28(%rbp)
	movl	$0, -16(%rbp)
	jmp	.L17
.L21:
	movl	-28(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -12(%rbp)
	jmp	.L18
.L20:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	4(%rax), %edx
	movl	-12(%rbp), %eax
	cltq
	salq	$3, %rax
	leaq	-8(%rax), %rcx
	movq	-24(%rbp), %rax
	addq	%rcx, %rax
	movl	4(%rax), %eax
	cmpl	%eax, %edx
	jge	.L19
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	movq	%rax, -8(%rbp)
	movl	-12(%rbp), %eax
	cltq
	salq	$3, %rax
	leaq	-8(%rax), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	-12(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	movq	-24(%rbp), %rdx
	addq	%rcx, %rdx
	movq	(%rax), %rax
	movq	%rax, (%rdx)
	movl	-12(%rbp), %eax
	cltq
	salq	$3, %rax
	leaq	-8(%rax), %rdx
	movq	-24(%rbp), %rax
	addq	%rax, %rdx
	movq	-8(%rbp), %rax
	movq	%rax, (%rdx)
.L19:
	subl	$1, -12(%rbp)
.L18:
	movl	-12(%rbp), %eax
	cmpl	-16(%rbp), %eax
	jg	.L20
	addl	$1, -16(%rbp)
.L17:
	movl	-28(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -16(%rbp)
	jl	.L21
	nop
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	BubbleSort, .-BubbleSort
	.globl	SelectionSort
	.type	SelectionSort, @function
SelectionSort:
.LFB2:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -40(%rbp)
	movl	%esi, -44(%rbp)
	movl	$0, -16(%rbp)
	jmp	.L23
.L27:
	movl	-16(%rbp), %eax
	movl	%eax, -20(%rbp)
	movl	-16(%rbp), %eax
	movl	%eax, -12(%rbp)
	jmp	.L24
.L26:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	4(%rax), %edx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	movq	-40(%rbp), %rax
	addq	%rcx, %rax
	movl	4(%rax), %eax
	cmpl	%eax, %edx
	jge	.L25
	movl	-12(%rbp), %eax
	movl	%eax, -20(%rbp)
.L25:
	addl	$1, -12(%rbp)
.L24:
	movl	-12(%rbp), %eax
	cmpl	-44(%rbp), %eax
	jl	.L26
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	movq	%rax, -8(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	-16(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	movq	-40(%rbp), %rdx
	addq	%rcx, %rdx
	movq	(%rax), %rax
	movq	%rax, (%rdx)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-40(%rbp), %rax
	addq	%rax, %rdx
	movq	-8(%rbp), %rax
	movq	%rax, (%rdx)
	addl	$1, -16(%rbp)
.L23:
	movl	-16(%rbp), %eax
	cmpl	-44(%rbp), %eax
	jl	.L27
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	SelectionSort, .-SelectionSort
	.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:
