#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*/ data_addresource(int, int /*<<< orphan*/, int);
int /*<<< orphan*/ data_refresh(int);
scalar_t__ data_totresources(int);
int getupperleft(int /*<<< orphan*/);
int io_getkey();
int /*<<< orphan*/ io_printmap(int);
int /*<<< orphan*/ map_getrobberhex();
int /*<<< orphan*/ map_setmessage(char *);
int /*<<< orphan*/ marker_setposition(int);
int robber_atvert(int, int);
int /*<<< orphan*/ robber_steal(int);
void robber_stealroutine(int player, int hex) {
  data_refresh(player);
  int verts[3], i;
  for (i = 0; i < 3; i++)
    verts[i] = 0;
  int vert = getupperleft(map_getrobberhex());
  i = -1;
  if (robber_atvert(player, vert) >= 0)
    verts[++i] = vert;
  if (robber_atvert(player, vert + 1) >= 0)
    verts[++i] = vert + 1;
  if (robber_atvert(player, vert + 6) >= 0)
    verts[++i] = vert + 6;
  if (robber_atvert(player, vert + 7) >= 0)
    verts[++i] = vert + 7;
  if (robber_atvert(player, vert + 12) >= 0)
    verts[++i] = vert + 12;
  if (robber_atvert(player, vert + 13) >= 0)
    verts[++i] = vert + 13;
  if (i == -1)
    return;
  int v1, v2, v3;
  v1 = v2 = v3 = robber_atvert(player, verts[0]);
  if (i >= 1)
    v2 = robber_atvert(player, verts[1]);
  if (i == 2)
    v3 = robber_atvert(player, verts[2]);
  marker_setposition(vert = verts[0]);
  if (v1 != v2 || v1 != v3 || v2 != v3) {
    map_setmessage("Please select a victim to steal from");
    int rob = 1;
    while (rob) {
      io_printmap(1);
      switch (io_getkey()) {
      case 2:
        marker_setposition(vert = verts[0]);
        break;
      case 3:
        marker_setposition(vert = verts[i]);
        break;
      case 0:
        marker_setposition(vert = verts[i / 2]);
        break;
      case 1:
        marker_setposition(vert = verts[(i + 1) / 2]);
        break;
      case 4:
      case 'r':
        rob = 0;
        break;
      default:
        break;
      }
    }
  }
  int robbed = robber_atvert(player, vert);
  if (data_totresources(robbed) > 0)
    data_addresource(player, robber_steal(robbed), 1);
  data_refresh(player);
}


x86 assembly (clang, -O0):
<robber_stealroutine>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1060 <data_refresh@plt>
movl   $0x0,-0x18(%rbp)
cmpl   $0x3,-0x18(%rbp)
jge    11f1 <robber_stealroutine+0x41>
movslq -0x18(%rbp),%rax
movl   $0x0,-0x14(%rbp,%rax,4)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11cd <robber_stealroutine+0x1d>
mov    $0x0,%al
call   1050 <map_getrobberhex@plt>
mov    %eax,%edi
call   1030 <getupperleft@plt>
mov    %eax,-0x1c(%rbp)
movl   $0xffffffff,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x1c(%rbp),%esi
call   10d0 <robber_atvert@plt>
cmp    $0x0,%eax
jl     122f <robber_stealroutine+0x7f>
mov    -0x1c(%rbp),%ecx
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
cltq
mov    %ecx,-0x14(%rbp,%rax,4)
mov    -0x4(%rbp),%edi
mov    -0x1c(%rbp),%esi
add    $0x1,%esi
call   10d0 <robber_atvert@plt>
cmp    $0x0,%eax
jl     125b <robber_stealroutine+0xab>
mov    -0x1c(%rbp),%ecx
add    $0x1,%ecx
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
cltq
mov    %ecx,-0x14(%rbp,%rax,4)
mov    -0x4(%rbp),%edi
mov    -0x1c(%rbp),%esi
add    $0x6,%esi
call   10d0 <robber_atvert@plt>
cmp    $0x0,%eax
jl     1287 <robber_stealroutine+0xd7>
mov    -0x1c(%rbp),%ecx
add    $0x6,%ecx
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
cltq
mov    %ecx,-0x14(%rbp,%rax,4)
mov    -0x4(%rbp),%edi
mov    -0x1c(%rbp),%esi
add    $0x7,%esi
call   10d0 <robber_atvert@plt>
cmp    $0x0,%eax
jl     12b3 <robber_stealroutine+0x103>
mov    -0x1c(%rbp),%ecx
add    $0x7,%ecx
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
cltq
mov    %ecx,-0x14(%rbp,%rax,4)
mov    -0x4(%rbp),%edi
mov    -0x1c(%rbp),%esi
add    $0xc,%esi
call   10d0 <robber_atvert@plt>
cmp    $0x0,%eax
jl     12df <robber_stealroutine+0x12f>
mov    -0x1c(%rbp),%ecx
add    $0xc,%ecx
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
cltq
mov    %ecx,-0x14(%rbp,%rax,4)
mov    -0x4(%rbp),%edi
mov    -0x1c(%rbp),%esi
add    $0xd,%esi
call   10d0 <robber_atvert@plt>
cmp    $0x0,%eax
jl     130b <robber_stealroutine+0x15b>
mov    -0x1c(%rbp),%ecx
add    $0xd,%ecx
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
cltq
mov    %ecx,-0x14(%rbp,%rax,4)
cmpl   $0xffffffff,-0x18(%rbp)
jne    131a <robber_stealroutine+0x16a>
jmp    14e6 <robber_stealroutine+0x336>
mov    -0x4(%rbp),%edi
mov    -0x14(%rbp),%esi
call   10d0 <robber_atvert@plt>
mov    %eax,-0x28(%rbp)
mov    %eax,-0x24(%rbp)
mov    %eax,-0x20(%rbp)
cmpl   $0x1,-0x18(%rbp)
jl     1346 <robber_stealroutine+0x196>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%esi
call   10d0 <robber_atvert@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x2,-0x18(%rbp)
jne    135e <robber_stealroutine+0x1ae>
mov    -0x4(%rbp),%edi
mov    -0xc(%rbp),%esi
call   10d0 <robber_atvert@plt>
mov    %eax,-0x28(%rbp)
mov    -0x14(%rbp),%edi
mov    %edi,-0x1c(%rbp)
call   1090 <marker_setposition@plt>
mov    -0x20(%rbp),%eax
cmp    -0x24(%rbp),%eax
jne    138d <robber_stealroutine+0x1dd>
mov    -0x20(%rbp),%eax
cmp    -0x28(%rbp),%eax
jne    138d <robber_stealroutine+0x1dd>
mov    -0x24(%rbp),%eax
cmp    -0x28(%rbp),%eax
je     14a1 <robber_stealroutine+0x2f1>
lea    0xc6c(%rip),%rdi
call   1080 <map_setmessage@plt>
movl   $0x1,-0x2c(%rbp)
cmpl   $0x0,-0x2c(%rbp)
je     149c <robber_stealroutine+0x2ec>
mov    $0x1,%edi
call   10c0 <io_printmap@plt>
xor    %eax,%eax
call   1070 <io_getkey@plt>
mov    %eax,%ecx
mov    %ecx,-0x34(%rbp)
test   %eax,%eax
je     1447 <robber_stealroutine+0x297>
jmp    13cd <robber_stealroutine+0x21d>
mov    -0x34(%rbp),%eax
sub    $0x1,%eax
je     1465 <robber_stealroutine+0x2b5>
jmp    13de <robber_stealroutine+0x22e>
mov    -0x34(%rbp),%eax
sub    $0x2,%eax
je     1422 <robber_stealroutine+0x272>
jmp    13ef <robber_stealroutine+0x23f>
mov    -0x34(%rbp),%eax
sub    $0x3,%eax
je     1432 <robber_stealroutine+0x282>
jmp    1400 <robber_stealroutine+0x250>
mov    -0x34(%rbp),%eax
sub    $0x4,%eax
je     1486 <robber_stealroutine+0x2d6>
jmp    1411 <robber_stealroutine+0x261>
mov    -0x34(%rbp),%eax
sub    $0x72,%eax
je     1486 <robber_stealroutine+0x2d6>
jmp    1492 <robber_stealroutine+0x2e2>
mov    -0x14(%rbp),%edi
mov    %edi,-0x1c(%rbp)
call   1090 <marker_setposition@plt>
jmp    1497 <robber_stealroutine+0x2e7>
movslq -0x18(%rbp),%rax
mov    -0x14(%rbp,%rax,4),%edi
mov    %edi,-0x1c(%rbp)
call   1090 <marker_setposition@plt>
jmp    1497 <robber_stealroutine+0x2e7>
mov    -0x18(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cltq
mov    -0x14(%rbp,%rax,4),%edi
mov    %edi,-0x1c(%rbp)
call   1090 <marker_setposition@plt>
jmp    1497 <robber_stealroutine+0x2e7>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cltq
mov    -0x14(%rbp,%rax,4),%edi
mov    %edi,-0x1c(%rbp)
call   1090 <marker_setposition@plt>
jmp    1497 <robber_stealroutine+0x2e7>
movl   $0x0,-0x2c(%rbp)
jmp    1497 <robber_stealroutine+0x2e7>
jmp    1497 <robber_stealroutine+0x2e7>
jmp    13a0 <robber_stealroutine+0x1f0>
jmp    14a1 <robber_stealroutine+0x2f1>
mov    -0x4(%rbp),%edi
mov    -0x1c(%rbp),%esi
call   10d0 <robber_atvert@plt>
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%edi
call   10b0 <data_totresources@plt>
cmp    $0x0,%rax
jle    14de <robber_stealroutine+0x32e>
mov    -0x4(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    -0x30(%rbp),%edi
call   10a0 <robber_steal@plt>
mov    -0x38(%rbp),%edi
mov    %eax,%esi
mov    $0x1,%edx
call   1040 <data_addresource@plt>
mov    -0x4(%rbp),%edi
call   1060 <data_refresh@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<robber_stealroutine>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %edi,%r15d
call   1060 <data_refresh@plt>
movl   $0x0,0x8(%rsp)
movq   $0x0,(%rsp)
xor    %r13d,%r13d
xor    %eax,%eax
call   1050 <map_getrobberhex@plt>
mov    %eax,%edi
call   1030 <getupperleft@plt>
mov    %eax,%ebp
mov    %r15d,%edi
mov    %eax,%esi
call   10d0 <robber_atvert@plt>
test   %eax,%eax
js     11fc <robber_stealroutine+0x4c>
mov    %ebp,(%rsp)
jmp    1202 <robber_stealroutine+0x52>
mov    $0xffffffff,%r13d
lea    0x1(%rbp),%ebx
mov    %r15d,%edi
mov    %ebx,%esi
call   10d0 <robber_atvert@plt>
test   %eax,%eax
js     121b <robber_stealroutine+0x6b>
add    $0x1,%r13d
mov    %ebx,(%rsp,%r13,4)
lea    0x6(%rbp),%ebx
mov    %r15d,%edi
mov    %ebx,%esi
call   10d0 <robber_atvert@plt>
test   %eax,%eax
js     1234 <robber_stealroutine+0x84>
add    $0x1,%r13d
mov    %ebx,(%rsp,%r13,4)
lea    0x7(%rbp),%ebx
mov    %r15d,%edi
mov    %ebx,%esi
call   10d0 <robber_atvert@plt>
test   %eax,%eax
js     124d <robber_stealroutine+0x9d>
add    $0x1,%r13d
mov    %ebx,(%rsp,%r13,4)
lea    0xc(%rbp),%ebx
mov    %r15d,%edi
mov    %ebx,%esi
call   10d0 <robber_atvert@plt>
test   %eax,%eax
js     1266 <robber_stealroutine+0xb6>
add    $0x1,%r13d
mov    %ebx,(%rsp,%r13,4)
add    $0xd,%ebp
mov    %r15d,%edi
mov    %ebp,%esi
call   10d0 <robber_atvert@plt>
test   %eax,%eax
js     1281 <robber_stealroutine+0xd1>
add    $0x1,%r13d
mov    %ebp,(%rsp,%r13,4)
jmp    128b <robber_stealroutine+0xdb>
cmp    $0xffffffff,%r13d
je     13b9 <robber_stealroutine+0x209>
mov    (%rsp),%r14d
mov    %r15d,%edi
mov    %r14d,%esi
call   10d0 <robber_atvert@plt>
mov    %eax,%ebp
test   %r13d,%r13d
je     12c6 <robber_stealroutine+0x116>
mov    0x4(%rsp),%esi
mov    %r15d,%edi
call   10d0 <robber_atvert@plt>
mov    %eax,%r12d
cmp    $0x2,%r13d
jne    12c9 <robber_stealroutine+0x119>
mov    0x8(%rsp),%esi
mov    %r15d,%edi
call   10d0 <robber_atvert@plt>
mov    %eax,%ebx
jmp    12cb <robber_stealroutine+0x11b>
mov    %ebp,%r12d
mov    %ebp,%ebx
mov    %r14d,%edi
call   1090 <marker_setposition@plt>
cmp    %r12d,%ebp
jne    1328 <robber_stealroutine+0x178>
cmp    %ebx,%ebp
jne    1328 <robber_stealroutine+0x178>
cmp    %ebx,%r12d
jne    1328 <robber_stealroutine+0x178>
mov    %r14d,%ebp
mov    %r15d,%edi
mov    %ebp,%esi
call   10d0 <robber_atvert@plt>
mov    %eax,%ebx
mov    %eax,%edi
call   10b0 <data_totresources@plt>
test   %rax,%rax
jle    1312 <robber_stealroutine+0x162>
mov    %ebx,%edi
call   10a0 <robber_steal@plt>
mov    %r15d,%edi
mov    %eax,%esi
mov    $0x1,%edx
call   1040 <data_addresource@plt>
mov    %r15d,%edi
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1060 <data_refresh@plt>
lea    0xce5(%rip),%rdi
call   1080 <map_setmessage@plt>
lea    0x1(%r13),%eax
shr    %eax
and    $0x7f,%eax
lea    (%rsp,%rax,4),%rax
mov    %rax,0x10(%rsp)
mov    %r13d,%eax
shr    %r13d
and    $0x7f,%r13d
lea    (%rsp,%r13,4),%r13
lea    (%rsp,%rax,4),%rbx
lea    0xca1(%rip),%r12
mov    %r14d,%ebp
jmp    1379 <robber_stealroutine+0x1c9>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
cmp    $0x72,%eax
je     12e4 <robber_stealroutine+0x134>
mov    $0x1,%edi
call   10c0 <io_printmap@plt>
xor    %eax,%eax
call   1070 <io_getkey@plt>
cmp    $0x4,%eax
ja     1370 <robber_stealroutine+0x1c0>
mov    %eax,%eax
movslq (%r12,%rax,4),%rax
add    %r12,%rax
jmp    *%rax
mov    0x0(%r13),%ebp
jmp    13b0 <robber_stealroutine+0x200>
mov    0x10(%rsp),%rax
mov    (%rax),%ebp
jmp    13b0 <robber_stealroutine+0x200>
mov    %r14d,%ebp
jmp    13b0 <robber_stealroutine+0x200>
mov    (%rbx),%ebp
mov    %ebp,%edi
call   1090 <marker_setposition@plt>
jmp    1379 <robber_stealroutine+0x1c9>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [37 x i8] c"Please select a victim to steal from\00"
define void @robber_stealroutine(i32 %0, i32 %1) {
%3 = alloca [3 x i32]
%4 = bitcast [3 x i32]* %3 to i8*
%5 = tail call i32 @data_refresh(i32 %0)
%6 = tail call i32 (...) @map_getrobberhex()
%7 = tail call i32 @getupperleft(i32 %6)
%8 = tail call i32 @robber_atvert(i32 %0, i32 %7)
%9 = icmp sgt i32 %8, -1
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 0
store i32 %7, i32* %11
br label %12
12: ; preds = %10, %2
%13 = phi i32 [ 0, %10 ], [ -1, %2 ]
%14 = add nsw i32 %7, 1
%15 = tail call i32 @robber_atvert(i32 %0, i32 %14)
%16 = icmp sgt i32 %15, -1
br i1 %16, label %17, label %21
17: ; preds = %12
%18 = add nsw i32 %13, 1
%19 = zext i32 %18 to i64
%20 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 %19
store i32 %14, i32* %20
br label %21
21: ; preds = %17, %12
%22 = phi i32 [ %18, %17 ], [ %13, %12 ]
%23 = add nsw i32 %7, 6
%24 = tail call i32 @robber_atvert(i32 %0, i32 %23)
%25 = icmp sgt i32 %24, -1
br i1 %25, label %26, label %30
26: ; preds = %21
%27 = add nsw i32 %22, 1
%28 = zext i32 %27 to i64
%29 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 %28
store i32 %23, i32* %29
br label %30
30: ; preds = %26, %21
%31 = phi i32 [ %27, %26 ], [ %22, %21 ]
%32 = add nsw i32 %7, 7
%33 = tail call i32 @robber_atvert(i32 %0, i32 %32)
%34 = icmp sgt i32 %33, -1
br i1 %34, label %35, label %39
35: ; preds = %30
%36 = add nsw i32 %31, 1
%37 = zext i32 %36 to i64
%38 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 %37
store i32 %32, i32* %38
br label %39
39: ; preds = %35, %30
%40 = phi i32 [ %36, %35 ], [ %31, %30 ]
%41 = add nsw i32 %7, 12
%42 = tail call i32 @robber_atvert(i32 %0, i32 %41)
%43 = icmp sgt i32 %42, -1
br i1 %43, label %44, label %48
44: ; preds = %39
%45 = add nsw i32 %40, 1
%46 = zext i32 %45 to i64
%47 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 %46
store i32 %41, i32* %47
br label %48
48: ; preds = %44, %39
%49 = phi i32 [ %45, %44 ], [ %40, %39 ]
%50 = add nsw i32 %7, 13
%51 = tail call i32 @robber_atvert(i32 %0, i32 %50)
%52 = icmp sgt i32 %51, -1
br i1 %52, label %53, label %57
53: ; preds = %48
%54 = add nsw i32 %49, 1
%55 = zext i32 %54 to i64
%56 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 %55
store i32 %50, i32* %56
br label %59
57: ; preds = %48
%58 = icmp eq i32 %49, -1
br i1 %58, label %119, label %59
59: ; preds = %53, %57
%60 = phi i32 [ %54, %53 ], [ %49, %57 ]
%61 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 0
%62 = load i32, i32* %61
%63 = tail call i32 @robber_atvert(i32 %0, i32 %62)
%64 = icmp eq i32 %60, 0
br i1 %64, label %74, label %65
65: ; preds = %59
%66 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 1
%67 = load i32, i32* %66
%68 = tail call i32 @robber_atvert(i32 %0, i32 %67)
%69 = icmp eq i32 %60, 2
br i1 %69, label %70, label %74
70: ; preds = %65
%71 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 2
%72 = load i32, i32* %71
%73 = tail call i32 @robber_atvert(i32 %0, i32 %72)
br label %74
74: ; preds = %59, %70, %65
%75 = phi i32 [ %68, %70 ], [ %68, %65 ], [ %63, %59 ]
%76 = phi i32 [ %73, %70 ], [ %63, %65 ], [ %63, %59 ]
%77 = tail call i32 @marker_setposition(i32 %62)
%78 = icmp eq i32 %63, %75
%79 = icmp eq i32 %63, %76
%80 = select i1 %78, i1 %79, i1 false
%81 = icmp eq i32 %75, %76
%82 = select i1 %80, i1 %81, i1 false
br i1 %82, label %109, label %83
83: ; preds = %74
%84 = tail call i32 @map_setmessage(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%85 = add i32 %60, 1
%86 = lshr i32 %85, 1
%87 = and i32 %86, 127
%88 = zext i32 %87 to i64
%89 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 %88
%90 = lshr i32 %60, 1
%91 = and i32 %90, 127
%92 = zext i32 %91 to i64
%93 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 %92
%94 = zext i32 %60 to i64
%95 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 %94
br label %96
96: ; preds = %106, %83
%97 = phi i32 [ %107, %106 ], [ %62, %83 ]
br label %98
98: ; preds = %96, %98
%99 = tail call i32 @io_printmap(i32 1)
%100 = tail call i32 (...) @io_getkey()
switch i32 %100, label %98 [
i32 2, label %106
i32 3, label %102
i32 0, label %103
i32 1, label %101
i32 4, label %109
i32 114, label %109
]
101: ; preds = %98
br label %103
102: ; preds = %98
br label %103
103: ; preds = %98, %102, %101
%104 = phi i32* [ %89, %101 ], [ %95, %102 ], [ %93, %98 ]
%105 = load i32, i32* %104
br label %106
106: ; preds = %98, %103
%107 = phi i32 [ %105, %103 ], [ %62, %98 ]
%108 = tail call i32 @marker_setposition(i32 %107)
br label %96
109: ; preds = %98, %98, %74
%110 = phi i32 [ %62, %74 ], [ %97, %98 ], [ %97, %98 ]
%111 = tail call i32 @robber_atvert(i32 %0, i32 %110)
%112 = tail call i64 @data_totresources(i32 %111)
%113 = icmp sgt i64 %112, 0
br i1 %113, label %114, label %117
114: ; preds = %109
%115 = tail call i32 @robber_steal(i32 %111)
%116 = tail call i32 @data_addresource(i32 %0, i32 %115, i32 1)
br label %117
117: ; preds = %114, %109
%118 = tail call i32 @data_refresh(i32 %0)
br label %119
119: ; preds = %57, %117
ret void
}