user: 这段汇编代码用C语言表示是什么样的?

```asm
<heapsort>:
  endbr64
  push   %r15
  xor    %eax,%eax
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x58,%rsp
  mov    %rdi,0x40(%rsp)
  cmp    $0x1,%rsi
  jbe    L105
  mov    %rdx,%r12
  test   %rdx,%rdx
  je     L42
  mov    %rdx,%rdi
  mov    %rsi,%r13
  mov    %rcx,%r14
  call   <malloc@plt>
  mov    %rax,0x10(%rsp)
  test   %rax,%rax
  je     L0
  mov    %r13,%rax
  mov    0x40(%rsp),%rbp
  mov    %r14,0x8(%rsp)
  shr    %rax
  mov    %rax,0x20(%rsp)
  sub    %r12,%rbp
  nopl   0x0(%rax,%rax,1)
L244:
  mov    0x20(%rsp),%r15
  lea    (%r15,%r15,1),%rax
  cmp    %rax,%r13
  jb     L233
  nopw   0x0(%rax,%rax,1)
L114:
  mov    %r12,%rbx
  mov    %rax,%r14
  imul   %rax,%rbx
  add    %rbp,%rbx
  cmp    %rax,%r13
  jbe    L44
  lea    (%rbx,%r12,1),%rdx
  mov    0x8(%rsp),%rax
  mov    %rbx,%rdi
  mov    %rdx,0x18(%rsp)
  mov    %rdx,%rsi
  call   *%rax
  test   %eax,%eax
  jns    L44
  mov    0x18(%rsp),%rbx
  add    $0x1,%r14
L44:
  imul   %r12,%r15
  mov    0x8(%rsp),%rax
  mov    %rbx,%rdi
  add    %rbp,%r15
  mov    %r15,%rsi
  call   *%rax
  test   %eax,%eax
  jle    L233
  lea    (%rbx,%r12,1),%rsi
  nopl   0x0(%rax)
L15:
  movzbl (%r15),%eax
  movzbl (%rbx),%edx
  add    $0x1,%rbx
  add    $0x1,%r15
  mov    %dl,-0x1(%r15)
  mov    %al,-0x1(%rbx)
  cmp    %rbx,%rsi
  jne    L15
  lea    (%r14,%r14,1),%rax
  cmp    %rax,%r13
  jb     L233
  mov    %r14,%r15
  jmp    L114
  nopl   0x0(%rax)
L233:
  subq   $0x1,0x20(%rsp)
  jne    L244
  mov    %r13,%rax
  mov    %r13,0x30(%rsp)
  mov    %rbp,%r14
  imul   %r12,%rax
  mov    %r12,0x48(%rsp)
  add    %rbp,%rax
  mov    %rax,0x38(%rsp)
L18:
  mov    0x48(%rsp),%r15
  mov    0x38(%rsp),%rbx
  xor    %r13d,%r13d
  mov    0x10(%rsp),%rdi
  mov    %r15,%rdx
  mov    %rbx,%rsi
  call   <memcpy@plt>
  mov    0x40(%rsp),%rbp
  mov    %rbx,%rdx
  mov    %r15,%rcx
  nopl   0x0(%rax,%rax,1)
L36:
  movzbl 0x0(%rbp,%r13,1),%eax
  mov    %r13,%rbx
  mov    %al,(%rdx,%r13,1)
  add    $0x1,%r13
  cmp    %r13,%rcx
  jne    L36
  subq   $0x1,0x30(%rsp)
  mov    0x30(%rsp),%r12
  cmp    $0x1,%r12
  je     L151
  mov    $0x2,%r9d
  mov    $0x1,%r15d
  mov    %r9,%rbp
  nopw   0x0(%rax,%rax,1)
L221:
  mov    %r13,%rdx
  imul   %rbp,%rdx
  mov    %rdx,0x18(%rsp)
  lea    (%r14,%rdx,1),%rdi
  cmp    %rbp,%r12
  jbe    L229
  lea    (%rdi,%r13,1),%rcx
  mov    %rdi,0x20(%rsp)
  mov    0x8(%rsp),%rax
  mov    %rcx,0x28(%rsp)
  mov    %rcx,%rsi
  call   *%rax
  mov    0x20(%rsp),%rdi
  mov    %eax,%r11d
  mov    %rbp,%rax
  mov    %rdi,%r10
  test   %r11d,%r11d
  jns    L240
  mov    0x18(%rsp),%rdx
  mov    0x28(%rsp),%rdi
  add    $0x1,%rax
  add    %r13,%rdx
  lea    (%r14,%rdx,1),%r10
L240:
  mov    %r15,%rsi
  xor    %edx,%edx
  imul   %r13,%rsi
  add    %r14,%rsi
  nopl   0x0(%rax)
L41:
  movzbl (%rdi,%rdx,1),%ecx
  mov    %cl,(%rsi,%rdx,1)
  mov    %rdx,%rcx
  add    $0x1,%rdx
  cmp    %rbx,%rcx
  jne    L41
  lea    (%rax,%rax,1),%rbp
  cmp    %rbp,%r12
  jb     L27
  mov    %rax,%r15
  jmp    L221
  nopl   0x0(%rax)
L229:
  mov    %rdi,%r10
  mov    %rbp,%rax
  jmp    L240
  nopl   0x0(%rax,%rax,1)
L27:
  mov    %rax,%r15
  mov    %r10,%r12
  shr    %r15
  mov    %r15,%rcx
  imul   %r13,%rcx
  add    %r14,%rcx
  cmp    $0x1,%rax
  je     L195
  mov    %r15,%rbp
  mov    %rcx,%r12
  mov    %rbx,%r15
  mov    %r14,%rbx
  mov    %r10,%r14
  nopl   0x0(%rax,%rax,1)
L123:
  mov    0x10(%rsp),%rdi
  mov    0x8(%rsp),%rax
  mov    %r12,%rsi
  call   *%rax
  test   %eax,%eax
  js     L183
  xor    %eax,%eax
  nopl   (%rax)
L39:
  movzbl (%r12,%rax,1),%edx
  mov    %dl,(%r14,%rax,1)
  mov    %rax,%rdx
  add    $0x1,%rax
  cmp    %r15,%rdx
  jne    L39
  mov    %rbp,%rax
  mov    %r13,%r14
  shr    %rax
  imul   %rbp,%r14
  mov    %rax,%r12
  imul   %r13,%r12
  add    %rbx,%r14
  add    %rbx,%r12
  cmp    $0x1,%rbp
  je     L183
  mov    %rax,%rbp
  jmp    L123
  nopw   0x0(%rax,%rax,1)
L183:
  mov    %r14,%r12
  mov    %rbx,%r14
L195:
  mov    0x10(%rsp),%rsi
  mov    %r13,%rdx
  mov    %r12,%rdi
  call   <memcpy@plt>
  sub    %r13,0x38(%rsp)
  jmp    L18
L151:
  mov    0x10(%rsp),%rbx
  mov    0x48(%rsp),%rdx
  mov    0x40(%rsp),%rdi
  mov    %rbx,%rsi
  call   <memcpy@plt>
  mov    %rbx,%rdi
  call   <free@plt>
  xor    %eax,%eax
L105:
  add    $0x58,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L42:
  mov    D14(%rip),%rax
  mov    (%rax),%edx
  mov    D3(%rip),%rax
  mov    %edx,(%rax)
  mov    $0xffffffff,%eax
  jmp    L105
L0:
  or     $0xffffffff,%eax
  jmp    L105
```

assistant: ```c
int heapsort(void *vbase, size_t nmemb, size_t size, int (*compar)(const void *, const void *)) {
  size_t cnt, i, j, l;
  char tmp, *tmp1, *tmp2;
  char *base, *k, *p, *t;
  if (nmemb <= 1)
    return (0);
  if (!size) {
    errno = EINVAL;
    return (-1);
  }
  if ((k = malloc(size)) == NULL)
    return (-1);
  base = (char *)vbase - size;
  for (l = nmemb / 2 + 1; --l;) {
    for (i = l; (j = i * 2) <= nmemb; i = j) {
      p = base + j * size;
      if (j < nmemb && compar(p, p + size) < 0) {
        p += size;
        ++j;
      }
      t = base + i * size;
      if (compar(p, t) <= 0)
        break;
      {
        cnt = size;
        do {
          tmp = *t;
          *t++ = *p;
          *p++ = tmp;
        } while (--cnt);
      };
    }
  };
  while (nmemb > 1) {
    {
      cnt = size;
      tmp1 = k;
      tmp2 = base + nmemb * size;
      do {
        *tmp1++ = *tmp2++;
      } while (--cnt);
    };
    {
      cnt = size;
      tmp1 = base + nmemb * size;
      tmp2 = base + size;
      do {
        *tmp1++ = *tmp2++;
      } while (--cnt);
    };
    --nmemb;
    {
      for (i = 1; (j = i * 2) <= nmemb; i = j) {
        p = base + j * size;
        if (j < nmemb && compar(p, p + size) < 0) {
          p += size;
          ++j;
        }
        t = base + i * size;
        {
          cnt = size;
          tmp1 = t;
          tmp2 = p;
          do {
            *tmp1++ = *tmp2++;
          } while (--cnt);
        };
      }
      for (;;) {
        j = i;
        i = j / 2;
        p = base + j * size;
        t = base + i * size;
        if (j == 1 || compar(k, t) < 0) {
          {
            cnt = size;
            tmp1 = p;
            tmp2 = k;
            do {
              *tmp1++ = *tmp2++;
            } while (--cnt);
          };
          break;
        }
        {
          cnt = size;
          tmp1 = p;
          tmp2 = t;
          do {
            *tmp1++ = *tmp2++;
          } while (--cnt);
        };
      }
    };
  }
  free(k);
  return (0);
}
```