#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*/ buy(int, int, int, int, int, int, int, int /*<<< orphan*/,
                       int, int, int, int, int, int /*<<< orphan*/, int, int);
void btr(int turn, int gold, int shield, int bomb, int animus, int tarsierw,
         int tarsier, int perforator, int shadowfang, int immolitew,
         int immolite, int nitrocybew, int nitrocybe, int nsup) {
  if (turn == 4) {
    int perf = perforator < animus * 2 ? perforator : animus * 2;
    buy(turn, gold, tarsier + shadowfang * 2 + perf + immolite + nitrocybe, 0,
        shield, bomb, animus, 0, 0, 0, 0, 0, 0, 0, 0, 0);
  } else {
    for (int perf = 0; perf <= perforator && perf <= animus * 2; perf++) {
      for (int immo = 0; immo <= immolite; immo++) {
        int attack = tarsier + shadowfang * 2 + perf + immo;
        int red = animus * 2 - perf;
        if (shield * 4 > attack + nitrocybe && attack % 4 != 0 &&
            nitrocybe >= (4 - attack % 4)) {
          buy(turn, gold, (attack + 3) / 4 * 4, red, shield, bomb, animus, 0,
              tarsierw + tarsier, perforator, shadowfang, immo,
              immolitew + immolite - immo, 0,
              nitrocybew + nitrocybe - (4 - attack % 4), nsup);
        } else if (shield * 4 > attack + nitrocybe) {
          buy(turn, gold, attack, red, shield, bomb, animus, 0,
              tarsierw + tarsier, perforator, shadowfang, immo,
              immolitew + immolite - immo, 0, nitrocybew + nitrocybe, nsup);
        } else {
          buy(turn, gold, attack + nitrocybe, red, shield, bomb, animus, 0,
              tarsierw + tarsier, perforator, shadowfang, immo,
              immolitew + immolite - immo, 0, nitrocybew, nsup);
        }
      }
    }
  }
}


x86 assembly (clang, -O0):
<btr>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xa8,%rsp
mov    0x48(%rbp),%eax
mov    0x40(%rbp),%eax
mov    0x38(%rbp),%eax
mov    0x30(%rbp),%eax
mov    0x28(%rbp),%eax
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%eax
mov    %edi,-0x2c(%rbp)
mov    %esi,-0x30(%rbp)
mov    %edx,-0x34(%rbp)
mov    %ecx,-0x38(%rbp)
mov    %r8d,-0x3c(%rbp)
mov    %r9d,-0x40(%rbp)
cmpl   $0x4,-0x2c(%rbp)
jne    1201 <btr+0xf1>
mov    0x18(%rbp),%eax
mov    -0x3c(%rbp),%ecx
shl    $0x1,%ecx
cmp    %ecx,%eax
jge    1176 <btr+0x66>
mov    0x18(%rbp),%eax
mov    %eax,-0x58(%rbp)
jmp    117f <btr+0x6f>
mov    -0x3c(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x58(%rbp)
mov    -0x58(%rbp),%eax
mov    %eax,-0x44(%rbp)
mov    -0x2c(%rbp),%edi
mov    -0x30(%rbp),%esi
mov    0x10(%rbp),%edx
mov    0x20(%rbp),%eax
shl    $0x1,%eax
add    %eax,%edx
add    -0x44(%rbp),%edx
add    0x30(%rbp),%edx
add    0x40(%rbp),%edx
mov    -0x34(%rbp),%r8d
mov    -0x38(%rbp),%r9d
mov    -0x3c(%rbp),%eax
xor    %ecx,%ecx
mov    %eax,(%rsp)
movl   $0x0,0x8(%rsp)
movl   $0x0,0x10(%rsp)
movl   $0x0,0x18(%rsp)
movl   $0x0,0x20(%rsp)
movl   $0x0,0x28(%rsp)
movl   $0x0,0x30(%rsp)
movl   $0x0,0x38(%rsp)
movl   $0x0,0x40(%rsp)
movl   $0x0,0x48(%rsp)
call   1030 <buy@plt>
jmp    14c0 <btr+0x3b0>
movl   $0x0,-0x48(%rbp)
mov    -0x48(%rbp),%ecx
xor    %eax,%eax
cmp    0x18(%rbp),%ecx
mov    %al,-0x59(%rbp)
jg     122a <btr+0x11a>
mov    -0x48(%rbp),%eax
mov    -0x3c(%rbp),%ecx
shl    $0x1,%ecx
cmp    %ecx,%eax
setle  %al
mov    %al,-0x59(%rbp)
mov    -0x59(%rbp),%al
test   $0x1,%al
jne    123a <btr+0x12a>
jmp    14bb <btr+0x3ab>
movl   $0x0,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
cmp    0x30(%rbp),%eax
jg     14a8 <btr+0x398>
mov    0x10(%rbp),%eax
mov    0x20(%rbp),%ecx
shl    $0x1,%ecx
add    %ecx,%eax
add    -0x48(%rbp),%eax
add    -0x4c(%rbp),%eax
mov    %eax,-0x50(%rbp)
mov    -0x3c(%rbp),%eax
shl    $0x1,%eax
sub    -0x48(%rbp),%eax
mov    %eax,-0x54(%rbp)
mov    -0x34(%rbp),%eax
shl    $0x2,%eax
mov    -0x50(%rbp),%ecx
add    0x40(%rbp),%ecx
cmp    %ecx,%eax
jle    1370 <btr+0x260>
mov    -0x50(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     1370 <btr+0x260>
mov    0x40(%rbp),%eax
mov    %eax,-0x60(%rbp)
mov    -0x50(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    -0x60(%rbp),%eax
mov    $0x4,%ecx
sub    %edx,%ecx
cmp    %ecx,%eax
jl     1370 <btr+0x260>
mov    -0x2c(%rbp),%edi
mov    -0x30(%rbp),%esi
mov    -0x50(%rbp),%eax
add    $0x3,%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
shl    $0x2,%eax
mov    %eax,-0x68(%rbp)
mov    -0x54(%rbp),%eax
mov    %eax,-0x6c(%rbp)
mov    -0x34(%rbp),%r8d
mov    -0x38(%rbp),%r9d
mov    -0x3c(%rbp),%r13d
mov    -0x40(%rbp),%r12d
add    0x10(%rbp),%r12d
mov    0x18(%rbp),%r15d
mov    0x20(%rbp),%r14d
mov    -0x4c(%rbp),%ebx
mov    0x28(%rbp),%r11d
add    0x30(%rbp),%r11d
sub    -0x4c(%rbp),%r11d
mov    0x38(%rbp),%r10d
add    0x40(%rbp),%r10d
mov    -0x50(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    -0x6c(%rbp),%ecx
mov    $0x4,%eax
sub    %edx,%eax
mov    -0x68(%rbp),%edx
sub    %eax,%r10d
mov    0x48(%rbp),%eax
mov    %eax,-0x64(%rbp)
xor    %eax,%eax
mov    -0x64(%rbp),%eax
mov    %r13d,(%rsp)
movl   $0x0,0x8(%rsp)
mov    %r12d,0x10(%rsp)
mov    %r15d,0x18(%rsp)
mov    %r14d,0x20(%rsp)
mov    %ebx,0x28(%rsp)
mov    %r11d,0x30(%rsp)
movl   $0x0,0x38(%rsp)
mov    %r10d,0x40(%rsp)
mov    %eax,0x48(%rsp)
call   1030 <buy@plt>
jmp    1495 <btr+0x385>
mov    -0x34(%rbp),%eax
shl    $0x2,%eax
mov    -0x50(%rbp),%ecx
add    0x40(%rbp),%ecx
cmp    %ecx,%eax
jle    140d <btr+0x2fd>
mov    -0x2c(%rbp),%edi
mov    -0x30(%rbp),%esi
mov    -0x50(%rbp),%edx
mov    -0x54(%rbp),%ecx
mov    -0x34(%rbp),%r8d
mov    -0x38(%rbp),%r9d
mov    -0x3c(%rbp),%r13d
mov    -0x40(%rbp),%r12d
add    0x10(%rbp),%r12d
mov    0x18(%rbp),%r15d
mov    0x20(%rbp),%r14d
mov    -0x4c(%rbp),%ebx
mov    0x28(%rbp),%r11d
add    0x30(%rbp),%r11d
sub    -0x4c(%rbp),%r11d
mov    0x38(%rbp),%r10d
add    0x40(%rbp),%r10d
mov    0x48(%rbp),%eax
mov    %eax,-0x70(%rbp)
xor    %eax,%eax
mov    -0x70(%rbp),%eax
mov    %r13d,(%rsp)
movl   $0x0,0x8(%rsp)
mov    %r12d,0x10(%rsp)
mov    %r15d,0x18(%rsp)
mov    %r14d,0x20(%rsp)
mov    %ebx,0x28(%rsp)
mov    %r11d,0x30(%rsp)
movl   $0x0,0x38(%rsp)
mov    %r10d,0x40(%rsp)
mov    %eax,0x48(%rsp)
call   1030 <buy@plt>
jmp    1490 <btr+0x380>
mov    -0x2c(%rbp),%edi
mov    -0x30(%rbp),%esi
mov    -0x50(%rbp),%edx
add    0x40(%rbp),%edx
mov    -0x54(%rbp),%ecx
mov    -0x34(%rbp),%r8d
mov    -0x38(%rbp),%r9d
mov    -0x3c(%rbp),%r13d
mov    -0x40(%rbp),%r12d
add    0x10(%rbp),%r12d
mov    0x18(%rbp),%r15d
mov    0x20(%rbp),%r14d
mov    -0x4c(%rbp),%ebx
mov    0x28(%rbp),%r11d
add    0x30(%rbp),%r11d
sub    -0x4c(%rbp),%r11d
mov    0x38(%rbp),%r10d
mov    0x48(%rbp),%eax
mov    %eax,-0x74(%rbp)
xor    %eax,%eax
mov    -0x74(%rbp),%eax
mov    %r13d,(%rsp)
movl   $0x0,0x8(%rsp)
mov    %r12d,0x10(%rsp)
mov    %r15d,0x18(%rsp)
mov    %r14d,0x20(%rsp)
mov    %ebx,0x28(%rsp)
mov    %r11d,0x30(%rsp)
movl   $0x0,0x38(%rsp)
mov    %r10d,0x40(%rsp)
mov    %eax,0x48(%rsp)
call   1030 <buy@plt>
jmp    1495 <btr+0x385>
jmp    149a <btr+0x38a>
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    1241 <btr+0x131>
jmp    14ad <btr+0x39d>
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    1208 <btr+0xf8>
jmp    14c0 <btr+0x3b0>
add    $0xa8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

x86 assembly (clang, -O2):
<btr>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
mov    %r9d,%r11d
mov    %r8d,%r10d
mov    %ecx,%r9d
mov    %edx,%r8d
mov    0xc0(%rsp),%ecx
mov    0xb0(%rsp),%r14d
mov    0xa0(%rsp),%ebx
mov    0x98(%rsp),%edx
mov    0x90(%rsp),%eax
lea    (%r10,%r10,1),%ebp
cmp    $0x4,%edi
jne    1192 <btr+0x82>
cmp    %edx,%ebp
cmovg  %edx,%ebp
lea    (%rax,%rbx,2),%edx
add    %ebp,%edx
add    %r14d,%edx
add    %ecx,%edx
mov    $0x4,%edi
xor    %ecx,%ecx
push   $0x0
push   $0x0
push   $0x0
push   $0x0
push   $0x0
push   $0x0
push   $0x0
push   $0x0
push   $0x0
push   %r10
call   1030 <buy@plt>
add    $0xa8,%rsp
jmp    137e <btr+0x26e>
mov    %edi,0x8(%rsp)
mov    %edx,%ecx
or     %r10d,%ecx
js     137a <btr+0x26a>
mov    0xb8(%rsp),%r13d
lea    0x0(,%r8,4),%ecx
mov    %ecx,0x14(%rsp)
add    %eax,%r11d
mov    0xc0(%rsp),%ecx
lea    (%rcx,%r13,1),%edx
mov    %rdx,0x38(%rsp)
mov    0xa8(%rsp),%edx
add    %r14d,%edx
mov    %edx,0x20(%rsp)
lea    0x1(%r14),%edx
mov    %edx,0x24(%rsp)
add    %eax,%ecx
lea    (%rcx,%rbx,2),%ecx
mov    %rcx,0x18(%rsp)
lea    (%rax,%rbx,2),%r12d
xor    %eax,%eax
mov    %r10,0x50(%rsp)
mov    %r9d,0x2c(%rsp)
mov    %r8,0x48(%rsp)
mov    %esi,0x28(%rsp)
mov    %r11,0x40(%rsp)
mov    %ebp,0x10(%rsp)
nopw   0x0(%rax,%rax,1)
mov    %rax,0x30(%rsp)
test   %r14d,%r14d
mov    0x14(%rsp),%r14d
js     1340 <btr+0x230>
mov    0x10(%rsp),%eax
sub    0x30(%rsp),%eax
mov    %eax,0xc(%rsp)
xor    %ebp,%ebp
mov    0x20(%rsp),%eax
mov    %eax,%r15d
jmp    129f <btr+0x18f>
nopw   0x0(%rax,%rax,1)
mov    0x8(%rsp),%edi
mov    0xc(%rsp),%ecx
mov    0xc8(%rsp),%eax
push   %rax
push   %r13
push   $0x0
push   %r15
push   %rbp
push   %rbx
mov    0xc8(%rsp),%eax
push   %rax
push   %r11
push   $0x0
push   %r10
call   1030 <buy@plt>
add    $0x50,%rsp
add    $0x1,%ebp
add    $0xffffffff,%r15d
cmp    %ebp,0x24(%rsp)
mov    0x50(%rsp),%r10
mov    0x2c(%rsp),%r9d
mov    0x48(%rsp),%r8
mov    0x28(%rsp),%esi
mov    0x40(%rsp),%r11
mov    0xa0(%rsp),%ebx
je     1340 <btr+0x230>
mov    0x18(%rsp),%rax
lea    (%rax,%rbp,1),%edx
cmp    %edx,%r14d
jle    1240 <btr+0x130>
lea    (%r12,%rbp,1),%edx
lea    0x3(%rdx),%ecx
test   %edx,%edx
cmovns %edx,%ecx
and    $0xfffffffc,%ecx
mov    %edx,%eax
sub    %ecx,%eax
je     1320 <btr+0x210>
mov    $0x4,%ecx
sub    %eax,%ecx
mov    0xc0(%rsp),%edi
cmp    %edi,%ecx
jg     1320 <btr+0x210>
lea    (%r12,%rbp,1),%ecx
add    $0x3,%ecx
lea    (%r12,%rbp,1),%edx
add    $0x6,%edx
test   %ecx,%ecx
cmovns %ecx,%edx
and    $0xfffffffc,%edx
mov    0x38(%rsp),%rcx
add    %ecx,%eax
add    $0xfffffffc,%eax
mov    0x8(%rsp),%edi
mov    0xc(%rsp),%ecx
mov    %r13,%r14
mov    0xc8(%rsp),%r13d
push   %r13
mov    %r14,%r13
mov    0x1c(%rsp),%r14d
push   %rax
jmp    1252 <btr+0x142>
cs nopw 0x0(%rax,%rax,1)
mov    0x8(%rsp),%edi
mov    0xc(%rsp),%ecx
mov    0xc8(%rsp),%eax
push   %rax
push   0x40(%rsp)
jmp    1252 <btr+0x142>
nopl   0x0(%rax)
mov    0x98(%rsp),%eax
mov    0x30(%rsp),%rdx
cmp    %eax,%edx
mov    0xb0(%rsp),%edi
mov    0x10(%rsp),%ebp
jge    137a <btr+0x26a>
mov    %rdi,%r14
lea    0x1(%rdx),%eax
mov    0x18(%rsp),%rcx
add    $0x1,%ecx
mov    %rcx,0x18(%rsp)
add    $0x1,%r12d
cmp    %edx,%ebp
jg     1210 <btr+0x100>
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @btr(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7, i32 %8, i32 %9, i32 %10, i32 %11, i32 %12, i32 %13) {
%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
%28 = alloca i32
%29 = alloca i32
%30 = alloca i32
%31 = alloca i32
%32 = alloca i32
%33 = alloca i32
store i32 %0, i32* %15
store i32 %1, i32* %16
store i32 %2, i32* %17
store i32 %3, i32* %18
store i32 %4, i32* %19
store i32 %5, i32* %20
store i32 %6, i32* %21
store i32 %7, i32* %22
store i32 %8, i32* %23
store i32 %9, i32* %24
store i32 %10, i32* %25
store i32 %11, i32* %26
store i32 %12, i32* %27
store i32 %13, i32* %28
%34 = load i32, i32* %15
%35 = icmp eq i32 %34, 4
br i1 %35, label %36, label %64
36: ; preds = %14
%37 = load i32, i32* %22
%38 = load i32, i32* %19
%39 = mul nsw i32 %38, 2
%40 = icmp slt i32 %37, %39
br i1 %40, label %41, label %43
41: ; preds = %36
%42 = load i32, i32* %22
br label %46
43: ; preds = %36
%44 = load i32, i32* %19
%45 = mul nsw i32 %44, 2
br label %46
46: ; preds = %43, %41
%47 = phi i32 [ %42, %41 ], [ %45, %43 ]
store i32 %47, i32* %29
%48 = load i32, i32* %15
%49 = load i32, i32* %16
%50 = load i32, i32* %21
%51 = load i32, i32* %23
%52 = mul nsw i32 %51, 2
%53 = add nsw i32 %50, %52
%54 = load i32, i32* %29
%55 = add nsw i32 %53, %54
%56 = load i32, i32* %25
%57 = add nsw i32 %55, %56
%58 = load i32, i32* %27
%59 = add nsw i32 %57, %58
%60 = load i32, i32* %17
%61 = load i32, i32* %18
%62 = load i32, i32* %19
%63 = call i32 @buy(i32 %48, i32 %49, i32 %59, i32 0, i32 %60, i32 %61, i32 %62, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0)
br label %206
64: ; preds = %14
store i32 0, i32* %30
br label %65
65: ; preds = %202, %64
%66 = load i32, i32* %30
%67 = load i32, i32* %22
%68 = icmp sle i32 %66, %67
br i1 %68, label %69, label %74
69: ; preds = %65
%70 = load i32, i32* %30
%71 = load i32, i32* %19
%72 = mul nsw i32 %71, 2
%73 = icmp sle i32 %70, %72
br label %74
74: ; preds = %69, %65
%75 = phi i1 [ false, %65 ], [ %73, %69 ]
br i1 %75, label %76, label %205
76: ; preds = %74
store i32 0, i32* %31
br label %77
77: ; preds = %198, %76
%78 = load i32, i32* %31
%79 = load i32, i32* %25
%80 = icmp sle i32 %78, %79
br i1 %80, label %81, label %201
81: ; preds = %77
%82 = load i32, i32* %21
%83 = load i32, i32* %23
%84 = mul nsw i32 %83, 2
%85 = add nsw i32 %82, %84
%86 = load i32, i32* %30
%87 = add nsw i32 %85, %86
%88 = load i32, i32* %31
%89 = add nsw i32 %87, %88
store i32 %89, i32* %32
%90 = load i32, i32* %19
%91 = mul nsw i32 %90, 2
%92 = load i32, i32* %30
%93 = sub nsw i32 %91, %92
store i32 %93, i32* %33
%94 = load i32, i32* %17
%95 = mul nsw i32 %94, 4
%96 = load i32, i32* %32
%97 = load i32, i32* %27
%98 = add nsw i32 %96, %97
%99 = icmp sgt i32 %95, %98
br i1 %99, label %100, label %141
100: ; preds = %81
%101 = load i32, i32* %32
%102 = srem i32 %101, 4
%103 = icmp ne i32 %102, 0
br i1 %103, label %104, label %141
104: ; preds = %100
%105 = load i32, i32* %27
%106 = load i32, i32* %32
%107 = srem i32 %106, 4
%108 = sub nsw i32 4, %107
%109 = icmp sge i32 %105, %108
br i1 %109, label %110, label %141
110: ; preds = %104
%111 = load i32, i32* %15
%112 = load i32, i32* %16
%113 = load i32, i32* %32
%114 = add nsw i32 %113, 3
%115 = sdiv i32 %114, 4
%116 = mul nsw i32 %115, 4
%117 = load i32, i32* %33
%118 = load i32, i32* %17
%119 = load i32, i32* %18
%120 = load i32, i32* %19
%121 = load i32, i32* %20
%122 = load i32, i32* %21
%123 = add nsw i32 %121, %122
%124 = load i32, i32* %22
%125 = load i32, i32* %23
%126 = load i32, i32* %31
%127 = load i32, i32* %24
%128 = load i32, i32* %25
%129 = add nsw i32 %127, %128
%130 = load i32, i32* %31
%131 = sub nsw i32 %129, %130
%132 = load i32, i32* %26
%133 = load i32, i32* %27
%134 = add nsw i32 %132, %133
%135 = load i32, i32* %32
%136 = srem i32 %135, 4
%137 = sub nsw i32 4, %136
%138 = sub nsw i32 %134, %137
%139 = load i32, i32* %28
%140 = call i32 @buy(i32 %111, i32 %112, i32 %116, i32 %117, i32 %118, i32 %119, i32 %120, i32 0, i32 %123, i32 %124, i32 %125, i32 %126, i32 %131, i32 0, i32 %138, i32 %139)
br label %197
141: ; preds = %104, %100, %81
%142 = load i32, i32* %17
%143 = mul nsw i32 %142, 4
%144 = load i32, i32* %32
%145 = load i32, i32* %27
%146 = add nsw i32 %144, %145
%147 = icmp sgt i32 %143, %146
br i1 %147, label %148, label %172
148: ; preds = %141
%149 = load i32, i32* %15
%150 = load i32, i32* %16
%151 = load i32, i32* %32
%152 = load i32, i32* %33
%153 = load i32, i32* %17
%154 = load i32, i32* %18
%155 = load i32, i32* %19
%156 = load i32, i32* %20
%157 = load i32, i32* %21
%158 = add nsw i32 %156, %157
%159 = load i32, i32* %22
%160 = load i32, i32* %23
%161 = load i32, i32* %31
%162 = load i32, i32* %24
%163 = load i32, i32* %25
%164 = add nsw i32 %162, %163
%165 = load i32, i32* %31
%166 = sub nsw i32 %164, %165
%167 = load i32, i32* %26
%168 = load i32, i32* %27
%169 = add nsw i32 %167, %168
%170 = load i32, i32* %28
%171 = call i32 @buy(i32 %149, i32 %150, i32 %151, i32 %152, i32 %153, i32 %154, i32 %155, i32 0, i32 %158, i32 %159, i32 %160, i32 %161, i32 %166, i32 0, i32 %169, i32 %170)
br label %196
172: ; preds = %141
%173 = load i32, i32* %15
%174 = load i32, i32* %16
%175 = load i32, i32* %32
%176 = load i32, i32* %27
%177 = add nsw i32 %175, %176
%178 = load i32, i32* %33
%179 = load i32, i32* %17
%180 = load i32, i32* %18
%181 = load i32, i32* %19
%182 = load i32, i32* %20
%183 = load i32, i32* %21
%184 = add nsw i32 %182, %183
%185 = load i32, i32* %22
%186 = load i32, i32* %23
%187 = load i32, i32* %31
%188 = load i32, i32* %24
%189 = load i32, i32* %25
%190 = add nsw i32 %188, %189
%191 = load i32, i32* %31
%192 = sub nsw i32 %190, %191
%193 = load i32, i32* %26
%194 = load i32, i32* %28
%195 = call i32 @buy(i32 %173, i32 %174, i32 %177, i32 %178, i32 %179, i32 %180, i32 %181, i32 0, i32 %184, i32 %185, i32 %186, i32 %187, i32 %192, i32 0, i32 %193, i32 %194)
br label %196
196: ; preds = %172, %148
br label %197
197: ; preds = %196, %110
br label %198
198: ; preds = %197
%199 = load i32, i32* %31
%200 = add nsw i32 %199, 1
store i32 %200, i32* %31
br label %77
201: ; preds = %77
br label %202
202: ; preds = %201
%203 = load i32, i32* %30
%204 = add nsw i32 %203, 1
store i32 %204, i32* %30
br label %65
205: ; preds = %74
br label %206
206: ; preds = %205, %46
ret void
}

LLVM IR (-O2):
define void @btr(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7, i32 %8, i32 %9, i32 %10, i32 %11, i32 %12, i32 %13) {
%15 = icmp eq i32 %0, 4
%16 = shl nsw i32 %4, 1
br i1 %15, label %28, label %17
17: ; preds = %14
%18 = or i32 %7, %4
%19 = icmp sgt i32 %18, -1
br i1 %19, label %20, label %77
20: ; preds = %17
%21 = icmp slt i32 %10, 0
%22 = shl nsw i32 %8, 1
%23 = add nsw i32 %22, %6
%24 = shl nsw i32 %2, 2
%25 = add nsw i32 %6, %5
%26 = add nsw i32 %10, %9
%27 = add nsw i32 %12, %11
br label %37
28: ; preds = %14
%29 = icmp sgt i32 %16, %7
%30 = select i1 %29, i32 %7, i32 %16
%31 = shl nsw i32 %8, 1
%32 = add nsw i32 %31, %6
%33 = add nsw i32 %32, %30
%34 = add nsw i32 %33, %10
%35 = add nsw i32 %34, %12
%36 = tail call i32 @buy(i32 4, i32 %1, i32 %35, i32 0, i32 %2, i32 %3, i32 %4, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0)
br label %77
37: ; preds = %20, %42
%38 = phi i32 [ 0, %20 ], [ %43, %42 ]
br i1 %21, label %42, label %39
39: ; preds = %37
%40 = add nsw i32 %23, %38
%41 = sub nsw i32 %16, %38
br label %47
42: ; preds = %73, %37
%43 = add nuw nsw i32 %38, 1
%44 = icmp slt i32 %38, %7
%45 = icmp sgt i32 %16, %38
%46 = select i1 %44, i1 %45, i1 false
br i1 %46, label %37, label %77
47: ; preds = %39, %73
%48 = phi i32 [ 0, %39 ], [ %75, %73 ]
%49 = phi i32 [ 0, %39 ], [ %74, %73 ]
%50 = add nsw i32 %40, %49
%51 = add nsw i32 %50, %12
%52 = icmp sgt i32 %24, %51
br i1 %52, label %53, label %70
53: ; preds = %47
%54 = srem i32 %50, 4
%55 = icmp eq i32 %54, 0
%56 = sub nsw i32 4, %54
%57 = icmp sgt i32 %56, %12
%58 = select i1 %55, i1 true, i1 %57
br i1 %58, label %67, label %59
59: ; preds = %53
%60 = add nsw i32 %54, -4
%61 = add nsw i32 %50, 3
%62 = sdiv i32 %61, 4
%63 = shl nsw i32 %62, 2
%64 = add i32 %26, %48
%65 = add i32 %27, %60
%66 = tail call i32 @buy(i32 %0, i32 %1, i32 %63, i32 %41, i32 %2, i32 %3, i32 %4, i32 0, i32 %25, i32 %7, i32 %8, i32 %49, i32 %64, i32 0, i32 %65, i32 %13)
br label %73
67: ; preds = %53
%68 = add i32 %26, %48
%69 = tail call i32 @buy(i32 %0, i32 %1, i32 %50, i32 %41, i32 %2, i32 %3, i32 %4, i32 0, i32 %25, i32 %7, i32 %8, i32 %49, i32 %68, i32 0, i32 %27, i32 %13)
br label %73
70: ; preds = %47
%71 = add i32 %26, %48
%72 = tail call i32 @buy(i32 %0, i32 %1, i32 %51, i32 %41, i32 %2, i32 %3, i32 %4, i32 0, i32 %25, i32 %7, i32 %8, i32 %49, i32 %71, i32 0, i32 %11, i32 %13)
br label %73
73: ; preds = %67, %70, %59
%74 = add nuw i32 %49, 1
%75 = xor i32 %49, -1
%76 = icmp eq i32 %49, %10
br i1 %76, label %42, label %47
77: ; preds = %42, %17, %28
ret void
}