#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 BUFSIZ;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ dup2(int, int);
int /*<<< orphan*/ execvp(char *, char **);
int /*<<< orphan*/ exit(int);
scalar_t__ fork();
int /*<<< orphan*/ perror(char *);
int pipe(int *);
char *strtok_r(char *, char const *, char **);
int /*<<< orphan*/ wait(int /*<<< orphan*/);
int main(int argc, char **argv) {
  char line[] = "ls -l";
  char *args[BUFSIZ];
  char *pipes[BUFSIZ];
  int pipen = 0;
  int argn = 0;
  char *save;
  char *s;
  int des_p[10];
  static const char delim_pipe[] = "|";
  static const char delim[] = " \t\n";
  int i, j;
  s = strtok_r(line, delim_pipe, &save);
  while (s != NULL) {
    pipes[pipen++] = s;
    s = strtok_r(NULL, delim_pipe, &save);
  }
  for (i = 0; i < pipen; i++) {
    if (pipe(des_p + i * 2) == -1) {
      perror("Pipe failed");
      exit(1);
    }
  }
  for (i = 0; i < pipen; i++) {
    if (fork() == 0) {
      if (i != 0) {
        close(0);
        dup2(des_p[(i - 1) * 2], 0);
      }
      if (i != pipen - 1) {
        close(1);
        dup2(des_p[i * 2 + 1], 1);
      }
      for (j = 0; j < pipen * 2; j++)
        close(des_p[j]);
      s = strtok_r(pipes[i], delim, &save);
      if (s == NULL) {
        exit(1);
      }
      while (s != NULL) {
        args[argn++] = s;
        s = strtok_r(NULL, delim, &save);
      }
      args[argn] = s;
      execvp(args[0], args);
      perror("execvp of ls failed");
      exit(1);
    }
  }
  for (j = 0; j < pipen * 2; j++)
    close(des_p[j]);
  wait(0);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movw   $0x6c,-0x14(%rbp)
movl   $0x2d20736c,-0x18(%rbp)
mov    0x2e23(%rip),%rax
mov    (%rax),%ecx
mov    %rsp,%rdx
mov    %rdx,-0x20(%rbp)
lea    0xf(,%rcx,8),%rsi
and    $0xfffffffffffffff0,%rsi
mov    %rsp,%rdx
sub    %rsi,%rdx
mov    %rdx,-0x88(%rbp)
mov    %rdx,%rsp
mov    %rcx,-0x28(%rbp)
mov    (%rax),%eax
lea    0xf(,%rax,8),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x80(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
movl   $0x0,-0x38(%rbp)
lea    -0x18(%rbp),%rdi
lea    0xe08(%rip),%rsi
lea    -0x40(%rbp),%rdx
call   1060 <strtok_r@plt>
mov    %rax,-0x48(%rbp)
cmpq   $0x0,-0x48(%rbp)
je     126d <main+0xdd>
mov    -0x80(%rbp),%rax
mov    -0x48(%rbp),%rdx
mov    -0x34(%rbp),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    %esi,-0x34(%rbp)
movslq %ecx,%rcx
mov    %rdx,(%rax,%rcx,8)
xor    %eax,%eax
mov    %eax,%edi
lea    0xdcb(%rip),%rsi
lea    -0x40(%rbp),%rdx
call   1060 <strtok_r@plt>
mov    %rax,-0x48(%rbp)
jmp    122b <main+0x9b>
movl   $0x0,-0x74(%rbp)
mov    -0x74(%rbp),%eax
cmp    -0x34(%rbp),%eax
jge    12ca <main+0x13a>
lea    -0x70(%rbp),%rdi
mov    -0x74(%rbp),%eax
shl    $0x1,%eax
cltq
shl    $0x2,%rax
add    %rax,%rdi
call   1050 <pipe@plt>
cmp    $0xffffffff,%eax
jne    12b7 <main+0x127>
lea    0xd5e(%rip),%rdi
call   1070 <perror@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
jmp    12bc <main+0x12c>
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    1274 <main+0xe4>
movl   $0x0,-0x74(%rbp)
mov    -0x74(%rbp),%eax
cmp    -0x34(%rbp),%eax
jge    143f <main+0x2af>
mov    $0x0,%al
call   10b0 <fork@plt>
cmp    $0x0,%rax
jne    142c <main+0x29c>
cmpl   $0x0,-0x74(%rbp)
je     1315 <main+0x185>
xor    %edi,%edi
call   1040 <close@plt>
mov    -0x74(%rbp),%eax
sub    $0x1,%eax
shl    $0x1,%eax
cltq
mov    -0x70(%rbp,%rax,4),%edi
xor    %esi,%esi
call   1030 <dup2@plt>
mov    -0x74(%rbp),%eax
mov    -0x34(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
je     1349 <main+0x1b9>
mov    $0x1,%edi
call   1040 <close@plt>
mov    -0x74(%rbp),%eax
shl    $0x1,%eax
add    $0x1,%eax
cltq
mov    -0x70(%rbp,%rax,4),%edi
mov    $0x1,%esi
call   1030 <dup2@plt>
movl   $0x0,-0x78(%rbp)
mov    -0x78(%rbp),%eax
mov    -0x34(%rbp),%ecx
shl    $0x1,%ecx
cmp    %ecx,%eax
jge    137c <main+0x1ec>
movslq -0x78(%rbp),%rax
mov    -0x70(%rbp,%rax,4),%edi
call   1040 <close@plt>
mov    -0x78(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x78(%rbp)
jmp    1350 <main+0x1c0>
mov    -0x80(%rbp),%rax
movslq -0x74(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xc99(%rip),%rsi
lea    -0x40(%rbp),%rdx
call   1060 <strtok_r@plt>
mov    %rax,-0x48(%rbp)
cmpq   $0x0,-0x48(%rbp)
jne    13b1 <main+0x221>
mov    $0x1,%edi
call   1090 <exit@plt>
jmp    13b6 <main+0x226>
cmpq   $0x0,-0x48(%rbp)
je     13fb <main+0x26b>
mov    -0x88(%rbp),%rax
mov    -0x48(%rbp),%rdx
mov    -0x38(%rbp),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    %esi,-0x38(%rbp)
movslq %ecx,%rcx
mov    %rdx,(%rax,%rcx,8)
xor    %eax,%eax
mov    %eax,%edi
lea    0xc3f(%rip),%rsi
lea    -0x40(%rbp),%rdx
call   1060 <strtok_r@plt>
mov    %rax,-0x48(%rbp)
jmp    13b6 <main+0x226>
mov    -0x88(%rbp),%rsi
mov    -0x48(%rbp),%rcx
movslq -0x38(%rbp),%rax
mov    %rcx,(%rsi,%rax,8)
mov    (%rsi),%rdi
call   1080 <execvp@plt>
lea    0xbf5(%rip),%rdi
call   1070 <perror@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
jmp    1431 <main+0x2a1>
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    12d1 <main+0x141>
movl   $0x0,-0x78(%rbp)
mov    -0x78(%rbp),%eax
mov    -0x34(%rbp),%ecx
shl    $0x1,%ecx
cmp    %ecx,%eax
jge    1472 <main+0x2e2>
movslq -0x78(%rbp),%rax
mov    -0x70(%rbp,%rax,4),%edi
call   1040 <close@plt>
mov    -0x78(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x78(%rbp)
jmp    1446 <main+0x2b6>
xor    %edi,%edi
call   10a0 <wait@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
mov    %rsp,-0x50(%rbp)
movw   $0x6c,-0x38(%rbp)
movl   $0x2d20736c,-0x3c(%rbp)
mov    0x2e27(%rip),%rax
mov    (%rax),%ecx
mov    %rsp,%rdx
lea    0xf(,%rcx,8),%rcx
and    $0xfffffffffffffff0,%rcx
sub    %rcx,%rdx
mov    %rdx,-0x48(%rbp)
mov    %rdx,%rsp
mov    (%rax),%eax
mov    %rsp,%r12
lea    0xf(,%rax,8),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r12
mov    %r12,%rsp
lea    0xe34(%rip),%rsi
lea    -0x3c(%rbp),%rdi
lea    -0x30(%rbp),%rdx
call   1060 <strtok_r@plt>
test   %rax,%rax
je     12d2 <main+0x142>
xor    %r13d,%r13d
lea    0xe14(%rip),%r15
lea    -0x30(%rbp),%rbx
xor    %r14d,%r14d
nopl   0x0(%rax)
mov    %rax,(%r12,%r13,4)
xor    %edi,%edi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1060 <strtok_r@plt>
add    $0xffffffff,%r14d
add    $0x2,%r13
test   %rax,%rax
jne    1220 <main+0x90>
test   %r14d,%r14d
je     12d2 <main+0x142>
mov    %r14d,%eax
neg    %eax
mov    %eax,-0x34(%rbp)
mov    %eax,%r15d
lea    -0x80(%rbp),%rbx
cs nopw 0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1050 <pipe@plt>
cmp    $0xffffffff,%eax
je     12ee <main+0x15e>
add    $0x8,%rbx
add    $0xffffffffffffffff,%r15
jne    1260 <main+0xd0>
test   %r14d,%r14d
je     12d2 <main+0x142>
mov    $0x1,%ebx
xor    %r15d,%r15d
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   10b0 <fork@plt>
test   %rax,%rax
je     12fa <main+0x16a>
add    $0x1,%r15
add    $0x2,%ebx
cmp    %r15d,-0x34(%rbp)
jne    1290 <main+0x100>
test   %r14d,%r14d
je     12d2 <main+0x142>
cmp    $0x2,%r13d
mov    $0x1,%r14d
cmovae %r13d,%r14d
xor    %ebx,%ebx
xchg   %ax,%ax
mov    -0x80(%rbp,%rbx,4),%edi
call   1040 <close@plt>
add    $0x1,%rbx
cmp    %rbx,%r14
jne    12c0 <main+0x130>
xor    %edi,%edi
call   10a0 <wait@plt>
mov    -0x50(%rbp),%rsp
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xd11(%rip),%rdi
jmp    13d7 <main+0x247>
test   %r15d,%r15d
je     1316 <main+0x186>
xor    %edi,%edi
call   1040 <close@plt>
lea    -0x3(%rbx),%eax
cltq
mov    -0x80(%rbp,%rax,4),%edi
xor    %esi,%esi
call   1030 <dup2@plt>
not    %r14d
cmp    %r15d,%r14d
je     1338 <main+0x1a8>
mov    $0x1,%edi
call   1040 <close@plt>
mov    %ebx,%eax
mov    -0x80(%rbp,%rax,4),%edi
mov    $0x1,%esi
call   1030 <dup2@plt>
cmp    $0x2,%r13d
mov    $0x1,%r14d
cmovae %r13d,%r14d
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    -0x80(%rbp,%rbx,4),%edi
call   1040 <close@plt>
add    $0x1,%rbx
cmp    %rbx,%r14
jne    1350 <main+0x1c0>
mov    (%r12,%r15,8),%rdi
lea    0xcbb(%rip),%rsi
lea    -0x30(%rbp),%rdx
call   1060 <strtok_r@plt>
test   %rax,%rax
jne    1385 <main+0x1f5>
mov    $0x1,%edi
call   1090 <exit@plt>
xor    %ebx,%ebx
lea    0xc9a(%rip),%r15
lea    -0x30(%rbp),%r14
mov    -0x48(%rbp),%r12
cs nopw 0x0(%rax,%rax,1)
mov    %rax,(%r12,%rbx,8)
add    $0x1,%rbx
xor    %edi,%edi
mov    %r15,%rsi
mov    %r14,%rdx
call   1060 <strtok_r@plt>
test   %rax,%rax
jne    13a0 <main+0x210>
mov    %ebx,%eax
movq   $0x0,(%r12,%rax,8)
mov    (%r12),%rdi
mov    %r12,%rsi
call   1080 <execvp@plt>
lea    0xc3b(%rip),%rdi
call   1070 <perror@plt>
mov    $0x1,%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@__const.main.line = [6 x i8] c"ls -l\00"
@BUFSIZ = global i32 0
@main.delim_pipe = internal constant [2 x i8] c"|\00"
@main.delim = internal constant [4 x i8] c" \09\0A\00"
@.str = [12 x i8] c"Pipe failed\00"
@.str.1 = [20 x i8] c"execvp of ls failed\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [6 x i8]
%7 = alloca i8*
%8 = alloca i64
%9 = alloca i64
%10 = alloca i32
%11 = alloca i32
%12 = alloca i8*
%13 = alloca i8*
%14 = alloca [10 x i32]
%15 = alloca i32
%16 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%17 = bitcast [6 x i8]* %6 to i8*
%18 = load i32, i32* @BUFSIZ
%19 = zext i32 %18 to i64
%20 = call i8* @llvm.stacksave()
store i8* %20, i8** %7
%21 = alloca i8*, i64 %19
store i64 %19, i64* %8
%22 = load i32, i32* @BUFSIZ
%23 = zext i32 %22 to i64
%24 = alloca i8*, i64 %23
store i64 %23, i64* %9
store i32 0, i32* %10
store i32 0, i32* %11
%25 = getelementptr inbounds [6 x i8], [6 x i8]* %6, i64 0, i64 0
%26 = call i8* @strtok_r(i8* %25, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @main.delim_pipe, i64 0, i64 0), i8** %12)
store i8* %26, i8** %13
br label %27
27: ; preds = %30, %2
%28 = load i8*, i8** %13
%29 = icmp ne i8* %28, null
br i1 %29, label %30, label %37
30: ; preds = %27
%31 = load i8*, i8** %13
%32 = load i32, i32* %10
%33 = add nsw i32 %32, 1
store i32 %33, i32* %10
%34 = sext i32 %32 to i64
%35 = getelementptr inbounds i8*, i8** %24, i64 %34
store i8* %31, i8** %35
%36 = call i8* @strtok_r(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @main.delim_pipe, i64 0, i64 0), i8** %12)
store i8* %36, i8** %13
br label %27
37: ; preds = %27
store i32 0, i32* %15
br label %38
38: ; preds = %54, %37
%39 = load i32, i32* %15
%40 = load i32, i32* %10
%41 = icmp slt i32 %39, %40
br i1 %41, label %42, label %57
42: ; preds = %38
%43 = getelementptr inbounds [10 x i32], [10 x i32]* %14, i64 0, i64 0
%44 = load i32, i32* %15
%45 = mul nsw i32 %44, 2
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds i32, i32* %43, i64 %46
%48 = call i32 @pipe(i32* %47)
%49 = icmp eq i32 %48, -1
br i1 %49, label %50, label %53
50: ; preds = %42
%51 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%52 = call i32 @exit(i32 1)
unreachable
53: ; preds = %42
br label %54
54: ; preds = %53
%55 = load i32, i32* %15
%56 = add nsw i32 %55, 1
store i32 %56, i32* %15
br label %38
57: ; preds = %38
store i32 0, i32* %15
br label %58
58: ; preds = %138, %57
%59 = load i32, i32* %15
%60 = load i32, i32* %10
%61 = icmp slt i32 %59, %60
br i1 %61, label %62, label %141
62: ; preds = %58
%63 = call i64 (...) @fork()
%64 = icmp eq i64 %63, 0
br i1 %64, label %65, label %137
65: ; preds = %62
%66 = load i32, i32* %15
%67 = icmp ne i32 %66, 0
br i1 %67, label %68, label %77
68: ; preds = %65
%69 = call i32 @close(i32 0)
%70 = load i32, i32* %15
%71 = sub nsw i32 %70, 1
%72 = mul nsw i32 %71, 2
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds [10 x i32], [10 x i32]* %14, i64 0, i64 %73
%75 = load i32, i32* %74
%76 = call i32 @dup2(i32 %75, i32 0)
br label %77
77: ; preds = %68, %65
%78 = load i32, i32* %15
%79 = load i32, i32* %10
%80 = sub nsw i32 %79, 1
%81 = icmp ne i32 %78, %80
br i1 %81, label %82, label %91
82: ; preds = %77
%83 = call i32 @close(i32 1)
%84 = load i32, i32* %15
%85 = mul nsw i32 %84, 2
%86 = add nsw i32 %85, 1
%87 = sext i32 %86 to i64
%88 = getelementptr inbounds [10 x i32], [10 x i32]* %14, i64 0, i64 %87
%89 = load i32, i32* %88
%90 = call i32 @dup2(i32 %89, i32 1)
br label %91
91: ; preds = %82, %77
store i32 0, i32* %16
br label %92
92: ; preds = %103, %91
%93 = load i32, i32* %16
%94 = load i32, i32* %10
%95 = mul nsw i32 %94, 2
%96 = icmp slt i32 %93, %95
br i1 %96, label %97, label %106
97: ; preds = %92
%98 = load i32, i32* %16
%99 = sext i32 %98 to i64
%100 = getelementptr inbounds [10 x i32], [10 x i32]* %14, i64 0, i64 %99
%101 = load i32, i32* %100
%102 = call i32 @close(i32 %101)
br label %103
103: ; preds = %97
%104 = load i32, i32* %16
%105 = add nsw i32 %104, 1
store i32 %105, i32* %16
br label %92
106: ; preds = %92
%107 = load i32, i32* %15
%108 = sext i32 %107 to i64
%109 = getelementptr inbounds i8*, i8** %24, i64 %108
%110 = load i8*, i8** %109
%111 = call i8* @strtok_r(i8* %110, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @main.delim, i64 0, i64 0), i8** %12)
store i8* %111, i8** %13
%112 = load i8*, i8** %13
%113 = icmp eq i8* %112, null
br i1 %113, label %114, label %116
114: ; preds = %106
%115 = call i32 @exit(i32 1)
unreachable
116: ; preds = %106
br label %117
117: ; preds = %120, %116
%118 = load i8*, i8** %13
%119 = icmp ne i8* %118, null
br i1 %119, label %120, label %127
120: ; preds = %117
%121 = load i8*, i8** %13
%122 = load i32, i32* %11
%123 = add nsw i32 %122, 1
store i32 %123, i32* %11
%124 = sext i32 %122 to i64
%125 = getelementptr inbounds i8*, i8** %21, i64 %124
store i8* %121, i8** %125
%126 = call i8* @strtok_r(i8* null, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @main.delim, i64 0, i64 0), i8** %12)
store i8* %126, i8** %13
br label %117
127: ; preds = %117
%128 = load i8*, i8** %13
%129 = load i32, i32* %11
%130 = sext i32 %129 to i64
%131 = getelementptr inbounds i8*, i8** %21, i64 %130
store i8* %128, i8** %131
%132 = getelementptr inbounds i8*, i8** %21, i64 0
%133 = load i8*, i8** %132
%134 = call i32 @execvp(i8* %133, i8** %21)
%135 = call i32 @perror(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
%136 = call i32 @exit(i32 1)
unreachable
137: ; preds = %62
br label %138
138: ; preds = %137
%139 = load i32, i32* %15
%140 = add nsw i32 %139, 1
store i32 %140, i32* %15
br label %58
141: ; preds = %58
store i32 0, i32* %16
br label %142
142: ; preds = %153, %141
%143 = load i32, i32* %16
%144 = load i32, i32* %10
%145 = mul nsw i32 %144, 2
%146 = icmp slt i32 %143, %145
br i1 %146, label %147, label %156
147: ; preds = %142
%148 = load i32, i32* %16
%149 = sext i32 %148 to i64
%150 = getelementptr inbounds [10 x i32], [10 x i32]* %14, i64 0, i64 %149
%151 = load i32, i32* %150
%152 = call i32 @close(i32 %151)
br label %153
153: ; preds = %147
%154 = load i32, i32* %16
%155 = add nsw i32 %154, 1
store i32 %155, i32* %16
br label %142
156: ; preds = %142
%157 = call i32 @wait(i32 0)
store i32 0, i32* %3
%158 = load i8*, i8** %7
%159 = load i32, i32* %3
ret i32 %159
}

LLVM IR (-O2):
@__const.main.line = [6 x i8] c"ls -l\00"
@BUFSIZ = global i32 0
@main.delim_pipe = internal constant [2 x i8] c"|\00"
@main.delim = internal constant [4 x i8] c" \09\0A\00"
@.str = [12 x i8] c"Pipe failed\00"
@.str.1 = [20 x i8] c"execvp of ls failed\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [6 x i8]
%4 = alloca i8*
%5 = alloca [10 x i32]
%6 = getelementptr inbounds [6 x i8], [6 x i8]* %3, i64 0, i64 0
%7 = load i32, i32* @BUFSIZ
%8 = zext i32 %7 to i64
%9 = tail call i8* @llvm.stacksave()
%10 = alloca i8*, i64 %8
%11 = load i32, i32* @BUFSIZ
%12 = zext i32 %11 to i64
%13 = alloca i8*, i64 %12
%14 = bitcast i8** %4 to i8*
%15 = bitcast [10 x i32]* %5 to i8*
%16 = call i8* @strtok_r(i8* %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @main.delim_pipe, i64 0, i64 0), i8** %4)
%17 = icmp eq i8* %16, null
br i1 %17, label %116, label %23
18: ; preds = %23
%19 = trunc i64 %26 to i32
%20 = icmp eq i32 %19, 0
br i1 %20, label %116, label %21
21: ; preds = %18
%22 = and i64 %26, 4294967295
br label %33
23: ; preds = %2, %23
%24 = phi i64 [ %26, %23 ], [ 0, %2 ]
%25 = phi i8* [ %28, %23 ], [ %16, %2 ]
%26 = add nuw i64 %24, 1
%27 = getelementptr inbounds i8*, i8** %13, i64 %24
store i8* %25, i8** %27
%28 = call i8* @strtok_r(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @main.delim_pipe, i64 0, i64 0), i8** %4)
%29 = icmp eq i8* %28, null
br i1 %29, label %18, label %23
30: ; preds = %33
%31 = icmp eq i64 %39, %22
br i1 %31, label %32, label %33
32: ; preds = %30
br i1 %20, label %116, label %48
33: ; preds = %21, %30
%34 = phi i64 [ 0, %21 ], [ %39, %30 ]
%35 = shl nuw nsw i64 %34, 1
%36 = getelementptr inbounds [10 x i32], [10 x i32]* %5, i64 0, i64 %35
%37 = call i32 @pipe(i32* %36)
%38 = icmp eq i32 %37, -1
%39 = add nuw nsw i64 %34, 1
br i1 %38, label %40, label %30
40: ; preds = %33
%41 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%42 = call i32 @exit(i32 1)
unreachable
43: ; preds = %106
br i1 %20, label %116, label %44
44: ; preds = %43
%45 = shl i32 %19, 1
%46 = call i32 @llvm.umax.i32(i32 %45, i32 1)
%47 = zext i32 %46 to i64
br label %109
48: ; preds = %32, %106
%49 = phi i32 [ %107, %106 ], [ 0, %32 ]
%50 = call i64 (...) @fork()
%51 = icmp eq i64 %50, 0
br i1 %51, label %52, label %106
52: ; preds = %48
%53 = icmp eq i32 %49, 0
br i1 %53, label %62, label %54
54: ; preds = %52
%55 = call i32 @close(i32 0)
%56 = shl nuw i32 %49, 1
%57 = add i32 %56, -2
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds [10 x i32], [10 x i32]* %5, i64 0, i64 %58
%60 = load i32, i32* %59
%61 = call i32 @dup2(i32 %60, i32 0)
br label %62
62: ; preds = %54, %52
%63 = add nsw i32 %19, -1
%64 = icmp eq i32 %49, %63
br i1 %64, label %73, label %65
65: ; preds = %62
%66 = call i32 @close(i32 1)
%67 = shl nuw nsw i32 %49, 1
%68 = or i32 %67, 1
%69 = zext i32 %68 to i64
%70 = getelementptr inbounds [10 x i32], [10 x i32]* %5, i64 0, i64 %69
%71 = load i32, i32* %70
%72 = call i32 @dup2(i32 %71, i32 1)
br label %73
73: ; preds = %65, %62
%74 = shl i32 %19, 1
%75 = call i32 @llvm.umax.i32(i32 %74, i32 1)
%76 = zext i32 %75 to i64
br label %77
77: ; preds = %73, %77
%78 = phi i64 [ 0, %73 ], [ %82, %77 ]
%79 = getelementptr inbounds [10 x i32], [10 x i32]* %5, i64 0, i64 %78
%80 = load i32, i32* %79
%81 = call i32 @close(i32 %80)
%82 = add nuw nsw i64 %78, 1
%83 = icmp eq i64 %82, %76
br i1 %83, label %84, label %77
84: ; preds = %77
%85 = zext i32 %49 to i64
%86 = getelementptr inbounds i8*, i8** %13, i64 %85
%87 = load i8*, i8** %86
%88 = call i8* @strtok_r(i8* %87, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @main.delim, i64 0, i64 0), i8** %4)
%89 = icmp eq i8* %88, null
br i1 %89, label %90, label %92
90: ; preds = %84
%91 = call i32 @exit(i32 1)
unreachable
92: ; preds = %84, %92
%93 = phi i64 [ %95, %92 ], [ 0, %84 ]
%94 = phi i8* [ %97, %92 ], [ %88, %84 ]
%95 = add nuw i64 %93, 1
%96 = getelementptr inbounds i8*, i8** %10, i64 %93
store i8* %94, i8** %96
%97 = call i8* @strtok_r(i8* null, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @main.delim, i64 0, i64 0), i8** %4)
%98 = icmp eq i8* %97, null
br i1 %98, label %99, label %92
99: ; preds = %92
%100 = and i64 %95, 4294967295
%101 = getelementptr inbounds i8*, i8** %10, i64 %100
store i8* null, i8** %101
%102 = load i8*, i8** %10
%103 = call i32 @execvp(i8* %102, i8** %10)
%104 = call i32 @perror(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
%105 = call i32 @exit(i32 1)
unreachable
106: ; preds = %48
%107 = add nuw i32 %49, 1
%108 = icmp eq i32 %107, %19
br i1 %108, label %43, label %48
109: ; preds = %44, %109
%110 = phi i64 [ 0, %44 ], [ %114, %109 ]
%111 = getelementptr inbounds [10 x i32], [10 x i32]* %5, i64 0, i64 %110
%112 = load i32, i32* %111
%113 = call i32 @close(i32 %112)
%114 = add nuw nsw i64 %110, 1
%115 = icmp eq i64 %114, %47
br i1 %115, label %116, label %109
116: ; preds = %109, %2, %18, %32, %43
%117 = call i32 @wait(i32 0)
ret i32 0
}