user: Converte this assembly snippet into its equivalent C code:

```asm
<countSort>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x50,%rsp
  mov    %rdi,-0x48(%rbp)
  mov    %esi,-0x4c(%rbp)
  mov    %edx,-0x50(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  mov    -0x4c(%rbp),%eax
  cltq
  shl    $0x2,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x38(%rbp)
  movq   $0x0,-0x30(%rbp)
  movq   $0x0,-0x28(%rbp)
  movq   $0x0,-0x20(%rbp)
  movq   $0x0,-0x18(%rbp)
  movq   $0x0,-0x10(%rbp)
  movl   $0x0,-0x3c(%rbp)
  jmp    L13
L30:
  mov    -0x3c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cltd
  idivl  -0x50(%rbp)
  mov    %eax,%ecx
  movslq %ecx,%rax
  imul   $0x66666667,%rax,%rax
  shr    $0x20,%rax
  sar    $0x2,%eax
  mov    %ecx,%esi
  sar    $0x1f,%esi
  sub    %esi,%eax
  mov    %eax,%edx
  mov    %edx,%eax
  shl    $0x2,%eax
  add    %edx,%eax
  add    %eax,%eax
  sub    %eax,%ecx
  mov    %ecx,%edx
  movslq %edx,%rax
  mov    -0x30(%rbp,%rax,4),%eax
  lea    0x1(%rax),%ecx
  movslq %edx,%rax
  mov    %ecx,-0x30(%rbp,%rax,4)
  addl   $0x1,-0x3c(%rbp)
L13:
  mov    -0x3c(%rbp),%eax
  cmp    -0x4c(%rbp),%eax
  jl     L30
  movl   $0x1,-0x3c(%rbp)
  jmp    L80
L41:
  mov    -0x3c(%rbp),%eax
  cltq
  mov    -0x30(%rbp,%rax,4),%edx
  mov    -0x3c(%rbp),%eax
  sub    $0x1,%eax
  cltq
  mov    -0x30(%rbp,%rax,4),%eax
  add    %eax,%edx
  mov    -0x3c(%rbp),%eax
  cltq
  mov    %edx,-0x30(%rbp,%rax,4)
  addl   $0x1,-0x3c(%rbp)
L80:
  cmpl   $0x9,-0x3c(%rbp)
  jle    L41
  mov    -0x4c(%rbp),%eax
  sub    $0x1,%eax
  mov    %eax,-0x3c(%rbp)
  jmp    L55
L64:
  mov    -0x3c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x48(%rbp),%rax
  lea    (%rdx,%rax,1),%rsi
  mov    -0x3c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cltd
  idivl  -0x50(%rbp)
  mov    %eax,%ecx
  movslq %ecx,%rax
  imul   $0x66666667,%rax,%rax
  shr    $0x20,%rax
  sar    $0x2,%eax
  mov    %ecx,%edi
  sar    $0x1f,%edi
  sub    %edi,%eax
  mov    %eax,%edx
  mov    %edx,%eax
  shl    $0x2,%eax
  add    %edx,%eax
  add    %eax,%eax
  sub    %eax,%ecx
  mov    %ecx,%edx
  movslq %edx,%rax
  mov    -0x30(%rbp,%rax,4),%eax
  cltq
  shl    $0x2,%rax
  lea    -0x4(%rax),%rdx
  mov    -0x38(%rbp),%rax
  add    %rax,%rdx
  mov    (%rsi),%eax
  mov    %eax,(%rdx)
  mov    -0x3c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cltd
  idivl  -0x50(%rbp)
  mov    %eax,%ecx
  movslq %ecx,%rax
  imul   $0x66666667,%rax,%rax
  shr    $0x20,%rax
  sar    $0x2,%eax
  mov    %ecx,%esi
  sar    $0x1f,%esi
  sub    %esi,%eax
  mov    %eax,%edx
  mov    %edx,%eax
  shl    $0x2,%eax
  add    %edx,%eax
  add    %eax,%eax
  sub    %eax,%ecx
  mov    %ecx,%edx
  movslq %edx,%rax
  mov    -0x30(%rbp,%rax,4),%eax
  lea    -0x1(%rax),%ecx
  movslq %edx,%rax
  mov    %ecx,-0x30(%rbp,%rax,4)
  subl   $0x1,-0x3c(%rbp)
L55:
  cmpl   $0x0,-0x3c(%rbp)
  jns    L64
  movl   $0x0,-0x3c(%rbp)
  jmp    L75
L9:
  mov    -0x3c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    -0x3c(%rbp),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,4),%rcx
  mov    -0x48(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rax),%eax
  mov    %eax,(%rdx)
  addl   $0x1,-0x3c(%rbp)
L75:
  mov    -0x3c(%rbp),%eax
  cmp    -0x4c(%rbp),%eax
  jl     L9
  nop
  mov    -0x8(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L78
  call   <__stack_chk_fail@plt>
L78:
  leave
  ret
```

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];
}
```