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

/* Variables and functions */
int EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ _exit(int);
int close(int);
int /*<<< orphan*/ exit(int);
int fork();
int pipe(int *);
int /*<<< orphan*/ printf(char *, ...);
int read(int, char *, unsigned int const);
int strlen(char const *);
int wait(int /*<<< orphan*/ *);
unsigned int const write(int, char const *, unsigned int const);
int main() {
  int pfd1[2];
  int pfd2[2];
  ssize_t numRead = -1;
  const char *messageOne = "Hello from child ONE.\n";
  const char *messageTwo = "Hello from child TWO.\n";
  const unsigned int commLen = strlen(messageOne) + 1;
  char buf[256];
  if (pipe(pfd1) == -1) {
    printf("Error opening pipe 1!\n");
    exit(1);
  }
  if (pipe(pfd2) == -1) {
    printf("Error opening pipe 2!\n");
    exit(1);
  }
  printf("Piped opened with success. Forking ...\n");
  switch (fork()) {
  case -1:
    printf("Error forking child 1!\n");
    exit(1);
  case 0:
    printf("\nChild 1 executing...\n");
    if (close(pfd1[0]) == -1) {
      printf("Error closing reading end of pipe 1.\n");
      _exit(1);
    }
    if (close(pfd2[1]) == -1) {
      printf("Error closing writing end of pipe 2.\n");
      _exit(1);
    }
    if (write(pfd1[1], messageOne, commLen) != commLen) {
      printf("Error writing to pipe 1.\n");
      _exit(1);
    }
    if (close(pfd1[1]) == -1) {
      printf("Error closing writing end of pipe 1.\n");
      _exit(1);
    }
    numRead = read(pfd2[0], buf, commLen);
    if (numRead == -1) {
      printf("Error reading from pipe 2.\n");
      _exit(1);
    }
    if (close(pfd2[0]) == -1) {
      printf("Error closing reding end of pipe 2.\n");
      _exit(1);
    }
    printf("Message received child ONE: %s", buf);
    printf("Exiting child 1...\n");
    _exit(0);
  default:
    break;
  }
  switch (fork()) {
  case -1:
    printf("Error forking child 2!\n");
    exit(1);
  case 0:
    printf("\nChild 2 executing...\n");
    if (close(pfd2[0]) == -1) {
      printf("Error closing reading end of pipe 2.\n");
      _exit(1);
    }
    if (close(pfd1[1]) == -1) {
      printf("Error closing writing end of pipe 1.\n");
      _exit(1);
    }
    if (read(pfd1[0], buf, commLen) == -1) {
      printf("Error reading from pipe 1.\n");
      _exit(EXIT_FAILURE);
    }
    if (close(pfd1[0]) == -1) {
      printf("Error closing reading end of pipe 1.\n");
      _exit(EXIT_FAILURE);
    }
    if (write(pfd2[1], messageTwo, commLen) != commLen) {
      printf("Error writing to the pipe.");
      _exit(EXIT_FAILURE);
    }
    if (close(pfd2[1]) == -1) {
      printf("Error closing writing end of pipe 2.");
      _exit(EXIT_FAILURE);
    }
    printf("Message received child TWO: %s", buf);
    printf("Exiting child 2...\n");
    _exit(EXIT_SUCCESS);
  default:
    break;
  }
  printf("Parent closing pipes.\n");
  if (close(pfd1[0]) == -1) {
    printf("Error closing reading end of the pipe.\n");
    exit(EXIT_FAILURE);
  }
  if (close(pfd2[1]) == -1) {
    printf("Error closing writing end of the pipe.\n");
    exit(EXIT_FAILURE);
  }
  if (close(pfd2[0]) == -1) {
    printf("Error closing reading end of the pipe.\n");
    exit(EXIT_FAILURE);
  }
  if (close(pfd1[1]) == -1) {
    printf("Error closing writing end of the pipe.\n");
    exit(EXIT_FAILURE);
  }
  printf("Parent waiting for children completion...\n");
  if (wait(NULL) == -1) {
    printf("Error waiting.\n");
    exit(EXIT_FAILURE);
  }
  if (wait(NULL) == -1) {
    printf("Error waiting.\n");
    exit(EXIT_FAILURE);
  }
  printf("Parent finishing.\n");
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x140,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xffffffff,-0x18(%rbp)
lea    0xe40(%rip),%rax
mov    %rax,-0x20(%rbp)
lea    0xe4c(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
call   1050 <strlen@plt>
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
lea    -0xc(%rbp),%rdi
call   1080 <pipe@plt>
cmp    $0xffffffff,%eax
jne    1208 <main+0x68>
lea    0xe37(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
lea    -0x14(%rbp),%rdi
call   1080 <pipe@plt>
cmp    $0xffffffff,%eax
jne    1232 <main+0x92>
lea    0xe24(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
lea    0xe23(%rip),%rdi
xor    %eax,%eax
mov    %al,-0x135(%rbp)
call   1060 <printf@plt>
mov    -0x135(%rbp),%al
call   10c0 <fork@plt>
mov    %eax,%ecx
mov    %ecx,-0x134(%rbp)
sub    $0xffffffff,%eax
je     127a <main+0xda>
jmp    1267 <main+0xc7>
mov    -0x134(%rbp),%eax
test   %eax,%eax
je     1292 <main+0xf2>
jmp    13d5 <main+0x235>
lea    0xe03(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
lea    0xe03(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0xc(%rbp),%edi
call   1070 <close@plt>
cmp    $0xffffffff,%eax
jne    12c9 <main+0x129>
lea    0xdfb(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
call   1030 <_exit@plt>
mov    -0x10(%rbp),%edi
call   1070 <close@plt>
cmp    $0xffffffff,%eax
jne    12f2 <main+0x152>
lea    0xdf8(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
call   1030 <_exit@plt>
mov    -0x8(%rbp),%edi
mov    -0x20(%rbp),%rsi
mov    -0x2c(%rbp),%edx
call   1040 <write@plt>
cmp    -0x2c(%rbp),%eax
je     1322 <main+0x182>
lea    0xdee(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
call   1030 <_exit@plt>
mov    -0x8(%rbp),%edi
call   1070 <close@plt>
cmp    $0xffffffff,%eax
jne    134b <main+0x1ab>
lea    0xddf(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
call   1030 <_exit@plt>
mov    -0x14(%rbp),%edi
lea    -0x130(%rbp),%rsi
mov    -0x2c(%rbp),%edx
call   1090 <read@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0xffffffff,-0x18(%rbp)
jne    1382 <main+0x1e2>
lea    0xdce(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
call   1030 <_exit@plt>
mov    -0x14(%rbp),%edi
call   1070 <close@plt>
cmp    $0xffffffff,%eax
jne    13ab <main+0x20b>
lea    0xdc1(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
call   1030 <_exit@plt>
lea    -0x130(%rbp),%rsi
lea    0xdc7(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xdd8(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
xor    %edi,%edi
call   1030 <_exit@plt>
jmp    13da <main+0x23a>
xor    %eax,%eax
call   10c0 <fork@plt>
mov    %eax,%ecx
mov    %ecx,-0x13c(%rbp)
sub    $0xffffffff,%eax
je     140a <main+0x26a>
jmp    13f7 <main+0x257>
mov    -0x13c(%rbp),%eax
test   %eax,%eax
je     1422 <main+0x282>
jmp    1578 <main+0x3d8>
lea    0xda2(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
lea    0xda2(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x14(%rbp),%edi
call   1070 <close@plt>
cmp    $0xffffffff,%eax
jne    1459 <main+0x2b9>
lea    0xd9a(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
call   1030 <_exit@plt>
mov    -0x8(%rbp),%edi
call   1070 <close@plt>
cmp    $0xffffffff,%eax
jne    1482 <main+0x2e2>
lea    0xca8(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
call   1030 <_exit@plt>
mov    -0xc(%rbp),%edi
lea    -0x130(%rbp),%rsi
mov    -0x2c(%rbp),%edx
call   1090 <read@plt>
cmp    $0xffffffff,%eax
jne    14b9 <main+0x319>
lea    0xd64(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    0x2b2e(%rip),%rax
mov    (%rax),%edi
call   1030 <_exit@plt>
mov    -0xc(%rbp),%edi
call   1070 <close@plt>
cmp    $0xffffffff,%eax
jne    14e6 <main+0x346>
lea    0xbe2(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    0x2b01(%rip),%rax
mov    (%rax),%edi
call   1030 <_exit@plt>
mov    -0x10(%rbp),%edi
mov    -0x28(%rbp),%rsi
mov    -0x2c(%rbp),%edx
call   1040 <write@plt>
cmp    -0x2c(%rbp),%eax
je     151a <main+0x37a>
lea    0xd1f(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    0x2acd(%rip),%rax
mov    (%rax),%edi
call   1030 <_exit@plt>
mov    -0x10(%rbp),%edi
call   1070 <close@plt>
cmp    $0xffffffff,%eax
jne    1547 <main+0x3a7>
lea    0xd0d(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    0x2aa0(%rip),%rax
mov    (%rax),%edi
call   1030 <_exit@plt>
lea    -0x130(%rbp),%rsi
lea    0xd0f(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xd20(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    0x2a67(%rip),%rax
mov    (%rax),%edi
call   1030 <_exit@plt>
jmp    157d <main+0x3dd>
lea    0xd13(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0xc(%rbp),%edi
call   1070 <close@plt>
cmp    $0xffffffff,%eax
jne    15b8 <main+0x418>
lea    0xd0b(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    0x2a2f(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>
mov    -0x10(%rbp),%edi
call   1070 <close@plt>
cmp    $0xffffffff,%eax
jne    15e5 <main+0x445>
lea    0xd06(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    0x2a02(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>
mov    -0x14(%rbp),%edi
call   1070 <close@plt>
cmp    $0xffffffff,%eax
jne    1612 <main+0x472>
lea    0xcb1(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    0x29d5(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>
mov    -0x8(%rbp),%edi
call   1070 <close@plt>
cmp    $0xffffffff,%eax
jne    163f <main+0x49f>
lea    0xcac(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    0x29a8(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>
lea    0xcb8(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   10b0 <wait@plt>
cmp    $0xffffffff,%eax
jne    167b <main+0x4db>
lea    0xcc3(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    0x296c(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>
xor    %eax,%eax
mov    %eax,%edi
call   10b0 <wait@plt>
cmp    $0xffffffff,%eax
jne    16a9 <main+0x509>
lea    0xc95(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    0x293e(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>
lea    0xc89(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    0x291a(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x110,%rsp
lea    0xe41(%rip),%rdi
call   1060 <strlen@plt>
mov    %eax,%ebx
lea    0x8(%rsp),%rdi
call   1090 <pipe@plt>
cmp    $0xffffffff,%eax
jne    11de <main+0x2e>
lea    0x111e(%rip),%rdi
jmp    1259 <main+0xa9>
mov    %rsp,%rdi
call   1090 <pipe@plt>
cmp    $0xffffffff,%eax
jne    11f4 <main+0x44>
lea    0x10f2(%rip),%rdi
jmp    1259 <main+0xa9>
add    $0x1,%ebx
lea    0xe89(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   10d0 <fork@plt>
test   %eax,%eax
je     121c <main+0x6c>
cmp    $0xffffffff,%eax
jne    1242 <main+0x92>
lea    0xf3a(%rip),%rdi
jmp    1259 <main+0xa9>
lea    0xe8b(%rip),%rdi
call   1040 <puts@plt>
mov    0x8(%rsp),%edi
call   1080 <close@plt>
cmp    $0xffffffff,%eax
jne    1268 <main+0xb8>
lea    0xf57(%rip),%rdi
jmp    1355 <main+0x1a5>
xor    %eax,%eax
call   10d0 <fork@plt>
test   %eax,%eax
je     1282 <main+0xd2>
cmp    $0xffffffff,%eax
jne    12a7 <main+0xf7>
lea    0xfc5(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
mov    0x4(%rsp),%edi
call   1080 <close@plt>
cmp    $0xffffffff,%eax
jne    12ca <main+0x11a>
lea    0xeb2(%rip),%rdi
jmp    1355 <main+0x1a5>
lea    0xee2(%rip),%rdi
call   1040 <puts@plt>
mov    (%rsp),%edi
call   1080 <close@plt>
cmp    $0xffffffff,%eax
jne    130f <main+0x15f>
lea    0xf57(%rip),%rdi
jmp    1355 <main+0x1a5>
lea    0xf87(%rip),%rdi
call   1040 <puts@plt>
mov    0x8(%rsp),%edi
call   1080 <close@plt>
cmp    $0xffffffff,%eax
jne    1326 <main+0x176>
lea    0xff5(%rip),%rdi
jmp    133b <main+0x18b>
mov    0xc(%rsp),%edi
lea    0xd2b(%rip),%rsi
mov    %ebx,%edx
call   1050 <write@plt>
cmp    %ebx,%eax
jne    134e <main+0x19e>
mov    0xc(%rsp),%edi
call   1080 <close@plt>
cmp    $0xffffffff,%eax
je     131d <main+0x16d>
mov    (%rsp),%edi
lea    0x10(%rsp),%rsi
mov    %ebx,%edx
call   10a0 <read@plt>
cmp    $0xffffffff,%eax
jne    13f1 <main+0x241>
lea    0xdee(%rip),%rdi
jmp    1355 <main+0x1a5>
mov    0xc(%rsp),%edi
call   1080 <close@plt>
cmp    $0xffffffff,%eax
jne    1364 <main+0x1b4>
lea    0xeb0(%rip),%rdi
jmp    1355 <main+0x1a5>
mov    0x4(%rsp),%edi
call   1080 <close@plt>
cmp    $0xffffffff,%eax
jne    1382 <main+0x1d2>
lea    0xf5b(%rip),%rdi
call   1040 <puts@plt>
mov    0x2c99(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
lea    0xdc1(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%edi
call   1030 <_exit@plt>
mov    0x8(%rsp),%edi
lea    0x10(%rsp),%rsi
mov    %ebx,%edx
call   10a0 <read@plt>
cmp    $0xffffffff,%eax
jne    13d5 <main+0x225>
lea    0xe39(%rip),%rdi
jmp    13ea <main+0x23a>
mov    (%rsp),%edi
call   1080 <close@plt>
cmp    $0xffffffff,%eax
je     12c1 <main+0x111>
mov    0xc(%rsp),%edi
call   1080 <close@plt>
cmp    $0xffffffff,%eax
je     1334 <main+0x184>
lea    0xea3(%rip),%rdi
call   1040 <puts@plt>
xor    %edi,%edi
call   10c0 <wait@plt>
cmp    $0xffffffff,%eax
je     13c9 <main+0x219>
xor    %edi,%edi
call   10c0 <wait@plt>
cmp    $0xffffffff,%eax
jne    1479 <main+0x2c9>
lea    0xeb7(%rip),%rdi
jmp    133b <main+0x18b>
mov    0x8(%rsp),%edi
call   1080 <close@plt>
cmp    $0xffffffff,%eax
jne    140a <main+0x25a>
lea    0xdaa(%rip),%rdi
call   1040 <puts@plt>
jmp    146b <main+0x2bb>
mov    (%rsp),%edi
call   1080 <close@plt>
cmp    $0xffffffff,%eax
jne    1437 <main+0x287>
lea    0xcd2(%rip),%rdi
jmp    1355 <main+0x1a5>
mov    0x4(%rsp),%edi
lea    0xc02(%rip),%rsi
mov    %ebx,%edx
call   1050 <write@plt>
cmp    %ebx,%eax
jne    145d <main+0x2ad>
mov    0x4(%rsp),%edi
call   1080 <close@plt>
cmp    $0xffffffff,%eax
jne    1493 <main+0x2e3>
lea    0xcfa(%rip),%rdi
jmp    1464 <main+0x2b4>
lea    0xbf0(%rip),%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xc73(%rip),%rdi
call   1040 <puts@plt>
xor    %edi,%edi
call   1030 <_exit@plt>
lea    0xbe9(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x2b6e(%rip),%rax
mov    (%rax),%edi
call   1030 <_exit@plt>
lea    0xdf5(%rip),%rdi
call   1040 <puts@plt>
mov    0x2b4c(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
lea    0xbce(%rip),%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xcd4(%rip),%rdi
call   1040 <puts@plt>
mov    0x2b1f(%rip),%rax
mov    (%rax),%edi
call   1030 <_exit@plt>

LLVM IR (-O0):
@.str = [23 x i8] c"Hello from child ONE.\0A\00"
@.str.1 = [23 x i8] c"Hello from child TWO.\0A\00"
@.str.2 = [23 x i8] c"Error opening pipe 1!\0A\00"
@.str.3 = [23 x i8] c"Error opening pipe 2!\0A\00"
@.str.4 = [40 x i8] c"Piped opened with success. Forking ...\0A\00"
@.str.5 = [24 x i8] c"Error forking child 1!\0A\00"
@.str.6 = [23 x i8] c"\0AChild 1 executing...\0A\00"
@.str.7 = [38 x i8] c"Error closing reading end of pipe 1.\0A\00"
@.str.8 = [38 x i8] c"Error closing writing end of pipe 2.\0A\00"
@.str.9 = [26 x i8] c"Error writing to pipe 1.\0A\00"
@.str.10 = [38 x i8] c"Error closing writing end of pipe 1.\0A\00"
@.str.11 = [28 x i8] c"Error reading from pipe 2.\0A\00"
@.str.12 = [37 x i8] c"Error closing reding end of pipe 2.\0A\00"
@.str.13 = [31 x i8] c"Message received child ONE: %s\00"
@.str.14 = [20 x i8] c"Exiting child 1...\0A\00"
@.str.15 = [24 x i8] c"Error forking child 2!\0A\00"
@.str.16 = [23 x i8] c"\0AChild 2 executing...\0A\00"
@.str.17 = [38 x i8] c"Error closing reading end of pipe 2.\0A\00"
@.str.18 = [28 x i8] c"Error reading from pipe 1.\0A\00"
@EXIT_FAILURE = global i32 0
@.str.19 = [27 x i8] c"Error writing to the pipe.\00"
@.str.20 = [37 x i8] c"Error closing writing end of pipe 2.\00"
@.str.21 = [31 x i8] c"Message received child TWO: %s\00"
@.str.22 = [20 x i8] c"Exiting child 2...\0A\00"
@EXIT_SUCCESS = global i32 0
@.str.23 = [23 x i8] c"Parent closing pipes.\0A\00"
@.str.24 = [40 x i8] c"Error closing reading end of the pipe.\0A\00"
@.str.25 = [40 x i8] c"Error closing writing end of the pipe.\0A\00"
@.str.26 = [43 x i8] c"Parent waiting for children completion...\0A\00"
@.str.27 = [16 x i8] c"Error waiting.\0A\00"
@.str.28 = [19 x i8] c"Parent finishing.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [2 x i32]
%3 = alloca [2 x i32]
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca [256 x i8]
store i32 0, i32* %1
store i32 -1, i32* %4
store i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8** %5
store i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i8** %6
%9 = load i8*, i8** %5
%10 = call i32 @strlen(i8* %9)
%11 = add nsw i32 %10, 1
store i32 %11, i32* %7
%12 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
%13 = call i32 @pipe(i32* %12)
%14 = icmp eq i32 %13, -1
br i1 %14, label %15, label %18
15: ; preds = %0
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
%17 = call i32 @exit(i32 1)
unreachable
18: ; preds = %0
%19 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
%20 = call i32 @pipe(i32* %19)
%21 = icmp eq i32 %20, -1
br i1 %21, label %22, label %25
22: ; preds = %18
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0))
%24 = call i32 @exit(i32 1)
unreachable
25: ; preds = %18
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.4, i64 0, i64 0))
%27 = call i32 (...) @fork()
switch i32 %27, label %91 [
i32 -1, label %28
i32 0, label %31
]
28: ; preds = %25
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0))
%30 = call i32 @exit(i32 1)
unreachable
31: ; preds = %25
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0))
%33 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
%34 = load i32, i32* %33
%35 = call i32 @close(i32 %34)
%36 = icmp eq i32 %35, -1
br i1 %36, label %37, label %40
37: ; preds = %31
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.7, i64 0, i64 0))
%39 = call i32 @_exit(i32 1)
unreachable
40: ; preds = %31
%41 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 1
%42 = load i32, i32* %41
%43 = call i32 @close(i32 %42)
%44 = icmp eq i32 %43, -1
br i1 %44, label %45, label %48
45: ; preds = %40
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.8, i64 0, i64 0))
%47 = call i32 @_exit(i32 1)
unreachable
48: ; preds = %40
%49 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 1
%50 = load i32, i32* %49
%51 = load i8*, i8** %5
%52 = load i32, i32* %7
%53 = call i32 @write(i32 %50, i8* %51, i32 %52)
%54 = load i32, i32* %7
%55 = icmp ne i32 %53, %54
br i1 %55, label %56, label %59
56: ; preds = %48
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.9, i64 0, i64 0))
%58 = call i32 @_exit(i32 1)
unreachable
59: ; preds = %48
%60 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 1
%61 = load i32, i32* %60
%62 = call i32 @close(i32 %61)
%63 = icmp eq i32 %62, -1
br i1 %63, label %64, label %67
64: ; preds = %59
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.10, i64 0, i64 0))
%66 = call i32 @_exit(i32 1)
unreachable
67: ; preds = %59
%68 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
%69 = load i32, i32* %68
%70 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%71 = load i32, i32* %7
%72 = call i32 @read(i32 %69, i8* %70, i32 %71)
store i32 %72, i32* %4
%73 = load i32, i32* %4
%74 = icmp eq i32 %73, -1
br i1 %74, label %75, label %78
75: ; preds = %67
%76 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.11, i64 0, i64 0))
%77 = call i32 @_exit(i32 1)
unreachable
78: ; preds = %67
%79 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
%80 = load i32, i32* %79
%81 = call i32 @close(i32 %80)
%82 = icmp eq i32 %81, -1
br i1 %82, label %83, label %86
83: ; preds = %78
%84 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.12, i64 0, i64 0))
%85 = call i32 @_exit(i32 1)
unreachable
86: ; preds = %78
%87 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%88 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.13, i64 0, i64 0), i8* %87)
%89 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.14, i64 0, i64 0))
%90 = call i32 @_exit(i32 0)
unreachable
91: ; preds = %25
br label %92
92: ; preds = %91
%93 = call i32 (...) @fork()
switch i32 %93, label %161 [
i32 -1, label %94
i32 0, label %97
]
94: ; preds = %92
%95 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.15, i64 0, i64 0))
%96 = call i32 @exit(i32 1)
unreachable
97: ; preds = %92
%98 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.16, i64 0, i64 0))
%99 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
%100 = load i32, i32* %99
%101 = call i32 @close(i32 %100)
%102 = icmp eq i32 %101, -1
br i1 %102, label %103, label %106
103: ; preds = %97
%104 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.17, i64 0, i64 0))
%105 = call i32 @_exit(i32 1)
unreachable
106: ; preds = %97
%107 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 1
%108 = load i32, i32* %107
%109 = call i32 @close(i32 %108)
%110 = icmp eq i32 %109, -1
br i1 %110, label %111, label %114
111: ; preds = %106
%112 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.10, i64 0, i64 0))
%113 = call i32 @_exit(i32 1)
unreachable
114: ; preds = %106
%115 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
%116 = load i32, i32* %115
%117 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%118 = load i32, i32* %7
%119 = call i32 @read(i32 %116, i8* %117, i32 %118)
%120 = icmp eq i32 %119, -1
br i1 %120, label %121, label %125
121: ; preds = %114
%122 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.18, i64 0, i64 0))
%123 = load i32, i32* @EXIT_FAILURE
%124 = call i32 @_exit(i32 %123)
unreachable
125: ; preds = %114
%126 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
%127 = load i32, i32* %126
%128 = call i32 @close(i32 %127)
%129 = icmp eq i32 %128, -1
br i1 %129, label %130, label %134
130: ; preds = %125
%131 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.7, i64 0, i64 0))
%132 = load i32, i32* @EXIT_FAILURE
%133 = call i32 @_exit(i32 %132)
unreachable
134: ; preds = %125
%135 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 1
%136 = load i32, i32* %135
%137 = load i8*, i8** %6
%138 = load i32, i32* %7
%139 = call i32 @write(i32 %136, i8* %137, i32 %138)
%140 = load i32, i32* %7
%141 = icmp ne i32 %139, %140
br i1 %141, label %142, label %146
142: ; preds = %134
%143 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.19, i64 0, i64 0))
%144 = load i32, i32* @EXIT_FAILURE
%145 = call i32 @_exit(i32 %144)
unreachable
146: ; preds = %134
%147 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 1
%148 = load i32, i32* %147
%149 = call i32 @close(i32 %148)
%150 = icmp eq i32 %149, -1
br i1 %150, label %151, label %155
151: ; preds = %146
%152 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.20, i64 0, i64 0))
%153 = load i32, i32* @EXIT_FAILURE
%154 = call i32 @_exit(i32 %153)
unreachable
155: ; preds = %146
%156 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%157 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.21, i64 0, i64 0), i8* %156)
%158 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.22, i64 0, i64 0))
%159 = load i32, i32* @EXIT_SUCCESS
%160 = call i32 @_exit(i32 %159)
unreachable
161: ; preds = %92
br label %162
162: ; preds = %161
%163 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.23, i64 0, i64 0))
%164 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
%165 = load i32, i32* %164
%166 = call i32 @close(i32 %165)
%167 = icmp eq i32 %166, -1
br i1 %167, label %168, label %172
168: ; preds = %162
%169 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.24, i64 0, i64 0))
%170 = load i32, i32* @EXIT_FAILURE
%171 = call i32 @exit(i32 %170)
unreachable
172: ; preds = %162
%173 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 1
%174 = load i32, i32* %173
%175 = call i32 @close(i32 %174)
%176 = icmp eq i32 %175, -1
br i1 %176, label %177, label %181
177: ; preds = %172
%178 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.25, i64 0, i64 0))
%179 = load i32, i32* @EXIT_FAILURE
%180 = call i32 @exit(i32 %179)
unreachable
181: ; preds = %172
%182 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
%183 = load i32, i32* %182
%184 = call i32 @close(i32 %183)
%185 = icmp eq i32 %184, -1
br i1 %185, label %186, label %190
186: ; preds = %181
%187 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.24, i64 0, i64 0))
%188 = load i32, i32* @EXIT_FAILURE
%189 = call i32 @exit(i32 %188)
unreachable
190: ; preds = %181
%191 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 1
%192 = load i32, i32* %191
%193 = call i32 @close(i32 %192)
%194 = icmp eq i32 %193, -1
br i1 %194, label %195, label %199
195: ; preds = %190
%196 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.25, i64 0, i64 0))
%197 = load i32, i32* @EXIT_FAILURE
%198 = call i32 @exit(i32 %197)
unreachable
199: ; preds = %190
%200 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.26, i64 0, i64 0))
%201 = call i32 @wait(i32* null)
%202 = icmp eq i32 %201, -1
br i1 %202, label %203, label %207
203: ; preds = %199
%204 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.27, i64 0, i64 0))
%205 = load i32, i32* @EXIT_FAILURE
%206 = call i32 @exit(i32 %205)
unreachable
207: ; preds = %199
%208 = call i32 @wait(i32* null)
%209 = icmp eq i32 %208, -1
br i1 %209, label %210, label %214
210: ; preds = %207
%211 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.27, i64 0, i64 0))
%212 = load i32, i32* @EXIT_FAILURE
%213 = call i32 @exit(i32 %212)
unreachable
214: ; preds = %207
%215 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.28, i64 0, i64 0))
%216 = load i32, i32* @EXIT_SUCCESS
%217 = call i32 @exit(i32 %216)
unreachable
}

LLVM IR (-O2):
@.str = [23 x i8] c"Hello from child ONE.\0A\00"
@.str.1 = [23 x i8] c"Hello from child TWO.\0A\00"
@.str.13 = [31 x i8] c"Message received child ONE: %s\00"
@EXIT_FAILURE = global i32 0
@.str.19 = [27 x i8] c"Error writing to the pipe.\00"
@.str.21 = [31 x i8] c"Message received child TWO: %s\00"
@EXIT_SUCCESS = global i32 0
@str = [39 x i8] c"Piped opened with success. Forking ...\00"
@str.29 = [22 x i8] c"\0AChild 1 executing...\00"
@str.30 = [19 x i8] c"Exiting child 1...\00"
@str.31 = [36 x i8] c"Error closing reding end of pipe 2.\00"
@str.32 = [27 x i8] c"Error reading from pipe 2.\00"
@str.34 = [25 x i8] c"Error writing to pipe 1.\00"
@str.35 = [37 x i8] c"Error closing writing end of pipe 2.\00"
@str.37 = [23 x i8] c"Error forking child 1!\00"
@str.38 = [22 x i8] c"\0AChild 2 executing...\00"
@str.39 = [19 x i8] c"Exiting child 2...\00"
@str.40 = [37 x i8] c"Error closing reading end of pipe 1.\00"
@str.41 = [27 x i8] c"Error reading from pipe 1.\00"
@str.42 = [37 x i8] c"Error closing writing end of pipe 1.\00"
@str.43 = [37 x i8] c"Error closing reading end of pipe 2.\00"
@str.44 = [23 x i8] c"Error forking child 2!\00"
@str.45 = [22 x i8] c"Parent closing pipes.\00"
@str.46 = [42 x i8] c"Parent waiting for children completion...\00"
@str.47 = [18 x i8] c"Parent finishing.\00"
@str.49 = [15 x i8] c"Error waiting.\00"
@str.52 = [39 x i8] c"Error closing writing end of the pipe.\00"
@str.53 = [39 x i8] c"Error closing reading end of the pipe.\00"
@str.54 = [22 x i8] c"Error opening pipe 2!\00"
@str.55 = [22 x i8] c"Error opening pipe 1!\00"
define i32 @main() {
%1 = alloca [2 x i32]
%2 = alloca [2 x i32]
%3 = alloca [256 x i8]
%4 = bitcast [2 x i32]* %1 to i8*
%5 = bitcast [2 x i32]* %2 to i8*
%6 = tail call i32 @strlen(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%7 = add nsw i32 %6, 1
%8 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%9 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 0, i64 0
%10 = call i32 @pipe(i32* %9)
%11 = icmp eq i32 %10, -1
br i1 %11, label %12, label %15
12: ; preds = %0
%13 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.55, i64 0, i64 0))
%14 = call i32 @exit(i32 1)
unreachable
15: ; preds = %0
%16 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
%17 = call i32 @pipe(i32* %16)
%18 = icmp eq i32 %17, -1
br i1 %18, label %19, label %22
19: ; preds = %15
%20 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.54, i64 0, i64 0))
%21 = call i32 @exit(i32 1)
unreachable
22: ; preds = %15
%23 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str, i64 0, i64 0))
%24 = call i32 (...) @fork()
switch i32 %24, label %77 [
i32 -1, label %25
i32 0, label %28
]
25: ; preds = %22
%26 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.37, i64 0, i64 0))
%27 = call i32 @exit(i32 1)
unreachable
28: ; preds = %22
%29 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.29, i64 0, i64 0))
%30 = load i32, i32* %9
%31 = call i32 @close(i32 %30)
%32 = icmp eq i32 %31, -1
br i1 %32, label %33, label %36
33: ; preds = %28
%34 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str.40, i64 0, i64 0))
%35 = call i32 @_exit(i32 1)
unreachable
36: ; preds = %28
%37 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 1
%38 = load i32, i32* %37
%39 = call i32 @close(i32 %38)
%40 = icmp eq i32 %39, -1
br i1 %40, label %41, label %44
41: ; preds = %36
%42 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str.35, i64 0, i64 0))
%43 = call i32 @_exit(i32 1)
unreachable
44: ; preds = %36
%45 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 0, i64 1
%46 = load i32, i32* %45
%47 = call i32 @write(i32 %46, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %7)
%48 = icmp eq i32 %47, %7
br i1 %48, label %52, label %49
49: ; preds = %44
%50 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.34, i64 0, i64 0))
%51 = call i32 @_exit(i32 1)
unreachable
52: ; preds = %44
%53 = load i32, i32* %45
%54 = call i32 @close(i32 %53)
%55 = icmp eq i32 %54, -1
br i1 %55, label %56, label %59
56: ; preds = %52
%57 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str.42, i64 0, i64 0))
%58 = call i32 @_exit(i32 1)
unreachable
59: ; preds = %52
%60 = load i32, i32* %16
%61 = call i32 @read(i32 %60, i8* %8, i32 %7)
%62 = icmp eq i32 %61, -1
br i1 %62, label %63, label %66
63: ; preds = %59
%64 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.32, i64 0, i64 0))
%65 = call i32 @_exit(i32 1)
unreachable
66: ; preds = %59
%67 = load i32, i32* %16
%68 = call i32 @close(i32 %67)
%69 = icmp eq i32 %68, -1
br i1 %69, label %70, label %73
70: ; preds = %66
%71 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.31, i64 0, i64 0))
%72 = call i32 @_exit(i32 1)
unreachable
73: ; preds = %66
%74 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.13, i64 0, i64 0), i8* %8)
%75 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.30, i64 0, i64 0))
%76 = call i32 @_exit(i32 0)
unreachable
77: ; preds = %22
%78 = call i32 (...) @fork()
switch i32 %78, label %136 [
i32 -1, label %79
i32 0, label %82
]
79: ; preds = %77
%80 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.44, i64 0, i64 0))
%81 = call i32 @exit(i32 1)
unreachable
82: ; preds = %77
%83 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.38, i64 0, i64 0))
%84 = load i32, i32* %16
%85 = call i32 @close(i32 %84)
%86 = icmp eq i32 %85, -1
br i1 %86, label %87, label %90
87: ; preds = %82
%88 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str.43, i64 0, i64 0))
%89 = call i32 @_exit(i32 1)
unreachable
90: ; preds = %82
%91 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 0, i64 1
%92 = load i32, i32* %91
%93 = call i32 @close(i32 %92)
%94 = icmp eq i32 %93, -1
br i1 %94, label %95, label %98
95: ; preds = %90
%96 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str.42, i64 0, i64 0))
%97 = call i32 @_exit(i32 1)
unreachable
98: ; preds = %90
%99 = load i32, i32* %9
%100 = call i32 @read(i32 %99, i8* %8, i32 %7)
%101 = icmp eq i32 %100, -1
br i1 %101, label %102, label %106
102: ; preds = %98
%103 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.41, i64 0, i64 0))
%104 = load i32, i32* @EXIT_FAILURE
%105 = call i32 @_exit(i32 %104)
unreachable
106: ; preds = %98
%107 = load i32, i32* %9
%108 = call i32 @close(i32 %107)
%109 = icmp eq i32 %108, -1
br i1 %109, label %110, label %114
110: ; preds = %106
%111 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str.40, i64 0, i64 0))
%112 = load i32, i32* @EXIT_FAILURE
%113 = call i32 @_exit(i32 %112)
unreachable
114: ; preds = %106
%115 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 1
%116 = load i32, i32* %115
%117 = call i32 @write(i32 %116, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 %7)
%118 = icmp eq i32 %117, %7
br i1 %118, label %123, label %119
119: ; preds = %114
%120 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.19, i64 0, i64 0))
%121 = load i32, i32* @EXIT_FAILURE
%122 = call i32 @_exit(i32 %121)
unreachable
123: ; preds = %114
%124 = load i32, i32* %115
%125 = call i32 @close(i32 %124)
%126 = icmp eq i32 %125, -1
br i1 %126, label %127, label %131
127: ; preds = %123
%128 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str.35, i64 0, i64 0))
%129 = load i32, i32* @EXIT_FAILURE
%130 = call i32 @_exit(i32 %129)
unreachable
131: ; preds = %123
%132 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.21, i64 0, i64 0), i8* %8)
%133 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.39, i64 0, i64 0))
%134 = load i32, i32* @EXIT_SUCCESS
%135 = call i32 @_exit(i32 %134)
unreachable
136: ; preds = %77
%137 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.45, i64 0, i64 0))
%138 = load i32, i32* %9
%139 = call i32 @close(i32 %138)
%140 = icmp eq i32 %139, -1
br i1 %140, label %141, label %145
141: ; preds = %136
%142 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.53, i64 0, i64 0))
%143 = load i32, i32* @EXIT_FAILURE
%144 = call i32 @exit(i32 %143)
unreachable
145: ; preds = %136
%146 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 1
%147 = load i32, i32* %146
%148 = call i32 @close(i32 %147)
%149 = icmp eq i32 %148, -1
br i1 %149, label %150, label %154
150: ; preds = %145
%151 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.52, i64 0, i64 0))
%152 = load i32, i32* @EXIT_FAILURE
%153 = call i32 @exit(i32 %152)
unreachable
154: ; preds = %145
%155 = load i32, i32* %16
%156 = call i32 @close(i32 %155)
%157 = icmp eq i32 %156, -1
br i1 %157, label %158, label %162
158: ; preds = %154
%159 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.53, i64 0, i64 0))
%160 = load i32, i32* @EXIT_FAILURE
%161 = call i32 @exit(i32 %160)
unreachable
162: ; preds = %154
%163 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 0, i64 1
%164 = load i32, i32* %163
%165 = call i32 @close(i32 %164)
%166 = icmp eq i32 %165, -1
br i1 %166, label %167, label %171
167: ; preds = %162
%168 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.52, i64 0, i64 0))
%169 = load i32, i32* @EXIT_FAILURE
%170 = call i32 @exit(i32 %169)
unreachable
171: ; preds = %162
%172 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str.46, i64 0, i64 0))
%173 = call i32 @wait(i32* null)
%174 = icmp eq i32 %173, -1
br i1 %174, label %175, label %179
175: ; preds = %171
%176 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.49, i64 0, i64 0))
%177 = load i32, i32* @EXIT_FAILURE
%178 = call i32 @exit(i32 %177)
unreachable
179: ; preds = %171
%180 = call i32 @wait(i32* null)
%181 = icmp eq i32 %180, -1
br i1 %181, label %182, label %186
182: ; preds = %179
%183 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.49, i64 0, i64 0))
%184 = load i32, i32* @EXIT_FAILURE
%185 = call i32 @exit(i32 %184)
unreachable
186: ; preds = %179
%187 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.47, i64 0, i64 0))
%188 = load i32, i32* @EXIT_SUCCESS
%189 = call i32 @exit(i32 %188)
unreachable
}