void stable_grail_combine_blocks(int **keys, int **arr, int len, int LL,
                                 int lblock, int havebuf, int **xbuf) {
  int M, b, NBlk, midkey, lrest, u, p, v, kc, nbl2, llast;
  int **arr1;
  M = len / (2 * LL);
  lrest = len % (2 * LL);
  if (lrest <= LL) {
    len -= lrest;
    lrest = 0;
  }
  if (xbuf) {
    memcpy((xbuf), (arr - lblock), (lblock) * sizeof(int *));
  }
  for (b = 0; b <= M; b++) {
    if (b == M && lrest == 0) {
      break;
    }
    arr1 = arr + b * 2 * LL;
    NBlk = (b == M ? lrest : 2 * LL) / lblock;
    stable_binary_insertion_sort(keys, NBlk + (b == M ? 1 : 0));
    midkey = LL / lblock;
    for (u = 1; u < NBlk; u++) {
      p = u - 1;
      for (v = u; v < NBlk; v++) {
        kc = (*(*(arr1 + p * lblock)) - *(*(arr1 + v * lblock)));
        if (kc > 0 || (kc == 0 && (*(*(keys + p)) - *(*(keys + v))) > 0)) {
          p = v;
        }
      }
      if (p != u - 1) {
        stable_grail_swap_n(arr1 + (u - 1) * lblock, arr1 + p * lblock, lblock);
        stable_grail_swap1(keys + (u - 1), keys + p);
        if (midkey == u - 1 || midkey == p) {
          midkey ^= (u - 1) ^ p;
        }
      }
    }
    nbl2 = llast = 0;
    if (b == M) {
      llast = lrest % lblock;
    }
    if (llast != 0) {
      while (nbl2 < NBlk && (*(*(arr1 + NBlk * lblock)) -
                             *(*(arr1 + (NBlk - nbl2 - 1) * lblock))) < 0) {
        nbl2++;
      }
    }
    if (xbuf) {
      stable_grail_merge_buffers_left_with_x_buf(
          keys, keys + midkey, arr1, NBlk - nbl2, lblock, nbl2, llast);
    } else {
      stable_grail_merge_buffers_left(keys, keys + midkey, arr1, NBlk - nbl2,
                                      lblock, havebuf, nbl2, llast);
    }
  }
  if (xbuf) {
    for (p = len; --p >= 0;) {
      arr[p] = arr[p - lblock];
    }
    memcpy((arr - lblock), (xbuf), (lblock) * sizeof(int *));
  } else if (havebuf) {
    while (--len >= 0) {
      stable_grail_swap1(arr + len, arr + len - lblock);
    }
  }
}


x86 assembly (clang, -O0):
<stable_grail_combine_blocks>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    %r9d,-0x20(%rbp)
mov    -0x14(%rbp),%eax
mov    -0x18(%rbp),%ecx
shl    $0x1,%ecx
cltd
idiv   %ecx
mov    %eax,-0x24(%rbp)
mov    -0x14(%rbp),%eax
mov    -0x18(%rbp),%ecx
shl    $0x1,%ecx
cltd
idiv   %ecx
mov    %edx,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x18(%rbp),%eax
jg     11be <stable_grail_combine_blocks+0x5e>
mov    -0x34(%rbp),%ecx
mov    -0x14(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x14(%rbp)
movl   $0x0,-0x34(%rbp)
cmpq   $0x0,0x10(%rbp)
je     11ee <stable_grail_combine_blocks+0x8e>
mov    0x10(%rbp),%rdi
mov    -0x10(%rbp),%rsi
movslq -0x1c(%rbp),%rcx
xor    %eax,%eax
sub    %rcx,%rax
shl    $0x3,%rax
add    %rax,%rsi
movslq -0x1c(%rbp),%rdx
shl    $0x3,%rdx
call   1060 <memcpy@plt>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x24(%rbp),%eax
jg     151c <stable_grail_combine_blocks+0x3bc>
mov    -0x28(%rbp),%eax
cmp    -0x24(%rbp),%eax
jne    121c <stable_grail_combine_blocks+0xbc>
cmpl   $0x0,-0x34(%rbp)
jne    121c <stable_grail_combine_blocks+0xbc>
jmp    151c <stable_grail_combine_blocks+0x3bc>
mov    -0x10(%rbp),%rax
mov    -0x28(%rbp),%ecx
shl    $0x1,%ecx
imul   -0x18(%rbp),%ecx
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x58(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x24(%rbp),%eax
jne    124f <stable_grail_combine_blocks+0xef>
mov    -0x34(%rbp),%eax
mov    %eax,-0x5c(%rbp)
jmp    1258 <stable_grail_combine_blocks+0xf8>
mov    -0x18(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x5c(%rbp)
mov    -0x5c(%rbp),%eax
cltd
idivl  -0x1c(%rbp)
mov    %eax,-0x2c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x2c(%rbp),%esi
mov    -0x28(%rbp),%edx
mov    -0x24(%rbp),%r8d
xor    %eax,%eax
mov    $0x1,%ecx
cmp    %r8d,%edx
cmove  %ecx,%eax
add    %eax,%esi
mov    $0x0,%al
call   1030 <stable_binary_insertion_sort@plt>
mov    -0x18(%rbp),%eax
cltd
idivl  -0x1c(%rbp)
mov    %eax,-0x30(%rbp)
movl   $0x1,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    13ee <stable_grail_combine_blocks+0x28e>
mov    -0x38(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x3c(%rbp)
mov    -0x38(%rbp),%eax
mov    %eax,-0x40(%rbp)
mov    -0x40(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    133b <stable_grail_combine_blocks+0x1db>
mov    -0x58(%rbp),%rax
mov    -0x3c(%rbp),%ecx
imul   -0x1c(%rbp),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    (%rax),%eax
mov    -0x58(%rbp),%rcx
mov    -0x40(%rbp),%edx
imul   -0x1c(%rbp),%edx
movslq %edx,%rdx
mov    (%rcx,%rdx,8),%rcx
sub    (%rcx),%eax
mov    %eax,-0x44(%rbp)
cmpl   $0x0,-0x44(%rbp)
jg     1322 <stable_grail_combine_blocks+0x1c2>
cmpl   $0x0,-0x44(%rbp)
jne    1328 <stable_grail_combine_blocks+0x1c8>
mov    -0x8(%rbp),%rax
movslq -0x3c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    (%rax),%eax
mov    -0x8(%rbp),%rcx
movslq -0x40(%rbp),%rdx
mov    (%rcx,%rdx,8),%rcx
sub    (%rcx),%eax
cmp    $0x0,%eax
jle    1328 <stable_grail_combine_blocks+0x1c8>
mov    -0x40(%rbp),%eax
mov    %eax,-0x3c(%rbp)
jmp    132d <stable_grail_combine_blocks+0x1cd>
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    12b2 <stable_grail_combine_blocks+0x152>
mov    -0x3c(%rbp),%eax
mov    -0x38(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
je     13db <stable_grail_combine_blocks+0x27b>
mov    -0x58(%rbp),%rdi
mov    -0x38(%rbp),%eax
sub    $0x1,%eax
imul   -0x1c(%rbp),%eax
cltq
shl    $0x3,%rax
add    %rax,%rdi
mov    -0x58(%rbp),%rsi
mov    -0x3c(%rbp),%eax
imul   -0x1c(%rbp),%eax
cltq
shl    $0x3,%rax
add    %rax,%rsi
mov    -0x1c(%rbp),%edx
mov    $0x0,%al
call   1040 <stable_grail_swap_n@plt>
mov    -0x8(%rbp),%rdi
mov    -0x38(%rbp),%eax
sub    $0x1,%eax
cltq
shl    $0x3,%rax
add    %rax,%rdi
mov    -0x8(%rbp),%rsi
movslq -0x3c(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rsi
mov    $0x0,%al
call   1070 <stable_grail_swap1@plt>
mov    -0x30(%rbp),%eax
mov    -0x38(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
je     13c7 <stable_grail_combine_blocks+0x267>
mov    -0x30(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jne    13d6 <stable_grail_combine_blocks+0x276>
mov    -0x38(%rbp),%eax
sub    $0x1,%eax
xor    -0x3c(%rbp),%eax
xor    -0x30(%rbp),%eax
mov    %eax,-0x30(%rbp)
jmp    13db <stable_grail_combine_blocks+0x27b>
jmp    13e0 <stable_grail_combine_blocks+0x280>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    1297 <stable_grail_combine_blocks+0x137>
movl   $0x0,-0x4c(%rbp)
movl   $0x0,-0x48(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x24(%rbp),%eax
jne    1412 <stable_grail_combine_blocks+0x2b2>
mov    -0x34(%rbp),%eax
cltd
idivl  -0x1c(%rbp)
mov    %edx,-0x4c(%rbp)
cmpl   $0x0,-0x4c(%rbp)
je     148c <stable_grail_combine_blocks+0x32c>
jmp    1421 <stable_grail_combine_blocks+0x2c1>
mov    -0x48(%rbp),%ecx
xor    %eax,%eax
cmp    -0x2c(%rbp),%ecx
mov    %al,-0x5d(%rbp)
jge    1469 <stable_grail_combine_blocks+0x309>
mov    -0x58(%rbp),%rax
mov    -0x2c(%rbp),%ecx
imul   -0x1c(%rbp),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    (%rax),%eax
mov    -0x58(%rbp),%rcx
mov    -0x2c(%rbp),%edx
sub    -0x48(%rbp),%edx
sub    $0x1,%edx
imul   -0x1c(%rbp),%edx
movslq %edx,%rdx
mov    (%rcx,%rdx,8),%rcx
sub    (%rcx),%eax
cmp    $0x0,%eax
setl   %al
mov    %al,-0x5d(%rbp)
mov    -0x5d(%rbp),%al
test   $0x1,%al
jne    1479 <stable_grail_combine_blocks+0x319>
jmp    1487 <stable_grail_combine_blocks+0x327>
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    1421 <stable_grail_combine_blocks+0x2c1>
jmp    148c <stable_grail_combine_blocks+0x32c>
cmpq   $0x0,0x10(%rbp)
je     14ce <stable_grail_combine_blocks+0x36e>
mov    -0x8(%rbp),%rdi
mov    -0x8(%rbp),%rsi
movslq -0x30(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rsi
mov    -0x58(%rbp),%rdx
mov    -0x2c(%rbp),%ecx
sub    -0x48(%rbp),%ecx
mov    -0x1c(%rbp),%r8d
mov    -0x48(%rbp),%r9d
mov    -0x4c(%rbp),%eax
mov    %eax,(%rsp)
mov    $0x0,%al
call   1050 <stable_grail_merge_buffers_left_with_x_buf@plt>
jmp    1509 <stable_grail_combine_blocks+0x3a9>
mov    -0x8(%rbp),%rdi
mov    -0x8(%rbp),%rsi
movslq -0x30(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rsi
mov    -0x58(%rbp),%rdx
mov    -0x2c(%rbp),%ecx
sub    -0x48(%rbp),%ecx
mov    -0x1c(%rbp),%r8d
mov    -0x20(%rbp),%r9d
mov    -0x48(%rbp),%r10d
mov    -0x4c(%rbp),%eax
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
mov    $0x0,%al
call   1080 <stable_grail_merge_buffers_left@plt>
jmp    150e <stable_grail_combine_blocks+0x3ae>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    11f5 <stable_grail_combine_blocks+0x95>
cmpq   $0x0,0x10(%rbp)
je     158b <stable_grail_combine_blocks+0x42b>
mov    -0x14(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x3c(%rbp)
cmp    $0x0,%eax
jl     1561 <stable_grail_combine_blocks+0x401>
mov    -0x10(%rbp),%rax
mov    -0x3c(%rbp),%ecx
sub    -0x1c(%rbp),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdx
mov    -0x10(%rbp),%rax
movslq -0x3c(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
jmp    152d <stable_grail_combine_blocks+0x3cd>
mov    -0x10(%rbp),%rdi
movslq -0x1c(%rbp),%rcx
xor    %eax,%eax
sub    %rcx,%rax
shl    $0x3,%rax
add    %rax,%rdi
mov    0x10(%rbp),%rsi
movslq -0x1c(%rbp),%rdx
shl    $0x3,%rdx
call   1060 <memcpy@plt>
jmp    15f0 <stable_grail_combine_blocks+0x490>
cmpl   $0x0,-0x20(%rbp)
je     15eb <stable_grail_combine_blocks+0x48b>
jmp    159a <stable_grail_combine_blocks+0x43a>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jl     15e6 <stable_grail_combine_blocks+0x486>
mov    -0x10(%rbp),%rdi
movslq -0x14(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdi
mov    -0x10(%rbp),%rsi
movslq -0x14(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rsi
movslq -0x1c(%rbp),%rcx
xor    %eax,%eax
sub    %rcx,%rax
shl    $0x3,%rax
add    %rax,%rsi
mov    $0x0,%al
call   1070 <stable_grail_swap1@plt>
jmp    159a <stable_grail_combine_blocks+0x43a>
jmp    15eb <stable_grail_combine_blocks+0x48b>
jmp    15f0 <stable_grail_combine_blocks+0x490>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stable_grail_combine_blocks>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
mov    %r9d,0xc(%rsp)
mov    %r8d,%ebp
mov    %edx,%eax
mov    %rsi,%r13
mov    0xb0(%rsp),%r14
lea    (%rcx,%rcx,1),%ebx
mov    %edx,0x38(%rsp)
cltd
idiv   %ebx
mov    %eax,%r12d
xor    %eax,%eax
mov    %rcx,0x70(%rsp)
cmp    %ecx,%edx
mov    $0x0,%ecx
cmovg  %edx,%ecx
mov    %ecx,0x8(%rsp)
cmovle %edx,%eax
mov    %rax,0x58(%rsp)
movslq %r8d,%r15
test   %r14,%r14
mov    %rdi,(%rsp)
je     11d3 <stable_grail_combine_blocks+0x73>
lea    0x0(,%r15,8),%rdx
mov    %r13,%rsi
sub    %rdx,%rsi
mov    %r14,%rdi
call   1060 <memcpy@plt>
mov    (%rsp),%rdi
mov    %r15,0x30(%rsp)
mov    %r14,0x40(%rsp)
test   %r12d,%r12d
js     148f <stable_grail_combine_blocks+0x32f>
mov    %r12d,%eax
mov    %rax,0x28(%rsp)
add    $0x1,%r12d
mov    %r12,0x68(%rsp)
mov    0x30(%rsp),%rax
lea    0x0(,%rax,8),%rcx
add    %r13,%rcx
mov    %rcx,0x60(%rsp)
lea    0x0(,%rax,8),%r12
movl   $0x0,0x14(%rsp)
xor    %ecx,%ecx
mov    %r13,0x18(%rsp)
mov    %ebx,0x10(%rsp)
jmp    1273 <stable_grail_combine_blocks+0x113>
nopl   0x0(%rax)
sub    $0x8,%rsp
mov    0x8(%rsp),%rdi
mov    %r14,%rdx
mov    %r15d,%ecx
mov    %ebp,%r8d
mov    %ebx,%r9d
xor    %eax,%eax
push   %r10
call   1050 <stable_grail_merge_buffers_left_with_x_buf@plt>
mov    0x10(%rsp),%rdi
add    $0x10,%rsp
mov    0x10(%rsp),%ebx
mov    0x20(%rsp),%rcx
add    $0x1,%rcx
add    %ebx,0x14(%rsp)
cmp    0x68(%rsp),%rcx
je     148f <stable_grail_combine_blocks+0x32f>
cmp    0x28(%rsp),%rcx
jne    1285 <stable_grail_combine_blocks+0x125>
cmpl   $0x0,0x8(%rsp)
je     148f <stable_grail_combine_blocks+0x32f>
mov    %ebx,%eax
imul   %ecx,%eax
xor    %esi,%esi
mov    %rcx,0x20(%rsp)
cmp    0x28(%rsp),%rcx
sete   %sil
movslq %eax,%rcx
mov    %ebx,%eax
cmove  0x8(%rsp),%eax
lea    0x0(,%rcx,8),%r14
add    %r13,%r14
cltd
idiv   %ebp
mov    %eax,%r15d
add    %eax,%esi
xor    %eax,%eax
call   1030 <stable_binary_insertion_sort@plt>
mov    0x70(%rsp),%rax
cltd
idiv   %ebp
mov    %eax,%r8d
cmp    $0x2,%r15d
jl     13e0 <stable_grail_combine_blocks+0x280>
movslq 0x14(%rsp),%rax
mov    0x60(%rsp),%rcx
lea    (%rcx,%rax,8),%rdi
mov    $0x1,%r13d
mov    (%rsp),%r9
jmp    130f <stable_grail_combine_blocks+0x1af>
nopl   (%rax)
xor    %ecx,%r8d
xor    %ebx,%r8d
mov    (%rsp),%r9
mov    0x48(%rsp),%rdi
add    $0x1,%r13
add    %r12,%rdi
cmp    %r15,%r13
je     13e4 <stable_grail_combine_blocks+0x284>
lea    -0x1(%r13),%r10
mov    %rdi,%rax
mov    %r13,%rcx
mov    %r10d,%ebx
jmp    132e <stable_grail_combine_blocks+0x1ce>
xchg   %ax,%ax
mov    %ecx,%ebx
add    $0x1,%rcx
add    %r12,%rax
cmp    %rcx,%r15
je     1360 <stable_grail_combine_blocks+0x200>
mov    %ebx,%edx
imul   %ebp,%edx
movslq %edx,%rdx
mov    (%r14,%rdx,8),%rdx
mov    (%rdx),%edx
mov    (%rax),%rsi
sub    (%rsi),%edx
jg     1320 <stable_grail_combine_blocks+0x1c0>
jne    1322 <stable_grail_combine_blocks+0x1c2>
movslq %ebx,%rdx
mov    (%r9,%rdx,8),%rdx
mov    (%rdx),%edx
mov    (%r9,%rcx,8),%rsi
cmp    (%rsi),%edx
jg     1320 <stable_grail_combine_blocks+0x1c0>
jmp    1322 <stable_grail_combine_blocks+0x1c2>
nopl   0x0(%rax,%rax,1)
mov    %ebx,%eax
cmp    %rax,%r10
je     12ff <stable_grail_combine_blocks+0x19f>
mov    %rdi,0x48(%rsp)
mov    %r10,%rax
imul   0x30(%rsp),%rax
lea    (%r14,%rax,8),%rdi
mov    %ebx,%eax
imul   %ebp,%eax
cltq
lea    (%r14,%rax,8),%rsi
mov    %ebp,%edx
xor    %eax,%eax
mov    %r8d,0x3c(%rsp)
mov    %r10,0x50(%rsp)
call   1040 <stable_grail_swap_n@plt>
mov    0x50(%rsp),%rax
mov    (%rsp),%rcx
lea    (%rcx,%rax,8),%rdi
movslq %ebx,%rax
lea    (%rcx,%rax,8),%rsi
xor    %eax,%eax
call   1070 <stable_grail_swap1@plt>
mov    0x50(%rsp),%rcx
mov    0x3c(%rsp),%r8d
mov    %r8d,%eax
cmp    %rax,%rcx
je     12f0 <stable_grail_combine_blocks+0x190>
cmp    %ebx,%r8d
jne    12f6 <stable_grail_combine_blocks+0x196>
jmp    12f0 <stable_grail_combine_blocks+0x190>
cs nopw 0x0(%rax,%rax,1)
mov    (%rsp),%r9
xor    %ebx,%ebx
mov    0x20(%rsp),%rax
cmp    0x28(%rsp),%rax
jne    1450 <stable_grail_combine_blocks+0x2f0>
mov    0x8(%rsp),%eax
cltd
idiv   %ebp
test   %edx,%edx
je     1450 <stable_grail_combine_blocks+0x2f0>
mov    %edx,%r10d
test   %r15d,%r15d
mov    0x18(%rsp),%r13
jle    1458 <stable_grail_combine_blocks+0x2f8>
mov    %r15d,%eax
imul   %ebp,%eax
cltq
mov    (%r14,%rax,8),%rax
mov    (%rax),%eax
lea    -0x1(%r15),%ecx
imul   %ebp,%ecx
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movslq %ecx,%rdx
mov    (%r14,%rdx,8),%rdx
cmp    (%rdx),%eax
jge    1458 <stable_grail_combine_blocks+0x2f8>
add    $0x1,%rbx
sub    %ebp,%ecx
cmp    %rbx,%r15
jne    1430 <stable_grail_combine_blocks+0x2d0>
mov    %r15d,%ebx
jmp    1458 <stable_grail_combine_blocks+0x2f8>
nopl   0x0(%rax,%rax,1)
xor    %r10d,%r10d
mov    0x18(%rsp),%r13
sub    %ebx,%r15d
movslq %r8d,%rax
lea    (%r9,%rax,8),%rsi
cmpq   $0x0,0x40(%rsp)
jne    1230 <stable_grail_combine_blocks+0xd0>
mov    (%rsp),%rdi
mov    %r14,%rdx
mov    %r15d,%ecx
mov    %ebp,%r8d
mov    0xc(%rsp),%r9d
xor    %eax,%eax
push   %r10
push   %rbx
call   1080 <stable_grail_merge_buffers_left@plt>
jmp    124e <stable_grail_combine_blocks+0xee>
mov    0x38(%rsp),%edx
mov    %edx,%eax
mov    0x58(%rsp),%r8
sub    %r8d,%eax
mov    0x40(%rsp),%rsi
test   %rsi,%rsi
je     14ee <stable_grail_combine_blocks+0x38e>
test   %eax,%eax
jle    1543 <stable_grail_combine_blocks+0x3e3>
mov    %eax,%ebx
movslq %ebp,%r10
cmp    $0x4,%eax
jae    1568 <stable_grail_combine_blocks+0x408>
add    $0xffffffffffffffff,%rbx
lea    0x0(,%r10,8),%rcx
mov    %r13,%rax
sub    %rcx,%rax
nop
mov    (%rax,%rbx,8),%rcx
mov    %ebx,%edx
mov    %rcx,0x0(%r13,%rdx,8)
lea    -0x1(%rbx),%rcx
add    $0x1,%rbx
cmp    $0x1,%rbx
mov    %rcx,%rbx
ja     14d0 <stable_grail_combine_blocks+0x370>
jmp    1548 <stable_grail_combine_blocks+0x3e8>
cmpl   $0x0,0xc(%rsp)
je     1534 <stable_grail_combine_blocks+0x3d4>
test   %eax,%eax
jle    1534 <stable_grail_combine_blocks+0x3d4>
movslq %ebp,%rbx
neg    %rbx
mov    %eax,%ebp
add    $0xffffffffffffffff,%rbp
cs nopw 0x0(%rax,%rax,1)
nop
mov    %ebp,%eax
lea    0x0(,%rax,8),%rdi
add    %r13,%rdi
lea    (%rdi,%rbx,8),%rsi
xor    %eax,%eax
call   1070 <stable_grail_swap1@plt>
add    $0xffffffffffffffff,%rbp
lea    0x2(%rbp),%eax
cmp    $0x1,%eax
jg     1510 <stable_grail_combine_blocks+0x3b0>
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x30(%rsp),%r10
shl    $0x3,%r10
sub    %r10,%r13
mov    %r13,%rdi
mov    %r10,%rdx
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1060 <memcpy@plt>
lea    -0x1(%rbx),%rcx
not    %r8d
add    %edx,%r8d
mov    $0x8,%edx
mov    %rcx,%rax
mul    %rdx
seto   %dl
cmp    %ecx,%r8d
jb     14bd <stable_grail_combine_blocks+0x35d>
shr    $0x20,%rcx
jne    14bd <stable_grail_combine_blocks+0x35d>
lea    0x0(,%r8,8),%rcx
add    %r13,%rcx
mov    %rcx,%rdi
sub    %rax,%rdi
cmp    %rcx,%rdi
ja     14bd <stable_grail_combine_blocks+0x35d>
test   %dl,%dl
jne    14bd <stable_grail_combine_blocks+0x35d>
mov    %r10,%rcx
not    %rcx
add    %rbx,%rcx
lea    0x0(,%rcx,8),%rcx
add    %r13,%rcx
mov    %rcx,%rdi
sub    %rax,%rdi
cmp    %rcx,%rdi
ja     14bd <stable_grail_combine_blocks+0x35d>
test   %dl,%dl
jne    14bd <stable_grail_combine_blocks+0x35d>
lea    0x1(%r8),%rax
sub    %rbx,%rax
lea    0x0(,%rax,8),%rax
add    %r13,%rax
mov    %rbx,%rcx
sub    %r10,%rcx
lea    0x0(,%rcx,8),%rcx
add    %r13,%rcx
cmp    %rcx,%rax
jae    162a <stable_grail_combine_blocks+0x4ca>
lea    0x8(,%r8,8),%rax
add    %r13,%rax
lea    0x0(,%r10,8),%rcx
mov    %r13,%rdx
sub    %rcx,%rdx
cmp    %rax,%rdx
jb     14bd <stable_grail_combine_blocks+0x35d>
mov    %ebx,%r8d
and    $0xfffffffc,%r8d
lea    -0x4(%r8),%rdx
mov    %rdx,%r9
shr    $0x2,%r9
add    $0x1,%r9
test   %rdx,%rdx
je     16ea <stable_grail_combine_blocks+0x58a>
mov    %r9,%rdi
and    $0xfffffffffffffffe,%rdi
mov    $0xfffffffffffffffe,%rdx
sub    %r10,%rdx
lea    0x0(,%rdx,8),%rbp
add    %r13,%rbp
mov    $0xffffffffffffffff,%rdx
mov    %rbx,%rcx
nop
lea    -0x1(%rcx),%eax
movups -0x10(%rbp,%rcx,8),%xmm0
movups 0x0(%rbp,%rcx,8),%xmm1
movups %xmm1,-0x8(%r13,%rax,8)
movups %xmm0,-0x18(%r13,%rax,8)
lea    -0x5(%rcx),%eax
movups -0x30(%rbp,%rcx,8),%xmm0
movups -0x20(%rbp,%rcx,8),%xmm1
movups %xmm1,-0x8(%r13,%rax,8)
movups %xmm0,-0x18(%r13,%rax,8)
add    $0xfffffffffffffff8,%rdx
add    $0xfffffffffffffff8,%rcx
add    $0xfffffffffffffffe,%rdi
jne    1670 <stable_grail_combine_blocks+0x510>
test   $0x1,%r9b
je     16d9 <stable_grail_combine_blocks+0x579>
add    %rbx,%rdx
mov    %rdx,%rax
sub    %r10,%rax
movups -0x18(%r13,%rax,8),%xmm0
movups -0x8(%r13,%rax,8),%xmm1
mov    %edx,%eax
movups %xmm1,-0x8(%r13,%rax,8)
movups %xmm0,-0x18(%r13,%rax,8)
cmp    %rbx,%r8
je     1548 <stable_grail_combine_blocks+0x3e8>
and    $0x3,%ebx
jmp    14bd <stable_grail_combine_blocks+0x35d>
mov    $0xffffffffffffffff,%rdx
test   $0x1,%r9b
jne    16b6 <stable_grail_combine_blocks+0x556>
jmp    16d9 <stable_grail_combine_blocks+0x579>

LLVM IR (-O0):
define void @stable_grail_combine_blocks(i32** %0, i32** %1, i32 %2, i32 %3, i32 %4, i32 %5, i32** %6) {
%8 = alloca i32**
%9 = alloca i32**
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32**
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
%24 = alloca i32
%25 = alloca i32
%26 = alloca i32**
store i32** %0, i32*** %8
store i32** %1, i32*** %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store i32 %4, i32* %12
store i32 %5, i32* %13
store i32** %6, i32*** %14
%27 = load i32, i32* %10
%28 = load i32, i32* %11
%29 = mul nsw i32 2, %28
%30 = sdiv i32 %27, %29
store i32 %30, i32* %15
%31 = load i32, i32* %10
%32 = load i32, i32* %11
%33 = mul nsw i32 2, %32
%34 = srem i32 %31, %33
store i32 %34, i32* %19
%35 = load i32, i32* %19
%36 = load i32, i32* %11
%37 = icmp sle i32 %35, %36
br i1 %37, label %38, label %42
38: ; preds = %7
%39 = load i32, i32* %19
%40 = load i32, i32* %10
%41 = sub nsw i32 %40, %39
store i32 %41, i32* %10
store i32 0, i32* %19
br label %42
42: ; preds = %38, %7
%43 = load i32**, i32*** %14
%44 = icmp ne i32** %43, null
br i1 %44, label %45, label %57
45: ; preds = %42
%46 = load i32**, i32*** %14
%47 = bitcast i32** %46 to i8*
%48 = load i32**, i32*** %9
%49 = load i32, i32* %12
%50 = sext i32 %49 to i64
%51 = sub i64 0, %50
%52 = getelementptr inbounds i32*, i32** %48, i64 %51
%53 = bitcast i32** %52 to i8*
%54 = load i32, i32* %12
%55 = sext i32 %54 to i64
%56 = mul i64 %55, 8
br label %57
57: ; preds = %45, %42
store i32 0, i32* %16
br label %58
58: ; preds = %286, %57
%59 = load i32, i32* %16
%60 = load i32, i32* %15
%61 = icmp sle i32 %59, %60
br i1 %61, label %62, label %289
62: ; preds = %58
%63 = load i32, i32* %16
%64 = load i32, i32* %15
%65 = icmp eq i32 %63, %64
br i1 %65, label %66, label %70
66: ; preds = %62
%67 = load i32, i32* %19
%68 = icmp eq i32 %67, 0
br i1 %68, label %69, label %70
69: ; preds = %66
br label %289
70: ; preds = %66, %62
%71 = load i32**, i32*** %9
%72 = load i32, i32* %16
%73 = mul nsw i32 %72, 2
%74 = load i32, i32* %11
%75 = mul nsw i32 %73, %74
%76 = sext i32 %75 to i64
%77 = getelementptr inbounds i32*, i32** %71, i64 %76
store i32** %77, i32*** %26
%78 = load i32, i32* %16
%79 = load i32, i32* %15
%80 = icmp eq i32 %78, %79
br i1 %80, label %81, label %83
81: ; preds = %70
%82 = load i32, i32* %19
br label %86
83: ; preds = %70
%84 = load i32, i32* %11
%85 = mul nsw i32 2, %84
br label %86
86: ; preds = %83, %81
%87 = phi i32 [ %82, %81 ], [ %85, %83 ]
%88 = load i32, i32* %12
%89 = sdiv i32 %87, %88
store i32 %89, i32* %17
%90 = load i32**, i32*** %8
%91 = load i32, i32* %17
%92 = load i32, i32* %16
%93 = load i32, i32* %15
%94 = icmp eq i32 %92, %93
%95 = zext i1 %94 to i64
%96 = select i1 %94, i32 1, i32 0
%97 = add nsw i32 %91, %96
%98 = call i32 (i32**, i32, ...) bitcast (i32 (...)* @stable_binary_insertion_sort to i32 (i32**, i32, ...)*)(i32** %90, i32 %97)
%99 = load i32, i32* %11
%100 = load i32, i32* %12
%101 = sdiv i32 %99, %100
store i32 %101, i32* %18
store i32 1, i32* %20
br label %102
102: ; preds = %206, %86
%103 = load i32, i32* %20
%104 = load i32, i32* %17
%105 = icmp slt i32 %103, %104
br i1 %105, label %106, label %209
106: ; preds = %102
%107 = load i32, i32* %20
%108 = sub nsw i32 %107, 1
store i32 %108, i32* %21
%109 = load i32, i32* %20
store i32 %109, i32* %22
br label %110
110: ; preds = %155, %106
%111 = load i32, i32* %22
%112 = load i32, i32* %17
%113 = icmp slt i32 %111, %112
br i1 %113, label %114, label %158
114: ; preds = %110
%115 = load i32**, i32*** %26
%116 = load i32, i32* %21
%117 = load i32, i32* %12
%118 = mul nsw i32 %116, %117
%119 = sext i32 %118 to i64
%120 = getelementptr inbounds i32*, i32** %115, i64 %119
%121 = load i32*, i32** %120
%122 = load i32, i32* %121
%123 = load i32**, i32*** %26
%124 = load i32, i32* %22
%125 = load i32, i32* %12
%126 = mul nsw i32 %124, %125
%127 = sext i32 %126 to i64
%128 = getelementptr inbounds i32*, i32** %123, i64 %127
%129 = load i32*, i32** %128
%130 = load i32, i32* %129
%131 = sub nsw i32 %122, %130
store i32 %131, i32* %23
%132 = load i32, i32* %23
%133 = icmp sgt i32 %132, 0
br i1 %133, label %152, label %134
134: ; preds = %114
%135 = load i32, i32* %23
%136 = icmp eq i32 %135, 0
br i1 %136, label %137, label %154
137: ; preds = %134
%138 = load i32**, i32*** %8
%139 = load i32, i32* %21
%140 = sext i32 %139 to i64
%141 = getelementptr inbounds i32*, i32** %138, i64 %140
%142 = load i32*, i32** %141
%143 = load i32, i32* %142
%144 = load i32**, i32*** %8
%145 = load i32, i32* %22
%146 = sext i32 %145 to i64
%147 = getelementptr inbounds i32*, i32** %144, i64 %146
%148 = load i32*, i32** %147
%149 = load i32, i32* %148
%150 = sub nsw i32 %143, %149
%151 = icmp sgt i32 %150, 0
br i1 %151, label %152, label %154
152: ; preds = %137, %114
%153 = load i32, i32* %22
store i32 %153, i32* %21
br label %154
154: ; preds = %152, %137, %134
br label %155
155: ; preds = %154
%156 = load i32, i32* %22
%157 = add nsw i32 %156, 1
store i32 %157, i32* %22
br label %110
158: ; preds = %110
%159 = load i32, i32* %21
%160 = load i32, i32* %20
%161 = sub nsw i32 %160, 1
%162 = icmp ne i32 %159, %161
br i1 %162, label %163, label %205
163: ; preds = %158
%164 = load i32**, i32*** %26
%165 = load i32, i32* %20
%166 = sub nsw i32 %165, 1
%167 = load i32, i32* %12
%168 = mul nsw i32 %166, %167
%169 = sext i32 %168 to i64
%170 = getelementptr inbounds i32*, i32** %164, i64 %169
%171 = load i32**, i32*** %26
%172 = load i32, i32* %21
%173 = load i32, i32* %12
%174 = mul nsw i32 %172, %173
%175 = sext i32 %174 to i64
%176 = getelementptr inbounds i32*, i32** %171, i64 %175
%177 = load i32, i32* %12
%178 = call i32 (i32**, i32**, i32, ...) bitcast (i32 (...)* @stable_grail_swap_n to i32 (i32**, i32**, i32, ...)*)(i32** %170, i32** %176, i32 %177)
%179 = load i32**, i32*** %8
%180 = load i32, i32* %20
%181 = sub nsw i32 %180, 1
%182 = sext i32 %181 to i64
%183 = getelementptr inbounds i32*, i32** %179, i64 %182
%184 = load i32**, i32*** %8
%185 = load i32, i32* %21
%186 = sext i32 %185 to i64
%187 = getelementptr inbounds i32*, i32** %184, i64 %186
%188 = call i32 (i32**, i32**, ...) bitcast (i32 (...)* @stable_grail_swap1 to i32 (i32**, i32**, ...)*)(i32** %183, i32** %187)
%189 = load i32, i32* %18
%190 = load i32, i32* %20
%191 = sub nsw i32 %190, 1
%192 = icmp eq i32 %189, %191
br i1 %192, label %197, label %193
193: ; preds = %163
%194 = load i32, i32* %18
%195 = load i32, i32* %21
%196 = icmp eq i32 %194, %195
br i1 %196, label %197, label %204
197: ; preds = %193, %163
%198 = load i32, i32* %20
%199 = sub nsw i32 %198, 1
%200 = load i32, i32* %21
%201 = xor i32 %199, %200
%202 = load i32, i32* %18
%203 = xor i32 %202, %201
store i32 %203, i32* %18
br label %204
204: ; preds = %197, %193
br label %205
205: ; preds = %204, %158
br label %206
206: ; preds = %205
%207 = load i32, i32* %20
%208 = add nsw i32 %207, 1
store i32 %208, i32* %20
br label %102
209: ; preds = %102
store i32 0, i32* %25
store i32 0, i32* %24
%210 = load i32, i32* %16
%211 = load i32, i32* %15
%212 = icmp eq i32 %210, %211
br i1 %212, label %213, label %217
213: ; preds = %209
%214 = load i32, i32* %19
%215 = load i32, i32* %12
%216 = srem i32 %214, %215
store i32 %216, i32* %25
br label %217
217: ; preds = %213, %209
%218 = load i32, i32* %25
%219 = icmp ne i32 %218, 0
br i1 %219, label %220, label %253
220: ; preds = %217
br label %221
221: ; preds = %249, %220
%222 = load i32, i32* %24
%223 = load i32, i32* %17
%224 = icmp slt i32 %222, %223
br i1 %224, label %225, label %247
225: ; preds = %221
%226 = load i32**, i32*** %26
%227 = load i32, i32* %17
%228 = load i32, i32* %12
%229 = mul nsw i32 %227, %228
%230 = sext i32 %229 to i64
%231 = getelementptr inbounds i32*, i32** %226, i64 %230
%232 = load i32*, i32** %231
%233 = load i32, i32* %232
%234 = load i32**, i32*** %26
%235 = load i32, i32* %17
%236 = load i32, i32* %24
%237 = sub nsw i32 %235, %236
%238 = sub nsw i32 %237, 1
%239 = load i32, i32* %12
%240 = mul nsw i32 %238, %239
%241 = sext i32 %240 to i64
%242 = getelementptr inbounds i32*, i32** %234, i64 %241
%243 = load i32*, i32** %242
%244 = load i32, i32* %243
%245 = sub nsw i32 %233, %244
%246 = icmp slt i32 %245, 0
br label %247
247: ; preds = %225, %221
%248 = phi i1 [ false, %221 ], [ %246, %225 ]
br i1 %248, label %249, label %252
249: ; preds = %247
%250 = load i32, i32* %24
%251 = add nsw i32 %250, 1
store i32 %251, i32* %24
br label %221
252: ; preds = %247
br label %253
253: ; preds = %252, %217
%254 = load i32**, i32*** %14
%255 = icmp ne i32** %254, null
br i1 %255, label %256, label %270
256: ; preds = %253
%257 = load i32**, i32*** %8
%258 = load i32**, i32*** %8
%259 = load i32, i32* %18
%260 = sext i32 %259 to i64
%261 = getelementptr inbounds i32*, i32** %258, i64 %260
%262 = load i32**, i32*** %26
%263 = load i32, i32* %17
%264 = load i32, i32* %24
%265 = sub nsw i32 %263, %264
%266 = load i32, i32* %12
%267 = load i32, i32* %24
%268 = load i32, i32* %25
%269 = call i32 (i32**, i32**, i32**, i32, i32, i32, i32, ...) bitcast (i32 (...)* @stable_grail_merge_buffers_left_with_x_buf to i32 (i32**, i32**, i32**, i32, i32, i32, i32, ...)*)(i32** %257, i32** %261, i32** %262, i32 %265, i32 %266, i32 %267, i32 %268)
br label %285
270: ; preds = %253
%271 = load i32**, i32*** %8
%272 = load i32**, i32*** %8
%273 = load i32, i32* %18
%274 = sext i32 %273 to i64
%275 = getelementptr inbounds i32*, i32** %272, i64 %274
%276 = load i32**, i32*** %26
%277 = load i32, i32* %17
%278 = load i32, i32* %24
%279 = sub nsw i32 %277, %278
%280 = load i32, i32* %12
%281 = load i32, i32* %13
%282 = load i32, i32* %24
%283 = load i32, i32* %25
%284 = call i32 (i32**, i32**, i32**, i32, i32, i32, i32, i32, ...) bitcast (i32 (...)* @stable_grail_merge_buffers_left to i32 (i32**, i32**, i32**, i32, i32, i32, i32, i32, ...)*)(i32** %271, i32** %275, i32** %276, i32 %279, i32 %280, i32 %281, i32 %282, i32 %283)
br label %285
285: ; preds = %270, %256
br label %286
286: ; preds = %285
%287 = load i32, i32* %16
%288 = add nsw i32 %287, 1
store i32 %288, i32* %16
br label %58
289: ; preds = %69, %58
%290 = load i32**, i32*** %14
%291 = icmp ne i32** %290, null
br i1 %291, label %292, label %322
292: ; preds = %289
%293 = load i32, i32* %10
store i32 %293, i32* %21
br label %294
294: ; preds = %298, %292
%295 = load i32, i32* %21
%296 = add nsw i32 %295, -1
store i32 %296, i32* %21
%297 = icmp sge i32 %296, 0
br i1 %297, label %298, label %310
298: ; preds = %294
%299 = load i32**, i32*** %9
%300 = load i32, i32* %21
%301 = load i32, i32* %12
%302 = sub nsw i32 %300, %301
%303 = sext i32 %302 to i64
%304 = getelementptr inbounds i32*, i32** %299, i64 %303
%305 = load i32*, i32** %304
%306 = load i32**, i32*** %9
%307 = load i32, i32* %21
%308 = sext i32 %307 to i64
%309 = getelementptr inbounds i32*, i32** %306, i64 %308
store i32* %305, i32** %309
br label %294
310: ; preds = %294
%311 = load i32**, i32*** %9
%312 = load i32, i32* %12
%313 = sext i32 %312 to i64
%314 = sub i64 0, %313
%315 = getelementptr inbounds i32*, i32** %311, i64 %314
%316 = bitcast i32** %315 to i8*
%317 = load i32**, i32*** %14
%318 = bitcast i32** %317 to i8*
%319 = load i32, i32* %12
%320 = sext i32 %319 to i64
%321 = mul i64 %320, 8
br label %346
322: ; preds = %289
%323 = load i32, i32* %13
%324 = icmp ne i32 %323, 0
br i1 %324, label %325, label %345
325: ; preds = %322
br label %326
326: ; preds = %330, %325
%327 = load i32, i32* %10
%328 = add nsw i32 %327, -1
store i32 %328, i32* %10
%329 = icmp sge i32 %328, 0
br i1 %329, label %330, label %344
330: ; preds = %326
%331 = load i32**, i32*** %9
%332 = load i32, i32* %10
%333 = sext i32 %332 to i64
%334 = getelementptr inbounds i32*, i32** %331, i64 %333
%335 = load i32**, i32*** %9
%336 = load i32, i32* %10
%337 = sext i32 %336 to i64
%338 = getelementptr inbounds i32*, i32** %335, i64 %337
%339 = load i32, i32* %12
%340 = sext i32 %339 to i64
%341 = sub i64 0, %340
%342 = getelementptr inbounds i32*, i32** %338, i64 %341
%343 = call i32 (i32**, i32**, ...) bitcast (i32 (...)* @stable_grail_swap1 to i32 (i32**, i32**, ...)*)(i32** %334, i32** %342)
br label %326
344: ; preds = %326
br label %345
345: ; preds = %344, %322
br label %346
346: ; preds = %345, %310
ret void
}

LLVM IR (-O2):
define void @stable_grail_combine_blocks(i32** %0, i32** %1, i32 %2, i32 %3, i32 %4, i32 %5, i32** %6) {
%8 = shl i32 %3, 1
%9 = sdiv i32 %2, %8
%10 = srem i32 %2, %8
%11 = icmp sgt i32 %10, %3
%12 = select i1 %11, i32 %10, i32 0
%13 = select i1 %11, i32 0, i32 %10
%14 = sub i32 %2, %13
%15 = icmp eq i32** %6, null
br i1 %15, label %23, label %16
16: ; preds = %7
%17 = bitcast i32** %6 to i8*
%18 = sext i32 %4 to i64
%19 = sub nsw i64 0, %18
%20 = getelementptr inbounds i32*, i32** %1, i64 %19
%21 = bitcast i32** %20 to i8*
%22 = shl nsw i64 %18, 3
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 8 %17, i8* align 8 %21, i64 %22, i1 false)
br label %23
23: ; preds = %16, %7
%24 = icmp slt i32 %9, 0
br i1 %24, label %153, label %25
25: ; preds = %23
%26 = icmp eq i32 %12, 0
%27 = sext i32 %4 to i64
%28 = zext i32 %9 to i64
%29 = add nuw i32 %9, 1
%30 = zext i32 %29 to i64
br label %31
31: ; preds = %25, %150
%32 = phi i64 [ 0, %25 ], [ %151, %150 ]
%33 = icmp eq i64 %32, %28
%34 = and i1 %33, %26
br i1 %34, label %153, label %35
35: ; preds = %31
%36 = trunc i64 %32 to i32
%37 = mul i32 %8, %36
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds i32*, i32** %1, i64 %38
%40 = select i1 %33, i32 %12, i32 %8
%41 = sdiv i32 %40, %4
%42 = zext i1 %33 to i32
%43 = add nsw i32 %41, %42
%44 = tail call i32 (i32**, i32, ...) bitcast (i32 (...)* @stable_binary_insertion_sort to i32 (i32**, i32, ...)*)(i32** %0, i32 %43)
%45 = sdiv i32 %3, %4
%46 = icmp sgt i32 %41, 1
br i1 %46, label %47, label %110
47: ; preds = %35
%48 = zext i32 %41 to i64
br label %49
49: ; preds = %106, %47
%50 = phi i64 [ 1, %47 ], [ %108, %106 ]
%51 = phi i32 [ %45, %47 ], [ %107, %106 ]
%52 = add nsw i64 %50, -1
%53 = trunc i64 %52 to i32
br label %54
54: ; preds = %49, %81
%55 = phi i64 [ %50, %49 ], [ %83, %81 ]
%56 = phi i32 [ %53, %49 ], [ %82, %81 ]
%57 = mul nsw i32 %56, %4
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds i32*, i32** %39, i64 %58
%60 = load i32*, i32** %59
%61 = load i32, i32* %60
%62 = mul nsw i64 %55, %27
%63 = getelementptr inbounds i32*, i32** %39, i64 %62
%64 = load i32*, i32** %63
%65 = load i32, i32* %64
%66 = sub nsw i32 %61, %65
%67 = icmp sgt i32 %66, 0
br i1 %67, label %79, label %68
68: ; preds = %54
%69 = icmp eq i32 %66, 0
br i1 %69, label %70, label %81
70: ; preds = %68
%71 = sext i32 %56 to i64
%72 = getelementptr inbounds i32*, i32** %0, i64 %71
%73 = load i32*, i32** %72
%74 = load i32, i32* %73
%75 = getelementptr inbounds i32*, i32** %0, i64 %55
%76 = load i32*, i32** %75
%77 = load i32, i32* %76
%78 = icmp sgt i32 %74, %77
br i1 %78, label %79, label %81
79: ; preds = %70, %54
%80 = trunc i64 %55 to i32
br label %81
81: ; preds = %68, %70, %79
%82 = phi i32 [ %80, %79 ], [ %56, %70 ], [ %56, %68 ]
%83 = add nuw nsw i64 %55, 1
%84 = icmp eq i64 %83, %48
br i1 %84, label %85, label %54
85: ; preds = %81
%86 = zext i32 %82 to i64
%87 = icmp eq i64 %52, %86
br i1 %87, label %106, label %88
88: ; preds = %85
%89 = mul nsw i64 %52, %27
%90 = getelementptr inbounds i32*, i32** %39, i64 %89
%91 = mul nsw i32 %82, %4
%92 = sext i32 %91 to i64
%93 = getelementptr inbounds i32*, i32** %39, i64 %92
%94 = tail call i32 (i32**, i32**, i32, ...) bitcast (i32 (...)* @stable_grail_swap_n to i32 (i32**, i32**, i32, ...)*)(i32** %90, i32** %93, i32 %4)
%95 = getelementptr inbounds i32*, i32** %0, i64 %52
%96 = sext i32 %82 to i64
%97 = getelementptr inbounds i32*, i32** %0, i64 %96
%98 = tail call i32 (i32**, i32**, ...) bitcast (i32 (...)* @stable_grail_swap1 to i32 (i32**, i32**, ...)*)(i32** %95, i32** %97)
%99 = zext i32 %51 to i64
%100 = icmp eq i64 %52, %99
%101 = icmp eq i32 %51, %82
%102 = select i1 %100, i1 true, i1 %101
br i1 %102, label %103, label %106
103: ; preds = %88
%104 = xor i32 %51, %53
%105 = xor i32 %104, %82
br label %106
106: ; preds = %88, %85, %103
%107 = phi i32 [ %105, %103 ], [ %51, %85 ], [ %51, %88 ]
%108 = add nuw nsw i64 %50, 1
%109 = icmp eq i64 %108, %48
br i1 %109, label %110, label %49
110: ; preds = %106, %35
%111 = phi i32 [ %45, %35 ], [ %107, %106 ]
br i1 %33, label %112, label %140
112: ; preds = %110
%113 = srem i32 %12, %4
%114 = icmp eq i32 %113, 0
br i1 %114, label %140, label %115
115: ; preds = %112
%116 = icmp sgt i32 %41, 0
br i1 %116, label %117, label %140
117: ; preds = %115
%118 = mul nsw i32 %41, %4
%119 = sext i32 %118 to i64
%120 = getelementptr inbounds i32*, i32** %39, i64 %119
%121 = load i32*, i32** %120
%122 = load i32, i32* %121
%123 = zext i32 %41 to i64
br label %124
124: ; preds = %117, %135
%125 = phi i64 [ 0, %117 ], [ %136, %135 ]
%126 = trunc i64 %125 to i32
%127 = xor i32 %126, -1
%128 = add i32 %41, %127
%129 = mul nsw i32 %128, %4
%130 = sext i32 %129 to i64
%131 = getelementptr inbounds i32*, i32** %39, i64 %130
%132 = load i32*, i32** %131
%133 = load i32, i32* %132
%134 = icmp slt i32 %122, %133
br i1 %134, label %135, label %138
135: ; preds = %124
%136 = add nuw nsw i64 %125, 1
%137 = icmp eq i64 %136, %123
br i1 %137, label %140, label %124
138: ; preds = %124
%139 = trunc i64 %125 to i32
br label %140
140: ; preds = %135, %138, %115, %110, %112
%141 = phi i32 [ 0, %112 ], [ 0, %110 ], [ %113, %115 ], [ %113, %138 ], [ %113, %135 ]
%142 = phi i32 [ 0, %112 ], [ 0, %110 ], [ 0, %115 ], [ %139, %138 ], [ %41, %135 ]
%143 = sext i32 %111 to i64
%144 = getelementptr inbounds i32*, i32** %0, i64 %143
%145 = sub nsw i32 %41, %142
br i1 %15, label %148, label %146
146: ; preds = %140
%147 = tail call i32 (i32**, i32**, i32**, i32, i32, i32, i32, ...) bitcast (i32 (...)* @stable_grail_merge_buffers_left_with_x_buf to i32 (i32**, i32**, i32**, i32, i32, i32, i32, ...)*)(i32** %0, i32** %144, i32** %39, i32 %145, i32 %4, i32 %142, i32 %141)
br label %150
148: ; preds = %140
%149 = tail call i32 (i32**, i32**, i32**, i32, i32, i32, i32, i32, ...) bitcast (i32 (...)* @stable_grail_merge_buffers_left to i32 (i32**, i32**, i32**, i32, i32, i32, i32, i32, ...)*)(i32** %0, i32** %144, i32** %39, i32 %145, i32 %4, i32 %5, i32 %142, i32 %141)
br label %150
150: ; preds = %146, %148
%151 = add nuw nsw i64 %32, 1
%152 = icmp eq i64 %151, %30
br i1 %152, label %153, label %31
153: ; preds = %150, %31, %23
br i1 %15, label %304, label %154
154: ; preds = %153
%155 = icmp sgt i32 %14, 0
br i1 %155, label %158, label %156
156: ; preds = %154
%157 = sext i32 %4 to i64
br label %297
158: ; preds = %154
%159 = zext i32 %14 to i64
%160 = sext i32 %4 to i64
%161 = icmp ult i32 %14, 4
br i1 %161, label %286, label %162
162: ; preds = %158
%163 = add nsw i64 %159, -1
%164 = xor i32 %13, -1
%165 = add i32 %164, %2
%166 = trunc i64 %163 to i32
%167 = icmp ult i32 %165, %166
%168 = icmp ugt i64 %163, 4294967295
%169 = or i1 %167, %168
%170 = zext i32 %165 to i64
%171 = getelementptr i32*, i32** %1, i64 %170
%172 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %163, i64 8)
%173 = extractvalue { i64, i1 } %172, 0
%174 = extractvalue { i64, i1 } %172, 1
%175 = bitcast i32** %171 to i8*
%176 = sub i64 0, %173
%177 = getelementptr i8, i8* %175, i64 %176
%178 = icmp ugt i8* %177, %175
%179 = or i1 %178, %174
%180 = xor i64 %160, -1
%181 = add nsw i64 %180, %159
%182 = getelementptr i32*, i32** %1, i64 %181
%183 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %163, i64 8)
%184 = extractvalue { i64, i1 } %183, 0
%185 = extractvalue { i64, i1 } %183, 1
%186 = bitcast i32** %182 to i8*
%187 = sub i64 0, %184
%188 = getelementptr i8, i8* %186, i64 %187
%189 = icmp ugt i8* %188, %186
%190 = or i1 %189, %185
%191 = or i1 %169, %179
%192 = or i1 %191, %190
br i1 %192, label %286, label %193
193: ; preds = %162
%194 = xor i32 %13, -1
%195 = add i32 %194, %2
%196 = zext i32 %195 to i64
%197 = add nuw nsw i64 %196, 1
%198 = sub nsw i64 %197, %159
%199 = getelementptr i32*, i32** %1, i64 %198
%200 = add nuw nsw i64 %196, 1
%201 = getelementptr i32*, i32** %1, i64 %200
%202 = sub nsw i64 0, %160
%203 = getelementptr i32*, i32** %1, i64 %202
%204 = sub nsw i64 %159, %160
%205 = getelementptr i32*, i32** %1, i64 %204
%206 = icmp ult i32** %199, %205
%207 = icmp ult i32** %203, %201
%208 = and i1 %206, %207
br i1 %208, label %286, label %209
209: ; preds = %193
%210 = and i64 %159, 4294967292
%211 = and i64 %159, 3
%212 = add nsw i64 %210, -4
%213 = lshr exact i64 %212, 2
%214 = add nuw nsw i64 %213, 1
%215 = and i64 %214, 1
%216 = icmp eq i64 %212, 0
br i1 %216, label %263, label %217
217: ; preds = %209
%218 = and i64 %214, 9223372036854775806
br label %219
219: ; preds = %219, %217
%220 = phi i64 [ 0, %217 ], [ %258, %219 ]
%221 = phi i64 [ 0, %217 ], [ %259, %219 ]
%222 = xor i64 %220, -1
%223 = add i64 %222, %159
%224 = sub nsw i64 %223, %160
%225 = getelementptr inbounds i32*, i32** %1, i64 %224
%226 = getelementptr inbounds i32*, i32** %225, i64 -1
%227 = bitcast i32** %226 to <2 x i32*>*
%228 = load <2 x i32*>, <2 x i32*>* %227
%229 = getelementptr inbounds i32*, i32** %225, i64 -2
%230 = getelementptr inbounds i32*, i32** %229, i64 -1
%231 = bitcast i32** %230 to <2 x i32*>*
%232 = load <2 x i32*>, <2 x i32*>* %231
%233 = and i64 %223, 4294967295
%234 = getelementptr inbounds i32*, i32** %1, i64 %233
%235 = getelementptr inbounds i32*, i32** %234, i64 -1
%236 = bitcast i32** %235 to <2 x i32*>*
store <2 x i32*> %228, <2 x i32*>* %236
%237 = getelementptr inbounds i32*, i32** %234, i64 -2
%238 = getelementptr inbounds i32*, i32** %237, i64 -1
%239 = bitcast i32** %238 to <2 x i32*>*
store <2 x i32*> %232, <2 x i32*>* %239
%240 = sub nuw nsw i64 -5, %220
%241 = add i64 %240, %159
%242 = sub nsw i64 %241, %160
%243 = getelementptr inbounds i32*, i32** %1, i64 %242
%244 = getelementptr inbounds i32*, i32** %243, i64 -1
%245 = bitcast i32** %244 to <2 x i32*>*
%246 = load <2 x i32*>, <2 x i32*>* %245
%247 = getelementptr inbounds i32*, i32** %243, i64 -2
%248 = getelementptr inbounds i32*, i32** %247, i64 -1
%249 = bitcast i32** %248 to <2 x i32*>*
%250 = load <2 x i32*>, <2 x i32*>* %249
%251 = and i64 %241, 4294967295
%252 = getelementptr inbounds i32*, i32** %1, i64 %251
%253 = getelementptr inbounds i32*, i32** %252, i64 -1
%254 = bitcast i32** %253 to <2 x i32*>*
store <2 x i32*> %246, <2 x i32*>* %254
%255 = getelementptr inbounds i32*, i32** %252, i64 -2
%256 = getelementptr inbounds i32*, i32** %255, i64 -1
%257 = bitcast i32** %256 to <2 x i32*>*
store <2 x i32*> %250, <2 x i32*>* %257
%258 = add nuw i64 %220, 8
%259 = add i64 %221, 2
%260 = icmp eq i64 %259, %218
br i1 %260, label %261, label %219
261: ; preds = %219
%262 = sub i64 -9, %220
br label %263
263: ; preds = %261, %209
%264 = phi i64 [ -1, %209 ], [ %262, %261 ]
%265 = icmp eq i64 %215, 0
br i1 %265, label %284, label %266
266: ; preds = %263
%267 = add i64 %264, %159
%268 = sub nsw i64 %267, %160
%269 = getelementptr inbounds i32*, i32** %1, i64 %268
%270 = getelementptr inbounds i32*, i32** %269, i64 -1
%271 = bitcast i32** %270 to <2 x i32*>*
%272 = load <2 x i32*>, <2 x i32*>* %271
%273 = getelementptr inbounds i32*, i32** %269, i64 -2
%274 = getelementptr inbounds i32*, i32** %273, i64 -1
%275 = bitcast i32** %274 to <2 x i32*>*
%276 = load <2 x i32*>, <2 x i32*>* %275
%277 = and i64 %267, 4294967295
%278 = getelementptr inbounds i32*, i32** %1, i64 %277
%279 = getelementptr inbounds i32*, i32** %278, i64 -1
%280 = bitcast i32** %279 to <2 x i32*>*
store <2 x i32*> %272, <2 x i32*>* %280
%281 = getelementptr inbounds i32*, i32** %278, i64 -2
%282 = getelementptr inbounds i32*, i32** %281, i64 -1
%283 = bitcast i32** %282 to <2 x i32*>*
store <2 x i32*> %276, <2 x i32*>* %283
br label %284
284: ; preds = %263, %266
%285 = icmp eq i64 %210, %159
br i1 %285, label %297, label %286
286: ; preds = %193, %162, %158, %284
%287 = phi i64 [ %159, %193 ], [ %159, %162 ], [ %159, %158 ], [ %211, %284 ]
br label %288
288: ; preds = %286, %288
%289 = phi i64 [ %290, %288 ], [ %287, %286 ]
%290 = add nsw i64 %289, -1
%291 = sub nsw i64 %290, %160
%292 = getelementptr inbounds i32*, i32** %1, i64 %291
%293 = load i32*, i32** %292
%294 = and i64 %290, 4294967295
%295 = getelementptr inbounds i32*, i32** %1, i64 %294
store i32* %293, i32** %295
%296 = icmp ugt i64 %289, 1
br i1 %296, label %288, label %297
297: ; preds = %288, %284, %156
%298 = phi i64 [ %157, %156 ], [ %160, %284 ], [ %160, %288 ]
%299 = sub nsw i64 0, %298
%300 = getelementptr inbounds i32*, i32** %1, i64 %299
%301 = bitcast i32** %300 to i8*
%302 = bitcast i32** %6 to i8*
%303 = shl nsw i64 %298, 3
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 8 %301, i8* align 8 %302, i64 %303, i1 false)
br label %321
304: ; preds = %153
%305 = icmp ne i32 %5, 0
%306 = icmp sgt i32 %14, 0
%307 = and i1 %305, %306
br i1 %307, label %308, label %321
308: ; preds = %304
%309 = sext i32 %4 to i64
%310 = sub nsw i64 0, %309
%311 = zext i32 %14 to i64
br label %312
312: ; preds = %308, %312
%313 = phi i64 [ %311, %308 ], [ %314, %312 ]
%314 = add nsw i64 %313, -1
%315 = and i64 %314, 4294967295
%316 = getelementptr inbounds i32*, i32** %1, i64 %315
%317 = getelementptr inbounds i32*, i32** %316, i64 %310
%318 = tail call i32 (i32**, i32**, ...) bitcast (i32 (...)* @stable_grail_swap1 to i32 (i32**, i32**, ...)*)(i32** %316, i32** %317)
%319 = trunc i64 %313 to i32
%320 = icmp sgt i32 %319, 1
br i1 %320, label %312, label %321
321: ; preds = %312, %304, %297
ret void
}