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

```asm
<mergesort_rec>:
  endbr64
  cmp    %edx,%ecx
  jg     L34
  ret
  nopl   0x0(%rax)
L34:
  lea    (%rcx,%rdx,1),%eax
  push   %r15
  mov    %eax,%r15d
  push   %r14
  mov    %r9,%r14
  push   %r13
  shr    $0x1f,%r15d
  mov    %r8,%r13
  push   %r12
  add    %eax,%r15d
  mov    %edx,%r12d
  push   %rbp
  sar    %r15d
  mov    %rdi,%rbp
  push   %rbx
  mov    %ecx,%ebx
  sub    $0x28,%rsp
  cmp    %r15d,%edx
  jl     L118
  lea    0x1(%r15),%r10d
  cmp    %ebx,%r10d
  jl     L28
L89:
  sub    $0x8,%rsp
  mov    %r13,%r9
  mov    %ebx,%r8d
  mov    %r15d,%ecx
  push   %r14
  mov    %r12d,%edx
  mov    %rbp,%rdi
  call   <merge@plt>
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L118:
  lea    (%rdx,%r15,1),%eax
  mov    %eax,%r10d
  shr    $0x1f,%r10d
  add    %eax,%r10d
  sar    %r10d
  cmp    %r10d,%edx
  jl     L26
L83:
  lea    0x1(%r10),%r11d
  cmp    %r11d,%r15d
  jg     L73
L33:
  sub    $0x8,%rsp
  mov    %r13,%r9
  mov    %r10d,%ecx
  mov    %r15d,%r8d
  push   %r14
  mov    %r12d,%edx
  mov    %rbp,%rdi
  mov    %rsi,0x10(%rsp)
  call   <merge@plt>
  pop    %r9
  pop    %r10
  lea    0x1(%r15),%r10d
  mov    (%rsp),%rsi
  cmp    %ebx,%r10d
  jge    L89
L28:
  lea    (%r10,%rbx,1),%eax
  mov    %eax,%r11d
  shr    $0x1f,%r11d
  add    %eax,%r11d
  sar    %r11d
  cmp    %r11d,%r10d
  jl     L56
L50:
  lea    0x1(%r11),%eax
  cmp    %eax,%ebx
  jg     L59
L24:
  sub    $0x8,%rsp
  mov    %r10d,%edx
  mov    %r13,%r9
  mov    %ebx,%r8d
  push   %r14
  mov    %r11d,%ecx
  mov    %rbp,%rdi
  mov    %rsi,0x10(%rsp)
  call   <merge@plt>
  pop    %rax
  pop    %rdx
  mov    (%rsp),%rsi
  jmp    L89
  nopl   0x0(%rax,%rax,1)
L26:
  lea    (%rdx,%r10,1),%eax
  mov    %r10d,0x18(%rsp)
  mov    %eax,%r11d
  mov    %rsi,(%rsp)
  shr    $0x1f,%r11d
  add    %eax,%r11d
  sar    %r11d
  mov    %r11d,%ecx
  mov    %r11d,0x8(%rsp)
  call   <mergesort_rec>
  mov    0x8(%rsp),%r11d
  mov    %r14,%r9
  mov    %r13,%r8
  mov    0x18(%rsp),%r10d
  mov    (%rsp),%rsi
  mov    %rbp,%rdi
  lea    0x1(%r11),%edx
  mov    %r11d,0x14(%rsp)
  mov    %r10d,%ecx
  mov    %r10d,0x8(%rsp)
  call   <mergesort_rec>
  sub    $0x8,%rsp
  mov    %r12d,%edx
  mov    %r13,%r9
  push   %r14
  mov    0x10(%rsp),%rsi
  mov    %rbp,%rdi
  mov    0x18(%rsp),%r8d
  mov    0x24(%rsp),%ecx
  call   <merge@plt>
  pop    %rax
  pop    %rdx
  mov    0x8(%rsp),%r10d
  mov    (%rsp),%rsi
  jmp    L83
  cs nopw 0x0(%rax,%rax,1)
L59:
  lea    (%rbx,%rax,1),%ecx
  mov    %r14,%r9
  mov    %r13,%r8
  mov    %rbp,%rdi
  mov    %ecx,%edx
  mov    %r11d,0x1c(%rsp)
  shr    $0x1f,%edx
  mov    %r10d,0x18(%rsp)
  add    %ecx,%edx
  mov    %eax,0x14(%rsp)
  sar    %edx
  mov    %rsi,0x8(%rsp)
  mov    %edx,(%rsp)
  mov    %edx,%ecx
  mov    %eax,%edx
  call   <mergesort_rec>
  mov    (%rsp),%edx
  mov    0x8(%rsp),%rsi
  mov    %r14,%r9
  mov    %r13,%r8
  mov    %ebx,%ecx
  mov    %rbp,%rdi
  add    $0x1,%edx
  call   <mergesort_rec>
  sub    $0x8,%rsp
  mov    %r13,%r9
  mov    %ebx,%r8d
  push   %r14
  mov    0x10(%rsp),%ecx
  mov    %rbp,%rdi
  mov    0x18(%rsp),%rsi
  mov    0x24(%rsp),%edx
  mov    %rsi,0x10(%rsp)
  call   <merge@plt>
  pop    %rcx
  pop    %rsi
  mov    0x1c(%rsp),%r11d
  mov    0x18(%rsp),%r10d
  mov    (%rsp),%rsi
  jmp    L24
  nopw   0x0(%rax,%rax,1)
L56:
  lea    (%r10,%r11,1),%edx
  mov    %r14,%r9
  mov    %r13,%r8
  mov    %rbp,%rdi
  mov    %edx,%eax
  mov    %r11d,0x14(%rsp)
  shr    $0x1f,%eax
  mov    %r10d,0x1c(%rsp)
  add    %edx,%eax
  mov    %r10d,%edx
  mov    %rsi,(%rsp)
  sar    %eax
  mov    %eax,%ecx
  mov    %eax,0x8(%rsp)
  call   <mergesort_rec>
  mov    0x8(%rsp),%eax
  mov    (%rsp),%rsi
  mov    %r14,%r9
  mov    0x14(%rsp),%r11d
  mov    %r13,%r8
  mov    %rbp,%rdi
  lea    0x1(%rax),%edx
  mov    %eax,0x18(%rsp)
  mov    %r11d,%ecx
  mov    %r11d,0x8(%rsp)
  call   <mergesort_rec>
  sub    $0x8,%rsp
  mov    %rbp,%rdi
  mov    %r13,%r9
  push   %r14
  mov    0x18(%rsp),%r11d
  mov    0x2c(%rsp),%r10d
  mov    0x10(%rsp),%rsi
  mov    0x28(%rsp),%ecx
  mov    %r11d,%r8d
  mov    %r10d,%edx
  mov    %r11d,0x24(%rsp)
  mov    %r10d,0x18(%rsp)
  call   <merge@plt>
  pop    %rdi
  pop    %r8
  mov    0x14(%rsp),%r11d
  mov    0x8(%rsp),%r10d
  mov    (%rsp),%rsi
  jmp    L50
  cs nopw 0x0(%rax,%rax,1)
L73:
  lea    (%r15,%r11,1),%edx
  mov    %r14,%r9
  mov    %r13,%r8
  mov    %rbp,%rdi
  mov    %edx,%eax
  mov    %r10d,0x18(%rsp)
  shr    $0x1f,%eax
  mov    %r11d,0x14(%rsp)
  add    %edx,%eax
  mov    %r11d,%edx
  mov    %rsi,(%rsp)
  sar    %eax
  mov    %eax,%ecx
  mov    %eax,0x8(%rsp)
  call   <mergesort_rec>
  mov    0x8(%rsp),%eax
  mov    (%rsp),%rsi
  mov    %r14,%r9
  mov    %r13,%r8
  mov    %r15d,%ecx
  mov    %rbp,%rdi
  lea    0x1(%rax),%edx
  call   <mergesort_rec>
  sub    $0x8,%rsp
  mov    %r13,%r9
  mov    %r15d,%r8d
  push   %r14
  mov    0x10(%rsp),%rsi
  mov    %rbp,%rdi
  mov    0x18(%rsp),%ecx
  mov    0x24(%rsp),%edx
  call   <merge@plt>
  pop    %r11
  pop    %rax
  mov    0x18(%rsp),%r10d
  mov    (%rsp),%rsi
  jmp    L33
```

assistant: ```c
void mergesort_rec(void *base, void *helper, int left, int right, size_t size, int (*compare)(const void *, const void *)) {
  int mid;
  if (right > left) {
    mid = (right + left) / 2;
    mergesort_rec(base, helper, left, mid, size, compare);
    mergesort_rec(base, helper, (mid + 1), right, size, compare);
    merge(base, helper, left, mid, right, size, compare);
  }
}
```