#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 EXIT_SUCCESS;
int /*<<< orphan*/ clear();
int /*<<< orphan*/ execute(char *);
int /*<<< orphan*/ execute_shell(int /*<<< orphan*/, int /*<<< orphan*/ *,
                                 int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
char *getenv(char *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ putenv(char *);
int /*<<< orphan*/ retrieve_full_path(char *, char *);
int /*<<< orphan*/ setenv(char *, char *, int);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
int main(int argc, char *argv[]) {
  char buffer[1024] = {0};
  char pwd[64] = {0};
  char command[1024] = {0};
  char arg[1024] = {0};
  char path[64 * 1000];
  int len;
  char shell_path[64] = "shell=";
  char readme_path[64] = "readme_path=";
  strcpy(path, getenv("PATH"));
  strcat(path, ":");
  if (argv[0] == "./myshell" && argv[0] == "myshell") {
    len = strlen(argv[0]);
    while (len && argv[0][len] != '/')
      len--;
    argv[0][len] = '\0';
    strcpy(pwd, argv[0]);
    retrieve_full_path(pwd, argv[0]);
    printf("%s\n", pwd);
  } else
    strcpy(pwd, getenv("PWD"));
  strcat(path, pwd);
  setenv("PATH", path, 1);
  strcat(shell_path, "/myshell");
  putenv(shell_path);
  strcat(readme_path, pwd);
  strcat(readme_path, "/README.md");
  putenv(readme_path);
  if (argc > 1) {
    strcpy(buffer, "myshell ");
    for (int i = 1; i < argc; i++) {
      strcat(buffer, argv[i]);
      strcat(buffer, "  ");
    }
    execute(buffer);
  } else {
    clear();
    fprintf(stderr,
            "                   Welcome to MyShell                     \n");
    fprintf(stderr, "               Type 'help' to get started! \n");
    fprintf(stderr,
            "------------------------------------------------------------\n");
    execute_shell(stdin, NULL, NULL);
  }
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10700,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x410(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1080 <memset@plt>
lea    -0x450(%rbp),%rdi
xor    %esi,%esi
mov    $0x40,%edx
call   1080 <memset@plt>
lea    -0x850(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1080 <memset@plt>
lea    -0xc50(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1080 <memset@plt>
lea    -0x106a0(%rbp),%rdi
xor    %esi,%esi
mov    $0x40,%edx
call   1080 <memset@plt>
movb   $0x73,-0x106a0(%rbp)
movb   $0x68,-0x1069f(%rbp)
movb   $0x65,-0x1069e(%rbp)
movb   $0x6c,-0x1069d(%rbp)
movb   $0x6c,-0x1069c(%rbp)
movb   $0x3d,-0x1069b(%rbp)
lea    -0x106e0(%rbp),%rdi
lea    0xd70(%rip),%rsi
mov    $0x40,%edx
call   10d0 <memcpy@plt>
lea    -0x10650(%rbp),%rax
mov    %rax,-0x106f0(%rbp)
lea    0xd91(%rip),%rdi
call   1030 <getenv@plt>
mov    -0x106f0(%rbp),%rdi
mov    %rax,%rsi
call   1040 <strcpy@plt>
lea    -0x10650(%rbp),%rdi
lea    0xd74(%rip),%rsi
call   10e0 <strcat@plt>
mov    -0x10(%rbp),%rax
lea    0xd66(%rip),%rcx
cmp    %rcx,(%rax)
jne    13ba <main+0x1da>
mov    -0x10(%rbp),%rax
lea    0xd54(%rip),%rcx
cmp    %rcx,(%rax)
jne    13ba <main+0x1da>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1060 <strlen@plt>
mov    %eax,-0x10654(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x10654(%rbp)
mov    %al,-0x106f1(%rbp)
je     1343 <main+0x163>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movslq -0x10654(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2f,%eax
setne  %al
mov    %al,-0x106f1(%rbp)
mov    -0x106f1(%rbp),%al
test   $0x1,%al
jne    1356 <main+0x176>
jmp    136a <main+0x18a>
mov    -0x10654(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10654(%rbp)
jmp    1310 <main+0x130>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movslq -0x10654(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
lea    -0x450(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
call   1040 <strcpy@plt>
lea    -0x450(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
call   10a0 <retrieve_full_path@plt>
lea    -0x450(%rbp),%rsi
lea    0xca1(%rip),%rdi
call   1070 <printf@plt>
jmp    13e3 <main+0x203>
lea    -0x450(%rbp),%rax
mov    %rax,-0x10700(%rbp)
lea    0xc86(%rip),%rdi
call   1030 <getenv@plt>
mov    -0x10700(%rbp),%rdi
mov    %rax,%rsi
call   1040 <strcpy@plt>
lea    -0x10650(%rbp),%rdi
lea    -0x450(%rbp),%rsi
call   10e0 <strcat@plt>
lea    -0x10650(%rbp),%rsi
lea    0xc3c(%rip),%rdi
mov    $0x1,%edx
call   1050 <setenv@plt>
lea    -0x106a0(%rbp),%rdi
lea    0xc2c(%rip),%rsi
call   10e0 <strcat@plt>
lea    -0x106a0(%rbp),%rdi
call   10b0 <putenv@plt>
lea    -0x106e0(%rbp),%rdi
lea    -0x450(%rbp),%rsi
call   10e0 <strcat@plt>
lea    -0x106e0(%rbp),%rdi
lea    0xc0b(%rip),%rsi
call   10e0 <strcat@plt>
lea    -0x106e0(%rbp),%rdi
call   10b0 <putenv@plt>
cmpl   $0x1,-0x8(%rbp)
jle    14e8 <main+0x308>
lea    -0x410(%rbp),%rdi
lea    0xbed(%rip),%rsi
call   1040 <strcpy@plt>
movl   $0x1,-0x106e4(%rbp)
mov    -0x106e4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    14d7 <main+0x2f7>
lea    -0x410(%rbp),%rdi
mov    -0x10(%rbp),%rax
movslq -0x106e4(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
call   10e0 <strcat@plt>
lea    -0x410(%rbp),%rdi
lea    0xbaf(%rip),%rsi
call   10e0 <strcat@plt>
mov    -0x106e4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x106e4(%rbp)
jmp    1486 <main+0x2a6>
lea    -0x410(%rbp),%rdi
call   1090 <execute@plt>
jmp    1543 <main+0x363>
mov    $0x0,%al
call   10f0 <clear@plt>
mov    0x2ae2(%rip),%rax
mov    (%rax),%edi
lea    0xb71(%rip),%rsi
call   10c0 <fprintf@plt>
mov    0x2acd(%rip),%rax
mov    (%rax),%edi
lea    0xb98(%rip),%rsi
call   10c0 <fprintf@plt>
mov    0x2ab8(%rip),%rax
mov    (%rax),%edi
lea    0xbb0(%rip),%rsi
call   10c0 <fprintf@plt>
mov    0x2ab3(%rip),%rax
mov    (%rax),%edi
xor    %eax,%eax
mov    %eax,%edx
mov    %rdx,%rsi
call   1100 <execute_shell@plt>
mov    0x2a86(%rip),%rax
mov    (%rax),%eax
add    $0x10700,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0xfec0,%rsp
mov    %rsi,%r15
mov    %edi,%r14d
lea    0xc0(%rsp),%rdi
mov    $0x400,%edx
xor    %esi,%esi
call   1080 <memset@plt>
xorps  %xmm0,%xmm0
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movl   $0x6c656873,(%rsp)
movw   $0x3d6c,0x4(%rsp)
movaps 0xdf8(%rip),%xmm0
movaps %xmm0,0xb0(%rsp)
movaps 0xdd9(%rip),%xmm0
movaps %xmm0,0xa0(%rsp)
movaps 0xdba(%rip),%xmm0
movaps %xmm0,0x90(%rsp)
movaps 0xd9b(%rip),%xmm0
movaps %xmm0,0x80(%rsp)
lea    0xdcc(%rip),%rdi
call   1030 <getenv@plt>
lea    0x4c0(%rsp),%rbx
mov    %rbx,%rdi
mov    %rax,%rsi
call   1040 <strcpy@plt>
lea    0xdb2(%rip),%rsi
mov    %rbx,%rdi
call   10d0 <strcat@plt>
lea    0xda5(%rip),%rax
cmp    %rax,(%r15)
jne    1312 <main+0x142>
lea    0xd9b(%rip),%rcx
cmp    %rcx,%rax
jne    1312 <main+0x142>
lea    0xd8f(%rip),%rdi
call   1060 <strlen@plt>
mov    (%r15),%rcx
test   %eax,%eax
je     12de <main+0x10e>
cltq
nopl   0x0(%rax,%rax,1)
cmpb   $0x2f,(%rcx,%rax,1)
je     12e0 <main+0x110>
add    $0xffffffffffffffff,%rax
test   %eax,%eax
jne    12d0 <main+0x100>
xor    %eax,%eax
cltq
movb   $0x0,(%rcx,%rax,1)
mov    (%r15),%rsi
lea    0x40(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <strcpy@plt>
mov    (%r15),%rsi
mov    %rbx,%rdi
call   10a0 <retrieve_full_path@plt>
lea    0xd49(%rip),%rdi
mov    %rbx,%rsi
call   1070 <printf@plt>
jmp    132b <main+0x15b>
lea    0xd3c(%rip),%rdi
call   1030 <getenv@plt>
lea    0x40(%rsp),%rdi
mov    %rax,%rsi
call   1040 <strcpy@plt>
lea    0x4c0(%rsp),%rbx
lea    0x40(%rsp),%rbp
mov    %rbx,%rdi
mov    %rbp,%rsi
call   10d0 <strcat@plt>
lea    0xcf6(%rip),%rdi
mov    %rbx,%rsi
mov    $0x1,%edx
call   1050 <setenv@plt>
lea    0xcea(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   10d0 <strcat@plt>
mov    %rbx,%rdi
call   10b0 <putenv@plt>
lea    0x80(%rsp),%rbx
mov    %rbx,%rdi
mov    %rbp,%rsi
call   10d0 <strcat@plt>
lea    0xcce(%rip),%rsi
mov    %rbx,%rdi
call   10d0 <strcat@plt>
mov    %rbx,%rdi
call   10b0 <putenv@plt>
cmp    $0x2,%r14d
jl     13ff <main+0x22f>
lea    0xcbc(%rip),%rsi
lea    0xc0(%rsp),%r12
mov    %r12,%rdi
call   1040 <strcpy@plt>
mov    %r14d,%ebx
mov    $0x1,%ebp
lea    0xca6(%rip),%r14
nopw   0x0(%rax,%rax,1)
mov    (%r15,%rbp,8),%rsi
mov    %r12,%rdi
call   10d0 <strcat@plt>
mov    %r12,%rdi
mov    %r14,%rsi
call   10d0 <strcat@plt>
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    13d0 <main+0x200>
lea    0xc0(%rsp),%rdi
call   1090 <execute@plt>
jmp    1449 <main+0x279>
xor    %eax,%eax
call   10e0 <clear@plt>
mov    0x2bcb(%rip),%rbx
mov    (%rbx),%edi
lea    0xc5a(%rip),%rsi
call   10c0 <fprintf@plt>
mov    (%rbx),%edi
lea    0xc88(%rip),%rsi
call   10c0 <fprintf@plt>
mov    (%rbx),%edi
lea    0xca7(%rip),%rsi
call   10c0 <fprintf@plt>
mov    0x2baa(%rip),%rax
mov    (%rax),%edi
xor    %esi,%esi
xor    %edx,%edx
call   10f0 <execute_shell@plt>
mov    0x2b80(%rip),%rax
mov    (%rax),%eax
add    $0xfec0,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.readme_path = [64 x i8] c"readme_path=\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@.str = [5 x i8] c"PATH\00"
@.str.1 = [2 x i8] c":\00"
@.str.2 = [10 x i8] c"./myshell\00"
@.str.3 = [8 x i8] c"myshell\00"
@.str.4 = [4 x i8] c"%s\0A\00"
@.str.5 = [4 x i8] c"PWD\00"
@.str.6 = [9 x i8] c"/myshell\00"
@.str.7 = [11 x i8] c"/README.md\00"
@.str.8 = [9 x i8] c"myshell \00"
@.str.9 = [3 x i8] c" \00"
@stderr = global i32 0
@.str.10 = [60 x i8] c" Welcome to MyShell \0A\00"
@.str.11 = [45 x i8] c" Type 'help' to get started! \0A\00"
@.str.12 = [62 x i8] c"------------------------------------------------------------\0A\00"
@stdin = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [1024 x i8]
%7 = alloca [64 x i8]
%8 = alloca [1024 x i8]
%9 = alloca [1024 x i8]
%10 = alloca [64000 x i8]
%11 = alloca i32
%12 = alloca [64 x i8]
%13 = alloca [64 x i8]
%14 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%15 = bitcast [1024 x i8]* %6 to i8*
%16 = bitcast [64 x i8]* %7 to i8*
%17 = bitcast [1024 x i8]* %8 to i8*
%18 = bitcast [1024 x i8]* %9 to i8*
%19 = bitcast [64 x i8]* %12 to i8*
%20 = bitcast i8* %19 to [64 x i8]*
%21 = getelementptr inbounds [64 x i8], [64 x i8]* %20, i32 0, i32 0
store i8 115, i8* %21
%22 = getelementptr inbounds [64 x i8], [64 x i8]* %20, i32 0, i32 1
store i8 104, i8* %22
%23 = getelementptr inbounds [64 x i8], [64 x i8]* %20, i32 0, i32 2
store i8 101, i8* %23
%24 = getelementptr inbounds [64 x i8], [64 x i8]* %20, i32 0, i32 3
store i8 108, i8* %24
%25 = getelementptr inbounds [64 x i8], [64 x i8]* %20, i32 0, i32 4
store i8 108, i8* %25
%26 = getelementptr inbounds [64 x i8], [64 x i8]* %20, i32 0, i32 5
store i8 61, i8* %26
%27 = bitcast [64 x i8]* %13 to i8*
%28 = getelementptr inbounds [64000 x i8], [64000 x i8]* %10, i64 0, i64 0
%29 = call i8* @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%30 = call i32 @strcpy(i8* %28, i8* %29)
%31 = getelementptr inbounds [64000 x i8], [64000 x i8]* %10, i64 0, i64 0
%32 = call i32 @strcat(i8* %31, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%33 = load i8**, i8*** %5
%34 = getelementptr inbounds i8*, i8** %33, i64 0
%35 = load i8*, i8** %34
%36 = icmp eq i8* %35, getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0)
br i1 %36, label %37, label %84
37: ; preds = %2
%38 = load i8**, i8*** %5
%39 = getelementptr inbounds i8*, i8** %38, i64 0
%40 = load i8*, i8** %39
%41 = icmp eq i8* %40, getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0)
br i1 %41, label %42, label %84
42: ; preds = %37
%43 = load i8**, i8*** %5
%44 = getelementptr inbounds i8*, i8** %43, i64 0
%45 = load i8*, i8** %44
%46 = call i32 @strlen(i8* %45)
store i32 %46, i32* %11
br label %47
47: ; preds = %62, %42
%48 = load i32, i32* %11
%49 = icmp ne i32 %48, 0
br i1 %49, label %50, label %60
50: ; preds = %47
%51 = load i8**, i8*** %5
%52 = getelementptr inbounds i8*, i8** %51, i64 0
%53 = load i8*, i8** %52
%54 = load i32, i32* %11
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds i8, i8* %53, i64 %55
%57 = load i8, i8* %56
%58 = sext i8 %57 to i32
%59 = icmp ne i32 %58, 47
br label %60
60: ; preds = %50, %47
%61 = phi i1 [ false, %47 ], [ %59, %50 ]
br i1 %61, label %62, label %65
62: ; preds = %60
%63 = load i32, i32* %11
%64 = add nsw i32 %63, -1
store i32 %64, i32* %11
br label %47
65: ; preds = %60
%66 = load i8**, i8*** %5
%67 = getelementptr inbounds i8*, i8** %66, i64 0
%68 = load i8*, i8** %67
%69 = load i32, i32* %11
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds i8, i8* %68, i64 %70
store i8 0, i8* %71
%72 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 0
%73 = load i8**, i8*** %5
%74 = getelementptr inbounds i8*, i8** %73, i64 0
%75 = load i8*, i8** %74
%76 = call i32 @strcpy(i8* %72, i8* %75)
%77 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 0
%78 = load i8**, i8*** %5
%79 = getelementptr inbounds i8*, i8** %78, i64 0
%80 = load i8*, i8** %79
%81 = call i32 @retrieve_full_path(i8* %77, i8* %80)
%82 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 0
%83 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* %82)
br label %88
84: ; preds = %37, %2
%85 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 0
%86 = call i8* @getenv(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%87 = call i32 @strcpy(i8* %85, i8* %86)
br label %88
88: ; preds = %84, %65
%89 = getelementptr inbounds [64000 x i8], [64000 x i8]* %10, i64 0, i64 0
%90 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 0
%91 = call i32 @strcat(i8* %89, i8* %90)
%92 = getelementptr inbounds [64000 x i8], [64000 x i8]* %10, i64 0, i64 0
%93 = call i32 @setenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %92, i32 1)
%94 = getelementptr inbounds [64 x i8], [64 x i8]* %12, i64 0, i64 0
%95 = call i32 @strcat(i8* %94, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0))
%96 = getelementptr inbounds [64 x i8], [64 x i8]* %12, i64 0, i64 0
%97 = call i32 @putenv(i8* %96)
%98 = getelementptr inbounds [64 x i8], [64 x i8]* %13, i64 0, i64 0
%99 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 0
%100 = call i32 @strcat(i8* %98, i8* %99)
%101 = getelementptr inbounds [64 x i8], [64 x i8]* %13, i64 0, i64 0
%102 = call i32 @strcat(i8* %101, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0))
%103 = getelementptr inbounds [64 x i8], [64 x i8]* %13, i64 0, i64 0
%104 = call i32 @putenv(i8* %103)
%105 = load i32, i32* %4
%106 = icmp sgt i32 %105, 1
br i1 %106, label %107, label %130
107: ; preds = %88
%108 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%109 = call i32 @strcpy(i8* %108, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0))
store i32 1, i32* %14
br label %110
110: ; preds = %124, %107
%111 = load i32, i32* %14
%112 = load i32, i32* %4
%113 = icmp slt i32 %111, %112
br i1 %113, label %114, label %127
114: ; preds = %110
%115 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%116 = load i8**, i8*** %5
%117 = load i32, i32* %14
%118 = sext i32 %117 to i64
%119 = getelementptr inbounds i8*, i8** %116, i64 %118
%120 = load i8*, i8** %119
%121 = call i32 @strcat(i8* %115, i8* %120)
%122 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%123 = call i32 @strcat(i8* %122, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0))
br label %124
124: ; preds = %114
%125 = load i32, i32* %14
%126 = add nsw i32 %125, 1
store i32 %126, i32* %14
br label %110
127: ; preds = %110
%128 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%129 = call i32 @execute(i8* %128)
br label %140
130: ; preds = %88
%131 = call i32 (...) @clear()
%132 = load i32, i32* @stderr
%133 = call i32 @fprintf(i32 %132, i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.10, i64 0, i64 0))
%134 = load i32, i32* @stderr
%135 = call i32 @fprintf(i32 %134, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.11, i64 0, i64 0))
%136 = load i32, i32* @stderr
%137 = call i32 @fprintf(i32 %136, i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.12, i64 0, i64 0))
%138 = load i32, i32* @stdin
%139 = call i32 @execute_shell(i32 %138, i32* null, i32* null)
br label %140
140: ; preds = %130, %127
%141 = load i32, i32* @EXIT_SUCCESS
ret i32 %141
}

LLVM IR (-O2):
@__const.main.readme_path = [64 x i8] c"readme_path=\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@.str = [5 x i8] c"PATH\00"
@.str.1 = [2 x i8] c":\00"
@.str.2 = [10 x i8] c"./myshell\00"
@.str.3 = [8 x i8] c"myshell\00"
@.str.4 = [4 x i8] c"%s\0A\00"
@.str.5 = [4 x i8] c"PWD\00"
@.str.6 = [9 x i8] c"/myshell\00"
@.str.7 = [11 x i8] c"/README.md\00"
@.str.8 = [9 x i8] c"myshell \00"
@.str.9 = [3 x i8] c" \00"
@stderr = global i32 0
@.str.10 = [60 x i8] c" Welcome to MyShell \0A\00"
@.str.11 = [45 x i8] c" Type 'help' to get started! \0A\00"
@.str.12 = [62 x i8] c"------------------------------------------------------------\0A\00"
@stdin = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [1024 x i8]
%4 = alloca [64 x i8]
%5 = alloca [64000 x i8]
%6 = alloca [64 x i8]
%7 = alloca [64 x i8]
%8 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%9 = getelementptr inbounds [64 x i8], [64 x i8]* %4, i64 0, i64 0
%10 = getelementptr inbounds [64000 x i8], [64000 x i8]* %5, i64 0, i64 0
%11 = getelementptr inbounds [64 x i8], [64 x i8]* %6, i64 0, i64 0
store i8 115, i8* %11
%12 = getelementptr inbounds [64 x i8], [64 x i8]* %6, i64 0, i64 1
store i8 104, i8* %12
%13 = getelementptr inbounds [64 x i8], [64 x i8]* %6, i64 0, i64 2
store i8 101, i8* %13
%14 = getelementptr inbounds [64 x i8], [64 x i8]* %6, i64 0, i64 3
store i8 108, i8* %14
%15 = getelementptr inbounds [64 x i8], [64 x i8]* %6, i64 0, i64 4
store i8 108, i8* %15
%16 = getelementptr inbounds [64 x i8], [64 x i8]* %6, i64 0, i64 5
store i8 61, i8* %16
%17 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 0
%18 = tail call i8* @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%19 = call i32 @strcpy(i8* %10, i8* %18)
%20 = call i32 @strcat(i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%21 = load i8*, i8** %1
%22 = icmp ne i8* %21, getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0)
%23 = or i1 %22, icmp ne (i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
br i1 %23, label %49, label %24
24: ; preds = %2
%25 = call i32 @strlen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%26 = icmp eq i32 %25, 0
%27 = load i8*, i8** %1
br i1 %26, label %39, label %28
28: ; preds = %24
%29 = sext i32 %25 to i64
br label %30
30: ; preds = %28, %35
%31 = phi i64 [ %29, %28 ], [ %36, %35 ]
%32 = getelementptr inbounds i8, i8* %27, i64 %31
%33 = load i8, i8* %32
%34 = icmp eq i8 %33, 47
br i1 %34, label %39, label %35
35: ; preds = %30
%36 = add nsw i64 %31, -1
%37 = trunc i64 %36 to i32
%38 = icmp eq i32 %37, 0
br i1 %38, label %39, label %30
39: ; preds = %30, %35, %24
%40 = phi i64 [ 0, %24 ], [ 0, %35 ], [ %31, %30 ]
%41 = shl i64 %40, 32
%42 = ashr exact i64 %41, 32
%43 = getelementptr inbounds i8, i8* %27, i64 %42
store i8 0, i8* %43
%44 = load i8*, i8** %1
%45 = call i32 @strcpy(i8* %9, i8* %44)
%46 = load i8*, i8** %1
%47 = call i32 @retrieve_full_path(i8* %9, i8* %46)
%48 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* %9)
br label %52
49: ; preds = %2
%50 = call i8* @getenv(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%51 = call i32 @strcpy(i8* %9, i8* %50)
br label %52
52: ; preds = %49, %39
%53 = call i32 @strcat(i8* %10, i8* %9)
%54 = call i32 @setenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %10, i32 1)
%55 = call i32 @strcat(i8* %11, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0))
%56 = call i32 @putenv(i8* %11)
%57 = call i32 @strcat(i8* %17, i8* %9)
%58 = call i32 @strcat(i8* %17, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0))
%59 = call i32 @putenv(i8* %17)
%60 = icmp sgt i32 %0, 1
br i1 %60, label %61, label %74
61: ; preds = %52
%62 = call i32 @strcpy(i8* %8, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0))
%63 = zext i32 %0 to i64
br label %66
64: ; preds = %66
%65 = call i32 @execute(i8* %8)
br label %84
66: ; preds = %61, %66
%67 = phi i64 [ 1, %61 ], [ %72, %66 ]
%68 = getelementptr inbounds i8*, i8** %1, i64 %67
%69 = load i8*, i8** %68
%70 = call i32 @strcat(i8* %8, i8* %69)
%71 = call i32 @strcat(i8* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0))
%72 = add nuw nsw i64 %67, 1
%73 = icmp eq i64 %72, %63
br i1 %73, label %64, label %66
74: ; preds = %52
%75 = call i32 (...) @clear()
%76 = load i32, i32* @stderr
%77 = call i32 @fprintf(i32 %76, i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.10, i64 0, i64 0))
%78 = load i32, i32* @stderr
%79 = call i32 @fprintf(i32 %78, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.11, i64 0, i64 0))
%80 = load i32, i32* @stderr
%81 = call i32 @fprintf(i32 %80, i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.12, i64 0, i64 0))
%82 = load i32, i32* @stdin
%83 = call i32 @execute_shell(i32 %82, i32* null, i32* null)
br label %84
84: ; preds = %74, %64
%85 = load i32, i32* @EXIT_SUCCESS
ret i32 %85
}