#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 atoi(char *);
int exec(char *, int, char **);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ halt();
int join(int, int *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ strcat(char *, char *);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int tokenizeCommand(char *, int, char **, char *);
void runline(char *line) {
  int pid, background, status;
  char args[64], prog[64];
  char *argv[16];
  int argc = tokenizeCommand(line, 16, argv, args);
  if (argc <= 0)
    return;
  if (argc > 0 && strcmp(argv[argc - 1], "&") == 0) {
    argc--;
    background = 1;
  } else {
    background = 0;
  }
  if (argc > 0) {
    if (strcmp(argv[0], "exit") == 0) {
      if (argc == 1) {
        exit(0);
      } else if (argc == 2) {
        exit(atoi(argv[1]));
      } else {
        printf("exit: Expression Syntax.\n");
        return;
      }
    } else if (strcmp(argv[0], "halt") == 0) {
      if (argc == 1) {
        halt();
        printf("Not the root process!\n");
      } else {
        printf("halt: Expression Syntax.\n");
      }
      return;
    } else if (strcmp(argv[0], "join") == 0) {
      if (argc == 2) {
        pid = atoi(argv[1]);
      } else {
        printf("join: Expression Syntax.\n");
        return;
      }
    } else {
      strcpy(prog, argv[0]);
      strcat(prog, ".coff");
      pid = exec(prog, argc, argv);
      if (pid == -1) {
        printf("%s: exec failed.\n", argv[0]);
        return;
      }
    }
    if (!background) {
      switch (join(pid, &status)) {
      case -1:
        printf("join: Invalid process ID.\n");
        break;
      case 0:
        printf("\n[%d] Unhandled exception\n", pid);
        break;
      case 1:
        printf("\n[%d] Done (%d)\n", pid, status);
        break;
      }
    } else {
      printf("\n[%d]\n", pid);
    }
  }
}


x86 assembly (clang, -O0):
<runline>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x120(%rbp),%rdx
lea    -0x60(%rbp),%rcx
mov    $0x10,%esi
call   1030 <tokenizeCommand@plt>
mov    %eax,-0x124(%rbp)
cmpl   $0x0,-0x124(%rbp)
jg     11e0 <runline+0x40>
jmp    1476 <runline+0x2d6>
cmpl   $0x0,-0x124(%rbp)
jle    1231 <runline+0x91>
mov    -0x124(%rbp),%eax
sub    $0x1,%eax
cltq
mov    -0x120(%rbp,%rax,8),%rdi
ff
lea    0xdf9(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    1231 <runline+0x91>
mov    -0x124(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x124(%rbp)
movl   $0x1,-0x10(%rbp)
jmp    1238 <runline+0x98>
movl   $0x0,-0x10(%rbp)
cmpl   $0x0,-0x124(%rbp)
jle    1476 <runline+0x2d6>
mov    -0x120(%rbp),%rdi
lea    0xdaf(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    12a9 <runline+0x109>
cmpl   $0x1,-0x124(%rbp)
jne    1276 <runline+0xd6>
xor    %edi,%edi
call   10a0 <exit@plt>
cmpl   $0x2,-0x124(%rbp)
jne    1296 <runline+0xf6>
mov    -0x118(%rbp),%rdi
call   1080 <atoi@plt>
mov    %eax,%edi
call   10a0 <exit@plt>
lea    0xd6a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1476 <runline+0x2d6>
mov    -0x120(%rbp),%rdi
lea    0xd6a(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    1300 <runline+0x160>
cmpl   $0x1,-0x124(%rbp)
jne    12ed <runline+0x14d>
mov    $0x0,%al
call   1070 <halt@plt>
lea    0xd45(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    12fb <runline+0x15b>
lea    0xd49(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1476 <runline+0x2d6>
mov    -0x120(%rbp),%rdi
lea    0xd49(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    1356 <runline+0x1b6>
cmpl   $0x2,-0x124(%rbp)
jne    133e <runline+0x19e>
mov    -0x118(%rbp),%rdi
call   1080 <atoi@plt>
mov    %eax,-0xc(%rbp)
jmp    1351 <runline+0x1b1>
lea    0xd17(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1476 <runline+0x2d6>
jmp    13c1 <runline+0x221>
lea    -0xa0(%rbp),%rdi
mov    -0x120(%rbp),%rsi
call   1040 <strcpy@plt>
lea    -0xa0(%rbp),%rdi
lea    0xcff(%rip),%rsi
call   1090 <strcat@plt>
lea    -0xa0(%rbp),%rdi
mov    -0x124(%rbp),%esi
lea    -0x120(%rbp),%rdx
call   10c0 <exec@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0xffffffff,-0xc(%rbp)
jne    13bc <runline+0x21c>
mov    -0x120(%rbp),%rsi
lea    0xccc(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1476 <runline+0x2d6>
jmp    13c1 <runline+0x221>
jmp    13c6 <runline+0x226>
jmp    13cb <runline+0x22b>
cmpl   $0x0,-0x10(%rbp)
jne    1460 <runline+0x2c0>
mov    -0xc(%rbp),%edi
lea    -0x14(%rbp),%rsi
call   10b0 <join@plt>
mov    %eax,%ecx
mov    %ecx,-0x128(%rbp)
sub    $0xffffffff,%eax
je     141e <runline+0x27e>
jmp    13f7 <runline+0x257>
mov    -0x128(%rbp),%eax
test   %eax,%eax
je     1431 <runline+0x291>
jmp    140a <runline+0x26a>
mov    -0x128(%rbp),%eax
sub    $0x1,%eax
je     1447 <runline+0x2a7>
jmp    145b <runline+0x2bb>
lea    0xc69(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    145b <runline+0x2bb>
mov    -0xc(%rbp),%esi
lea    0xc6e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    145b <runline+0x2bb>
mov    -0xc(%rbp),%esi
mov    -0x14(%rbp),%edx
lea    0xc70(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1471 <runline+0x2d1>
mov    -0xc(%rbp),%esi
lea    0xc6b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1476 <runline+0x2d6>
add    $0x130,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<runline>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x118,%rsp
lea    0x10(%rsp),%rdx
lea    0xd0(%rsp),%rcx
mov    $0x10,%esi
call   1030 <tokenizeCommand@plt>
test   %eax,%eax
jle    1377 <runline+0x1c7>
mov    %eax,%r12d
lea    -0x1(%r12),%ebx
mov    0x10(%rsp,%rbx,8),%rdi
lea    0xe0f(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
cmove  %ebx,%r12d
test   %r12d,%r12d
je     1377 <runline+0x1c7>
mov    %rax,%r14
mov    0x10(%rsp),%rdi
lea    0xded(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     12aa <runline+0xfa>
mov    0x10(%rsp),%rdi
lea    0xdd8(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     12cf <runline+0x11f>
mov    0x10(%rsp),%rdi
lea    0xdc3(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     12ed <runline+0x13d>
mov    0x10(%rsp),%rsi
lea    0x90(%rsp),%r15
mov    %r15,%rdi
call   1040 <strcpy@plt>
lea    0xd9e(%rip),%rsi
mov    %r15,%rdi
call   10a0 <strcat@plt>
lea    0x10(%rsp),%rdx
mov    %r15,%rdi
mov    %r12d,%esi
call   10d0 <exec@plt>
mov    %eax,%ebx
cmp    $0xffffffff,%eax
jne    12ff <runline+0x14f>
mov    0x10(%rsp),%rsi
lea    0xd79(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
jmp    1377 <runline+0x1c7>
cmp    $0x2,%r12d
je     1386 <runline+0x1d6>
cmp    $0x1,%r12d
je     1397 <runline+0x1e7>
lea    0xdf9(%rip),%rdi
call   1050 <puts@plt>
jmp    1377 <runline+0x1c7>
cmp    $0x1,%r12d
jne    132c <runline+0x17c>
xor    %eax,%eax
call   1080 <halt@plt>
lea    0xdc5(%rip),%rdi
call   1050 <puts@plt>
jmp    1377 <runline+0x1c7>
cmp    $0x2,%r12d
jne    1343 <runline+0x193>
mov    0x18(%rsp),%rdi
call   1090 <atoi@plt>
mov    %eax,%ebx
test   %r14,%r14
je     133a <runline+0x18a>
lea    0xc(%rsp),%rsi
mov    %ebx,%edi
call   10c0 <join@plt>
cmp    $0x1,%eax
je     1351 <runline+0x1a1>
test   %eax,%eax
je     1367 <runline+0x1b7>
cmp    $0xffffffff,%eax
jne    1377 <runline+0x1c7>
lea    0xd37(%rip),%rdi
call   1050 <puts@plt>
jmp    1377 <runline+0x1c7>
lea    0xd5c(%rip),%rdi
call   1050 <puts@plt>
jmp    1377 <runline+0x1c7>
lea    0xd14(%rip),%rdi
jmp    136e <runline+0x1be>
lea    0xd2c(%rip),%rdi
call   1050 <puts@plt>
jmp    1377 <runline+0x1c7>
mov    0xc(%rsp),%edx
lea    0xce8(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1060 <printf@plt>
jmp    1377 <runline+0x1c7>
lea    0xcbb(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1060 <printf@plt>
add    $0x118,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
mov    0x18(%rsp),%rdi
call   1090 <atoi@plt>
mov    %eax,%edi
call   10b0 <exit@plt>
xor    %edi,%edi
call   10b0 <exit@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"&\00"
@.str.1 = [5 x i8] c"exit\00"
@.str.2 = [26 x i8] c"exit: Expression Syntax.\0A\00"
@.str.3 = [5 x i8] c"halt\00"
@.str.4 = [23 x i8] c"Not the root process!\0A\00"
@.str.5 = [26 x i8] c"halt: Expression Syntax.\0A\00"
@.str.6 = [5 x i8] c"join\00"
@.str.7 = [26 x i8] c"join: Expression Syntax.\0A\00"
@.str.8 = [6 x i8] c".coff\00"
@.str.9 = [18 x i8] c"%s: exec failed.\0A\00"
@.str.10 = [27 x i8] c"join: Invalid process ID.\0A\00"
@.str.11 = [27 x i8] c"\0A[%d] Unhandled exception\0A\00"
@.str.12 = [17 x i8] c"\0A[%d] Done (%d)\0A\00"
@.str.13 = [7 x i8] c"\0A[%d]\0A\00"
define void @runline(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca [64 x i8]
%7 = alloca [64 x i8]
%8 = alloca [16 x i8*]
%9 = alloca i32
store i8* %0, i8** %2
%10 = load i8*, i8** %2
%11 = getelementptr inbounds [16 x i8*], [16 x i8*]* %8, i64 0, i64 0
%12 = getelementptr inbounds [64 x i8], [64 x i8]* %6, i64 0, i64 0
%13 = call i32 @tokenizeCommand(i8* %10, i32 16, i8** %11, i8* %12)
store i32 %13, i32* %9
%14 = load i32, i32* %9
%15 = icmp sle i32 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %1
br label %124
17: ; preds = %1
%18 = load i32, i32* %9
%19 = icmp sgt i32 %18, 0
br i1 %19, label %20, label %31
20: ; preds = %17
%21 = load i32, i32* %9
%22 = sub nsw i32 %21, 1
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [16 x i8*], [16 x i8*]* %8, i64 0, i64 %23
%25 = load i8*, i8** %24
%26 = call i64 @strcmp(i8* %25, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%27 = icmp eq i64 %26, 0
br i1 %27, label %28, label %31
28: ; preds = %20
%29 = load i32, i32* %9
%30 = add nsw i32 %29, -1
store i32 %30, i32* %9
store i32 1, i32* %4
br label %32
31: ; preds = %20, %17
store i32 0, i32* %4
br label %32
32: ; preds = %31, %28
%33 = load i32, i32* %9
%34 = icmp sgt i32 %33, 0
br i1 %34, label %35, label %124
35: ; preds = %32
%36 = getelementptr inbounds [16 x i8*], [16 x i8*]* %8, i64 0, i64 0
%37 = load i8*, i8** %36
%38 = call i64 @strcmp(i8* %37, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%39 = icmp eq i64 %38, 0
br i1 %39, label %40, label %55
40: ; preds = %35
%41 = load i32, i32* %9
%42 = icmp eq i32 %41, 1
br i1 %42, label %43, label %45
43: ; preds = %40
%44 = call i32 @exit(i32 0)
unreachable
45: ; preds = %40
%46 = load i32, i32* %9
%47 = icmp eq i32 %46, 2
br i1 %47, label %48, label %53
48: ; preds = %45
%49 = getelementptr inbounds [16 x i8*], [16 x i8*]* %8, i64 0, i64 1
%50 = load i8*, i8** %49
%51 = call i32 @atoi(i8* %50)
%52 = call i32 @exit(i32 %51)
unreachable
53: ; preds = %45
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
br label %124
55: ; preds = %35
%56 = getelementptr inbounds [16 x i8*], [16 x i8*]* %8, i64 0, i64 0
%57 = load i8*, i8** %56
%58 = call i64 @strcmp(i8* %57, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%59 = icmp eq i64 %58, 0
br i1 %59, label %60, label %69
60: ; preds = %55
%61 = load i32, i32* %9
%62 = icmp eq i32 %61, 1
br i1 %62, label %63, label %66
63: ; preds = %60
%64 = call i32 (...) @halt()
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0))
br label %68
66: ; preds = %60
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0))
br label %68
68: ; preds = %66, %63
br label %124
69: ; preds = %55
%70 = getelementptr inbounds [16 x i8*], [16 x i8*]* %8, i64 0, i64 0
%71 = load i8*, i8** %70
%72 = call i64 @strcmp(i8* %71, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%73 = icmp eq i64 %72, 0
br i1 %73, label %74, label %84
74: ; preds = %69
%75 = load i32, i32* %9
%76 = icmp eq i32 %75, 2
br i1 %76, label %77, label %81
77: ; preds = %74
%78 = getelementptr inbounds [16 x i8*], [16 x i8*]* %8, i64 0, i64 1
%79 = load i8*, i8** %78
%80 = call i32 @atoi(i8* %79)
store i32 %80, i32* %3
br label %83
81: ; preds = %74
%82 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.7, i64 0, i64 0))
br label %124
83: ; preds = %77
br label %102
84: ; preds = %69
%85 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 0
%86 = getelementptr inbounds [16 x i8*], [16 x i8*]* %8, i64 0, i64 0
%87 = load i8*, i8** %86
%88 = call i32 @strcpy(i8* %85, i8* %87)
%89 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 0
%90 = call i32 @strcat(i8* %89, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
%91 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 0
%92 = load i32, i32* %9
%93 = getelementptr inbounds [16 x i8*], [16 x i8*]* %8, i64 0, i64 0
%94 = call i32 @exec(i8* %91, i32 %92, i8** %93)
store i32 %94, i32* %3
%95 = load i32, i32* %3
%96 = icmp eq i32 %95, -1
br i1 %96, label %97, label %101
97: ; preds = %84
%98 = getelementptr inbounds [16 x i8*], [16 x i8*]* %8, i64 0, i64 0
%99 = load i8*, i8** %98
%100 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.9, i64 0, i64 0), i8* %99)
br label %124
101: ; preds = %84
br label %102
102: ; preds = %101, %83
br label %103
103: ; preds = %102
br label %104
104: ; preds = %103
%105 = load i32, i32* %4
%106 = icmp ne i32 %105, 0
br i1 %106, label %120, label %107
107: ; preds = %104
%108 = load i32, i32* %3
%109 = call i32 @join(i32 %108, i32* %5)
switch i32 %109, label %119 [
i32 -1, label %110
i32 0, label %112
i32 1, label %115
]
110: ; preds = %107
%111 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.10, i64 0, i64 0))
br label %119
112: ; preds = %107
%113 = load i32, i32* %3
%114 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.11, i64 0, i64 0), i32 %113)
br label %119
115: ; preds = %107
%116 = load i32, i32* %3
%117 = load i32, i32* %5
%118 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.12, i64 0, i64 0), i32 %116, i32 %117)
br label %119
119: ; preds = %107, %115, %112, %110
br label %123
120: ; preds = %104
%121 = load i32, i32* %3
%122 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.13, i64 0, i64 0), i32 %121)
br label %123
123: ; preds = %120, %119
br label %124
124: ; preds = %16, %53, %68, %81, %97, %123, %32
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"&\00"
@.str.1 = [5 x i8] c"exit\00"
@.str.3 = [5 x i8] c"halt\00"
@.str.6 = [5 x i8] c"join\00"
@.str.8 = [6 x i8] c".coff\00"
@.str.9 = [18 x i8] c"%s: exec failed.\0A\00"
@.str.11 = [27 x i8] c"\0A[%d] Unhandled exception\0A\00"
@.str.12 = [17 x i8] c"\0A[%d] Done (%d)\0A\00"
@.str.13 = [7 x i8] c"\0A[%d]\0A\00"
@str = [26 x i8] c"join: Invalid process ID.\00"
@str.14 = [25 x i8] c"join: Expression Syntax.\00"
@str.15 = [25 x i8] c"halt: Expression Syntax.\00"
@str.16 = [22 x i8] c"Not the root process!\00"
@str.17 = [25 x i8] c"exit: Expression Syntax.\00"
define void @runline(i8* %0) {
%2 = alloca i32
%3 = alloca [64 x i8]
%4 = alloca [64 x i8]
%5 = alloca [16 x i8*]
%6 = bitcast i32* %2 to i8*
%7 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%8 = getelementptr inbounds [64 x i8], [64 x i8]* %4, i64 0, i64 0
%9 = bitcast [16 x i8*]* %5 to i8*
%10 = getelementptr inbounds [16 x i8*], [16 x i8*]* %5, i64 0, i64 0
%11 = call i32 @tokenizeCommand(i8* %0, i32 16, i8** %10, i8* %7)
%12 = icmp slt i32 %11, 1
br i1 %12, label %81, label %13
13: ; preds = %1
%14 = add nsw i32 %11, -1
%15 = zext i32 %14 to i64
%16 = getelementptr inbounds [16 x i8*], [16 x i8*]* %5, i64 0, i64 %15
%17 = load i8*, i8** %16
%18 = call i64 @strcmp(i8* %17, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%19 = icmp eq i64 %18, 0
%20 = select i1 %19, i32 %14, i32 %11
%21 = icmp eq i32 %20, 0
br i1 %21, label %81, label %22
22: ; preds = %13
%23 = load i8*, i8** %10
%24 = call i64 @strcmp(i8* %23, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%25 = icmp eq i64 %24, 0
br i1 %25, label %26, label %36
26: ; preds = %22
switch i32 %20, label %34 [
i32 1, label %27
i32 2, label %29
]
27: ; preds = %26
%28 = call i32 @exit(i32 0)
unreachable
29: ; preds = %26
%30 = getelementptr inbounds [16 x i8*], [16 x i8*]* %5, i64 0, i64 1
%31 = load i8*, i8** %30
%32 = call i32 @atoi(i8* %31)
%33 = call i32 @exit(i32 %32)
unreachable
34: ; preds = %26
%35 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.17, i64 0, i64 0))
br label %81
36: ; preds = %22
%37 = load i8*, i8** %10
%38 = call i64 @strcmp(i8* %37, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%39 = icmp eq i64 %38, 0
br i1 %39, label %40, label %47
40: ; preds = %36
%41 = icmp eq i32 %20, 1
br i1 %41, label %42, label %45
42: ; preds = %40
%43 = call i32 (...) @halt()
%44 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.16, i64 0, i64 0))
br label %81
45: ; preds = %40
%46 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.15, i64 0, i64 0))
br label %81
47: ; preds = %36
%48 = load i8*, i8** %10
%49 = call i64 @strcmp(i8* %48, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%50 = icmp eq i64 %49, 0
br i1 %50, label %51, label %59
51: ; preds = %47
%52 = icmp eq i32 %20, 2
br i1 %52, label %53, label %57
53: ; preds = %51
%54 = getelementptr inbounds [16 x i8*], [16 x i8*]* %5, i64 0, i64 1
%55 = load i8*, i8** %54
%56 = call i32 @atoi(i8* %55)
br label %68
57: ; preds = %51
%58 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.14, i64 0, i64 0))
br label %81
59: ; preds = %47
%60 = load i8*, i8** %10
%61 = call i32 @strcpy(i8* %8, i8* %60)
%62 = call i32 @strcat(i8* %8, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
%63 = call i32 @exec(i8* %8, i32 %20, i8** %10)
%64 = icmp eq i32 %63, -1
br i1 %64, label %65, label %68
65: ; preds = %59
%66 = load i8*, i8** %10
%67 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.9, i64 0, i64 0), i8* %66)
br label %81
68: ; preds = %59, %53
%69 = phi i32 [ %56, %53 ], [ %63, %59 ]
br i1 %19, label %79, label %70
70: ; preds = %68
%71 = call i32 @join(i32 %69, i32* %2)
switch i32 %71, label %81 [
i32 -1, label %72
i32 0, label %74
i32 1, label %76
]
72: ; preds = %70
%73 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
br label %81
74: ; preds = %70
%75 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.11, i64 0, i64 0), i32 %69)
br label %81
76: ; preds = %70
%77 = load i32, i32* %2
%78 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.12, i64 0, i64 0), i32 %69, i32 %77)
br label %81
79: ; preds = %68
%80 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.13, i64 0, i64 0), i32 %69)
br label %81
81: ; preds = %13, %72, %74, %76, %70, %79, %42, %45, %1, %65, %57, %34
ret void
}