user: 请从给定的汇编指令推导出C源代码:

```asm
<merge>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x60,%rsp
  mov    %rdi,-0x48(%rbp)
  mov    %rsi,-0x50(%rbp)
  mov    %rdx,-0x58(%rbp)
  mov    %rcx,-0x60(%rbp)
  mov    -0x58(%rbp),%rax
  sub    -0x50(%rbp),%rax
  add    $0x1,%rax
  mov    %rax,-0x20(%rbp)
  mov    -0x60(%rbp),%rax
  sub    -0x58(%rbp),%rax
  mov    %rax,-0x18(%rbp)
  mov    -0x20(%rbp),%rax
  shl    $0x2,%rax
  mov    %rax,%rdi
  call   <malloc@plt>
  mov    %rax,-0x10(%rbp)
  mov    -0x18(%rbp),%rax
  shl    $0x2,%rax
  mov    %rax,%rdi
  call   <malloc@plt>
  mov    %rax,-0x8(%rbp)
  mov    -0x20(%rbp),%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x50(%rbp),%rax
  lea    0x0(,%rax,4),%rcx
  mov    -0x48(%rbp),%rax
  add    %rax,%rcx
  mov    -0x10(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  mov    -0x18(%rbp),%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x58(%rbp),%rax
  add    $0x1,%rax
  lea    0x0(,%rax,4),%rcx
  mov    -0x48(%rbp),%rax
  add    %rax,%rcx
  mov    -0x8(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  movq   $0x0,-0x28(%rbp)
  mov    -0x28(%rbp),%rax
  mov    %rax,-0x30(%rbp)
  mov    -0x50(%rbp),%rax
  mov    %eax,-0x34(%rbp)
  jmp    L2
L26:
  mov    -0x30(%rbp),%rax
  cmp    -0x20(%rbp),%rax
  jne    L78
  mov    -0x28(%rbp),%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  mov    -0x34(%rbp),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,4),%rcx
  mov    -0x48(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rax),%eax
  mov    %eax,(%rdx)
  addq   $0x1,-0x28(%rbp)
  jmp    L47
L78:
  mov    -0x28(%rbp),%rax
  cmp    -0x18(%rbp),%rax
  jne    L59
  mov    -0x30(%rbp),%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x10(%rbp),%rax
  add    %rdx,%rax
  mov    -0x34(%rbp),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,4),%rcx
  mov    -0x48(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rax),%eax
  mov    %eax,(%rdx)
  addq   $0x1,-0x30(%rbp)
  jmp    L47
L59:
  mov    -0x30(%rbp),%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x10(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  mov    -0x28(%rbp),%rax
  lea    0x0(,%rax,4),%rcx
  mov    -0x8(%rbp),%rax
  add    %rcx,%rax
  mov    (%rax),%eax
  cmp    %eax,%edx
  jg     L7
  mov    -0x30(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x30(%rbp)
  lea    0x0(,%rax,4),%rdx
  mov    -0x10(%rbp),%rax
  add    %rdx,%rax
  mov    -0x34(%rbp),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,4),%rcx
  mov    -0x48(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rax),%eax
  mov    %eax,(%rdx)
  jmp    L47
L7:
  mov    -0x28(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x28(%rbp)
  lea    0x0(,%rax,4),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  mov    -0x34(%rbp),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,4),%rcx
  mov    -0x48(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rax),%eax
  mov    %eax,(%rdx)
L47:
  addl   $0x1,-0x34(%rbp)
L2:
  mov    -0x34(%rbp),%eax
  cltq
  cmp    %rax,-0x60(%rbp)
  jae    L26
  mov    -0x10(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  nop
  leave
  ret
```

assistant: ```c
void merge(int a[], size_t p, size_t q, size_t r) {
  size_t n1 = q - p + 1;
  size_t n2 = r - q;
  size_t i, j;
  int *a1 = (int *)malloc(n1 * sizeof(int));
  int *a2 = (int *)malloc(n2 * sizeof(int));
  memcpy(a1, &a[p], n1 * sizeof(int));
  memcpy(a2, &a[q + 1], n2 * sizeof(int));
  i = j = 0;
  for (int k = p; k <= r; ++k) {
    if (i == n1) {
      a[k] = a2[j];
      ++j;
      continue;
    }
    if (j == n2) {
      a[k] = a1[i];
      ++i;
      continue;
    }
    if (a1[i] <= a2[j]) {
      a[k] = a1[i++];
    } else {
      a[k] = a2[j++];
    }
  }
  free(a1);
  free(a2);
}
```