user: What is the c source code of the assembly code below?

```asm
<mergei_v2>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x50,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %esi,-0x3c(%rbp)
  mov    %edx,-0x40(%rbp)
  mov    %ecx,-0x44(%rbp)
  mov    -0x40(%rbp),%eax
  sub    -0x3c(%rbp),%eax
  add    $0x1,%eax
  mov    %eax,-0x18(%rbp)
  mov    -0x44(%rbp),%eax
  sub    -0x40(%rbp),%eax
  add    $0x1,%eax
  mov    %eax,-0x14(%rbp)
  movq   $0x0,-0x10(%rbp)
  movq   $0x0,-0x8(%rbp)
  movl   $0x0,-0x24(%rbp)
  movl   $0x0,-0x20(%rbp)
  cmpq   $0x0,-0x38(%rbp)
  je     L113
  mov    -0x3c(%rbp),%eax
  cmp    -0x40(%rbp),%eax
  jg     L113
  mov    -0x40(%rbp),%eax
  cmp    -0x44(%rbp),%eax
  jg     L113
  mov    $0x1,%eax
  jmp    L87
L113:
  mov    $0x0,%eax
L87:
  mov    %eax,%edi
  call   <assert@plt>
  mov    -0x18(%rbp),%eax
  cltq
  shl    $0x2,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x10(%rbp)
  mov    -0x14(%rbp),%eax
  cltq
  shl    $0x2,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x8(%rbp)
  cmpq   $0x0,-0x10(%rbp)
  je     L62
  cmpq   $0x0,-0x8(%rbp)
  jne    L118
L62:
  mov    -0x10(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    $0x1,%eax
  jmp    L105
L118:
  mov    -0x18(%rbp),%eax
  sub    $0x1,%eax
  cltq
  shl    $0x2,%eax
  mov    %eax,%edx
  mov    -0x3c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rcx
  mov    -0x38(%rbp),%rax
  add    %rax,%rcx
  mov    -0x10(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  mov    -0x14(%rbp),%eax
  sub    $0x1,%eax
  cltq
  shl    $0x2,%eax
  mov    %eax,%edx
  mov    -0x40(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rcx
  mov    -0x38(%rbp),%rax
  add    %rax,%rcx
  mov    -0x8(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  mov    -0x14(%rbp),%eax
  cltq
  shl    $0x2,%rax
  lea    -0x4(%rax),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  mov    D6(%rip),%rdx
  mov    (%rdx),%edx
  mov    %edx,(%rax)
  mov    -0x18(%rbp),%edx
  movslq %edx,%rdx
  shl    $0x2,%rdx
  lea    -0x4(%rdx),%rcx
  mov    -0x10(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rax),%eax
  mov    %eax,(%rdx)
  mov    -0x3c(%rbp),%eax
  mov    %eax,-0x1c(%rbp)
  jmp    L48
L52:
  mov    -0x24(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x10(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  mov    -0x20(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rcx
  mov    -0x8(%rbp),%rax
  add    %rcx,%rax
  mov    (%rax),%eax
  cmp    %eax,%edx
  jge    L67
  mov    -0x24(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x24(%rbp)
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x10(%rbp),%rax
  add    %rdx,%rax
  mov    -0x1c(%rbp),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,4),%rcx
  mov    -0x38(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rax),%eax
  mov    %eax,(%rdx)
  jmp    L103
L67:
  mov    -0x20(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  mov    -0x24(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rcx
  mov    -0x10(%rbp),%rax
  add    %rcx,%rax
  mov    (%rax),%eax
  cmp    %eax,%edx
  jge    L103
  mov    -0x20(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x20(%rbp)
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  mov    -0x1c(%rbp),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,4),%rcx
  mov    -0x38(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rax),%eax
  mov    %eax,(%rdx)
L103:
  addl   $0x1,-0x1c(%rbp)
L48:
  mov    -0x1c(%rbp),%eax
  cmp    -0x44(%rbp),%eax
  jl     L52
  mov    -0x10(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    $0x0,%eax
L105:
  leave
  ret
```

assistant: ```c
int mergei_v2(int arr[], int lb, int mid, int ub) {
  int m = mid - lb + 1;
  int n = ub - mid + 1;
  int *left = NULL;
  int *right = NULL;
  int i = 0;
  int j = 0;
  int k;
  assert(arr != NULL && lb <= mid && mid <= ub);
  left = malloc(m * sizeof(int));
  right = malloc(n * sizeof(int));
  if (left == NULL || right == NULL) {
    free(left);
    free(right);
    return 1;
  }
  memcpy(left, arr + lb, (m - 1) * sizeof(int));
  memcpy(right, arr + mid, (n - 1) * sizeof(int));
  left[m - 1] = right[n - 1] = INT_MAX;
  for (k = lb; k < ub; ++k) {
    if (left[i] < right[j])
      arr[k] = left[i++];
    else if (right[j] < left[i])
      arr[k] = right[j++];
  }
  free(left);
  free(right);
  return 0;
}
```