user: Converte this assembly snippet into its equivalent C code:

```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    L114
  add    %r13d,%r13d
  movslq %r12d,%r14
  nopw   0x0(%rax,%rax,1)
L160:
  subl   $0x1,0x4(%rsp)
  mov    0x4(%rsp),%eax
  mov    %r13d,%r8d
  movslq %eax,%r9
  cmp    %r13d,%r11d
  jl     L194
  nopl   0x0(%rax)
L60:
  movslq %r8d,%rax
  shl    $0x3,%rax
  lea    0x0(%rbp,%rax,1),%r10
  mov    (%r10),%rsi
  cmp    %r8d,%r11d
  jg     L217
  lea    0x0(%rbp,%r9,8),%r15
  mov    (%r15),%rdi
  cmp    %r12d,%ebx
  jle    L194
  movslq %r8d,%r9
L163:
  mov    %r14,%rax
  jmp    L53
  nopl   (%rax)
L185:
  add    $0x1,%rax
  cmp    %eax,%ebx
  jle    L194
L53:
  movzbl (%rdi,%rax,1),%edx
  movzbl (%rsi,%rax,1),%ecx
  cmp    %cl,%dl
  je     L185
  cmp    %dl,%cl
  jbe    L194
  add    %r8d,%r8d
  mov    %rsi,(%r15)
  mov    %rdi,(%r10)
  cmp    %r8d,%r11d
  jge    L60
  xchg   %ax,%ax
L194:
  mov    0x4(%rsp),%eax
  sub    $0x2,%r13d
  test   %eax,%eax
  jne    L160
L114:
  test   %r11d,%r11d
  jle    L241
  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)
L219:
  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
L202:
  movslq %r8d,%rax
  shl    $0x3,%rax
  lea    0x0(%rbp,%rax,1),%r10
  mov    (%r10),%rsi
  cmp    %r11d,%r8d
  jl     L179
  lea    0x0(%rbp,%r9,8),%r14
  mov    (%r14),%rdi
  test   %ebx,%ebx
  jle    L243
  movslq %r8d,%r9
L269:
  xor    %eax,%eax
  jmp    L97
  nopl   0x0(%rax,%rax,1)
L54:
  add    $0x1,%rax
  cmp    %eax,%ebx
  jle    L243
L97:
  movzbl (%rdi,%rax,1),%edx
  movzbl (%rsi,%rax,1),%ecx
  cmp    %cl,%dl
  je     L54
  cmp    %dl,%cl
  jbe    L243
  add    %r8d,%r8d
  mov    %rsi,(%r14)
  mov    %rdi,(%r10)
  cmp    %r13d,%r8d
  jle    L202
  cs nopw 0x0(%rax,%rax,1)
L243:
  sub    $0x1,%r11
  cmp    %r11,%r15
  jne    L219
L241:
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L217:
  lea    0x8(%rbp,%rax,1),%r15
  mov    (%r15),%rdi
  cmp    %r12d,%ebx
  jle    L194
  mov    %r14,%rax
  jmp    L56
  cs nopw 0x0(%rax,%rax,1)
L302:
  add    $0x1,%rax
  cmp    %eax,%ebx
  jle    L11
L56:
  movzbl (%rdi,%rax,1),%edx
  movzbl (%rsi,%rax,1),%ecx
  cmp    %cl,%dl
  je     L302
  cmp    %dl,%cl
  jae    L11
  add    $0x1,%r8d
  mov    %rdi,%rsi
  mov    %r15,%r10
L11:
  lea    0x0(%rbp,%r9,8),%r15
  movslq %r8d,%r9
  mov    (%r15),%rdi
  jmp    L163
  nopw   0x0(%rax,%rax,1)
L179:
  lea    0x8(%rbp,%rax,1),%r14
  mov    (%r14),%rdi
  test   %ebx,%ebx
  jle    L243
  xor    %eax,%eax
  jmp    L222
  nopl   0x0(%rax)
L249:
  add    $0x1,%rax
  cmp    %rax,%r12
  je     L48
L222:
  movzbl (%rdi,%rax,1),%edx
  movzbl (%rsi,%rax,1),%ecx
  cmp    %cl,%dl
  je     L249
  cmp    %dl,%cl
  jae    L48
  add    $0x1,%r8d
  mov    %rdi,%rsi
  mov    %r14,%r10
L48:
  lea    0x0(%rbp,%r9,8),%r14
  movslq %r8d,%r9
  mov    (%r14),%rdi
  jmp    L269
```

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