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

```asm
<stable_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    L55
  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
  mov    $0x0,%eax
  call   <stable_grail_merge_left_with_x_buf@plt>
  jmp    L100
L55:
  mov    -0x50(%rbp),%eax
  mov    %eax,-0x24(%rbp)
  mov    -0x38(%rbp),%rax
  mov    (%rax),%rax
  mov    (%rax),%edx
  mov    -0x40(%rbp),%rax
  mov    (%rax),%rax
  mov    (%rax),%ecx
  mov    %edx,%eax
  sub    %ecx,%eax
  not    %eax
  shr    $0x1f,%eax
  movzbl %al,%eax
  mov    %eax,-0x20(%rbp)
  mov    -0x50(%rbp),%eax
  mov    %eax,-0x18(%rbp)
  movl   $0x1,-0x14(%rbp)
  jmp    L53
L15:
  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),%rax
  mov    (%rax),%edx
  mov    -0x40(%rbp),%rax
  mov    (%rax),%rax
  mov    (%rax),%ecx
  mov    %edx,%eax
  sub    %ecx,%eax
  not    %eax
  shr    $0x1f,%eax
  movzbl %al,%eax
  mov    %eax,-0x10(%rbp)
  mov    -0x20(%rbp),%eax
  cmp    %eax,-0x10(%rbp)
  jne    L10
  mov    -0x24(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x1c(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rcx
  mov    -0x48(%rbp),%rax
  add    %rax,%rcx
  mov    -0x1c(%rbp),%eax
  cltq
  mov    -0x50(%rbp),%esi
  movslq %esi,%rsi
  sub    %rsi,%rax
  lea    0x0(,%rax,8),%rsi
  mov    -0x48(%rbp),%rax
  add    %rsi,%rax
  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    L33
L10:
  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
  mov    $0x0,%eax
  call   <stable_grail_smart_merge_with_x_buf@plt>
L33:
  addl   $0x1,-0x14(%rbp)
  mov    -0x50(%rbp),%eax
  add    %eax,-0x18(%rbp)
L53:
  mov    -0x14(%rbp),%eax
  cmp    -0x4c(%rbp),%eax
  jl     L15
  mov    -0x24(%rbp),%edx
  mov    -0x18(%rbp),%eax
  sub    %edx,%eax
  mov    %eax,-0x1c(%rbp)
  cmpl   $0x0,0x10(%rbp)
  je     L75
  mov    -0x20(%rbp),%eax
  test   %eax,%eax
  je     L65
  mov    -0x24(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x1c(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rcx
  mov    -0x48(%rbp),%rax
  add    %rax,%rcx
  mov    -0x1c(%rbp),%eax
  cltq
  mov    -0x50(%rbp),%esi
  movslq %esi,%rsi
  sub    %rsi,%rax
  lea    0x0(,%rax,8),%rsi
  mov    -0x48(%rbp),%rax
  add    %rsi,%rax
  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    L109
L65:
  mov    -0x50(%rbp),%eax
  imul   -0x54(%rbp),%eax
  mov    %eax,%edx
  mov    -0x24(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x24(%rbp)
L109:
  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
  mov    $0x0,%eax
  call   <stable_grail_merge_left_with_x_buf@plt>
  jmp    L100
L75:
  mov    -0x24(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x1c(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rcx
  mov    -0x48(%rbp),%rax
  add    %rax,%rcx
  mov    -0x1c(%rbp),%eax
  cltq
  mov    -0x50(%rbp),%esi
  movslq %esi,%rsi
  sub    %rsi,%rax
  lea    0x0(,%rax,8),%rsi
  mov    -0x48(%rbp),%rax
  add    %rsi,%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
L100:
  mov    -0x8(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L86
  call   <__stack_chk_fail@plt>
L86:
  leave
  ret
```

assistant: ```c
void stable_grail_merge_buffers_left_with_x_buf(int **keys, int **midkey, int **arr, int nblock, int lblock, int nblock2, int llast) {
  int l, prest, lrest, frest, pidx, cidx, fnext;
  if (nblock == 0) {
    l = nblock2 * lblock;
    stable_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(int *));
      prest = pidx;
      lrest = lblock;
    } else {
      stable_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(int *));
      prest = pidx;
      lrest = lblock * nblock2;
      frest = 0;
    } else {
      lrest += lblock * nblock2;
    }
    stable_grail_merge_left_with_x_buf(arr + prest, lrest, llast, -lblock);
  } else {
    memcpy((arr + prest - lblock), (arr + prest), (lrest) * sizeof(int *));
  }
}
```