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

```asm
<rxsort>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %rdi,%r12
  mov    %esi,%r14d
  mov    %esi,0x10(%rsp)
  mov    %edx,%r15d
  mov    %edx,0x14(%rsp)
  mov    %ecx,%ebx
  lea    0x0(,%rcx,4),%edi
  call   <malloc@plt>
  test   %rax,%rax
  je     L169
  mov    %rax,%rbp
  lea    0x0(,%r14,4),%eax
  mov    %eax,0x18(%rsp)
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,%r13
  test   %rax,%rax
  je     L47
  test   %r15d,%r15d
  jle    L139
  lea    -0x1(%rbx),%eax
  lea    0x4(%rbp,%rax,4),%r15
  mov    %r14d,%edi
  lea    -0x1(%r14),%eax
  lea    0x4(%r12,%rax,4),%r14
  movl   $0x0,0xc(%rsp)
  lea    -0x1(%rdi),%eax
  mov    %eax,0x1c(%rsp)
  jmp    L30
L12:
  cmp    $0x1,%ebx
  jle    L72
L92:
  lea    0x4(%rbp),%rax
  mov    $0x1,%edx
L83:
  mov    -0x4(%rax),%esi
  add    %esi,(%rax)
  add    $0x1,%edx
  add    $0x4,%rax
  cmp    %edx,%ebx
  jg     L83
  mov    0x1c(%rsp),%eax
  mov    %eax,%esi
  test   %eax,%eax
  js     L72
L44:
  movslq %esi,%rsi
L128:
  mov    (%r12,%rsi,4),%edi
  mov    %edi,%eax
  cltd
  idiv   %ecx
  cltd
  idiv   %ebx
  movslq %edx,%rdx
  lea    0x0(%rbp,%rdx,4),%rax
  movslq (%rax),%rdx
  mov    %edi,-0x4(%r13,%rdx,4)
  subl   $0x1,(%rax)
  sub    $0x1,%rsi
  test   %esi,%esi
  jns    L128
L72:
  mov    0x18(%rsp),%edx
  mov    %r13,%rsi
  mov    %r12,%rdi
  call   <memcpy@plt>
  addl   $0x1,0xc(%rsp)
  mov    0xc(%rsp),%eax
  cmp    %eax,0x14(%rsp)
  je     L139
L30:
  mov    %rbp,%rax
  test   %ebx,%ebx
  jle    L156
L136:
  movl   $0x0,(%rax)
  add    $0x4,%rax
  cmp    %r15,%rax
  jne    L136
L156:
  pxor   %xmm0,%xmm0
  cvtsi2sd %ebx,%xmm0
  pxor   %xmm1,%xmm1
  cvtsi2sdl 0xc(%rsp),%xmm1
  call   <pow@plt>
  mov    %eax,%ecx
  cmpl   $0x0,0x10(%rsp)
  jle    L12
  mov    %r12,%rsi
L75:
  mov    (%rsi),%eax
  cltd
  idiv   %ecx
  cltd
  idiv   %ebx
  movslq %edx,%rdx
  addl   $0x1,0x0(%rbp,%rdx,4)
  add    $0x4,%rsi
  cmp    %r14,%rsi
  jne    L75
  cmp    $0x1,%ebx
  jg     L92
  mov    0x1c(%rsp),%esi
  jmp    L44
L139:
  mov    %rbp,%rdi
  call   <free@plt>
  mov    %r13,%rdi
  call   <free@plt>
  mov    $0x0,%eax
L38:
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L169:
  mov    $0xffffffff,%eax
  jmp    L38
L47:
  mov    $0xffffffff,%eax
  jmp    L38
```

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