user: 请将以下的汇编代码转换成C语言代码：

```asm
<CountSort>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbx
  mov    %rdi,%rbx
  sub    $0x28,%rsp
  mov    (%rdi),%r14d
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  xor    %eax,%eax
  test   %esi,%esi
  jle    L51
  lea    -0x1(%rsi),%edx
  lea    0x4(%rdi),%rax
  mov    %esi,%r15d
  mov    %r14d,%r12d
  lea    (%rax,%rdx,4),%rcx
  mov    %r14d,%edx
  jmp    L109
  nopl   0x0(%rax,%rax,1)
L191:
  mov    (%rax),%edx
  add    $0x4,%rax
L109:
  cmp    %edx,%r12d
  cmovl  %edx,%r12d
  cmp    %rax,%rcx
  jne    L191
  lea    0x1(%r12),%eax
  mov    %rsp,%rdx
  cltq
  lea    0xf(,%rax,4),%r8
  mov    %r8,%rcx
  mov    %r8,%rax
  and    $0xfffffffffffff000,%rcx
  and    $0xfffffffffffffff0,%rax
  sub    %rcx,%rdx
  cmp    %rdx,%rsp
  je     L212
L130:
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  cmp    %rdx,%rsp
  jne    L130
L212:
  and    $0xfff,%eax
  sub    %rax,%rsp
  test   %rax,%rax
  jne    L7
L103:
  mov    %rsp,%rdi
  mov    %rdi,%r13
  test   %r12d,%r12d
  js     L5
  movslq %r12d,%rcx
  xor    %esi,%esi
  mov    %r8,-0x48(%rbp)
  lea    0x4(,%rcx,4),%rdx
  call   <memset@plt>
  mov    -0x48(%rbp),%r8
  mov    %r13,%rdi
L5:
  xor    %eax,%eax
  jmp    L67
  nop
L26:
  mov    (%rbx,%rax,4),%r14d
L67:
  movslq %r14d,%rdx
  add    $0x1,%rax
  addl   $0x1,(%rdi,%rdx,4)
  cmp    %eax,%r15d
  jg     L26
L117:
  mov    %r8,%rax
  mov    %rsp,%rdx
  and    $0xfffffffffffff000,%r8
  sub    %r8,%rdx
  and    $0xfffffffffffffff0,%rax
  cmp    %rdx,%rsp
  je     L220
L125:
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  cmp    %rdx,%rsp
  jne    L125
L220:
  and    $0xfff,%eax
  sub    %rax,%rsp
  test   %rax,%rax
  jne    L235
L188:
  lea    0x3(%rsp),%rsi
  mov    0x0(%r13),%edx
  mov    %rsi,%rax
  and    $0xfffffffffffffffc,%rsi
  shr    $0x2,%rax
  mov    %edx,0x0(,%rax,4)
  test   %r12d,%r12d
  jle    L219
  movslq %r12d,%rcx
  mov    $0x1,%eax
  jmp    L8
  nopl   0x0(%rax)
L82:
  add    $0x1,%rax
L8:
  add    0x0(%r13,%rax,4),%edx
  mov    %edx,(%rsi,%rax,4)
  cmp    %rax,%rcx
  jne    L82
  nopl   0x0(%rax)
L156:
  movslq (%rsi,%rcx,4),%rax
  mov    %ecx,%edx
  test   %eax,%eax
  je     L275
  nopw   0x0(%rax,%rax,1)
L76:
  mov    %edx,-0x4(%rbx,%rax,4)
  sub    $0x1,%rax
  test   %eax,%eax
  jne    L76
  movl   $0x0,(%rsi,%rcx,4)
L275:
  sub    $0x1,%rcx
  test   %ecx,%ecx
  jns    L156
L57:
  mov    -0x38(%rbp),%rax
  sub    %fs:0x28,%rax
  jne    L18
  lea    -0x28(%rbp),%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
L235:
  orq    $0x0,-0x8(%rsp,%rax,1)
  jmp    L188
L7:
  orq    $0x0,-0x8(%rsp,%rax,1)
  jmp    L103
L51:
  lea    0x1(%r14),%eax
  mov    %rsp,%rdx
  cltq
  lea    0xf(,%rax,4),%r8
  mov    %r8,%rcx
  mov    %r8,%rax
  and    $0xfffffffffffff000,%rcx
  and    $0xfffffffffffffff0,%rax
  sub    %rcx,%rdx
  cmp    %rdx,%rsp
  je     L58
L172:
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  cmp    %rdx,%rsp
  jne    L172
L58:
  and    $0xfff,%eax
  sub    %rax,%rsp
  test   %rax,%rax
  je     L271
  orq    $0x0,-0x8(%rsp,%rax,1)
L271:
  mov    %rsp,%r13
  test   %r14d,%r14d
  js     L57
  movslq %r14d,%rax
  xor    %esi,%esi
  mov    %r13,%rdi
  mov    %r8,-0x48(%rbp)
  lea    0x4(,%rax,4),%rdx
  mov    %r14d,%r12d
  call   <memset@plt>
  mov    -0x48(%rbp),%r8
  jmp    L117
L219:
  jne    L57
  xor    %ecx,%ecx
  jmp    L156
L18:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void CountSort(int *A, int n) {
  int maxValue = A[0];
  for (int i = 0; i < n; i++)
    maxValue = (maxValue > A[i]) ? (maxValue) : A[i];
  int B[maxValue + 1];
  for (int i = 0; i < maxValue + 1; i++)
    B[i] = 0;
  for (int i = 0; i < n; i++)
    B[A[i]]++;
  int C[maxValue + 1];
  C[0] = B[0];
  for (int i = 1; i < maxValue + 1; i++)
    C[i] = C[i - 1] + B[i];
  for (int i = maxValue; i >= 0; i--) {
    while (C[i]) {
      A[C[i] - 1] = i;
      C[i]--;
    }
  }
}
```