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

```asm
<qsort>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x50,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %rsi,-0x40(%rbp)
  mov    %rdx,-0x48(%rbp)
  mov    %rcx,-0x50(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  cmpq   $0x3,-0x40(%rbp)
  ja     L211
  cmpq   $0x2,-0x40(%rbp)
  jne    L100
  mov    -0x38(%rbp),%rdx
  mov    -0x48(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x38(%rbp),%rax
  mov    -0x50(%rbp),%rdx
  mov    %rax,%rsi
  mov    %rcx,%rdi
  call   *%rdx
  test   %eax,%eax
  jns    L124
  mov    -0x38(%rbp),%rdx
  mov    -0x48(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x48(%rbp),%rdx
  mov    -0x38(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <swap@plt>
  jmp    L124
L100:
  cmpq   $0x3,-0x40(%rbp)
  jne    L124
  mov    -0x38(%rbp),%rdx
  mov    -0x48(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x38(%rbp),%rax
  mov    -0x50(%rbp),%rdx
  mov    %rax,%rsi
  mov    %rcx,%rdi
  call   *%rdx
  test   %eax,%eax
  jns    L164
  mov    -0x38(%rbp),%rdx
  mov    -0x48(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x48(%rbp),%rdx
  mov    -0x38(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <swap@plt>
L164:
  mov    -0x38(%rbp),%rdx
  mov    -0x48(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x48(%rbp),%rax
  lea    (%rax,%rax,1),%rdx
  mov    -0x38(%rbp),%rax
  add    %rax,%rdx
  mov    -0x50(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rdx,%rdi
  call   *%rax
  test   %eax,%eax
  jns    L124
  mov    -0x48(%rbp),%rax
  lea    (%rax,%rax,1),%rdx
  mov    -0x38(%rbp),%rax
  lea    (%rdx,%rax,1),%rsi
  mov    -0x38(%rbp),%rdx
  mov    -0x48(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x48(%rbp),%rax
  mov    %rax,%rdx
  mov    %rcx,%rdi
  call   <swap@plt>
  mov    -0x38(%rbp),%rdx
  mov    -0x48(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x38(%rbp),%rax
  mov    -0x50(%rbp),%rdx
  mov    %rax,%rsi
  mov    %rcx,%rdi
  call   *%rdx
  test   %eax,%eax
  jns    L124
  mov    -0x38(%rbp),%rdx
  mov    -0x48(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x48(%rbp),%rdx
  mov    -0x38(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <swap@plt>
  jmp    L124
L211:
  mov    $0x0,%eax
  call   <rand@plt>
  mov    $0x0,%edx
  divq   -0x40(%rbp)
  mov    %rdx,%rax
  imul   -0x48(%rbp),%rax
  mov    %rax,%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,-0x18(%rbp)
  mov    -0x48(%rbp),%rax
  lea    0x8(%rax),%rdx
  mov    $0x10,%eax
  sub    $0x1,%rax
  add    %rdx,%rax
  mov    $0x10,%edi
  mov    $0x0,%edx
  div    %rdi
  imul   $0x10,%rax,%rax
  mov    %rax,%rcx
  and    $0xfffffffffffff000,%rcx
  mov    %rsp,%rdx
  sub    %rcx,%rdx
L72:
  cmp    %rdx,%rsp
  je     L89
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L72
L89:
  mov    %rax,%rdx
  and    $0xfff,%edx
  sub    %rdx,%rsp
  mov    %rax,%rdx
  and    $0xfff,%edx
  test   %rdx,%rdx
  je     L199
  and    $0xfff,%eax
  sub    $0x8,%rax
  add    %rsp,%rax
  orq    $0x0,(%rax)
L199:
  mov    %rsp,%rax
  add    $0xf,%rax
  shr    $0x4,%rax
  shl    $0x4,%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x38(%rbp),%rax
  mov    %rax,-0x28(%rbp)
  mov    -0x40(%rbp),%rax
  sub    $0x1,%rax
  imul   -0x48(%rbp),%rax
  mov    %rax,%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,-0x20(%rbp)
  mov    -0x48(%rbp),%rdx
  mov    -0x18(%rbp),%rcx
  mov    -0x10(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  jmp    L185
L219:
  mov    -0x48(%rbp),%rax
  add    %rax,-0x28(%rbp)
L109:
  mov    -0x10(%rbp),%rdx
  mov    -0x28(%rbp),%rax
  mov    -0x50(%rbp),%rcx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   *%rcx
  test   %eax,%eax
  js     L219
  jmp    L75
L107:
  mov    -0x48(%rbp),%rax
  neg    %rax
  add    %rax,-0x20(%rbp)
L75:
  mov    -0x20(%rbp),%rdx
  mov    -0x10(%rbp),%rax
  mov    -0x50(%rbp),%rcx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   *%rcx
  test   %eax,%eax
  js     L107
  mov    -0x28(%rbp),%rax
  cmp    -0x20(%rbp),%rax
  ja     L185
  mov    -0x48(%rbp),%rdx
  mov    -0x20(%rbp),%rcx
  mov    -0x28(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <swap@plt>
  mov    -0x48(%rbp),%rax
  add    %rax,-0x28(%rbp)
  mov    -0x48(%rbp),%rax
  neg    %rax
  add    %rax,-0x20(%rbp)
L185:
  mov    -0x28(%rbp),%rax
  cmp    -0x20(%rbp),%rax
  jbe    L109
  mov    -0x20(%rbp),%rax
  cmp    -0x38(%rbp),%rax
  jbe    L7
  mov    -0x20(%rbp),%rax
  sub    -0x38(%rbp),%rax
  mov    $0x0,%edx
  divq   -0x48(%rbp)
  lea    0x1(%rax),%rsi
  mov    -0x50(%rbp),%rcx
  mov    -0x48(%rbp),%rdx
  mov    -0x38(%rbp),%rax
  mov    %rax,%rdi
  call   <qsort>
L7:
  mov    -0x40(%rbp),%rax
  sub    $0x1,%rax
  imul   -0x48(%rbp),%rax
  mov    %rax,%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  cmp    %rax,-0x28(%rbp)
  jae    L45
  mov    -0x28(%rbp),%rax
  sub    -0x38(%rbp),%rax
  mov    $0x0,%edx
  divq   -0x48(%rbp)
  mov    %rax,%rdx
  mov    -0x40(%rbp),%rax
  sub    %rdx,%rax
  mov    %rax,%rsi
  mov    -0x50(%rbp),%rcx
  mov    -0x48(%rbp),%rdx
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <qsort>
  jmp    L45
L124:
  nop
L45:
  mov    -0x8(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L170
  call   <__stack_chk_fail@plt>
L170:
  leave
  ret
```

assistant: ```c
void qsort(void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *)) {
  if (nmemb < 4) {
    if (nmemb == 2) {
      if (compar(base + size, base) < 0) {
        swap(base, base + size, size);
      }
    } else if (nmemb == 3) {
      if (compar(base + size, base) < 0) {
        swap(base, base + size, size);
      }
      if (compar(base + (size << 1), base + size) < 0) {
        swap(base + size, base + (size << 1), size);
        if (compar(base + size, base) < 0) {
          swap(base, base + size, size);
        }
      }
    }
    return;
  } else {
    void *pos = (rand() % nmemb) * size + base;
    void *key = alloca(size);
    void *i = base, *j = base + (size * (nmemb - 1));
    memcpy(key, pos, size);
    while (i <= j) {
      while (compar(i, key) < 0) {
        i += size;
      }
      while (compar(key, j) < 0) {
        j -= size;
      }
      if (i <= j) {
        swap(i, j, size);
        i += size;
        j -= size;
      }
    }
    if (j > base) {
      qsort(base, (j - base) / size + 1, size, compar);
    }
    if (i < base + (nmemb - 1) * size) {
      qsort(i, nmemb - (i - base) / size, size, compar);
    }
  }
}
```