#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*/ printf(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) {
      printf("It is very dark in here.\n");
    } else if (strcmp(verb, "go") == 0) {
      printf("It's too dark to go anywhere.\n");
    } 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    0xeb9(%rip),%rsi
call   1050 <strtok@plt>
mov    %rax,-0x18(%rbp)
xor    %eax,%eax
mov    %eax,%edi
lea    0xea5(%rip),%rsi
call   1050 <strtok@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1210 <parseAndExecute+0xe0>
mov    -0x18(%rbp),%rdi
lea    0xe89(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1195 <parseAndExecute+0x65>
movl   $0x0,-0x4(%rbp)
jmp    1217 <parseAndExecute+0xe7>
mov    -0x18(%rbp),%rdi
lea    0xe68(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11c2 <parseAndExecute+0x92>
lea    0xe57(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1206 <parseAndExecute+0xd6>
mov    -0x18(%rbp),%rdi
lea    0xe5a(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11ef <parseAndExecute+0xbf>
lea    0xe47(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1201 <parseAndExecute+0xd1>
mov    -0x18(%rbp),%rsi
lea    0xe4f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1206 <parseAndExecute+0xd6>
jmp    120b <parseAndExecute+0xdb>
jmp    1210 <parseAndExecute+0xe0>
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    0xeb4(%rip),%r15
mov    %r15,%rsi
call   1060 <strtok@plt>
mov    %rax,%r14
xor    %ebx,%ebx
xor    %edi,%edi
mov    %r15,%rsi
call   1060 <strtok@plt>
test   %r14,%r14
je     11cc <parseAndExecute+0x8c>
lea    0xe94(%rip),%rsi
mov    %r14,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     11d1 <parseAndExecute+0x91>
lea    0xe85(%rip),%rsi
mov    %r14,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     11b7 <parseAndExecute+0x77>
lea    0xe76(%rip),%rsi
mov    %r14,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     11c0 <parseAndExecute+0x80>
lea    0xe65(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11cc <parseAndExecute+0x8c>
lea    0xe8b(%rip),%rdi
jmp    11c7 <parseAndExecute+0x87>
lea    0xe64(%rip),%rdi
call   1030 <puts@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 = [5 x i8] c"quit\00"
@.str.2 = [5 x i8] c"look\00"
@.str.3 = [26 x i8] c"It is very dark in here.\0A\00"
@.str.4 = [3 x i8] c"go\00"
@.str.5 = [31 x i8] c"It's too dark to go anywhere.\0A\00"
@.str.6 = [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 ([3 x i8], [3 x i8]* @.str, 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 %34
11: ; preds = %1
%12 = load i8*, i8** %4
%13 = call i64 @strcmp(i8* %12, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, 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 %35
16: ; preds = %11
%17 = load i8*, i8** %4
%18 = call i64 @strcmp(i8* %17, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %16
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
br label %32
22: ; preds = %16
%23 = load i8*, i8** %4
%24 = call i64 @strcmp(i8* %23, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%25 = icmp eq i64 %24, 0
br i1 %25, label %26, label %28
26: ; preds = %22
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0))
br label %31
28: ; preds = %22
%29 = load i8*, i8** %4
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0), i8* %29)
br label %31
31: ; preds = %28, %26
br label %32
32: ; preds = %31, %20
br label %33
33: ; preds = %32
br label %34
34: ; preds = %33, %1
store i32 1, i32* %2
br label %35
35: ; preds = %34, %15
%36 = load i32, i32* %2
ret i32 %36
}

LLVM IR (-O2):
@.str = [3 x i8] c" \0A\00"
@.str.1 = [5 x i8] c"quit\00"
@.str.2 = [5 x i8] c"look\00"
@.str.4 = [3 x i8] c"go\00"
@.str.6 = [27 x i8] c"I don't know how to '%s'.\0A\00"
@str = [30 x i8] c"It's too dark to go anywhere.\00"
@str.7 = [25 x i8] c"It is very dark in here.\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 ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i8* %2, null
br i1 %4, label %20, label %5
5: ; preds = %1
%6 = tail call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%7 = icmp eq i64 %6, 0
br i1 %7, label %20, label %8
8: ; preds = %5
%9 = tail call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %8
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.7, i64 0, i64 0))
br label %20
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 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
br label %20
18: ; preds = %13
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0), i8* %2)
br label %20
20: ; preds = %1, %11, %18, %16, %5
%21 = phi i32 [ 0, %5 ], [ 1, %16 ], [ 1, %18 ], [ 1, %11 ], [ 1, %1 ]
ret i32 %21
}