#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ memcpy(int **, int **, int);
int /*<<< orphan*/ stable_grail_merge_buffers_left(int **, int **, int **, int,
                                                   int, int, int, int);
int /*<<< orphan*/ stable_grail_merge_buffers_left_with_x_buf(int **, int **,
                                                              int **, int, int,
                                                              int, int);
int /*<<< orphan*/ stable_grail_sort_ins(int **, int);
int /*<<< orphan*/ stable_grail_swap1(int **, int **);
int /*<<< orphan*/ stable_grail_swap_n(int **, int **, int);
void stable_grail_combine_blocks(int **keys, int **arr, int len, int LL,
                                 int lblock, int havebuf, int **xbuf) {
  int M, nkeys, b, NBlk, midkey, lrest, u, p, v, kc, nbl2, llast;
  int **arr1;
  M = len / (2 * LL);
  lrest = len % (2 * LL);
  nkeys = (2 * LL) / lblock;
  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_grail_sort_ins(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,-0x38(%rbp)
mov    -0x18(%rbp),%eax
shl    $0x1,%eax
cltd
idivl  -0x1c(%rbp)
mov    %eax,-0x28(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x18(%rbp),%eax
jg     11cb <stable_grail_combine_blocks+0x6b>
mov    -0x38(%rbp),%ecx
mov    -0x14(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x14(%rbp)
movl   $0x0,-0x38(%rbp)
cmpq   $0x0,0x10(%rbp)
je     11fd <stable_grail_combine_blocks+0x9d>
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),%rax
shl    $0x3,%rax
mov    %eax,%edx
call   1060 <memcpy@plt>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x24(%rbp),%eax
jg     1521 <stable_grail_combine_blocks+0x3c1>
mov    -0x2c(%rbp),%eax
cmp    -0x24(%rbp),%eax
jne    122b <stable_grail_combine_blocks+0xcb>
cmpl   $0x0,-0x38(%rbp)
jne    122b <stable_grail_combine_blocks+0xcb>
jmp    1521 <stable_grail_combine_blocks+0x3c1>
mov    -0x10(%rbp),%rax
mov    -0x2c(%rbp),%ecx
shl    $0x1,%ecx
imul   -0x18(%rbp),%ecx
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x58(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x24(%rbp),%eax
jne    125e <stable_grail_combine_blocks+0xfe>
mov    -0x38(%rbp),%eax
mov    %eax,-0x5c(%rbp)
jmp    1267 <stable_grail_combine_blocks+0x107>
mov    -0x18(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x5c(%rbp)
mov    -0x5c(%rbp),%eax
cltd
idivl  -0x1c(%rbp)
mov    %eax,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x30(%rbp),%esi
mov    -0x2c(%rbp),%edx
mov    -0x24(%rbp),%r8d
xor    %eax,%eax
mov    $0x1,%ecx
cmp    %r8d,%edx
cmove  %ecx,%eax
add    %eax,%esi
call   1030 <stable_grail_sort_ins@plt>
mov    -0x18(%rbp),%eax
cltd
idivl  -0x1c(%rbp)
mov    %eax,-0x34(%rbp)
movl   $0x1,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x30(%rbp),%eax
jge    13f7 <stable_grail_combine_blocks+0x297>
mov    -0x3c(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x40(%rbp)
mov    -0x3c(%rbp),%eax
mov    %eax,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0x30(%rbp),%eax
jge    1348 <stable_grail_combine_blocks+0x1e8>
mov    -0x58(%rbp),%rax
mov    -0x40(%rbp),%ecx
imul   -0x1c(%rbp),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    (%rax),%eax
mov    -0x58(%rbp),%rcx
mov    -0x44(%rbp),%edx
imul   -0x1c(%rbp),%edx
movslq %edx,%rdx
mov    (%rcx,%rdx,8),%rcx
sub    (%rcx),%eax
mov    %eax,-0x48(%rbp)
cmpl   $0x0,-0x48(%rbp)
jg     132f <stable_grail_combine_blocks+0x1cf>
cmpl   $0x0,-0x48(%rbp)
jne    1335 <stable_grail_combine_blocks+0x1d5>
mov    -0x8(%rbp),%rax
movslq -0x40(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    (%rax),%eax
mov    -0x8(%rbp),%rcx
movslq -0x44(%rbp),%rdx
mov    (%rcx,%rdx,8),%rcx
sub    (%rcx),%eax
cmp    $0x0,%eax
jle    1335 <stable_grail_combine_blocks+0x1d5>
mov    -0x44(%rbp),%eax
mov    %eax,-0x40(%rbp)
jmp    133a <stable_grail_combine_blocks+0x1da>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    12bf <stable_grail_combine_blocks+0x15f>
mov    -0x40(%rbp),%eax
mov    -0x3c(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
je     13e4 <stable_grail_combine_blocks+0x284>
mov    -0x58(%rbp),%rdi
mov    -0x3c(%rbp),%eax
sub    $0x1,%eax
imul   -0x1c(%rbp),%eax
cltq
shl    $0x3,%rax
add    %rax,%rdi
mov    -0x58(%rbp),%rsi
mov    -0x40(%rbp),%eax
imul   -0x1c(%rbp),%eax
cltq
shl    $0x3,%rax
add    %rax,%rsi
mov    -0x1c(%rbp),%edx
call   1040 <stable_grail_swap_n@plt>
mov    -0x8(%rbp),%rdi
mov    -0x3c(%rbp),%eax
sub    $0x1,%eax
cltq
shl    $0x3,%rax
add    %rax,%rdi
mov    -0x8(%rbp),%rsi
movslq -0x40(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rsi
call   1070 <stable_grail_swap1@plt>
mov    -0x34(%rbp),%eax
mov    -0x3c(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
je     13d0 <stable_grail_combine_blocks+0x270>
mov    -0x34(%rbp),%eax
cmp    -0x40(%rbp),%eax
jne    13df <stable_grail_combine_blocks+0x27f>
mov    -0x3c(%rbp),%eax
sub    $0x1,%eax
xor    -0x40(%rbp),%eax
xor    -0x34(%rbp),%eax
mov    %eax,-0x34(%rbp)
jmp    13e4 <stable_grail_combine_blocks+0x284>
jmp    13e9 <stable_grail_combine_blocks+0x289>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    12a4 <stable_grail_combine_blocks+0x144>
movl   $0x0,-0x50(%rbp)
movl   $0x0,-0x4c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x24(%rbp),%eax
jne    141b <stable_grail_combine_blocks+0x2bb>
mov    -0x38(%rbp),%eax
cltd
idivl  -0x1c(%rbp)
mov    %edx,-0x50(%rbp)
cmpl   $0x0,-0x50(%rbp)
je     1495 <stable_grail_combine_blocks+0x335>
jmp    142a <stable_grail_combine_blocks+0x2ca>
mov    -0x4c(%rbp),%ecx
xor    %eax,%eax
cmp    -0x30(%rbp),%ecx
mov    %al,-0x5d(%rbp)
jge    1472 <stable_grail_combine_blocks+0x312>
mov    -0x58(%rbp),%rax
mov    -0x30(%rbp),%ecx
imul   -0x1c(%rbp),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    (%rax),%eax
mov    -0x58(%rbp),%rcx
mov    -0x30(%rbp),%edx
sub    -0x4c(%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    1482 <stable_grail_combine_blocks+0x322>
jmp    1490 <stable_grail_combine_blocks+0x330>
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    142a <stable_grail_combine_blocks+0x2ca>
jmp    1495 <stable_grail_combine_blocks+0x335>
cmpq   $0x0,0x10(%rbp)
je     14d5 <stable_grail_combine_blocks+0x375>
mov    -0x8(%rbp),%rdi
mov    -0x8(%rbp),%rsi
movslq -0x34(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rsi
mov    -0x58(%rbp),%rdx
mov    -0x30(%rbp),%ecx
sub    -0x4c(%rbp),%ecx
mov    -0x1c(%rbp),%r8d
mov    -0x4c(%rbp),%r9d
mov    -0x50(%rbp),%eax
mov    %eax,(%rsp)
call   1050 <stable_grail_merge_buffers_left_with_x_buf@plt>
jmp    150e <stable_grail_combine_blocks+0x3ae>
mov    -0x8(%rbp),%rdi
mov    -0x8(%rbp),%rsi
movslq -0x34(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rsi
mov    -0x58(%rbp),%rdx
mov    -0x30(%rbp),%ecx
sub    -0x4c(%rbp),%ecx
mov    -0x1c(%rbp),%r8d
mov    -0x20(%rbp),%r9d
mov    -0x4c(%rbp),%r10d
mov    -0x50(%rbp),%eax
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
call   1080 <stable_grail_merge_buffers_left@plt>
jmp    1513 <stable_grail_combine_blocks+0x3b3>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1204 <stable_grail_combine_blocks+0xa4>
cmpq   $0x0,0x10(%rbp)
je     1592 <stable_grail_combine_blocks+0x432>
mov    -0x14(%rbp),%eax
mov    %eax,-0x40(%rbp)
mov    -0x40(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x40(%rbp)
cmp    $0x0,%eax
jl     1566 <stable_grail_combine_blocks+0x406>
mov    -0x10(%rbp),%rax
mov    -0x40(%rbp),%ecx
sub    -0x1c(%rbp),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdx
mov    -0x10(%rbp),%rax
movslq -0x40(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
jmp    1532 <stable_grail_combine_blocks+0x3d2>
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),%rax
shl    $0x3,%rax
mov    %eax,%edx
call   1060 <memcpy@plt>
jmp    15f5 <stable_grail_combine_blocks+0x495>
cmpl   $0x0,-0x20(%rbp)
je     15f0 <stable_grail_combine_blocks+0x490>
jmp    15a1 <stable_grail_combine_blocks+0x441>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jl     15eb <stable_grail_combine_blocks+0x48b>
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
call   1070 <stable_grail_swap1@plt>
jmp    15a1 <stable_grail_combine_blocks+0x441>
jmp    15f0 <stable_grail_combine_blocks+0x490>
jmp    15f5 <stable_grail_combine_blocks+0x495>
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    $0x88,%rsp
mov    %r9d,0x18(%rsp)
mov    %r8d,%ebp
mov    %edx,%eax
mov    %rsi,%r15
mov    0xc0(%rsp),%r14
lea    (%rcx,%rcx,1),%ebx
mov    %edx,0x48(%rsp)
cltd
idiv   %ebx
mov    %eax,%r13d
xor    %eax,%eax
mov    %rcx,0x80(%rsp)
cmp    %ecx,%edx
mov    $0x0,%ecx
cmovg  %edx,%ecx
mov    %ecx,0x14(%rsp)
cmovle %edx,%eax
mov    %rax,0x68(%rsp)
movslq %r8d,%r12
test   %r14,%r14
mov    %rdi,0x8(%rsp)
je     11e3 <stable_grail_combine_blocks+0x83>
lea    0x0(,%r12,8),%rax
mov    %r15,%rsi
sub    %rax,%rsi
lea    0x0(,%r12,8),%edx
mov    %r14,%rdi
call   1060 <memcpy@plt>
mov    0x8(%rsp),%rdi
mov    %r12,0x40(%rsp)
mov    %r14,0x50(%rsp)
test   %r13d,%r13d
js     14ac <stable_grail_combine_blocks+0x34c>
mov    %r13d,%eax
mov    %rax,0x38(%rsp)
add    $0x1,%r13d
mov    %r13,0x78(%rsp)
mov    0x40(%rsp),%rax
lea    (%r15,%rax,8),%rcx
mov    %rcx,0x70(%rsp)
lea    0x0(,%rax,8),%r14
xor    %eax,%eax
mov    %rax,0x28(%rsp)
xor    %ecx,%ecx
mov    %r15,0x20(%rsp)
mov    %ebx,0x1c(%rsp)
jmp    1288 <stable_grail_combine_blocks+0x128>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
sub    $0x8,%rsp
mov    0x10(%rsp),%rdi
mov    %r13,%rdx
mov    %r12d,%ecx
mov    %ebp,%r8d
mov    %ebx,%r9d
push   %rax
call   1050 <stable_grail_merge_buffers_left_with_x_buf@plt>
mov    0x18(%rsp),%rdi
add    $0x10,%rsp
mov    0x1c(%rsp),%ebx
mov    0x30(%rsp),%rcx
add    $0x1,%rcx
mov    0x28(%rsp),%rax
add    %ebx,%eax
mov    %rax,0x28(%rsp)
cmp    0x78(%rsp),%rcx
je     14ac <stable_grail_combine_blocks+0x34c>
cmp    0x38(%rsp),%rcx
jne    129a <stable_grail_combine_blocks+0x13a>
cmpl   $0x0,0x14(%rsp)
je     14ac <stable_grail_combine_blocks+0x34c>
mov    %ebx,%eax
imul   %ecx,%eax
xor    %esi,%esi
mov    %rcx,0x30(%rsp)
cmp    0x38(%rsp),%rcx
sete   %sil
movslq %eax,%rcx
mov    %ebx,%eax
cmove  0x14(%rsp),%eax
lea    (%r15,%rcx,8),%r13
cltd
idiv   %ebp
mov    %eax,%r12d
add    %eax,%esi
call   1030 <stable_grail_sort_ins@plt>
mov    0x80(%rsp),%rax
cltd
idiv   %ebp
mov    %eax,%r8d
cmp    $0x2,%r12d
jl     1400 <stable_grail_combine_blocks+0x2a0>
movslq 0x28(%rsp),%rax
mov    0x70(%rsp),%rcx
lea    (%rcx,%rax,8),%rdi
mov    $0x1,%r15d
mov    0x8(%rsp),%r9
jmp    1320 <stable_grail_combine_blocks+0x1c0>
nopl   (%rax)
xor    %ecx,%r8d
xor    %ebx,%r8d
mov    0x8(%rsp),%r9
mov    0x58(%rsp),%rdi
add    $0x1,%r15
add    %r14,%rdi
cmp    %r12,%r15
je     1405 <stable_grail_combine_blocks+0x2a5>
lea    -0x1(%r15),%r10
mov    %rdi,%rax
mov    %r15,%rcx
mov    %r10d,%ebx
jmp    133e <stable_grail_combine_blocks+0x1de>
nop
mov    %ecx,%ebx
add    $0x1,%rcx
add    %r14,%rax
cmp    %rcx,%r12
je     1370 <stable_grail_combine_blocks+0x210>
mov    %ebx,%edx
imul   %ebp,%edx
movslq %edx,%rdx
mov    0x0(%r13,%rdx,8),%rdx
mov    (%rdx),%edx
mov    (%rax),%rsi
sub    (%rsi),%edx
jg     1330 <stable_grail_combine_blocks+0x1d0>
jne    1332 <stable_grail_combine_blocks+0x1d2>
movslq %ebx,%rdx
mov    (%r9,%rdx,8),%rdx
mov    (%rdx),%edx
mov    (%r9,%rcx,8),%rsi
cmp    (%rsi),%edx
jg     1330 <stable_grail_combine_blocks+0x1d0>
jmp    1332 <stable_grail_combine_blocks+0x1d2>
nopl   0x0(%rax)
mov    %ebx,%eax
cmp    %rax,%r10
je     1310 <stable_grail_combine_blocks+0x1b0>
mov    %rdi,0x58(%rsp)
mov    %r10,%rax
imul   0x40(%rsp),%rax
lea    0x0(,%rax,8),%rdi
add    %r13,%rdi
mov    %ebx,%eax
imul   %ebp,%eax
cltq
lea    0x0(,%rax,8),%rsi
add    %r13,%rsi
mov    %ebp,%edx
mov    %r8d,0x4c(%rsp)
mov    %r10,0x60(%rsp)
call   1040 <stable_grail_swap_n@plt>
mov    0x60(%rsp),%rax
mov    0x8(%rsp),%rcx
lea    (%rcx,%rax,8),%rdi
movslq %ebx,%rax
lea    (%rcx,%rax,8),%rsi
call   1070 <stable_grail_swap1@plt>
mov    0x60(%rsp),%rcx
mov    0x4c(%rsp),%r8d
mov    %r8d,%eax
cmp    %rax,%rcx
je     1300 <stable_grail_combine_blocks+0x1a0>
cmp    %ebx,%r8d
jne    1306 <stable_grail_combine_blocks+0x1a6>
jmp    1300 <stable_grail_combine_blocks+0x1a0>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    0x8(%rsp),%r9
xor    %ebx,%ebx
mov    0x30(%rsp),%rax
cmp    0x38(%rsp),%rax
jne    1470 <stable_grail_combine_blocks+0x310>
mov    0x14(%rsp),%eax
cltd
idiv   %ebp
test   %edx,%edx
je     1470 <stable_grail_combine_blocks+0x310>
mov    %edx,%eax
test   %r12d,%r12d
mov    0x20(%rsp),%r15
jle    1477 <stable_grail_combine_blocks+0x317>
mov    %r12d,%ecx
imul   %ebp,%ecx
movslq %ecx,%rcx
mov    0x0(%r13,%rcx,8),%rcx
mov    (%rcx),%ecx
lea    -0x1(%r12),%edx
imul   %ebp,%edx
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movslq %edx,%rsi
mov    0x0(%r13,%rsi,8),%rsi
cmp    (%rsi),%ecx
jge    1477 <stable_grail_combine_blocks+0x317>
add    $0x1,%rbx
sub    %ebp,%edx
cmp    %rbx,%r12
jne    1450 <stable_grail_combine_blocks+0x2f0>
mov    %r12d,%ebx
jmp    1477 <stable_grail_combine_blocks+0x317>
nopl   0x0(%rax)
xor    %eax,%eax
mov    0x20(%rsp),%r15
sub    %ebx,%r12d
movslq %r8d,%rcx
lea    (%r9,%rcx,8),%rsi
cmpq   $0x0,0x50(%rsp)
jne    1240 <stable_grail_combine_blocks+0xe0>
mov    0x8(%rsp),%rdi
mov    %r13,%rdx
mov    %r12d,%ecx
mov    %ebp,%r8d
mov    0x18(%rsp),%r9d
push   %rax
push   %rbx
call   1080 <stable_grail_merge_buffers_left@plt>
jmp    125b <stable_grail_combine_blocks+0xfb>
mov    0x48(%rsp),%edx
mov    %edx,%eax
mov    0x68(%rsp),%r8
sub    %r8d,%eax
mov    0x50(%rsp),%rsi
test   %rsi,%rsi
je     150d <stable_grail_combine_blocks+0x3ad>
test   %eax,%eax
jle    155d <stable_grail_combine_blocks+0x3fd>
mov    %eax,%ebx
movslq %ebp,%r11
cmp    $0x4,%eax
jae    1587 <stable_grail_combine_blocks+0x427>
add    $0xffffffffffffffff,%rbx
lea    0x0(,%r11,8),%rcx
mov    %r15,%rax
sub    %rcx,%rax
nopl   0x0(%rax)
mov    (%rax,%rbx,8),%rcx
mov    %ebx,%edx
mov    %rcx,(%r15,%rdx,8)
lea    -0x1(%rbx),%rcx
add    $0x1,%rbx
cmp    $0x1,%rbx
mov    %rcx,%rbx
ja     14f0 <stable_grail_combine_blocks+0x390>
jmp    1562 <stable_grail_combine_blocks+0x402>
cmpl   $0x0,0x18(%rsp)
je     154b <stable_grail_combine_blocks+0x3eb>
test   %eax,%eax
jle    154b <stable_grail_combine_blocks+0x3eb>
movslq %ebp,%rbx
neg    %rbx
mov    %eax,%ebp
add    $0xffffffffffffffff,%rbp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %ebp,%eax
lea    (%r15,%rax,8),%rdi
lea    (%rdi,%rbx,8),%rsi
call   1070 <stable_grail_swap1@plt>
add    $0xffffffffffffffff,%rbp
lea    0x2(%rbp),%eax
cmp    $0x1,%eax
jg     1530 <stable_grail_combine_blocks+0x3d0>
add    $0x88,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x40(%rsp),%r11
shl    $0x3,%r11
sub    %r11,%r15
shl    $0x3,%ebp
mov    %r15,%rdi
mov    %ebp,%edx
add    $0x88,%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     14da <stable_grail_combine_blocks+0x37a>
shr    $0x20,%rcx
jne    14da <stable_grail_combine_blocks+0x37a>
lea    (%r15,%r8,8),%rcx
mov    %rcx,%rdi
sub    %rax,%rdi
cmp    %rcx,%rdi
ja     14da <stable_grail_combine_blocks+0x37a>
test   %dl,%dl
jne    14da <stable_grail_combine_blocks+0x37a>
mov    %r11,%rcx
not    %rcx
add    %rbx,%rcx
lea    (%r15,%rcx,8),%rcx
mov    %rcx,%rdi
sub    %rax,%rdi
cmp    %rcx,%rdi
ja     14da <stable_grail_combine_blocks+0x37a>
test   %dl,%dl
jne    14da <stable_grail_combine_blocks+0x37a>
lea    0x1(%r8),%rax
sub    %rbx,%rax
lea    (%r15,%rax,8),%rax
mov    %rbx,%rcx
sub    %r11,%rcx
lea    (%r15,%rcx,8),%rcx
cmp    %rcx,%rax
jae    162a <stable_grail_combine_blocks+0x4ca>
lea    (%r15,%r8,8),%rax
add    $0x8,%rax
lea    0x0(,%r11,8),%rcx
mov    %r15,%rdx
sub    %rcx,%rdx
cmp    %rax,%rdx
jb     14da <stable_grail_combine_blocks+0x37a>
mov    %ebx,%r8d
and    $0xfffffffc,%r8d
lea    -0x4(%r8),%rax
mov    %rax,%r9
shr    $0x2,%r9
add    $0x1,%r9
test   %rax,%rax
je     16ed <stable_grail_combine_blocks+0x58d>
mov    %r9,%rdi
and    $0xfffffffffffffffe,%rdi
mov    $0xfffffffffffffffe,%rax
sub    %r11,%rax
lea    (%r15,%rax,8),%r10
mov    $0xffffffffffffffff,%rdx
mov    %rbx,%rax
nopl   0x0(%rax,%rax,1)
lea    -0x1(%rax),%ecx
movups -0x10(%r10,%rax,8),%xmm0
movups (%r10,%rax,8),%xmm1
movups %xmm1,-0x8(%r15,%rcx,8)
movups %xmm0,-0x18(%r15,%rcx,8)
lea    -0x5(%rax),%ecx
movups -0x30(%r10,%rax,8),%xmm0
movups -0x20(%r10,%rax,8),%xmm1
movups %xmm1,-0x8(%r15,%rcx,8)
movups %xmm0,-0x18(%r15,%rcx,8)
add    $0xfffffffffffffff8,%rdx
add    $0xfffffffffffffff8,%rax
add    $0xfffffffffffffffe,%rdi
jne    1670 <stable_grail_combine_blocks+0x510>
test   $0x1,%r9b
je     16dc <stable_grail_combine_blocks+0x57c>
add    %rbx,%rdx
mov    %rdx,%rax
sub    %r11,%rax
movups -0x18(%r15,%rax,8),%xmm0
movups -0x8(%r15,%rax,8),%xmm1
mov    %edx,%eax
movups %xmm1,-0x8(%r15,%rax,8)
movups %xmm0,-0x18(%r15,%rax,8)
cmp    %rbx,%r8
je     1562 <stable_grail_combine_blocks+0x402>
and    $0x3,%ebx
jmp    14da <stable_grail_combine_blocks+0x37a>
mov    $0xffffffffffffffff,%rdx
test   $0x1,%r9b
jne    16b9 <stable_grail_combine_blocks+0x559>
jmp    16dc <stable_grail_combine_blocks+0x57c>

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