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

```asm
<mergeSortWithinBounds>:
  endbr64
  cmp    %r8d,%ecx
  jl     L8
  ret
  nopw   0x0(%rax,%rax,1)
L8:
  lea    (%rcx,%r8,1),%eax
  push   %r15
  mov    %rdx,%r15
  push   %r14
  mov    %rsi,%r14
  push   %r13
  mov    %rdi,%r13
  push   %r12
  mov    %ecx,%r12d
  push   %rbp
  mov    %eax,%ebp
  push   %rbx
  shr    $0x1f,%ebp
  mov    %r8d,%ebx
  add    %eax,%ebp
  sar    %ebp
  sub    $0x18,%rsp
  cmp    %ebp,%ecx
  jl     L120
  add    $0x1,%ebp
  cmp    %ebx,%ebp
  jl     L47
L42:
  add    $0x18,%rsp
  mov    %ebx,%r9d
  mov    %ebp,%r8d
  mov    %r12d,%ecx
  pop    %rbx
  mov    %r15,%rdx
  pop    %rbp
  mov    %r14,%rsi
  pop    %r12
  mov    %r13,%rdi
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    1050 <mergeSortMerge@plt>
  nopw   0x0(%rax,%rax,1)
L120:
  lea    (%rcx,%rbp,1),%eax
  mov    %eax,%r10d
  shr    $0x1f,%r10d
  add    %eax,%r10d
  sar    %r10d
  cmp    %r10d,%ecx
  jl     L28
L17:
  add    $0x1,%r10d
  cmp    %r10d,%ebp
  jg     L79
L15:
  mov    %ebp,%r9d
  mov    %r10d,%r8d
  mov    %r12d,%ecx
  mov    %r15,%rdx
  mov    %r14,%rsi
  mov    %r13,%rdi
  add    $0x1,%ebp
  call   <mergeSortMerge@plt>
  cmp    %ebx,%ebp
  jge    L42
L47:
  lea    0x0(%rbp,%rbx,1),%eax
  mov    %eax,%r10d
  shr    $0x1f,%r10d
  add    %eax,%r10d
  sar    %r10d
  cmp    %r10d,%ebp
  jl     L77
L48:
  add    $0x1,%r10d
  cmp    %r10d,%ebx
  jg     L100
L37:
  mov    %ebx,%r9d
  mov    %r10d,%r8d
  mov    %ebp,%ecx
  mov    %r15,%rdx
  mov    %r14,%rsi
  mov    %r13,%rdi
  call   <mergeSortMerge@plt>
  jmp    L42
  nopw   0x0(%rax,%rax,1)
L28:
  lea    (%rcx,%r10,1),%eax
  mov    %r10d,0xc(%rsp)
  mov    %eax,%r8d
  shr    $0x1f,%r8d
  add    %eax,%r8d
  sar    %r8d
  mov    %r8d,0x8(%rsp)
  call   <mergeSortWithinBounds>
  mov    0x8(%rsp),%r8d
  mov    %r15,%rdx
  mov    %r14,%rsi
  mov    0xc(%rsp),%r10d
  mov    %r13,%rdi
  lea    0x1(%r8),%eax
  mov    %eax,%ecx
  mov    %r10d,%r8d
  mov    %r10d,0x8(%rsp)
  mov    %eax,0xc(%rsp)
  call   <mergeSortWithinBounds>
  mov    0x8(%rsp),%r9d
  mov    %r12d,%ecx
  mov    %r15,%rdx
  mov    0xc(%rsp),%r8d
  mov    %r14,%rsi
  mov    %r13,%rdi
  call   <mergeSortMerge@plt>
  mov    0x8(%rsp),%r10d
  jmp    L17
  nopw   0x0(%rax,%rax,1)
L100:
  lea    (%rbx,%r10,1),%eax
  mov    %r10d,%ecx
  mov    %r15,%rdx
  mov    %r14,%rsi
  mov    %eax,%r8d
  mov    %r13,%rdi
  mov    %r10d,0xc(%rsp)
  shr    $0x1f,%r8d
  add    %eax,%r8d
  sar    %r8d
  mov    %r8d,0x8(%rsp)
  call   <mergeSortWithinBounds>
  mov    0x8(%rsp),%r8d
  mov    %r15,%rdx
  mov    %r14,%rsi
  mov    %r13,%rdi
  lea    0x1(%r8),%eax
  mov    %ebx,%r8d
  mov    %eax,%ecx
  mov    %eax,0x8(%rsp)
  call   <mergeSortWithinBounds>
  mov    0xc(%rsp),%r10d
  mov    %ebx,%r9d
  mov    %r15,%rdx
  mov    0x8(%rsp),%r8d
  mov    %r14,%rsi
  mov    %r13,%rdi
  mov    %r10d,%ecx
  mov    %r10d,0x8(%rsp)
  call   <mergeSortMerge@plt>
  mov    0x8(%rsp),%r10d
  jmp    L37
  nopl   0x0(%rax)
L77:
  lea    0x0(%rbp,%r10,1),%eax
  mov    %ebp,%ecx
  mov    %r15,%rdx
  mov    %r14,%rsi
  mov    %eax,%r8d
  mov    %r13,%rdi
  mov    %r10d,0xc(%rsp)
  shr    $0x1f,%r8d
  add    %eax,%r8d
  sar    %r8d
  mov    %r8d,0x8(%rsp)
  call   <mergeSortWithinBounds>
  mov    0x8(%rsp),%r8d
  mov    %r15,%rdx
  mov    %r14,%rsi
  mov    0xc(%rsp),%r10d
  mov    %r13,%rdi
  lea    0x1(%r8),%eax
  mov    %eax,%ecx
  mov    %r10d,%r8d
  mov    %r10d,0x8(%rsp)
  mov    %eax,0xc(%rsp)
  call   <mergeSortWithinBounds>
  mov    0x8(%rsp),%r9d
  mov    %ebp,%ecx
  mov    %r15,%rdx
  mov    0xc(%rsp),%r8d
  mov    %r14,%rsi
  mov    %r13,%rdi
  call   <mergeSortMerge@plt>
  mov    0x8(%rsp),%r10d
  jmp    L48
  nopw   0x0(%rax,%rax,1)
L79:
  lea    0x0(%rbp,%r10,1),%eax
  mov    %r10d,%ecx
  mov    %r15,%rdx
  mov    %r14,%rsi
  mov    %eax,%r8d
  mov    %r13,%rdi
  mov    %r10d,0xc(%rsp)
  shr    $0x1f,%r8d
  add    %eax,%r8d
  sar    %r8d
  mov    %r8d,0x8(%rsp)
  call   <mergeSortWithinBounds>
  mov    0x8(%rsp),%r8d
  mov    %r15,%rdx
  mov    %r14,%rsi
  mov    %r13,%rdi
  lea    0x1(%r8),%eax
  mov    %ebp,%r8d
  mov    %eax,%ecx
  mov    %eax,0x8(%rsp)
  call   <mergeSortWithinBounds>
  mov    0xc(%rsp),%r10d
  mov    %ebp,%r9d
  mov    %r15,%rdx
  mov    0x8(%rsp),%r8d
  mov    %r14,%rsi
  mov    %r13,%rdi
  mov    %r10d,%ecx
  mov    %r10d,0x8(%rsp)
  call   <mergeSortMerge@plt>
  mov    0x8(%rsp),%r10d
  jmp    L15
```

assistant: ```c
void mergeSortWithinBounds(double *array, int *sorted, int *tosort, int p, int q) {
  int r;
  if (p < q) {
    r = (p + q) / 2;
    mergeSortWithinBounds(array, sorted, tosort, p, r);
    mergeSortWithinBounds(array, sorted, tosort, r + 1, q);
    mergeSortMerge(array, sorted, tosort, p, r + 1, q);
  }
}
```