#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*/ cat(char *);
int /*<<< orphan*/ cd(char *);
int /*<<< orphan*/ echo(char *);
int ffind(int, char *);
int fget(char *);
int fgettype(int);
int /*<<< orphan*/ fgetwd(char *);
int /*<<< orphan*/ iexec(int);
int /*<<< orphan*/ ireads(char *, int);
int /*<<< orphan*/ ireboot();
int /*<<< orphan*/ iwrites(char *);
int /*<<< orphan*/ ls();
int /*<<< orphan*/ pwd(char *);
int /*<<< orphan*/ scompare(char *, char *);
int /*<<< orphan*/ scopy(char *, char *, int);
int sfindc(char *, char);
int slength(char *);
int main() {
  char buffer[80];
  char verb[80];
  char wd[512];
  int len;
  int prog;
  while (1) {
    fgetwd(wd);
    iwrites(wd);
    iwrites("> ");
    ireads(buffer, 80);
    len = sfindc(buffer, ' ');
    if (len < 0)
      len = slength(buffer);
    scopy(verb, buffer, len);
    if (!scompare(verb, "help")) {
      iwrites("\ncat: print file contents\ncd: change directories\necho: print "
              "a string\nhelp: display this message\nls: list files\npwd: "
              "print current working directory\n\n");
    } else if (!scompare(verb, "ls")) {
      ls();
    } else if (!scompare(verb, "cd")) {
      cd(buffer + len + 1);
    } else if (!scompare(verb, "cat")) {
      cat(buffer + len + 1);
    } else if (!scompare(verb, "echo")) {
      echo(buffer + len + 1);
    } else if (!scompare(verb, "pwd")) {
      pwd(buffer + len + 1);
    } else if (!scompare(verb, "reboot")) {
      ireboot();
    } else if (sfindc(verb, '/') == -1) {
      prog = fget("/bin/");
      if (!prog) {
        iwrites("Error: unable to locate bin directory\n");
        continue;
      }
      prog = ffind(prog, verb);
      if (!prog) {
        iwrites("Error: unrecognized command \"");
        iwrites(verb);
        iwrites("\"\n");
        continue;
      }
      if (fgettype(prog) == 2)
        iexec(prog);
      else {
        iwrites("Error: file is not executable\n");
        continue;
      }
    } else if (prog = fget(verb)) {
      if (fgettype(prog) == 2)
        iexec(prog);
      else {
        iwrites("Error: file is not executable\n");
        continue;
      }
    } else {
      iwrites("Error: executable not found\n");
      continue;
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2c0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x2b0(%rbp),%rdi
call   1110 <fgetwd@plt>
lea    -0x2b0(%rbp),%rdi
call   10c0 <iwrites@plt>
lea    0xdbf(%rip),%rdi
call   10c0 <iwrites@plt>
lea    -0x60(%rbp),%rdi
mov    $0x50,%esi
call   1040 <ireads@plt>
lea    -0x60(%rbp),%rdi
mov    $0x20,%esi
call   10f0 <sfindc@plt>
mov    %eax,-0x2b4(%rbp)
cmpl   $0x0,-0x2b4(%rbp)
jge    1284 <main+0x74>
lea    -0x60(%rbp),%rdi
call   1120 <slength@plt>
mov    %eax,-0x2b4(%rbp)
lea    -0xb0(%rbp),%rdi
lea    -0x60(%rbp),%rsi
mov    -0x2b4(%rbp),%edx
call   1070 <scopy@plt>
lea    -0xb0(%rbp),%rdi
lea    0xd5b(%rip),%rsi
call   1060 <scompare@plt>
cmp    $0x0,%eax
jne    12c7 <main+0xb7>
lea    0xd4b(%rip),%rdi
call   10c0 <iwrites@plt>
jmp    1557 <main+0x347>
lea    -0xb0(%rbp),%rdi
lea    0xdca(%rip),%rsi
call   1060 <scompare@plt>
cmp    $0x0,%eax
jne    12ef <main+0xdf>
mov    $0x0,%al
call   1090 <ls@plt>
jmp    1552 <main+0x342>
lea    -0xb0(%rbp),%rdi
lea    0xda5(%rip),%rsi
call   1060 <scompare@plt>
cmp    $0x0,%eax
jne    1327 <main+0x117>
lea    -0x60(%rbp),%rdi
movslq -0x2b4(%rbp),%rax
add    %rax,%rdi
add    $0x1,%rdi
call   1050 <cd@plt>
jmp    154d <main+0x33d>
lea    -0xb0(%rbp),%rdi
lea    0xd70(%rip),%rsi
call   1060 <scompare@plt>
cmp    $0x0,%eax
jne    135f <main+0x14f>
lea    -0x60(%rbp),%rdi
movslq -0x2b4(%rbp),%rax
add    %rax,%rdi
add    $0x1,%rdi
call   1130 <cat@plt>
jmp    1548 <main+0x338>
lea    -0xb0(%rbp),%rdi
lea    0xd3c(%rip),%rsi
call   1060 <scompare@plt>
cmp    $0x0,%eax
jne    1397 <main+0x187>
lea    -0x60(%rbp),%rdi
movslq -0x2b4(%rbp),%rax
add    %rax,%rdi
add    $0x1,%rdi
call   1030 <echo@plt>
jmp    1543 <main+0x333>
lea    -0xb0(%rbp),%rdi
lea    0xd09(%rip),%rsi
call   1060 <scompare@plt>
cmp    $0x0,%eax
jne    13cf <main+0x1bf>
lea    -0x60(%rbp),%rdi
movslq -0x2b4(%rbp),%rax
add    %rax,%rdi
add    $0x1,%rdi
call   1080 <pwd@plt>
jmp    153e <main+0x32e>
lea    -0xb0(%rbp),%rdi
lea    0xcd5(%rip),%rsi
call   1060 <scompare@plt>
cmp    $0x0,%eax
jne    13f7 <main+0x1e7>
mov    $0x0,%al
call   10d0 <ireboot@plt>
jmp    1539 <main+0x329>
lea    -0xb0(%rbp),%rdi
mov    $0x2f,%esi
call   10f0 <sfindc@plt>
cmp    $0xffffffff,%eax
jne    14c9 <main+0x2b9>
lea    0xca1(%rip),%rdi
call   10a0 <fget@plt>
mov    %eax,-0x2b8(%rbp)
cmpl   $0x0,-0x2b8(%rbp)
jne    1441 <main+0x231>
lea    0xc88(%rip),%rdi
call   10c0 <iwrites@plt>
jmp    1222 <main+0x12>
mov    -0x2b8(%rbp),%edi
lea    -0xb0(%rbp),%rsi
call   1100 <ffind@plt>
mov    %eax,-0x2b8(%rbp)
cmpl   $0x0,-0x2b8(%rbp)
jne    148f <main+0x27f>
lea    0xc79(%rip),%rdi
call   10c0 <iwrites@plt>
lea    -0xb0(%rbp),%rdi
call   10c0 <iwrites@plt>
lea    0xc7f(%rip),%rdi
call   10c0 <iwrites@plt>
jmp    1222 <main+0x12>
mov    -0x2b8(%rbp),%edi
call   10b0 <fgettype@plt>
cmp    $0x2,%eax
jne    14b3 <main+0x2a3>
mov    -0x2b8(%rbp),%edi
call   10e0 <iexec@plt>
jmp    14c4 <main+0x2b4>
lea    0xc4d(%rip),%rdi
call   10c0 <iwrites@plt>
jmp    1222 <main+0x12>
jmp    1534 <main+0x324>
lea    -0xb0(%rbp),%rdi
call   10a0 <fget@plt>
mov    %eax,-0x2b8(%rbp)
cmp    $0x0,%eax
je     151e <main+0x30e>
mov    -0x2b8(%rbp),%edi
call   10b0 <fgettype@plt>
cmp    $0x2,%eax
jne    1508 <main+0x2f8>
mov    -0x2b8(%rbp),%edi
call   10e0 <iexec@plt>
jmp    1519 <main+0x309>
lea    0xbf8(%rip),%rdi
call   10c0 <iwrites@plt>
jmp    1222 <main+0x12>
jmp    152f <main+0x31f>
lea    0xc01(%rip),%rdi
call   10c0 <iwrites@plt>
jmp    1222 <main+0x12>
jmp    1534 <main+0x324>
jmp    1539 <main+0x329>
jmp    153e <main+0x32e>
jmp    1543 <main+0x333>
jmp    1548 <main+0x338>
jmp    154d <main+0x33d>
jmp    1552 <main+0x342>
jmp    1557 <main+0x347>
jmp    1222 <main+0x12>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x2a8,%rsp
lea    0xa0(%rsp),%r15
lea    0xdd0(%rip),%r14
mov    %rsp,%r12
lea    0x50(%rsp),%rbx
lea    0xdc4(%rip),%r13
jmp    125c <main+0x4c>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
lea    0xdb1(%rip),%rdi
call   10c0 <iwrites@plt>
mov    %r15,%rdi
call   1110 <fgetwd@plt>
mov    %r15,%rdi
call   10c0 <iwrites@plt>
mov    %r14,%rdi
call   10c0 <iwrites@plt>
mov    %r12,%rdi
mov    $0x50,%esi
call   1040 <ireads@plt>
mov    %r12,%rdi
mov    $0x20,%esi
call   10f0 <sfindc@plt>
mov    %eax,%ebp
test   %eax,%eax
jns    129e <main+0x8e>
mov    %r12,%rdi
call   1120 <slength@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %ebp,%edx
call   1070 <scopy@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
call   1060 <scompare@plt>
test   %eax,%eax
je     1250 <main+0x40>
mov    %rbx,%rdi
lea    0xddb(%rip),%rsi
call   1060 <scompare@plt>
test   %eax,%eax
je     1380 <main+0x170>
mov    %rbx,%rdi
lea    0xdc7(%rip),%rsi
call   1060 <scompare@plt>
test   %eax,%eax
je     138c <main+0x17c>
mov    %rbx,%rdi
lea    0xdb3(%rip),%rsi
call   1060 <scompare@plt>
test   %eax,%eax
je     13a1 <main+0x191>
mov    %rbx,%rdi
lea    0xda0(%rip),%rsi
call   1060 <scompare@plt>
test   %eax,%eax
je     13b6 <main+0x1a6>
mov    %rbx,%rdi
lea    0xd8e(%rip),%rsi
call   1060 <scompare@plt>
test   %eax,%eax
je     13cb <main+0x1bb>
mov    %rbx,%rdi
lea    0xd7b(%rip),%rsi
call   1060 <scompare@plt>
test   %eax,%eax
je     13e0 <main+0x1d0>
mov    %rbx,%rdi
mov    $0x2f,%esi
call   10f0 <sfindc@plt>
cmp    $0xffffffff,%eax
je     13ec <main+0x1dc>
mov    %rbx,%rdi
call   10a0 <fget@plt>
test   %eax,%eax
jne    140a <main+0x1fa>
lea    0xdb5(%rip),%rdi
call   10c0 <iwrites@plt>
jmp    125c <main+0x4c>
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1090 <ls@plt>
jmp    125c <main+0x4c>
movslq %ebp,%rax
lea    (%rsp,%rax,1),%rdi
add    $0x1,%rdi
call   1050 <cd@plt>
jmp    125c <main+0x4c>
movslq %ebp,%rax
lea    (%rsp,%rax,1),%rdi
add    $0x1,%rdi
call   1130 <cat@plt>
jmp    125c <main+0x4c>
movslq %ebp,%rax
lea    (%rsp,%rax,1),%rdi
add    $0x1,%rdi
call   1030 <echo@plt>
jmp    125c <main+0x4c>
movslq %ebp,%rax
lea    (%rsp,%rax,1),%rdi
add    $0x1,%rdi
call   1080 <pwd@plt>
jmp    125c <main+0x4c>
xor    %eax,%eax
call   10d0 <ireboot@plt>
jmp    125c <main+0x4c>
lea    0xcc6(%rip),%rdi
call   10a0 <fget@plt>
test   %eax,%eax
je     1435 <main+0x225>
mov    %eax,%edi
mov    %rbx,%rsi
call   1100 <ffind@plt>
test   %eax,%eax
je     1446 <main+0x236>
mov    %eax,%ebp
mov    %eax,%edi
call   10b0 <fgettype@plt>
cmp    $0x2,%eax
jne    1424 <main+0x214>
mov    %ebp,%edi
call   10e0 <iexec@plt>
jmp    125c <main+0x4c>
lea    0xcdc(%rip),%rdi
call   10c0 <iwrites@plt>
jmp    125c <main+0x4c>
lea    0xc83(%rip),%rdi
call   10c0 <iwrites@plt>
jmp    125c <main+0x4c>
lea    0xc99(%rip),%rdi
call   10c0 <iwrites@plt>
mov    %rbx,%rdi
call   10c0 <iwrites@plt>
lea    0xca3(%rip),%rdi
call   10c0 <iwrites@plt>
jmp    125c <main+0x4c>

LLVM IR (-O0):
@.str = [3 x i8] c"> \00"
@.str.1 = [5 x i8] c"help\00"
@.str.2 = [151 x i8] c"\0Acat: print file contents\0Acd: change directories\0Aecho: print a string\0Ahelp: display this message\0Als: list files\0Apwd: print current working directory\0A\0A\00"
@.str.3 = [3 x i8] c"ls\00"
@.str.4 = [3 x i8] c"cd\00"
@.str.5 = [4 x i8] c"cat\00"
@.str.6 = [5 x i8] c"echo\00"
@.str.7 = [4 x i8] c"pwd\00"
@.str.8 = [7 x i8] c"reboot\00"
@.str.9 = [6 x i8] c"/bin/\00"
@.str.10 = [39 x i8] c"Error: unable to locate bin directory\0A\00"
@.str.11 = [30 x i8] c"Error: unrecognized command \22\00"
@.str.12 = [3 x i8] c"\22\0A\00"
@.str.13 = [31 x i8] c"Error: file is not executable\0A\00"
@.str.14 = [29 x i8] c"Error: executable not found\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [80 x i8]
%3 = alloca [80 x i8]
%4 = alloca [512 x i8]
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
br label %7
7: ; preds = %0, %96, %104, %116, %130, %133, %143
%8 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 0
%9 = call i32 @fgetwd(i8* %8)
%10 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 0
%11 = call i32 @iwrites(i8* %10)
%12 = call i32 @iwrites(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%13 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%14 = call i32 @ireads(i8* %13, i32 80)
%15 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%16 = call i32 @sfindc(i8* %15, i8 signext 32)
store i32 %16, i32* %5
%17 = load i32, i32* %5
%18 = icmp slt i32 %17, 0
br i1 %18, label %19, label %22
19: ; preds = %7
%20 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%21 = call i32 @slength(i8* %20)
store i32 %21, i32* %5
br label %22
22: ; preds = %19, %7
%23 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%24 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%25 = load i32, i32* %5
%26 = call i32 @scopy(i8* %23, i8* %24, i32 %25)
%27 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%28 = call i32 @scompare(i8* %27, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%29 = icmp ne i32 %28, 0
br i1 %29, label %32, label %30
30: ; preds = %22
%31 = call i32 @iwrites(i8* getelementptr inbounds ([151 x i8], [151 x i8]* @.str.2, i64 0, i64 0))
br label %143
32: ; preds = %22
%33 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%34 = call i32 @scompare(i8* %33, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%35 = icmp ne i32 %34, 0
br i1 %35, label %38, label %36
36: ; preds = %32
%37 = call i32 (...) @ls()
br label %142
38: ; preds = %32
%39 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%40 = call i32 @scompare(i8* %39, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%41 = icmp ne i32 %40, 0
br i1 %41, label %49, label %42
42: ; preds = %38
%43 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%44 = load i32, i32* %5
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds i8, i8* %43, i64 %45
%47 = getelementptr inbounds i8, i8* %46, i64 1
%48 = call i32 @cd(i8* %47)
br label %141
49: ; preds = %38
%50 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%51 = call i32 @scompare(i8* %50, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%52 = icmp ne i32 %51, 0
br i1 %52, label %60, label %53
53: ; preds = %49
%54 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%55 = load i32, i32* %5
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds i8, i8* %54, i64 %56
%58 = getelementptr inbounds i8, i8* %57, i64 1
%59 = call i32 @cat(i8* %58)
br label %140
60: ; preds = %49
%61 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%62 = call i32 @scompare(i8* %61, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%63 = icmp ne i32 %62, 0
br i1 %63, label %71, label %64
64: ; preds = %60
%65 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%66 = load i32, i32* %5
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds i8, i8* %65, i64 %67
%69 = getelementptr inbounds i8, i8* %68, i64 1
%70 = call i32 @echo(i8* %69)
br label %139
71: ; preds = %60
%72 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%73 = call i32 @scompare(i8* %72, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
%74 = icmp ne i32 %73, 0
br i1 %74, label %82, label %75
75: ; preds = %71
%76 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%77 = load i32, i32* %5
%78 = sext i32 %77 to i64
%79 = getelementptr inbounds i8, i8* %76, i64 %78
%80 = getelementptr inbounds i8, i8* %79, i64 1
%81 = call i32 @pwd(i8* %80)
br label %138
82: ; preds = %71
%83 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%84 = call i32 @scompare(i8* %83, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0))
%85 = icmp ne i32 %84, 0
br i1 %85, label %88, label %86
86: ; preds = %82
%87 = call i32 (...) @ireboot()
br label %137
88: ; preds = %82
%89 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%90 = call i32 @sfindc(i8* %89, i8 signext 47)
%91 = icmp eq i32 %90, -1
br i1 %91, label %92, label %119
92: ; preds = %88
%93 = call i32 @fget(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0))
store i32 %93, i32* %6
%94 = load i32, i32* %6
%95 = icmp ne i32 %94, 0
br i1 %95, label %98, label %96
96: ; preds = %92
%97 = call i32 @iwrites(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.10, i64 0, i64 0))
br label %7
98: ; preds = %92
%99 = load i32, i32* %6
%100 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%101 = call i32 @ffind(i32 %99, i8* %100)
store i32 %101, i32* %6
%102 = load i32, i32* %6
%103 = icmp ne i32 %102, 0
br i1 %103, label %109, label %104
104: ; preds = %98
%105 = call i32 @iwrites(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.11, i64 0, i64 0))
%106 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%107 = call i32 @iwrites(i8* %106)
%108 = call i32 @iwrites(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.12, i64 0, i64 0))
br label %7
109: ; preds = %98
%110 = load i32, i32* %6
%111 = call i32 @fgettype(i32 %110)
%112 = icmp eq i32 %111, 2
br i1 %112, label %113, label %116
113: ; preds = %109
%114 = load i32, i32* %6
%115 = call i32 @iexec(i32 %114)
br label %118
116: ; preds = %109
%117 = call i32 @iwrites(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.13, i64 0, i64 0))
br label %7
118: ; preds = %113
br label %136
119: ; preds = %88
%120 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%121 = call i32 @fget(i8* %120)
store i32 %121, i32* %6
%122 = icmp ne i32 %121, 0
br i1 %122, label %123, label %133
123: ; preds = %119
%124 = load i32, i32* %6
%125 = call i32 @fgettype(i32 %124)
%126 = icmp eq i32 %125, 2
br i1 %126, label %127, label %130
127: ; preds = %123
%128 = load i32, i32* %6
%129 = call i32 @iexec(i32 %128)
br label %132
130: ; preds = %123
%131 = call i32 @iwrites(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.13, i64 0, i64 0))
br label %7
132: ; preds = %127
br label %135
133: ; preds = %119
%134 = call i32 @iwrites(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.14, i64 0, i64 0))
br label %7
135: ; preds = %132
br label %136
136: ; preds = %135, %118
br label %137
137: ; preds = %136, %86
br label %138
138: ; preds = %137, %75
br label %139
139: ; preds = %138, %64
br label %140
140: ; preds = %139, %53
br label %141
141: ; preds = %140, %42
br label %142
142: ; preds = %141, %36
br label %143
143: ; preds = %142, %30
br label %7
}

LLVM IR (-O2):
@.str = [3 x i8] c"> \00"
@.str.1 = [5 x i8] c"help\00"
@.str.2 = [151 x i8] c"\0Acat: print file contents\0Acd: change directories\0Aecho: print a string\0Ahelp: display this message\0Als: list files\0Apwd: print current working directory\0A\0A\00"
@.str.3 = [3 x i8] c"ls\00"
@.str.4 = [3 x i8] c"cd\00"
@.str.5 = [4 x i8] c"cat\00"
@.str.6 = [5 x i8] c"echo\00"
@.str.7 = [4 x i8] c"pwd\00"
@.str.8 = [7 x i8] c"reboot\00"
@.str.9 = [6 x i8] c"/bin/\00"
@.str.10 = [39 x i8] c"Error: unable to locate bin directory\0A\00"
@.str.11 = [30 x i8] c"Error: unrecognized command \22\00"
@.str.12 = [3 x i8] c"\22\0A\00"
@.str.13 = [31 x i8] c"Error: file is not executable\0A\00"
@.str.14 = [29 x i8] c"Error: executable not found\0A\00"
define i32 @main() {
%1 = alloca [80 x i8]
%2 = alloca [80 x i8]
%3 = alloca [512 x i8]
%4 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%5 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
br label %7
7: ; preds = %23, %0
%8 = call i32 @fgetwd(i8* %6)
%9 = call i32 @iwrites(i8* %6)
%10 = call i32 @iwrites(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @ireads(i8* %4, i32 80)
%12 = call i32 @sfindc(i8* %4, i8 signext 32)
%13 = icmp slt i32 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %7
%15 = call i32 @slength(i8* %4)
br label %16
16: ; preds = %14, %7
%17 = phi i32 [ %15, %14 ], [ %12, %7 ]
%18 = call i32 @scopy(i8* %5, i8* %4, i32 %17)
%19 = call i32 @scompare(i8* %5, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %24
21: ; preds = %16
%22 = call i32 @iwrites(i8* getelementptr inbounds ([151 x i8], [151 x i8]* @.str.2, i64 0, i64 0))
br label %23
23: ; preds = %21, %32, %48, %64, %94, %84, %56, %40, %27, %72, %77, %86, %96, %98
br label %7
24: ; preds = %16
%25 = call i32 @scompare(i8* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%26 = icmp eq i32 %25, 0
br i1 %26, label %27, label %29
27: ; preds = %24
%28 = call i32 (...) @ls()
br label %23
29: ; preds = %24
%30 = call i32 @scompare(i8* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%31 = icmp eq i32 %30, 0
br i1 %31, label %32, label %37
32: ; preds = %29
%33 = sext i32 %17 to i64
%34 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 %33
%35 = getelementptr inbounds i8, i8* %34, i64 1
%36 = call i32 @cd(i8* %35)
br label %23
37: ; preds = %29
%38 = call i32 @scompare(i8* %5, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%39 = icmp eq i32 %38, 0
br i1 %39, label %40, label %45
40: ; preds = %37
%41 = sext i32 %17 to i64
%42 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 %41
%43 = getelementptr inbounds i8, i8* %42, i64 1
%44 = call i32 @cat(i8* %43)
br label %23
45: ; preds = %37
%46 = call i32 @scompare(i8* %5, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%47 = icmp eq i32 %46, 0
br i1 %47, label %48, label %53
48: ; preds = %45
%49 = sext i32 %17 to i64
%50 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 %49
%51 = getelementptr inbounds i8, i8* %50, i64 1
%52 = call i32 @echo(i8* %51)
br label %23
53: ; preds = %45
%54 = call i32 @scompare(i8* %5, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
%55 = icmp eq i32 %54, 0
br i1 %55, label %56, label %61
56: ; preds = %53
%57 = sext i32 %17 to i64
%58 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 %57
%59 = getelementptr inbounds i8, i8* %58, i64 1
%60 = call i32 @pwd(i8* %59)
br label %23
61: ; preds = %53
%62 = call i32 @scompare(i8* %5, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0))
%63 = icmp eq i32 %62, 0
br i1 %63, label %64, label %66
64: ; preds = %61
%65 = call i32 (...) @ireboot()
br label %23
66: ; preds = %61
%67 = call i32 @sfindc(i8* %5, i8 signext 47)
%68 = icmp eq i32 %67, -1
br i1 %68, label %69, label %88
69: ; preds = %66
%70 = call i32 @fget(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0))
%71 = icmp eq i32 %70, 0
br i1 %71, label %72, label %74
72: ; preds = %69
%73 = call i32 @iwrites(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.10, i64 0, i64 0))
br label %23
74: ; preds = %69
%75 = call i32 @ffind(i32 %70, i8* %5)
%76 = icmp eq i32 %75, 0
br i1 %76, label %77, label %81
77: ; preds = %74
%78 = call i32 @iwrites(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.11, i64 0, i64 0))
%79 = call i32 @iwrites(i8* %5)
%80 = call i32 @iwrites(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.12, i64 0, i64 0))
br label %23
81: ; preds = %74
%82 = call i32 @fgettype(i32 %75)
%83 = icmp eq i32 %82, 2
br i1 %83, label %84, label %86
84: ; preds = %81
%85 = call i32 @iexec(i32 %75)
br label %23
86: ; preds = %81
%87 = call i32 @iwrites(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.13, i64 0, i64 0))
br label %23
88: ; preds = %66
%89 = call i32 @fget(i8* %5)
%90 = icmp eq i32 %89, 0
br i1 %90, label %98, label %91
91: ; preds = %88
%92 = call i32 @fgettype(i32 %89)
%93 = icmp eq i32 %92, 2
br i1 %93, label %94, label %96
94: ; preds = %91
%95 = call i32 @iexec(i32 %89)
br label %23
96: ; preds = %91
%97 = call i32 @iwrites(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.13, i64 0, i64 0))
br label %23
98: ; preds = %88
%99 = call i32 @iwrites(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.14, i64 0, i64 0))
br label %23
}