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

```asm
<keySort>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %esi,-0x3c(%rbp)
  mov    %edx,-0x40(%rbp)
  mov    -0x40(%rbp),%eax
  cltq
  shl    $0x2,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x10(%rbp)
  mov    -0x3c(%rbp),%eax
  cltq
  shl    $0x2,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x8(%rbp)
  movl   $0x0,-0x24(%rbp)
  jmp    L44
L54:
  mov    -0x24(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x10(%rbp),%rax
  add    %rdx,%rax
  movl   $0x0,(%rax)
  addl   $0x1,-0x24(%rbp)
L44:
  mov    -0x24(%rbp),%eax
  cmp    -0x40(%rbp),%eax
  jl     L54
  movl   $0x0,-0x20(%rbp)
  jmp    L26
L93:
  mov    -0x20(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cltq
  add    $0x1,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x10(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  add    $0x1,%edx
  mov    %edx,(%rax)
  addl   $0x1,-0x20(%rbp)
L26:
  mov    -0x20(%rbp),%eax
  cmp    -0x3c(%rbp),%eax
  jl     L93
  movl   $0x0,-0x1c(%rbp)
  jmp    L39
L23:
  mov    -0x1c(%rbp),%eax
  cltq
  add    $0x1,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x10(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%ecx
  mov    -0x1c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x10(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  mov    -0x1c(%rbp),%eax
  cltq
  add    $0x1,%rax
  lea    0x0(,%rax,4),%rsi
  mov    -0x10(%rbp),%rax
  add    %rsi,%rax
  add    %ecx,%edx
  mov    %edx,(%rax)
  addl   $0x1,-0x1c(%rbp)
L39:
  mov    -0x40(%rbp),%eax
  sub    $0x1,%eax
  cmp    %eax,-0x1c(%rbp)
  jl     L23
  movl   $0x0,-0x18(%rbp)
  jmp    L20
L62:
  mov    -0x18(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x38(%rbp),%rax
  lea    (%rdx,%rax,1),%rsi
  mov    -0x18(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x10(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  lea    0x1(%rdx),%ecx
  mov    %ecx,(%rax)
  movslq %edx,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x8(%rbp),%rax
  add    %rax,%rdx
  mov    (%rsi),%eax
  mov    %eax,(%rdx)
  addl   $0x1,-0x18(%rbp)
L20:
  mov    -0x18(%rbp),%eax
  cmp    -0x3c(%rbp),%eax
  jl     L62
  movl   $0x0,-0x14(%rbp)
  jmp    L21
L7:
  mov    -0x14(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  mov    -0x14(%rbp),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,4),%rcx
  mov    -0x38(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rax),%eax
  mov    %eax,(%rdx)
  addl   $0x1,-0x14(%rbp)
L21:
  mov    -0x14(%rbp),%eax
  cmp    -0x3c(%rbp),%eax
  jl     L7
  nop
  nop
  leave
  ret
```

assistant: ```c
void keySort(int *nums, int size, int keySize) {
  int *array = (int *)malloc(sizeof(int) * keySize);
  int *nums1 = (int *)malloc(sizeof(int) * size);
  for (int i = 0; i < keySize; i++)
    array[i] = 0;
  for (int i = 0; i < size; i++)
    array[nums[i] + 1]++;
  for (int i = 0; i < keySize - 1; i++)
    array[i + 1] += array[i];
  for (int i = 0; i < size; i++)
    nums1[array[nums[i]]++] = nums[i];
  for (int i = 0; i < size; i++)
    nums[i] = nums1[i];
}
```