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

```asm
<LMSsort2>:
  endbr64
  push   %r15
  mov    %rsi,%r15
  push   %r14
  mov    %rdi,%r14
  xor    %edi,%edi
  push   %r13
  push   %r12
  mov    %rcx,%r12
  push   %rbp
  mov    %r9d,%ebp
  push   %rbx
  sub    $0x58,%rsp
  cmp    %rcx,%rdx
  mov    0x98(%rsp),%ebx
  setne  %dil
  mov    %rdx,0x38(%rsp)
  mov    0x90(%rsp),%r13d
  mov    %rcx,0x18(%rsp)
  mov    %ebx,0x20(%rsp)
  mov    %rdx,%rbx
  mov    %r8,(%rsp)
  mov    %r13d,0x40(%rsp)
  call   <assert@plt>
  xor    %ecx,%ecx
  mov    %r13d,%edx
  mov    %r12,%rsi
  mov    %rbx,%rdi
  call   <getBuckets@plt>
  lea    -0x1(%rbp),%edx
  cmpl   $0x4,0x20(%rsp)
  movslq %edx,%rax
  mov    %rax,0x30(%rsp)
  mov    %rax,%r12
  lea    -0x2(%rbp),%eax
  je     L81
  mov    0x30(%rsp),%rbx
  movslq %eax,%rsi
  movzbl (%r14,%rsi,1),%edi
  movzbl (%r14,%rbx,1),%r9d
  mov    0x18(%rsp),%rbx
  movslq (%rbx,%r9,4),%rcx
  lea    (%r15,%rcx,4),%rcx
L128:
  add    %ebp,%eax
  cmp    %r9d,%edi
  lea    0x4(%rcx),%r11
  mov    %eax,%esi
  not    %esi
  cmovl  %esi,%eax
  mov    %eax,(%rcx)
  test   %ebp,%ebp
  jle    L111
  movslq %ebp,%rax
  mov    %r12,0x48(%rsp)
  xor    %r13d,%r13d
  mov    %r15,%r12
  mov    %rax,0x28(%rsp)
  mov    %r9d,%r15d
  movl   $0x0,0x24(%rsp)
  mov    %edx,0x44(%rsp)
  mov    %r11,0x8(%rsp)
  jmp    L237
  cs nopw 0x0(%rax,%rax,1)
L304:
  cmp    %ebx,%ebp
  jg     L234
  addl   $0x1,0x24(%rsp)
  sub    %ebp,%ebx
L234:
  lea    0x1(%rbx),%eax
  cmpl   $0x4,0x20(%rsp)
  movslq %ebx,%rsi
  cltq
  je     L312
  add    %r14,%rsi
  movzbl (%r14,%rax,1),%eax
  cmp    %al,(%rsi)
  mov    %rsi,0x10(%rsp)
  setae  %dil
  movzbl %dil,%edi
  call   <assert@plt>
  mov    0x10(%rsp),%rsi
  movzbl (%rsi),%r10d
L250:
  mov    0x8(%rsp),%rsi
  cmp    %r10d,%r15d
  je     L0
  mov    0x18(%rsp),%rcx
  sub    %r12,%rsi
  movslq %r15d,%r9
  movslq %r10d,%rax
  sar    $0x2,%rsi
  mov    %esi,(%rcx,%r9,4)
  movslq (%rcx,%rax,4),%rax
  lea    (%r12,%rax,4),%rsi
L0:
  mov    %rsi,%rax
  xor    %edi,%edi
  mov    %r10d,0x10(%rsp)
  sub    %r12,%rax
  mov    %rsi,0x8(%rsp)
  sar    $0x2,%rax
  cmp    %r13,%rax
  setg   %dil
  call   <assert@plt>
  mov    0x10(%rsp),%r10d
  lea    -0x1(%rbx),%edx
  cmpl   $0x4,0x20(%rsp)
  mov    0x8(%rsp),%rsi
  movslq %edx,%rax
  lea    (%r10,%r10,1),%edi
  je     L104
  movzbl (%r14,%rax,1),%eax
L226:
  cmp    %eax,%r10d
  mov    (%rsp),%rbx
  setg   %al
  movzbl %al,%eax
  or     %edi,%eax
  movslq %eax,%rdi
  lea    (%rbx,%rdi,4),%rdi
  mov    0x24(%rsp),%ebx
  cmp    %ebx,(%rdi)
  je     L238
  mov    %ebx,(%rdi)
  add    %ebp,%edx
L238:
  mov    %edx,%edi
  test   $0x1,%al
  lea    0x4(%rsi),%rax
  mov    %r10d,%r15d
  not    %edi
  mov    %rax,0x8(%rsp)
  cmovne %edi,%edx
  mov    %edx,(%rsi)
  movl   $0x0,(%r12,%r13,4)
L215:
  add    $0x1,%r13
  cmp    %r13,0x28(%rsp)
  je     L320
L237:
  mov    (%r12,%r13,4),%ebx
  test   %ebx,%ebx
  jg     L304
  je     L215
  not    %ebx
  mov    %ebx,(%r12,%r13,4)
  add    $0x1,%r13
  cmp    %r13,0x28(%rsp)
  jne    L237
L320:
  mov    %r12,%r15
  mov    0x44(%rsp),%edx
  mov    0x48(%rsp),%r12
L299:
  test   %edx,%edx
  js     L130
  mov    0x30(%rsp),%rax
  jmp    L335
  nopw   0x0(%rax,%rax,1)
L35:
  sub    $0x1,%edx
  js     L125
L117:
  movslq %edx,%rax
L335:
  shl    $0x2,%rax
  lea    (%r15,%rax,1),%rsi
  mov    (%rsi),%ecx
  test   %ecx,%ecx
  jle    L35
  cmp    %ebp,%ecx
  jge    L35
  add    %ebp,%ecx
  sub    $0x1,%edx
  mov    %ecx,(%rsi)
  lea    -0x4(%r15,%rax,1),%rsi
  movslq %edx,%rdi
  mov    (%rsi),%ecx
  cmp    %ecx,%ebp
  jle    L300
  lea    -0x4(%r15,%rdi,4),%rax
  nopl   0x0(%rax)
L58:
  mov    %rax,%rsi
  mov    (%rax),%ecx
  sub    $0x4,%rax
  sub    $0x1,%edx
  cmp    %ebp,%ecx
  jl     L58
L300:
  sub    %ebp,%ecx
  mov    %ecx,(%rsi)
  sub    $0x1,%edx
  jns    L117
  nopl   0x0(%rax)
L125:
  mov    0x18(%rsp),%r13
  mov    0x40(%rsp),%edx
  mov    $0x1,%ecx
  mov    0x38(%rsp),%rdi
  mov    %r13,%rsi
  call   <getBuckets@plt>
  movslq 0x0(%r13),%rax
  mov    0x24(%rsp),%ebx
  xor    %edx,%edx
  mov    %r12,%r13
  mov    %ebp,0x24(%rsp)
  mov    %r15,%r12
  lea    (%r15,%rax,4),%r9
  add    $0x1,%ebx
  mov    %edx,%r15d
  mov    %r9,0x8(%rsp)
  jmp    L205
  nopl   0x0(%rax,%rax,1)
L210:
  movzbl (%r14,%rax,1),%eax
L96:
  cmp    %eax,%r10d
  mov    (%rsp),%rdi
  setl   %al
  movzbl %al,%eax
  or     %edx,%eax
  movslq %eax,%rdx
  lea    (%rdi,%rdx,4),%rdx
  cmp    %ebx,(%rdx)
  je     L42
  mov    %ebx,(%rdx)
  add    0x24(%rsp),%ecx
L42:
  mov    $0xfffffffe,%edx
  mov    %r10d,%r15d
  sub    %ecx,%edx
  test   $0x1,%al
  lea    -0x4(%r8),%rax
  cmovne %edx,%ecx
  mov    %rax,0x8(%rsp)
  mov    %ecx,-0x4(%r8)
  movl   $0x0,(%r12,%r13,4)
L187:
  sub    $0x1,%r13
  test   %r13d,%r13d
  js     L163
L205:
  mov    (%r12,%r13,4),%ebp
  test   %ebp,%ebp
  jle    L187
  mov    0x24(%rsp),%eax
  cmp    %ebp,%eax
  jg     L203
  add    $0x1,%ebx
  sub    %eax,%ebp
L203:
  cmpl   $0x4,0x20(%rsp)
  movslq %ebp,%rax
  je     L69
  lea    (%r14,%rax,1),%r8
  movzbl 0x1(%r14,%rax,1),%eax
  cmp    %al,(%r8)
  mov    %r8,0x10(%rsp)
  setbe  %dil
  movzbl %dil,%edi
  call   <assert@plt>
  mov    0x10(%rsp),%r8
  movzbl (%r8),%r10d
L76:
  mov    0x8(%rsp),%r8
  cmp    %r10d,%r15d
  je     L229
  mov    0x18(%rsp),%rsi
  sub    %r12,%r8
  movslq %r15d,%rdx
  movslq %r10d,%rax
  sar    $0x2,%r8
  mov    %r8d,(%rsi,%rdx,4)
  movslq (%rsi,%rax,4),%rax
  lea    (%r12,%rax,4),%r8
L229:
  mov    %r8,%rax
  xor    %edi,%edi
  mov    %r10d,0x10(%rsp)
  sub    %r12,%rax
  mov    %r8,0x8(%rsp)
  sar    $0x2,%rax
  cmp    %r13,%rax
  setle  %dil
  call   <assert@plt>
  mov    0x10(%rsp),%r10d
  lea    -0x1(%rbp),%ecx
  cmpl   $0x4,0x20(%rsp)
  mov    0x8(%rsp),%r8
  movslq %ecx,%rax
  lea    (%r10,%r10,1),%edx
  jne    L210
  mov    (%r14,%rax,4),%eax
  jmp    L96
  nopl   0x0(%rax,%rax,1)
L104:
  mov    (%r14,%rax,4),%eax
  jmp    L226
  nopl   0x0(%rax)
L312:
  shl    $0x2,%rsi
  lea    (%r14,%rsi,1),%r10
  mov    0x4(%r14,%rsi,1),%eax
  cmp    %eax,(%r10)
  mov    %r10,0x10(%rsp)
  setge  %dil
  movzbl %dil,%edi
  call   <assert@plt>
  mov    0x10(%rsp),%r10
  mov    (%r10),%r10d
  jmp    L250
  nopw   0x0(%rax,%rax,1)
L69:
  shl    $0x2,%rax
  lea    (%r14,%rax,1),%r8
  mov    0x4(%r14,%rax,1),%eax
  cmp    %eax,(%r8)
  mov    %r8,0x10(%rsp)
  setle  %dil
  movzbl %dil,%edi
  call   <assert@plt>
  mov    0x10(%rsp),%r8
  mov    (%r8),%r10d
  jmp    L76
  nop
L163:
  add    $0x58,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nop
L81:
  movslq (%r14,%r12,4),%rcx
  mov    0x18(%rsp),%rdi
  mov    %rcx,%r9
  movslq (%rdi,%rcx,4),%rcx
  mov    -0x4(%r14,%r12,4),%edi
  lea    (%r15,%rcx,4),%rcx
  jmp    L128
L130:
  mov    0x40(%rsp),%edx
  mov    0x18(%rsp),%rsi
  mov    $0x1,%ecx
  mov    0x38(%rsp),%rdi
  add    $0x58,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    1070 <getBuckets@plt>
L111:
  movl   $0x0,0x24(%rsp)
  jmp    L299
```

assistant: ```c
void LMSsort2(const void *T, int *SA, int *C, int *B, int *D, int n, int k, int cs) {
  int *b, i, j, t, d;
  int c0, c1;
  assert(C != B);
  getBuckets(C, B, k, 0);
  j = n - 1;
  b = SA + B[c1 = (cs == sizeof(int) ? ((int *)T)[(j)] : ((unsigned char *)T)[(j)])];
  --j;
  t = ((cs == sizeof(int) ? ((int *)T)[(j)] : ((unsigned char *)T)[(j)]) < c1);
  j += n;
  *b++ = (t & 1) ? ~j : j;
  for (i = 0, d = 0; i < n; ++i) {
    if (0 < (j = SA[i])) {
      if (n <= j) {
        d += 1;
        j -= n;
      }
      assert((cs == sizeof(int) ? ((int *)T)[(j)] : ((unsigned char *)T)[(j)]) >= (cs == sizeof(int) ? ((int *)T)[(j + 1)] : ((unsigned char *)T)[(j + 1)]));
      if ((c0 = (cs == sizeof(int) ? ((int *)T)[(j)] : ((unsigned char *)T)[(j)])) != c1) {
        B[c1] = b - SA;
        b = SA + B[c1 = c0];
      }
      assert(i < (b - SA));
      --j;
      t = c0;
      t = (t << 1) | ((cs == sizeof(int) ? ((int *)T)[(j)] : ((unsigned char *)T)[(j)]) < c1);
      if (D[t] != d) {
        j += n;
        D[t] = d;
      }
      *b++ = (t & 1) ? ~j : j;
      SA[i] = 0;
    } else if (j < 0) {
      SA[i] = ~j;
    }
  }
  for (i = n - 1; 0 <= i; --i) {
    if (0 < SA[i]) {
      if (SA[i] < n) {
        SA[i] += n;
        for (j = i - 1; SA[j] < n; --j) {
        }
        SA[j] -= n;
        i = j;
      }
    }
  }
  getBuckets(C, B, k, 1);
  for (i = n - 1, d += 1, b = SA + B[c1 = 0]; 0 <= i; --i) {
    if (0 < (j = SA[i])) {
      if (n <= j) {
        d += 1;
        j -= n;
      }
      assert((cs == sizeof(int) ? ((int *)T)[(j)] : ((unsigned char *)T)[(j)]) <= (cs == sizeof(int) ? ((int *)T)[(j + 1)] : ((unsigned char *)T)[(j + 1)]));
      if ((c0 = (cs == sizeof(int) ? ((int *)T)[(j)] : ((unsigned char *)T)[(j)])) != c1) {
        B[c1] = b - SA;
        b = SA + B[c1 = c0];
      }
      assert((b - SA) <= i);
      --j;
      t = c0;
      t = (t << 1) | ((cs == sizeof(int) ? ((int *)T)[(j)] : ((unsigned char *)T)[(j)]) > c1);
      if (D[t] != d) {
        j += n;
        D[t] = d;
      }
      *--b = (t & 1) ? ~(j + 1) : j;
      SA[i] = 0;
    }
  }
}
```