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

```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    $0x3,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x10(%rbp)
  mov    -0x18(%rbp),%rax
  shl    $0x3,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x8(%rbp)
  movq   $0x0,-0x38(%rbp)
  jmp    L64
L2:
  mov    -0x50(%rbp),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    -0x38(%rbp),%rdx
  lea    0x0(,%rdx,8),%rcx
  mov    -0x10(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rax),%rax
  mov    %rax,(%rdx)
  addq   $0x1,-0x38(%rbp)
L64:
  mov    -0x38(%rbp),%rax
  cmp    -0x20(%rbp),%rax
  jl     L2
  movq   $0x0,-0x38(%rbp)
  jmp    L98
L37:
  mov    -0x58(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    -0x38(%rbp),%rdx
  lea    0x0(,%rdx,8),%rcx
  mov    -0x8(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rax),%rax
  mov    %rax,(%rdx)
  addq   $0x1,-0x38(%rbp)
L98:
  mov    -0x38(%rbp),%rax
  cmp    -0x18(%rbp),%rax
  jl     L37
  movq   $0x0,-0x38(%rbp)
  movq   $0x0,-0x30(%rbp)
  mov    -0x50(%rbp),%rax
  mov    %rax,-0x28(%rbp)
  jmp    L10
L39:
  mov    -0x38(%rbp),%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x10(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x30(%rbp),%rax
  lea    0x0(,%rax,8),%rcx
  mov    -0x8(%rbp),%rax
  add    %rcx,%rax
  mov    (%rax),%rax
  cmp    %rax,%rdx
  jge    L5
  mov    -0x38(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x38(%rbp)
  lea    0x0(,%rax,8),%rdx
  mov    -0x10(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x28(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x28(%rbp)
  lea    0x0(,%rax,8),%rdx
  mov    -0x48(%rbp),%rax
  add    %rax,%rdx
  mov    (%rcx),%rax
  mov    %rax,(%rdx)
  jmp    L10
L5:
  mov    -0x30(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x30(%rbp)
  lea    0x0(,%rax,8),%rdx
  mov    -0x8(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x28(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x28(%rbp)
  lea    0x0(,%rax,8),%rdx
  mov    -0x48(%rbp),%rax
  add    %rax,%rdx
  mov    (%rcx),%rax
  mov    %rax,(%rdx)
L10:
  mov    -0x38(%rbp),%rax
  cmp    -0x20(%rbp),%rax
  jge    L119
  mov    -0x30(%rbp),%rax
  cmp    -0x18(%rbp),%rax
  jl     L39
  jmp    L119
L124:
  mov    -0x38(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x38(%rbp)
  lea    0x0(,%rax,8),%rdx
  mov    -0x10(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x28(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x28(%rbp)
  lea    0x0(,%rax,8),%rdx
  mov    -0x48(%rbp),%rax
  add    %rax,%rdx
  mov    (%rcx),%rax
  mov    %rax,(%rdx)
L119:
  mov    -0x38(%rbp),%rax
  cmp    -0x20(%rbp),%rax
  jl     L124
  jmp    L47
L0:
  mov    -0x30(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x30(%rbp)
  lea    0x0(,%rax,8),%rdx
  mov    -0x8(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x28(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x28(%rbp)
  lea    0x0(,%rax,8),%rdx
  mov    -0x48(%rbp),%rax
  add    %rax,%rdx
  mov    (%rcx),%rax
  mov    %rax,(%rdx)
L47:
  mov    -0x30(%rbp),%rax
  cmp    -0x18(%rbp),%rax
  jl     L0
  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(long arr[], long start, long mid, long end) {
  long len_l = mid - start + 1;
  long len_r = end - mid;
  long *l = (long *)malloc(sizeof(long) * len_l);
  long *r = (long *)malloc(sizeof(long) * len_r);
  long i, j, k;
  for (i = 0; i < len_l; i++)
    l[i] = arr[start + i];
  for (i = 0; i < len_r; i++)
    r[i] = arr[mid + 1 + i];
  i = 0;
  j = 0;
  k = start;
  while (i < len_l && j < len_r) {
    if (l[i] < r[j])
      arr[k++] = l[i++];
    else
      arr[k++] = r[j++];
  }
  while (i < len_l)
    arr[k++] = l[i++];
  while (j < len_r)
    arr[k++] = r[j++];
  free(l);
  free(r);
}
```