#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*/ input;

/* Variables and functions */
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *, ...);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ s_tokenize(char *, char **, int, char *);
int /*<<< orphan*/ s_tolower(char *);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ strcmp(char *, char *);
int /*<<< orphan*/ system(char *);
void start_menu(void) {
  char input[255 + 1];
  char *tokens[2] = {NULL};
  for (;;) {
    system("clear");
    printf("              %s\n"
           "    ------------------------\n\n"
           "      S  Start the game\n\n"
           "      C  Show credits\n\n"
           "      I  Info about playing\n\n"
           "      Q  Quit\n\n",
           "Hunt");
    fgets(input, sizeof(input), stdin);
    s_tolower(input);
    s_tokenize(input, tokens, 2, " \n");
    if (tokens[0] == NULL || tokens[1] != NULL)
      continue;
    if (!strcmp(tokens[0], "s")) {
      return;
    } else if (!strcmp(tokens[0], "c")) {
      system("clear");
      printf(
          "Name: %s\n"
          "Version: %s\n\n"
          "Copyright (C) 2012-2013 %s <%s>\n\n"
          "%s is free software: you can redistribute it and/or modify\n"
          "it under the terms of the GNU General Public License as published "
          "by\n"
          "the Free Software Foundation, either version 3 of the License, or\n"
          "(at your option) any later version.\n\n"
          "Written by %s.\n\n"
          "Special thanks to migf1.\n\n",
          "Hunt", "0.4.0", "Ilias Stamatis", "stamatis.iliass@gmail.com",
          "Hunt", "Ilias Stamatis");
      puts("[Press Enter.]");
      fgets(input, sizeof(input), stdin);
    } else if (!strcmp(tokens[0], "i")) {
      system("clear");
      puts("Info about playing\n"
           "-------------------\n"
           "Commands consist of sentences with one, two or three words.\n"
           "Only the following commands are understood by the program:\n"
           "HELP, QUIT, SHOOT, LOOK, BUY, STATUS.\n\n"
           "Try HELP to see a description of each command.\n\n"
           "Your target is to capture as many animals as you can.\n"
           "For each animal you capture you earn gold and gain some xp.\n"
           "You can buy bullets, better weapons and drugs in case you get hurt "
           "by an animal.\n\n"
           "When your health drops below 0, the game is over.\n");
      puts("[Press Enter.]");
      fgets(input, sizeof(input), stdin);
    } else if (!strcmp(tokens[0], "q"))
      exit(EXIT_SUCCESS);
  }
}


x86 assembly (clang, -O0):
<start_menu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
lea    -0x110(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1060 <memset@plt>
lea    0xe4b(%rip),%rdi
call   1040 <system@plt>
lea    0xe45(%rip),%rdi
lea    0xeca(%rip),%rsi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x100(%rbp),%rdi
mov    0x2e0b(%rip),%rax
mov    (%rax),%edx
mov    $0x100,%esi
call   1070 <fgets@plt>
lea    -0x100(%rbp),%rdi
call   1090 <s_tolower@plt>
lea    -0x100(%rbp),%rdi
lea    -0x110(%rbp),%rsi
mov    $0x2,%edx
lea    0xe88(%rip),%rcx
call   10a0 <s_tokenize@plt>
cmpq   $0x0,-0x110(%rbp)
je     1230 <start_menu+0xa0>
cmpq   $0x0,-0x108(%rbp)
je     1235 <start_menu+0xa5>
jmp    11ae <start_menu+0x1e>
mov    -0x110(%rbp),%rdi
lea    0xfb5(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%eax
jne    125a <start_menu+0xca>
add    $0x120,%rsp
pop    %rbp
ret
mov    -0x110(%rbp),%rdi
lea    0xe32(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%eax
jne    12e1 <start_menu+0x151>
lea    0xd83(%rip),%rdi
call   1040 <system@plt>
lea    0xe13(%rip),%rdi
lea    0xe02(%rip),%r9
lea    0xf4e(%rip),%rdx
lea    0xf4d(%rip),%rax
lea    0xf55(%rip),%r8
mov    %r9,%rsi
mov    %rax,%rcx
mov    %rax,(%rsp)
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xf57(%rip),%rdi
call   1030 <puts@plt>
lea    -0x100(%rbp),%rdi
mov    0x2d18(%rip),%rax
mov    (%rax),%edx
mov    $0x100,%esi
call   1070 <fgets@plt>
jmp    1374 <start_menu+0x1e4>
mov    -0x110(%rbp),%rdi
lea    0xf34(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%eax
jne    1340 <start_menu+0x1b0>
lea    0xcfc(%rip),%rdi
call   1040 <system@plt>
lea    0xf15(%rip),%rdi
call   1030 <puts@plt>
lea    0xef8(%rip),%rdi
call   1030 <puts@plt>
lea    -0x100(%rbp),%rdi
mov    0x2cb9(%rip),%rax
mov    (%rax),%edx
mov    $0x100,%esi
call   1070 <fgets@plt>
jmp    136f <start_menu+0x1df>
mov    -0x110(%rbp),%rdi
lea    0x10c3(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%eax
jne    136a <start_menu+0x1da>
mov    0x2c75(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
jmp    136f <start_menu+0x1df>
jmp    1374 <start_menu+0x1e4>
jmp    1379 <start_menu+0x1e9>
jmp    11ae <start_menu+0x1e>

x86 assembly (clang, -O2):
<start_menu>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x128,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x10(%rsp)
lea    0xe60(%rip),%r15
lea    0xeeb(%rip),%r12
mov    0x2e3a(%rip),%r13
lea    0x20(%rsp),%rbx
lea    0x10(%rsp),%rbp
jmp    120c <start_menu+0x8c>
mov    %r15,%rdi
call   1040 <system@plt>
lea    0x1022(%rip),%rcx
mov    %rcx,(%rsp)
lea    0xec8(%rip),%rdi
mov    %r12,%rsi
lea    0x1007(%rip),%rdx
lea    0x1015(%rip),%r8
mov    %r12,%r9
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x101e(%rip),%rdi
call   1030 <puts@plt>
mov    0x0(%r13),%edx
mov    %rbx,%rdi
mov    $0x100,%esi
call   1060 <fgets@plt>
mov    %r15,%rdi
call   1040 <system@plt>
lea    0xdeb(%rip),%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x0(%r13),%edx
mov    %rbx,%rdi
mov    $0x100,%esi
call   1060 <fgets@plt>
mov    %rbx,%rdi
call   1080 <s_tolower@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    $0x2,%edx
lea    0xe47(%rip),%rcx
call   1090 <s_tokenize@plt>
mov    0x10(%rsp),%r14
test   %r14,%r14
je     120c <start_menu+0x8c>
cmpq   $0x0,0x18(%rsp)
jne    120c <start_menu+0x8c>
mov    %r14,%rdi
lea    0xf87(%rip),%rsi
call   1070 <strcmp@plt>
test   %eax,%eax
je     12d6 <start_menu+0x156>
mov    %r14,%rdi
lea    0xe16(%rip),%rsi
call   1070 <strcmp@plt>
test   %eax,%eax
je     11ba <start_menu+0x3a>
mov    %r14,%rdi
lea    0xf88(%rip),%rsi
call   1070 <strcmp@plt>
test   %eax,%eax
je     12bd <start_menu+0x13d>
mov    %r14,%rdi
lea    0x1163(%rip),%rsi
call   1070 <strcmp@plt>
test   %eax,%eax
jne    120c <start_menu+0x8c>
jmp    12e8 <start_menu+0x168>
mov    %r15,%rdi
call   1040 <system@plt>
lea    0xf59(%rip),%rdi
call   1030 <puts@plt>
jmp    11ef <start_menu+0x6f>
add    $0x128,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2ce9(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"clear\00"
@.str.1 = [140 x i8] c" %s\0A ------------------------\0A\0A S Start the game\0A\0A C Show credits\0A\0A I Info about playing\0A\0A Q Quit\0A\0A\00"
@.str.2 = [5 x i8] c"Hunt\00"
@stdin = global i32 0
@.str.3 = [3 x i8] c" \0A\00"
@.str.4 = [2 x i8] c"s\00"
@.str.5 = [2 x i8] c"c\00"
@.str.6 = [329 x i8] c"Name: %s\0AVersion: %s\0A\0ACopyright (C) 2012-2013 %s <%s>\0A\0A%s is free software: you can redistribute it and/or modify\0Ait under the terms of the GNU General Public License as published by\0Athe Free Software Foundation, either version 3 of the License, or\0A(at your option) any later version.\0A\0AWritten by %s.\0A\0ASpecial thanks to migf1.\0A\0A\00"
@.str.7 = [6 x i8] c"0.4.0\00"
@.str.8 = [15 x i8] c"Ilias Stamatis\00"
@.str.9 = [26 x i8] c"stamatis.iliass@gmail.com\00"
@.str.10 = [15 x i8] c"[Press Enter.]\00"
@.str.11 = [2 x i8] c"i\00"
@.str.12 = [492 x i8] c"Info about playing\0A-------------------\0ACommands consist of sentences with one, two or three words.\0AOnly the following commands are understood by the program:\0AHELP, QUIT, SHOOT, LOOK, BUY, STATUS.\0A\0ATry HELP to see a description of each command.\0A\0AYour target is to capture as many animals as you can.\0AFor each animal you capture you earn gold and gain some xp.\0AYou can buy bullets, better weapons and drugs in case you get hurt by an animal.\0A\0AWhen your health drops below 0, the game is over.\0A\00"
@.str.13 = [2 x i8] c"q\00"
@EXIT_SUCCESS = global i32 0
define void @start_menu() {
%1 = alloca [256 x i8]
%2 = alloca [2 x i8*]
%3 = bitcast [2 x i8*]* %2 to i8*
br label %4
4: ; preds = %64, %22, %0
%5 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%6 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([140 x i8], [140 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%7 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%8 = load i32, i32* @stdin
%9 = call i32 @fgets(i8* %7, i32 256, i32 %8)
%10 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%11 = call i32 @s_tolower(i8* %10)
%12 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%13 = getelementptr inbounds [2 x i8*], [2 x i8*]* %2, i64 0, i64 0
%14 = call i32 @s_tokenize(i8* %12, i8** %13, i32 2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%15 = getelementptr inbounds [2 x i8*], [2 x i8*]* %2, i64 0, i64 0
%16 = load i8*, i8** %15
%17 = icmp eq i8* %16, null
br i1 %17, label %22, label %18
18: ; preds = %4
%19 = getelementptr inbounds [2 x i8*], [2 x i8*]* %2, i64 0, i64 1
%20 = load i8*, i8** %19
%21 = icmp ne i8* %20, null
br i1 %21, label %22, label %23
22: ; preds = %18, %4
br label %4
23: ; preds = %18
%24 = getelementptr inbounds [2 x i8*], [2 x i8*]* %2, i64 0, i64 0
%25 = load i8*, i8** %24
%26 = call i32 @strcmp(i8* %25, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%27 = icmp ne i32 %26, 0
br i1 %27, label %29, label %28
28: ; preds = %23
ret void
29: ; preds = %23
%30 = getelementptr inbounds [2 x i8*], [2 x i8*]* %2, i64 0, i64 0
%31 = load i8*, i8** %30
%32 = call i32 @strcmp(i8* %31, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%33 = icmp ne i32 %32, 0
br i1 %33, label %41, label %34
34: ; preds = %29
%35 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%36 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([329 x i8], [329 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.8, i64 0, i64 0))
%37 = call i32 @puts(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.10, i64 0, i64 0))
%38 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%39 = load i32, i32* @stdin
%40 = call i32 @fgets(i8* %38, i32 256, i32 %39)
br label %63
41: ; preds = %29
%42 = getelementptr inbounds [2 x i8*], [2 x i8*]* %2, i64 0, i64 0
%43 = load i8*, i8** %42
%44 = call i32 @strcmp(i8* %43, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i64 0, i64 0))
%45 = icmp ne i32 %44, 0
br i1 %45, label %53, label %46
46: ; preds = %41
%47 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%48 = call i32 @puts(i8* getelementptr inbounds ([492 x i8], [492 x i8]* @.str.12, i64 0, i64 0))
%49 = call i32 @puts(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.10, i64 0, i64 0))
%50 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%51 = load i32, i32* @stdin
%52 = call i32 @fgets(i8* %50, i32 256, i32 %51)
br label %62
53: ; preds = %41
%54 = getelementptr inbounds [2 x i8*], [2 x i8*]* %2, i64 0, i64 0
%55 = load i8*, i8** %54
%56 = call i32 @strcmp(i8* %55, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.13, i64 0, i64 0))
%57 = icmp ne i32 %56, 0
br i1 %57, label %61, label %58
58: ; preds = %53
%59 = load i32, i32* @EXIT_SUCCESS
%60 = call i32 @exit(i32 %59)
unreachable
61: ; preds = %53
br label %62
62: ; preds = %61, %46
br label %63
63: ; preds = %62, %34
br label %64
64: ; preds = %63
br label %4
}

LLVM IR (-O2):
@.str = [6 x i8] c"clear\00"
@.str.1 = [140 x i8] c" %s\0A ------------------------\0A\0A S Start the game\0A\0A C Show credits\0A\0A I Info about playing\0A\0A Q Quit\0A\0A\00"
@.str.2 = [5 x i8] c"Hunt\00"
@stdin = global i32 0
@.str.3 = [3 x i8] c" \0A\00"
@.str.4 = [2 x i8] c"s\00"
@.str.5 = [2 x i8] c"c\00"
@.str.6 = [329 x i8] c"Name: %s\0AVersion: %s\0A\0ACopyright (C) 2012-2013 %s <%s>\0A\0A%s is free software: you can redistribute it and/or modify\0Ait under the terms of the GNU General Public License as published by\0Athe Free Software Foundation, either version 3 of the License, or\0A(at your option) any later version.\0A\0AWritten by %s.\0A\0ASpecial thanks to migf1.\0A\0A\00"
@.str.7 = [6 x i8] c"0.4.0\00"
@.str.8 = [15 x i8] c"Ilias Stamatis\00"
@.str.9 = [26 x i8] c"stamatis.iliass@gmail.com\00"
@.str.10 = [15 x i8] c"[Press Enter.]\00"
@.str.11 = [2 x i8] c"i\00"
@.str.12 = [492 x i8] c"Info about playing\0A-------------------\0ACommands consist of sentences with one, two or three words.\0AOnly the following commands are understood by the program:\0AHELP, QUIT, SHOOT, LOOK, BUY, STATUS.\0A\0ATry HELP to see a description of each command.\0A\0AYour target is to capture as many animals as you can.\0AFor each animal you capture you earn gold and gain some xp.\0AYou can buy bullets, better weapons and drugs in case you get hurt by an animal.\0A\0AWhen your health drops below 0, the game is over.\0A\00"
@.str.13 = [2 x i8] c"q\00"
@EXIT_SUCCESS = global i32 0
define void @start_menu() {
%1 = alloca [256 x i8]
%2 = alloca [2 x i8*]
%3 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%4 = bitcast [2 x i8*]* %2 to i8*
%5 = getelementptr inbounds [2 x i8*], [2 x i8*]* %2, i64 0, i64 0
%6 = getelementptr inbounds [2 x i8*], [2 x i8*]* %2, i64 0, i64 1
br label %7
7: ; preds = %45, %0
%8 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%9 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([140 x i8], [140 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%10 = load i32, i32* @stdin
%11 = call i32 @fgets(i8* %3, i32 256, i32 %10)
%12 = call i32 @s_tolower(i8* %3)
%13 = call i32 @s_tokenize(i8* %3, i8** %5, i32 2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%14 = load i8*, i8** %5
%15 = icmp eq i8* %14, null
%16 = load i8*, i8** %6
%17 = icmp ne i8* %16, null
%18 = select i1 %15, i1 true, i1 %17
br i1 %18, label %45, label %19
19: ; preds = %7
%20 = call i32 @strcmp(i8* dereferenceable(1) %14, i8* dereferenceable(2) getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%21 = icmp eq i32 %20, 0
br i1 %21, label %22, label %23
22: ; preds = %19
ret void
23: ; preds = %19
%24 = call i32 @strcmp(i8* dereferenceable(1) %14, i8* dereferenceable(2) getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%25 = icmp eq i32 %24, 0
br i1 %25, label %26, label %29
26: ; preds = %23
%27 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%28 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([329 x i8], [329 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.8, i64 0, i64 0))
br label %41
29: ; preds = %23
%30 = call i32 @strcmp(i8* dereferenceable(1) %14, i8* dereferenceable(2) getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i64 0, i64 0))
%31 = icmp eq i32 %30, 0
br i1 %31, label %32, label %35
32: ; preds = %29
%33 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%34 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([492 x i8], [492 x i8]* @.str.12, i64 0, i64 0))
br label %41
35: ; preds = %29
%36 = call i32 @strcmp(i8* dereferenceable(1) %14, i8* dereferenceable(2) getelementptr inbounds ([2 x i8], [2 x i8]* @.str.13, i64 0, i64 0))
%37 = icmp eq i32 %36, 0
br i1 %37, label %38, label %45
38: ; preds = %35
%39 = load i32, i32* @EXIT_SUCCESS
%40 = call i32 @exit(i32 %39)
unreachable
41: ; preds = %26, %32
%42 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.10, i64 0, i64 0))
%43 = load i32, i32* @stdin
%44 = call i32 @fgets(i8* %3, i32 256, i32 %43)
br label %45
45: ; preds = %41, %35, %7
br label %7
}