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

```asm
<rxsort>:
  endbr64
  push   %r15
  push   %r14
  mov    %rdi,%r14
  lea    0x0(,%rcx,4),%edi
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %ecx,%ebx
  sub    $0x28,%rsp
  mov    %esi,0x4(%rsp)
  mov    %edx,0x8(%rsp)
  call   <malloc@plt>
  test   %rax,%rax
  je     L134
  mov    0x4(%rsp),%ebp
  mov    %rax,%r15
  lea    0x0(,%rbp,4),%eax
  mov    %eax,%edi
  mov    %eax,0xc(%rsp)
  call   <malloc@plt>
  mov    %rax,%r13
  test   %rax,%rax
  je     L134
  mov    0x8(%rsp),%ecx
  test   %ecx,%ecx
  jle    L83
  pxor   %xmm2,%xmm2
  lea    -0x1(%rbx),%eax
  cvtsi2sd %ebx,%xmm2
  lea    0x4(,%rax,4),%rax
  mov    %rax,0x18(%rsp)
  lea    -0x1(%rbp),%eax
  xor    %ebp,%ebp
  mov    %eax,(%rsp)
  lea    0x4(%r14,%rax,4),%r12
  mov    %r13,%rax
  mov    %r15,%r13
  mov    %rax,%r15
  movsd  %xmm2,0x10(%rsp)
  nopl   0x0(%rax)
L95:
  test   %ebx,%ebx
  jle    L0
  mov    0x18(%rsp),%rdx
  xor    %esi,%esi
  mov    %r13,%rdi
  call   <memset@plt>
L0:
  pxor   %xmm1,%xmm1
  movsd  0x10(%rsp),%xmm0
  cvtsi2sd %ebp,%xmm1
  call   <pow@plt>
  mov    0x4(%rsp),%edx
  mov    %eax,%ecx
  test   %edx,%edx
  jle    L36
  mov    %r14,%rsi
  nopw   0x0(%rax,%rax,1)
L1:
  mov    (%rsi),%eax
  add    $0x4,%rsi
  cltd
  idiv   %ecx
  cltd
  idiv   %ebx
  movslq %edx,%rdx
  addl   $0x1,0x0(%r13,%rdx,4)
  cmp    %rsi,%r12
  jne    L1
  cmp    $0x1,%ebx
  jle    L58
L114:
  lea    0x4(%r13),%rax
  mov    $0x1,%edx
  nopl   0x0(%rax,%rax,1)
L88:
  add    $0x1,%edx
  mov    -0x4(%rax),%esi
  add    %esi,(%rax)
  add    $0x4,%rax
  cmp    %edx,%ebx
  jg     L88
  mov    (%rsp),%eax
  test   %eax,%eax
  js     L51
L58:
  movslq (%rsp),%rsi
  nopl   0x0(%rax,%rax,1)
L2:
  mov    (%r14,%rsi,4),%edi
  sub    $0x1,%rsi
  mov    %edi,%eax
  cltd
  idiv   %ecx
  cltd
  idiv   %ebx
  movslq %edx,%rdx
  lea    0x0(%r13,%rdx,4),%rax
  movslq (%rax),%rdx
  mov    %edi,-0x4(%r15,%rdx,4)
  subl   $0x1,(%rax)
  test   %esi,%esi
  jns    L2
L51:
  mov    0xc(%rsp),%edx
  mov    %r15,%rsi
  mov    %r14,%rdi
  add    $0x1,%ebp
  call   <memcpy@plt>
  cmp    %ebp,0x8(%rsp)
  jne    L95
  mov    %r15,%rax
  mov    %r13,%r15
  mov    %rax,%r13
L83:
  mov    %r15,%rdi
  call   <free@plt>
  mov    %r13,%rdi
  call   <free@plt>
  xor    %eax,%eax
L113:
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   (%rax)
L36:
  cmp    $0x1,%ebx
  jg     L114
  jmp    L51
L134:
  mov    $0xffffffff,%eax
  jmp    L113
```

assistant: ```c
int rxsort(int *data, int size, int p, int k) {
  int *counts, *temp;
  int index, pval, i, j, n;
  if ((counts = (int *)malloc(k * sizeof(int))) == NULL)
    return -1;
  if ((temp = (int *)malloc(size * sizeof(int))) == NULL)
    return -1;
  for (n = 0; n < p; n++) {
    for (i = 0; i < k; i++)
      counts[i] = 0;
    pval = (int)pow((double)k, (double)n);
    for (j = 0; j < size; j++) {
      index = (int)(data[j] / pval) % k;
      counts[index] = counts[index] + 1;
    }
    for (i = 1; i < k; i++)
      counts[i] = counts[i] + counts[i - 1];
    for (j = size - 1; j >= 0; j--) {
      index = (int)(data[j] / pval) % k;
      temp[counts[index] - 1] = data[j];
      counts[index] = counts[index] - 1;
    }
    memcpy(data, temp, size * sizeof(int));
  }
  free(counts);
  free(temp);
  return 0;
}
```