#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 */
typedef scalar_t__ int64_t;
typedef int /*<<< orphan*/ dst1;

/* Variables and functions */
size_t rbnd(size_t const);
int /*<<< orphan*/ sorter_bitonic_sort(scalar_t__ *, size_t const);
int /*<<< orphan*/ sorter_merge_sort_in_place_aswap(scalar_t__ *, scalar_t__ *,
                                                    size_t);
scalar_t__ sorter_merge_sort_in_place_backmerge(scalar_t__ *, size_t,
                                                scalar_t__ *, size_t);
int /*<<< orphan*/ sorter_merge_sort_in_place_frontmerge(scalar_t__ *, size_t,
                                                         scalar_t__ *, size_t);
int /*<<< orphan*/ sorter_merge_sort_in_place_rmerge(scalar_t__ *, size_t,
                                                     size_t, size_t);
void sorter_merge_sort_in_place(int64_t *dst, const size_t len) {
  size_t r = rbnd(len);
  size_t lr = (len / r - 1) * r;
  int64_t *dst1 = dst - 1;
  size_t p, m, q, q1, p0;
  if (len <= 1) {
    return;
  }
  if (len <= 16) {
    sorter_bitonic_sort(dst, len);
    return;
  }
  for (p = 2; p <= lr; p += 2) {
    dst1 += 2;
    if (((dst1[0]) - (dst1[-1])) < 0) {
      {
        int64_t _sort_swap_temp = (dst1[0]);
        (dst1[0]) = (dst1[-1]);
        (dst1[-1]) = _sort_swap_temp;
      };
    }
    if (p & 2) {
      continue;
    }
    m = len - p;
    q = 2;
    while ((p & q) == 0) {
      if (((dst1[1 - q]) - (dst1[-(int)q])) < 0) {
        break;
      }
      q *= 2;
    }
    if (p & q) {
      continue;
    }
    if (q < m) {
      p0 = len - q;
      sorter_merge_sort_in_place_aswap(dst + p - q, dst + p0, q);
      for (;;) {
        q1 = 2 * q;
        if ((q1 > m) || (p & q1)) {
          break;
        }
        p0 = len - q1;
        sorter_merge_sort_in_place_frontmerge(dst + (p - q1), q, dst + p0 + q,
                                              q);
        q = q1;
      }
      sorter_merge_sort_in_place_backmerge(dst + (len - 1), q, dst1 - q, q);
      q *= 2;
    }
    q1 = q;
    while (q1 > m) {
      q1 /= 2;
    }
    while ((q & p) == 0) {
      q *= 2;
      sorter_merge_sort_in_place_rmerge(dst + (p - q), q, q / 2, q1);
    }
  }
  q1 = 0;
  for (q = r; q < lr; q *= 2) {
    if ((lr & q) != 0) {
      q1 += q;
      if (q1 != q) {
        sorter_merge_sort_in_place_rmerge(dst + (lr - q1), q1, q, r);
      }
    }
  }
  m = len - lr;
  sorter_merge_sort_in_place(dst + lr, m);
  sorter_merge_sort_in_place_aswap(dst, dst + lr, m);
  m += sorter_merge_sort_in_place_backmerge(dst + (m - 1), m, dst + (lr - 1),
                                            lr - m);
  sorter_merge_sort_in_place(dst, m);
}


x86 assembly (clang, -O0):
<sorter_merge_sort_in_place>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1090 <rbnd@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0x18(%rbp)
sub    $0x1,%rax
imul   -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
add    $0xfffffffffffffff8,%rax
mov    %rax,-0x28(%rbp)
cmpq   $0x1,-0x10(%rbp)
ja     11c2 <sorter_merge_sort_in_place+0x52>
jmp    158b <sorter_merge_sort_in_place+0x41b>
cmpq   $0x10,-0x10(%rbp)
ja     11df <sorter_merge_sort_in_place+0x6f>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1080 <sorter_bitonic_sort@plt>
jmp    158b <sorter_merge_sort_in_place+0x41b>
movq   $0x2,-0x30(%rbp)
mov    -0x30(%rbp),%rax
cmp    -0x20(%rbp),%rax
ja     1476 <sorter_merge_sort_in_place+0x306>
mov    -0x28(%rbp),%rax
add    $0x10,%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    (%rax),%rax
mov    -0x28(%rbp),%rcx
sub    -0x8(%rcx),%rax
cmp    $0x0,%rax
jge    1240 <sorter_merge_sort_in_place+0xd0>
mov    -0x28(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x58(%rbp)
mov    -0x28(%rbp),%rax
mov    -0x8(%rax),%rcx
mov    -0x28(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x58(%rbp),%rcx
mov    -0x28(%rbp),%rax
mov    %rcx,-0x8(%rax)
mov    -0x30(%rbp),%rax
and    $0x2,%rax
cmp    $0x0,%rax
je     1257 <sorter_merge_sort_in_place+0xe7>
jmp    1465 <sorter_merge_sort_in_place+0x2f5>
mov    -0x10(%rbp),%rax
sub    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
movq   $0x2,-0x40(%rbp)
mov    -0x30(%rbp),%rax
and    -0x40(%rbp),%rax
cmp    $0x0,%rax
jne    12c3 <sorter_merge_sort_in_place+0x153>
mov    -0x28(%rbp),%rax
mov    $0x1,%ecx
sub    -0x40(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x28(%rbp),%rcx
mov    -0x40(%rbp),%rdx
mov    %edx,%esi
xor    %edx,%edx
sub    %esi,%edx
movslq %edx,%rdx
sub    (%rcx,%rdx,8),%rax
cmp    $0x0,%rax
jge    12b2 <sorter_merge_sort_in_place+0x142>
jmp    12c3 <sorter_merge_sort_in_place+0x153>
mov    -0x40(%rbp),%rax
shl    $0x1,%rax
mov    %rax,-0x40(%rbp)
jmp    126b <sorter_merge_sort_in_place+0xfb>
mov    -0x30(%rbp),%rax
and    -0x40(%rbp),%rax
cmp    $0x0,%rax
je     12da <sorter_merge_sort_in_place+0x16a>
jmp    1465 <sorter_merge_sort_in_place+0x2f5>
mov    -0x40(%rbp),%rax
cmp    -0x38(%rbp),%rax
jae    13e9 <sorter_merge_sort_in_place+0x279>
mov    -0x10(%rbp),%rax
sub    -0x40(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x30(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdi
xor    %eax,%eax
sub    -0x40(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdi
mov    -0x8(%rbp),%rsi
mov    -0x50(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rsi
mov    -0x40(%rbp),%rdx
call   1030 <sorter_merge_sort_in_place_aswap@plt>
mov    -0x40(%rbp),%rax
shl    $0x1,%rax
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rax
cmp    -0x38(%rbp),%rax
ja     1354 <sorter_merge_sort_in_place+0x1e4>
mov    -0x30(%rbp),%rax
and    -0x48(%rbp),%rax
cmp    $0x0,%rax
je     1359 <sorter_merge_sort_in_place+0x1e9>
jmp    13ac <sorter_merge_sort_in_place+0x23c>
mov    -0x10(%rbp),%rax
sub    -0x48(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x30(%rbp),%rax
sub    -0x48(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdi
mov    -0x40(%rbp),%rsi
mov    -0x8(%rbp),%rdx
mov    -0x50(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdx
mov    -0x40(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdx
mov    -0x40(%rbp),%rcx
call   1060 <sorter_merge_sort_in_place_frontmerge@plt>
mov    -0x48(%rbp),%rax
mov    %rax,-0x40(%rbp)
jmp    1328 <sorter_merge_sort_in_place+0x1b8>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
sub    $0x1,%rax
shl    $0x3,%rax
add    %rax,%rdi
mov    -0x40(%rbp),%rsi
mov    -0x28(%rbp),%rdx
xor    %eax,%eax
sub    -0x40(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdx
mov    -0x40(%rbp),%rcx
call   1050 <sorter_merge_sort_in_place_backmerge@plt>
mov    -0x40(%rbp),%rax
shl    $0x1,%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rax
cmp    -0x38(%rbp),%rax
jbe    1410 <sorter_merge_sort_in_place+0x2a0>
mov    -0x48(%rbp),%rax
shr    $0x1,%rax
mov    %rax,-0x48(%rbp)
jmp    13f1 <sorter_merge_sort_in_place+0x281>
jmp    1415 <sorter_merge_sort_in_place+0x2a5>
mov    -0x40(%rbp),%rax
and    -0x30(%rbp),%rax
cmp    $0x0,%rax
jne    1460 <sorter_merge_sort_in_place+0x2f0>
mov    -0x40(%rbp),%rax
shl    $0x1,%rax
mov    %rax,-0x40(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x30(%rbp),%rax
sub    -0x40(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdi
mov    -0x40(%rbp),%rsi
mov    -0x40(%rbp),%rdx
shr    $0x1,%rdx
mov    -0x48(%rbp),%rcx
call   1070 <sorter_merge_sort_in_place_rmerge@plt>
jmp    1415 <sorter_merge_sort_in_place+0x2a5>
jmp    1465 <sorter_merge_sort_in_place+0x2f5>
mov    -0x30(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x30(%rbp)
jmp    11e7 <sorter_merge_sort_in_place+0x77>
movq   $0x0,-0x48(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rax
cmp    -0x20(%rbp),%rax
jae    14ff <sorter_merge_sort_in_place+0x38f>
mov    -0x20(%rbp),%rax
and    -0x40(%rbp),%rax
cmp    $0x0,%rax
je     14e9 <sorter_merge_sort_in_place+0x379>
mov    -0x40(%rbp),%rax
add    -0x48(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rax
cmp    -0x40(%rbp),%rax
je     14e4 <sorter_merge_sort_in_place+0x374>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rax
sub    -0x48(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdi
mov    -0x48(%rbp),%rsi
mov    -0x40(%rbp),%rdx
mov    -0x18(%rbp),%rcx
call   1070 <sorter_merge_sort_in_place_rmerge@plt>
jmp    14e9 <sorter_merge_sort_in_place+0x379>
jmp    14ee <sorter_merge_sort_in_place+0x37e>
mov    -0x40(%rbp),%rax
shl    $0x1,%rax
mov    %rax,-0x40(%rbp)
jmp    1486 <sorter_merge_sort_in_place+0x316>
mov    -0x10(%rbp),%rax
sub    -0x20(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdi
mov    -0x38(%rbp),%rsi
call   1040 <sorter_merge_sort_in_place@plt>
mov    -0x8(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x20(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rsi
mov    -0x38(%rbp),%rdx
call   1030 <sorter_merge_sort_in_place_aswap@plt>
mov    -0x8(%rbp),%rdi
mov    -0x38(%rbp),%rax
sub    $0x1,%rax
shl    $0x3,%rax
add    %rax,%rdi
mov    -0x38(%rbp),%rsi
mov    -0x8(%rbp),%rdx
mov    -0x20(%rbp),%rax
sub    $0x1,%rax
shl    $0x3,%rax
add    %rax,%rdx
mov    -0x20(%rbp),%rcx
sub    -0x38(%rbp),%rcx
call   1050 <sorter_merge_sort_in_place_backmerge@plt>
add    -0x38(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x38(%rbp),%rsi
call   1040 <sorter_merge_sort_in_place@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sorter_merge_sort_in_place>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %rsi,%rbp
mov    %rdi,0x8(%rsp)
mov    %rsi,%rdi
call   1090 <rbnd@plt>
cmp    $0x2,%rbp
jae    11a3 <sorter_merge_sort_in_place+0x33>
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %rax,%rcx
mov    %rbp,%rax
or     %rcx,%rax
shr    $0x20,%rax
je     11bf <sorter_merge_sort_in_place+0x4f>
mov    %rbp,%rax
xor    %edx,%edx
div    %rcx
mov    %rax,%r13
jmp    11c8 <sorter_merge_sort_in_place+0x58>
mov    %ebp,%eax
xor    %edx,%edx
div    %ecx
mov    %eax,%r13d
add    $0xffffffffffffffff,%r13
imul   %rcx,%r13
mov    0x8(%rsp),%rax
add    $0xfffffffffffffff8,%rax
mov    %rax,0x18(%rsp)
jmp    1281 <sorter_merge_sort_in_place+0x111>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r14,%rbx
sub    %r13,%rbx
mov    0x8(%rsp),%rbp
lea    0x0(,%r13,8),%r14
add    %rbp,%r14
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <sorter_merge_sort_in_place@plt>
mov    %rbp,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1030 <sorter_merge_sort_in_place_aswap@plt>
lea    -0x8(,%rbx,8),%rdi
ff
add    %rbp,%rdi
lea    -0x8(,%r13,8),%rdx
ff
add    %rbp,%rdx
sub    %rbx,%r13
mov    %rbx,%rsi
mov    %r13,%rcx
call   1050 <sorter_merge_sort_in_place_backmerge@plt>
mov    %rax,%rbp
add    %rbx,%rbp
mov    %rbp,%rdi
call   1090 <rbnd@plt>
mov    %rax,%rcx
mov    %rbp,%rax
or     %rcx,%rax
shr    $0x20,%rax
je     14c0 <sorter_merge_sort_in_place+0x350>
mov    %rbp,%rax
xor    %edx,%edx
div    %rcx
mov    %rax,%r13
add    $0xffffffffffffffff,%r13
imul   %rcx,%r13
cmp    $0x1,%rbp
jbe    1194 <sorter_merge_sort_in_place+0x24>
cmp    $0x11,%rbp
jb     14ce <sorter_merge_sort_in_place+0x35e>
mov    %rcx,0x20(%rsp)
mov    %rbp,0x10(%rsp)
cmp    $0x2,%r13
jae    1300 <sorter_merge_sort_in_place+0x190>
mov    0x20(%rsp),%r15
cmp    %r13,%r15
mov    0x10(%rsp),%r14
jae    11f0 <sorter_merge_sort_in_place+0x80>
xor    %eax,%eax
mov    %r15,%rbp
jmp    12d2 <sorter_merge_sort_in_place+0x162>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rax,%rbx
add    %rbp,%rbp
mov    %rbx,%rax
cmp    %r13,%rbp
jae    11f0 <sorter_merge_sort_in_place+0x80>
test   %r13,%rbp
je     12c0 <sorter_merge_sort_in_place+0x150>
lea    (%rax,%rbp,1),%rbx
test   %rax,%rax
je     12c3 <sorter_merge_sort_in_place+0x153>
mov    %r13,%rax
sub    %rbx,%rax
mov    0x8(%rsp),%rcx
lea    (%rcx,%rax,8),%rdi
mov    %rbx,%rsi
mov    %rbp,%rdx
mov    %r15,%rcx
call   1070 <sorter_merge_sort_in_place_rmerge@plt>
jmp    12c3 <sorter_merge_sort_in_place+0x153>
nop
mov    0x8(%rsp),%rax
mov    0x10(%rsp),%rcx
lea    (%rax,%rcx,8),%rax
add    $0xfffffffffffffff8,%rax
mov    %rax,0x28(%rsp)
mov    $0x2,%r14d
mov    0x18(%rsp),%r12
mov    %r13,0x30(%rsp)
jmp    1342 <sorter_merge_sort_in_place+0x1d2>
nopl   0x0(%rax)
add    $0x2,%r14
mov    0x30(%rsp),%r13
cmp    %r13,%r14
ja     129b <sorter_merge_sort_in_place+0x12b>
mov    0x8(%r12),%rcx
mov    0x10(%r12),%rax
cmp    %rcx,%rax
jge    135b <sorter_merge_sort_in_place+0x1eb>
mov    %rcx,0x10(%r12)
mov    %rax,0x8(%r12)
add    $0x10,%r12
test   $0x2,%r14b
jne    1330 <sorter_merge_sort_in_place+0x1c0>
mov    0x10(%rsp),%r15
sub    %r14,%r15
mov    $0x2,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0x1,%eax
sub    %rbp,%rax
mov    (%r12,%rax,8),%rax
mov    %rbp,%rcx
shl    $0x20,%rcx
neg    %rcx
sar    $0x1d,%rcx
cmp    (%r12,%rcx,1),%rax
jl     13b0 <sorter_merge_sort_in_place+0x240>
add    %rbp,%rbp
test   %r14,%rbp
je     1380 <sorter_merge_sort_in_place+0x210>
jmp    1330 <sorter_merge_sort_in_place+0x1c0>
nopw   0x0(%rax,%rax,1)
cmp    %r15,%rbp
jae    1458 <sorter_merge_sort_in_place+0x2e8>
mov    0x10(%rsp),%rax
sub    %rbp,%rax
mov    0x8(%rsp),%rdx
lea    (%rdx,%r14,8),%rdi
mov    %rbp,%r13
neg    %r13
lea    0x0(,%rbp,8),%rcx
sub    %rcx,%rdi
lea    (%rdx,%rax,8),%rsi
mov    %rbp,%rdx
call   1030 <sorter_merge_sort_in_place_aswap@plt>
mov    %rbp,%rbx
add    %rbp,%rbx
cmp    %r15,%rbx
ja     1441 <sorter_merge_sort_in_place+0x2d1>
mov    %rbx,%rax
and    %r14,%rax
jne    1441 <sorter_merge_sort_in_place+0x2d1>
mov    0x10(%rsp),%r13
nop
mov    %rbp,%rcx
mov    %rbx,%rbp
mov    %r13,%rax
sub    %rbx,%rax
mov    %r14,%rdx
sub    %rbx,%rdx
mov    0x8(%rsp),%rsi
lea    (%rsi,%rdx,8),%rdi
lea    (%rsi,%rax,8),%rax
lea    (%rax,%rcx,8),%rdx
mov    %rcx,%rsi
call   1060 <sorter_merge_sort_in_place_frontmerge@plt>
add    %rbx,%rbx
cmp    %r15,%rbx
ja     143b <sorter_merge_sort_in_place+0x2cb>
mov    %rbx,%rax
and    %r14,%rax
je     1400 <sorter_merge_sort_in_place+0x290>
mov    %rbp,%r13
neg    %r13
lea    (%r12,%r13,8),%rdx
mov    0x28(%rsp),%rdi
mov    %rbp,%rsi
mov    %rbp,%rcx
call   1050 <sorter_merge_sort_in_place_backmerge@plt>
mov    %rbx,%rbp
mov    %rbp,%rax
nopl   0x0(%rax,%rax,1)
mov    %rax,%r13
shr    %rax
cmp    %r15,%r13
ja     1460 <sorter_merge_sort_in_place+0x2f0>
test   %r14,%rbp
jne    1330 <sorter_merge_sort_in_place+0x1c0>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rbp,%rbx
add    %rbp,%rbx
mov    %r14,%rax
sub    %rbx,%rax
mov    0x8(%rsp),%rcx
lea    (%rcx,%rax,8),%rdi
movabs $0x7ffffffffffffffe,%rax
ff ff 7f
and    %rax,%rbp
mov    %rbx,%rsi
mov    %rbp,%rdx
mov    %r13,%rcx
call   1070 <sorter_merge_sort_in_place_rmerge@plt>
mov    %rbx,%rbp
test   %r14,%rbx
je     1480 <sorter_merge_sort_in_place+0x310>
jmp    1330 <sorter_merge_sort_in_place+0x1c0>
nopl   (%rax)
mov    %ebp,%eax
xor    %edx,%edx
div    %ecx
mov    %eax,%r13d
jmp    126f <sorter_merge_sort_in_place+0xff>
mov    0x8(%rsp),%rdi
mov    %rbp,%rsi
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1080 <sorter_bitonic_sort@plt>

LLVM IR (-O0):
define void @sorter_merge_sort_in_place(i64* %0, i64 %1) {
%3 = alloca i64*
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64*
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64
%11 = alloca i64
%12 = alloca i64
%13 = alloca i64
store i64* %0, i64** %3
store i64 %1, i64* %4
%14 = load i64, i64* %4
%15 = call i64 @rbnd(i64 %14)
store i64 %15, i64* %5
%16 = load i64, i64* %4
%17 = load i64, i64* %5
%18 = udiv i64 %16, %17
%19 = sub i64 %18, 1
%20 = load i64, i64* %5
%21 = mul i64 %19, %20
store i64 %21, i64* %6
%22 = load i64*, i64** %3
%23 = getelementptr inbounds i64, i64* %22, i64 -1
store i64* %23, i64** %7
%24 = load i64, i64* %4
%25 = icmp ule i64 %24, 1
br i1 %25, label %26, label %27
26: ; preds = %2
br label %260
27: ; preds = %2
%28 = load i64, i64* %4
%29 = icmp ule i64 %28, 16
br i1 %29, label %30, label %34
30: ; preds = %27
%31 = load i64*, i64** %3
%32 = load i64, i64* %4
%33 = call i32 @sorter_bitonic_sort(i64* %31, i64 %32)
br label %260
34: ; preds = %27
store i64 2, i64* %8
br label %35
35: ; preds = %193, %34
%36 = load i64, i64* %8
%37 = load i64, i64* %6
%38 = icmp ule i64 %36, %37
br i1 %38, label %39, label %196
39: ; preds = %35
%40 = load i64*, i64** %7
%41 = getelementptr inbounds i64, i64* %40, i64 2
store i64* %41, i64** %7
%42 = load i64*, i64** %7
%43 = getelementptr inbounds i64, i64* %42, i64 0
%44 = load i64, i64* %43
%45 = load i64*, i64** %7
%46 = getelementptr inbounds i64, i64* %45, i64 -1
%47 = load i64, i64* %46
%48 = sub nsw i64 %44, %47
%49 = icmp slt i64 %48, 0
br i1 %49, label %50, label %62
50: ; preds = %39
%51 = load i64*, i64** %7
%52 = getelementptr inbounds i64, i64* %51, i64 0
%53 = load i64, i64* %52
store i64 %53, i64* %13
%54 = load i64*, i64** %7
%55 = getelementptr inbounds i64, i64* %54, i64 -1
%56 = load i64, i64* %55
%57 = load i64*, i64** %7
%58 = getelementptr inbounds i64, i64* %57, i64 0
store i64 %56, i64* %58
%59 = load i64, i64* %13
%60 = load i64*, i64** %7
%61 = getelementptr inbounds i64, i64* %60, i64 -1
store i64 %59, i64* %61
br label %62
62: ; preds = %50, %39
%63 = load i64, i64* %8
%64 = and i64 %63, 2
%65 = icmp ne i64 %64, 0
br i1 %65, label %66, label %67
66: ; preds = %62
br label %193
67: ; preds = %62
%68 = load i64, i64* %4
%69 = load i64, i64* %8
%70 = sub i64 %68, %69
store i64 %70, i64* %9
store i64 2, i64* %10
br label %71
71: ; preds = %92, %67
%72 = load i64, i64* %8
%73 = load i64, i64* %10
%74 = and i64 %72, %73
%75 = icmp eq i64 %74, 0
br i1 %75, label %76, label %95
76: ; preds = %71
%77 = load i64*, i64** %7
%78 = load i64, i64* %10
%79 = sub i64 1, %78
%80 = getelementptr inbounds i64, i64* %77, i64 %79
%81 = load i64, i64* %80
%82 = load i64*, i64** %7
%83 = load i64, i64* %10
%84 = trunc i64 %83 to i32
%85 = sub nsw i32 0, %84
%86 = sext i32 %85 to i64
%87 = getelementptr inbounds i64, i64* %82, i64 %86
%88 = load i64, i64* %87
%89 = sub nsw i64 %81, %88
%90 = icmp slt i64 %89, 0
br i1 %90, label %91, label %92
91: ; preds = %76
br label %95
92: ; preds = %76
%93 = load i64, i64* %10
%94 = mul i64 %93, 2
store i64 %94, i64* %10
br label %71
95: ; preds = %91, %71
%96 = load i64, i64* %8
%97 = load i64, i64* %10
%98 = and i64 %96, %97
%99 = icmp ne i64 %98, 0
br i1 %99, label %100, label %101
100: ; preds = %95
br label %193
101: ; preds = %95
%102 = load i64, i64* %10
%103 = load i64, i64* %9
%104 = icmp ult i64 %102, %103
br i1 %104, label %105, label %164
105: ; preds = %101
%106 = load i64, i64* %4
%107 = load i64, i64* %10
%108 = sub i64 %106, %107
store i64 %108, i64* %12
%109 = load i64*, i64** %3
%110 = load i64, i64* %8
%111 = getelementptr inbounds i64, i64* %109, i64 %110
%112 = load i64, i64* %10
%113 = sub i64 0, %112
%114 = getelementptr inbounds i64, i64* %111, i64 %113
%115 = load i64*, i64** %3
%116 = load i64, i64* %12
%117 = getelementptr inbounds i64, i64* %115, i64 %116
%118 = load i64, i64* %10
%119 = call i32 @sorter_merge_sort_in_place_aswap(i64* %114, i64* %117, i64 %118)
br label %120
120: ; preds = %132, %105
%121 = load i64, i64* %10
%122 = mul i64 2, %121
store i64 %122, i64* %11
%123 = load i64, i64* %11
%124 = load i64, i64* %9
%125 = icmp ugt i64 %123, %124
br i1 %125, label %131, label %126
126: ; preds = %120
%127 = load i64, i64* %8
%128 = load i64, i64* %11
%129 = and i64 %127, %128
%130 = icmp ne i64 %129, 0
br i1 %130, label %131, label %132
131: ; preds = %126, %120
br label %150
132: ; preds = %126
%133 = load i64, i64* %4
%134 = load i64, i64* %11
%135 = sub i64 %133, %134
store i64 %135, i64* %12
%136 = load i64*, i64** %3
%137 = load i64, i64* %8
%138 = load i64, i64* %11
%139 = sub i64 %137, %138
%140 = getelementptr inbounds i64, i64* %136, i64 %139
%141 = load i64, i64* %10
%142 = load i64*, i64** %3
%143 = load i64, i64* %12
%144 = getelementptr inbounds i64, i64* %142, i64 %143
%145 = load i64, i64* %10
%146 = getelementptr inbounds i64, i64* %144, i64 %145
%147 = load i64, i64* %10
%148 = call i32 @sorter_merge_sort_in_place_frontmerge(i64* %140, i64 %141, i64* %146, i64 %147)
%149 = load i64, i64* %11
store i64 %149, i64* %10
br label %120
150: ; preds = %131
%151 = load i64*, i64** %3
%152 = load i64, i64* %4
%153 = sub i64 %152, 1
%154 = getelementptr inbounds i64, i64* %151, i64 %153
%155 = load i64, i64* %10
%156 = load i64*, i64** %7
%157 = load i64, i64* %10
%158 = sub i64 0, %157
%159 = getelementptr inbounds i64, i64* %156, i64 %158
%160 = load i64, i64* %10
%161 = call i64 @sorter_merge_sort_in_place_backmerge(i64* %154, i64 %155, i64* %159, i64 %160)
%162 = load i64, i64* %10
%163 = mul i64 %162, 2
store i64 %163, i64* %10
br label %164
164: ; preds = %150, %101
%165 = load i64, i64* %10
store i64 %165, i64* %11
br label %166
166: ; preds = %170, %164
%167 = load i64, i64* %11
%168 = load i64, i64* %9
%169 = icmp ugt i64 %167, %168
br i1 %169, label %170, label %173
170: ; preds = %166
%171 = load i64, i64* %11
%172 = udiv i64 %171, 2
store i64 %172, i64* %11
br label %166
173: ; preds = %166
br label %174
174: ; preds = %179, %173
%175 = load i64, i64* %10
%176 = load i64, i64* %8
%177 = and i64 %175, %176
%178 = icmp eq i64 %177, 0
br i1 %178, label %179, label %192
179: ; preds = %174
%180 = load i64, i64* %10
%181 = mul i64 %180, 2
store i64 %181, i64* %10
%182 = load i64*, i64** %3
%183 = load i64, i64* %8
%184 = load i64, i64* %10
%185 = sub i64 %183, %184
%186 = getelementptr inbounds i64, i64* %182, i64 %185
%187 = load i64, i64* %10
%188 = load i64, i64* %10
%189 = udiv i64 %188, 2
%190 = load i64, i64* %11
%191 = call i32 @sorter_merge_sort_in_place_rmerge(i64* %186, i64 %187, i64 %189, i64 %190)
br label %174
192: ; preds = %174
br label %193
193: ; preds = %192, %100, %66
%194 = load i64, i64* %8
%195 = add i64 %194, 2
store i64 %195, i64* %8
br label %35
196: ; preds = %35
store i64 0, i64* %11
%197 = load i64, i64* %5
store i64 %197, i64* %10
br label %198
198: ; preds = %226, %196
%199 = load i64, i64* %10
%200 = load i64, i64* %6
%201 = icmp ult i64 %199, %200
br i1 %201, label %202, label %229
202: ; preds = %198
%203 = load i64, i64* %6
%204 = load i64, i64* %10
%205 = and i64 %203, %204
%206 = icmp ne i64 %205, 0
br i1 %206, label %207, label %225
207: ; preds = %202
%208 = load i64, i64* %10
%209 = load i64, i64* %11
%210 = add i64 %209, %208
store i64 %210, i64* %11
%211 = load i64, i64* %11
%212 = load i64, i64* %10
%213 = icmp ne i64 %211, %212
br i1 %213, label %214, label %224
214: ; preds = %207
%215 = load i64*, i64** %3
%216 = load i64, i64* %6
%217 = load i64, i64* %11
%218 = sub i64 %216, %217
%219 = getelementptr inbounds i64, i64* %215, i64 %218
%220 = load i64, i64* %11
%221 = load i64, i64* %10
%222 = load i64, i64* %5
%223 = call i32 @sorter_merge_sort_in_place_rmerge(i64* %219, i64 %220, i64 %221, i64 %222)
br label %224
224: ; preds = %214, %207
br label %225
225: ; preds = %224, %202
br label %226
226: ; preds = %225
%227 = load i64, i64* %10
%228 = mul i64 %227, 2
store i64 %228, i64* %10
br label %198
229: ; preds = %198
%230 = load i64, i64* %4
%231 = load i64, i64* %6
%232 = sub i64 %230, %231
store i64 %232, i64* %9
%233 = load i64*, i64** %3
%234 = load i64, i64* %6
%235 = getelementptr inbounds i64, i64* %233, i64 %234
%236 = load i64, i64* %9
%237 = load i64*, i64** %3
%238 = load i64*, i64** %3
%239 = load i64, i64* %6
%240 = getelementptr inbounds i64, i64* %238, i64 %239
%241 = load i64, i64* %9
%242 = call i32 @sorter_merge_sort_in_place_aswap(i64* %237, i64* %240, i64 %241)
%243 = load i64*, i64** %3
%244 = load i64, i64* %9
%245 = sub i64 %244, 1
%246 = getelementptr inbounds i64, i64* %243, i64 %245
%247 = load i64, i64* %9
%248 = load i64*, i64** %3
%249 = load i64, i64* %6
%250 = sub i64 %249, 1
%251 = getelementptr inbounds i64, i64* %248, i64 %250
%252 = load i64, i64* %6
%253 = load i64, i64* %9
%254 = sub i64 %252, %253
%255 = call i64 @sorter_merge_sort_in_place_backmerge(i64* %246, i64 %247, i64* %251, i64 %254)
%256 = load i64, i64* %9
%257 = add i64 %256, %255
store i64 %257, i64* %9
%258 = load i64*, i64** %3
%259 = load i64, i64* %9
br label %260
260: ; preds = %229, %30, %26
ret void
}

LLVM IR (-O2):
define void @sorter_merge_sort_in_place(i64* %0, i64 %1) {
%3 = tail call i64 @rbnd(i64 %1)
%4 = icmp ult i64 %1, 2
br i1 %4, label %141, label %5
5: ; preds = %2
%6 = udiv i64 %1, %3
%7 = add i64 %6, -1
%8 = mul i64 %7, %3
%9 = getelementptr inbounds i64, i64* %0, i64 -1
br label %10
10: ; preds = %5, %125
%11 = phi i64 [ %8, %5 ], [ %139, %125 ]
%12 = phi i64 [ %3, %5 ], [ %136, %125 ]
%13 = phi i64 [ %1, %5 ], [ %135, %125 ]
%14 = icmp ult i64 %13, 17
br i1 %14, label %20, label %15
15: ; preds = %10
%16 = icmp ult i64 %11, 2
br i1 %16, label %22, label %17
17: ; preds = %15
%18 = add i64 %13, -1
%19 = getelementptr inbounds i64, i64* %0, i64 %18
br label %24
20: ; preds = %10
%21 = tail call i32 @sorter_bitonic_sort(i64* %0, i64 %13)
br label %141
22: ; preds = %106, %15
%23 = icmp ult i64 %12, %11
br i1 %23, label %109, label %125
24: ; preds = %17, %106
%25 = phi i64* [ %9, %17 ], [ %27, %106 ]
%26 = phi i64 [ 2, %17 ], [ %107, %106 ]
%27 = getelementptr inbounds i64, i64* %25, i64 2
%28 = load i64, i64* %27
%29 = getelementptr inbounds i64, i64* %25, i64 1
%30 = load i64, i64* %29
%31 = icmp slt i64 %28, %30
br i1 %31, label %32, label %33
32: ; preds = %24
store i64 %30, i64* %27
store i64 %28, i64* %29
br label %33
33: ; preds = %32, %24
%34 = and i64 %26, 2
%35 = icmp eq i64 %34, 0
br i1 %35, label %36, label %106
36: ; preds = %33
%37 = sub i64 %13, %26
br label %38
38: ; preds = %36, %48
%39 = phi i64 [ %49, %48 ], [ 2, %36 ]
%40 = sub i64 1, %39
%41 = getelementptr inbounds i64, i64* %27, i64 %40
%42 = load i64, i64* %41
%43 = mul i64 %39, -4294967296
%44 = ashr exact i64 %43, 32
%45 = getelementptr inbounds i64, i64* %27, i64 %44
%46 = load i64, i64* %45
%47 = icmp slt i64 %42, %46
br i1 %47, label %52, label %48
48: ; preds = %38
%49 = shl i64 %39, 1
%50 = and i64 %49, %26
%51 = icmp eq i64 %50, 0
br i1 %51, label %38, label %106
52: ; preds = %38
%53 = icmp ult i64 %39, %37
br i1 %53, label %54, label %88
54: ; preds = %52
%55 = sub i64 %13, %39
%56 = getelementptr inbounds i64, i64* %0, i64 %26
%57 = sub i64 0, %39
%58 = getelementptr inbounds i64, i64* %56, i64 %57
%59 = getelementptr inbounds i64, i64* %0, i64 %55
%60 = tail call i32 @sorter_merge_sort_in_place_aswap(i64* %58, i64* %59, i64 %39)
%61 = shl i64 %39, 1
%62 = icmp ule i64 %61, %37
%63 = and i64 %61, %26
%64 = icmp eq i64 %63, 0
%65 = and i1 %62, %64
br i1 %65, label %66, label %82
66: ; preds = %54, %66
%67 = phi i64 [ %75, %66 ], [ %61, %54 ]
%68 = phi i64 [ %67, %66 ], [ %39, %54 ]
%69 = sub i64 %13, %67
%70 = sub i64 %26, %67
%71 = getelementptr inbounds i64, i64* %0, i64 %70
%72 = getelementptr inbounds i64, i64* %0, i64 %69
%73 = getelementptr inbounds i64, i64* %72, i64 %68
%74 = tail call i32 @sorter_merge_sort_in_place_frontmerge(i64* %71, i64 %68, i64* %73, i64 %68)
%75 = shl i64 %67, 1
%76 = icmp ule i64 %75, %37
%77 = and i64 %75, %26
%78 = icmp eq i64 %77, 0
%79 = and i1 %76, %78
br i1 %79, label %66, label %80
80: ; preds = %66
%81 = sub i64 0, %67
br label %82
82: ; preds = %80, %54
%83 = phi i64 [ %81, %80 ], [ %57, %54 ]
%84 = phi i64 [ %67, %80 ], [ %39, %54 ]
%85 = phi i64 [ %75, %80 ], [ %61, %54 ]
%86 = getelementptr inbounds i64, i64* %27, i64 %83
%87 = tail call i64 @sorter_merge_sort_in_place_backmerge(i64* %19, i64 %84, i64* %86, i64 %84)
br label %88
88: ; preds = %82, %52
%89 = phi i64 [ %85, %82 ], [ %39, %52 ]
br label %90
90: ; preds = %90, %88
%91 = phi i64 [ %89, %88 ], [ %93, %90 ]
%92 = icmp ugt i64 %91, %37
%93 = lshr i64 %91, 1
br i1 %92, label %90, label %94
94: ; preds = %90
%95 = and i64 %89, %26
%96 = icmp eq i64 %95, 0
br i1 %96, label %97, label %106
97: ; preds = %94, %97
%98 = phi i64 [ %99, %97 ], [ %89, %94 ]
%99 = shl i64 %98, 1
%100 = sub i64 %26, %99
%101 = getelementptr inbounds i64, i64* %0, i64 %100
%102 = and i64 %98, 9223372036854775806
%103 = tail call i32 @sorter_merge_sort_in_place_rmerge(i64* %101, i64 %99, i64 %102, i64 %91)
%104 = and i64 %99, %26
%105 = icmp eq i64 %104, 0
br i1 %105, label %97, label %106
106: ; preds = %48, %97, %94, %33
%107 = add i64 %26, 2
%108 = icmp ugt i64 %107, %11
br i1 %108, label %22, label %24
109: ; preds = %22, %121
%110 = phi i64 [ %122, %121 ], [ 0, %22 ]
%111 = phi i64 [ %123, %121 ], [ %12, %22 ]
%112 = and i64 %111, %11
%113 = icmp eq i64 %112, 0
br i1 %113, label %121, label %114
114: ; preds = %109
%115 = add i64 %110, %111
%116 = icmp eq i64 %110, 0
br i1 %116, label %121, label %117
117: ; preds = %114
%118 = sub i64 %11, %115
%119 = getelementptr inbounds i64, i64* %0, i64 %118
%120 = tail call i32 @sorter_merge_sort_in_place_rmerge(i64* %119, i64 %115, i64 %111, i64 %12)
br label %121
121: ; preds = %109, %117, %114
%122 = phi i64 [ %115, %117 ], [ %115, %114 ], [ %110, %109 ]
%123 = shl i64 %111, 1
%124 = icmp ult i64 %123, %11
br i1 %124, label %109, label %125
125: ; preds = %121, %22
%126 = sub i64 %13, %11
%127 = getelementptr inbounds i64, i64* %0, i64 %11
tail call void @sorter_merge_sort_in_place(i64* %127, i64 %126)
%128 = tail call i32 @sorter_merge_sort_in_place_aswap(i64* %0, i64* %127, i64 %126)
%129 = add i64 %126, -1
%130 = getelementptr inbounds i64, i64* %0, i64 %129
%131 = add i64 %11, -1
%132 = getelementptr inbounds i64, i64* %0, i64 %131
%133 = sub i64 %11, %126
%134 = tail call i64 @sorter_merge_sort_in_place_backmerge(i64* %130, i64 %126, i64* %132, i64 %133)
%135 = add i64 %134, %126
%136 = tail call i64 @rbnd(i64 %135)
%137 = udiv i64 %135, %136
%138 = add i64 %137, -1
%139 = mul i64 %138, %136
%140 = icmp ult i64 %135, 2
br i1 %140, label %141, label %10
141: ; preds = %125, %2, %20
ret void
}