#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int chdir(char *);
int execvp(char *, char **);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
scalar_t__ fork();
int /*<<< orphan*/ *freopen(char *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ stdout;
scalar_t__ strncmp(char *, char *, int);
char *strtok(char *, char *);
int /*<<< orphan*/ wait(int *);
int main() {
  char in_holder[512];
  char *tok_holder;
  char delimeter[8];
  char *arg_holder[50];
  int arg_count;
  int arg_count_fcheck;
  int exit_flag;
  int ret_val;
  int line_count;
  delimeter[0] = 32;
  delimeter[1] = 9;
  delimeter[2] = 10;
  delimeter[3] = 40;
  delimeter[4] = 41;
  delimeter[5] = 124;
  delimeter[6] = 38;
  delimeter[7] = 59;
  line_count = 1;
  exit_flag = 0;
  while (exit_flag == 0) {
    arg_count = 0;
    printf("(%d) Bryan's Shell $ ", line_count);
    fgets(in_holder, 512, stdin);
    if (in_holder[0] == '\n')
      printf("");
    else {
      line_count++;
      tok_holder = strtok(in_holder, delimeter);
      while (tok_holder != NULL) {
        arg_holder[arg_count] = tok_holder;
        arg_count++;
        tok_holder = strtok(NULL, delimeter);
      }
      arg_holder[arg_count] = NULL;
      arg_count_fcheck = arg_count - 2;
      if (strncmp(arg_holder[0], "exit", 4) == 0) {
        exit_flag = 1;
        printf("Shell now exiting. Goodbye!\n");
      } else {
        if (strncmp(arg_holder[0], "cd", 2) == 0) {
          ret_val = chdir(arg_holder[1]);
          if (ret_val == 0)
            printf("Directory changed successfully.\n");
          else
            perror("Directory NOT changed!");
        } else {
          if (arg_count == 1 || arg_count == 2) {
            if (fork() == 0) {
              ret_val = execvp(arg_holder[0], arg_holder);
              if (ret_val == -1)
                perror("Oh No! Error!");
              exit(0);
            } else {
              int status;
              wait(&status);
            }
          } else {
            if (strncmp(arg_holder[arg_count_fcheck], ">>", 2) == 0) {
              if (fork() == 0) {
                FILE *fp;
                fp = freopen(arg_holder[arg_count - 1], "a", stdout);
                arg_holder[arg_count - 1] = NULL;
                arg_holder[arg_count_fcheck] = NULL;
                ret_val = execvp(arg_holder[0], arg_holder);
                if (ret_val == -1)
                  perror("Oh No! Error!");
                fclose(fp);
                exit(0);
              } else {
                int status;
                wait(&status);
              }
            } else if (strncmp(arg_holder[arg_count_fcheck], ">", 1) == 0) {
              if (fork() == 0) {
                FILE *fp;
                fp = freopen(arg_holder[arg_count - 1], "w+", stdout);
                arg_holder[arg_count - 1] = NULL;
                arg_holder[arg_count_fcheck] = NULL;
                ret_val = execvp(arg_holder[0], arg_holder);
                if (ret_val == -1)
                  perror("Oh No! Error!");
                fclose(fp);
                exit(0);
              } else {
                int status;
                wait(&status);
              }
            } else if (strncmp(arg_holder[arg_count_fcheck], "<", 1) == 0) {
              if (fork() == 0) {
                FILE *fp;
                fp = freopen(arg_holder[arg_count - 1], "r", stdin);
                arg_holder[arg_count - 1] = NULL;
                arg_holder[arg_count_fcheck] = NULL;
                ret_val = execvp(arg_holder[0], arg_holder);
                if (ret_val == -1)
                  perror("Oh No! Error!");
                fclose(fp);
                exit(0);
              } else {
                int status;
                wait(&status);
              }
            } else {
              if (fork() == 0) {
                ret_val = execvp(arg_holder[0], arg_holder);
                if (ret_val == -1)
                  perror("Oh No! Error!");
                exit(0);
              } else {
                int status;
                wait(&status);
              }
            }
          }
        }
      }
    }
  }
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x400,%rsp
movl   $0x0,-0x4(%rbp)
movb   $0x20,-0x220(%rbp)
movb   $0x9,-0x21f(%rbp)
movb   $0xa,-0x21e(%rbp)
movb   $0x28,-0x21d(%rbp)
movb   $0x29,-0x21c(%rbp)
movb   $0x7c,-0x21b(%rbp)
movb   $0x26,-0x21a(%rbp)
movb   $0x3b,-0x219(%rbp)
movl   $0x1,-0x3c4(%rbp)
movl   $0x0,-0x3bc(%rbp)
cmpl   $0x0,-0x3bc(%rbp)
jne    1775 <main+0x5b5>
movl   $0x0,-0x3b4(%rbp)
mov    -0x3c4(%rbp),%esi
lea    0xdbe(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0x210(%rbp),%rdi
mov    0x2d91(%rip),%rax
mov    (%rax),%edx
mov    $0x200,%esi
call   1080 <fgets@plt>
movsbl -0x210(%rbp),%eax
cmp    $0xa,%eax
jne    1286 <main+0xc6>
lea    0xdbd(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    1770 <main+0x5b0>
mov    -0x3c4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c4(%rbp)
lea    -0x210(%rbp),%rdi
lea    -0x220(%rbp),%rsi
call   10a0 <strtok@plt>
mov    %rax,-0x218(%rbp)
cmpq   $0x0,-0x218(%rbp)
je     12fe <main+0x13e>
mov    -0x218(%rbp),%rcx
movslq -0x3b4(%rbp),%rax
mov    %rcx,-0x3b0(%rbp,%rax,8)
ff
mov    -0x3b4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3b4(%rbp)
lea    -0x220(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edi
call   10a0 <strtok@plt>
mov    %rax,-0x218(%rbp)
jmp    12af <main+0xef>
movslq -0x3b4(%rbp),%rax
movq   $0x0,-0x3b0(%rbp,%rax,8)
mov    -0x3b4(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0x3b8(%rbp)
mov    -0x3b0(%rbp),%rdi
lea    0xce8(%rip),%rsi
mov    $0x4,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    135f <main+0x19f>
movl   $0x1,-0x3bc(%rbp)
lea    0xcc8(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    176b <main+0x5ab>
mov    -0x3b0(%rbp),%rdi
lea    0xccb(%rip),%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    13c4 <main+0x204>
mov    -0x3a8(%rbp),%rdi
call   1050 <chdir@plt>
mov    %eax,-0x3c0(%rbp)
cmpl   $0x0,-0x3c0(%rbp)
jne    13b3 <main+0x1f3>
lea    0xc94(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    13bf <main+0x1ff>
lea    0xca2(%rip),%rdi
call   1090 <perror@plt>
jmp    1766 <main+0x5a6>
cmpl   $0x1,-0x3b4(%rbp)
je     13de <main+0x21e>
cmpl   $0x2,-0x3b4(%rbp)
jne    1439 <main+0x279>
mov    $0x0,%al
call   10e0 <fork@plt>
cmp    $0x0,%rax
jne    1428 <main+0x268>
mov    -0x3b0(%rbp),%rdi
lea    -0x3b0(%rbp),%rsi
call   10b0 <execvp@plt>
mov    %eax,-0x3c0(%rbp)
cmpl   $0xffffffff,-0x3c0(%rbp)
jne    1421 <main+0x261>
lea    0xc57(%rip),%rdi
call   1090 <perror@plt>
xor    %edi,%edi
call   10c0 <exit@plt>
lea    -0x3c8(%rbp),%rdi
call   10d0 <wait@plt>
jmp    1761 <main+0x5a1>
movslq -0x3b8(%rbp),%rax
mov    -0x3b0(%rbp,%rax,8),%rdi
ff
lea    0xc32(%rip),%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1523 <main+0x363>
mov    $0x0,%al
call   10e0 <fork@plt>
cmp    $0x0,%rax
jne    1512 <main+0x352>
mov    -0x3b4(%rbp),%eax
sub    $0x1,%eax
cltq
mov    -0x3b0(%rbp,%rax,8),%rdi
ff
mov    0x2b4a(%rip),%rax
mov    (%rax),%edx
lea    0xbed(%rip),%rsi
call   1070 <freopen@plt>
mov    %rax,-0x3d0(%rbp)
mov    -0x3b4(%rbp),%eax
sub    $0x1,%eax
cltq
movq   $0x0,-0x3b0(%rbp,%rax,8)
movslq -0x3b8(%rbp),%rax
movq   $0x0,-0x3b0(%rbp,%rax,8)
mov    -0x3b0(%rbp),%rdi
lea    -0x3b0(%rbp),%rsi
call   10b0 <execvp@plt>
mov    %eax,-0x3c0(%rbp)
cmpl   $0xffffffff,-0x3c0(%rbp)
jne    14ff <main+0x33f>
lea    0xb79(%rip),%rdi
call   1090 <perror@plt>
mov    -0x3d0(%rbp),%rdi
call   1040 <fclose@plt>
xor    %edi,%edi
call   10c0 <exit@plt>
lea    -0x3d4(%rbp),%rdi
call   10d0 <wait@plt>
jmp    175c <main+0x59c>
movslq -0x3b8(%rbp),%rax
mov    -0x3b0(%rbp,%rax,8),%rdi
ff
lea    0xb49(%rip),%rsi
mov    $0x1,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    160d <main+0x44d>
mov    $0x0,%al
call   10e0 <fork@plt>
cmp    $0x0,%rax
jne    15fc <main+0x43c>
mov    -0x3b4(%rbp),%eax
sub    $0x1,%eax
cltq
mov    -0x3b0(%rbp,%rax,8),%rdi
ff
mov    0x2a60(%rip),%rax
mov    (%rax),%edx
lea    0xb05(%rip),%rsi
call   1070 <freopen@plt>
mov    %rax,-0x3e0(%rbp)
mov    -0x3b4(%rbp),%eax
sub    $0x1,%eax
cltq
movq   $0x0,-0x3b0(%rbp,%rax,8)
movslq -0x3b8(%rbp),%rax
movq   $0x0,-0x3b0(%rbp,%rax,8)
mov    -0x3b0(%rbp),%rdi
lea    -0x3b0(%rbp),%rsi
call   10b0 <execvp@plt>
mov    %eax,-0x3c0(%rbp)
cmpl   $0xffffffff,-0x3c0(%rbp)
jne    15e9 <main+0x429>
lea    0xa8f(%rip),%rdi
call   1090 <perror@plt>
mov    -0x3e0(%rbp),%rdi
call   1040 <fclose@plt>
xor    %edi,%edi
call   10c0 <exit@plt>
lea    -0x3e4(%rbp),%rdi
call   10d0 <wait@plt>
jmp    1757 <main+0x597>
movslq -0x3b8(%rbp),%rax
mov    -0x3b0(%rbp,%rax,8),%rdi
ff
lea    0xa66(%rip),%rsi
mov    $0x1,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    16f7 <main+0x537>
mov    $0x0,%al
call   10e0 <fork@plt>
cmp    $0x0,%rax
jne    16e6 <main+0x526>
mov    -0x3b4(%rbp),%eax
sub    $0x1,%eax
cltq
mov    -0x3b0(%rbp,%rax,8),%rdi
ff
mov    0x2986(%rip),%rax
mov    (%rax),%edx
lea    0xa20(%rip),%rsi
call   1070 <freopen@plt>
mov    %rax,-0x3f0(%rbp)
mov    -0x3b4(%rbp),%eax
sub    $0x1,%eax
cltq
movq   $0x0,-0x3b0(%rbp,%rax,8)
movslq -0x3b8(%rbp),%rax
movq   $0x0,-0x3b0(%rbp,%rax,8)
mov    -0x3b0(%rbp),%rdi
lea    -0x3b0(%rbp),%rsi
call   10b0 <execvp@plt>
mov    %eax,-0x3c0(%rbp)
cmpl   $0xffffffff,-0x3c0(%rbp)
jne    16d3 <main+0x513>
lea    0x9a5(%rip),%rdi
call   1090 <perror@plt>
mov    -0x3f0(%rbp),%rdi
call   1040 <fclose@plt>
xor    %edi,%edi
call   10c0 <exit@plt>
lea    -0x3f4(%rbp),%rdi
call   10d0 <wait@plt>
jmp    1752 <main+0x592>
mov    $0x0,%al
call   10e0 <fork@plt>
cmp    $0x0,%rax
jne    1741 <main+0x581>
mov    -0x3b0(%rbp),%rdi
lea    -0x3b0(%rbp),%rsi
call   10b0 <execvp@plt>
mov    %eax,-0x3c0(%rbp)
cmpl   $0xffffffff,-0x3c0(%rbp)
jne    173a <main+0x57a>
lea    0x93e(%rip),%rdi
call   1090 <perror@plt>
xor    %edi,%edi
call   10c0 <exit@plt>
lea    -0x3f8(%rbp),%rdi
call   10d0 <wait@plt>
jmp    1752 <main+0x592>
jmp    1757 <main+0x597>
jmp    175c <main+0x59c>
jmp    1761 <main+0x5a1>
jmp    1766 <main+0x5a6>
jmp    176b <main+0x5ab>
jmp    1770 <main+0x5b0>
jmp    121e <main+0x5e>
xor    %edi,%edi
call   10c0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x3a8,%rsp
movabs $0x3b267c29280a0920,%rax
7c 26 3b
mov    %rax,0x8(%rsp)
mov    $0x1,%r15d
lea    0xe03(%rip),%r14
mov    0x2de4(%rip),%r13
lea    0x1a0(%rsp),%rbp
lea    0x8(%rsp),%rbx
jmp    123c <main+0x6c>
xor    %eax,%eax
call   10f0 <fork@plt>
test   %rax,%rax
je     1458 <main+0x288>
lea    0x4(%rsp),%rdi
call   10e0 <wait@plt>
lea    0xdcc(%rip),%r14
lea    0x1a0(%rsp),%rbp
mov    %r14,%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x0(%r13),%edx
mov    %rbp,%rdi
mov    $0x200,%esi
call   1090 <fgets@plt>
cmpb   $0xa,0x1a0(%rsp)
0a
je     123c <main+0x6c>
mov    %rbp,%rdi
mov    %rbx,%rsi
call   10b0 <strtok@plt>
xor    %ebp,%ebp
test   %rax,%rax
je     1298 <main+0xc8>
cs nopw 0x0(%rax,%rax,1)
mov    %rax,0x10(%rsp,%rbp,8)
add    $0x1,%rbp
xor    %edi,%edi
mov    %rbx,%rsi
call   10b0 <strtok@plt>
test   %rax,%rax
jne    1280 <main+0xb0>
mov    %ebp,%eax
movq   $0x0,0x10(%rsp,%rax,8)
mov    0x10(%rsp),%r12
mov    %r12,%rdi
lea    0xd64(%rip),%rsi
mov    $0x4,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     1445 <main+0x275>
add    $0x1,%r15d
mov    %r12,%rdi
lea    0xd48(%rip),%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     138e <main+0x1be>
lea    -0x1(%rbp),%r14d
cmp    $0x1,%r14d
jbe    1213 <main+0x43>
add    $0xfffffffe,%ebp
movslq %ebp,%rbp
mov    0x10(%rsp,%rbp,8),%r13
mov    %r13,%rdi
lea    0xd3a(%rip),%rsi
mov    $0x2,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     13b9 <main+0x1e9>
mov    %r13,%rdi
lea    0xd1e(%rip),%rsi
mov    $0x1,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     13df <main+0x20f>
mov    %r13,%rdi
lea    0xd08(%rip),%rsi
mov    $0x1,%edx
call   1030 <strncmp@plt>
mov    %rax,%r13
xor    %eax,%eax
call   10f0 <fork@plt>
test   %r13,%r13
je     13fb <main+0x22b>
test   %rax,%rax
mov    0x2c7e(%rip),%r13
lea    0xc8f(%rip),%r14
je     1458 <main+0x288>
lea    0x4(%rsp),%rdi
call   10e0 <wait@plt>
lea    0x1a0(%rsp),%rbp
jmp    123c <main+0x6c>
mov    0x18(%rsp),%rdi
call   1060 <chdir@plt>
test   %eax,%eax
jne    142c <main+0x25c>
lea    0xca8(%rip),%rdi
call   1040 <puts@plt>
lea    0x1a0(%rsp),%rbp
jmp    123c <main+0x6c>
xor    %eax,%eax
call   10f0 <fork@plt>
test   %rax,%rax
je     147d <main+0x2ad>
lea    0x4(%rsp),%rdi
call   10e0 <wait@plt>
mov    0x2c0e(%rip),%r13
jmp    122d <main+0x5d>
xor    %eax,%eax
call   10f0 <fork@plt>
test   %rax,%rax
mov    0x2bf8(%rip),%r13
jne    1223 <main+0x53>
jmp    149a <main+0x2ca>
mov    %rbp,%r12
test   %rax,%rax
mov    0x2be0(%rip),%r13
lea    0x1a0(%rsp),%rbp
je     14f4 <main+0x324>
lea    0x4(%rsp),%rdi
call   10e0 <wait@plt>
lea    0xbd9(%rip),%r14
jmp    123c <main+0x6c>
lea    0xbeb(%rip),%rdi
call   10a0 <perror@plt>
lea    0x1a0(%rsp),%rbp
jmp    123c <main+0x6c>
lea    0xc23(%rip),%rdi
call   1040 <puts@plt>
xor    %edi,%edi
call   10d0 <exit@plt>
lea    0x10(%rsp),%rsi
mov    %r12,%rdi
call   10c0 <execvp@plt>
cmp    $0xffffffff,%eax
jne    1476 <main+0x2a6>
lea    0xbc4(%rip),%rdi
call   10a0 <perror@plt>
xor    %edi,%edi
call   10d0 <exit@plt>
mov    %rbp,%rbx
movslq %r14d,%rbp
mov    0x10(%rsp,%rbp,8),%rdi
mov    0x2b49(%rip),%rax
mov    (%rax),%edx
lea    0xbae(%rip),%rsi
jmp    14b5 <main+0x2e5>
mov    %rbp,%rbx
movslq %r14d,%rbp
mov    0x10(%rsp,%rbp,8),%rdi
mov    0x2b2c(%rip),%rax
mov    (%rax),%edx
lea    0xb93(%rip),%rsi
call   1080 <freopen@plt>
mov    %rax,%r14
movq   $0x0,0x10(%rsp,%rbp,8)
movq   $0x0,0x10(%rsp,%rbx,8)
mov    0x10(%rsp),%rdi
lea    0x10(%rsp),%rsi
call   10c0 <execvp@plt>
cmp    $0xffffffff,%eax
jne    14ef <main+0x31f>
lea    0xb4b(%rip),%rdi
call   10a0 <perror@plt>
mov    %r14,%rdi
jmp    1544 <main+0x374>
movslq %r14d,%rbp
mov    0x10(%rsp,%rbp,8),%rdi
mov    0x0(%r13),%edx
lea    0xb46(%rip),%rsi
call   1080 <freopen@plt>
mov    %rax,%rbx
movq   $0x0,0x10(%rsp,%rbp,8)
movq   $0x0,0x10(%rsp,%r12,8)
mov    0x10(%rsp),%rdi
lea    0x10(%rsp),%rsi
call   10c0 <execvp@plt>
cmp    $0xffffffff,%eax
jne    1541 <main+0x371>
lea    0xaf9(%rip),%rdi
call   10a0 <perror@plt>
mov    %rbx,%rdi
call   1050 <fclose@plt>
xor    %edi,%edi
call   10d0 <exit@plt>

LLVM IR (-O0):
@.str = [22 x i8] c"(%d) Bryan's Shell $ \00"
@stdin = global i32 0
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [5 x i8] c"exit\00"
@.str.3 = [29 x i8] c"Shell now exiting. Goodbye!\0A\00"
@.str.4 = [3 x i8] c"cd\00"
@.str.5 = [33 x i8] c"Directory changed successfully.\0A\00"
@.str.6 = [23 x i8] c"Directory NOT changed!\00"
@.str.7 = [14 x i8] c"Oh No! Error!\00"
@.str.8 = [3 x i8] c">>\00"
@.str.9 = [2 x i8] c"a\00"
@stdout = global i32 0
@.str.10 = [2 x i8] c">\00"
@.str.11 = [3 x i8] c"w+\00"
@.str.12 = [2 x i8] c"<\00"
@.str.13 = [2 x i8] c"r\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [512 x i8]
%3 = alloca i8*
%4 = alloca [8 x i8]
%5 = alloca [50 x i8*]
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32*
%13 = alloca i32
%14 = alloca i32*
%15 = alloca i32
%16 = alloca i32*
%17 = alloca i32
%18 = alloca i32
store i32 0, i32* %1
%19 = getelementptr inbounds [8 x i8], [8 x i8]* %4, i64 0, i64 0
store i8 32, i8* %19
%20 = getelementptr inbounds [8 x i8], [8 x i8]* %4, i64 0, i64 1
store i8 9, i8* %20
%21 = getelementptr inbounds [8 x i8], [8 x i8]* %4, i64 0, i64 2
store i8 10, i8* %21
%22 = getelementptr inbounds [8 x i8], [8 x i8]* %4, i64 0, i64 3
store i8 40, i8* %22
%23 = getelementptr inbounds [8 x i8], [8 x i8]* %4, i64 0, i64 4
store i8 41, i8* %23
%24 = getelementptr inbounds [8 x i8], [8 x i8]* %4, i64 0, i64 5
store i8 124, i8* %24
%25 = getelementptr inbounds [8 x i8], [8 x i8]* %4, i64 0, i64 6
store i8 38, i8* %25
%26 = getelementptr inbounds [8 x i8], [8 x i8]* %4, i64 0, i64 7
store i8 59, i8* %26
store i32 1, i32* %10
store i32 0, i32* %8
br label %27
27: ; preds = %254, %0
%28 = load i32, i32* %8
%29 = icmp eq i32 %28, 0
br i1 %29, label %30, label %255
30: ; preds = %27
store i32 0, i32* %6
%31 = load i32, i32* %10
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %31)
%33 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%34 = load i32, i32* @stdin
%35 = call i32 @fgets(i8* %33, i32 512, i32 %34)
%36 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%37 = load i8, i8* %36
%38 = sext i8 %37 to i32
%39 = icmp eq i32 %38, 10
br i1 %39, label %40, label %42
40: ; preds = %30
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
br label %254
42: ; preds = %30
%43 = load i32, i32* %10
%44 = add nsw i32 %43, 1
store i32 %44, i32* %10
%45 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%46 = getelementptr inbounds [8 x i8], [8 x i8]* %4, i64 0, i64 0
%47 = call i8* @strtok(i8* %45, i8* %46)
store i8* %47, i8** %3
br label %48
48: ; preds = %51, %42
%49 = load i8*, i8** %3
%50 = icmp ne i8* %49, null
br i1 %50, label %51, label %60
51: ; preds = %48
%52 = load i8*, i8** %3
%53 = load i32, i32* %6
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds [50 x i8*], [50 x i8*]* %5, i64 0, i64 %54
store i8* %52, i8** %55
%56 = load i32, i32* %6
%57 = add nsw i32 %56, 1
store i32 %57, i32* %6
%58 = getelementptr inbounds [8 x i8], [8 x i8]* %4, i64 0, i64 0
%59 = call i8* @strtok(i8* null, i8* %58)
store i8* %59, i8** %3
br label %48
60: ; preds = %48
%61 = load i32, i32* %6
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds [50 x i8*], [50 x i8*]* %5, i64 0, i64 %62
store i8* null, i8** %63
%64 = load i32, i32* %6
%65 = sub nsw i32 %64, 2
store i32 %65, i32* %7
%66 = getelementptr inbounds [50 x i8*], [50 x i8*]* %5, i64 0, i64 0
%67 = load i8*, i8** %66
%68 = call i64 @strncmp(i8* %67, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 4)
%69 = icmp eq i64 %68, 0
br i1 %69, label %70, label %72
70: ; preds = %60
store i32 1, i32* %8
%71 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0))
br label %253
72: ; preds = %60
%73 = getelementptr inbounds [50 x i8*], [50 x i8*]* %5, i64 0, i64 0
%74 = load i8*, i8** %73
%75 = call i64 @strncmp(i8* %74, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 2)
%76 = icmp eq i64 %75, 0
br i1 %76, label %77, label %88
77: ; preds = %72
%78 = getelementptr inbounds [50 x i8*], [50 x i8*]* %5, i64 0, i64 1
%79 = load i8*, i8** %78
%80 = call i32 @chdir(i8* %79)
store i32 %80, i32* %9
%81 = load i32, i32* %9
%82 = icmp eq i32 %81, 0
br i1 %82, label %83, label %85
83: ; preds = %77
%84 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.5, i64 0, i64 0))
br label %87
85: ; preds = %77
%86 = call i32 @perror(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0))
br label %87
87: ; preds = %85, %83
br label %252
88: ; preds = %72
%89 = load i32, i32* %6
%90 = icmp eq i32 %89, 1
br i1 %90, label %94, label %91
91: ; preds = %88
%92 = load i32, i32* %6
%93 = icmp eq i32 %92, 2
br i1 %93, label %94, label %111
94: ; preds = %91, %88
%95 = call i64 (...) @fork()
%96 = icmp eq i64 %95, 0
br i1 %96, label %97, label %108
97: ; preds = %94
%98 = getelementptr inbounds [50 x i8*], [50 x i8*]* %5, i64 0, i64 0
%99 = load i8*, i8** %98
%100 = getelementptr inbounds [50 x i8*], [50 x i8*]* %5, i64 0, i64 0
%101 = call i32 @execvp(i8* %99, i8** %100)
store i32 %101, i32* %9
%102 = load i32, i32* %9
%103 = icmp eq i32 %102, -1
br i1 %103, label %104, label %106
104: ; preds = %97
%105 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0))
br label %106
106: ; preds = %104, %97
%107 = call i32 @exit(i32 0)
unreachable
108: ; preds = %94
%109 = call i32 @wait(i32* %11)
br label %110
110: ; preds = %108
br label %251
111: ; preds = %91
%112 = load i32, i32* %7
%113 = sext i32 %112 to i64
%114 = getelementptr inbounds [50 x i8*], [50 x i8*]* %5, i64 0, i64 %113
%115 = load i8*, i8** %114
%116 = call i64 @strncmp(i8* %115, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i32 2)
%117 = icmp eq i64 %116, 0
br i1 %117, label %118, label %151
118: ; preds = %111
%119 = call i64 (...) @fork()
%120 = icmp eq i64 %119, 0
br i1 %120, label %121, label %148
121: ; preds = %118
%122 = load i32, i32* %6
%123 = sub nsw i32 %122, 1
%124 = sext i32 %123 to i64
%125 = getelementptr inbounds [50 x i8*], [50 x i8*]* %5, i64 0, i64 %124
%126 = load i8*, i8** %125
%127 = load i32, i32* @stdout
%128 = call i32* @freopen(i8* %126, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0), i32 %127)
store i32* %128, i32** %12
%129 = load i32, i32* %6
%130 = sub nsw i32 %129, 1
%131 = sext i32 %130 to i64
%132 = getelementptr inbounds [50 x i8*], [50 x i8*]* %5, i64 0, i64 %131
store i8* null, i8** %132
%133 = load i32, i32* %7
%134 = sext i32 %133 to i64
%135 = getelementptr inbounds [50 x i8*], [50 x i8*]* %5, i64 0, i64 %134
store i8* null, i8** %135
%136 = getelementptr inbounds [50 x i8*], [50 x i8*]* %5, i64 0, i64 0
%137 = load i8*, i8** %136
%138 = getelementptr inbounds [50 x i8*], [50 x i8*]* %5, i64 0, i64 0
%139 = call i32 @execvp(i8* %137, i8** %138)
store i32 %139, i32* %9
%140 = load i32, i32* %9
%141 = icmp eq i32 %140, -1
br i1 %141, label %142, label %144
142: ; preds = %121
%143 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0))
br label %144
144: ; preds = %142, %121
%145 = load i32*, i32** %12
%146 = call i32 @fclose(i32* %145)
%147 = call i32 @exit(i32 0)
unreachable
148: ; preds = %118
%149 = call i32 @wait(i32* %13)
br label %150
150: ; preds = %148
br label %250
151: ; preds = %111
%152 = load i32, i32* %7
%153 = sext i32 %152 to i64
%154 = getelementptr inbounds [50 x i8*], [50 x i8*]* %5, i64 0, i64 %153
%155 = load i8*, i8** %154
%156 = call i64 @strncmp(i8* %155, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0), i32 1)
%157 = icmp eq i64 %156, 0
br i1 %157, label %158, label %191
158: ; preds = %151
%159 = call i64 (...) @fork()
%160 = icmp eq i64 %159, 0
br i1 %160, label %161, label %188
161: ; preds = %158
%162 = load i32, i32* %6
%163 = sub nsw i32 %162, 1
%164 = sext i32 %163 to i64
%165 = getelementptr inbounds [50 x i8*], [50 x i8*]* %5, i64 0, i64 %164
%166 = load i8*, i8** %165
%167 = load i32, i32* @stdout
%168 = call i32* @freopen(i8* %166, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0), i32 %167)
store i32* %168, i32** %14
%169 = load i32, i32* %6
%170 = sub nsw i32 %169, 1
%171 = sext i32 %170 to i64
%172 = getelementptr inbounds [50 x i8*], [50 x i8*]* %5, i64 0, i64 %171
store i8* null, i8** %172
%173 = load i32, i32* %7
%174 = sext i32 %173 to i64
%175 = getelementptr inbounds [50 x i8*], [50 x i8*]* %5, i64 0, i64 %174
store i8* null, i8** %175
%176 = getelementptr inbounds [50 x i8*], [50 x i8*]* %5, i64 0, i64 0
%177 = load i8*, i8** %176
%178 = getelementptr inbounds [50 x i8*], [50 x i8*]* %5, i64 0, i64 0
%179 = call i32 @execvp(i8* %177, i8** %178)
store i32 %179, i32* %9
%180 = load i32, i32* %9
%181 = icmp eq i32 %180, -1
br i1 %181, label %182, label %184
182: ; preds = %161
%183 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0))
br label %184
184: ; preds = %182, %161
%185 = load i32*, i32** %14
%186 = call i32 @fclose(i32* %185)
%187 = call i32 @exit(i32 0)
unreachable
188: ; preds = %158
%189 = call i32 @wait(i32* %15)
br label %190
190: ; preds = %188
br label %249
191: ; preds = %151
%192 = load i32, i32* %7
%193 = sext i32 %192 to i64
%194 = getelementptr inbounds [50 x i8*], [50 x i8*]* %5, i64 0, i64 %193
%195 = load i8*, i8** %194
%196 = call i64 @strncmp(i8* %195, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i64 0, i64 0), i32 1)
%197 = icmp eq i64 %196, 0
br i1 %197, label %198, label %231
198: ; preds = %191
%199 = call i64 (...) @fork()
%200 = icmp eq i64 %199, 0
br i1 %200, label %201, label %228
201: ; preds = %198
%202 = load i32, i32* %6
%203 = sub nsw i32 %202, 1
%204 = sext i32 %203 to i64
%205 = getelementptr inbounds [50 x i8*], [50 x i8*]* %5, i64 0, i64 %204
%206 = load i8*, i8** %205
%207 = load i32, i32* @stdin
%208 = call i32* @freopen(i8* %206, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.13, i64 0, i64 0), i32 %207)
store i32* %208, i32** %16
%209 = load i32, i32* %6
%210 = sub nsw i32 %209, 1
%211 = sext i32 %210 to i64
%212 = getelementptr inbounds [50 x i8*], [50 x i8*]* %5, i64 0, i64 %211
store i8* null, i8** %212
%213 = load i32, i32* %7
%214 = sext i32 %213 to i64
%215 = getelementptr inbounds [50 x i8*], [50 x i8*]* %5, i64 0, i64 %214
store i8* null, i8** %215
%216 = getelementptr inbounds [50 x i8*], [50 x i8*]* %5, i64 0, i64 0
%217 = load i8*, i8** %216
%218 = getelementptr inbounds [50 x i8*], [50 x i8*]* %5, i64 0, i64 0
%219 = call i32 @execvp(i8* %217, i8** %218)
store i32 %219, i32* %9
%220 = load i32, i32* %9
%221 = icmp eq i32 %220, -1
br i1 %221, label %222, label %224
222: ; preds = %201
%223 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0))
br label %224
224: ; preds = %222, %201
%225 = load i32*, i32** %16
%226 = call i32 @fclose(i32* %225)
%227 = call i32 @exit(i32 0)
unreachable
228: ; preds = %198
%229 = call i32 @wait(i32* %17)
br label %230
230: ; preds = %228
br label %248
231: ; preds = %191
%232 = call i64 (...) @fork()
%233 = icmp eq i64 %232, 0
br i1 %233, label %234, label %245
234: ; preds = %231
%235 = getelementptr inbounds [50 x i8*], [50 x i8*]* %5, i64 0, i64 0
%236 = load i8*, i8** %235
%237 = getelementptr inbounds [50 x i8*], [50 x i8*]* %5, i64 0, i64 0
%238 = call i32 @execvp(i8* %236, i8** %237)
store i32 %238, i32* %9
%239 = load i32, i32* %9
%240 = icmp eq i32 %239, -1
br i1 %240, label %241, label %243
241: ; preds = %234
%242 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0))
br label %243
243: ; preds = %241, %234
%244 = call i32 @exit(i32 0)
unreachable
245: ; preds = %231
%246 = call i32 @wait(i32* %18)
br label %247
247: ; preds = %245
br label %248
248: ; preds = %247, %230
br label %249
249: ; preds = %248, %190
br label %250
250: ; preds = %249, %150
br label %251
251: ; preds = %250, %110
br label %252
252: ; preds = %251, %87
br label %253
253: ; preds = %252, %70
br label %254
254: ; preds = %253, %40
br label %27
255: ; preds = %27
%256 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [22 x i8] c"(%d) Bryan's Shell $ \00"
@stdin = global i32 0
@.str.2 = [5 x i8] c"exit\00"
@.str.4 = [3 x i8] c"cd\00"
@.str.6 = [23 x i8] c"Directory NOT changed!\00"
@.str.7 = [14 x i8] c"Oh No! Error!\00"
@.str.8 = [3 x i8] c">>\00"
@.str.9 = [2 x i8] c"a\00"
@stdout = global i32 0
@.str.10 = [2 x i8] c">\00"
@.str.11 = [3 x i8] c"w+\00"
@.str.12 = [2 x i8] c"<\00"
@.str.13 = [2 x i8] c"r\00"
@str = [32 x i8] c"Directory changed successfully.\00"
@str.14 = [28 x i8] c"Shell now exiting. Goodbye!\00"
define i32 @main() {
%1 = alloca [512 x i8]
%2 = alloca [8 x i8]
%3 = alloca [50 x i8*]
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = getelementptr inbounds [512 x i8], [512 x i8]* %1, i64 0, i64 0
%10 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 0
%11 = bitcast [50 x i8*]* %3 to i8*
store i8 32, i8* %10
%12 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 1
store i8 9, i8* %12
%13 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 2
store i8 10, i8* %13
%14 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 3
store i8 40, i8* %14
%15 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 4
store i8 41, i8* %15
%16 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 5
store i8 124, i8* %16
%17 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 6
store i8 38, i8* %17
%18 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 7
store i8 59, i8* %18
%19 = getelementptr inbounds [50 x i8*], [50 x i8*]* %3, i64 0, i64 0
%20 = bitcast i32* %8 to i8*
%21 = bitcast i32* %7 to i8*
%22 = bitcast i32* %6 to i8*
%23 = bitcast i32* %5 to i8*
%24 = bitcast i32* %4 to i8*
%25 = getelementptr inbounds [50 x i8*], [50 x i8*]* %3, i64 0, i64 1
br label %26
26: ; preds = %33, %0
%27 = phi i32 [ 1, %0 ], [ %34, %33 ]
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %27)
%29 = load i32, i32* @stdin
%30 = call i32 @fgets(i8* %9, i32 512, i32 %29)
%31 = load i8, i8* %9
%32 = icmp eq i8 %31, 10
br i1 %32, label %33, label %35
33: ; preds = %26, %80, %129, %162, %152, %106, %63, %65
%34 = phi i32 [ %36, %63 ], [ %36, %65 ], [ %36, %80 ], [ %36, %106 ], [ %36, %129 ], [ %36, %152 ], [ %36, %162 ], [ %27, %26 ]
br label %26
35: ; preds = %26
%36 = add nsw i32 %27, 1
%37 = call i8* @strtok(i8* %9, i8* %10)
%38 = icmp eq i8* %37, null
br i1 %38, label %48, label %39
39: ; preds = %35, %39
%40 = phi i64 [ %43, %39 ], [ 0, %35 ]
%41 = phi i8* [ %44, %39 ], [ %37, %35 ]
%42 = getelementptr inbounds [50 x i8*], [50 x i8*]* %3, i64 0, i64 %40
store i8* %41, i8** %42
%43 = add nuw i64 %40, 1
%44 = call i8* @strtok(i8* null, i8* %10)
%45 = icmp eq i8* %44, null
br i1 %45, label %46, label %39
46: ; preds = %39
%47 = trunc i64 %43 to i32
br label %48
48: ; preds = %46, %35
%49 = phi i32 [ 0, %35 ], [ %47, %46 ]
%50 = zext i32 %49 to i64
%51 = getelementptr inbounds [50 x i8*], [50 x i8*]* %3, i64 0, i64 %50
store i8* null, i8** %51
%52 = add nsw i32 %49, -2
%53 = load i8*, i8** %19
%54 = call i64 @strncmp(i8* %53, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 4)
%55 = icmp eq i64 %54, 0
br i1 %55, label %164, label %56
56: ; preds = %48
%57 = call i64 @strncmp(i8* %53, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 2)
%58 = icmp eq i64 %57, 0
br i1 %58, label %59, label %67
59: ; preds = %56
%60 = load i8*, i8** %25
%61 = call i32 @chdir(i8* %60)
%62 = icmp eq i32 %61, 0
br i1 %62, label %63, label %65
63: ; preds = %59
%64 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
br label %33
65: ; preds = %59
%66 = call i32 @perror(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0))
br label %33
67: ; preds = %56
%68 = add nsw i32 %49, -1
%69 = icmp ult i32 %68, 2
br i1 %69, label %70, label %82
70: ; preds = %67
%71 = call i64 (...) @fork()
%72 = icmp eq i64 %71, 0
br i1 %72, label %73, label %80
73: ; preds = %70
%74 = call i32 @execvp(i8* %53, i8** %19)
%75 = icmp eq i32 %74, -1
br i1 %75, label %76, label %78
76: ; preds = %73
%77 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0))
br label %78
78: ; preds = %76, %73
%79 = call i32 @exit(i32 0)
unreachable
80: ; preds = %70
%81 = call i32 @wait(i32* %4)
br label %33
82: ; preds = %67
%83 = sext i32 %52 to i64
%84 = getelementptr inbounds [50 x i8*], [50 x i8*]* %3, i64 0, i64 %83
%85 = load i8*, i8** %84
%86 = call i64 @strncmp(i8* %85, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i32 2)
%87 = icmp eq i64 %86, 0
br i1 %87, label %88, label %108
88: ; preds = %82
%89 = call i64 (...) @fork()
%90 = icmp eq i64 %89, 0
br i1 %90, label %91, label %106
91: ; preds = %88
%92 = getelementptr inbounds [50 x i8*], [50 x i8*]* %3, i64 0, i64 %83
%93 = sext i32 %68 to i64
%94 = getelementptr inbounds [50 x i8*], [50 x i8*]* %3, i64 0, i64 %93
%95 = load i8*, i8** %94
%96 = load i32, i32* @stdout
%97 = call i32* @freopen(i8* %95, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0), i32 %96)
store i8* null, i8** %94
store i8* null, i8** %92
%98 = load i8*, i8** %19
%99 = call i32 @execvp(i8* %98, i8** %19)
%100 = icmp eq i32 %99, -1
br i1 %100, label %101, label %103
101: ; preds = %91
%102 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0))
br label %103
103: ; preds = %101, %91
%104 = call i32 @fclose(i32* %97)
%105 = call i32 @exit(i32 0)
unreachable
106: ; preds = %88
%107 = call i32 @wait(i32* %5)
br label %33
108: ; preds = %82
%109 = call i64 @strncmp(i8* %85, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0), i32 1)
%110 = icmp eq i64 %109, 0
br i1 %110, label %111, label %131
111: ; preds = %108
%112 = call i64 (...) @fork()
%113 = icmp eq i64 %112, 0
br i1 %113, label %114, label %129
114: ; preds = %111
%115 = getelementptr inbounds [50 x i8*], [50 x i8*]* %3, i64 0, i64 %83
%116 = sext i32 %68 to i64
%117 = getelementptr inbounds [50 x i8*], [50 x i8*]* %3, i64 0, i64 %116
%118 = load i8*, i8** %117
%119 = load i32, i32* @stdout
%120 = call i32* @freopen(i8* %118, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0), i32 %119)
store i8* null, i8** %117
store i8* null, i8** %115
%121 = load i8*, i8** %19
%122 = call i32 @execvp(i8* %121, i8** %19)
%123 = icmp eq i32 %122, -1
br i1 %123, label %124, label %126
124: ; preds = %114
%125 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0))
br label %126
126: ; preds = %124, %114
%127 = call i32 @fclose(i32* %120)
%128 = call i32 @exit(i32 0)
unreachable
129: ; preds = %111
%130 = call i32 @wait(i32* %6)
br label %33
131: ; preds = %108
%132 = call i64 @strncmp(i8* %85, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i64 0, i64 0), i32 1)
%133 = icmp eq i64 %132, 0
%134 = call i64 (...) @fork()
%135 = icmp eq i64 %134, 0
br i1 %133, label %136, label %154
136: ; preds = %131
br i1 %135, label %137, label %152
137: ; preds = %136
%138 = getelementptr inbounds [50 x i8*], [50 x i8*]* %3, i64 0, i64 %83
%139 = sext i32 %68 to i64
%140 = getelementptr inbounds [50 x i8*], [50 x i8*]* %3, i64 0, i64 %139
%141 = load i8*, i8** %140
%142 = load i32, i32* @stdin
%143 = call i32* @freopen(i8* %141, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.13, i64 0, i64 0), i32 %142)
store i8* null, i8** %140
store i8* null, i8** %138
%144 = load i8*, i8** %19
%145 = call i32 @execvp(i8* %144, i8** %19)
%146 = icmp eq i32 %145, -1
br i1 %146, label %147, label %149
147: ; preds = %137
%148 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0))
br label %149
149: ; preds = %147, %137
%150 = call i32 @fclose(i32* %143)
%151 = call i32 @exit(i32 0)
unreachable
152: ; preds = %136
%153 = call i32 @wait(i32* %7)
br label %33
154: ; preds = %131
br i1 %135, label %155, label %162
155: ; preds = %154
%156 = call i32 @execvp(i8* %53, i8** %19)
%157 = icmp eq i32 %156, -1
br i1 %157, label %158, label %160
158: ; preds = %155
%159 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0))
br label %160
160: ; preds = %158, %155
%161 = call i32 @exit(i32 0)
unreachable
162: ; preds = %154
%163 = call i32 @wait(i32* %8)
br label %33
164: ; preds = %48
%165 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.14, i64 0, i64 0))
%166 = call i32 @exit(i32 0)
unreachable
}