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

```asm
<qsort>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbx
  sub    $0x48,%rsp
  mov    %rdi,-0x58(%rbp)
  mov    %esi,-0x5c(%rbp)
  mov    %edx,-0x60(%rbp)
  mov    %rcx,-0x68(%rbp)
  mov    -0x60(%rbp),%eax
  shl    $0x2,%eax
  mov    %eax,-0x48(%rbp)
  mov    -0x60(%rbp),%edx
  mov    %edx,%eax
  add    %eax,%eax
  add    %edx,%eax
  add    %eax,%eax
  mov    %eax,-0x44(%rbp)
  cmpl   $0x1,-0x5c(%rbp)
  jle    L27
  mov    -0x5c(%rbp),%eax
  imul   -0x60(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x58(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,-0x38(%rbp)
  cmpl   $0x3,-0x5c(%rbp)
  jle    L150
  mov    -0x44(%rbp),%r8d
  mov    -0x48(%rbp),%edi
  mov    -0x60(%rbp),%ecx
  mov    -0x68(%rbp),%rdx
  mov    -0x38(%rbp),%rsi
  mov    -0x58(%rbp),%rax
  mov    %r8d,%r9d
  mov    %edi,%r8d
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <qst@plt>
  mov    -0x48(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x58(%rbp),%rax
  lea    (%rdx,%rax,1),%rbx
  jmp    L9
L150:
  mov    -0x38(%rbp),%rbx
L9:
  mov    -0x58(%rbp),%r12
  mov    %r12,%r13
  jmp    L8
L85:
  mov    -0x68(%rbp),%rax
  mov    %r12,%rsi
  mov    %r13,%rdi
  call   *%rax
  test   %eax,%eax
  jle    L8
  mov    %r12,%r13
L8:
  mov    -0x60(%rbp),%eax
  cltq
  add    %rax,%r12
  cmp    %rbx,%r12
  jb     L85
  cmp    -0x58(%rbp),%r13
  je     L96
  mov    -0x58(%rbp),%r14
  mov    -0x60(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x58(%rbp),%rax
  lea    (%rdx,%rax,1),%rbx
  jmp    L142
L135:
  movzbl 0x0(%r13),%r15d
  mov    %r13,%rax
  lea    0x1(%rax),%r13
  movzbl (%r14),%edx
  mov    %dl,(%rax)
  mov    %r14,%rax
  lea    0x1(%rax),%r14
  mov    %r15b,(%rax)
L142:
  cmp    %rbx,%r14
  jb     L135
L96:
  mov    -0x58(%rbp),%rax
  mov    %rax,-0x40(%rbp)
  jmp    L76
L20:
  nop
L170:
  mov    -0x60(%rbp),%eax
  cltq
  neg    %rax
  add    %rax,%rbx
  mov    -0x40(%rbp),%rax
  mov    -0x68(%rbp),%rdx
  mov    %rax,%rsi
  mov    %rbx,%rdi
  call   *%rdx
  test   %eax,%eax
  jg     L170
  mov    -0x60(%rbp),%eax
  cltq
  add    %rax,%rbx
  cmp    -0x40(%rbp),%rbx
  je     L76
  mov    -0x60(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x40(%rbp),%rax
  lea    (%rdx,%rax,1),%r12
  jmp    L162
L164:
  movzbl (%r12),%r15d
  mov    %r12,%r13
  mov    %r13,%r14
  jmp    L61
L129:
  movzbl 0x0(%r13),%eax
  mov    %al,(%r14)
  mov    %r13,%r14
L61:
  mov    -0x60(%rbp),%eax
  cltq
  neg    %rax
  add    %rax,%r13
  cmp    %rbx,%r13
  jae    L129
  mov    %r15b,(%r14)
L162:
  sub    $0x1,%r12
  cmp    -0x40(%rbp),%r12
  jae    L164
L76:
  mov    -0x60(%rbp),%eax
  cltq
  add    %rax,-0x40(%rbp)
  mov    -0x40(%rbp),%rbx
  cmp    -0x38(%rbp),%rbx
  jb     L20
  jmp    L100
L27:
  nop
L100:
  add    $0x48,%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
```

assistant: ```c
void qsort(void *base, int n, int size, int (*compar)(void *, void *)) {
  register char c, *i, *j, *lo, *hi;
  char *min, *max;
  int thresh = size * 4;
  int mthresh = size * 6;
  if (n <= 1)
    return;
  max = (char *)base + n * size;
  if (n >= 4) {
    qst(base, max, compar, size, thresh, mthresh);
    hi = (char *)base + thresh;
  } else {
    hi = max;
  }
  for (j = lo = base; (lo += size) < hi;)
    if (compar(j, lo) > 0)
      j = lo;
  if (j != base) {
    for (i = (char *)base, hi = (char *)base + size; i < hi;) {
      c = *j;
      *j++ = *i;
      *i++ = c;
    }
  }
  for (min = base; (hi = min += size) < max;) {
    while (compar(hi -= size, min) > 0)
      ;
    if ((hi += size) != min) {
      for (lo = min + size; --lo >= min;) {
        c = *lo;
        for (i = j = lo; (j -= size) >= hi; i = j)
          *i = *j;
        *i = c;
      }
    }
  }
}
```