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>
#define N 10000

void CountingSort(int k);

int A[2000001],B[2000001],C[N];

int main(){
  int i,k;
  
  scanf("%d",&k);
  for(i=1;i<k+1;i++)
    scanf("%d",&A[i]);

  CountingSort(k);

  for(i=1;i<k;i++)
    printf("%d ",B[i]);
  printf("%d\n",B[i]);

  return 0;
}
void CountingSort(int k){
  int i,j;
  
  for(i=0;i<=N;i++)
    C[i] = 0;

  /* C[i] に i の出現数を記録する */
  for(j=1;j<=k;j++)
    C[A[j]]++;
  
  /* C[i] に i 以下の数の出現数を記録する*/
  for(i=1;i<=N;i++)
    C[i] = C[i] + C[i-1];
  
  for(j=k;j>0;j--){
    B[C[A[j]]] = A[j];
    C[A[j]]--;
  }
}

```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	A
	.bss
	.align 32
	.type	A, @object
	.size	A, 8000004
A:
	.zero	8000004
	.globl	B
	.align 32
	.type	B, @object
	.size	B, 8000004
B:
	.zero	8000004
	.globl	C
	.align 32
	.type	C, @object
	.size	C, 40000
C:
	.zero	40000
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d "
.LC2:
	.string	"%d\n"
	.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	$16, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-16(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, -12(%rbp)
	jmp	.L2
.L3:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -12(%rbp)
.L2:
	movl	-16(%rbp), %eax
	cmpl	%eax, -12(%rbp)
	jle	.L3
	movl	-16(%rbp), %eax
	movl	%eax, %edi
	call	CountingSort
	movl	$1, -12(%rbp)
	jmp	.L4
.L5:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	B(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -12(%rbp)
.L4:
	movl	-16(%rbp), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L5
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	B(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L7
	call	__stack_chk_fail@PLT
.L7:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	CountingSort
	.type	CountingSort, @function
CountingSort:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -20(%rbp)
	movl	$0, -8(%rbp)
	jmp	.L9
.L10:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	C(%rip), %rax
	movl	$0, (%rdx,%rax)
	addl	$1, -8(%rbp)
.L9:
	cmpl	$10000, -8(%rbp)
	jle	.L10
	movl	$1, -4(%rbp)
	jmp	.L11
.L12:
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	movl	(%rdx,%rax), %eax
	movslq	%eax, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	C(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	leal	1(%rdx), %ecx
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	C(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	addl	$1, -4(%rbp)
.L11:
	movl	-4(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jle	.L12
	movl	$1, -8(%rbp)
	jmp	.L13
.L14:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	C(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-8(%rbp), %eax
	subl	$1, %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	C(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, %ecx
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	C(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	addl	$1, -8(%rbp)
.L13:
	cmpl	$10000, -8(%rbp)
	jle	.L14
	movl	-20(%rbp), %eax
	movl	%eax, -4(%rbp)
	jmp	.L15
.L16:
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	C(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	A(%rip), %rax
	movl	(%rcx,%rax), %eax
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	B(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	movl	(%rdx,%rax), %eax
	movslq	%eax, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	C(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	leal	-1(%rdx), %ecx
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	C(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	subl	$1, -4(%rbp)
.L15:
	cmpl	$0, -4(%rbp)
	jg	.L16
	nop
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	CountingSort, .-CountingSort
	.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	CountingSort
	.type	CountingSort, @function
CountingSort:
.LFB24:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	movl	$40004, %edx
	movl	%edi, %ebx
	xorl	%esi, %esi
	leaq	C(%rip), %rdi
	call	memset@PLT
	movq	%rax, %rdi
	testl	%ebx, %ebx
	jle	.L2
	leaq	4+A(%rip), %rax
	leal	-1(%rbx), %edx
	leaq	4(%rax), %rcx
	leaq	(%rcx,%rdx,4), %rcx
	.p2align 4,,10
	.p2align 3
.L3:
	movslq	(%rax), %rdx
	addq	$4, %rax
	addl	$1, (%rdi,%rdx,4)
	cmpq	%rcx, %rax
	jne	.L3
.L2:
	leaq	4+C(%rip), %rax
	movl	C(%rip), %edx
	leaq	40000(%rax), %rcx
	.p2align 4,,10
	.p2align 3
.L4:
	addl	(%rax), %edx
	addq	$4, %rax
	movl	%edx, -4(%rax)
	cmpq	%rcx, %rax
	jne	.L4
	testl	%ebx, %ebx
	jle	.L1
	movslq	%ebx, %rax
	leal	-1(%rbx), %ecx
	leaq	A(%rip), %rdx
	leaq	(%rdx,%rax,4), %rdx
	subq	%rcx, %rax
	leaq	-4+A(%rip), %rcx
	leaq	(%rcx,%rax,4), %r10
	leaq	B(%rip), %r9
	.p2align 4,,10
	.p2align 3
.L6:
	movslq	(%rdx), %rcx
	subq	$4, %rdx
	movslq	(%rdi,%rcx,4), %r8
	movq	%r8, %rax
	movl	%ecx, (%r9,%r8,4)
	subl	$1, %eax
	movl	%eax, (%rdi,%rcx,4)
	cmpq	%rdx, %r10
	jne	.L6
.L1:
	popq	%rbx
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE24:
	.size	CountingSort, .-CountingSort
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%d "
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	leaq	.LC0(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	movq	%r12, %rdi
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	subq	$16, %rsp
	.cfi_def_cfa_offset 48
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %edi
	testl	%edi, %edi
	jle	.L13
	leaq	4+A(%rip), %rbp
	movl	$1, %ebx
	.p2align 4,,10
	.p2align 3
.L14:
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %edi
	addq	$4, %rbp
	cmpl	%ebx, %edi
	jge	.L14
.L13:
	call	CountingSort
	cmpl	$1, 4(%rsp)
	jle	.L18
	leaq	4+B(%rip), %rbp
	movl	$1, %ebx
	leaq	.LC1(%rip), %r12
	.p2align 4,,10
	.p2align 3
.L16:
	movl	0(%rbp), %edx
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addl	$1, %ebx
	addq	$4, %rbp
	call	__printf_chk@PLT
	cmpl	%ebx, 4(%rsp)
	jg	.L16
.L15:
	leaq	B(%rip), %rax
	movslq	%ebx, %rbx
	movl	$1, %edi
	movl	(%rax,%rbx,4), %edx
	leaq	.LC2(%rip), %rsi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L22
	addq	$16, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L18:
	.cfi_restore_state
	movl	$1, %ebx
	jmp	.L15
.L22:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	C
	.bss
	.align 32
	.type	C, @object
	.size	C, 40000
C:
	.zero	40000
	.globl	B
	.align 32
	.type	B, @object
	.size	B, 8000004
B:
	.zero	8000004
	.globl	A
	.align 32
	.type	A, @object
	.size	A, 8000004
A:
	.zero	8000004
	.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	CountingSort
	.type	CountingSort, @function
CountingSort:
.LFB24:
	.cfi_startproc
	endbr64
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	movl	$40004, %edx
	movl	%edi, %ebx
	xorl	%esi, %esi
	leaq	C(%rip), %rdi
	call	memset@PLT
	movq	%rax, %rdi
	testl	%ebx, %ebx
	jle	.L2
	leaq	4+A(%rip), %rax
	leal	-1(%rbx), %edx
	leaq	4(%rax), %rcx
	leaq	(%rcx,%rdx,4), %rcx
	.p2align 4,,10
	.p2align 3
.L3:
	movslq	(%rax), %rdx
	addq	$4, %rax
	addl	$1, (%rdi,%rdx,4)
	cmpq	%rcx, %rax
	jne	.L3
.L2:
	leaq	4+C(%rip), %rax
	movl	C(%rip), %edx
	leaq	40000(%rax), %rcx
	.p2align 4,,10
	.p2align 3
.L4:
	addl	(%rax), %edx
	addq	$4, %rax
	movl	%edx, -4(%rax)
	cmpq	%rcx, %rax
	jne	.L4
	testl	%ebx, %ebx
	jle	.L1
	movslq	%ebx, %rax
	leal	-1(%rbx), %ecx
	leaq	A(%rip), %rdx
	leaq	(%rdx,%rax,4), %rdx
	subq	%rcx, %rax
	leaq	-4+A(%rip), %rcx
	leaq	(%rcx,%rax,4), %r10
	leaq	B(%rip), %r9
	.p2align 4,,10
	.p2align 3
.L6:
	movslq	(%rdx), %rcx
	subq	$4, %rdx
	movslq	(%rdi,%rcx,4), %r8
	movq	%r8, %rax
	movl	%ecx, (%r9,%r8,4)
	subl	$1, %eax
	movl	%eax, (%rdi,%rcx,4)
	cmpq	%rdx, %r10
	jne	.L6
.L1:
	popq	%rbx
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE24:
	.size	CountingSort, .-CountingSort
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%d "
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	leaq	.LC0(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	movq	%r12, %rdi
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	subq	$16, %rsp
	.cfi_def_cfa_offset 48
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %edi
	testl	%edi, %edi
	jle	.L13
	leaq	4+A(%rip), %rbp
	movl	$1, %ebx
	.p2align 4,,10
	.p2align 3
.L14:
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %edi
	addq	$4, %rbp
	cmpl	%ebx, %edi
	jge	.L14
.L13:
	call	CountingSort
	cmpl	$1, 4(%rsp)
	jle	.L18
	leaq	4+B(%rip), %rbp
	movl	$1, %ebx
	leaq	.LC1(%rip), %r12
	.p2align 4,,10
	.p2align 3
.L16:
	movl	0(%rbp), %edx
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addl	$1, %ebx
	addq	$4, %rbp
	call	__printf_chk@PLT
	cmpl	%ebx, 4(%rsp)
	jg	.L16
.L15:
	leaq	B(%rip), %rax
	movslq	%ebx, %rbx
	movl	$1, %edi
	movl	(%rax,%rbx,4), %edx
	leaq	.LC2(%rip), %rsi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L22
	addq	$16, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L18:
	.cfi_restore_state
	movl	$1, %ebx
	jmp	.L15
.L22:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	C
	.bss
	.align 32
	.type	C, @object
	.size	C, 40000
C:
	.zero	40000
	.globl	B
	.align 32
	.type	B, @object
	.size	B, 8000004
B:
	.zero	8000004
	.globl	A
	.align 32
	.type	A, @object
	.size	A, 8000004
A:
	.zero	8000004
	.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>
#define N 10000

void CountingSort(int k);

int A[2000001],B[2000001],C[N];

int main(){
  int i,k;
  
  scanf("%d",&k);
  for(i=1;i<k+1;i++)
    scanf("%d",&A[i]);

  CountingSort(k);

  for(i=1;i<k;i++)
    printf("%d ",B[i]);
  printf("%d\n",B[i]);

  return 0;
}
void CountingSort(int k){
  int i,j;
  
  for(i=0;i<=N;i++)
    C[i] = 0;

  /* C[i] に i の出現数を記録する */
  for(j=1;j<=k;j++)
    C[A[j]]++;
  
  /* C[i] に i 以下の数の出現数を記録する*/
  for(i=1;i<=N;i++)
    C[i] = C[i] + C[i-1];
  
  for(j=k;j>0;j--){
    B[C[A[j]]] = A[j];
    C[A[j]]--;
  }
}


7
2 5 1 3 2 3 1
 7
2 5 1 3 4 3 1
 7
2 5 2 3 4 3 1
 7
4 5 2 3 4 3 1
 7
4 9 2 3 4 3 1
 7
4 9 2 3 4 3 2
 7
4 9 2 1 4 3 2
 7
4 9 2 0 4 3 3
 7
8 9 2 0 4 3 3
 7
8 9 2 0 6 3 3

1 1 2 2 3 3 5
 1 1 2 3 3 4 5
 1 2 2 3 3 4 5
 1 2 3 3 4 4 5
 1 2 3 3 4 4 9
 2 2 3 3 4 4 9
 1 2 2 3 4 4 9
 0 2 3 3 4 4 9
 0 2 3 3 4 8 9
 0 2 3 3 6 8 9

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>
#define N 10000

void CountingSort(int k);

int A[2000001],B[2000001],C[N];

int main(){
  int i,k;
  
  scanf("%d",&k);
  for(i=1;i<k+1;i++)
    scanf("%d",&A[i]);

  CountingSort(k);

  for(i=1;i<k;i++)
    printf("%d ",B[i]);
  printf("%d\n",B[i]);

  return 0;
}
void CountingSort(int k){
  int i,j;
  
  for(i=0;i<=N;i++)
    C[i] = 0;

  /* C[i] に i の出現数を記録する */
  for(j=1;j<=k;j++)
    C[A[j]]++;
  
  /* C[i] に i 以下の数の出現数を記録する*/
  for(i=1;i<=N;i++)
    C[i] = C[i] + C[i-1];
  
  for(j=k;j>0;j--){
    B[C[A[j]]] = A[j];
    C[A[j]]--;
  }
}

```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	A
	.bss
	.align 32
	.type	A, @object
	.size	A, 8000004
A:
	.zero	8000004
	.globl	B
	.align 32
	.type	B, @object
	.size	B, 8000004
B:
	.zero	8000004
	.globl	C
	.align 32
	.type	C, @object
	.size	C, 40000
C:
	.zero	40000
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d "
.LC2:
	.string	"%d\n"
	.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	$16, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-16(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, -12(%rbp)
	jmp	.L2
.L3:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -12(%rbp)
.L2:
	movl	-16(%rbp), %eax
	cmpl	%eax, -12(%rbp)
	jle	.L3
	movl	-16(%rbp), %eax
	movl	%eax, %edi
	call	CountingSort
	movl	$1, -12(%rbp)
	jmp	.L4
.L5:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	B(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -12(%rbp)
.L4:
	movl	-16(%rbp), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L5
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	B(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L7
	call	__stack_chk_fail@PLT
.L7:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	CountingSort
	.type	CountingSort, @function
CountingSort:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -20(%rbp)
	movl	$0, -8(%rbp)
	jmp	.L9
.L10:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	C(%rip), %rax
	movl	$0, (%rdx,%rax)
	addl	$1, -8(%rbp)
.L9:
	cmpl	$10000, -8(%rbp)
	jle	.L10
	movl	$1, -4(%rbp)
	jmp	.L11
.L12:
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	movl	(%rdx,%rax), %eax
	movslq	%eax, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	C(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	leal	1(%rdx), %ecx
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	C(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	addl	$1, -4(%rbp)
.L11:
	movl	-4(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jle	.L12
	movl	$1, -8(%rbp)
	jmp	.L13
.L14:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	C(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-8(%rbp), %eax
	subl	$1, %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	C(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, %ecx
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	C(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	addl	$1, -8(%rbp)
.L13:
	cmpl	$10000, -8(%rbp)
	jle	.L14
	movl	-20(%rbp), %eax
	movl	%eax, -4(%rbp)
	jmp	.L15
.L16:
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	C(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	A(%rip), %rax
	movl	(%rcx,%rax), %eax
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	B(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	movl	(%rdx,%rax), %eax
	movslq	%eax, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	C(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	leal	-1(%rdx), %ecx
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	C(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	subl	$1, -4(%rbp)
.L15:
	cmpl	$0, -4(%rbp)
	jg	.L16
	nop
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	CountingSort, .-CountingSort
	.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	A
	.bss
	.align 32
	.type	A, @object
	.size	A, 8000004
A:
	.zero	8000004
	.globl	B
	.align 32
	.type	B, @object
	.size	B, 8000004
B:
	.zero	8000004
	.globl	C
	.align 32
	.type	C, @object
	.size	C, 40000
C:
	.zero	40000
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d "
.LC2:
	.string	"%d\n"
	.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	$16, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-16(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, -12(%rbp)
	jmp	.L2
.L3:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -12(%rbp)
.L2:
	movl	-16(%rbp), %eax
	cmpl	%eax, -12(%rbp)
	jle	.L3
	movl	-16(%rbp), %eax
	movl	%eax, %edi
	call	CountingSort
	movl	$1, -12(%rbp)
	jmp	.L4
.L5:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	B(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -12(%rbp)
.L4:
	movl	-16(%rbp), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L5
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	B(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L7
	call	__stack_chk_fail@PLT
.L7:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	CountingSort
	.type	CountingSort, @function
CountingSort:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -20(%rbp)
	movl	$0, -8(%rbp)
	jmp	.L9
.L10:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	C(%rip), %rax
	movl	$0, (%rdx,%rax)
	addl	$1, -8(%rbp)
.L9:
	cmpl	$10000, -8(%rbp)
	jle	.L10
	movl	$1, -4(%rbp)
	jmp	.L11
.L12:
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	movl	(%rdx,%rax), %eax
	movslq	%eax, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	C(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	leal	1(%rdx), %ecx
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	C(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	addl	$1, -4(%rbp)
.L11:
	movl	-4(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jle	.L12
	movl	$1, -8(%rbp)
	jmp	.L13
.L14:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	C(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	-8(%rbp), %eax
	subl	$1, %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	C(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, %ecx
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	C(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	addl	$1, -8(%rbp)
.L13:
	cmpl	$10000, -8(%rbp)
	jle	.L14
	movl	-20(%rbp), %eax
	movl	%eax, -4(%rbp)
	jmp	.L15
.L16:
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	C(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	A(%rip), %rax
	movl	(%rcx,%rax), %eax
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	B(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	movl	(%rdx,%rax), %eax
	movslq	%eax, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	C(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	leal	-1(%rdx), %ecx
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	C(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	subl	$1, -4(%rbp)
.L15:
	cmpl	$0, -4(%rbp)
	jg	.L16
	nop
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	CountingSort, .-CountingSort
	.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:
