#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*/ printf(char *);
scalar_t__ strcmp(char const *, char *);
int game_make_choice(char const *choice, int *roomNumber, int *exit) {
  if (*roomNumber == 0) {
    if (strcmp(choice, "forward") == 0) {
      printf("\n Congrats you've gone absolutely nowhere, you are literally "
             "just standing in a basement. I'm sure you're making your parents "
             "proud\n");
    } else if (strcmp(choice, "backward") == 0) {
      printf("\nYou went throught the basement backdoor and are now outside. "
             "This is actually progress. You've done something right for once "
             "you miserable slacker\n");
      *roomNumber = 1;
    } else {
      printf("\n choice unavailable\n");
    }
  } else if (*roomNumber == 1) {
    if (strcmp(choice, "forward") == 0) {
      printf("\nyou are back in the basement\n");
      *roomNumber = 0;
    } else if (strcmp(choice, "backward") == 0) {
      printf("you die\n");
      *exit = 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<game_make_choice>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
cmpl   $0x0,(%rax)
jne    11b7 <game_make_choice+0x97>
mov    -0x8(%rbp),%rdi
lea    0xeb4(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    116c <game_make_choice+0x4c>
lea    0xea6(%rip),%rdi
call   1030 <printf@plt>
jmp    11b2 <game_make_choice+0x92>
mov    -0x8(%rbp),%rdi
lea    0xf16(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11a1 <game_make_choice+0x81>
lea    0xf09(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
movl   $0x1,(%rax)
jmp    11ad <game_make_choice+0x8d>
lea    0xf83(%rip),%rdi
call   1030 <printf@plt>
jmp    11b2 <game_make_choice+0x92>
jmp    1238 <game_make_choice+0x118>
mov    -0x10(%rbp),%rax
cmpl   $0x1,(%rax)
jne    1233 <game_make_choice+0x113>
mov    -0x8(%rbp),%rdi
lea    0xe31(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11f9 <game_make_choice+0xd9>
lea    0xf5c(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
movl   $0x0,(%rax)
jmp    122e <game_make_choice+0x10e>
mov    -0x8(%rbp),%rdi
lea    0xe89(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1229 <game_make_choice+0x109>
lea    0xf46(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
movl   $0x1,(%rax)
jmp    122e <game_make_choice+0x10e>
jmp    1233 <game_make_choice+0x113>
jmp    1238 <game_make_choice+0x118>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<game_make_choice>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
mov    (%rsi),%eax
cmp    $0x1,%eax
je     1170 <game_make_choice+0x50>
test   %eax,%eax
jne    11e6 <game_make_choice+0xc6>
lea    0xebf(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     11b0 <game_make_choice+0x90>
lea    0xeb3(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     11d3 <game_make_choice+0xb3>
lea    0xece(%rip),%rdi
call   1030 <puts@plt>
jmp    11e6 <game_make_choice+0xc6>
mov    %rdx,%r15
lea    0xe86(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     11be <game_make_choice+0x9e>
lea    0xe7a(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
jne    11e6 <game_make_choice+0xc6>
lea    0xe6f(%rip),%rdi
call   1030 <puts@plt>
movl   $0x1,(%r15)
jmp    11e6 <game_make_choice+0xc6>
lea    0xf29(%rip),%rdi
call   1030 <puts@plt>
jmp    11e6 <game_make_choice+0xc6>
lea    0xe54(%rip),%rdi
call   1030 <puts@plt>
movl   $0x0,(%r14)
jmp    11e6 <game_make_choice+0xc6>
lea    0xe72(%rip),%rdi
call   1030 <puts@plt>
movl   $0x1,(%r14)
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [8 x i8] c"forward\00"
@.str.1 = [133 x i8] c"\0A Congrats you've gone absolutely nowhere, you are literally just standing in a basement. I'm sure you're making your parents proud\0A\00"
@.str.2 = [9 x i8] c"backward\00"
@.str.3 = [149 x i8] c"\0AYou went throught the basement backdoor and are now outside. This is actually progress. You've done something right for once you miserable slacker\0A\00"
@.str.4 = [22 x i8] c"\0A choice unavailable\0A\00"
@.str.5 = [31 x i8] c"\0Ayou are back in the basement\0A\00"
@.str.6 = [9 x i8] c"you die\0A\00"
define i32 @game_make_choice(i8* %0, i32* %1, i32* %2) {
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i32*
store i8* %0, i8** %4
store i32* %1, i32** %5
store i32* %2, i32** %6
%7 = load i32*, i32** %5
%8 = load i32, i32* %7
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %27
10: ; preds = %3
%11 = load i8*, i8** %4
%12 = call i64 @strcmp(i8* %11, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %10
%15 = call i32 @printf(i8* getelementptr inbounds ([133 x i8], [133 x i8]* @.str.1, i64 0, i64 0))
br label %26
16: ; preds = %10
%17 = load i8*, i8** %4
%18 = call i64 @strcmp(i8* %17, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %23
20: ; preds = %16
%21 = call i32 @printf(i8* getelementptr inbounds ([149 x i8], [149 x i8]* @.str.3, i64 0, i64 0))
%22 = load i32*, i32** %5
store i32 1, i32* %22
br label %25
23: ; preds = %16
%24 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0))
br label %25
25: ; preds = %23, %20
br label %26
26: ; preds = %25, %14
br label %48
27: ; preds = %3
%28 = load i32*, i32** %5
%29 = load i32, i32* %28
%30 = icmp eq i32 %29, 1
br i1 %30, label %31, label %47
31: ; preds = %27
%32 = load i8*, i8** %4
%33 = call i64 @strcmp(i8* %32, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%34 = icmp eq i64 %33, 0
br i1 %34, label %35, label %38
35: ; preds = %31
%36 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0))
%37 = load i32*, i32** %5
store i32 0, i32* %37
br label %46
38: ; preds = %31
%39 = load i8*, i8** %4
%40 = call i64 @strcmp(i8* %39, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%41 = icmp eq i64 %40, 0
br i1 %41, label %42, label %45
42: ; preds = %38
%43 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0))
%44 = load i32*, i32** %6
store i32 1, i32* %44
br label %45
45: ; preds = %42, %38
br label %46
46: ; preds = %45, %35
br label %47
47: ; preds = %46, %27
br label %48
48: ; preds = %47, %26
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"forward\00"
@.str.2 = [9 x i8] c"backward\00"
@str = [8 x i8] c"you die\00"
@str.7 = [30 x i8] c"\0Ayou are back in the basement\00"
@str.8 = [21 x i8] c"\0A choice unavailable\00"
@str.9 = [148 x i8] c"\0AYou went throught the basement backdoor and are now outside. This is actually progress. You've done something right for once you miserable slacker\00"
@str.10 = [132 x i8] c"\0A Congrats you've gone absolutely nowhere, you are literally just standing in a basement. I'm sure you're making your parents proud\00"
define i32 @game_make_choice(i8* %0, i32* nocapture %1, i32* nocapture writeonly %2) {
%4 = load i32, i32* %1
switch i32 %4, label %27 [
i32 0, label %5
i32 1, label %17
]
5: ; preds = %3
%6 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %5
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([132 x i8], [132 x i8]* @str.10, i64 0, i64 0))
br label %27
10: ; preds = %5
%11 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %10
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([148 x i8], [148 x i8]* @str.9, i64 0, i64 0))
store i32 1, i32* %1
br label %27
15: ; preds = %10
%16 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.8, i64 0, i64 0))
br label %27
17: ; preds = %3
%18 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %17
%21 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.7, i64 0, i64 0))
store i32 0, i32* %1
br label %27
22: ; preds = %17
%23 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%24 = icmp eq i64 %23, 0
br i1 %24, label %25, label %27
25: ; preds = %22
%26 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
store i32 1, i32* %2
br label %27
27: ; preds = %3, %22, %25, %20, %8, %15, %13
ret i32 0
}