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

```asm
<cbssort>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %esi,-0x2c(%rbp)
  mov    %edx,-0x30(%rbp)
  mov    %rcx,-0x38(%rbp)
  cmpq   $0x0,-0x28(%rbp)
  je     L129
  cmpl   $0x0,-0x2c(%rbp)
  js     L129
  cmpl   $0x0,-0x30(%rbp)
  jle    L129
  cmpq   $0x0,-0x38(%rbp)
  je     L129
  mov    $0x1,%eax
  jmp    L88
L129:
  mov    $0x0,%eax
L88:
  mov    %eax,%edi
  call   <assert@plt>
  mov    -0x28(%rbp),%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x30(%rbp),%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x8(%rbp)
  cmpq   $0x0,-0x8(%rbp)
  jne    L117
  lea    D1(%rip),%rax
  mov    %rax,%rdi
  call   <cbmyfatal@plt>
L117:
  mov    -0x2c(%rbp),%eax
  sub    $0x1,%eax
  movslq %eax,%rdx
  imul   $0x55555556,%rdx,%rdx
  shr    $0x20,%rdx
  sar    $0x1f,%eax
  mov    %eax,%ecx
  mov    %edx,%eax
  sub    %ecx,%eax
  mov    %eax,-0x20(%rbp)
  jmp    L103
L150:
  cmpl   $0x4,-0x20(%rbp)
  jg     L37
  movl   $0x1,-0x20(%rbp)
L37:
  movl   $0x0,-0x1c(%rbp)
  jmp    L85
L98:
  mov    -0x1c(%rbp),%edx
  mov    -0x20(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x18(%rbp)
  jmp    L173
L191:
  mov    -0x18(%rbp),%eax
  imul   -0x30(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x10(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x18(%rbp),%eax
  sub    -0x20(%rbp),%eax
  imul   -0x30(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x10(%rbp),%rax
  add    %rax,%rdx
  mov    -0x38(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rdx,%rdi
  call   *%rax
  test   %eax,%eax
  jle    L82
  mov    -0x18(%rbp),%eax
  imul   -0x30(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x10(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x30(%rbp),%edx
  mov    -0x8(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  mov    -0x18(%rbp),%eax
  mov    %eax,-0x14(%rbp)
  jmp    L142
L15:
  mov    -0x14(%rbp),%eax
  sub    -0x20(%rbp),%eax
  imul   -0x30(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x10(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x8(%rbp),%rax
  mov    -0x38(%rbp),%rdx
  mov    %rax,%rsi
  mov    %rcx,%rdi
  call   *%rdx
  test   %eax,%eax
  js     L119
  mov    -0x14(%rbp),%eax
  sub    -0x20(%rbp),%eax
  imul   -0x30(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x10(%rbp),%rax
  lea    (%rdx,%rax,1),%rsi
  mov    -0x14(%rbp),%eax
  imul   -0x30(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x10(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x30(%rbp),%eax
  mov    %eax,%edx
  mov    %rcx,%rdi
  call   <memcpy@plt>
  mov    -0x20(%rbp),%eax
  sub    %eax,-0x14(%rbp)
L142:
  mov    -0x20(%rbp),%eax
  cmp    -0x14(%rbp),%eax
  jle    L15
  jmp    L41
L119:
  nop
L41:
  mov    -0x14(%rbp),%eax
  imul   -0x30(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x10(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x30(%rbp),%edx
  mov    -0x8(%rbp),%rax
  mov    %rax,%rsi
  mov    %rcx,%rdi
  call   <memcpy@plt>
L82:
  mov    -0x20(%rbp),%eax
  add    %eax,-0x18(%rbp)
L173:
  mov    -0x18(%rbp),%eax
  cmp    -0x2c(%rbp),%eax
  jl     L191
  addl   $0x1,-0x1c(%rbp)
L85:
  mov    -0x1c(%rbp),%eax
  cmp    -0x20(%rbp),%eax
  jl     L98
  cmpl   $0x1,-0x20(%rbp)
  jle    L2
  mov    -0x20(%rbp),%eax
  sub    $0x1,%eax
  movslq %eax,%rdx
  imul   $0x55555556,%rdx,%rdx
  shr    $0x20,%rdx
  sar    $0x1f,%eax
  mov    %eax,%ecx
  mov    %edx,%eax
  sub    %ecx,%eax
  mov    %eax,-0x20(%rbp)
L103:
  cmpl   $0x0,-0x20(%rbp)
  jns    L150
  jmp    L3
L2:
  nop
L3:
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  nop
  leave
  ret
```

tool_calls: name: unpack_data
arguments: label: D1
datatype: string

tool: D1: out of memory

assistant: ```c
void cbssort(void *base, int nmemb, int size, int (*compar)(const void *, const void *)) {
  char *bp, *swap;
  int step, bottom, i, j;
  assert(base && nmemb >= 0 && size > 0 && compar);
  bp = (char *)base;
  (((swap) = malloc(size)) ? (swap) : cbmyfatal("out of memory"));
  for (step = (nmemb - 1) / 3; step >= 0; step = (step - 1) / 3) {
    if (step < 5)
      step = 1;
    for (bottom = 0; bottom < step; bottom++) {
      for (i = bottom + step; i < nmemb; i += step) {
        if (compar(bp + (i - step) * size, bp + i * size) > 0) {
          memcpy(swap, bp + i * size, size);
          for (j = i; j > step - 1; j -= step) {
            if (compar(bp + (j - step) * size, swap) < 0)
              break;
            memcpy(bp + j * size, bp + (j - step) * size, size);
          }
          memcpy(bp + j * size, swap, size);
        }
      }
    }
    if (step < 2)
      break;
  }
  free(swap);
}
```