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

```asm
<sorter_grail_merge_buffers_left_with_x_buf>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x60,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %rsi,-0x40(%rbp)
  mov    %rdx,-0x48(%rbp)
  mov    %ecx,-0x4c(%rbp)
  mov    %r8d,-0x50(%rbp)
  mov    %r9d,-0x54(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  cmpl   $0x0,-0x4c(%rbp)
  jne    L38
  mov    -0x54(%rbp),%eax
  imul   -0x50(%rbp),%eax
  mov    %eax,-0xc(%rbp)
  mov    -0x50(%rbp),%eax
  neg    %eax
  mov    %eax,%edx
  mov    -0xc(%rbp),%esi
  mov    -0x48(%rbp),%rax
  mov    %edx,%ecx
  mov    0x10(%rbp),%edx
  mov    %rax,%rdi
  call   <sorter_grail_merge_left_with_x_buf@plt>
  jmp    L89
L38:
  mov    -0x50(%rbp),%eax
  mov    %eax,-0x24(%rbp)
  mov    -0x38(%rbp),%rax
  mov    (%rax),%rdx
  mov    -0x40(%rbp),%rax
  mov    (%rax),%rcx
  mov    %rdx,%rax
  sub    %rcx,%rax
  not    %rax
  shr    $0x3f,%rax
  movzbl %al,%eax
  mov    %eax,-0x20(%rbp)
  mov    -0x50(%rbp),%eax
  mov    %eax,-0x18(%rbp)
  movl   $0x1,-0x14(%rbp)
  jmp    L64
L24:
  mov    -0x24(%rbp),%edx
  mov    -0x18(%rbp),%eax
  sub    %edx,%eax
  mov    %eax,-0x1c(%rbp)
  mov    -0x14(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x40(%rbp),%rax
  mov    (%rax),%rcx
  mov    %rdx,%rax
  sub    %rcx,%rax
  not    %rax
  shr    $0x3f,%rax
  movzbl %al,%eax
  mov    %eax,-0x10(%rbp)
  mov    -0x20(%rbp),%eax
  cmp    %eax,-0x10(%rbp)
  jne    L25
  mov    -0x24(%rbp),%eax
  cltq
  shl    $0x3,%eax
  mov    %eax,%esi
  mov    -0x1c(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x48(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x1c(%rbp),%eax
  cltq
  mov    -0x50(%rbp),%edx
  movslq %edx,%rdx
  sub    %rdx,%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    %esi,%edx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  mov    -0x18(%rbp),%eax
  mov    %eax,-0x1c(%rbp)
  mov    -0x50(%rbp),%eax
  mov    %eax,-0x24(%rbp)
  jmp    L109
L25:
  mov    -0x1c(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x48(%rbp),%rax
  lea    (%rdx,%rax,1),%rdi
  mov    -0x50(%rbp),%esi
  mov    -0x50(%rbp),%ecx
  lea    -0x20(%rbp),%rdx
  lea    -0x24(%rbp),%rax
  mov    %esi,%r8d
  mov    %rax,%rsi
  call   <sorter_grail_smart_merge_with_x_buf@plt>
L109:
  addl   $0x1,-0x14(%rbp)
  mov    -0x50(%rbp),%eax
  add    %eax,-0x18(%rbp)
L64:
  mov    -0x14(%rbp),%eax
  cmp    -0x4c(%rbp),%eax
  jl     L24
  mov    -0x24(%rbp),%edx
  mov    -0x18(%rbp),%eax
  sub    %edx,%eax
  mov    %eax,-0x1c(%rbp)
  cmpl   $0x0,0x10(%rbp)
  je     L71
  mov    -0x20(%rbp),%eax
  test   %eax,%eax
  je     L60
  mov    -0x24(%rbp),%eax
  cltq
  shl    $0x3,%eax
  mov    %eax,%esi
  mov    -0x1c(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x48(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x1c(%rbp),%eax
  cltq
  mov    -0x50(%rbp),%edx
  movslq %edx,%rdx
  sub    %rdx,%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    %esi,%edx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  mov    -0x18(%rbp),%eax
  mov    %eax,-0x1c(%rbp)
  mov    -0x50(%rbp),%eax
  imul   -0x54(%rbp),%eax
  mov    %eax,-0x24(%rbp)
  movl   $0x0,-0x20(%rbp)
  jmp    L65
L60:
  mov    -0x50(%rbp),%eax
  imul   -0x54(%rbp),%eax
  mov    %eax,%edx
  mov    -0x24(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x24(%rbp)
L65:
  mov    -0x50(%rbp),%eax
  neg    %eax
  mov    %eax,%edx
  mov    -0x24(%rbp),%eax
  mov    -0x1c(%rbp),%ecx
  movslq %ecx,%rcx
  lea    0x0(,%rcx,8),%rsi
  mov    -0x48(%rbp),%rcx
  lea    (%rsi,%rcx,1),%rdi
  mov    %edx,%ecx
  mov    0x10(%rbp),%edx
  mov    %eax,%esi
  call   <sorter_grail_merge_left_with_x_buf@plt>
  jmp    L89
L71:
  mov    -0x24(%rbp),%eax
  cltq
  shl    $0x3,%eax
  mov    %eax,%esi
  mov    -0x1c(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x48(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x1c(%rbp),%eax
  cltq
  mov    -0x50(%rbp),%edx
  movslq %edx,%rdx
  sub    %rdx,%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    %esi,%edx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
L89:
  mov    -0x8(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L2
  call   <__stack_chk_fail@plt>
L2:
  leave
  ret
```

assistant: ```c
void sorter_grail_merge_buffers_left_with_x_buf(int64_t *keys, int64_t *midkey, int64_t *arr, int nblock, int lblock, int nblock2, int llast) {
  int l, prest, lrest, frest, pidx, cidx, fnext;
  if (nblock == 0) {
    l = nblock2 * lblock;
    sorter_grail_merge_left_with_x_buf(arr, l, llast, -lblock);
    return;
  }
  lrest = lblock;
  frest = ((*(keys)) - (*(midkey))) < 0 ? 0 : 1;
  pidx = lblock;
  for (cidx = 1; cidx < nblock; cidx++, pidx += lblock) {
    prest = pidx - lrest;
    fnext = ((*(keys + cidx)) - (*(midkey))) < 0 ? 0 : 1;
    if (fnext == frest) {
      memcpy(arr + prest - lblock, arr + prest, lrest * sizeof(int64_t));
      prest = pidx;
      lrest = lblock;
    } else {
      sorter_grail_smart_merge_with_x_buf(arr + prest, &lrest, &frest, lblock, lblock);
    }
  }
  prest = pidx - lrest;
  if (llast) {
    if (frest) {
      memcpy(arr + prest - lblock, arr + prest, lrest * sizeof(int64_t));
      prest = pidx;
      lrest = lblock * nblock2;
      frest = 0;
    } else {
      lrest += lblock * nblock2;
    }
    sorter_grail_merge_left_with_x_buf(arr + prest, lrest, llast, -lblock);
  } else {
    memcpy(arr + prest - lblock, arr + prest, lrest * sizeof(int64_t));
  }
}
```