#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(char *);
int /*<<< orphan*/ display_history();
int /*<<< orphan*/ exIt(char **, int);
int /*<<< orphan*/ exite();
int /*<<< orphan*/ exprEval(char *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ validateEcho(int, char **);
void executeCommand(int flag, int numParm, char *arr[]) {
  int j = 0;
  switch (flag) {
  case 0:
    break;
  case 1:
    cd(arr[1]);
    break;
  case 2:
    validateEcho(numParm, arr);
    break;
  case 3:
    exprEval(arr[0]);
    break;
  case 4:
    exIt(arr, numParm);
    break;
  case 5:
    exite();
    break;
  case 6:
    perror("There is an error in the Command, The Command doesn't exsist");
    break;
  case 7:
    display_history();
    break;
  }
}


x86 assembly (clang, -O0):
<executeCommand>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x4(%rbp),%eax
mov    %rax,-0x20(%rbp)
sub    $0x7,%rax
ja     121c <executeCommand+0xac>
mov    -0x20(%rbp),%rax
lea    0xe5b(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
jmp    121c <executeCommand+0xac>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <cd@plt>
jmp    121c <executeCommand+0xac>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <validateEcho@plt>
jmp    121c <executeCommand+0xac>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1040 <exprEval@plt>
jmp    121c <executeCommand+0xac>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1090 <exIt@plt>
jmp    121c <executeCommand+0xac>
mov    $0x0,%al
call   1080 <exite@plt>
jmp    121c <executeCommand+0xac>
lea    0xe15(%rip),%rdi
call   1070 <perror@plt>
jmp    121c <executeCommand+0xac>
mov    $0x0,%al
call   1060 <display_history@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<executeCommand>:
add    $0xffffffff,%edi
cmp    $0x6,%edi
ja     1191 <executeCommand+0x21>
lea    0xe81(%rip),%rax
movslq (%rax,%rdi,4),%rcx
add    %rax,%rcx
jmp    *%rcx
mov    0x8(%rdx),%rdi
jmp    1050 <cd@plt>
ret
mov    %esi,%edi
mov    %rdx,%rsi
jmp    1030 <validateEcho@plt>
mov    (%rdx),%rdi
jmp    1040 <exprEval@plt>
mov    %rdx,%rdi
jmp    1090 <exIt@plt>
xor    %eax,%eax
jmp    1080 <exite@plt>
xor    %eax,%eax
jmp    1060 <display_history@plt>
lea    0xe5b(%rip),%rdi
jmp    1070 <perror@plt>

LLVM IR (-O0):
@.str = [61 x i8] c"There is an error in the Command, The Command doesn't exsist\00"
define void @executeCommand(i32 %0, i32 %1, i8** %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i8** %2, i8*** %6
store i32 0, i32* %7
%8 = load i32, i32* %4
switch i32 %8, label %34 [
i32 0, label %9
i32 1, label %10
i32 2, label %15
i32 3, label %19
i32 4, label %24
i32 5, label %28
i32 6, label %30
i32 7, label %32
]
9: ; preds = %3
br label %34
10: ; preds = %3
%11 = load i8**, i8*** %6
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
%14 = call i32 @cd(i8* %13)
br label %34
15: ; preds = %3
%16 = load i32, i32* %5
%17 = load i8**, i8*** %6
%18 = call i32 @validateEcho(i32 %16, i8** %17)
br label %34
19: ; preds = %3
%20 = load i8**, i8*** %6
%21 = getelementptr inbounds i8*, i8** %20, i64 0
%22 = load i8*, i8** %21
%23 = call i32 @exprEval(i8* %22)
br label %34
24: ; preds = %3
%25 = load i8**, i8*** %6
%26 = load i32, i32* %5
%27 = call i32 @exIt(i8** %25, i32 %26)
br label %34
28: ; preds = %3
%29 = call i32 (...) @exite()
br label %34
30: ; preds = %3
%31 = call i32 @perror(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str, i64 0, i64 0))
br label %34
32: ; preds = %3
%33 = call i32 (...) @display_history()
br label %34
34: ; preds = %3, %32, %30, %28, %24, %19, %15, %10, %9
ret void
}

LLVM IR (-O2):
@.str = [61 x i8] c"There is an error in the Command, The Command doesn't exsist\00"
define void @executeCommand(i32 %0, i32 %1, i8** %2) {
switch i32 %0, label %21 [
i32 7, label %19
i32 1, label %4
i32 2, label %8
i32 3, label %10
i32 4, label %13
i32 5, label %15
i32 6, label %17
]
4: ; preds = %3
%5 = getelementptr inbounds i8*, i8** %2, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @cd(i8* %6)
br label %21
8: ; preds = %3
%9 = tail call i32 @validateEcho(i32 %1, i8** %2)
br label %21
10: ; preds = %3
%11 = load i8*, i8** %2
%12 = tail call i32 @exprEval(i8* %11)
br label %21
13: ; preds = %3
%14 = tail call i32 @exIt(i8** %2, i32 %1)
br label %21
15: ; preds = %3
%16 = tail call i32 (...) @exite()
br label %21
17: ; preds = %3
%18 = tail call i32 @perror(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str, i64 0, i64 0))
br label %21
19: ; preds = %3
%20 = tail call i32 (...) @display_history()
br label %21
21: ; preds = %3, %19, %17, %15, %13, %10, %8, %4
ret void
}