user: 请将以下的汇编代码转换成C语言代码:

```asm
<cntsrtna>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  lea    0x0(,%rcx,4),%r13d
  push   %r12
  mov    %ecx,%r12d
  push   %rbp
  push   %rbx
  mov    %edx,%ebx
  lea    0x0(,%rbx,4),%r14d
  sub    $0x98,%rsp
  mov    %rdi,0x10(%rsp)
  mov    %r13d,%edi
  mov    %esi,0x38(%rsp)
  call   <malloc@plt>
  mov    %r13d,%edi
  mov    %rax,%rbp
  call   <malloc@plt>
  mov    %r14d,%edi
  mov    %rax,%r13
  call   <malloc@plt>
  mov    %r14d,%edi
  mov    %rax,%r15
  call   <malloc@plt>
  mov    %r14d,%edi
  mov    %rax,0x8(%rsp)
  call   <malloc@plt>
  test   %ebx,%ebx
  mov    0x10(%rsp),%r8
  mov    %rax,0x28(%rsp)
  jle    L65
  mov    %rax,%rcx
  lea    -0x1(%rbx),%eax
  cmp    $0x2,%eax
  jbe    L189
  mov    %ebx,%edx
  movdqa D6(%rip),%xmm0
  movdqa D5(%rip),%xmm2
  mov    %rcx,%rax
  shr    $0x2,%edx
  shl    $0x4,%rdx
  add    %rcx,%rdx
  nopl   (%rax)
L177:
  movdqa %xmm0,%xmm1
  add    $0x10,%rax
  paddd  %xmm2,%xmm0
  movups %xmm1,-0x10(%rax)
  cmp    %rdx,%rax
  jne    L177
  mov    %ebx,%eax
  and    $0xfffffffc,%eax
  test   $0x3,%bl
  je     L65
L101:
  mov    0x28(%rsp),%rdi
  movslq %eax,%rdx
  lea    0x0(,%rdx,4),%rcx
  mov    %eax,(%rdi,%rdx,4)
  lea    0x1(%rax),%edx
  cmp    %edx,%ebx
  jle    L65
  add    $0x2,%eax
  mov    %edx,0x4(%rdi,%rcx,1)
  cmp    %eax,%ebx
  jle    L65
  mov    %eax,0x8(%rdi,%rcx,1)
L65:
  mov    0x38(%rsp),%eax
  sub    $0x1,%eax
  mov    %eax,0x38(%rsp)
  js     L64
  mov    %eax,%r14d
  lea    -0x1(%r12),%eax
  mov    0x28(%rsp),%rcx
  lea    0x4(%r15),%rdx
  imul   %ebx,%r14d
  lea    0x4(,%rax,4),%rax
  mov    %rax,0x30(%rsp)
  lea    -0x1(%rbx),%eax
  mov    %rcx,%r9
  lea    0x4(%rcx,%rax,4),%r10
  mov    %rcx,%rax
  sub    %rdx,%rax
  cmp    $0x8,%rax
  seta   %dl
  cmp    $0x3,%ebx
  setg   %al
  and    %eax,%edx
  test   %ebx,%ebx
  mov    $0x1,%eax
  cmovg  %ebx,%eax
  mov    %dl,0x3f(%rsp)
  sub    0x8(%rsp),%r9
  mov    %eax,%edi
  mov    %eax,0x54(%rsp)
  shr    $0x2,%eax
  sub    $0x1,%eax
  and    $0xfffffffc,%edi
  add    $0x1,%rax
  mov    %edi,0x50(%rsp)
  shl    $0x4,%rax
  add    %r15,%rax
  mov    %rax,0x48(%rsp)
  movslq %edi,%rax
  shl    $0x2,%rax
  lea    (%r15,%rax,1),%rsi
  add    %rcx,%rax
  mov    %rax,0x60(%rsp)
  lea    0x1(%rdi),%eax
  mov    %eax,0x78(%rsp)
  cltq
  shl    $0x2,%rax
  mov    %rsi,0x58(%rsp)
  lea    (%r15,%rax,1),%rsi
  add    %rcx,%rax
  mov    %rax,0x70(%rsp)
  lea    0x2(%rdi),%eax
  mov    %eax,0x7c(%rsp)
  cltq
  shl    $0x2,%rax
  mov    %rsi,0x68(%rsp)
  lea    (%r15,%rax,1),%rdi
  add    %rcx,%rax
  sub    %r15,%rcx
  mov    %rax,0x80(%rsp)
  mov    %rcx,0x40(%rsp)
  lea    0x4(%r13),%rcx
  mov    %rdi,0x88(%rsp)
  sub    %rbp,%rcx
  mov    %rbp,%rdi
  mov    %r10,%rbp
  nopl   0x0(%rax,%rax,1)
L169:
  test   %r12d,%r12d
  jle    L73
  mov    0x30(%rsp),%rdx
  xor    %esi,%esi
  mov    %rcx,0x20(%rsp)
  mov    %r9,0x18(%rsp)
  mov    %r8,0x10(%rsp)
  call   <memset@plt>
  mov    0x20(%rsp),%rcx
  mov    0x18(%rsp),%r9
  mov    0x10(%rsp),%r8
  mov    %rax,%rdi
L73:
  test   %ebx,%ebx
  jle    L61
  mov    0x28(%rsp),%rax
  mov    0x8(%rsp),%rsi
  mov    %rax,%rdx
  sub    %rax,%rsi
  nopw   0x0(%rax,%rax,1)
L145:
  mov    (%rdx),%eax
  add    %r14d,%eax
  cltq
  movslq (%r8,%rax,4),%rax
  mov    %eax,(%rsi,%rdx,1)
  add    $0x4,%rdx
  addl   $0x1,(%rdi,%rax,4)
  cmp    %rbp,%rdx
  jne    L145
  movl   $0x0,0x0(%r13)
  cmp    $0x1,%r12d
  jle    L137
L57:
  mov    0x0(%r13),%esi
  mov    %rdi,%rax
  mov    $0x1,%edx
  nopl   (%rax)
L123:
  add    (%rax),%esi
  add    $0x1,%edx
  mov    %esi,(%rcx,%rax,1)
  add    $0x4,%rax
  cmp    %edx,%r12d
  jg     L123
  test   %ebx,%ebx
  jle    L70
L137:
  mov    0x8(%rsp),%rdx
  xor    %esi,%esi
  nopl   0x0(%rax,%rax,1)
L18:
  movslq (%rdx),%rax
  add    $0x1,%esi
  lea    0x0(%r13,%rax,4),%r10
  movslq (%r10),%rax
  lea    0x1(%rax),%r11d
  mov    %r11d,(%r10)
  mov    (%r9,%rdx,1),%r10d
  add    $0x4,%rdx
  mov    %r10d,(%r15,%rax,4)
  cmp    %esi,%ebx
  jg     L18
  cmpb   $0x0,0x3f(%rsp)
  mov    %r15,%rax
  je     L163
  mov    0x48(%rsp),%rdx
  mov    0x40(%rsp),%rsi
  nopl   (%rax)
L130:
  movdqu (%rax),%xmm3
  movups %xmm3,(%rsi,%rax,1)
  add    $0x10,%rax
  cmp    %rax,%rdx
  jne    L130
  mov    0x54(%rsp),%esi
  cmp    %esi,0x50(%rsp)
  je     L70
  mov    0x58(%rsp),%rax
  mov    0x60(%rsp),%rsi
  mov    (%rax),%eax
  mov    %eax,(%rsi)
  cmp    0x78(%rsp),%ebx
  jle    L70
  mov    0x68(%rsp),%rax
  mov    0x70(%rsp),%rsi
  mov    (%rax),%eax
  mov    %eax,(%rsi)
  cmp    0x7c(%rsp),%ebx
  jle    L70
  mov    0x88(%rsp),%rax
  mov    0x80(%rsp),%rsi
  mov    (%rax),%eax
  mov    %eax,(%rsi)
L70:
  subl   $0x1,0x38(%rsp)
  mov    0x38(%rsp),%eax
  sub    %ebx,%r14d
  cmp    $0xffffffff,%eax
  jne    L169
  mov    %rdi,%rbp
L64:
  mov    %r15,%rdi
  call   <free@plt>
  mov    %r13,%rdi
  call   <free@plt>
  mov    %rbp,%rdi
  call   <free@plt>
  mov    0x8(%rsp),%rdi
  call   <free@plt>
  mov    0x28(%rsp),%rax
  add    $0x98,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax,%rax,1)
L163:
  mov    0x40(%rsp),%r10
  xor    %edx,%edx
  nopw   0x0(%rax,%rax,1)
L31:
  mov    (%rax),%esi
  add    $0x1,%edx
  mov    %esi,(%r10,%rax,1)
  add    $0x4,%rax
  cmp    %edx,%ebx
  jg     L31
  jmp    L70
  nopl   0x0(%rax,%rax,1)
L61:
  movl   $0x0,0x0(%r13)
  cmp    $0x1,%r12d
  jg     L57
  jmp    L70
L189:
  xor    %eax,%eax
  jmp    L101
```

tool_calls: name: read_data
arguments: data_label: D6
type_guessed: byte[16]
name: read_data
arguments: data_label: D5
type_guessed: byte[16]

tool: {"D6": [0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x03,0x00,0x00,0x00]}

tool: {"D5": [0x04,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x04,0x00,0x00,0x00]}

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