user: What would the C source look like for the assembly code provided here:

```asm
<stable_grail_common_sort>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x50,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %esi,-0x3c(%rbp)
  mov    %rdx,-0x48(%rbp)
  mov    %ecx,-0x40(%rbp)
  cmpl   $0xf,-0x3c(%rbp)
  jg     L184
  mov    -0x3c(%rbp),%edx
  mov    -0x38(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <stable_binary_insertion_sort@plt>
  jmp    L215
L184:
  movl   $0x1,-0x2c(%rbp)
  jmp    L226
L187:
  shll   -0x2c(%rbp)
L226:
  mov    -0x2c(%rbp),%eax
  imul   %eax,%eax
  cmp    %eax,-0x3c(%rbp)
  jg     L187
  mov    -0x3c(%rbp),%eax
  sub    $0x1,%eax
  cltd
  idivl  -0x2c(%rbp)
  add    $0x1,%eax
  mov    %eax,-0x28(%rbp)
  mov    -0x28(%rbp),%edx
  mov    -0x2c(%rbp),%eax
  add    %eax,%edx
  mov    -0x3c(%rbp),%ecx
  mov    -0x38(%rbp),%rax
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <stable_grail_find_keys@plt>
  mov    %eax,-0x10(%rbp)
  movl   $0x1,-0x18(%rbp)
  mov    -0x28(%rbp),%edx
  mov    -0x2c(%rbp),%eax
  add    %edx,%eax
  cmp    %eax,-0x10(%rbp)
  jge    L120
  cmpl   $0x3,-0x10(%rbp)
  jg     L247
  mov    -0x3c(%rbp),%edx
  mov    -0x38(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <stable_grail_lazy_stable_sort@plt>
  jmp    L215
L247:
  mov    -0x2c(%rbp),%eax
  mov    %eax,-0x28(%rbp)
  jmp    L142
L56:
  mov    -0x28(%rbp),%eax
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %edx,%eax
  sar    %eax
  mov    %eax,-0x28(%rbp)
L142:
  mov    -0x28(%rbp),%eax
  cmp    -0x10(%rbp),%eax
  jg     L56
  movl   $0x0,-0x18(%rbp)
  movl   $0x0,-0x2c(%rbp)
L120:
  mov    -0x2c(%rbp),%edx
  mov    -0x28(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0xc(%rbp)
  cmpl   $0x0,-0x18(%rbp)
  je     L92
  mov    -0x2c(%rbp),%eax
  jmp    L181
L92:
  mov    -0x28(%rbp),%eax
L181:
  mov    %eax,-0x24(%rbp)
  cmpl   $0x0,-0x18(%rbp)
  je     L5
  mov    -0x3c(%rbp),%eax
  sub    -0xc(%rbp),%eax
  mov    -0xc(%rbp),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,8),%rcx
  mov    -0x38(%rbp),%rdx
  lea    (%rcx,%rdx,1),%rdi
  mov    -0x40(%rbp),%esi
  mov    -0x48(%rbp),%rcx
  mov    -0x24(%rbp),%edx
  mov    %esi,%r8d
  mov    %eax,%esi
  call   <stable_grail_build_blocks@plt>
  jmp    L52
L5:
  mov    -0x3c(%rbp),%eax
  sub    -0xc(%rbp),%eax
  mov    -0xc(%rbp),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,8),%rcx
  mov    -0x38(%rbp),%rdx
  lea    (%rcx,%rdx,1),%rdi
  mov    -0x24(%rbp),%edx
  mov    $0x0,%r8d
  mov    $0x0,%ecx
  mov    %eax,%esi
  call   <stable_grail_build_blocks@plt>
  jmp    L52
L21:
  mov    -0x2c(%rbp),%eax
  mov    %eax,-0x20(%rbp)
  mov    -0x18(%rbp),%eax
  mov    %eax,-0x14(%rbp)
  cmpl   $0x0,-0x18(%rbp)
  jne    L148
  cmpl   $0x4,-0x28(%rbp)
  jle    L65
  mov    -0x28(%rbp),%eax
  lea    0x7(%rax),%edx
  test   %eax,%eax
  cmovs  %edx,%eax
  sar    $0x3,%eax
  imul   -0x28(%rbp),%eax
  cmp    %eax,-0x24(%rbp)
  jg     L65
  mov    -0x28(%rbp),%eax
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %edx,%eax
  sar    %eax
  mov    %eax,-0x20(%rbp)
  movl   $0x1,-0x14(%rbp)
  jmp    L148
L65:
  movl   $0x1,-0x1c(%rbp)
  mov    -0x24(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x10(%rbp),%eax
  cltq
  imul   %rdx,%rax
  mov    %rax,%rdx
  shr    $0x3f,%rdx
  add    %rdx,%rax
  sar    %rax
  mov    %rax,-0x8(%rbp)
  jmp    L216
L238:
  shll   -0x1c(%rbp)
  mov    -0x8(%rbp),%rax
  lea    0x7(%rax),%rdx
  test   %rax,%rax
  cmovs  %rdx,%rax
  sar    $0x3,%rax
  mov    %rax,-0x8(%rbp)
L216:
  mov    -0x1c(%rbp),%eax
  cmp    -0x28(%rbp),%eax
  jge    L39
  cmpq   $0x0,-0x8(%rbp)
  jne    L238
L39:
  mov    -0x24(%rbp),%eax
  add    %eax,%eax
  cltd
  idivl  -0x1c(%rbp)
  mov    %eax,-0x20(%rbp)
L148:
  cmpl   $0x0,-0x14(%rbp)
  je     L130
  mov    -0x20(%rbp),%eax
  cmp    -0x40(%rbp),%eax
  jg     L130
  mov    -0x48(%rbp),%rsi
  jmp    L128
L130:
  mov    $0x0,%esi
L128:
  mov    -0x3c(%rbp),%eax
  sub    -0xc(%rbp),%eax
  mov    %eax,%edx
  mov    -0xc(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rcx
  mov    -0x38(%rbp),%rax
  lea    (%rcx,%rax,1),%rdi
  mov    -0x14(%rbp),%r9d
  mov    -0x20(%rbp),%r8d
  mov    -0x24(%rbp),%ecx
  mov    -0x38(%rbp),%rax
  sub    $0x8,%rsp
  push   %rsi
  mov    %rdi,%rsi
  mov    %rax,%rdi
  call   <stable_grail_combine_blocks@plt>
  add    $0x10,%rsp
L52:
  mov    -0x3c(%rbp),%eax
  sub    -0xc(%rbp),%eax
  shll   -0x24(%rbp)
  cmp    %eax,-0x24(%rbp)
  jl     L21
  mov    -0xc(%rbp),%edx
  mov    -0x38(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <stable_binary_insertion_sort@plt>
  mov    -0x3c(%rbp),%eax
  sub    -0xc(%rbp),%eax
  mov    %eax,%edx
  mov    -0xc(%rbp),%ecx
  mov    -0x38(%rbp),%rax
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <stable_grail_merge_without_buffer@plt>
L215:
  leave
  ret
```

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);
}
```