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

/* Variables and functions */
int /*<<< orphan*/ _IONBF;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ dup2(int, int);
int execl(char *, char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int pfork(int);
scalar_t__ pipe(int *);
int /*<<< orphan*/ printf(char *, char *, char *);
int /*<<< orphan*/ read(int, char *, int);
int /*<<< orphan*/ setvbuf(int /*<<< orphan*/, char *, int /*<<< orphan*/,
                           int /*<<< orphan*/);
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ write(int, char *, int);
void runPrograms(char colourA, char colourB, int n) {
  char a;
  pid_t pid;
  int rv;
  int parentA[2];
  int childA[2];
  int parentB[2];
  int childB[2];
  char buffA[50];
  char buffB[50];
  if (pipe(parentA) || pipe(childA) || pipe(parentB) || pipe(childB)) {
    fprintf(stderr, "Pipe error!\n");
    exit(1);
  }
  int i;
  i = pfork(3);
  if (i == 0) {
    setvbuf(stdout, (char *)NULL, _IONBF, 0);
    int inA, outA;
    inA = parentA[0];
    outA = childA[1];
    close(parentA[1]);
    close(childB[0]);
    int inB, outB;
    inB = parentB[0];
    outB = childB[1];
    close(parentB[1]);
    close(childB[0]);
    write(outA, &colourA, 50);
    write(outB, &colourB, 50);
    sleep(1);
    read(inA, buffA, 50);
    read(inB, buffB, 50);
    printf("%s%s\n", buffA, buffB);
  } else if (i == 1) {
    setvbuf(stdout, (char *)NULL, _IONBF, 0);
    int in, out;
    in = childA[0];
    out = parentA[1];
    close(childA[1]);
    close(parentA[0]);
    dup2(in, 0);
    dup2(out, 1);
    if (execl("A", "A", NULL) == -1)
      fprintf(stderr, "A execl Error!\n");
    exit(1);
  } else if (i == 2) {
    setvbuf(stdout, (char *)NULL, _IONBF, 0);
    int in, out;
    in = childB[0];
    out = parentB[1];
    close(childB[1]);
    close(parentB[0]);
    dup2(in, 0);
    dup2(out, 1);
    if (execl("B", "B", NULL) == -1)
      fprintf(stderr, "B execl Error!\n");
    exit(1);
  }
}


x86 assembly (clang, -O0):
<runPrograms>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
mov    %edx,-0x8(%rbp)
lea    -0x1c(%rbp),%rdi
call   1080 <pipe@plt>
cmp    $0x0,%rax
jne    1226 <runPrograms+0x66>
lea    -0x24(%rbp),%rdi
call   1080 <pipe@plt>
cmp    $0x0,%rax
jne    1226 <runPrograms+0x66>
lea    -0x2c(%rbp),%rdi
call   1080 <pipe@plt>
cmp    $0x0,%rax
jne    1226 <runPrograms+0x66>
lea    -0x34(%rbp),%rdi
call   1080 <pipe@plt>
cmp    $0x0,%rax
je     1245 <runPrograms+0x85>
mov    0x2dab(%rip),%rax
mov    (%rax),%edi
lea    0xdca(%rip),%rsi
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
mov    $0x3,%edi
call   1060 <pfork@plt>
mov    %eax,-0xb4(%rbp)
cmpl   $0x0,-0xb4(%rbp)
jne    133c <runPrograms+0x17c>
mov    0x2d67(%rip),%rax
mov    (%rax),%edi
mov    0x2d76(%rip),%rax
mov    (%rax),%edx
xor    %eax,%eax
mov    %eax,%esi
xor    %ecx,%ecx
call   10b0 <setvbuf@plt>
mov    -0x1c(%rbp),%eax
mov    %eax,-0xb8(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0xbc(%rbp)
mov    -0x18(%rbp),%edi
call   1070 <close@plt>
mov    -0x34(%rbp),%edi
call   1070 <close@plt>
mov    -0x2c(%rbp),%eax
mov    %eax,-0xc0(%rbp)
mov    -0x30(%rbp),%eax
mov    %eax,-0xc4(%rbp)
mov    -0x28(%rbp),%edi
call   1070 <close@plt>
mov    -0x34(%rbp),%edi
call   1070 <close@plt>
mov    -0xbc(%rbp),%edi
lea    -0x1(%rbp),%rsi
mov    $0x32,%edx
call   1030 <write@plt>
mov    -0xc4(%rbp),%edi
lea    -0x2(%rbp),%rsi
mov    $0x32,%edx
call   1030 <write@plt>
mov    $0x1,%edi
call   10e0 <sleep@plt>
mov    -0xb8(%rbp),%edi
lea    -0x70(%rbp),%rsi
mov    $0x32,%edx
call   1090 <read@plt>
mov    -0xc0(%rbp),%edi
lea    -0xb0(%rbp),%rsi
mov    $0x32,%edx
call   1090 <read@plt>
lea    -0x70(%rbp),%rsi
lea    -0xb0(%rbp),%rdx
lea    0xcdb(%rip),%rdi
call   1050 <printf@plt>
jmp    148e <runPrograms+0x2ce>
cmpl   $0x1,-0xb4(%rbp)
jne    13e0 <runPrograms+0x220>
mov    0x2c80(%rip),%rax
mov    (%rax),%edi
mov    0x2c8f(%rip),%rax
mov    (%rax),%edx
xor    %eax,%eax
mov    %eax,%esi
xor    %ecx,%ecx
call   10b0 <setvbuf@plt>
mov    -0x24(%rbp),%eax
mov    %eax,-0xc8(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0xcc(%rbp)
mov    -0x20(%rbp),%edi
call   1070 <close@plt>
mov    -0x1c(%rbp),%edi
call   1070 <close@plt>
mov    -0xc8(%rbp),%edi
xor    %esi,%esi
call   1040 <dup2@plt>
mov    -0xcc(%rbp),%edi
mov    $0x1,%esi
call   1040 <dup2@plt>
lea    0xc67(%rip),%rsi
xor    %eax,%eax
mov    %eax,%edx
mov    %rsi,%rdi
call   10d0 <execl@plt>
cmp    $0xffffffff,%eax
jne    13d6 <runPrograms+0x216>
mov    0x2c10(%rip),%rax
mov    (%rax),%edi
lea    0xc44(%rip),%rsi
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
cmpl   $0x2,-0xb4(%rbp)
jne    1484 <runPrograms+0x2c4>
mov    0x2bdc(%rip),%rax
mov    (%rax),%edi
mov    0x2beb(%rip),%rax
mov    (%rax),%edx
xor    %eax,%eax
mov    %eax,%esi
xor    %ecx,%ecx
call   10b0 <setvbuf@plt>
mov    -0x34(%rbp),%eax
mov    %eax,-0xd0(%rbp)
mov    -0x28(%rbp),%eax
mov    %eax,-0xd4(%rbp)
mov    -0x30(%rbp),%edi
call   1070 <close@plt>
mov    -0x2c(%rbp),%edi
call   1070 <close@plt>
mov    -0xd0(%rbp),%edi
xor    %esi,%esi
call   1040 <dup2@plt>
mov    -0xd4(%rbp),%edi
mov    $0x1,%esi
call   1040 <dup2@plt>
lea    0xbd5(%rip),%rsi
xor    %eax,%eax
mov    %eax,%edx
mov    %rsi,%rdi
call   10d0 <execl@plt>
cmp    $0xffffffff,%eax
jne    147a <runPrograms+0x2ba>
mov    0x2b6c(%rip),%rax
mov    (%rax),%edi
lea    0xbb2(%rip),%rsi
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
jmp    1489 <runPrograms+0x2c9>
jmp    148e <runPrograms+0x2ce>
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<runPrograms>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0xa8,%rsp
mov    %dil,0xf(%rsp)
mov    %sil,0xe(%rsp)
lea    0x20(%rsp),%rdi
call   1080 <pipe@plt>
test   %rax,%rax
jne    1387 <runPrograms+0x1c7>
lea    0x28(%rsp),%rdi
call   1080 <pipe@plt>
test   %rax,%rax
jne    1387 <runPrograms+0x1c7>
lea    0x18(%rsp),%rdi
call   1080 <pipe@plt>
test   %rax,%rax
jne    1387 <runPrograms+0x1c7>
lea    0x10(%rsp),%rdi
call   1080 <pipe@plt>
test   %rax,%rax
jne    1387 <runPrograms+0x1c7>
mov    $0x3,%edi
call   1060 <pfork@plt>
test   %eax,%eax
je     12c0 <runPrograms+0x100>
cmp    $0x1,%eax
je     13a6 <runPrograms+0x1e6>
cmp    $0x2,%eax
jne    1379 <runPrograms+0x1b9>
mov    0x2d82(%rip),%rax
mov    (%rax),%edi
mov    0x2d91(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
xor    %ecx,%ecx
call   10b0 <setvbuf@plt>
mov    0x1c(%rsp),%ebx
mov    0x10(%rsp),%ebp
mov    0x14(%rsp),%edi
call   1070 <close@plt>
mov    0x18(%rsp),%edi
call   1070 <close@plt>
mov    %ebp,%edi
xor    %esi,%esi
call   1040 <dup2@plt>
mov    %ebx,%edi
mov    $0x1,%esi
call   1040 <dup2@plt>
lea    0xd8d(%rip),%rdi
mov    %rdi,%rsi
xor    %edx,%edx
call   10d0 <execl@plt>
cmp    $0xffffffff,%eax
jne    141b <runPrograms+0x25b>
mov    0x2d26(%rip),%rax
mov    (%rax),%edi
lea    0xd6c(%rip),%rsi
jmp    1416 <runPrograms+0x256>
mov    0x2d09(%rip),%rax
mov    (%rax),%edi
mov    0x2d18(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
xor    %ecx,%ecx
call   10b0 <setvbuf@plt>
mov    0x2c(%rsp),%ebx
mov    0x20(%rsp),%r14d
mov    0x24(%rsp),%edi
call   1070 <close@plt>
mov    0x10(%rsp),%edi
call   1070 <close@plt>
mov    0x14(%rsp),%ebp
mov    0x18(%rsp),%r15d
mov    0x1c(%rsp),%edi
call   1070 <close@plt>
mov    0x10(%rsp),%edi
call   1070 <close@plt>
lea    0xf(%rsp),%rsi
mov    %ebx,%edi
mov    $0x32,%edx
call   1030 <write@plt>
lea    0xe(%rsp),%rsi
mov    %ebp,%edi
mov    $0x32,%edx
call   1030 <write@plt>
mov    $0x1,%edi
call   10e0 <sleep@plt>
lea    0x70(%rsp),%rbx
mov    %r14d,%edi
mov    %rbx,%rsi
mov    $0x32,%edx
call   1090 <read@plt>
lea    0x30(%rsp),%rbp
mov    %r15d,%edi
mov    %rbp,%rsi
mov    $0x32,%edx
call   1090 <read@plt>
lea    0xc9f(%rip),%rdi
mov    %rbx,%rsi
mov    %rbp,%rdx
call   1050 <printf@plt>
add    $0xa8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2c4a(%rip),%rax
mov    (%rax),%edi
lea    0xc69(%rip),%rsi
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
mov    0x2c23(%rip),%rax
mov    (%rax),%edi
mov    0x2c32(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
xor    %ecx,%ecx
call   10b0 <setvbuf@plt>
mov    0x24(%rsp),%ebx
mov    0x28(%rsp),%ebp
mov    0x2c(%rsp),%edi
call   1070 <close@plt>
mov    0x20(%rsp),%edi
call   1070 <close@plt>
mov    %ebp,%edi
xor    %esi,%esi
call   1040 <dup2@plt>
mov    %ebx,%edi
mov    $0x1,%esi
call   1040 <dup2@plt>
lea    0xc1c(%rip),%rdi
mov    %rdi,%rsi
xor    %edx,%edx
call   10d0 <execl@plt>
cmp    $0xffffffff,%eax
jne    141b <runPrograms+0x25b>
mov    0x2bcb(%rip),%rax
mov    (%rax),%edi
lea    0xbff(%rip),%rsi
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [13 x i8] c"Pipe error!\0A\00"
@stdout = global i32 0
@_IONBF = global i32 0
@.str.1 = [6 x i8] c"%s%s\0A\00"
@.str.2 = [2 x i8] c"A\00"
@.str.3 = [16 x i8] c"A execl Error!\0A\00"
@.str.4 = [2 x i8] c"B\00"
@.str.5 = [16 x i8] c"B execl Error!\0A\00"
define void @runPrograms(i8 signext %0, i8 signext %1, i32 %2) {
%4 = alloca i8
%5 = alloca i8
%6 = alloca i32
%7 = alloca i8
%8 = alloca i32
%9 = alloca i32
%10 = alloca [2 x i32]
%11 = alloca [2 x i32]
%12 = alloca [2 x i32]
%13 = alloca [2 x i32]
%14 = alloca [50 x i8]
%15 = alloca [50 x i8]
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
%24 = alloca i32
store i8 %0, i8* %4
store i8 %1, i8* %5
store i32 %2, i32* %6
%25 = getelementptr inbounds [2 x i32], [2 x i32]* %10, i64 0, i64 0
%26 = call i64 @pipe(i32* %25)
%27 = icmp ne i64 %26, 0
br i1 %27, label %40, label %28
28: ; preds = %3
%29 = getelementptr inbounds [2 x i32], [2 x i32]* %11, i64 0, i64 0
%30 = call i64 @pipe(i32* %29)
%31 = icmp ne i64 %30, 0
br i1 %31, label %40, label %32
32: ; preds = %28
%33 = getelementptr inbounds [2 x i32], [2 x i32]* %12, i64 0, i64 0
%34 = call i64 @pipe(i32* %33)
%35 = icmp ne i64 %34, 0
br i1 %35, label %40, label %36
36: ; preds = %32
%37 = getelementptr inbounds [2 x i32], [2 x i32]* %13, i64 0, i64 0
%38 = call i64 @pipe(i32* %37)
%39 = icmp ne i64 %38, 0
br i1 %39, label %40, label %44
40: ; preds = %36, %32, %28, %3
%41 = load i32, i32* @stderr
%42 = call i32 @fprintf(i32 %41, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%43 = call i32 @exit(i32 1)
unreachable
44: ; preds = %36
%45 = call i32 @pfork(i32 3)
store i32 %45, i32* %16
%46 = load i32, i32* %16
%47 = icmp eq i32 %46, 0
br i1 %47, label %48, label %86
48: ; preds = %44
%49 = load i32, i32* @stdout
%50 = load i32, i32* @_IONBF
%51 = call i32 @setvbuf(i32 %49, i8* null, i32 %50, i32 0)
%52 = getelementptr inbounds [2 x i32], [2 x i32]* %10, i64 0, i64 0
%53 = load i32, i32* %52
store i32 %53, i32* %17
%54 = getelementptr inbounds [2 x i32], [2 x i32]* %11, i64 0, i64 1
%55 = load i32, i32* %54
store i32 %55, i32* %18
%56 = getelementptr inbounds [2 x i32], [2 x i32]* %10, i64 0, i64 1
%57 = load i32, i32* %56
%58 = call i32 @close(i32 %57)
%59 = getelementptr inbounds [2 x i32], [2 x i32]* %13, i64 0, i64 0
%60 = load i32, i32* %59
%61 = call i32 @close(i32 %60)
%62 = getelementptr inbounds [2 x i32], [2 x i32]* %12, i64 0, i64 0
%63 = load i32, i32* %62
store i32 %63, i32* %19
%64 = getelementptr inbounds [2 x i32], [2 x i32]* %13, i64 0, i64 1
%65 = load i32, i32* %64
store i32 %65, i32* %20
%66 = getelementptr inbounds [2 x i32], [2 x i32]* %12, i64 0, i64 1
%67 = load i32, i32* %66
%68 = call i32 @close(i32 %67)
%69 = getelementptr inbounds [2 x i32], [2 x i32]* %13, i64 0, i64 0
%70 = load i32, i32* %69
%71 = call i32 @close(i32 %70)
%72 = load i32, i32* %18
%73 = call i32 @write(i32 %72, i8* %4, i32 50)
%74 = load i32, i32* %20
%75 = call i32 @write(i32 %74, i8* %5, i32 50)
%76 = call i32 @sleep(i32 1)
%77 = load i32, i32* %17
%78 = getelementptr inbounds [50 x i8], [50 x i8]* %14, i64 0, i64 0
%79 = call i32 @read(i32 %77, i8* %78, i32 50)
%80 = load i32, i32* %19
%81 = getelementptr inbounds [50 x i8], [50 x i8]* %15, i64 0, i64 0
%82 = call i32 @read(i32 %80, i8* %81, i32 50)
%83 = getelementptr inbounds [50 x i8], [50 x i8]* %14, i64 0, i64 0
%84 = getelementptr inbounds [50 x i8], [50 x i8]* %15, i64 0, i64 0
%85 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %83, i8* %84)
br label %144
86: ; preds = %44
%87 = load i32, i32* %16
%88 = icmp eq i32 %87, 1
br i1 %88, label %89, label %114
89: ; preds = %86
%90 = load i32, i32* @stdout
%91 = load i32, i32* @_IONBF
%92 = call i32 @setvbuf(i32 %90, i8* null, i32 %91, i32 0)
%93 = getelementptr inbounds [2 x i32], [2 x i32]* %11, i64 0, i64 0
%94 = load i32, i32* %93
store i32 %94, i32* %21
%95 = getelementptr inbounds [2 x i32], [2 x i32]* %10, i64 0, i64 1
%96 = load i32, i32* %95
store i32 %96, i32* %22
%97 = getelementptr inbounds [2 x i32], [2 x i32]* %11, i64 0, i64 1
%98 = load i32, i32* %97
%99 = call i32 @close(i32 %98)
%100 = getelementptr inbounds [2 x i32], [2 x i32]* %10, i64 0, i64 0
%101 = load i32, i32* %100
%102 = call i32 @close(i32 %101)
%103 = load i32, i32* %21
%104 = call i32 @dup2(i32 %103, i32 0)
%105 = load i32, i32* %22
%106 = call i32 @dup2(i32 %105, i32 1)
%107 = call i32 @execl(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32* null)
%108 = icmp eq i32 %107, -1
br i1 %108, label %109, label %112
109: ; preds = %89
%110 = load i32, i32* @stderr
%111 = call i32 @fprintf(i32 %110, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
br label %112
112: ; preds = %109, %89
%113 = call i32 @exit(i32 1)
unreachable
114: ; preds = %86
%115 = load i32, i32* %16
%116 = icmp eq i32 %115, 2
br i1 %116, label %117, label %142
117: ; preds = %114
%118 = load i32, i32* @stdout
%119 = load i32, i32* @_IONBF
%120 = call i32 @setvbuf(i32 %118, i8* null, i32 %119, i32 0)
%121 = getelementptr inbounds [2 x i32], [2 x i32]* %13, i64 0, i64 0
%122 = load i32, i32* %121
store i32 %122, i32* %23
%123 = getelementptr inbounds [2 x i32], [2 x i32]* %12, i64 0, i64 1
%124 = load i32, i32* %123
store i32 %124, i32* %24
%125 = getelementptr inbounds [2 x i32], [2 x i32]* %13, i64 0, i64 1
%126 = load i32, i32* %125
%127 = call i32 @close(i32 %126)
%128 = getelementptr inbounds [2 x i32], [2 x i32]* %12, i64 0, i64 0
%129 = load i32, i32* %128
%130 = call i32 @close(i32 %129)
%131 = load i32, i32* %23
%132 = call i32 @dup2(i32 %131, i32 0)
%133 = load i32, i32* %24
%134 = call i32 @dup2(i32 %133, i32 1)
%135 = call i32 @execl(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i32* null)
%136 = icmp eq i32 %135, -1
br i1 %136, label %137, label %140
137: ; preds = %117
%138 = load i32, i32* @stderr
%139 = call i32 @fprintf(i32 %138, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0))
br label %140
140: ; preds = %137, %117
%141 = call i32 @exit(i32 1)
unreachable
142: ; preds = %114
br label %143
143: ; preds = %142
br label %144
144: ; preds = %143, %48
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [13 x i8] c"Pipe error!\0A\00"
@stdout = global i32 0
@_IONBF = global i32 0
@.str.1 = [6 x i8] c"%s%s\0A\00"
@.str.2 = [2 x i8] c"A\00"
@.str.3 = [16 x i8] c"A execl Error!\0A\00"
@.str.4 = [2 x i8] c"B\00"
@.str.5 = [16 x i8] c"B execl Error!\0A\00"
define void @runPrograms(i8 signext %0, i8 signext %1, i32 %2) {
%4 = alloca i8
%5 = alloca i8
%6 = alloca [2 x i32]
%7 = alloca [2 x i32]
%8 = alloca [2 x i32]
%9 = alloca [2 x i32]
%10 = alloca [50 x i8]
%11 = alloca [50 x i8]
store i8 %0, i8* %4
store i8 %1, i8* %5
%12 = bitcast [2 x i32]* %6 to i8*
%13 = bitcast [2 x i32]* %7 to i8*
%14 = bitcast [2 x i32]* %8 to i8*
%15 = bitcast [2 x i32]* %9 to i8*
%16 = getelementptr inbounds [50 x i8], [50 x i8]* %10, i64 0, i64 0
%17 = getelementptr inbounds [50 x i8], [50 x i8]* %11, i64 0, i64 0
%18 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
%19 = call i64 @pipe(i32* %18)
%20 = icmp eq i64 %19, 0
br i1 %20, label %21, label %33
21: ; preds = %3
%22 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
%23 = call i64 @pipe(i32* %22)
%24 = icmp eq i64 %23, 0
br i1 %24, label %25, label %33
25: ; preds = %21
%26 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 0
%27 = call i64 @pipe(i32* %26)
%28 = icmp eq i64 %27, 0
br i1 %28, label %29, label %33
29: ; preds = %25
%30 = getelementptr inbounds [2 x i32], [2 x i32]* %9, i64 0, i64 0
%31 = call i64 @pipe(i32* %30)
%32 = icmp eq i64 %31, 0
br i1 %32, label %37, label %33
33: ; preds = %29, %25, %21, %3
%34 = load i32, i32* @stderr
%35 = call i32 @fprintf(i32 %34, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%36 = call i32 @exit(i32 1)
unreachable
37: ; preds = %29
%38 = call i32 @pfork(i32 3)
switch i32 %38, label %107 [
i32 0, label %39
i32 1, label %65
i32 2, label %86
]
39: ; preds = %37
%40 = load i32, i32* @stdout
%41 = load i32, i32* @_IONBF
%42 = call i32 @setvbuf(i32 %40, i8* null, i32 %41, i32 0)
%43 = load i32, i32* %18
%44 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 1
%45 = load i32, i32* %44
%46 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 1
%47 = load i32, i32* %46
%48 = call i32 @close(i32 %47)
%49 = load i32, i32* %30
%50 = call i32 @close(i32 %49)
%51 = load i32, i32* %26
%52 = getelementptr inbounds [2 x i32], [2 x i32]* %9, i64 0, i64 1
%53 = load i32, i32* %52
%54 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 1
%55 = load i32, i32* %54
%56 = call i32 @close(i32 %55)
%57 = load i32, i32* %30
%58 = call i32 @close(i32 %57)
%59 = call i32 @write(i32 %45, i8* %4, i32 50)
%60 = call i32 @write(i32 %53, i8* %5, i32 50)
%61 = call i32 @sleep(i32 1)
%62 = call i32 @read(i32 %43, i8* %16, i32 50)
%63 = call i32 @read(i32 %51, i8* %17, i32 50)
%64 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %16, i8* %17)
br label %107
65: ; preds = %37
%66 = load i32, i32* @stdout
%67 = load i32, i32* @_IONBF
%68 = call i32 @setvbuf(i32 %66, i8* null, i32 %67, i32 0)
%69 = load i32, i32* %22
%70 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 1
%71 = load i32, i32* %70
%72 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 1
%73 = load i32, i32* %72
%74 = call i32 @close(i32 %73)
%75 = load i32, i32* %18
%76 = call i32 @close(i32 %75)
%77 = call i32 @dup2(i32 %69, i32 0)
%78 = call i32 @dup2(i32 %71, i32 1)
%79 = call i32 @execl(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32* null)
%80 = icmp eq i32 %79, -1
br i1 %80, label %81, label %84
81: ; preds = %65
%82 = load i32, i32* @stderr
%83 = call i32 @fprintf(i32 %82, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
br label %84
84: ; preds = %81, %65
%85 = call i32 @exit(i32 1)
unreachable
86: ; preds = %37
%87 = load i32, i32* @stdout
%88 = load i32, i32* @_IONBF
%89 = call i32 @setvbuf(i32 %87, i8* null, i32 %88, i32 0)
%90 = load i32, i32* %30
%91 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 1
%92 = load i32, i32* %91
%93 = getelementptr inbounds [2 x i32], [2 x i32]* %9, i64 0, i64 1
%94 = load i32, i32* %93
%95 = call i32 @close(i32 %94)
%96 = load i32, i32* %26
%97 = call i32 @close(i32 %96)
%98 = call i32 @dup2(i32 %90, i32 0)
%99 = call i32 @dup2(i32 %92, i32 1)
%100 = call i32 @execl(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i32* null)
%101 = icmp eq i32 %100, -1
br i1 %101, label %102, label %105
102: ; preds = %86
%103 = load i32, i32* @stderr
%104 = call i32 @fprintf(i32 %103, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0))
br label %105
105: ; preds = %102, %86
%106 = call i32 @exit(i32 1)
unreachable
107: ; preds = %37, %39
ret void
}