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

```asm
<qsort>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x408,%rsp
  mov    %rdi,0x8(%rsp)
  mov    %esi,%ebx
  mov    %edx,0x10(%rsp)
  mov    %rcx,%r13
  mov    %fs:0x28,%rax
  mov    %rax,0x3f8(%rsp)
  xor    %eax,%eax
  lea    0xd0(%rsp),%r15
  cmp    $0x31f,%edx
  ja     L9
L72:
  mov    0x10(%rsp),%eax
  movb   $0x0,(%r15,%rax,1)
  movl   $0x0,0x30(%rsp)
  sub    $0x1,%ebx
  mov    %ebx,0x34(%rsp)
  movl   $0x0,0x2c(%rsp)
  jmp    L182
L9:
  lea    0x1(%rdx),%edi
  mov    $0x0,%eax
  call   <malloc@plt>
  mov    %rax,%r15
  test   %rax,%rax
  jne    L72
  jmp    L85
L201:
  sub    $0x1,%r12d
L184:
  mov    %ebp,%ebx
  add    0x8(%rsp),%rbx
  mov    %rbx,%rsi
  mov    %r15,%rdi
  mov    $0x0,%eax
  call   *%r13
  sub    0x10(%rsp),%ebp
  test   %eax,%eax
  js     L201
  cmp    0x14(%rsp),%r12d
  jge    L15
L49:
  mov    %r12d,%edx
  sub    0x24(%rsp),%edx
  mov    0x28(%rsp),%ecx
  mov    %ecx,%eax
  mov    0x14(%rsp),%esi
  sub    %esi,%eax
  cmp    %eax,%edx
  jge    L37
  cmp    %esi,%ecx
  jle    L33
  addl   $0x1,0x2c(%rsp)
  mov    0x2c(%rsp),%eax
  cltq
  mov    %esi,0x30(%rsp,%rax,8)
  mov    %ecx,0x34(%rsp,%rax,8)
  mov    %r12d,0x28(%rsp)
L18:
  mov    0x28(%rsp),%edx
  cmp    %edx,0x24(%rsp)
  jge    L204
L113:
  mov    0x24(%rsp),%ebx
  mov    %ebx,%eax
  mov    0x28(%rsp),%r12d
  add    %r12d,%eax
  mov    %eax,%edi
  shr    $0x1f,%edi
  add    %eax,%edi
  sar    %edi
  mov    0x10(%rsp),%r14d
  imul   %r14d,%edi
  add    0x8(%rsp),%rdi
  mov    %r14d,%edx
  mov    %r15,%rsi
  mov    $0x0,%eax
  call   <bmove@plt>
  mov    %r14d,%eax
  imul   %ebx,%eax
  mov    %eax,0x20(%rsp)
  lea    0x1(%rbx),%r14d
  jmp    L109
L15:
  mov    %rbx,%rdx
  mov    0x18(%rsp),%rsi
  mov    0x10(%rsp),%edi
  mov    $0x0,%eax
  call   <_swap@plt>
  mov    %r14d,0x14(%rsp)
  sub    $0x1,%r12d
  cmp    %r12d,%r14d
  jg     L49
L122:
  mov    0x10(%rsp),%ecx
  add    %ecx,0x20(%rsp)
  add    $0x1,%r14d
L109:
  lea    -0x1(%r14),%eax
  mov    %eax,0x14(%rsp)
  mov    0x20(%rsp),%eax
  add    0x8(%rsp),%rax
  mov    %rax,0x18(%rsp)
  mov    %r15,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   *%r13
  test   %eax,%eax
  js     L122
  mov    0x10(%rsp),%ebp
  imul   %r12d,%ebp
  jmp    L184
L37:
  mov    0x24(%rsp),%edx
  cmp    %r12d,%edx
  jge    L3
  addl   $0x1,0x2c(%rsp)
  mov    0x2c(%rsp),%eax
  cltq
  mov    %edx,0x30(%rsp,%rax,8)
  mov    %r12d,0x34(%rsp,%rax,8)
  mov    0x14(%rsp),%eax
  mov    %eax,0x24(%rsp)
  jmp    L18
L33:
  mov    %r12d,0x28(%rsp)
  jmp    L18
L3:
  mov    0x14(%rsp),%eax
  mov    %eax,0x24(%rsp)
  jmp    L18
L204:
  cmpl   $0x0,0x2c(%rsp)
  js     L90
L182:
  mov    0x2c(%rsp),%edx
  movslq %edx,%rax
  mov    0x30(%rsp,%rax,8),%ecx
  mov    %ecx,0x24(%rsp)
  mov    0x34(%rsp,%rax,8),%eax
  mov    %eax,0x28(%rsp)
  lea    -0x1(%rdx),%eax
  mov    %eax,0x2c(%rsp)
  jmp    L113
L90:
  lea    0xd0(%rsp),%rax
  cmp    %rax,%r15
  je     L85
  mov    %r15,%rdi
  call   <free@plt>
L85:
  mov    0x3f8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L68
  mov    $0x0,%eax
  add    $0x408,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L68:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
qsort(base, nel, width, compar) char *base;
int (*compar)();
unsigned width, nel;
{
  register char *x;
  extern char *malloc();
  register int i, j, l, r;
  struct {
    int l, r;
  } stack[20];
  int s;
  char xbuf[800];
  if (width < sizeof xbuf)
    x = xbuf;
  else if (!(x = malloc(width + 1)))
    return;
  x[width] = 0;
  s = 0;
  stack[0].l = 0;
  stack[0].r = nel - 1;
  do {
    l = stack[s].l;
    r = stack[s--].r;
    do {
      i = l;
      j = r;
      bmove(base + width * ((i + j) / 2), x, width);
      do {
        while ((*compar)(base + i * width, x) < 0)
          i++;
        while ((*compar)(x, base + j * width) < 0)
          j--;
        if (i <= j) {
          _swap(width, base + i * width, base + j * width);
          i++;
          j--;
        }
      } while (i <= j);
      if (j - l < r - i) {
        if (i < r) {
          stack[++s].l = i;
          stack[s].r = r;
        }
        r = j;
      } else {
        if (l < j) {
          stack[++s].l = l;
          stack[s].r = j;
        }
        l = i;
      }
    } while (l < r);
  } while (s >= 0);
  if (x != xbuf)
    free(x);
}
```