#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*/ game_make_choice(char *, int *, int *);
int /*<<< orphan*/ game_print_menu(int);
int /*<<< orphan*/ game_print_welcome_msg(int);
int scanf(char *, char *);
int main(void) {
  int exit = 0;
  int room = 0;
  char choice[20];
  while (!exit) {
    game_print_welcome_msg(room);
    game_print_menu(room);
    int ret = scanf("%19s", choice);
    if (ret != 1)
      return -1;
    game_make_choice(choice, &room, &exit);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1173 <main+0x33>
jmp    11c2 <main+0x82>
mov    -0xc(%rbp),%edi
call   1040 <game_print_welcome_msg@plt>
mov    -0xc(%rbp),%edi
call   1030 <game_print_menu@plt>
lea    -0x20(%rbp),%rsi
lea    0xe72(%rip),%rdi
call   1050 <scanf@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x1,-0x24(%rbp)
je     11ac <main+0x6c>
movl   $0xffffffff,-0x4(%rbp)
jmp    11c2 <main+0x82>
lea    -0x20(%rbp),%rdi
lea    -0xc(%rbp),%rsi
lea    -0x8(%rbp),%rdx
call   1060 <game_make_choice@plt>
jmp    115d <main+0x1d>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x30,%rsp
movl   $0x0,0xc(%rsp)
movl   $0x0,0x8(%rsp)
xor    %edi,%edi
call   1040 <game_print_welcome_msg@plt>
mov    0x8(%rsp),%edi
call   1030 <game_print_menu@plt>
lea    0xe8d(%rip),%rdi
lea    0x10(%rsp),%rsi
call   1050 <scanf@plt>
mov    $0xffffffff,%r14d
cmp    $0x1,%eax
jne    11dc <main+0x9c>
lea    0x10(%rsp),%rbx
lea    0x8(%rsp),%r15
lea    0xc(%rsp),%rbp
lea    0xe62(%rip),%r12
xchg   %ax,%ax
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %rbp,%rdx
call   1060 <game_make_choice@plt>
cmpl   $0x0,0xc(%rsp)
jne    11d9 <main+0x99>
mov    0x8(%rsp),%edi
call   1040 <game_print_welcome_msg@plt>
mov    0x8(%rsp),%edi
call   1030 <game_print_menu@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
cmp    $0x1,%eax
je     11a0 <main+0x60>
jmp    11dc <main+0x9c>
xor    %r14d,%r14d
mov    %r14d,%eax
add    $0x30,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%19s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [20 x i8]
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
br label %6
6: ; preds = %20, %0
%7 = load i32, i32* %2
%8 = icmp ne i32 %7, 0
%9 = xor i1 %8, true
br i1 %9, label %10, label %23
10: ; preds = %6
%11 = load i32, i32* %3
%12 = call i32 @game_print_welcome_msg(i32 %11)
%13 = load i32, i32* %3
%14 = call i32 @game_print_menu(i32 %13)
%15 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 0
%16 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %15)
store i32 %16, i32* %5
%17 = load i32, i32* %5
%18 = icmp ne i32 %17, 1
br i1 %18, label %19, label %20
19: ; preds = %10
store i32 -1, i32* %1
br label %23
20: ; preds = %10
%21 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 0
%22 = call i32 @game_make_choice(i8* %21, i32* %3, i32* %2)
br label %6
23: ; preds = %19, %6
%24 = load i32, i32* %1
ret i32 %24
}

LLVM IR (-O2):
@.str = [5 x i8] c"%19s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [20 x i8]
%4 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%5 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%6 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%7 = call i32 @game_print_welcome_msg(i32 0)
%8 = load i32, i32* %2
%9 = call i32 @game_print_menu(i32 %8)
%10 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %6)
%11 = icmp eq i32 %10, 1
br i1 %11, label %12, label %23
12: ; preds = %0, %16
%13 = call i32 @game_make_choice(i8* %6, i32* %2, i32* %1)
%14 = load i32, i32* %1
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %23
16: ; preds = %12
%17 = load i32, i32* %2
%18 = call i32 @game_print_welcome_msg(i32 %17)
%19 = load i32, i32* %2
%20 = call i32 @game_print_menu(i32 %19)
%21 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %6)
%22 = icmp eq i32 %21, 1
br i1 %22, label %12, label %23
23: ; preds = %16, %12, %0
%24 = phi i32 [ -1, %0 ], [ -1, %16 ], [ 0, %12 ]
ret i32 %24
}