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

```asm
<stable_grail_common_sort>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %rdi,%r14
  mov    %esi,%ebp
  mov    %rdx,0x8(%rsp)
  mov    %ecx,0x10(%rsp)
  mov    $0x1,%ebx
  cmp    $0xf,%esi
  jle    L14
L138:
  add    %ebx,%ebx
  mov    %ebx,%eax
  imul   %ebx,%eax
  cmp    %ebp,%eax
  jl     L138
  lea    -0x1(%rbp),%eax
  cltd
  idiv   %ebx
  lea    0x1(%rax),%r13d
  lea    0x0(%r13,%rbx,1),%r15d
  mov    %r15d,0x14(%rsp)
  mov    %r15d,%edx
  mov    %ebp,%esi
  mov    %r14,%rdi
  call   <stable_grail_find_keys@plt>
  mov    %eax,0x1c(%rsp)
  cmp    %eax,%r15d
  jle    L89
  cmp    $0x3,%eax
  jle    L172
  mov    0x1c(%rsp),%edx
  cmp    %ebx,%eax
  jge    L28
L77:
  mov    %ebx,%eax
  shr    $0x1f,%eax
  add    %ebx,%eax
  sar    %eax
  mov    %eax,%ebx
  cmp    %eax,%edx
  jl     L77
L28:
  mov    %ebp,%esi
  sub    %ebx,%esi
  movslq %ebx,%rax
  lea    (%r14,%rax,8),%rdi
  mov    $0x0,%r8d
  mov    $0x0,%ecx
  mov    %ebx,%edx
  call   <stable_grail_build_blocks@plt>
  mov    %ebx,0x14(%rsp)
  mov    %ebx,%r8d
  mov    %ebx,%r13d
  mov    $0x0,%r15d
  mov    $0x0,%ebx
  jmp    L155
L14:
  call   <stable_binary_insertion_sort@plt>
  jmp    L42
L172:
  mov    %ebp,%esi
  mov    %r14,%rdi
  call   <stable_grail_lazy_stable_sort@plt>
  jmp    L42
L201:
  mov    $0x1,%esi
  jmp    L99
L72:
  mov    %ebx,%r8d
  mov    $0x1,%r9d
  cmp    0x10(%rsp),%ebx
  mov    $0x0,%edx
  cmovle 0x8(%rsp),%rdx
L177:
  sub    $0x8,%rsp
  push   %rdx
  mov    %r12d,%ecx
  mov    %ebp,%edx
  mov    0x10(%rsp),%rsi
  mov    %r14,%rdi
  call   <stable_grail_combine_blocks@plt>
  lea    (%r12,%r12,1),%edx
  mov    %r12d,%r8d
  add    $0x10,%rsp
  cmp    %ebp,%edx
  jge    L103
  mov    %edx,%r12d
L30:
  test   %r15d,%r15d
  jne    L72
  cmp    $0x4,%r13d
  jle    L20
  cmp    %r12d,0x18(%rsp)
  jge    L72
L20:
  movslq %r12d,%rax
  movslq 0x1c(%rsp),%rdx
  imul   %rdx,%rax
  mov    %rax,%rdx
  shr    $0x3f,%rdx
  add    %rdx,%rax
  sar    %rax
  mov    %rax,%rdx
  cmp    $0x1,%r13d
  jle    L201
  test   %rax,%rax
  je     L201
  mov    $0x1,%esi
L111:
  add    %esi,%esi
  lea    0x7(%rdx),%rax
  test   %rdx,%rdx
  cmovns %rdx,%rax
  sar    $0x3,%rax
  mov    %rax,%rdx
  cmp    %r13d,%esi
  jge    L99
  test   %rax,%rax
  jne    L111
L99:
  shl    $0x2,%r8d
  mov    %r8d,%eax
  cltd
  idiv   %esi
  mov    %eax,%r8d
  mov    %r15d,%r9d
  mov    $0x0,%edx
  jmp    L177
L103:
  mov    0x14(%rsp),%ebx
  mov    %ebx,%esi
  mov    %r14,%rdi
  call   <stable_binary_insertion_sort@plt>
  mov    %ebp,%edx
  mov    %ebx,%esi
  mov    %r14,%rdi
  call   <stable_grail_merge_without_buffer@plt>
L42:
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L89:
  mov    %ebp,%esi
  mov    0x14(%rsp),%eax
  sub    %eax,%esi
  cltq
  lea    (%r14,%rax,8),%rdi
  mov    0x10(%rsp),%r8d
  mov    0x8(%rsp),%rcx
  mov    %ebx,%edx
  call   <stable_grail_build_blocks@plt>
  mov    %ebx,%r8d
  mov    $0x1,%r15d
L155:
  mov    0x14(%rsp),%edi
  sub    %edi,%ebp
  lea    (%r8,%r8,1),%r12d
  cmp    %r12d,%ebp
  jle    L103
  lea    0x7(%r13),%eax
  test   %r13d,%r13d
  cmovns %r13d,%eax
  sar    $0x3,%eax
  imul   %r13d,%eax
  mov    %eax,0x18(%rsp)
  mov    %r13d,%eax
  shr    $0x1f,%eax
  add    %r13d,%eax
  sar    %eax
  test   %r15d,%r15d
  cmove  %eax,%ebx
  movslq %edi,%rax
  lea    (%r14,%rax,8),%rax
  mov    %rax,(%rsp)
  jmp    L30
```

assistant: ```c
void stable_grail_common_sort(int **arr, int Len, int **extbuf, int LExtBuf) {
  int lblock, nkeys, findkeys, ptr, cbuf, lb, nk;
  int havebuf, chavebuf;
  long long s;
  if (Len < 16) {
    stable_binary_insertion_sort(arr, Len);
    return;
  }
  lblock = 1;
  while (lblock * lblock < Len) {
    lblock *= 2;
  }
  nkeys = (Len - 1) / lblock + 1;
  findkeys = stable_grail_find_keys(arr, Len, nkeys + lblock);
  havebuf = 1;
  if (findkeys < nkeys + lblock) {
    if (findkeys < 4) {
      stable_grail_lazy_stable_sort(arr, Len);
      return;
    }
    nkeys = lblock;
    while (nkeys > findkeys) {
      nkeys /= 2;
    }
    havebuf = 0;
    lblock = 0;
  }
  ptr = lblock + nkeys;
  cbuf = havebuf ? lblock : nkeys;
  if (havebuf) {
    stable_grail_build_blocks(arr + ptr, Len - ptr, cbuf, extbuf, LExtBuf);
  } else {
    stable_grail_build_blocks(arr + ptr, Len - ptr, cbuf, 0, 0);
  }
  while (Len - ptr > (cbuf *= 2)) {
    lb = lblock;
    chavebuf = havebuf;
    if (!havebuf) {
      if (nkeys > 4 && nkeys / 8 * nkeys >= cbuf) {
        lb = nkeys / 2;
        chavebuf = 1;
      } else {
        nk = 1;
        s = (long long)cbuf * findkeys / 2;
        while (nk < nkeys && s != 0) {
          nk *= 2;
          s /= 8;
        }
        lb = (2 * cbuf) / nk;
      }
    }
    stable_grail_combine_blocks(arr, arr + ptr, Len - ptr, cbuf, lb, chavebuf, chavebuf && lb <= LExtBuf ? extbuf : 0);
  }
  stable_binary_insertion_sort(arr, ptr);
  stable_grail_merge_without_buffer(arr, ptr, Len - ptr);
}
```