user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<countSort>:
  endbr64
  push   %r12
  mov    %esi,%r12d
  push   %rbp
  mov    %rdi,%rbp
  lea    0x0(,%r12,4),%edi
  push   %rbx
  mov    %edx,%ebx
  sub    $0x30,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  call   <malloc@plt>
  pxor   %xmm0,%xmm0
  lea    -0x1(%r12),%esi
  movq   $0x0,0x20(%rsp)
  mov    %rax,%rcx
  movaps %xmm0,(%rsp)
  movaps %xmm0,0x10(%rsp)
  test   %r12d,%r12d
  jle    L41
  lea    -0x1(%r12),%eax
  mov    %rbp,%rdi
  mov    %rax,%rsi
  lea    0x4(%rbp,%rax,4),%r8
  nopl   0x0(%rax)
L93:
  mov    (%rdi),%eax
  add    $0x4,%rdi
  cltd
  idiv   %ebx
  movslq %eax,%rdx
  mov    %eax,%r9d
  imul   $0x66666667,%rdx,%rdx
  sar    $0x1f,%r9d
  sar    $0x22,%rdx
  sub    %r9d,%edx
  lea    (%rdx,%rdx,4),%r9d
  add    %r9d,%r9d
  sub    %r9d,%eax
  movslq %eax,%rdx
  addl   $0x1,(%rsp,%rdx,4)
  cmp    %rdi,%r8
  jne    L93
L41:
  mov    0x8(%rsp),%edx
  mov    0xc(%rsp),%r9d
  mov    (%rsp),%r8d
  add    0x4(%rsp),%r8d
  mov    0x10(%rsp),%eax
  add    %r8d,%edx
  mov    0x14(%rsp),%r11d
  add    %edx,%r9d
  mov    0x18(%rsp),%edi
  movd   %edx,%xmm3
  movd   0x20(%rsp),%xmm5
  add    %r9d,%eax
  movd   0x18(%rsp),%xmm6
  mov    0x1c(%rsp),%r10d
  add    %eax,%r11d
  movd   0x1c(%rsp),%xmm1
  movd   0x14(%rsp),%xmm0
  add    %r11d,%edi
  punpckldq %xmm5,%xmm1
  punpckldq %xmm6,%xmm0
  movd   %r11d,%xmm5
  add    %edi,%r10d
  punpcklqdq %xmm1,%xmm0
  movd   %r10d,%xmm7
  movd   %eax,%xmm1
  movd   0x10(%rsp),%xmm6
  movd   %edi,%xmm2
  punpckldq %xmm5,%xmm1
  movd   %r9d,%xmm5
  punpckldq %xmm7,%xmm2
  movd   0x8(%rsp),%xmm7
  punpckldq %xmm5,%xmm3
  punpcklqdq %xmm2,%xmm1
  movd   0xc(%rsp),%xmm2
  paddd  %xmm1,%xmm0
  movd   (%rsp),%xmm1
  punpckldq %xmm6,%xmm2
  movd   %r8d,%xmm6
  movups %xmm0,0x14(%rsp)
  pshufd $0xff,%xmm0,%xmm0
  punpckldq %xmm7,%xmm1
  movd   %xmm0,%eax
  add    %eax,0x24(%rsp)
  punpcklqdq %xmm2,%xmm1
  movd   0x4(%rsp),%xmm2
  punpckldq %xmm6,%xmm2
  punpcklqdq %xmm3,%xmm2
  paddd  %xmm2,%xmm1
  movups %xmm1,0x4(%rsp)
  test   %esi,%esi
  js     L97
  movslq %esi,%rdi
L80:
  mov    0x0(%rbp,%rdi,4),%r8d
  sub    $0x1,%rdi
  mov    %r8d,%eax
  cltd
  idiv   %ebx
  movslq %eax,%rdx
  mov    %eax,%r9d
  imul   $0x66666667,%rdx,%rdx
  sar    $0x1f,%r9d
  sar    $0x22,%rdx
  sub    %r9d,%edx
  lea    (%rdx,%rdx,4),%r9d
  add    %r9d,%r9d
  sub    %r9d,%eax
  movslq %eax,%rdx
  movslq (%rsp,%rdx,4),%r9
  mov    %r9,%rax
  mov    %r8d,-0x4(%rcx,%r9,4)
  sub    $0x1,%eax
  mov    %eax,(%rsp,%rdx,4)
  test   %edi,%edi
  jns    L80
L97:
  test   %r12d,%r12d
  jle    L25
  lea    0x4(%rcx),%rdx
  mov    %rbp,%rax
  sub    %rdx,%rax
  cmp    $0x8,%rax
  jbe    L58
  cmp    $0x2,%esi
  jbe    L58
  mov    %r12d,%edx
  mov    %rbp,%rsi
  mov    %rcx,%rax
  shr    $0x2,%edx
  sub    %rcx,%rsi
  shl    $0x4,%rdx
  add    %rcx,%rdx
  cs nopw 0x0(%rax,%rax,1)
L26:
  movdqu (%rax),%xmm4
  movups %xmm4,(%rsi,%rax,1)
  add    $0x10,%rax
  cmp    %rax,%rdx
  jne    L26
  mov    %r12d,%eax
  and    $0xfffffffc,%eax
  test   $0x3,%r12b
  je     L25
  mov    %eax,%esi
  mov    (%rcx,%rsi,4),%edi
  lea    0x0(,%rsi,4),%rdx
  mov    %edi,0x0(%rbp,%rsi,4)
  lea    0x1(%rax),%esi
  cmp    %esi,%r12d
  jle    L25
  mov    0x4(%rcx,%rdx,1),%esi
  add    $0x2,%eax
  mov    %esi,0x4(%rbp,%rdx,1)
  cmp    %eax,%r12d
  jle    L25
  mov    0x8(%rcx,%rdx,1),%eax
  mov    %eax,0x8(%rbp,%rdx,1)
L25:
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L115
  add    $0x30,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
  nopw   0x0(%rax,%rax,1)
L58:
  lea    (%rcx,%r12,4),%rdx
  sub    %rcx,%rbp
  nopw   0x0(%rax,%rax,1)
L64:
  mov    (%rcx),%eax
  mov    %eax,0x0(%rbp,%rcx,1)
  add    $0x4,%rcx
  cmp    %rcx,%rdx
  jne    L64
  jmp    L25
L115:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void countSort(int *arr, int n, int exp) {
  int *output = (int *)malloc(sizeof(int) * n);
  int i, cont[10] = {0};
  for (i = 0; i < n; i++)
    cont[(arr[i] / exp) % 10]++;
  for (i = 1; i < 10; i++)
    cont[i] += cont[i - 1];
  for (i = n - 1; i >= 0; i--) {
    output[cont[(arr[i] / exp) % 10] - 1] = arr[i];
    cont[(arr[i] / exp) % 10]--;
  }
  for (i = 0; i < n; i++)
    arr[i] = output[i];
}
```