user: Translate the below assembly code into C programming language:

```asm
<stable_grail_rec_merge>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %esi,-0x2c(%rbp)
  mov    %edx,-0x30(%rbp)
  cmpl   $0x2,-0x2c(%rbp)
  jle    L109
  cmpl   $0x2,-0x30(%rbp)
  jg     L94
L109:
  mov    -0x30(%rbp),%edx
  mov    -0x2c(%rbp),%ecx
  mov    -0x28(%rbp),%rax
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <stable_grail_merge_without_buffer@plt>
  jmp    L37
L94:
  mov    -0x2c(%rbp),%eax
  cmp    -0x30(%rbp),%eax
  jge    L43
  mov    -0x30(%rbp),%eax
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %edx,%eax
  sar    %eax
  mov    %eax,%edx
  mov    -0x2c(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x14(%rbp)
  jmp    L64
L43:
  mov    -0x2c(%rbp),%eax
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %edx,%eax
  sar    %eax
  mov    %eax,-0x14(%rbp)
L64:
  mov    -0x14(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x28(%rbp),%rax
  add    %rax,%rdx
  mov    -0x2c(%rbp),%ecx
  mov    -0x28(%rbp),%rax
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <stable_grail_bin_search_left@plt>
  mov    %eax,-0x10(%rbp)
  mov    -0x10(%rbp),%eax
  mov    %eax,-0x8(%rbp)
  mov    -0x10(%rbp),%eax
  cmp    -0x2c(%rbp),%eax
  jge    L3
  mov    -0x10(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  mov    (%rax),%edx
  mov    -0x14(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rcx
  mov    -0x28(%rbp),%rax
  add    %rcx,%rax
  mov    (%rax),%rax
  mov    (%rax),%eax
  cmp    %eax,%edx
  jne    L3
  mov    -0x14(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x28(%rbp),%rax
  add    %rax,%rdx
  mov    -0x2c(%rbp),%eax
  sub    -0x8(%rbp),%eax
  mov    -0x8(%rbp),%ecx
  movslq %ecx,%rcx
  lea    0x0(,%rcx,8),%rsi
  mov    -0x28(%rbp),%rcx
  add    %rsi,%rcx
  mov    %eax,%esi
  mov    %rcx,%rdi
  call   <stable_grail_bin_search_right@plt>
  mov    -0x8(%rbp),%edx
  add    %edx,%eax
  mov    %eax,-0x10(%rbp)
L3:
  mov    -0x14(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x28(%rbp),%rax
  add    %rax,%rdx
  mov    -0x2c(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rcx
  mov    -0x28(%rbp),%rax
  add    %rax,%rcx
  mov    -0x30(%rbp),%eax
  mov    %eax,%esi
  mov    %rcx,%rdi
  call   <stable_grail_bin_search_left@plt>
  mov    %eax,-0x4(%rbp)
  mov    -0x4(%rbp),%eax
  mov    %eax,-0xc(%rbp)
  mov    -0xc(%rbp),%eax
  cmp    -0x30(%rbp),%eax
  jge    L22
  mov    -0x2c(%rbp),%eax
  movslq %eax,%rdx
  mov    -0xc(%rbp),%eax
  cltq
  add    %rdx,%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  mov    (%rax),%edx
  mov    -0x14(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rcx
  mov    -0x28(%rbp),%rax
  add    %rcx,%rax
  mov    (%rax),%rax
  mov    (%rax),%eax
  cmp    %eax,%edx
  jne    L22
  mov    -0x14(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x28(%rbp),%rax
  add    %rax,%rdx
  mov    -0x30(%rbp),%eax
  sub    -0x4(%rbp),%eax
  mov    -0x2c(%rbp),%ecx
  movslq %ecx,%rsi
  mov    -0x4(%rbp),%ecx
  movslq %ecx,%rcx
  add    %rsi,%rcx
  lea    0x0(,%rcx,8),%rsi
  mov    -0x28(%rbp),%rcx
  add    %rsi,%rcx
  mov    %eax,%esi
  mov    %rcx,%rdi
  call   <stable_grail_bin_search_right@plt>
  mov    -0x4(%rbp),%edx
  add    %edx,%eax
  mov    %eax,-0xc(%rbp)
L22:
  mov    -0x8(%rbp),%eax
  cmp    -0x10(%rbp),%eax
  jne    L96
  mov    -0x2c(%rbp),%eax
  sub    -0x10(%rbp),%eax
  mov    -0x10(%rbp),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,8),%rcx
  mov    -0x28(%rbp),%rdx
  add    %rdx,%rcx
  mov    -0xc(%rbp),%edx
  mov    %eax,%esi
  mov    %rcx,%rdi
  call   <stable_grail_rotate@plt>
  jmp    L57
L96:
  mov    -0x2c(%rbp),%eax
  sub    -0x8(%rbp),%eax
  mov    -0x8(%rbp),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,8),%rcx
  mov    -0x28(%rbp),%rdx
  add    %rdx,%rcx
  mov    -0x4(%rbp),%edx
  mov    %eax,%esi
  mov    %rcx,%rdi
  call   <stable_grail_rotate@plt>
  mov    -0xc(%rbp),%eax
  cmp    -0x4(%rbp),%eax
  je     L57
  mov    -0xc(%rbp),%eax
  sub    -0x4(%rbp),%eax
  mov    %eax,%edx
  mov    -0x2c(%rbp),%eax
  sub    -0x10(%rbp),%eax
  mov    -0x10(%rbp),%esi
  mov    -0x4(%rbp),%ecx
  add    %esi,%ecx
  movslq %ecx,%rcx
  lea    0x0(,%rcx,8),%rsi
  mov    -0x28(%rbp),%rcx
  add    %rsi,%rcx
  mov    %eax,%esi
  mov    %rcx,%rdi
  call   <stable_grail_rotate@plt>
L57:
  mov    -0x30(%rbp),%eax
  sub    -0xc(%rbp),%eax
  mov    %eax,%edx
  mov    -0x2c(%rbp),%eax
  sub    -0x10(%rbp),%eax
  mov    -0x10(%rbp),%esi
  mov    -0xc(%rbp),%ecx
  add    %esi,%ecx
  movslq %ecx,%rcx
  lea    0x0(,%rcx,8),%rsi
  mov    -0x28(%rbp),%rcx
  add    %rsi,%rcx
  mov    %eax,%esi
  mov    %rcx,%rdi
  call   <stable_grail_rec_merge>
  mov    -0x4(%rbp),%edx
  mov    -0x8(%rbp),%ecx
  mov    -0x28(%rbp),%rax
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <stable_grail_rec_merge>
L37:
  leave
  ret
```

assistant: ```c
void stable_grail_rec_merge(int **A, int L1, int L2) {
  int K, k1, k2, m1, m2;
  if (L1 < 3 || L2 < 3) {
    stable_grail_merge_without_buffer(A, L1, L2);
    return;
  }
  if (L1 < L2) {
    K = L1 + L2 / 2;
  } else {
    K = L1 / 2;
  }
  k1 = k2 = stable_grail_bin_search_left(A, L1, A + K);
  if (k2 < L1 && (*(*(A + k2)) - *(*(A + K))) == 0) {
    k2 = stable_grail_bin_search_right(A + k1, L1 - k1, A + K) + k1;
  }
  m1 = stable_grail_bin_search_left(A + L1, L2, A + K);
  m2 = m1;
  if (m2 < L2 && (*(*(A + L1 + m2)) - *(*(A + K))) == 0) {
    m2 = stable_grail_bin_search_right(A + L1 + m1, L2 - m1, A + K) + m1;
  }
  if (k1 == k2) {
    stable_grail_rotate(A + k2, L1 - k2, m2);
  } else {
    stable_grail_rotate(A + k1, L1 - k1, m1);
    if (m2 != m1) {
      stable_grail_rotate(A + (k2 + m1), L1 - k2, m2 - m1);
    }
  }
  stable_grail_rec_merge(A + (k2 + m2), L1 - k2, L2 - m2);
  stable_grail_rec_merge(A, k1, m1);
}
```