#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
char *getRoom(int /*<<< orphan*/ *, char *);
char *getRoomText(char *);
scalar_t__ isGameOver(char *);
char *performAction(char *);
int /*<<< orphan*/ printf(char *, char *);
char *processRoom(FILE *adventure_file, char *room_number) {
  char *line;
  line = getRoom(adventure_file, room_number);
  if (!line) {
    printf("Room %s could not be found\n", room_number);
    return 0;
  }
  printf("%s\n", getRoomText(line));
  if (isGameOver(line))
    return 0;
  room_number = performAction(line);
  return room_number;
}


x86 assembly (clang, -O0):
<processRoom>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <getRoom@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1199 <processRoom+0x49>
mov    -0x18(%rbp),%rsi
lea    0xe79(%rip),%rdi
call   1030 <printf@plt>
movq   $0x0,-0x8(%rbp)
jmp    11e6 <processRoom+0x96>
mov    -0x20(%rbp),%rdi
call   1050 <getRoomText@plt>
mov    %rax,%rsi
lea    0xe70(%rip),%rdi
call   1030 <printf@plt>
mov    -0x20(%rbp),%rdi
call   1070 <isGameOver@plt>
cmp    $0x0,%rax
je     11d1 <processRoom+0x81>
movq   $0x0,-0x8(%rbp)
jmp    11e6 <processRoom+0x96>
mov    -0x20(%rbp),%rdi
call   1060 <performAction@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<processRoom>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
call   1040 <getRoom@plt>
test   %rax,%rax
je     1197 <processRoom+0x47>
mov    %rax,%rbx
mov    %rax,%rdi
call   1050 <getRoomText@plt>
lea    0xea9(%rip),%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
mov    %rbx,%rdi
call   1070 <isGameOver@plt>
test   %rax,%rax
jne    11a6 <processRoom+0x56>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1060 <performAction@plt>
lea    0xe62(%rip),%rdi
mov    %r14,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [28 x i8] c"Room %s could not be found\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i8* @processRoom(i32* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i8*
store i32* %0, i32** %4
store i8* %1, i8** %5
%7 = load i32*, i32** %4
%8 = load i8*, i8** %5
%9 = call i8* @getRoom(i32* %7, i8* %8)
store i8* %9, i8** %6
%10 = load i8*, i8** %6
%11 = icmp ne i8* %10, null
br i1 %11, label %15, label %12
12: ; preds = %2
%13 = load i8*, i8** %5
%14 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* %13)
store i8* null, i8** %3
br label %27
15: ; preds = %2
%16 = load i8*, i8** %6
%17 = call i8* @getRoomText(i8* %16)
%18 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %17)
%19 = load i8*, i8** %6
%20 = call i64 @isGameOver(i8* %19)
%21 = icmp ne i64 %20, 0
br i1 %21, label %22, label %23
22: ; preds = %15
store i8* null, i8** %3
br label %27
23: ; preds = %15
%24 = load i8*, i8** %6
%25 = call i8* @performAction(i8* %24)
store i8* %25, i8** %5
%26 = load i8*, i8** %5
store i8* %26, i8** %3
br label %27
27: ; preds = %23, %22, %12
%28 = load i8*, i8** %3
ret i8* %28
}

LLVM IR (-O2):
@.str = [28 x i8] c"Room %s could not be found\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i8* @processRoom(i32* %0, i8* %1) {
%3 = tail call i8* @getRoom(i32* %0, i8* %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* %1)
br label %14
7: ; preds = %2
%8 = tail call i8* @getRoomText(i8* %3)
%9 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %8)
%10 = tail call i64 @isGameOver(i8* %3)
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %7
%13 = tail call i8* @performAction(i8* %3)
br label %14
14: ; preds = %7, %12, %5
%15 = phi i8* [ %13, %12 ], [ null, %5 ], [ null, %7 ]
ret i8* %15
}