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

```asm
<stable_grail_build_blocks>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x50,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %esi,-0x3c(%rbp)
  mov    %edx,-0x40(%rbp)
  mov    %rcx,-0x48(%rbp)
  mov    %r8d,-0x4c(%rbp)
  mov    -0x4c(%rbp),%edx
  mov    -0x40(%rbp),%eax
  cmp    %eax,%edx
  cmovle %edx,%eax
  mov    %eax,-0x10(%rbp)
  jmp    L27
L68:
  mov    -0x10(%rbp),%eax
  sub    $0x1,%eax
  and    %eax,-0x10(%rbp)
L27:
  mov    -0x10(%rbp),%eax
  sub    $0x1,%eax
  and    -0x10(%rbp),%eax
  test   %eax,%eax
  jne    L68
  cmpl   $0x0,-0x10(%rbp)
  je     L249
  mov    -0x10(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x10(%rbp),%eax
  cltq
  shl    $0x3,%rax
  neg    %rax
  mov    %rax,%rcx
  mov    -0x38(%rbp),%rax
  add    %rax,%rcx
  mov    -0x48(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  movl   $0x1,-0x24(%rbp)
  jmp    L210
L279:
  movl   $0x0,-0x20(%rbp)
  mov    -0x24(%rbp),%eax
  cltq
  shl    $0x3,%rax
  lea    -0x8(%rax),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  mov    (%rax),%edx
  mov    -0x24(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rcx
  mov    -0x38(%rbp),%rax
  add    %rcx,%rax
  mov    (%rax),%rax
  mov    (%rax),%ecx
  mov    %edx,%eax
  sub    %ecx,%eax
  test   %eax,%eax
  jle    L36
  movl   $0x1,-0x20(%rbp)
L36:
  mov    -0x24(%rbp),%eax
  lea    -0x1(%rax),%edx
  mov    -0x20(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    -0x24(%rbp),%edx
  movslq %edx,%rdx
  shl    $0x3,%rdx
  lea    -0x18(%rdx),%rcx
  mov    -0x38(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rax),%rax
  mov    %rax,(%rdx)
  mov    -0x24(%rbp),%eax
  sub    -0x20(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    -0x24(%rbp),%edx
  movslq %edx,%rdx
  shl    $0x3,%rdx
  lea    -0x10(%rdx),%rcx
  mov    -0x38(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rax),%rax
  mov    %rax,(%rdx)
  addl   $0x2,-0x24(%rbp)
L210:
  mov    -0x24(%rbp),%eax
  cmp    -0x3c(%rbp),%eax
  jl     L279
  mov    -0x3c(%rbp),%eax
  and    $0x1,%eax
  test   %eax,%eax
  je     L82
  mov    -0x3c(%rbp),%eax
  cltq
  shl    $0x3,%rax
  lea    -0x8(%rax),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    -0x3c(%rbp),%edx
  movslq %edx,%rdx
  shl    $0x3,%rdx
  lea    -0x18(%rdx),%rcx
  mov    -0x38(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rax),%rax
  mov    %rax,(%rdx)
L82:
  subq   $0x10,-0x38(%rbp)
  movl   $0x2,-0x1c(%rbp)
  jmp    L64
L226:
  movl   $0x0,-0x18(%rbp)
  mov    -0x1c(%rbp),%eax
  lea    (%rax,%rax,1),%edx
  mov    -0x3c(%rbp),%eax
  sub    %edx,%eax
  mov    %eax,-0xc(%rbp)
  jmp    L168
L74:
  mov    -0x1c(%rbp),%eax
  neg    %eax
  mov    %eax,%ecx
  mov    -0x18(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  lea    (%rdx,%rax,1),%rdi
  mov    -0x1c(%rbp),%edx
  mov    -0x1c(%rbp),%eax
  mov    %eax,%esi
  mov    $0x0,%eax
  call   <stable_grail_merge_left_with_x_buf@plt>
  mov    -0x1c(%rbp),%eax
  add    %eax,%eax
  add    %eax,-0x18(%rbp)
L168:
  mov    -0x18(%rbp),%eax
  cmp    -0xc(%rbp),%eax
  jle    L74
  mov    -0x3c(%rbp),%eax
  sub    -0x18(%rbp),%eax
  mov    %eax,-0x8(%rbp)
  mov    -0x8(%rbp),%eax
  cmp    -0x1c(%rbp),%eax
  jle    L63
  mov    -0x1c(%rbp),%eax
  neg    %eax
  mov    %eax,%ecx
  mov    -0x8(%rbp),%eax
  sub    -0x1c(%rbp),%eax
  mov    %eax,%edx
  mov    -0x18(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rsi
  mov    -0x38(%rbp),%rax
  lea    (%rsi,%rax,1),%rdi
  mov    -0x1c(%rbp),%eax
  mov    %eax,%esi
  mov    $0x0,%eax
  call   <stable_grail_merge_left_with_x_buf@plt>
  jmp    L53
L227:
  mov    -0x18(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x18(%rbp),%eax
  sub    -0x1c(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  add    %rax,%rdx
  mov    (%rcx),%rax
  mov    %rax,(%rdx)
  addl   $0x1,-0x18(%rbp)
L63:
  mov    -0x18(%rbp),%eax
  cmp    -0x3c(%rbp),%eax
  jl     L227
L53:
  mov    -0x1c(%rbp),%eax
  cltq
  shl    $0x3,%rax
  neg    %rax
  add    %rax,-0x38(%rbp)
  shll   -0x1c(%rbp)
L64:
  mov    -0x1c(%rbp),%eax
  cmp    -0x10(%rbp),%eax
  jl     L226
  mov    -0x10(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x3c(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rcx
  mov    -0x38(%rbp),%rax
  add    %rax,%rcx
  mov    -0x48(%rbp),%rax
  mov    %rax,%rsi
  mov    %rcx,%rdi
  call   <memcpy@plt>
  jmp    L73
L249:
  movl   $0x1,-0x24(%rbp)
  jmp    L78
L187:
  movl   $0x0,-0x20(%rbp)
  mov    -0x24(%rbp),%eax
  cltq
  shl    $0x3,%rax
  lea    -0x8(%rax),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  mov    (%rax),%edx
  mov    -0x24(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rcx
  mov    -0x38(%rbp),%rax
  add    %rcx,%rax
  mov    (%rax),%rax
  mov    (%rax),%ecx
  mov    %edx,%eax
  sub    %ecx,%eax
  test   %eax,%eax
  jle    L149
  movl   $0x1,-0x20(%rbp)
L149:
  mov    -0x24(%rbp),%eax
  lea    -0x1(%rax),%edx
  mov    -0x20(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  add    %rax,%rdx
  mov    -0x24(%rbp),%eax
  cltq
  shl    $0x3,%rax
  lea    -0x18(%rax),%rcx
  mov    -0x38(%rbp),%rax
  add    %rcx,%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <stable_grail_swap1@plt>
  mov    -0x24(%rbp),%eax
  sub    -0x20(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  add    %rax,%rdx
  mov    -0x24(%rbp),%eax
  cltq
  shl    $0x3,%rax
  lea    -0x10(%rax),%rcx
  mov    -0x38(%rbp),%rax
  add    %rcx,%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <stable_grail_swap1@plt>
  addl   $0x2,-0x24(%rbp)
L78:
  mov    -0x24(%rbp),%eax
  cmp    -0x3c(%rbp),%eax
  jl     L187
  mov    -0x3c(%rbp),%eax
  and    $0x1,%eax
  test   %eax,%eax
  je     L182
  mov    -0x3c(%rbp),%eax
  cltq
  shl    $0x3,%rax
  lea    -0x18(%rax),%rdx
  mov    -0x38(%rbp),%rax
  add    %rax,%rdx
  mov    -0x3c(%rbp),%eax
  cltq
  shl    $0x3,%rax
  lea    -0x8(%rax),%rcx
  mov    -0x38(%rbp),%rax
  add    %rcx,%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <stable_grail_swap1@plt>
L182:
  subq   $0x10,-0x38(%rbp)
  movl   $0x2,-0x1c(%rbp)
  jmp    L73
L208:
  movl   $0x0,-0x18(%rbp)
  mov    -0x1c(%rbp),%eax
  lea    (%rax,%rax,1),%edx
  mov    -0x3c(%rbp),%eax
  sub    %edx,%eax
  mov    %eax,-0xc(%rbp)
  jmp    L237
L194:
  mov    -0x1c(%rbp),%eax
  neg    %eax
  mov    %eax,%ecx
  mov    -0x18(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  lea    (%rdx,%rax,1),%rdi
  mov    -0x1c(%rbp),%edx
  mov    -0x1c(%rbp),%eax
  mov    %eax,%esi
  mov    $0x0,%eax
  call   <stable_grail_merge_left@plt>
  mov    -0x1c(%rbp),%eax
  add    %eax,%eax
  add    %eax,-0x18(%rbp)
L237:
  mov    -0x18(%rbp),%eax
  cmp    -0xc(%rbp),%eax
  jle    L194
  mov    -0x3c(%rbp),%eax
  sub    -0x18(%rbp),%eax
  mov    %eax,-0x8(%rbp)
  mov    -0x8(%rbp),%eax
  cmp    -0x1c(%rbp),%eax
  jle    L139
  mov    -0x1c(%rbp),%eax
  neg    %eax
  mov    %eax,%ecx
  mov    -0x8(%rbp),%eax
  sub    -0x1c(%rbp),%eax
  mov    %eax,%edx
  mov    -0x18(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rsi
  mov    -0x38(%rbp),%rax
  lea    (%rsi,%rax,1),%rdi
  mov    -0x1c(%rbp),%eax
  mov    %eax,%esi
  mov    $0x0,%eax
  call   <stable_grail_merge_left@plt>
  jmp    L40
L139:
  mov    -0x18(%rbp),%eax
  cltq
  mov    -0x1c(%rbp),%edx
  movslq %edx,%rdx
  sub    %rdx,%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x8(%rbp),%edx
  mov    -0x1c(%rbp),%eax
  mov    %eax,%esi
  mov    %rcx,%rdi
  mov    $0x0,%eax
  call   <stable_grail_rotate@plt>
L40:
  mov    -0x1c(%rbp),%eax
  cltq
  shl    $0x3,%rax
  neg    %rax
  add    %rax,-0x38(%rbp)
  shll   -0x1c(%rbp)
L73:
  mov    -0x1c(%rbp),%eax
  cmp    -0x40(%rbp),%eax
  jl     L208
  mov    -0x40(%rbp),%eax
  lea    (%rax,%rax,1),%ecx
  mov    -0x3c(%rbp),%eax
  cltd
  idiv   %ecx
  mov    %edx,-0x4(%rbp)
  mov    -0x3c(%rbp),%eax
  sub    -0x4(%rbp),%eax
  mov    %eax,-0x14(%rbp)
  mov    -0x4(%rbp),%eax
  cmp    -0x40(%rbp),%eax
  jg     L55
  mov    -0x14(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x40(%rbp),%edx
  mov    -0x4(%rbp),%eax
  mov    %eax,%esi
  mov    %rcx,%rdi
  mov    $0x0,%eax
  call   <stable_grail_rotate@plt>
  jmp    L239
L55:
  mov    -0x4(%rbp),%eax
  sub    -0x40(%rbp),%eax
  mov    %eax,%edx
  mov    -0x14(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rcx
  mov    -0x38(%rbp),%rax
  lea    (%rcx,%rax,1),%rdi
  mov    -0x40(%rbp),%ecx
  mov    -0x40(%rbp),%eax
  mov    %eax,%esi
  mov    $0x0,%eax
  call   <stable_grail_merge_right@plt>
  jmp    L239
L200:
  mov    -0x40(%rbp),%eax
  add    %eax,%eax
  sub    %eax,-0x14(%rbp)
  mov    -0x14(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  lea    (%rdx,%rax,1),%rdi
  mov    -0x40(%rbp),%ecx
  mov    -0x40(%rbp),%edx
  mov    -0x40(%rbp),%eax
  mov    %eax,%esi
  mov    $0x0,%eax
  call   <stable_grail_merge_right@plt>
L239:
  cmpl   $0x0,-0x14(%rbp)
  jg     L200
  nop
  nop
  leave
  ret
```

assistant: ```c
void stable_grail_build_blocks(int **arr, int L, int K, int **extbuf, int LExtBuf) {
  int m, u, h, p0, p1, rest, restk, p, kbuf;
  kbuf = K < LExtBuf ? K : LExtBuf;
  while (kbuf & (kbuf - 1)) {
    kbuf &= kbuf - 1;
  }
  if (kbuf) {
    memcpy((extbuf), (arr - kbuf), (kbuf) * sizeof(int *));
    for (m = 1; m < L; m += 2) {
      u = 0;
      if ((*(*(arr + (m - 1))) - *(*(arr + m))) > 0) {
        u = 1;
      }
      arr[m - 3] = arr[m - 1 + u];
      arr[m - 2] = arr[m - u];
    }
    if (L % 2) {
      arr[L - 3] = arr[L - 1];
    }
    arr -= 2;
    for (h = 2; h < kbuf; h *= 2) {
      p0 = 0;
      p1 = L - 2 * h;
      while (p0 <= p1) {
        stable_grail_merge_left_with_x_buf(arr + p0, h, h, -h);
        p0 += 2 * h;
      }
      rest = L - p0;
      if (rest > h) {
        stable_grail_merge_left_with_x_buf(arr + p0, h, rest - h, -h);
      } else {
        for (; p0 < L; p0++) {
          arr[p0 - h] = arr[p0];
        }
      }
      arr -= h;
    }
    memcpy((arr + L), (extbuf), (kbuf) * sizeof(int *));
  } else {
    for (m = 1; m < L; m += 2) {
      u = 0;
      if ((*(*(arr + (m - 1))) - *(*(arr + m))) > 0) {
        u = 1;
      }
      stable_grail_swap1(arr + (m - 3), arr + (m - 1 + u));
      stable_grail_swap1(arr + (m - 2), arr + (m - u));
    }
    if (L % 2) {
      stable_grail_swap1(arr + (L - 1), arr + (L - 3));
    }
    arr -= 2;
    h = 2;
  }
  for (; h < K; h *= 2) {
    p0 = 0;
    p1 = L - 2 * h;
    while (p0 <= p1) {
      stable_grail_merge_left(arr + p0, h, h, -h);
      p0 += 2 * h;
    }
    rest = L - p0;
    if (rest > h) {
      stable_grail_merge_left(arr + p0, h, rest - h, -h);
    } else {
      stable_grail_rotate(arr + p0 - h, h, rest);
    }
    arr -= h;
  }
  restk = L % (2 * K);
  p = L - restk;
  if (restk <= K) {
    stable_grail_rotate(arr + p, restk, K);
  } else {
    stable_grail_merge_right(arr + p, K, restk - K, K);
  }
  while (p > 0) {
    p -= 2 * K;
    stable_grail_merge_right(arr + p, K, K, K);
  }
}
```