#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*/ genmap(int *, int *, int *, int *);
int /*<<< orphan*/ getint(int *);
int /*<<< orphan*/ printf(char *);
void movement(int *future, int *map, int *loot, int *vision, int *pos,
              int *floor, int *start, int *antimag, int *checkcurse, int free) {
  int e = -2;
  if (free == 1) {
    do {
      printf("Where do you want to teleport?\n");
    } while ((e < -1) || (e > 11));
    if (e >= 0) {
      *pos = e;
      *start = 1;
      if (*(vision + *pos) == 0)
        *(vision + *pos) = 1;
      return;
    } else {
      *floor = *floor + 1;
      *antimag = 0;
      *checkcurse = 0;
      genmap(future, map, loot, vision);
      if (*(vision + *pos) == 0)
        *(vision + *pos) = 1;
      *start = 1;
      return;
    }
  }
  printf("Where do you want to go?\n[0]: Nowhere\n");
  if (*pos - 4 >= 0) {
    printf("[1]: North\n");
  }
  if (*pos % 4) {
    printf("[4]: West\n");
  }
  if (*pos % 4 != 3) {
    printf("[6]: East\n");
  }
  if (*pos + 4 < 12) {
    printf("[8]: South\n");
  }
  if (*(map + *pos) == -1) {
    printf("[-1]: Down\n");
  }
  getint(&e);
  if (e == 0)
    return;
  if ((e == 1) && (pos - 4 >= 0)) {
    *pos = *pos - 4;
    *start = 1;
    if (*(vision + *pos) == 0)
      *(vision + *pos) = 1;
    return;
  }
  if ((e == 4) && (*pos % 4)) {
    *pos = *pos - 1;
    *start = 1;
    if (*(vision + *pos) == 0)
      *(vision + *pos) = 1;
    return;
  }
  if ((e == 6) && (*(pos) % 4 != 3)) {
    *pos = *pos + 1;
    *start = 1;
    if (*(vision + *pos) == 0)
      *(vision + *pos) = 1;
    return;
  }
  if ((e == 8) && (*pos + 4 < 12)) {
    *pos = *pos + 4;
    *start = 1;
    if (*(vision + *pos) == 0)
      *(vision + *pos) = 1;
    return;
  }
  if ((e == -1) && (*(map + *pos) == -1)) {
    *floor = *floor + 1;
    *antimag = 0;
    *checkcurse = 0;
    genmap(future, map, loot, vision);
    *start = 1;
    if (*(vision + *pos) == 0)
      *(vision + *pos) = 1;
    return;
  }
  printf("That's not an available direction!\n");
}


x86 assembly (clang, -O0):
<movement>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x28(%rbp),%eax
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
movl   $0xfffffffe,-0x34(%rbp)
cmpl   $0x1,0x28(%rbp)
jne    125c <movement+0x12c>
jmp    1175 <movement+0x45>
lea    0xe84(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%al
cmpl   $0xffffffff,-0x34(%rbp)
mov    %al,-0x35(%rbp)
jl     119a <movement+0x6a>
cmpl   $0xb,-0x34(%rbp)
setg   %al
mov    %al,-0x35(%rbp)
mov    -0x35(%rbp),%al
test   $0x1,%al
jne    1175 <movement+0x45>
cmpl   $0x0,-0x34(%rbp)
jl     11ee <movement+0xbe>
mov    -0x34(%rbp),%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
mov    0x10(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x20(%rbp),%rax
mov    -0x28(%rbp),%rcx
movslq (%rcx),%rcx
cmpl   $0x0,(%rax,%rcx,4)
jne    11e9 <movement+0xb9>
mov    -0x20(%rbp),%rax
mov    -0x28(%rbp),%rcx
movslq (%rcx),%rcx
movl   $0x1,(%rax,%rcx,4)
jmp    154a <movement+0x41a>
mov    -0x30(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    -0x30(%rbp),%rax
mov    %ecx,(%rax)
mov    0x18(%rbp),%rax
movl   $0x0,(%rax)
mov    0x20(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
call   1050 <genmap@plt>
mov    -0x20(%rbp),%rax
mov    -0x28(%rbp),%rcx
movslq (%rcx),%rcx
cmpl   $0x0,(%rax,%rcx,4)
jne    124d <movement+0x11d>
mov    -0x20(%rbp),%rax
mov    -0x28(%rbp),%rcx
movslq (%rcx),%rcx
movl   $0x1,(%rax,%rcx,4)
mov    0x10(%rbp),%rax
movl   $0x1,(%rax)
jmp    154a <movement+0x41a>
lea    0xdbd(%rip),%rdi
call   1030 <printf@plt>
mov    -0x28(%rbp),%rax
mov    (%rax),%eax
sub    $0x4,%eax
cmp    $0x0,%eax
jl     1286 <movement+0x156>
lea    0xdc6(%rip),%rdi
call   1030 <printf@plt>
mov    -0x28(%rbp),%rax
mov    (%rax),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     12a9 <movement+0x179>
lea    0xdaf(%rip),%rdi
call   1030 <printf@plt>
mov    -0x28(%rbp),%rax
mov    (%rax),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
cmp    $0x3,%edx
je     12cc <movement+0x19c>
lea    0xd97(%rip),%rdi
call   1030 <printf@plt>
mov    -0x28(%rbp),%rax
mov    (%rax),%eax
add    $0x4,%eax
cmp    $0xc,%eax
jge    12ea <movement+0x1ba>
lea    0xd84(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    -0x28(%rbp),%rcx
movslq (%rcx),%rcx
cmpl   $0xffffffff,(%rax,%rcx,4)
jne    130b <movement+0x1db>
lea    0xd6f(%rip),%rdi
call   1030 <printf@plt>
lea    -0x34(%rbp),%rdi
call   1040 <getint@plt>
cmpl   $0x0,-0x34(%rbp)
jne    1323 <movement+0x1f3>
jmp    154a <movement+0x41a>
cmpl   $0x1,-0x34(%rbp)
jne    1384 <movement+0x254>
mov    -0x28(%rbp),%rax
add    $0xfffffffffffffff0,%rax
cmp    $0x0,%rax
jb     1384 <movement+0x254>
mov    -0x28(%rbp),%rax
mov    (%rax),%ecx
sub    $0x4,%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
mov    0x10(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x20(%rbp),%rax
mov    -0x28(%rbp),%rcx
movslq (%rcx),%rcx
cmpl   $0x0,(%rax,%rcx,4)
jne    137f <movement+0x24f>
mov    -0x20(%rbp),%rax
mov    -0x28(%rbp),%rcx
movslq (%rcx),%rcx
movl   $0x1,(%rax,%rcx,4)
jmp    154a <movement+0x41a>
cmpl   $0x4,-0x34(%rbp)
jne    13ea <movement+0x2ba>
mov    -0x28(%rbp),%rax
mov    (%rax),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     13ea <movement+0x2ba>
mov    -0x28(%rbp),%rax
mov    (%rax),%ecx
sub    $0x1,%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
mov    0x10(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x20(%rbp),%rax
mov    -0x28(%rbp),%rcx
movslq (%rcx),%rcx
cmpl   $0x0,(%rax,%rcx,4)
jne    13e5 <movement+0x2b5>
mov    -0x20(%rbp),%rax
mov    -0x28(%rbp),%rcx
movslq (%rcx),%rcx
movl   $0x1,(%rax,%rcx,4)
jmp    154a <movement+0x41a>
cmpl   $0x6,-0x34(%rbp)
jne    1450 <movement+0x320>
mov    -0x28(%rbp),%rax
mov    (%rax),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
cmp    $0x3,%edx
je     1450 <movement+0x320>
mov    -0x28(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
mov    0x10(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x20(%rbp),%rax
mov    -0x28(%rbp),%rcx
movslq (%rcx),%rcx
cmpl   $0x0,(%rax,%rcx,4)
jne    144b <movement+0x31b>
mov    -0x20(%rbp),%rax
mov    -0x28(%rbp),%rcx
movslq (%rcx),%rcx
movl   $0x1,(%rax,%rcx,4)
jmp    154a <movement+0x41a>
cmpl   $0x8,-0x34(%rbp)
jne    14b1 <movement+0x381>
mov    -0x28(%rbp),%rax
mov    (%rax),%eax
add    $0x4,%eax
cmp    $0xc,%eax
jge    14b1 <movement+0x381>
mov    -0x28(%rbp),%rax
mov    (%rax),%ecx
add    $0x4,%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
mov    0x10(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x20(%rbp),%rax
mov    -0x28(%rbp),%rcx
movslq (%rcx),%rcx
cmpl   $0x0,(%rax,%rcx,4)
jne    14ac <movement+0x37c>
mov    -0x20(%rbp),%rax
mov    -0x28(%rbp),%rcx
movslq (%rcx),%rcx
movl   $0x1,(%rax,%rcx,4)
jmp    154a <movement+0x41a>
cmpl   $0xffffffff,-0x34(%rbp)
jne    153e <movement+0x40e>
mov    -0x10(%rbp),%rax
mov    -0x28(%rbp),%rcx
movslq (%rcx),%rcx
cmpl   $0xffffffff,(%rax,%rcx,4)
jne    153e <movement+0x40e>
mov    -0x30(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    -0x30(%rbp),%rax
mov    %ecx,(%rax)
mov    0x18(%rbp),%rax
movl   $0x0,(%rax)
mov    0x20(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
call   1050 <genmap@plt>
mov    0x10(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x20(%rbp),%rax
mov    -0x28(%rbp),%rcx
movslq (%rcx),%rcx
cmpl   $0x0,(%rax,%rcx,4)
jne    1539 <movement+0x409>
mov    -0x20(%rbp),%rax
mov    -0x28(%rbp),%rcx
movslq (%rcx),%rcx
movl   $0x1,(%rax,%rcx,4)
jmp    154a <movement+0x41a>
lea    0xb3c(%rip),%rdi
call   1030 <printf@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<movement>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    0x58(%rsp),%eax
movl   $0xfffffffe,0x4(%rsp)
ff
cmp    $0x1,%eax
jne    116a <movement+0x3a>
lea    0xf53(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %rbx,%rdi
call   1030 <puts@plt>
jmp    1160 <movement+0x30>
mov    %r9,%r13
mov    %r8,%rbx
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%r12
mov    %rdi,%rbp
lea    0xea5(%rip),%rdi
call   1030 <puts@plt>
mov    (%rbx),%eax
cmp    $0x4,%eax
jl     119d <movement+0x6d>
lea    0xf05(%rip),%rdi
call   1030 <puts@plt>
mov    (%rbx),%eax
test   $0x3,%al
je     11af <movement+0x7f>
lea    0xee9(%rip),%rdi
call   1030 <puts@plt>
mov    (%rbx),%eax
lea    0x3(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xfffffffc,%ecx
mov    %eax,%edx
sub    %ecx,%edx
cmp    $0x3,%edx
je     11d1 <movement+0xa1>
lea    0xebd(%rip),%rdi
call   1030 <puts@plt>
mov    (%rbx),%eax
cmp    $0x7,%eax
jg     11e4 <movement+0xb4>
lea    0xe9f(%rip),%rdi
call   1030 <puts@plt>
mov    (%rbx),%eax
cltq
cmpl   $0xffffffff,(%r12,%rax,4)
jne    11f9 <movement+0xc9>
lea    0xe7d(%rip),%rdi
call   1030 <puts@plt>
lea    0x4(%rsp),%rdi
call   1040 <getint@plt>
mov    0x4(%rsp),%eax
add    $0x1,%eax
cmp    $0x9,%eax
ja     12c1 <movement+0x191>
mov    0x40(%rsp),%rsi
lea    0xde1(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movslq (%rbx),%rax
cmpl   $0xffffffff,(%r12,%rax,4)
jne    12c1 <movement+0x191>
addl   $0x1,0x0(%r13)
mov    0x50(%rsp),%rax
mov    0x48(%rsp),%rcx
movl   $0x0,(%rcx)
movl   $0x0,(%rax)
mov    %rbp,%rdi
mov    %rsi,%rbp
mov    %r12,%rsi
mov    %r15,%rdx
mov    %r14,%rcx
call   1050 <genmap@plt>
movl   $0x1,0x0(%rbp)
jmp    12ad <movement+0x17d>
addl   $0xfffffffc,(%rbx)
jmp    12a7 <movement+0x177>
mov    (%rbx),%eax
test   $0x3,%al
je     12c1 <movement+0x191>
add    $0xffffffff,%eax
jmp    12a5 <movement+0x175>
mov    (%rbx),%eax
lea    0x3(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xfffffffc,%ecx
mov    %eax,%edx
sub    %ecx,%edx
cmp    $0x3,%edx
je     12c1 <movement+0x191>
add    $0x1,%eax
mov    %eax,(%rbx)
jmp    12a7 <movement+0x177>
mov    (%rbx),%eax
cmp    $0x7,%eax
jg     12c1 <movement+0x191>
add    $0x4,%eax
mov    %eax,(%rbx)
movl   $0x1,(%rsi)
movslq (%rbx),%rax
cmpl   $0x0,(%r14,%rax,4)
jne    12cd <movement+0x19d>
movl   $0x1,(%r14,%rax,4)
jmp    12cd <movement+0x19d>
lea    0xd86(%rip),%rdi
call   1030 <puts@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [32 x i8] c"Where do you want to teleport?\0A\00"
@.str.1 = [39 x i8] c"Where do you want to go?\0A[0]: Nowhere\0A\00"
@.str.2 = [12 x i8] c"[1]: North\0A\00"
@.str.3 = [11 x i8] c"[4]: West\0A\00"
@.str.4 = [11 x i8] c"[6]: East\0A\00"
@.str.5 = [12 x i8] c"[8]: South\0A\00"
@.str.6 = [12 x i8] c"[-1]: Down\0A\00"
@.str.7 = [36 x i8] c"That's not an available direction!\0A\00"
define void @movement(i32* %0, i32* %1, i32* %2, i32* %3, i32* %4, i32* %5, i32* %6, i32* %7, i32* %8, i32 %9) {
%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
store i32* %0, i32** %11
store i32* %1, i32** %12
store i32* %2, i32** %13
store i32* %3, i32** %14
store i32* %4, i32** %15
store i32* %5, i32** %16
store i32* %6, i32** %17
store i32* %7, i32** %18
store i32* %8, i32** %19
store i32 %9, i32* %20
store i32 -2, i32* %21
%22 = load i32, i32* %20
%23 = icmp eq i32 %22, 1
br i1 %23, label %24, label %83
24: ; preds = %10
br label %25
25: ; preds = %33, %24
%26 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
br label %27
27: ; preds = %25
%28 = load i32, i32* %21
%29 = icmp slt i32 %28, -1
br i1 %29, label %33, label %30
30: ; preds = %27
%31 = load i32, i32* %21
%32 = icmp sgt i32 %31, 11
br label %33
33: ; preds = %30, %27
%34 = phi i1 [ true, %27 ], [ %32, %30 ]
br i1 %34, label %25, label %35
35: ; preds = %33
%36 = load i32, i32* %21
%37 = icmp sge i32 %36, 0
br i1 %37, label %38, label %56
38: ; preds = %35
%39 = load i32, i32* %21
%40 = load i32*, i32** %15
store i32 %39, i32* %40
%41 = load i32*, i32** %17
store i32 1, i32* %41
%42 = load i32*, i32** %14
%43 = load i32*, i32** %15
%44 = load i32, i32* %43
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds i32, i32* %42, i64 %45
%47 = load i32, i32* %46
%48 = icmp eq i32 %47, 0
br i1 %48, label %49, label %55
49: ; preds = %38
%50 = load i32*, i32** %14
%51 = load i32*, i32** %15
%52 = load i32, i32* %51
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds i32, i32* %50, i64 %53
store i32 1, i32* %54
br label %55
55: ; preds = %49, %38
br label %278
56: ; preds = %35
%57 = load i32*, i32** %16
%58 = load i32, i32* %57
%59 = add nsw i32 %58, 1
%60 = load i32*, i32** %16
store i32 %59, i32* %60
%61 = load i32*, i32** %18
store i32 0, i32* %61
%62 = load i32*, i32** %19
store i32 0, i32* %62
%63 = load i32*, i32** %11
%64 = load i32*, i32** %12
%65 = load i32*, i32** %13
%66 = load i32*, i32** %14
%67 = call i32 @genmap(i32* %63, i32* %64, i32* %65, i32* %66)
%68 = load i32*, i32** %14
%69 = load i32*, i32** %15
%70 = load i32, i32* %69
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds i32, i32* %68, i64 %71
%73 = load i32, i32* %72
%74 = icmp eq i32 %73, 0
br i1 %74, label %75, label %81
75: ; preds = %56
%76 = load i32*, i32** %14
%77 = load i32*, i32** %15
%78 = load i32, i32* %77
%79 = sext i32 %78 to i64
%80 = getelementptr inbounds i32, i32* %76, i64 %79
store i32 1, i32* %80
br label %81
81: ; preds = %75, %56
%82 = load i32*, i32** %17
store i32 1, i32* %82
br label %278
83: ; preds = %10
%84 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0))
%85 = load i32*, i32** %15
%86 = load i32, i32* %85
%87 = sub nsw i32 %86, 4
%88 = icmp sge i32 %87, 0
br i1 %88, label %89, label %91
89: ; preds = %83
%90 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
br label %91
91: ; preds = %89, %83
%92 = load i32*, i32** %15
%93 = load i32, i32* %92
%94 = srem i32 %93, 4
%95 = icmp ne i32 %94, 0
br i1 %95, label %96, label %98
96: ; preds = %91
%97 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
br label %98
98: ; preds = %96, %91
%99 = load i32*, i32** %15
%100 = load i32, i32* %99
%101 = srem i32 %100, 4
%102 = icmp ne i32 %101, 3
br i1 %102, label %103, label %105
103: ; preds = %98
%104 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
br label %105
105: ; preds = %103, %98
%106 = load i32*, i32** %15
%107 = load i32, i32* %106
%108 = add nsw i32 %107, 4
%109 = icmp slt i32 %108, 12
br i1 %109, label %110, label %112
110: ; preds = %105
%111 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0))
br label %112
112: ; preds = %110, %105
%113 = load i32*, i32** %12
%114 = load i32*, i32** %15
%115 = load i32, i32* %114
%116 = sext i32 %115 to i64
%117 = getelementptr inbounds i32, i32* %113, i64 %116
%118 = load i32, i32* %117
%119 = icmp eq i32 %118, -1
br i1 %119, label %120, label %122
120: ; preds = %112
%121 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0))
br label %122
122: ; preds = %120, %112
%123 = call i32 @getint(i32* %21)
%124 = load i32, i32* %21
%125 = icmp eq i32 %124, 0
br i1 %125, label %126, label %127
126: ; preds = %122
br label %278
127: ; preds = %122
%128 = load i32, i32* %21
%129 = icmp eq i32 %128, 1
br i1 %129, label %130, label %154
130: ; preds = %127
%131 = load i32*, i32** %15
%132 = getelementptr inbounds i32, i32* %131, i64 -4
%133 = icmp uge i32* %132, null
br i1 %133, label %134, label %154
134: ; preds = %130
%135 = load i32*, i32** %15
%136 = load i32, i32* %135
%137 = sub nsw i32 %136, 4
%138 = load i32*, i32** %15
store i32 %137, i32* %138
%139 = load i32*, i32** %17
store i32 1, i32* %139
%140 = load i32*, i32** %14
%141 = load i32*, i32** %15
%142 = load i32, i32* %141
%143 = sext i32 %142 to i64
%144 = getelementptr inbounds i32, i32* %140, i64 %143
%145 = load i32, i32* %144
%146 = icmp eq i32 %145, 0
br i1 %146, label %147, label %153
147: ; preds = %134
%148 = load i32*, i32** %14
%149 = load i32*, i32** %15
%150 = load i32, i32* %149
%151 = sext i32 %150 to i64
%152 = getelementptr inbounds i32, i32* %148, i64 %151
store i32 1, i32* %152
br label %153
153: ; preds = %147, %134
br label %278
154: ; preds = %130, %127
%155 = load i32, i32* %21
%156 = icmp eq i32 %155, 4
br i1 %156, label %157, label %182
157: ; preds = %154
%158 = load i32*, i32** %15
%159 = load i32, i32* %158
%160 = srem i32 %159, 4
%161 = icmp ne i32 %160, 0
br i1 %161, label %162, label %182
162: ; preds = %157
%163 = load i32*, i32** %15
%164 = load i32, i32* %163
%165 = sub nsw i32 %164, 1
%166 = load i32*, i32** %15
store i32 %165, i32* %166
%167 = load i32*, i32** %17
store i32 1, i32* %167
%168 = load i32*, i32** %14
%169 = load i32*, i32** %15
%170 = load i32, i32* %169
%171 = sext i32 %170 to i64
%172 = getelementptr inbounds i32, i32* %168, i64 %171
%173 = load i32, i32* %172
%174 = icmp eq i32 %173, 0
br i1 %174, label %175, label %181
175: ; preds = %162
%176 = load i32*, i32** %14
%177 = load i32*, i32** %15
%178 = load i32, i32* %177
%179 = sext i32 %178 to i64
%180 = getelementptr inbounds i32, i32* %176, i64 %179
store i32 1, i32* %180
br label %181
181: ; preds = %175, %162
br label %278
182: ; preds = %157, %154
%183 = load i32, i32* %21
%184 = icmp eq i32 %183, 6
br i1 %184, label %185, label %210
185: ; preds = %182
%186 = load i32*, i32** %15
%187 = load i32, i32* %186
%188 = srem i32 %187, 4
%189 = icmp ne i32 %188, 3
br i1 %189, label %190, label %210
190: ; preds = %185
%191 = load i32*, i32** %15
%192 = load i32, i32* %191
%193 = add nsw i32 %192, 1
%194 = load i32*, i32** %15
store i32 %193, i32* %194
%195 = load i32*, i32** %17
store i32 1, i32* %195
%196 = load i32*, i32** %14
%197 = load i32*, i32** %15
%198 = load i32, i32* %197
%199 = sext i32 %198 to i64
%200 = getelementptr inbounds i32, i32* %196, i64 %199
%201 = load i32, i32* %200
%202 = icmp eq i32 %201, 0
br i1 %202, label %203, label %209
203: ; preds = %190
%204 = load i32*, i32** %14
%205 = load i32*, i32** %15
%206 = load i32, i32* %205
%207 = sext i32 %206 to i64
%208 = getelementptr inbounds i32, i32* %204, i64 %207
store i32 1, i32* %208
br label %209
209: ; preds = %203, %190
br label %278
210: ; preds = %185, %182
%211 = load i32, i32* %21
%212 = icmp eq i32 %211, 8
br i1 %212, label %213, label %238
213: ; preds = %210
%214 = load i32*, i32** %15
%215 = load i32, i32* %214
%216 = add nsw i32 %215, 4
%217 = icmp slt i32 %216, 12
br i1 %217, label %218, label %238
218: ; preds = %213
%219 = load i32*, i32** %15
%220 = load i32, i32* %219
%221 = add nsw i32 %220, 4
%222 = load i32*, i32** %15
store i32 %221, i32* %222
%223 = load i32*, i32** %17
store i32 1, i32* %223
%224 = load i32*, i32** %14
%225 = load i32*, i32** %15
%226 = load i32, i32* %225
%227 = sext i32 %226 to i64
%228 = getelementptr inbounds i32, i32* %224, i64 %227
%229 = load i32, i32* %228
%230 = icmp eq i32 %229, 0
br i1 %230, label %231, label %237
231: ; preds = %218
%232 = load i32*, i32** %14
%233 = load i32*, i32** %15
%234 = load i32, i32* %233
%235 = sext i32 %234 to i64
%236 = getelementptr inbounds i32, i32* %232, i64 %235
store i32 1, i32* %236
br label %237
237: ; preds = %231, %218
br label %278
238: ; preds = %213, %210
%239 = load i32, i32* %21
%240 = icmp eq i32 %239, -1
br i1 %240, label %241, label %276
241: ; preds = %238
%242 = load i32*, i32** %12
%243 = load i32*, i32** %15
%244 = load i32, i32* %243
%245 = sext i32 %244 to i64
%246 = getelementptr inbounds i32, i32* %242, i64 %245
%247 = load i32, i32* %246
%248 = icmp eq i32 %247, -1
br i1 %248, label %249, label %276
249: ; preds = %241
%250 = load i32*, i32** %16
%251 = load i32, i32* %250
%252 = add nsw i32 %251, 1
%253 = load i32*, i32** %16
store i32 %252, i32* %253
%254 = load i32*, i32** %18
store i32 0, i32* %254
%255 = load i32*, i32** %19
store i32 0, i32* %255
%256 = load i32*, i32** %11
%257 = load i32*, i32** %12
%258 = load i32*, i32** %13
%259 = load i32*, i32** %14
%260 = call i32 @genmap(i32* %256, i32* %257, i32* %258, i32* %259)
%261 = load i32*, i32** %17
store i32 1, i32* %261
%262 = load i32*, i32** %14
%263 = load i32*, i32** %15
%264 = load i32, i32* %263
%265 = sext i32 %264 to i64
%266 = getelementptr inbounds i32, i32* %262, i64 %265
%267 = load i32, i32* %266
%268 = icmp eq i32 %267, 0
br i1 %268, label %269, label %275
269: ; preds = %249
%270 = load i32*, i32** %14
%271 = load i32*, i32** %15
%272 = load i32, i32* %271
%273 = sext i32 %272 to i64
%274 = getelementptr inbounds i32, i32* %270, i64 %273
store i32 1, i32* %274
br label %275
275: ; preds = %269, %249
br label %278
276: ; preds = %241, %238
%277 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.7, i64 0, i64 0))
br label %278
278: ; preds = %276, %275, %237, %209, %181, %153, %126, %81, %55
ret void
}

LLVM IR (-O2):
@str = [38 x i8] c"Where do you want to go?\0A[0]: Nowhere\00"
@str.8 = [35 x i8] c"That's not an available direction!\00"
@str.9 = [11 x i8] c"[-1]: Down\00"
@str.10 = [11 x i8] c"[8]: South\00"
@str.11 = [10 x i8] c"[6]: East\00"
@str.12 = [10 x i8] c"[4]: West\00"
@str.13 = [11 x i8] c"[1]: North\00"
@str.14 = [31 x i8] c"Where do you want to teleport?\00"
define void @movement(i32* %0, i32* %1, i32* %2, i32* %3, i32* %4, i32* nocapture %5, i32* nocapture writeonly %6, i32* nocapture writeonly %7, i32* nocapture writeonly %8, i32 %9) {
%11 = alloca i32
%12 = bitcast i32* %11 to i8*
store i32 -2, i32* %11
%13 = icmp eq i32 %9, 1
br i1 %13, label %14, label %16
14: ; preds = %10, %14
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.14, i64 0, i64 0))
br label %14
16: ; preds = %10
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str, i64 0, i64 0))
%18 = load i32, i32* %4
%19 = icmp sgt i32 %18, 3
br i1 %19, label %20, label %23
20: ; preds = %16
%21 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.13, i64 0, i64 0))
%22 = load i32, i32* %4
br label %23
23: ; preds = %20, %16
%24 = phi i32 [ %22, %20 ], [ %18, %16 ]
%25 = and i32 %24, 3
%26 = icmp eq i32 %25, 0
br i1 %26, label %30, label %27
27: ; preds = %23
%28 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str.12, i64 0, i64 0))
%29 = load i32, i32* %4
br label %30
30: ; preds = %27, %23
%31 = phi i32 [ %29, %27 ], [ %24, %23 ]
%32 = srem i32 %31, 4
%33 = icmp eq i32 %32, 3
br i1 %33, label %37, label %34
34: ; preds = %30
%35 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str.11, i64 0, i64 0))
%36 = load i32, i32* %4
br label %37
37: ; preds = %34, %30
%38 = phi i32 [ %36, %34 ], [ %31, %30 ]
%39 = icmp slt i32 %38, 8
br i1 %39, label %40, label %43
40: ; preds = %37
%41 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.10, i64 0, i64 0))
%42 = load i32, i32* %4
br label %43
43: ; preds = %40, %37
%44 = phi i32 [ %42, %40 ], [ %38, %37 ]
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds i32, i32* %1, i64 %45
%47 = load i32, i32* %46
%48 = icmp eq i32 %47, -1
br i1 %48, label %49, label %51
49: ; preds = %43
%50 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.9, i64 0, i64 0))
br label %51
51: ; preds = %49, %43
%52 = call i32 @getint(i32* %11)
%53 = load i32, i32* %11
switch i32 %53, label %114 [
i32 0, label %116
i32 1, label %54
i32 4, label %63
i32 6, label %75
i32 8, label %87
i32 -1, label %98
]
54: ; preds = %51
%55 = load i32, i32* %4
%56 = add nsw i32 %55, -4
store i32 %56, i32* %4
store i32 1, i32* %6
%57 = load i32, i32* %4
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds i32, i32* %3, i64 %58
%60 = load i32, i32* %59
%61 = icmp eq i32 %60, 0
br i1 %61, label %62, label %116
62: ; preds = %54
store i32 1, i32* %59
br label %116
63: ; preds = %51
%64 = load i32, i32* %4
%65 = and i32 %64, 3
%66 = icmp eq i32 %65, 0
br i1 %66, label %114, label %67
67: ; preds = %63
%68 = add nsw i32 %64, -1
store i32 %68, i32* %4
store i32 1, i32* %6
%69 = load i32, i32* %4
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds i32, i32* %3, i64 %70
%72 = load i32, i32* %71
%73 = icmp eq i32 %72, 0
br i1 %73, label %74, label %116
74: ; preds = %67
store i32 1, i32* %71
br label %116
75: ; preds = %51
%76 = load i32, i32* %4
%77 = srem i32 %76, 4
%78 = icmp eq i32 %77, 3
br i1 %78, label %114, label %79
79: ; preds = %75
%80 = add nsw i32 %76, 1
store i32 %80, i32* %4
store i32 1, i32* %6
%81 = load i32, i32* %4
%82 = sext i32 %81 to i64
%83 = getelementptr inbounds i32, i32* %3, i64 %82
%84 = load i32, i32* %83
%85 = icmp eq i32 %84, 0
br i1 %85, label %86, label %116
86: ; preds = %79
store i32 1, i32* %83
br label %116
87: ; preds = %51
%88 = load i32, i32* %4
%89 = icmp slt i32 %88, 8
br i1 %89, label %90, label %114
90: ; preds = %87
%91 = add nsw i32 %88, 4
store i32 %91, i32* %4
store i32 1, i32* %6
%92 = load i32, i32* %4
%93 = sext i32 %92 to i64
%94 = getelementptr inbounds i32, i32* %3, i64 %93
%95 = load i32, i32* %94
%96 = icmp eq i32 %95, 0
br i1 %96, label %97, label %116
97: ; preds = %90
store i32 1, i32* %94
br label %116
98: ; preds = %51
%99 = load i32, i32* %4
%100 = sext i32 %99 to i64
%101 = getelementptr inbounds i32, i32* %1, i64 %100
%102 = load i32, i32* %101
%103 = icmp eq i32 %102, -1
br i1 %103, label %104, label %114
104: ; preds = %98
%105 = load i32, i32* %5
%106 = add nsw i32 %105, 1
store i32 %106, i32* %5
store i32 0, i32* %7
store i32 0, i32* %8
%107 = call i32 @genmap(i32* %0, i32* %1, i32* %2, i32* %3)
store i32 1, i32* %6
%108 = load i32, i32* %4
%109 = sext i32 %108 to i64
%110 = getelementptr inbounds i32, i32* %3, i64 %109
%111 = load i32, i32* %110
%112 = icmp eq i32 %111, 0
br i1 %112, label %113, label %116
113: ; preds = %104
store i32 1, i32* %110
br label %116
114: ; preds = %51, %63, %75, %87, %98
%115 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str.8, i64 0, i64 0))
br label %116
116: ; preds = %51, %104, %113, %90, %97, %79, %86, %67, %74, %54, %62, %114
ret void
}