#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*/ getchar();
int /*<<< orphan*/ slowprintf(char *);
int /*<<< orphan*/ strncmp(char *, char *, int);
int /*<<< orphan*/ strtolower(char *);
void help(char *topic) {
  if (topic)
    strtolower(topic);
  if (!strncmp(topic, "co", 2)) {
    slowprintf("WEREWOLVES AND WANDERER COMMANDS\n\n"
               "GO - Travel to a different room. GO then EAST,\n"
               "     GO EAST, or just EAST are all the same.\n"
               "LOOK - Get a description of the room\n"
               "INVENTORY - See your stats.\n"
               "GET or PICK UP - Add the treasure in the room\n"
               "     to your wealth total.\n"
               "TRADE or BUY - Purchase items from the merchant\n"
               "     if available. Typing TRADE then AXE or\n"
               "     BUY AXE are the same.\n"
               "EAT - Consume food to increase your strength.\n"
               "FIGHT - Engage monster in the room to combat.\n"
               "RUN or FLEE - Attempt to escape from monsters\n"
               "     in the room. RUN then EAST or RUN EAST\n"
               "     both have the same effect.\n"
               "MAGIC - If you have the amulet you can summon\n"
               "     its power to teleport you within the castle.\n"
               "EXAMINE - In certain rooms you may learn more\n"
               "     about the story.\n"
               "HIGH SCORE - look at the high score table.\n"
               "QUIT - End your game.\n\n");
  } else {
    slowprintf("WEREWOLVES AND WANDERER\n"
               "Original game by Tim Hartnell.\n"
               "Remake by Joseph Larson\n\n"
               "In this adventure you are the wanderer and\n"
               "werewolves and other strange creatures inhabit\n"
               "an ancient, abandoned, stone castle where you\n"
               "are seeking untold fortune.\n\n"
               "This is a basic text-adventure that seeks to\n"
               "simplify the experience by giving you the\n"
               "available exits and commands without needing\n"
               "to hunt around for them, tho it will also\n"
               "accept a few other commands as well as\n"
               "occasional two word commands.\n\n"
               "The EXAMINE command is the one exception. Typing\n"
               "EXAMINE in a room may give you extra expository\n"
               "information about that room, tho the game may not\n"
               "always tell you when you can use it.\n\n"
               "Type HELP COMMANDS for a list of all commands.\n\n");
  }
  slowprintf("Press ENTER to continue\n");
  getchar();
}


x86 assembly (clang, -O0):
<help>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1160 <help+0x20>
mov    -0x8(%rbp),%rdi
call   1040 <strtolower@plt>
mov    -0x8(%rbp),%rdi
lea    0xe95(%rip),%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    118f <help+0x4f>
lea    0xe7e(%rip),%rdi
call   1060 <slowprintf@plt>
jmp    119b <help+0x5b>
lea    0x11a9(%rip),%rdi
call   1060 <slowprintf@plt>
lea    0x1470(%rip),%rdi
call   1060 <slowprintf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<help>:
push   %rbx
mov    %rdi,%rbx
test   %rdi,%rdi
je     1151 <help+0x11>
mov    %rbx,%rdi
call   1040 <strtolower@plt>
lea    0xea8(%rip),%rsi
mov    %rbx,%rdi
mov    $0x2,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
lea    0xe95(%rip),%rax
lea    0x11ca(%rip),%rdi
cmove  %rax,%rdi
call   1060 <slowprintf@plt>
lea    0x148d(%rip),%rdi
call   1060 <slowprintf@plt>
xor    %eax,%eax
pop    %rbx
jmp    1050 <getchar@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"co\00"
@.str.1 = [828 x i8] c"WEREWOLVES AND WANDERER COMMANDS\0A\0AGO - Travel to a different room. GO then EAST,\0A GO EAST, or just EAST are all the same.\0ALOOK - Get a description of the room\0AINVENTORY - See your stats.\0AGET or PICK UP - Add the treasure in the room\0A to your wealth total.\0ATRADE or BUY - Purchase items from the merchant\0A if available. Typing TRADE then AXE or\0A BUY AXE are the same.\0AEAT - Consume food to increase your strength.\0AFIGHT - Engage monster in the room to combat.\0ARUN or FLEE - Attempt to escape from monsters\0A in the room. RUN then EAST or RUN EAST\0A both have the same effect.\0AMAGIC - If you have the amulet you can summon\0A its power to teleport you within the castle.\0AEXAMINE - In certain rooms you may learn more\0A about the story.\0AHIGH SCORE - look at the high score table.\0AQUIT - End your game.\0A\0A\00"
@.str.2 = [723 x i8] c"WEREWOLVES AND WANDERER\0AOriginal game by Tim Hartnell.\0ARemake by Joseph Larson\0A\0AIn this adventure you are the wanderer and\0Awerewolves and other strange creatures inhabit\0Aan ancient, abandoned, stone castle where you\0Aare seeking untold fortune.\0A\0AThis is a basic text-adventure that seeks to\0Asimplify the experience by giving you the\0Aavailable exits and commands without needing\0Ato hunt around for them, tho it will also\0Aaccept a few other commands as well as\0Aoccasional two word commands.\0A\0AThe EXAMINE command is the one exception. Typing\0AEXAMINE in a room may give you extra expository\0Ainformation about that room, tho the game may not\0Aalways tell you when you can use it.\0A\0AType HELP COMMANDS for a list of all commands.\0A\0A\00"
@.str.3 = [25 x i8] c"Press ENTER to continue\0A\00"
define void @help(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp ne i8* %3, null
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i8*, i8** %2
%7 = call i32 @strtolower(i8* %6)
br label %8
8: ; preds = %5, %1
%9 = load i8*, i8** %2
%10 = call i32 @strncmp(i8* %9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 2)
%11 = icmp ne i32 %10, 0
br i1 %11, label %14, label %12
12: ; preds = %8
%13 = call i32 @slowprintf(i8* getelementptr inbounds ([828 x i8], [828 x i8]* @.str.1, i64 0, i64 0))
br label %16
14: ; preds = %8
%15 = call i32 @slowprintf(i8* getelementptr inbounds ([723 x i8], [723 x i8]* @.str.2, i64 0, i64 0))
br label %16
16: ; preds = %14, %12
%17 = call i32 @slowprintf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0))
%18 = call i32 (...) @getchar()
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"co\00"
@.str.1 = [828 x i8] c"WEREWOLVES AND WANDERER COMMANDS\0A\0AGO - Travel to a different room. GO then EAST,\0A GO EAST, or just EAST are all the same.\0ALOOK - Get a description of the room\0AINVENTORY - See your stats.\0AGET or PICK UP - Add the treasure in the room\0A to your wealth total.\0ATRADE or BUY - Purchase items from the merchant\0A if available. Typing TRADE then AXE or\0A BUY AXE are the same.\0AEAT - Consume food to increase your strength.\0AFIGHT - Engage monster in the room to combat.\0ARUN or FLEE - Attempt to escape from monsters\0A in the room. RUN then EAST or RUN EAST\0A both have the same effect.\0AMAGIC - If you have the amulet you can summon\0A its power to teleport you within the castle.\0AEXAMINE - In certain rooms you may learn more\0A about the story.\0AHIGH SCORE - look at the high score table.\0AQUIT - End your game.\0A\0A\00"
@.str.2 = [723 x i8] c"WEREWOLVES AND WANDERER\0AOriginal game by Tim Hartnell.\0ARemake by Joseph Larson\0A\0AIn this adventure you are the wanderer and\0Awerewolves and other strange creatures inhabit\0Aan ancient, abandoned, stone castle where you\0Aare seeking untold fortune.\0A\0AThis is a basic text-adventure that seeks to\0Asimplify the experience by giving you the\0Aavailable exits and commands without needing\0Ato hunt around for them, tho it will also\0Aaccept a few other commands as well as\0Aoccasional two word commands.\0A\0AThe EXAMINE command is the one exception. Typing\0AEXAMINE in a room may give you extra expository\0Ainformation about that room, tho the game may not\0Aalways tell you when you can use it.\0A\0AType HELP COMMANDS for a list of all commands.\0A\0A\00"
@.str.3 = [25 x i8] c"Press ENTER to continue\0A\00"
define void @help(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @strtolower(i8* %0)
br label %5
5: ; preds = %3, %1
%6 = tail call i32 @strncmp(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 2)
%7 = icmp eq i32 %6, 0
%8 = select i1 %7, i8* getelementptr inbounds ([828 x i8], [828 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([723 x i8], [723 x i8]* @.str.2, i64 0, i64 0)
%9 = tail call i32 @slowprintf(i8* %8)
%10 = tail call i32 @slowprintf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0))
%11 = tail call i32 (...) @getchar()
ret void
}