user: What is the c source code of the assembly code below:

```asm
<cntsrtna>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %rdi,%r15
  mov    %esi,0xc(%rsp)
  mov    %edx,%ebx
  mov    %ecx,%r14d
  lea    0x0(,%rcx,4),%r12d
  mov    %r12d,%edi
  call   <malloc@plt>
  mov    %rax,%rbp
  mov    %r12d,%edi
  call   <malloc@plt>
  mov    %rax,%r12
  lea    0x0(,%rbx,4),%eax
  mov    %eax,0x8(%rsp)
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,%r13
  mov    0x8(%rsp),%edi
  call   <malloc@plt>
  mov    %rax,0x10(%rsp)
  mov    0x8(%rsp),%edi
  call   <malloc@plt>
  mov    %rax,0x18(%rsp)
  test   %ebx,%ebx
  jle    L15
  mov    %rax,%rdx
  mov    $0x0,%eax
L53:
  mov    %eax,(%rdx)
  add    $0x1,%eax
  add    $0x4,%rdx
  cmp    %eax,%ebx
  jne    L53
L15:
  mov    0xc(%rsp),%eax
  sub    $0x1,%eax
  mov    %eax,0x8(%rsp)
  js     L21
  imul   %ebx,%eax
  mov    %eax,0xc(%rsp)
  lea    -0x1(%r14),%eax
  lea    0x4(%rbp,%rax,4),%rax
  mov    %rax,0x28(%rsp)
  lea    -0x1(%rbx),%eax
  mov    0x18(%rsp),%rdi
  lea    0x4(%rdi,%rax,4),%rax
  mov    %rax,0x20(%rsp)
  mov    %rdi,%r11
  mov    0x10(%rsp),%rcx
  sub    %rcx,%r11
  mov    %rdi,%r10
  sub    %r13,%r10
  mov    %rbp,%r9
  sub    %r12,%r9
  sub    %rdi,%rcx
  mov    %rcx,%r8
  jmp    L72
L54:
  movl   $0x0,(%r12)
  cmp    $0x1,%r14d
  jle    L110
L19:
  mov    %r12,%rax
  mov    $0x1,%ecx
L154:
  mov    (%rax),%edx
  mov    (%r9,%rax,1),%esi
  add    $0x4,%rax
  add    %esi,%edx
  mov    %edx,(%rax)
  add    $0x1,%ecx
  cmp    %ecx,%r14d
  jg     L154
  test   %ebx,%ebx
  jle    L110
L112:
  mov    0x10(%rsp),%rdx
  mov    $0x0,%ecx
L64:
  movslq (%rdx),%rax
  lea    (%r12,%rax,4),%rsi
  mov    (%rsi),%eax
  lea    0x1(%rax),%edi
  mov    %edi,(%rsi)
  mov    (%r11,%rdx,1),%esi
  cltq
  mov    %esi,0x0(%r13,%rax,4)
  add    $0x1,%ecx
  add    $0x4,%rdx
  cmp    %ecx,%ebx
  jg     L64
  mov    %r13,%rax
  mov    $0x0,%edx
L79:
  mov    (%rax),%ecx
  mov    %ecx,(%r10,%rax,1)
  add    $0x1,%edx
  add    $0x4,%rax
  cmp    %edx,%ebx
  jg     L79
L110:
  subl   $0x1,0x8(%rsp)
  mov    0x8(%rsp),%eax
  sub    %ebx,0xc(%rsp)
  cmp    $0xffffffff,%eax
  je     L21
L72:
  mov    %rbp,%rax
  mov    0x28(%rsp),%rdx
  test   %r14d,%r14d
  jle    L80
L113:
  movl   $0x0,(%rax)
  add    $0x4,%rax
  cmp    %rdx,%rax
  jne    L113
L80:
  test   %ebx,%ebx
  jle    L54
  mov    0xc(%rsp),%ecx
  mov    0x18(%rsp),%rdx
  mov    0x20(%rsp),%rsi
L49:
  mov    %ecx,%eax
  add    (%rdx),%eax
  cltq
  mov    (%r15,%rax,4),%eax
  mov    %eax,(%r8,%rdx,1)
  cltq
  addl   $0x1,0x0(%rbp,%rax,4)
  add    $0x4,%rdx
  cmp    %rsi,%rdx
  jne    L49
  movl   $0x0,(%r12)
  cmp    $0x1,%r14d
  jg     L19
  jmp    L112
L21:
  mov    %r13,%rdi
  call   <free@plt>
  mov    %r12,%rdi
  call   <free@plt>
  mov    %rbp,%rdi
  call   <free@plt>
  mov    0x10(%rsp),%rdi
  call   <free@plt>
  mov    0x18(%rsp),%rax
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
unsigned int *cntsrtna(unsigned int *sx, int k, int r, int na) {
  int *sxc = (int *)malloc(na * sizeof(int));
  int *bc = (int *)malloc(na * sizeof(int));
  int *sxl = (int *)malloc(r * sizeof(int));
  int *cc = (int *)malloc(r * sizeof(int));
  int *regroup = (int *)malloc(r * sizeof(int));
  int i, j;
  for (i = 0; i < r; ++i)
    regroup[i] = i;
  for (j = k - 1; j >= 0; --j) {
    for (i = 0; i < na; ++i)
      sxc[i] = 0;
    for (i = 0; i < r; ++i) {
      cc[i] = sx[regroup[i] + j * r];
      sxc[cc[i]]++;
    }
    bc[0] = 0;
    for (i = 1; i < na; ++i)
      bc[i] = bc[i - 1] + sxc[i - 1];
    for (i = 0; i < r; ++i)
      sxl[bc[cc[i]]++] = regroup[i];
    for (i = 0; i < r; ++i) {
      regroup[i] = sxl[i];
    }
  }
  free(sxl);
  free(bc);
  free(sxc);
  free(cc);
  return regroup;
}
```