#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*/ executeAsk(char *);
int /*<<< orphan*/ executeDrop(char *);
int /*<<< orphan*/ executeGet(char *);
int /*<<< orphan*/ executeGive(char *);
int /*<<< orphan*/ executeGo(char *);
int /*<<< orphan*/ executeInventory();
int /*<<< orphan*/ executeLook(char *);
int /*<<< orphan*/ printf(char *, char *);
scalar_t__ strcmp(char *, char *);
char *strtok(char *, char *);
bool parseAndExecute(char *input) {
  char *verb = strtok(input, " \n");
  char *noun = strtok(NULL, "\n");
  if (verb != NULL) {
    if (strcmp(verb, "quit") == 0) {
      return false;
    } else if (strcmp(verb, "look") == 0) {
      executeLook(noun);
    } else if (strcmp(verb, "go") == 0) {
      executeGo(noun);
    } else if (strcmp(verb, "get") == 0) {
      executeGet(noun);
    } else if (strcmp(verb, "drop") == 0) {
      executeDrop(noun);
    } else if (strcmp(verb, "give") == 0) {
      executeGive(noun);
    } else if (strcmp(verb, "ask") == 0) {
      executeAsk(noun);
    } else if (strcmp(verb, "inventory") == 0) {
      executeInventory();
    } else {
      printf("I don't know how to '%s'.\n", verb);
    }
  }
  return true;
}


x86 assembly (clang, -O0):
<parseAndExecute>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe49(%rip),%rsi
call   10c0 <strtok@plt>
mov    %rax,-0x18(%rbp)
xor    %eax,%eax
mov    %eax,%edi
lea    0xe36(%rip),%rsi
call   10c0 <strtok@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1353 <parseAndExecute+0x1b3>
mov    -0x18(%rbp),%rdi
lea    0xe19(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
jne    1205 <parseAndExecute+0x65>
movl   $0x0,-0x4(%rbp)
jmp    135a <parseAndExecute+0x1ba>
mov    -0x18(%rbp),%rdi
lea    0xdf8(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
jne    122d <parseAndExecute+0x8d>
mov    -0x20(%rbp),%rdi
call   1030 <executeLook@plt>
jmp    1349 <parseAndExecute+0x1a9>
mov    -0x18(%rbp),%rdi
lea    0xdd5(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
jne    1255 <parseAndExecute+0xb5>
mov    -0x20(%rbp),%rdi
call   1080 <executeGo@plt>
jmp    1344 <parseAndExecute+0x1a4>
mov    -0x18(%rbp),%rdi
lea    0xdb0(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
jne    127d <parseAndExecute+0xdd>
mov    -0x20(%rbp),%rdi
call   10b0 <executeGet@plt>
jmp    133f <parseAndExecute+0x19f>
mov    -0x18(%rbp),%rdi
lea    0xd8c(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
jne    12a5 <parseAndExecute+0x105>
mov    -0x20(%rbp),%rdi
call   10a0 <executeDrop@plt>
jmp    133a <parseAndExecute+0x19a>
mov    -0x18(%rbp),%rdi
lea    0xd69(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
jne    12cd <parseAndExecute+0x12d>
mov    -0x20(%rbp),%rdi
call   1040 <executeGive@plt>
jmp    1335 <parseAndExecute+0x195>
mov    -0x18(%rbp),%rdi
lea    0xd46(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
jne    12f5 <parseAndExecute+0x155>
mov    -0x20(%rbp),%rdi
call   1060 <executeAsk@plt>
jmp    1330 <parseAndExecute+0x190>
mov    -0x18(%rbp),%rdi
lea    0xd22(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
jne    131b <parseAndExecute+0x17b>
mov    $0x0,%al
call   1050 <executeInventory@plt>
jmp    132b <parseAndExecute+0x18b>
mov    -0x18(%rbp),%rsi
lea    0xd06(%rip),%rdi
call   1070 <printf@plt>
jmp    1330 <parseAndExecute+0x190>
jmp    1335 <parseAndExecute+0x195>
jmp    133a <parseAndExecute+0x19a>
jmp    133f <parseAndExecute+0x19f>
jmp    1344 <parseAndExecute+0x1a4>
jmp    1349 <parseAndExecute+0x1a9>
jmp    134e <parseAndExecute+0x1ae>
jmp    1353 <parseAndExecute+0x1b3>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parseAndExecute>:
push   %r15
push   %r14
push   %rbx
lea    0xe54(%rip),%rsi
call   10c0 <strtok@plt>
mov    %rax,%r15
lea    0xe46(%rip),%rsi
xor    %ebx,%ebx
xor    %edi,%edi
call   10c0 <strtok@plt>
test   %r15,%r15
je     12cc <parseAndExecute+0x12c>
mov    %rax,%r14
lea    0xe2c(%rip),%rsi
mov    %r15,%rdi
call   1090 <strcmp@plt>
test   %rax,%rax
je     12d1 <parseAndExecute+0x131>
lea    0xe19(%rip),%rsi
mov    %r15,%rdi
call   1090 <strcmp@plt>
test   %rax,%rax
je     1289 <parseAndExecute+0xe9>
lea    0xe06(%rip),%rsi
mov    %r15,%rdi
call   1090 <strcmp@plt>
test   %rax,%rax
je     1293 <parseAndExecute+0xf3>
lea    0xdf5(%rip),%rsi
mov    %r15,%rdi
call   1090 <strcmp@plt>
test   %rax,%rax
je     129d <parseAndExecute+0xfd>
lea    0xde5(%rip),%rsi
mov    %r15,%rdi
call   1090 <strcmp@plt>
test   %rax,%rax
je     12a7 <parseAndExecute+0x107>
lea    0xdd6(%rip),%rsi
mov    %r15,%rdi
call   1090 <strcmp@plt>
test   %rax,%rax
je     12b1 <parseAndExecute+0x111>
lea    0xdc7(%rip),%rsi
mov    %r15,%rdi
call   1090 <strcmp@plt>
test   %rax,%rax
je     12bb <parseAndExecute+0x11b>
lea    0xdb7(%rip),%rsi
mov    %r15,%rdi
call   1090 <strcmp@plt>
test   %rax,%rax
je     12c5 <parseAndExecute+0x125>
lea    0xdad(%rip),%rdi
mov    %r15,%rsi
call   1070 <printf@plt>
jmp    12cc <parseAndExecute+0x12c>
mov    %r14,%rdi
call   1030 <executeLook@plt>
jmp    12cc <parseAndExecute+0x12c>
mov    %r14,%rdi
call   1080 <executeGo@plt>
jmp    12cc <parseAndExecute+0x12c>
mov    %r14,%rdi
call   10b0 <executeGet@plt>
jmp    12cc <parseAndExecute+0x12c>
mov    %r14,%rdi
call   10a0 <executeDrop@plt>
jmp    12cc <parseAndExecute+0x12c>
mov    %r14,%rdi
call   1040 <executeGive@plt>
jmp    12cc <parseAndExecute+0x12c>
mov    %r14,%rdi
call   1060 <executeAsk@plt>
jmp    12cc <parseAndExecute+0x12c>
xor    %eax,%eax
call   1050 <executeInventory@plt>
mov    $0x1,%ebx
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c" \0A\00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [5 x i8] c"quit\00"
@.str.3 = [5 x i8] c"look\00"
@.str.4 = [3 x i8] c"go\00"
@.str.5 = [4 x i8] c"get\00"
@.str.6 = [5 x i8] c"drop\00"
@.str.7 = [5 x i8] c"give\00"
@.str.8 = [4 x i8] c"ask\00"
@.str.9 = [10 x i8] c"inventory\00"
@.str.10 = [27 x i8] c"I don't know how to '%s'.\0A\00"
define i32 @parseAndExecute(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %3
%6 = load i8*, i8** %3
%7 = call i8* @strtok(i8* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i8* %7, i8** %4
%8 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i8* %8, i8** %5
%9 = load i8*, i8** %4
%10 = icmp ne i8* %9, null
br i1 %10, label %11, label %75
11: ; preds = %1
%12 = load i8*, i8** %4
%13 = call i64 @strcmp(i8* %12, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %11
store i32 0, i32* %2
br label %76
16: ; preds = %11
%17 = load i8*, i8** %4
%18 = call i64 @strcmp(i8* %17, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %23
20: ; preds = %16
%21 = load i8*, i8** %5
%22 = call i32 @executeLook(i8* %21)
br label %73
23: ; preds = %16
%24 = load i8*, i8** %4
%25 = call i64 @strcmp(i8* %24, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%26 = icmp eq i64 %25, 0
br i1 %26, label %27, label %30
27: ; preds = %23
%28 = load i8*, i8** %5
%29 = call i32 @executeGo(i8* %28)
br label %72
30: ; preds = %23
%31 = load i8*, i8** %4
%32 = call i64 @strcmp(i8* %31, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%33 = icmp eq i64 %32, 0
br i1 %33, label %34, label %37
34: ; preds = %30
%35 = load i8*, i8** %5
%36 = call i32 @executeGet(i8* %35)
br label %71
37: ; preds = %30
%38 = load i8*, i8** %4
%39 = call i64 @strcmp(i8* %38, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%40 = icmp eq i64 %39, 0
br i1 %40, label %41, label %44
41: ; preds = %37
%42 = load i8*, i8** %5
%43 = call i32 @executeDrop(i8* %42)
br label %70
44: ; preds = %37
%45 = load i8*, i8** %4
%46 = call i64 @strcmp(i8* %45, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
%47 = icmp eq i64 %46, 0
br i1 %47, label %48, label %51
48: ; preds = %44
%49 = load i8*, i8** %5
%50 = call i32 @executeGive(i8* %49)
br label %69
51: ; preds = %44
%52 = load i8*, i8** %4
%53 = call i64 @strcmp(i8* %52, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0))
%54 = icmp eq i64 %53, 0
br i1 %54, label %55, label %58
55: ; preds = %51
%56 = load i8*, i8** %5
%57 = call i32 @executeAsk(i8* %56)
br label %68
58: ; preds = %51
%59 = load i8*, i8** %4
%60 = call i64 @strcmp(i8* %59, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0))
%61 = icmp eq i64 %60, 0
br i1 %61, label %62, label %64
62: ; preds = %58
%63 = call i32 (...) @executeInventory()
br label %67
64: ; preds = %58
%65 = load i8*, i8** %4
%66 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.10, i64 0, i64 0), i8* %65)
br label %67
67: ; preds = %64, %62
br label %68
68: ; preds = %67, %55
br label %69
69: ; preds = %68, %48
br label %70
70: ; preds = %69, %41
br label %71
71: ; preds = %70, %34
br label %72
72: ; preds = %71, %27
br label %73
73: ; preds = %72, %20
br label %74
74: ; preds = %73
br label %75
75: ; preds = %74, %1
store i32 1, i32* %2
br label %76
76: ; preds = %75, %15
%77 = load i32, i32* %2
ret i32 %77
}

LLVM IR (-O2):
@.str = [3 x i8] c" \0A\00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [5 x i8] c"quit\00"
@.str.3 = [5 x i8] c"look\00"
@.str.4 = [3 x i8] c"go\00"
@.str.5 = [4 x i8] c"get\00"
@.str.6 = [5 x i8] c"drop\00"
@.str.7 = [5 x i8] c"give\00"
@.str.8 = [4 x i8] c"ask\00"
@.str.9 = [10 x i8] c"inventory\00"
@.str.10 = [27 x i8] c"I don't know how to '%s'.\0A\00"
define i32 @parseAndExecute(i8* %0) {
%2 = tail call i8* @strtok(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%3 = tail call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%4 = icmp eq i8* %2, null
br i1 %4, label %45, label %5
5: ; preds = %1
%6 = tail call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%7 = icmp eq i64 %6, 0
br i1 %7, label %45, label %8
8: ; preds = %5
%9 = tail call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %8
%12 = tail call i32 @executeLook(i8* %3)
br label %45
13: ; preds = %8
%14 = tail call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %13
%17 = tail call i32 @executeGo(i8* %3)
br label %45
18: ; preds = %13
%19 = tail call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%20 = icmp eq i64 %19, 0
br i1 %20, label %21, label %23
21: ; preds = %18
%22 = tail call i32 @executeGet(i8* %3)
br label %45
23: ; preds = %18
%24 = tail call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%25 = icmp eq i64 %24, 0
br i1 %25, label %26, label %28
26: ; preds = %23
%27 = tail call i32 @executeDrop(i8* %3)
br label %45
28: ; preds = %23
%29 = tail call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
%30 = icmp eq i64 %29, 0
br i1 %30, label %31, label %33
31: ; preds = %28
%32 = tail call i32 @executeGive(i8* %3)
br label %45
33: ; preds = %28
%34 = tail call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0))
%35 = icmp eq i64 %34, 0
br i1 %35, label %36, label %38
36: ; preds = %33
%37 = tail call i32 @executeAsk(i8* %3)
br label %45
38: ; preds = %33
%39 = tail call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0))
%40 = icmp eq i64 %39, 0
br i1 %40, label %41, label %43
41: ; preds = %38
%42 = tail call i32 (...) @executeInventory()
br label %45
43: ; preds = %38
%44 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.10, i64 0, i64 0), i8* %2)
br label %45
45: ; preds = %1, %11, %21, %31, %41, %43, %36, %26, %16, %5
%46 = phi i32 [ 0, %5 ], [ 1, %16 ], [ 1, %26 ], [ 1, %36 ], [ 1, %43 ], [ 1, %41 ], [ 1, %31 ], [ 1, %21 ], [ 1, %11 ], [ 1, %1 ]
ret i32 %46
}