user: 请将以下的汇编代码转换成C语言代码：

```asm
<qsort>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %rdi,%rbp
  mov    %esi,%ebx
  mov    %edx,0x18(%rsp)
  mov    %rcx,%r12
  mov    $0x2,%r13d
  test   $0x7,%dil
  jne    L39
  test   $0x7,%dl
  jne    L39
  cmp    $0x8,%edx
  setne  %r13b
  movzbl %r13b,%r13d
L39:
  cmp    $0x6,%ebx
  jbe    L332
  mov    %ebx,%r14d
  shr    %r14d
  mov    0x18(%rsp),%ecx
  imul   %ecx,%r14d
  add    %rbp,%r14
  cmp    $0x7,%ebx
  jbe    L325
  lea    -0x1(%rbx),%eax
  imul   %ecx,%eax
  lea    0x0(%rbp,%rax,1),%r15
  mov    %rbp,(%rsp)
  cmp    $0x28,%ebx
  ja     L171
L131:
  mov    %r12,%rcx
  mov    %r15,%rdx
  mov    %r14,%rsi
  mov    (%rsp),%rdi
  mov    $0x0,%eax
  call   <med3@plt>
  movslq %eax,%r14
L325:
  test   %r13d,%r13d
  jne    L42
  mov    0x0(%rbp),%rax
  mov    (%r14),%rdx
  mov    %rdx,0x0(%rbp)
  mov    %rax,(%r14)
L173:
  mov    0x18(%rsp),%ecx
  movslq %ecx,%rax
  mov    %rax,(%rsp)
  add    %rbp,%rax
  mov    %rax,0x10(%rsp)
  sub    $0x1,%ebx
  imul   %ecx,%ebx
  mov    %ebx,0x1c(%rsp)
  mov    %ebx,%ebx
  add    %rbp,%rbx
  mov    %rax,0x8(%rsp)
  mov    %rbx,%r14
  jmp    L349
L332:
  mov    0x18(%rsp),%ecx
  movslq %ecx,%r14
  lea    0x0(%rbp,%r14,1),%rdx
  mov    %rdx,(%rsp)
  mov    %ebx,%eax
  imul   %ecx,%eax
  add    %rbp,%rax
  mov    %rax,0x8(%rsp)
  cmp    %rax,%rdx
  jb     L322
  jmp    L61
L282:
  mov    %r13d,%ecx
  mov    0x18(%rsp),%edx
  mov    %rbx,%rsi
  mov    %r15,%rdi
  mov    $0x0,%eax
  call   <swapfunc@plt>
L99:
  cmp    %rbp,%rbx
  jbe    L199
L69:
  mov    %rbx,%r15
  sub    %r14,%rbx
  mov    %r15,%rsi
  mov    %rbx,%rdi
  call   *%r12
  test   %eax,%eax
  jle    L199
  test   %r13d,%r13d
  jne    L282
  mov    (%rbx,%r14,1),%rax
  mov    (%rbx),%rdx
  mov    %rdx,(%rbx,%r14,1)
  mov    %rax,(%rbx)
  jmp    L99
L199:
  add    %r14,(%rsp)
  mov    (%rsp),%rax
  cmp    0x8(%rsp),%rax
  jae    L61
L322:
  mov    (%rsp),%rax
  mov    %rax,%rbx
  cmp    %rax,%rbp
  jb     L69
  jmp    L199
L171:
  mov    %ebx,%eax
  shr    $0x3,%eax
  imul   %ecx,%eax
  movslq %eax,%rcx
  lea    (%rax,%rax,1),%edx
  movslq %edx,%rdx
  add    %rbp,%rdx
  mov    %rcx,0x8(%rsp)
  lea    0x0(%rbp,%rcx,1),%rsi
  mov    %r12,%rcx
  mov    %rbp,%rdi
  mov    $0x0,%eax
  call   <med3@plt>
  movslq %eax,%rsi
  mov    %rsi,(%rsp)
  mov    0x8(%rsp),%rax
  mov    %rax,%rcx
  neg    %rcx
  mov    %rcx,0x8(%rsp)
  lea    (%r14,%rax,1),%rdx
  mov    %r14,%rdi
  sub    %rax,%rdi
  mov    %r12,%rcx
  mov    %r14,%rsi
  mov    $0x0,%eax
  call   <med3@plt>
  movslq %eax,%r14
  mov    0x8(%rsp),%rcx
  lea    (%r15,%rcx,1),%rsi
  lea    (%rsi,%rcx,1),%rdi
  mov    %r12,%rcx
  mov    %r15,%rdx
  mov    $0x0,%eax
  call   <med3@plt>
  movslq %eax,%r15
  jmp    L131
L42:
  mov    %r13d,%ecx
  mov    0x18(%rsp),%edx
  mov    %r14,%rsi
  mov    %rbp,%rdi
  mov    $0x0,%eax
  call   <swapfunc@plt>
  jmp    L173
L116:
  mov    %r13d,%ecx
  mov    0x18(%rsp),%edx
  mov    %r15,%rsi
  mov    0x10(%rsp),%rdi
  mov    $0x0,%eax
  call   <swapfunc@plt>
  jmp    L80
L159:
  mov    (%rbx),%rax
  mov    (%r14),%rdx
  mov    %rdx,(%rbx)
  mov    %rax,(%r14)
L143:
  sub    (%rsp),%r14
L169:
  sub    (%rsp),%rbx
  cmp    %rbx,%r15
  ja     L22
L363:
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  call   *%r12
  test   %eax,%eax
  js     L77
  jne    L169
  test   %r13d,%r13d
  je     L159
  mov    %r13d,%ecx
  mov    0x18(%rsp),%edx
  mov    %r14,%rsi
  mov    %rbx,%rdi
  mov    $0x0,%eax
  call   <swapfunc@plt>
  jmp    L143
L77:
  cmp    %rbx,%r15
  ja     L22
  test   %r13d,%r13d
  jne    L5
  mov    (%r15),%rax
  mov    (%rbx),%rdx
  mov    %rdx,(%r15)
  mov    %rax,(%rbx)
L167:
  sub    (%rsp),%rbx
L339:
  mov    (%rsp),%rcx
  add    %rcx,0x8(%rsp)
L349:
  mov    0x8(%rsp),%rax
  mov    %rax,%r15
  cmp    %rbx,%rax
  ja     L22
  mov    %rbp,%rsi
  mov    %rax,%rdi
  call   *%r12
  test   %eax,%eax
  jg     L363
  jne    L339
  test   %r13d,%r13d
  jne    L116
  mov    0x10(%rsp),%rcx
  mov    (%rcx),%rax
  mov    (%r15),%rdx
  mov    %rdx,(%rcx)
  mov    %rax,(%r15)
L80:
  mov    (%rsp),%rcx
  add    %rcx,0x10(%rsp)
  jmp    L339
L5:
  mov    %r13d,%ecx
  mov    0x18(%rsp),%edx
  mov    %rbx,%rsi
  mov    %r15,%rdi
  mov    $0x0,%eax
  call   <swapfunc@plt>
  jmp    L167
L22:
  mov    0x18(%rsp),%eax
  mov    0x1c(%rsp),%ecx
  lea    (%rax,%rcx,1),%eax
  add    %rbp,%rax
  mov    %rax,(%rsp)
  mov    %r15,%rcx
  mov    0x10(%rsp),%rax
  sub    %rax,%rcx
  mov    %rcx,0x8(%rsp)
  sub    %rbp,%rax
  cmp    %rcx,%rax
  cmovg  %rcx,%rax
  mov    %eax,%edx
  test   %eax,%eax
  jg     L96
L144:
  mov    %r14,%rcx
  sub    %rbx,%rcx
  mov    %rcx,%rbx
  mov    (%rsp),%rdi
  mov    %rdi,%rax
  sub    %r14,%rax
  movslq 0x18(%rsp),%rdx
  sub    %rdx,%rax
  cmp    %rcx,%rax
  cmovg  %rcx,%rax
  mov    %eax,%edx
  test   %eax,%eax
  jg     L260
L156:
  mov    0x8(%rsp),%rcx
  mov    %ecx,%eax
  cmp    %ecx,0x18(%rsp)
  jl     L43
L219:
  mov    %ebx,%eax
  cmp    %ebx,0x18(%rsp)
  jl     L237
L61:
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L96:
  cltq
  mov    %r15,%rsi
  sub    %rax,%rsi
  mov    %r13d,%ecx
  mov    %rbp,%rdi
  mov    $0x0,%eax
  call   <swapfunc@plt>
  jmp    L144
L260:
  cltq
  mov    %rdi,%rsi
  sub    %rax,%rsi
  mov    %r13d,%ecx
  mov    %r15,%rdi
  mov    $0x0,%eax
  call   <swapfunc@plt>
  jmp    L156
L43:
  mov    0x18(%rsp),%edi
  cltd
  idiv   %edi
  mov    %r12,%rcx
  mov    %edi,%edx
  mov    %eax,%esi
  mov    %rbp,%rdi
  call   <qsort>
  jmp    L219
L237:
  mov    0x18(%rsp),%esi
  cltd
  idiv   %esi
  movslq %ebx,%rdx
  mov    (%rsp),%rdi
  sub    %rdx,%rdi
  mov    %r12,%rcx
  mov    %esi,%edx
  mov    %eax,%esi
  call   <qsort>
  jmp    L61
```

assistant: ```c
void qsort(void *base, unsigned n, int es, int (*cmp)(const void *, const void *)) {
  char *pa, *pb, *pc, *pd, *pl, *pm, *pn;
  int d, r, swaptype;
  char *a = (char *)base;
  swaptype = (a - (char *)0) % sizeof(long) || es % sizeof(long) ? 2 : es == sizeof(long) ? 0 : 1;
  ;
  if (n < 7) {
    for (pm = a + es; pm < a + n * es; pm += es)
      for (pl = pm; pl > a && cmp(pl - es, pl) > 0; pl -= es)
        if (swaptype == 0) {
          long t = *(long *)(pl);
          *(long *)(pl) = *(long *)(pl - es);
          *(long *)(pl - es) = t;
        } else
          swapfunc(pl, pl - es, es, swaptype);
    return;
  }
  pm = a + (n / 2) * es;
  if (n > 7) {
    pl = a;
    pn = a + (n - 1) * es;
    if (n > 40) {
      d = (n / 8) * es;
      pl = med3(pl, pl + d, pl + 2 * d, cmp);
      pm = med3(pm - d, pm, pm + d, cmp);
      pn = med3(pn - 2 * d, pn - d, pn, cmp);
    }
    pm = med3(pl, pm, pn, cmp);
  }
  if (swaptype == 0) {
    long t = *(long *)(a);
    *(long *)(a) = *(long *)(pm);
    *(long *)(pm) = t;
  } else
    swapfunc(a, pm, es, swaptype);
  pa = pb = a + es;
  pc = pd = a + (n - 1) * es;
  for (;;) {
    while (pb <= pc && (r = cmp(pb, a)) <= 0) {
      if (r == 0) {
        if (swaptype == 0) {
          long t = *(long *)(pa);
          *(long *)(pa) = *(long *)(pb);
          *(long *)(pb) = t;
        } else
          swapfunc(pa, pb, es, swaptype);
        pa += es;
      }
      pb += es;
    }
    while (pb <= pc && (r = cmp(pc, a)) >= 0) {
      if (r == 0) {
        if (swaptype == 0) {
          long t = *(long *)(pc);
          *(long *)(pc) = *(long *)(pd);
          *(long *)(pd) = t;
        } else
          swapfunc(pc, pd, es, swaptype);
        pd -= es;
      }
      pc -= es;
    }
    if (pb > pc)
      break;
    if (swaptype == 0) {
      long t = *(long *)(pb);
      *(long *)(pb) = *(long *)(pc);
      *(long *)(pc) = t;
    } else
      swapfunc(pb, pc, es, swaptype);
    pb += es;
    pc -= es;
  }
  pn = a + n * es;
  r = ((pa - a) <= (pb - pa) ? (pa - a) : (pb - pa));
  if (r > 0)
    swapfunc(a, pb - r, r, swaptype);
  r = ((pd - pc) <= (pn - pd - es) ? (pd - pc) : (pn - pd - es));
  if (r > 0)
    swapfunc(pb, pn - r, r, swaptype);
  if ((r = pb - pa) > es)
    qsort(a, r / es, es, cmp);
  if ((r = pd - pc) > es)
    qsort(pn - r, r / es, es, cmp);
}
```