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),%r12d
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  xor    %eax,%eax
  test   %esi,%esi
  jle    L95
  lea    -0x1(%rsi),%eax
  mov    %esi,%r13d
  cmp    $0x2,%eax
  jbe    L149
  mov    %esi,%edx
  movd   %r12d,%xmm4
  mov    %rdi,%rax
  shr    $0x2,%edx
  pshufd $0x0,%xmm4,%xmm2
  sub    $0x1,%edx
  shl    $0x4,%rdx
  lea    0x10(%rdi,%rdx,1),%rdx
  nop
L333:
  movdqu (%rax),%xmm0
  add    $0x10,%rax
  movdqa %xmm0,%xmm1
  pcmpgtd %xmm2,%xmm1
  pand   %xmm1,%xmm0
  pandn  %xmm2,%xmm1
  movdqa %xmm1,%xmm2
  por    %xmm0,%xmm2
  cmp    %rdx,%rax
  jne    L333
  movdqa %xmm2,%xmm1
  mov    %r13d,%eax
  psrldq $0x8,%xmm1
  and    $0xfffffffc,%eax
  movdqa %xmm1,%xmm0
  pcmpgtd %xmm2,%xmm0
  pand   %xmm0,%xmm1
  pandn  %xmm2,%xmm0
  por    %xmm1,%xmm0
  movdqa %xmm0,%xmm2
  psrldq $0x4,%xmm2
  movdqa %xmm2,%xmm1
  pcmpgtd %xmm0,%xmm1
  pand   %xmm1,%xmm2
  pandn  %xmm0,%xmm1
  por    %xmm2,%xmm1
  movd   %xmm1,%r12d
  test   $0x3,%r13b
  je     L152
L33:
  movslq %eax,%rdx
  lea    0x0(,%rdx,4),%rcx
  mov    (%rbx,%rdx,4),%edx
  cmp    %edx,%r12d
  cmovl  %edx,%r12d
  lea    0x1(%rax),%edx
  cmp    %edx,%r13d
  jle    L152
  mov    0x4(%rbx,%rcx,1),%edx
  cmp    %edx,%r12d
  cmovl  %edx,%r12d
  add    $0x2,%eax
  cmp    %eax,%r13d
  jle    L152
  mov    0x8(%rbx,%rcx,1),%eax
  cmp    %eax,%r12d
  cmovl  %eax,%r12d
L152:
  lea    0x1(%r12),%r15d
  mov    %rsp,%rdx
  movslq %r15d,%rax
  lea    0xf(,%rax,4),%r8
  mov    %r8,%rcx
  mov    %r8,%rax
  and    $0xfffffffffffff000,%rcx
  and    $0xfffffffffffffff0,%rax
  sub    %rcx,%rdx
  cmp    %rdx,%rsp
  je     L315
L208:
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  cmp    %rdx,%rsp
  jne    L208
L315:
  and    $0xfff,%eax
  sub    %rax,%rsp
  test   %rax,%rax
  jne    L250
L64:
  mov    %rsp,%rcx
  mov    %rcx,%r14
  test   %r12d,%r12d
  js     L93
  movslq %r12d,%rax
  mov    %rcx,%rdi
  xor    %esi,%esi
  mov    %r8,-0x48(%rbp)
  lea    0x4(,%rax,4),%rdx
  call   <memset@plt>
  mov    -0x48(%rbp),%r8
  mov    %r14,%rcx
L93:
  xor    %eax,%eax
  nopw   0x0(%rax,%rax,1)
L253:
  movslq (%rbx,%rax,4),%rdx
  add    $0x1,%rax
  addl   $0x1,(%rcx,%rdx,4)
  cmp    %eax,%r13d
  jg     L253
L255:
  mov    %r8,%rax
  mov    %rsp,%rdx
  and    $0xfffffffffffff000,%r8
  sub    %r8,%rdx
  and    $0xfffffffffffffff0,%rax
  cmp    %rdx,%rsp
  je     L48
L188:
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  cmp    %rdx,%rsp
  jne    L188
L48:
  and    $0xfff,%eax
  sub    %rax,%rsp
  test   %rax,%rax
  jne    L176
L110:
  lea    0x3(%rsp),%r8
  mov    (%r14),%edx
  mov    %r8,%rax
  and    $0xfffffffffffffffc,%r8
  shr    $0x2,%rax
  mov    %edx,0x0(,%rax,4)
  test   %r12d,%r12d
  jle    L319
  mov    %r15d,%ecx
  mov    $0x1,%eax
  nopl   0x0(%rax,%rax,1)
L157:
  add    (%r14,%rax,4),%edx
  mov    %edx,(%r8,%rax,4)
  add    $0x1,%rax
  cmp    %rcx,%rax
  jne    L157
L167:
  movslq %r12d,%r9
  nopl   0x0(%rax)
L346:
  mov    (%r8,%r9,4),%edx
  mov    %r9d,%r10d
  test   %edx,%edx
  je     L201
  lea    -0x1(%rdx),%eax
  mov    %edx,%r11d
  cmp    $0x2,%eax
  jbe    L235
  movslq %edx,%rax
  mov    %edx,%esi
  movd   %r10d,%xmm3
  shr    $0x2,%esi
  lea    -0x10(%rbx,%rax,4),%rcx
  pshufd $0x0,%xmm3,%xmm0
  lea    -0x1(%rsi),%edi
  lea    -0x10(%rcx),%rax
  shl    $0x4,%rdi
  mov    %rax,%rsi
  sub    %rdi,%rsi
  jmp    L219
  nopl   0x0(%rax)
L14:
  sub    $0x10,%rax
L219:
  movups %xmm0,(%rcx)
  mov    %rax,%rcx
  cmp    %rax,%rsi
  jne    L14
  mov    %edx,%eax
  and    $0xfffffffc,%eax
  sub    %eax,%edx
  cmp    %eax,%r11d
  je     L136
  lea    -0x1(%rdx),%eax
L235:
  movslq %edx,%rcx
  mov    %r10d,-0x4(%rbx,%rcx,4)
  test   %eax,%eax
  je     L136
  cltq
  mov    %r10d,-0x4(%rbx,%rax,4)
  sub    $0x2,%edx
  je     L136
  movslq %edx,%rdx
  mov    %r10d,-0x4(%rbx,%rdx,4)
L136:
  movl   $0x0,(%r8,%r9,4)
L201:
  sub    $0x1,%r9
  test   %r9d,%r9d
  jns    L346
L112:
  mov    -0x38(%rbp),%rax
  sub    %fs:0x28,%rax
  jne    L132
  lea    -0x28(%rbp),%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
L176:
  orq    $0x0,-0x8(%rsp,%rax,1)
  jmp    L110
L250:
  orq    $0x0,-0x8(%rsp,%rax,1)
  jmp    L64
L95:
  lea    0x1(%r12),%r15d
  mov    %rsp,%rdx
  movslq %r15d,%rax
  lea    0xf(,%rax,4),%r8
  mov    %r8,%rcx
  mov    %r8,%rax
  and    $0xfffffffffffff000,%rcx
  and    $0xfffffffffffffff0,%rax
  sub    %rcx,%rdx
  cmp    %rdx,%rsp
  je     L89
L209:
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  cmp    %rdx,%rsp
  jne    L209
L89:
  and    $0xfff,%eax
  sub    %rax,%rsp
  test   %rax,%rax
  je     L40
  orq    $0x0,-0x8(%rsp,%rax,1)
L40:
  mov    %rsp,%r14
  test   %r12d,%r12d
  js     L112
  movslq %r12d,%rax
  xor    %esi,%esi
  mov    %r14,%rdi
  mov    %r8,-0x48(%rbp)
  lea    0x4(,%rax,4),%rdx
  call   <memset@plt>
  mov    -0x48(%rbp),%r8
  jmp    L255
L319:
  jne    L112
  jmp    L167
  nopl   0x0(%rax,%rax,1)
L149:
  xor    %eax,%eax
  jmp    L33
L132:
  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]--;
    }
  }
}
```