user: Please show me the C implementation that matches the assembly code listed below:

```asm
<_wqsort>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %rdi,0x10(%rsp)
  mov    %esi,0x1c(%rsp)
  mov    %edx,0x18(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  cmp    %edx,%esi
  jge    L110
  mov    %rcx,%r12
  lea    0x24(%rsp),%r13
L102:
  mov    0x18(%rsp),%ebp
  mov    0x1c(%rsp),%edi
  mov    0x10(%rsp),%rsi
  mov    %ebp,%eax
  mov    %edi,0xc(%rsp)
  add    %edi,%eax
  sar    %eax
  cltq
  lea    (%rsi,%rax,4),%rcx
  movslq %edi,%rax
  lea    (%rsi,%rax,4),%rax
  mov    (%rcx),%edx
  mov    (%rax),%esi
  mov    %edx,0x24(%rsp)
  mov    %esi,(%rcx)
  mov    %edx,(%rax)
  nop
L82:
  mov    0x10(%rsp),%rcx
  movslq %ebp,%rax
  lea    (%rcx,%rax,4),%rax
  jmp    L114
  xchg   %ax,%ax
L136:
  sub    $0x1,%ebp
L114:
  mov    %rax,%rbx
  mov    %rax,%rdi
  mov    %r13,%rsi
  xor    %eax,%eax
  call   *%r12
  mov    %eax,%r8d
  lea    -0x4(%rbx),%rax
  test   %r8d,%r8d
  jle    L136
  movslq 0xc(%rsp),%rax
  mov    0x10(%rsp),%rdi
  mov    %rax,%rcx
  lea    (%rdi,%rax,4),%r14
  mov    (%rbx),%eax
  mov    %eax,(%r14)
  cmp    %ecx,%ebp
  jle    L139
  mov    0xc(%rsp),%r15d
  mov    %r14,%rdx
  jmp    L79
  nopl   (%rax)
L41:
  lea    0x4(%r14),%rdx
  cmp    %r15d,%ebp
  je     L132
L79:
  mov    %rdx,%r14
  mov    %r13,%rsi
  mov    %rdx,%rdi
  xor    %eax,%eax
  call   *%r12
  mov    %r15d,0xc(%rsp)
  add    $0x1,%r15d
  test   %eax,%eax
  jg     L41
  mov    (%r14),%eax
  mov    %eax,(%rbx)
  cmp    0xc(%rsp),%ebp
  jg     L82
  mov    0xc(%rsp),%eax
  mov    %eax,%r15d
  sub    $0x1,%eax
  mov    %eax,0xc(%rsp)
  jmp    L61
  nopl   0x0(%rax,%rax,1)
L132:
  mov    0x10(%rsp),%rcx
  movslq %r15d,%rax
  lea    (%rcx,%rax,4),%r14
  mov    (%r14),%eax
L107:
  mov    %eax,(%rbx)
L61:
  mov    0x24(%rsp),%eax
  mov    0x1c(%rsp),%esi
  mov    %r15d,%edx
  lea    0x1(%r15),%ebp
  mov    %r12,%rcx
  mov    %eax,(%r14)
  mov    0x18(%rsp),%eax
  sub    %esi,%edx
  sub    %r15d,%eax
  cmp    %eax,%edx
  jge    L134
  mov    0xc(%rsp),%edx
  mov    0x10(%rsp),%rdi
  xor    %eax,%eax
  call   <_wqsort>
  mov    %ebp,0x1c(%rsp)
L28:
  mov    0x1c(%rsp),%ecx
  cmp    %ecx,0x18(%rsp)
  jg     L102
L110:
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L96
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L139:
  mov    0xc(%rsp),%ecx
  mov    %ecx,%r15d
  sub    $0x1,%ecx
  mov    %ecx,0xc(%rsp)
  jmp    L107
L134:
  mov    0x18(%rsp),%edx
  mov    0x10(%rsp),%rdi
  xor    %eax,%eax
  mov    %ebp,%esi
  call   <_wqsort>
  mov    0xc(%rsp),%eax
  mov    %eax,0x18(%rsp)
  jmp    L28
L96:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void _wqsort(base, lo, hi, cmp) register int *base;
register int lo;
register int hi;
register int (*cmp)();
{
  int k;
  register int i, j, t;
  register int *p = &k;
  while (hi > lo) {
    i = lo;
    j = hi;
    t = ((i + j) >> 1);
    *p = base[t];
    base[t] = base[i];
    base[i] = *p;
    while (i < j) {
      while (((*cmp)((base + j), p)) <= 0)
        --j;
      base[i] = base[j];
      while ((i < j) && (((*cmp)((base + i), p)) > 0))
        ++i;
      base[j] = base[i];
    }
    base[i] = *p;
    if ((i - lo) < (hi - i)) {
      _wqsort(base, lo, (i - 1), cmp);
      lo = i + 1;
    } else {
      _wqsort(base, (i + 1), hi, cmp);
      hi = i - 1;
    }
  }
}
```