#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*/ cardinal(int, char **);
int /*<<< orphan*/ look(int, char **);
scalar_t__ strcmp(char const *, char *);
int /*<<< orphan*/ teleport(int, char **);
int navigate(const char *c, int argc, char *argv[]) {
  if ((strcmp((c), ("look")) == 0)) {
    look(argc, argv);
    return 1;
  }
  if ((strcmp((c), ("teleport")) == 0) || (strcmp((c), ("cd")) == 0)) {
    teleport(argc, argv);
    return 1;
  }
  if ((strcmp((c), ("north")) == 0) || (strcmp((c), ("south")) == 0) ||
      (strcmp((c), ("east")) == 0) || (strcmp((c), ("west")) == 0) ||
      (strcmp((c), ("up")) == 0) || (strcmp((c), ("down")) == 0)) {
    cardinal(argc, argv);
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<navigate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xea2(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1185 <navigate+0x45>
mov    -0x14(%rbp),%edi
mov    -0x20(%rbp),%rsi
call   1050 <look@plt>
movl   $0x1,-0x4(%rbp)
jmp    128c <navigate+0x14c>
mov    -0x10(%rbp),%rdi
lea    0xe75(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     11b9 <navigate+0x79>
mov    -0x10(%rbp),%rdi
lea    0xe64(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11d1 <navigate+0x91>
mov    -0x14(%rbp),%edi
mov    -0x20(%rbp),%rsi
call   1060 <teleport@plt>
movl   $0x1,-0x4(%rbp)
jmp    128c <navigate+0x14c>
mov    -0x10(%rbp),%rdi
lea    0xe35(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     126d <navigate+0x12d>
mov    -0x10(%rbp),%rdi
lea    0xe21(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     126d <navigate+0x12d>
mov    -0x10(%rbp),%rdi
lea    0xe0d(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     126d <navigate+0x12d>
mov    -0x10(%rbp),%rdi
lea    0xdf8(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     126d <navigate+0x12d>
mov    -0x10(%rbp),%rdi
lea    0xde3(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     126d <navigate+0x12d>
mov    -0x10(%rbp),%rdi
lea    0xdcc(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1285 <navigate+0x145>
mov    -0x14(%rbp),%edi
mov    -0x20(%rbp),%rsi
call   1030 <cardinal@plt>
movl   $0x1,-0x4(%rbp)
jmp    128c <navigate+0x14c>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<navigate>:
push   %rbp
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %esi,%ebp
mov    %rdi,%rbx
lea    0xead(%rip),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     1226 <navigate+0xe6>
lea    0xe9d(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     121a <navigate+0xda>
lea    0xe8e(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     121a <navigate+0xda>
lea    0xe79(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     120e <navigate+0xce>
lea    0xe6b(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     120e <navigate+0xce>
lea    0xe5d(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     120e <navigate+0xce>
lea    0xe4e(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     120e <navigate+0xce>
lea    0xe3f(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     120e <navigate+0xce>
lea    0xe2e(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
jne    1235 <navigate+0xf5>
mov    %ebp,%edi
mov    %r14,%rsi
call   1030 <cardinal@plt>
jmp    1230 <navigate+0xf0>
mov    %ebp,%edi
mov    %r14,%rsi
call   1060 <teleport@plt>
jmp    1230 <navigate+0xf0>
mov    %ebp,%edi
mov    %r14,%rsi
call   1050 <look@plt>
mov    $0x1,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"look\00"
@.str.1 = [9 x i8] c"teleport\00"
@.str.2 = [3 x i8] c"cd\00"
@.str.3 = [6 x i8] c"north\00"
@.str.4 = [6 x i8] c"south\00"
@.str.5 = [5 x i8] c"east\00"
@.str.6 = [5 x i8] c"west\00"
@.str.7 = [3 x i8] c"up\00"
@.str.8 = [5 x i8] c"down\00"
define i32 @navigate(i8* %0, i32 %1, i8** %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8**
store i8* %0, i8** %5
store i32 %1, i32* %6
store i8** %2, i8*** %7
%8 = load i8*, i8** %5
%9 = call i64 @strcmp(i8* %8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %15
11: ; preds = %3
%12 = load i32, i32* %6
%13 = load i8**, i8*** %7
%14 = call i32 @look(i32 %12, i8** %13)
store i32 1, i32* %4
br label %56
15: ; preds = %3
%16 = load i8*, i8** %5
%17 = call i64 @strcmp(i8* %16, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
br i1 %18, label %23, label %19
19: ; preds = %15
%20 = load i8*, i8** %5
%21 = call i64 @strcmp(i8* %20, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%22 = icmp eq i64 %21, 0
br i1 %22, label %23, label %27
23: ; preds = %19, %15
%24 = load i32, i32* %6
%25 = load i8**, i8*** %7
%26 = call i32 @teleport(i32 %24, i8** %25)
store i32 1, i32* %4
br label %56
27: ; preds = %19
%28 = load i8*, i8** %5
%29 = call i64 @strcmp(i8* %28, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%30 = icmp eq i64 %29, 0
br i1 %30, label %51, label %31
31: ; preds = %27
%32 = load i8*, i8** %5
%33 = call i64 @strcmp(i8* %32, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%34 = icmp eq i64 %33, 0
br i1 %34, label %51, label %35
35: ; preds = %31
%36 = load i8*, i8** %5
%37 = call i64 @strcmp(i8* %36, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%38 = icmp eq i64 %37, 0
br i1 %38, label %51, label %39
39: ; preds = %35
%40 = load i8*, i8** %5
%41 = call i64 @strcmp(i8* %40, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%42 = icmp eq i64 %41, 0
br i1 %42, label %51, label %43
43: ; preds = %39
%44 = load i8*, i8** %5
%45 = call i64 @strcmp(i8* %44, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
%46 = icmp eq i64 %45, 0
br i1 %46, label %51, label %47
47: ; preds = %43
%48 = load i8*, i8** %5
%49 = call i64 @strcmp(i8* %48, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
%50 = icmp eq i64 %49, 0
br i1 %50, label %51, label %55
51: ; preds = %47, %43, %39, %35, %31, %27
%52 = load i32, i32* %6
%53 = load i8**, i8*** %7
%54 = call i32 @cardinal(i32 %52, i8** %53)
store i32 1, i32* %4
br label %56
55: ; preds = %47
store i32 0, i32* %4
br label %56
56: ; preds = %55, %51, %23, %11
%57 = load i32, i32* %4
ret i32 %57
}

LLVM IR (-O2):
@.str = [5 x i8] c"look\00"
@.str.1 = [9 x i8] c"teleport\00"
@.str.2 = [3 x i8] c"cd\00"
@.str.3 = [6 x i8] c"north\00"
@.str.4 = [6 x i8] c"south\00"
@.str.5 = [5 x i8] c"east\00"
@.str.6 = [5 x i8] c"west\00"
@.str.7 = [3 x i8] c"up\00"
@.str.8 = [5 x i8] c"down\00"
define i32 @navigate(i8* %0, i32 %1, i8** %2) {
%4 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = tail call i32 @look(i32 %1, i8** %2)
br label %36
8: ; preds = %3
%9 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%10 = icmp eq i64 %9, 0
br i1 %10, label %14, label %11
11: ; preds = %8
%12 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %11, %8
%15 = tail call i32 @teleport(i32 %1, i8** %2)
br label %36
16: ; preds = %11
%17 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
br i1 %18, label %34, label %19
19: ; preds = %16
%20 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%21 = icmp eq i64 %20, 0
br i1 %21, label %34, label %22
22: ; preds = %19
%23 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%24 = icmp eq i64 %23, 0
br i1 %24, label %34, label %25
25: ; preds = %22
%26 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%27 = icmp eq i64 %26, 0
br i1 %27, label %34, label %28
28: ; preds = %25
%29 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
%30 = icmp eq i64 %29, 0
br i1 %30, label %34, label %31
31: ; preds = %28
%32 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
%33 = icmp eq i64 %32, 0
br i1 %33, label %34, label %36
34: ; preds = %31, %28, %25, %22, %19, %16
%35 = tail call i32 @cardinal(i32 %1, i8** %2)
br label %36
36: ; preds = %31, %34, %14, %6
%37 = phi i32 [ 1, %6 ], [ 1, %14 ], [ 1, %34 ], [ 0, %31 ]
ret i32 %37
}