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

```asm
<tcbwtsortstrheap>:
  endbr64
  push   %r15
  mov    %esi,%r15d
  push   %r14
  push   %r13
  push   %r12
  mov    %ecx,%r12d
  push   %rbp
  mov    %rdi,%rbp
  mov    %esi,%edi
  push   %rbx
  or     %edx,%edi
  mov    %edx,%ebx
  not    %edi
  shr    $0x1f,%edi
  sub    $0x18,%rsp
  test   %rbp,%rbp
  setne  %al
  mov    %esi,0xc(%rsp)
  and    %eax,%edi
  call   <assert@plt>
  lea    -0x1(%r15),%r11d
  mov    %r11d,%r13d
  sar    %r13d
  lea    0x1(%r13),%eax
  mov    %eax,0x4(%rsp)
  test   %eax,%eax
  jle    L3
  add    %r13d,%r13d
  movslq %r12d,%r14
  nopw   0x0(%rax,%rax,1)
L69:
  subl   $0x1,0x4(%rsp)
  mov    0x4(%rsp),%eax
  mov    %r13d,%r8d
  movslq %eax,%r9
  cmp    %r13d,%r11d
  jl     L89
  nopl   0x0(%rax)
L167:
  movslq %r8d,%rax
  shl    $0x3,%rax
  lea    0x0(%rbp,%rax,1),%r10
  mov    (%r10),%rsi
  cmp    %r8d,%r11d
  jg     L198
  lea    0x0(%rbp,%r9,8),%r15
  mov    (%r15),%rdi
  cmp    %r12d,%ebx
  jle    L89
  movslq %r8d,%r9
L63:
  mov    %r14,%rax
  jmp    L196
  nopl   (%rax)
L84:
  add    $0x1,%rax
  cmp    %eax,%ebx
  jle    L89
L196:
  movzbl (%rdi,%rax,1),%edx
  movzbl (%rsi,%rax,1),%ecx
  cmp    %cl,%dl
  je     L84
  cmp    %dl,%cl
  jbe    L89
  add    %r8d,%r8d
  mov    %rsi,(%r15)
  mov    %rdi,(%r10)
  cmp    %r8d,%r11d
  jge    L167
  xchg   %ax,%ax
L89:
  mov    0x4(%rsp),%eax
  sub    $0x2,%r13d
  test   %eax,%eax
  jne    L69
L3:
  test   %r11d,%r11d
  jle    L275
  mov    0x4(%rsp),%eax
  movslq %ebx,%r12
  add    %eax,%eax
  mov    %eax,0x8(%rsp)
  movslq 0xc(%rsp),%rax
  lea    -0x2(%rax),%edx
  sub    $0x3,%rax
  movslq %edx,%r11
  mov    %edx,%edx
  sub    %rdx,%rax
  mov    %rax,%r15
  nopl   0x0(%rax)
L202:
  mov    0x0(%rbp),%rax
  mov    0x8(%rbp,%r11,8),%rdx
  mov    %r11d,%r13d
  mov    0x8(%rsp),%r8d
  movslq 0x4(%rsp),%r9
  mov    %rdx,0x0(%rbp)
  mov    %rax,0x8(%rbp,%r11,8)
  nop
L37:
  movslq %r8d,%rax
  shl    $0x3,%rax
  lea    0x0(%rbp,%rax,1),%r10
  mov    (%r10),%rsi
  cmp    %r11d,%r8d
  jl     L270
  lea    0x0(%rbp,%r9,8),%r14
  mov    (%r14),%rdi
  test   %ebx,%ebx
  jle    L17
  movslq %r8d,%r9
L152:
  xor    %eax,%eax
  jmp    L194
  nopl   0x0(%rax,%rax,1)
L308:
  add    $0x1,%rax
  cmp    %eax,%ebx
  jle    L17
L194:
  movzbl (%rdi,%rax,1),%edx
  movzbl (%rsi,%rax,1),%ecx
  cmp    %cl,%dl
  je     L308
  cmp    %dl,%cl
  jbe    L17
  add    %r8d,%r8d
  mov    %rsi,(%r14)
  mov    %rdi,(%r10)
  cmp    %r13d,%r8d
  jle    L37
  cs nopw 0x0(%rax,%rax,1)
L17:
  sub    $0x1,%r11
  cmp    %r11,%r15
  jne    L202
L275:
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L198:
  lea    0x8(%rbp,%rax,1),%r15
  mov    (%r15),%rdi
  cmp    %r12d,%ebx
  jle    L89
  mov    %r14,%rax
  jmp    L103
  cs nopw 0x0(%rax,%rax,1)
L169:
  add    $0x1,%rax
  cmp    %eax,%ebx
  jle    L44
L103:
  movzbl (%rdi,%rax,1),%edx
  movzbl (%rsi,%rax,1),%ecx
  cmp    %cl,%dl
  je     L169
  cmp    %dl,%cl
  jae    L44
  add    $0x1,%r8d
  mov    %rdi,%rsi
  mov    %r15,%r10
L44:
  lea    0x0(%rbp,%r9,8),%r15
  movslq %r8d,%r9
  mov    (%r15),%rdi
  jmp    L63
  nopw   0x0(%rax,%rax,1)
L270:
  lea    0x8(%rbp,%rax,1),%r14
  mov    (%r14),%rdi
  test   %ebx,%ebx
  jle    L17
  xor    %eax,%eax
  jmp    L115
  nopl   0x0(%rax)
L208:
  add    $0x1,%rax
  cmp    %rax,%r12
  je     L203
L115:
  movzbl (%rdi,%rax,1),%edx
  movzbl (%rsi,%rax,1),%ecx
  cmp    %cl,%dl
  je     L208
  cmp    %dl,%cl
  jae    L203
  add    $0x1,%r8d
  mov    %rdi,%rsi
  mov    %r14,%r10
L203:
  lea    0x0(%rbp,%r9,8),%r14
  movslq %r8d,%r9
  mov    (%r14),%rdi
  jmp    L152
```

assistant: ```c
void tcbwtsortstrheap(const char **arrays, int anum, int len, int skip) {
  assert(arrays && anum >= 0 && len >= 0);
  anum--;
  int bottom = (anum >> 1) + 1;
  int top = anum;
  while (bottom > 0) {
    bottom--;
    int mybot = bottom;
    int i = mybot * 2;
    while (i <= top) {
      if (i < top) {
        int cmp = 0;
        const unsigned char *ap = (unsigned char *)arrays[i + 1];
        const unsigned char *bp = (unsigned char *)arrays[i];
        for (int j = skip; j < len; j++) {
          if (ap[j] != bp[j]) {
            cmp = ap[j] - bp[j];
            break;
          }
        }
        if (cmp > 0)
          i++;
      }
      int cmp = 0;
      const unsigned char *ap = (unsigned char *)arrays[mybot];
      const unsigned char *bp = (unsigned char *)arrays[i];
      for (int j = skip; j < len; j++) {
        if (ap[j] != bp[j]) {
          cmp = ap[j] - bp[j];
          break;
        }
      }
      if (cmp >= 0)
        break;
      const char *swap = arrays[mybot];
      arrays[mybot] = arrays[i];
      arrays[i] = swap;
      mybot = i;
      i = mybot * 2;
    }
  }
  while (top > 0) {
    const char *swap = arrays[0];
    arrays[0] = arrays[top];
    arrays[top] = swap;
    top--;
    int mybot = bottom;
    int i = mybot * 2;
    while (i <= top) {
      if (i < top) {
        int cmp = 0;
        const unsigned char *ap = (unsigned char *)arrays[i + 1];
        const unsigned char *bp = (unsigned char *)arrays[i];
        for (int j = 0; j < len; j++) {
          if (ap[j] != bp[j]) {
            cmp = ap[j] - bp[j];
            break;
          }
        }
        if (cmp > 0)
          i++;
      }
      int cmp = 0;
      const unsigned char *ap = (unsigned char *)arrays[mybot];
      const unsigned char *bp = (unsigned char *)arrays[i];
      for (int j = 0; j < len; j++) {
        if (ap[j] != bp[j]) {
          cmp = ap[j] - bp[j];
          break;
        }
      }
      if (cmp >= 0)
        break;
      swap = arrays[mybot];
      arrays[mybot] = arrays[i];
      arrays[i] = swap;
      mybot = i;
      i = mybot * 2;
    }
  }
}
```