#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 pid_t;

/* Variables and functions */
int /*<<< orphan*/ close(int);
int dup2(int, int);
int execlp(char const *, char const *, int /*<<< orphan*/ *,
           int /*<<< orphan*/ *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int fork();
int getpid();
int getppid();
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ pipe(int *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ wait(int /*<<< orphan*/);
int main(int argc, const char *argv[]) {
  if (argc < 3) {
    printf("Not enough parameters received.\nUsage: %s command1 command2\nThis "
           "is equal to command1 | command 2\n",
           argv[0]);
    return 1;
  }
  if ((argc - 1) % 2 != 0) {
    printf("Only accepted parameters are pairs. Received %d", argc - 1);
    return 1;
  }
  for (int i = 1; i < argc; i += 2) {
    pid_t pid = fork();
    if (pid == -1) {
      perror("failed\n");
    } else if (pid == 0) {
      int cPipe[2];
      pipe(cPipe);
      printf("Pairs %s, %s\n", argv[i], argv[i + 1]);
      printf("pid: %d ppid: %d\n", getpid(), getppid());
      int pidA1 = fork();
      if (pidA1 == 0) {
        close(cPipe[1]);
        int ret = dup2(cPipe[0], 0);
        close(cPipe[0]);
        if (ret < 0)
          perror("dup2\n");
        if (execlp(argv[i + 1], argv[i + 1], NULL, NULL) == -1) {
          perror("never should have come here\n");
          printf("%s\n", argv[i + 1]);
        }
      }
      int pidA0 = fork();
      if (pidA0 == 0) {
        int ret = dup2(cPipe[1], 1);
        if (ret < 0)
          perror("dup2\n");
        close(cPipe[1]);
        if (execlp(argv[i], argv[i], NULL, NULL) == -1) {
          perror("never should have come here\n");
          printf("%s\n", argv[i]);
        }
      }
      exit(0);
    } else {
      wait(0);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    11f1 <main+0x41>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe22(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1437 <main+0x287>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     1228 <main+0x78>
mov    -0x8(%rbp),%esi
sub    $0x1,%esi
lea    0xe4e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1437 <main+0x287>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1430 <main+0x280>
mov    $0x0,%al
call   10d0 <fork@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0xffffffff,-0x18(%rbp)
jne    1260 <main+0xb0>
lea    0xe3d(%rip),%rdi
call   1080 <perror@plt>
jmp    141d <main+0x26d>
cmpl   $0x0,-0x18(%rbp)
jne    1411 <main+0x261>
lea    -0x20(%rbp),%rdi
call   1070 <pipe@plt>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xe04(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,-0x34(%rbp)
mov    $0x0,%al
call   1090 <getppid@plt>
mov    -0x34(%rbp),%esi
mov    %eax,%edx
lea    0xdee(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   10d0 <fork@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jne    1370 <main+0x1c0>
mov    -0x1c(%rbp),%edi
call   1060 <close@plt>
mov    -0x20(%rbp),%edi
xor    %esi,%esi
call   1040 <dup2@plt>
mov    %eax,-0x28(%rbp)
mov    -0x20(%rbp),%edi
call   1060 <close@plt>
cmpl   $0x0,-0x28(%rbp)
jge    1309 <main+0x159>
lea    0xdb7(%rip),%rdi
call   1080 <perror@plt>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rsi
xor    %eax,%eax
mov    %eax,%ecx
mov    %rcx,%rdx
call   10b0 <execlp@plt>
cmp    $0xffffffff,%eax
jne    136b <main+0x1bb>
lea    0xd7a(%rip),%rdi
call   1080 <perror@plt>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xd41(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1370 <main+0x1c0>
mov    $0x0,%al
call   10d0 <fork@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0x0,-0x2c(%rbp)
jne    140a <main+0x25a>
mov    -0x1c(%rbp),%edi
mov    $0x1,%esi
call   1040 <dup2@plt>
mov    %eax,-0x30(%rbp)
cmpl   $0x0,-0x30(%rbp)
jge    13aa <main+0x1fa>
lea    0xd16(%rip),%rdi
call   1080 <perror@plt>
mov    -0x1c(%rbp),%edi
call   1060 <close@plt>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
xor    %eax,%eax
mov    %eax,%ecx
mov    %rcx,%rdx
call   10b0 <execlp@plt>
cmp    $0xffffffff,%eax
jne    1405 <main+0x255>
lea    0xcdb(%rip),%rdi
call   1080 <perror@plt>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xca7(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    140a <main+0x25a>
xor    %edi,%edi
call   10a0 <exit@plt>
xor    %edi,%edi
call   10c0 <wait@plt>
jmp    141d <main+0x26d>
jmp    1422 <main+0x272>
mov    -0x14(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x14(%rbp)
jmp    122f <main+0x7f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%r14
cmp    $0x2,%edi
jg     11ec <main+0x2c>
mov    (%r14),%rsi
lea    0xe22(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x1,%eax
jmp    1253 <main+0x93>
mov    %edi,%r12d
lea    -0x1(%r12),%esi
test   $0x1,%sil
jne    123c <main+0x7c>
mov    $0x1,%ebx
lea    0xe8d(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   10e0 <fork@plt>
cmp    $0xffffffff,%eax
je     1232 <main+0x72>
test   %eax,%eax
je     1260 <main+0xa0>
xor    %edi,%edi
call   10d0 <wait@plt>
add    $0x2,%rbx
cmp    %r12d,%ebx
jl     1210 <main+0x50>
jmp    1251 <main+0x91>
mov    %r15,%rdi
call   1090 <perror@plt>
jmp    1227 <main+0x67>
lea    0xe20(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x1,%eax
jmp    1253 <main+0x93>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0x8(%rsp),%rdi
call   1080 <pipe@plt>
mov    (%r14,%rbx,8),%rsi
mov    0x8(%r14,%rbx,8),%rdx
lea    0xe21(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
call   1040 <getpid@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   10a0 <getppid@plt>
lea    0xe11(%rip),%rdi
mov    %ebp,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
call   10e0 <fork@plt>
test   %eax,%eax
jne    1309 <main+0x149>
mov    0xc(%rsp),%edi
call   1070 <close@plt>
mov    0x8(%rsp),%edi
xor    %esi,%esi
call   1050 <dup2@plt>
mov    %eax,%ebp
mov    0x8(%rsp),%edi
call   1070 <close@plt>
test   %ebp,%ebp
jns    12dd <main+0x11d>
lea    0xde3(%rip),%rdi
call   1090 <perror@plt>
mov    0x8(%r14,%rbx,8),%rdi
mov    %rdi,%rsi
xor    %edx,%edx
xor    %ecx,%ecx
call   10c0 <execlp@plt>
cmp    $0xffffffff,%eax
jne    1309 <main+0x149>
lea    0xdc7(%rip),%rdi
call   1090 <perror@plt>
mov    0x8(%r14,%rbx,8),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   10e0 <fork@plt>
test   %eax,%eax
jne    1365 <main+0x1a5>
mov    0xc(%rsp),%edi
mov    $0x1,%esi
call   1050 <dup2@plt>
test   %eax,%eax
jns    1332 <main+0x172>
lea    0xd8e(%rip),%rdi
call   1090 <perror@plt>
mov    0xc(%rsp),%edi
call   1070 <close@plt>
mov    (%r14,%rbx,8),%rdi
mov    %rdi,%rsi
xor    %edx,%edx
xor    %ecx,%ecx
call   10c0 <execlp@plt>
cmp    $0xffffffff,%eax
jne    1365 <main+0x1a5>
lea    0xd6a(%rip),%rdi
call   1090 <perror@plt>
mov    (%r14,%rbx,8),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   10b0 <exit@plt>

LLVM IR (-O0):
@.str = [99 x i8] c"Not enough parameters received.\0AUsage: %s command1 command2\0AThis is equal to command1 | command 2\0A\00"
@.str.1 = [48 x i8] c"Only accepted parameters are pairs. Received %d\00"
@.str.2 = [8 x i8] c"failed\0A\00"
@.str.3 = [14 x i8] c"Pairs %s, %s\0A\00"
@.str.4 = [18 x i8] c"pid: %d ppid: %d\0A\00"
@.str.5 = [6 x i8] c"dup2\0A\00"
@.str.6 = [29 x i8] c"never should have come here\0A\00"
@.str.7 = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca [2 x i32]
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%13 = load i32, i32* %4
%14 = icmp slt i32 %13, 3
br i1 %14, label %15, label %20
15: ; preds = %2
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 0
%18 = load i8*, i8** %17
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([99 x i8], [99 x i8]* @.str, i64 0, i64 0), i8* %18)
store i32 1, i32* %3
br label %150
20: ; preds = %2
%21 = load i32, i32* %4
%22 = sub nsw i32 %21, 1
%23 = srem i32 %22, 2
%24 = icmp ne i32 %23, 0
br i1 %24, label %25, label %29
25: ; preds = %20
%26 = load i32, i32* %4
%27 = sub nsw i32 %26, 1
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.1, i64 0, i64 0), i32 %27)
store i32 1, i32* %3
br label %150
29: ; preds = %20
store i32 1, i32* %6
br label %30
30: ; preds = %146, %29
%31 = load i32, i32* %6
%32 = load i32, i32* %4
%33 = icmp slt i32 %31, %32
br i1 %33, label %34, label %149
34: ; preds = %30
%35 = call i32 (...) @fork()
store i32 %35, i32* %7
%36 = load i32, i32* %7
%37 = icmp eq i32 %36, -1
br i1 %37, label %38, label %40
38: ; preds = %34
%39 = call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
br label %145
40: ; preds = %34
%41 = load i32, i32* %7
%42 = icmp eq i32 %41, 0
br i1 %42, label %43, label %142
43: ; preds = %40
%44 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 0
%45 = call i32 @pipe(i32* %44)
%46 = load i8**, i8*** %5
%47 = load i32, i32* %6
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds i8*, i8** %46, i64 %48
%50 = load i8*, i8** %49
%51 = load i8**, i8*** %5
%52 = load i32, i32* %6
%53 = add nsw i32 %52, 1
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds i8*, i8** %51, i64 %54
%56 = load i8*, i8** %55
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i8* %50, i8* %56)
%58 = call i32 (...) @getpid()
%59 = call i32 (...) @getppid()
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i32 %58, i32 %59)
%61 = call i32 (...) @fork()
store i32 %61, i32* %9
%62 = load i32, i32* %9
%63 = icmp eq i32 %62, 0
br i1 %63, label %64, label %103
64: ; preds = %43
%65 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 1
%66 = load i32, i32* %65
%67 = call i32 @close(i32 %66)
%68 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 0
%69 = load i32, i32* %68
%70 = call i32 @dup2(i32 %69, i32 0)
store i32 %70, i32* %10
%71 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 0
%72 = load i32, i32* %71
%73 = call i32 @close(i32 %72)
%74 = load i32, i32* %10
%75 = icmp slt i32 %74, 0
br i1 %75, label %76, label %78
76: ; preds = %64
%77 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
br label %78
78: ; preds = %76, %64
%79 = load i8**, i8*** %5
%80 = load i32, i32* %6
%81 = add nsw i32 %80, 1
%82 = sext i32 %81 to i64
%83 = getelementptr inbounds i8*, i8** %79, i64 %82
%84 = load i8*, i8** %83
%85 = load i8**, i8*** %5
%86 = load i32, i32* %6
%87 = add nsw i32 %86, 1
%88 = sext i32 %87 to i64
%89 = getelementptr inbounds i8*, i8** %85, i64 %88
%90 = load i8*, i8** %89
%91 = call i32 @execlp(i8* %84, i8* %90, i32* null, i32* null)
%92 = icmp eq i32 %91, -1
br i1 %92, label %93, label %102
93: ; preds = %78
%94 = call i32 @perror(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.6, i64 0, i64 0))
%95 = load i8**, i8*** %5
%96 = load i32, i32* %6
%97 = add nsw i32 %96, 1
%98 = sext i32 %97 to i64
%99 = getelementptr inbounds i8*, i8** %95, i64 %98
%100 = load i8*, i8** %99
%101 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i8* %100)
br label %102
102: ; preds = %93, %78
br label %103
103: ; preds = %102, %43
%104 = call i32 (...) @fork()
store i32 %104, i32* %11
%105 = load i32, i32* %11
%106 = icmp eq i32 %105, 0
br i1 %106, label %107, label %140
107: ; preds = %103
%108 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 1
%109 = load i32, i32* %108
%110 = call i32 @dup2(i32 %109, i32 1)
store i32 %110, i32* %12
%111 = load i32, i32* %12
%112 = icmp slt i32 %111, 0
br i1 %112, label %113, label %115
113: ; preds = %107
%114 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
br label %115
115: ; preds = %113, %107
%116 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 1
%117 = load i32, i32* %116
%118 = call i32 @close(i32 %117)
%119 = load i8**, i8*** %5
%120 = load i32, i32* %6
%121 = sext i32 %120 to i64
%122 = getelementptr inbounds i8*, i8** %119, i64 %121
%123 = load i8*, i8** %122
%124 = load i8**, i8*** %5
%125 = load i32, i32* %6
%126 = sext i32 %125 to i64
%127 = getelementptr inbounds i8*, i8** %124, i64 %126
%128 = load i8*, i8** %127
%129 = call i32 @execlp(i8* %123, i8* %128, i32* null, i32* null)
%130 = icmp eq i32 %129, -1
br i1 %130, label %131, label %139
131: ; preds = %115
%132 = call i32 @perror(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.6, i64 0, i64 0))
%133 = load i8**, i8*** %5
%134 = load i32, i32* %6
%135 = sext i32 %134 to i64
%136 = getelementptr inbounds i8*, i8** %133, i64 %135
%137 = load i8*, i8** %136
%138 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i8* %137)
br label %139
139: ; preds = %131, %115
br label %140
140: ; preds = %139, %103
%141 = call i32 @exit(i32 0)
unreachable
142: ; preds = %40
%143 = call i32 @wait(i32 0)
br label %144
144: ; preds = %142
br label %145
145: ; preds = %144, %38
br label %146
146: ; preds = %145
%147 = load i32, i32* %6
%148 = add nsw i32 %147, 2
store i32 %148, i32* %6
br label %30
149: ; preds = %30
store i32 0, i32* %3
br label %150
150: ; preds = %149, %25, %15
%151 = load i32, i32* %3
ret i32 %151
}

LLVM IR (-O2):
@.str = [99 x i8] c"Not enough parameters received.\0AUsage: %s command1 command2\0AThis is equal to command1 | command 2\0A\00"
@.str.1 = [48 x i8] c"Only accepted parameters are pairs. Received %d\00"
@.str.2 = [8 x i8] c"failed\0A\00"
@.str.3 = [14 x i8] c"Pairs %s, %s\0A\00"
@.str.4 = [18 x i8] c"pid: %d ppid: %d\0A\00"
@.str.5 = [6 x i8] c"dup2\0A\00"
@.str.6 = [29 x i8] c"never should have come here\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [2 x i32]
%4 = icmp slt i32 %0, 3
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = load i8*, i8** %1
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([99 x i8], [99 x i8]* @.str, i64 0, i64 0), i8* %6)
br label %82
8: ; preds = %2
%9 = add nsw i32 %0, -1
%10 = and i32 %9, 1
%11 = icmp eq i32 %10, 0
br i1 %11, label %14, label %12
12: ; preds = %8
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str.1, i64 0, i64 0), i32 %9)
br label %82
14: ; preds = %8, %79
%15 = phi i32 [ %80, %79 ], [ 1, %8 ]
%16 = tail call i32 (...) @fork()
switch i32 %16, label %77 [
i32 -1, label %17
i32 0, label %19
]
17: ; preds = %14
%18 = tail call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
br label %79
19: ; preds = %14
%20 = bitcast [2 x i32]* %3 to i8*
%21 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
%22 = call i32 @pipe(i32* %21)
%23 = zext i32 %15 to i64
%24 = getelementptr inbounds i8*, i8** %1, i64 %23
%25 = load i8*, i8** %24
%26 = add nuw nsw i32 %15, 1
%27 = zext i32 %26 to i64
%28 = getelementptr inbounds i8*, i8** %1, i64 %27
%29 = load i8*, i8** %28
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i8* %25, i8* %29)
%31 = call i32 (...) @getpid()
%32 = call i32 (...) @getppid()
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i32 %31, i32 %32)
%34 = call i32 (...) @fork()
%35 = icmp eq i32 %34, 0
br i1 %35, label %36, label %55
36: ; preds = %19
%37 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 1
%38 = load i32, i32* %37
%39 = call i32 @close(i32 %38)
%40 = load i32, i32* %21
%41 = call i32 @dup2(i32 %40, i32 0)
%42 = load i32, i32* %21
%43 = call i32 @close(i32 %42)
%44 = icmp slt i32 %41, 0
br i1 %44, label %45, label %47
45: ; preds = %36
%46 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
br label %47
47: ; preds = %45, %36
%48 = load i8*, i8** %28
%49 = call i32 @execlp(i8* %48, i8* %48, i32* null, i32* null)
%50 = icmp eq i32 %49, -1
br i1 %50, label %51, label %55
51: ; preds = %47
%52 = call i32 @perror(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.6, i64 0, i64 0))
%53 = load i8*, i8** %28
%54 = call i32 @puts(i8* dereferenceable(1) %53)
br label %55
55: ; preds = %47, %51, %19
%56 = call i32 (...) @fork()
%57 = icmp eq i32 %56, 0
br i1 %57, label %58, label %75
58: ; preds = %55
%59 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 1
%60 = load i32, i32* %59
%61 = call i32 @dup2(i32 %60, i32 1)
%62 = icmp slt i32 %61, 0
br i1 %62, label %63, label %65
63: ; preds = %58
%64 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
br label %65
65: ; preds = %63, %58
%66 = load i32, i32* %59
%67 = call i32 @close(i32 %66)
%68 = load i8*, i8** %24
%69 = call i32 @execlp(i8* %68, i8* %68, i32* null, i32* null)
%70 = icmp eq i32 %69, -1
br i1 %70, label %71, label %75
71: ; preds = %65
%72 = call i32 @perror(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.6, i64 0, i64 0))
%73 = load i8*, i8** %24
%74 = call i32 @puts(i8* dereferenceable(1) %73)
br label %75
75: ; preds = %65, %71, %55
%76 = call i32 @exit(i32 0)
unreachable
77: ; preds = %14
%78 = tail call i32 @wait(i32 0)
br label %79
79: ; preds = %77, %17
%80 = add nuw nsw i32 %15, 2
%81 = icmp slt i32 %80, %0
br i1 %81, label %14, label %82
82: ; preds = %79, %12, %5
%83 = phi i32 [ 1, %5 ], [ 1, %12 ], [ 0, %79 ]
ret i32 %83
}