#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*/ cd(int, char **);
int /*<<< orphan*/ echo(int, char **);
int /*<<< orphan*/ execute_External(char **);
int /*<<< orphan*/ export(int, char **);
int /*<<< orphan*/ ls(int, char **);
int /*<<< orphan*/ pwd(int, char **);
int /*<<< orphan*/ strcmp(char *, char *);
int /*<<< orphan*/ whoami(int, char **);
void execute_Command(int argc, char **argv) {
  if (!strcmp(argv[0], "ls"))
    ls(argc, argv);
  else if (!strcmp(argv[0], "cd"))
    cd(argc, argv);
  else if (!strcmp(argv[0], "pwd"))
    pwd(argc, argv);
  else if (!strcmp(argv[0], "echo"))
    echo(argc, argv);
  else if (!strcmp(argv[0], "whoami"))
    whoami(argc, argv);
  else if (!strcmp(argv[0], "export"))
    export(argc, argv);
  else
    execute_External(argv);
}


x86 assembly (clang, -O0):
<execute_Command>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xe63(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%eax
jne    11bc <execute_Command+0x3c>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1070 <ls@plt>
jmp    12bf <execute_Command+0x13f>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xe39(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%eax
jne    11e9 <execute_Command+0x69>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1040 <cd@plt>
jmp    12ba <execute_Command+0x13a>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xe0f(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%eax
jne    1216 <execute_Command+0x96>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1060 <pwd@plt>
jmp    12b5 <execute_Command+0x135>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xde6(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%eax
jne    1243 <execute_Command+0xc3>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <echo@plt>
jmp    12b0 <execute_Command+0x130>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xdbe(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%eax
jne    1270 <execute_Command+0xf0>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1050 <whoami@plt>
jmp    12ab <execute_Command+0x12b>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xd98(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%eax
jne    129d <execute_Command+0x11d>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   10a0 <export@plt>
jmp    12a6 <execute_Command+0x126>
mov    -0x10(%rbp),%rdi
call   1090 <execute_External@plt>
jmp    12ab <execute_Command+0x12b>
jmp    12b0 <execute_Command+0x130>
jmp    12b5 <execute_Command+0x135>
jmp    12ba <execute_Command+0x13a>
jmp    12bf <execute_Command+0x13f>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<execute_Command>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %edi,%r14d
mov    (%rsi),%rbp
lea    0xe6c(%rip),%rsi
mov    %rbp,%rdi
call   1080 <strcmp@plt>
test   %eax,%eax
je     120b <execute_Command+0x8b>
lea    0xe5c(%rip),%rsi
mov    %rbp,%rdi
call   1080 <strcmp@plt>
test   %eax,%eax
je     121a <execute_Command+0x9a>
lea    0xe4c(%rip),%rsi
mov    %rbp,%rdi
call   1080 <strcmp@plt>
test   %eax,%eax
je     1229 <execute_Command+0xa9>
lea    0xe3d(%rip),%rsi
mov    %rbp,%rdi
call   1080 <strcmp@plt>
test   %eax,%eax
je     1238 <execute_Command+0xb8>
lea    0xe2f(%rip),%rsi
mov    %rbp,%rdi
call   1080 <strcmp@plt>
test   %eax,%eax
je     1247 <execute_Command+0xc7>
lea    0xe23(%rip),%rsi
mov    %rbp,%rdi
call   1080 <strcmp@plt>
test   %eax,%eax
je     1256 <execute_Command+0xd6>
mov    %rbx,%rdi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1090 <execute_External@plt>
mov    %r14d,%edi
mov    %rbx,%rsi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1070 <ls@plt>
mov    %r14d,%edi
mov    %rbx,%rsi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <cd@plt>
mov    %r14d,%edi
mov    %rbx,%rsi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1060 <pwd@plt>
mov    %r14d,%edi
mov    %rbx,%rsi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <echo@plt>
mov    %r14d,%edi
mov    %rbx,%rsi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1050 <whoami@plt>
mov    %r14d,%edi
mov    %rbx,%rsi
pop    %rbx
pop    %r14
pop    %rbp
jmp    10a0 <export@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"ls\00"
@.str.1 = [3 x i8] c"cd\00"
@.str.2 = [4 x i8] c"pwd\00"
@.str.3 = [5 x i8] c"echo\00"
@.str.4 = [7 x i8] c"whoami\00"
@.str.5 = [7 x i8] c"export\00"
define void @execute_Command(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = load i8**, i8*** %4
%6 = getelementptr inbounds i8*, i8** %5, i64 0
%7 = load i8*, i8** %6
%8 = call i32 @strcmp(i8* %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%9 = icmp ne i32 %8, 0
br i1 %9, label %14, label %10
10: ; preds = %2
%11 = load i32, i32* %3
%12 = load i8**, i8*** %4
%13 = call i32 @ls(i32 %11, i8** %12)
br label %72
14: ; preds = %2
%15 = load i8**, i8*** %4
%16 = getelementptr inbounds i8*, i8** %15, i64 0
%17 = load i8*, i8** %16
%18 = call i32 @strcmp(i8* %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%19 = icmp ne i32 %18, 0
br i1 %19, label %24, label %20
20: ; preds = %14
%21 = load i32, i32* %3
%22 = load i8**, i8*** %4
%23 = call i32 @cd(i32 %21, i8** %22)
br label %71
24: ; preds = %14
%25 = load i8**, i8*** %4
%26 = getelementptr inbounds i8*, i8** %25, i64 0
%27 = load i8*, i8** %26
%28 = call i32 @strcmp(i8* %27, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%29 = icmp ne i32 %28, 0
br i1 %29, label %34, label %30
30: ; preds = %24
%31 = load i32, i32* %3
%32 = load i8**, i8*** %4
%33 = call i32 @pwd(i32 %31, i8** %32)
br label %70
34: ; preds = %24
%35 = load i8**, i8*** %4
%36 = getelementptr inbounds i8*, i8** %35, i64 0
%37 = load i8*, i8** %36
%38 = call i32 @strcmp(i8* %37, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%39 = icmp ne i32 %38, 0
br i1 %39, label %44, label %40
40: ; preds = %34
%41 = load i32, i32* %3
%42 = load i8**, i8*** %4
%43 = call i32 @echo(i32 %41, i8** %42)
br label %69
44: ; preds = %34
%45 = load i8**, i8*** %4
%46 = getelementptr inbounds i8*, i8** %45, i64 0
%47 = load i8*, i8** %46
%48 = call i32 @strcmp(i8* %47, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%49 = icmp ne i32 %48, 0
br i1 %49, label %54, label %50
50: ; preds = %44
%51 = load i32, i32* %3
%52 = load i8**, i8*** %4
%53 = call i32 @whoami(i32 %51, i8** %52)
br label %68
54: ; preds = %44
%55 = load i8**, i8*** %4
%56 = getelementptr inbounds i8*, i8** %55, i64 0
%57 = load i8*, i8** %56
%58 = call i32 @strcmp(i8* %57, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
%59 = icmp ne i32 %58, 0
br i1 %59, label %64, label %60
60: ; preds = %54
%61 = load i32, i32* %3
%62 = load i8**, i8*** %4
%63 = call i32 @export(i32 %61, i8** %62)
br label %67
64: ; preds = %54
%65 = load i8**, i8*** %4
%66 = call i32 @execute_External(i8** %65)
br label %67
67: ; preds = %64, %60
br label %68
68: ; preds = %67, %50
br label %69
69: ; preds = %68, %40
br label %70
70: ; preds = %69, %30
br label %71
71: ; preds = %70, %20
br label %72
72: ; preds = %71, %10
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"ls\00"
@.str.1 = [3 x i8] c"cd\00"
@.str.2 = [4 x i8] c"pwd\00"
@.str.3 = [5 x i8] c"echo\00"
@.str.4 = [7 x i8] c"whoami\00"
@.str.5 = [7 x i8] c"export\00"
define void @execute_Command(i32 %0, i8** %1) {
%3 = load i8*, i8** %1
%4 = tail call i32 @strcmp(i8* dereferenceable(1) %3, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 @ls(i32 %0, i8** %1)
br label %35
8: ; preds = %2
%9 = tail call i32 @strcmp(i8* dereferenceable(1) %3, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %8
%12 = tail call i32 @cd(i32 %0, i8** %1)
br label %35
13: ; preds = %8
%14 = tail call i32 @strcmp(i8* dereferenceable(1) %3, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %13
%17 = tail call i32 @pwd(i32 %0, i8** %1)
br label %35
18: ; preds = %13
%19 = tail call i32 @strcmp(i8* dereferenceable(1) %3, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %23
21: ; preds = %18
%22 = tail call i32 @echo(i32 %0, i8** %1)
br label %35
23: ; preds = %18
%24 = tail call i32 @strcmp(i8* dereferenceable(1) %3, i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%25 = icmp eq i32 %24, 0
br i1 %25, label %26, label %28
26: ; preds = %23
%27 = tail call i32 @whoami(i32 %0, i8** %1)
br label %35
28: ; preds = %23
%29 = tail call i32 @strcmp(i8* dereferenceable(1) %3, i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
%30 = icmp eq i32 %29, 0
br i1 %30, label %31, label %33
31: ; preds = %28
%32 = tail call i32 @export(i32 %0, i8** %1)
br label %35
33: ; preds = %28
%34 = tail call i32 @execute_External(i8** %1)
br label %35
35: ; preds = %11, %21, %31, %33, %26, %16, %6
ret void
}