#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;
typedef int mode_t;

/* Variables and functions */
scalar_t__ EEXIST;
int S_IRUSR;
int S_IWUSR;
int /*<<< orphan*/ checkInput(int, char **);
scalar_t__ errno;
int /*<<< orphan*/ exit(int);
int fork();
int getppid();
int mkfifo(char *, int);
int /*<<< orphan*/ namedPipe(char *, char *, char *, int, int, int);
int /*<<< orphan*/ noNamedPipe(char *, char *, int *, int, int);
int /*<<< orphan*/ perror(char *);
int pipe(int *);
int /*<<< orphan*/ printf(char *);
scalar_t__ strcmp(char *, char *);
int main(int argc, char *argv[]) {
  checkInput(argc, argv);
  bool pipeIsNamed = true;
  int argBase = 2;
  if (strcmp(argv[1], "u") == 0) {
    pipeIsNamed = false;
    --argBase;
  }
  char *pipeName;
  if (pipeIsNamed)
    pipeName = argv[argBase];
  bool parentToChild = true;
  if (strcmp(argv[argBase + 1], "c") == 0)
    parentToChild = false;
  char *pipeMessage;
  pipeMessage = argv[argBase + 2];
  mode_t fifo_mode = S_IRUSR | S_IWUSR;
  int f_des[2];
  int maxBufferSize = 32;
  if (pipeIsNamed) {
    if ((mkfifo(pipeName, fifo_mode) == -1) && (errno != EEXIST)) {
      perror("Could not generate pipe, exiting...");
      exit(1);
    }
  } else {
    if (pipe(f_des) == -1) {
      perror("Could not generate pipe, exiting...");
      exit(2);
    }
  }
  pid_t childId;
  if ((childId = fork()) == -1) {
    printf("Unable to fork child, exiting...\n");
    exit(5);
  } else if (childId == 0) {
    if (pipeIsNamed) {
      if (parentToChild)
        namedPipe("Child", "", pipeName, maxBufferSize, getppid(), true);
      else
        namedPipe("Child", pipeMessage, pipeName, maxBufferSize, getppid(),
                  false);
    } else {
      if (parentToChild)
        noNamedPipe("Child", "", f_des, maxBufferSize, true);
      else
        noNamedPipe("Child", pipeMessage, f_des, maxBufferSize, false);
    }
  } else {
    if (childId == -1) {
      printf("Unable to fork child, exiting...\n");
      exit(5);
    }
    if (pipeIsNamed) {
      if (parentToChild)
        namedPipe("Parent", pipeMessage, pipeName, maxBufferSize, childId,
                  false);
      else
        namedPipe("Parent", "", pipeName, maxBufferSize, childId, true);
    } else {
      if (parentToChild)
        noNamedPipe("Parent", pipeMessage, f_des, maxBufferSize, false);
      else
        noNamedPipe("Parent", "", f_des, maxBufferSize, true);
    }
  }
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1090 <checkInput@plt>
movl   $0x1,-0x14(%rbp)
movl   $0x2,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe11(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    120e <main+0x5e>
movl   $0x0,-0x14(%rbp)
mov    -0x18(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1228 <main+0x78>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x20(%rbp)
movl   $0x1,-0x24(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xdbb(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    125d <main+0xad>
movl   $0x0,-0x24(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x30(%rbp)
mov    0x2d4f(%rip),%rax
mov    (%rax),%eax
mov    0x2d66(%rip),%rcx
or     (%rcx),%eax
mov    %eax,-0x34(%rbp)
movl   $0x20,-0x40(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     12e2 <main+0x132>
mov    -0x20(%rbp),%rdi
mov    -0x34(%rbp),%esi
call   1080 <mkfifo@plt>
cmp    $0xffffffff,%eax
jne    12dd <main+0x12d>
mov    0x2d1c(%rip),%rax
mov    (%rax),%rax
mov    0x2d1a(%rip),%rcx
cmp    (%rcx),%rax
je     12dd <main+0x12d>
lea    0xd36(%rip),%rdi
call   10a0 <perror@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
jmp    130f <main+0x15f>
lea    -0x3c(%rbp),%rdi
call   1060 <pipe@plt>
cmp    $0xffffffff,%eax
jne    130a <main+0x15a>
lea    0xd09(%rip),%rdi
call   10a0 <perror@plt>
mov    $0x2,%edi
call   10c0 <exit@plt>
jmp    130f <main+0x15f>
mov    $0x0,%al
call   10d0 <fork@plt>
mov    %eax,-0x44(%rbp)
cmp    $0xffffffff,%eax
jne    1338 <main+0x188>
lea    0xcff(%rip),%rdi
call   1050 <printf@plt>
mov    $0x5,%edi
call   10c0 <exit@plt>
cmpl   $0x0,-0x44(%rbp)
jne    1425 <main+0x275>
cmpl   $0x0,-0x14(%rbp)
je     13d2 <main+0x222>
cmpl   $0x0,-0x24(%rbp)
je     1393 <main+0x1e3>
mov    -0x20(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x40(%rbp),%eax
mov    %eax,-0x48(%rbp)
mov    $0x0,%al
call   10b0 <getppid@plt>
mov    -0x50(%rbp),%rdx
mov    -0x48(%rbp),%ecx
mov    %eax,%r8d
lea    0xcce(%rip),%rdi
lea    0xcc6(%rip),%rsi
mov    $0x1,%r9d
call   1030 <namedPipe@plt>
jmp    13cd <main+0x21d>
mov    -0x30(%rbp),%rax
mov    %rax,-0x68(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x60(%rbp)
mov    -0x40(%rbp),%eax
mov    %eax,-0x54(%rbp)
mov    $0x0,%al
call   10b0 <getppid@plt>
mov    -0x68(%rbp),%rsi
mov    -0x60(%rbp),%rdx
mov    -0x54(%rbp),%ecx
mov    %eax,%r8d
lea    0xc85(%rip),%rdi
xor    %r9d,%r9d
call   1030 <namedPipe@plt>
jmp    1420 <main+0x270>
cmpl   $0x0,-0x24(%rbp)
je     1401 <main+0x251>
lea    -0x3c(%rbp),%rdx
mov    -0x40(%rbp),%ecx
lea    0xc60(%rip),%rdi
lea    0xc58(%rip),%rsi
mov    $0x1,%r8d
call   1040 <noNamedPipe@plt>
jmp    141b <main+0x26b>
mov    -0x30(%rbp),%rsi
lea    -0x3c(%rbp),%rdx
mov    -0x40(%rbp),%ecx
lea    0xc37(%rip),%rdi
xor    %r8d,%r8d
call   1040 <noNamedPipe@plt>
jmp    1420 <main+0x270>
jmp    14f8 <main+0x348>
cmpl   $0xffffffff,-0x44(%rbp)
jne    1445 <main+0x295>
lea    0xbf2(%rip),%rdi
call   1050 <printf@plt>
mov    $0x5,%edi
call   10c0 <exit@plt>
cmpl   $0x0,-0x14(%rbp)
je     14a5 <main+0x2f5>
cmpl   $0x0,-0x24(%rbp)
je     147c <main+0x2cc>
mov    -0x30(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x40(%rbp),%ecx
mov    -0x44(%rbp),%r8d
lea    0xbe1(%rip),%rdi
xor    %r9d,%r9d
call   1030 <namedPipe@plt>
jmp    14a0 <main+0x2f0>
mov    -0x20(%rbp),%rdx
mov    -0x40(%rbp),%ecx
mov    -0x44(%rbp),%r8d
lea    0xbc2(%rip),%rdi
lea    0xbb4(%rip),%rsi
mov    $0x1,%r9d
call   1030 <namedPipe@plt>
jmp    14f3 <main+0x343>
cmpl   $0x0,-0x24(%rbp)
je     14ce <main+0x31e>
mov    -0x30(%rbp),%rsi
lea    -0x3c(%rbp),%rdx
mov    -0x40(%rbp),%ecx
lea    0xb8f(%rip),%rdi
xor    %r8d,%r8d
call   1040 <noNamedPipe@plt>
jmp    14ee <main+0x33e>
lea    -0x3c(%rbp),%rdx
mov    -0x40(%rbp),%ecx
lea    0xb74(%rip),%rdi
lea    0xb66(%rip),%rsi
mov    $0x1,%r8d
call   1040 <noNamedPipe@plt>
jmp    14f3 <main+0x343>
jmp    14f8 <main+0x348>
jmp    14fd <main+0x34d>
xor    %edi,%edi
call   10c0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
call   1090 <checkInput@plt>
mov    0x8(%rbx),%rdi
lea    0xe30(%rip),%rsi
call   1070 <strcmp@plt>
mov    %rax,%r13
xor    %eax,%eax
test   %r13,%r13
sete   %al
mov    $0x2,%ecx
sub    %eax,%ecx
mov    %ecx,%r15d
test   %r13,%r13
je     11f3 <main+0x43>
mov    (%rbx,%r15,8),%r14
mov    0x8(%rbx,%r15,8),%rdi
lea    0xe03(%rip),%rsi
call   1070 <strcmp@plt>
mov    %rax,%r12
mov    0x10(%rbx,%r15,8),%r15
test   %r13,%r13
jne    1236 <main+0x86>
lea    0x8(%rsp),%rdi
call   1060 <pipe@plt>
cmp    $0xffffffff,%eax
jne    126b <main+0xbb>
lea    0xddd(%rip),%rdi
call   10a0 <perror@plt>
mov    $0x2,%edi
call   10c0 <exit@plt>
mov    0x2d8b(%rip),%rax
mov    (%rax),%esi
mov    0x2da2(%rip),%rax
or     (%rax),%esi
mov    %r14,%rdi
call   1080 <mkfifo@plt>
cmp    $0xffffffff,%eax
jne    126b <main+0xbb>
mov    0x2d74(%rip),%rax
mov    (%rax),%rax
mov    0x2d72(%rip),%rcx
cmp    (%rcx),%rax
jne    12e8 <main+0x138>
xor    %eax,%eax
call   10d0 <fork@plt>
test   %eax,%eax
je     1291 <main+0xe1>
cmp    $0xffffffff,%eax
jne    12b4 <main+0x104>
lea    0xdb3(%rip),%rdi
call   1040 <puts@plt>
mov    $0x5,%edi
call   10c0 <exit@plt>
test   %r13,%r13
jne    12fe <main+0x14e>
lea    0xd8b(%rip),%rdi
test   %r12,%r12
jne    12c5 <main+0x115>
lea    0x8(%rsp),%rdx
mov    %r15,%rsi
mov    $0x20,%ecx
xor    %r8d,%r8d
jmp    12dc <main+0x12c>
lea    0xd73(%rip),%rdi
test   %r13,%r13
jne    1324 <main+0x174>
test   %r12,%r12
jne    12a2 <main+0xf2>
lea    0xd89(%rip),%rsi
lea    0x8(%rsp),%rdx
mov    $0x20,%ecx
mov    $0x1,%r8d
call   1050 <noNamedPipe@plt>
xor    %edi,%edi
call   10c0 <exit@plt>
lea    0xd15(%rip),%rdi
call   10a0 <perror@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
xor    %eax,%eax
call   10b0 <getppid@plt>
lea    0xd1c(%rip),%rdi
test   %r12,%r12
jne    1329 <main+0x179>
mov    %r15,%rsi
mov    %r14,%rdx
mov    $0x20,%ecx
mov    %eax,%r8d
xor    %r9d,%r9d
jmp    1341 <main+0x191>
test   %r12,%r12
jne    1311 <main+0x161>
lea    0xd25(%rip),%rsi
mov    %r14,%rdx
mov    $0x20,%ecx
mov    %eax,%r8d
mov    $0x1,%r9d
call   1030 <namedPipe@plt>
xor    %edi,%edi
call   10c0 <exit@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"u\00"
@.str.1 = [2 x i8] c"c\00"
@S_IRUSR = global i32 0
@S_IWUSR = global i32 0
@errno = global i64 0
@EEXIST = global i64 0
@.str.2 = [36 x i8] c"Could not generate pipe, exiting...\00"
@.str.3 = [34 x i8] c"Unable to fork child, exiting...\0A\00"
@.str.4 = [6 x i8] c"Child\00"
@.str.5 = [1 x i8] zeroinitializer
@.str.6 = [7 x i8] c"Parent\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 i8*
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i32
%12 = alloca [2 x i32]
%13 = alloca i32
%14 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%15 = load i32, i32* %4
%16 = load i8**, i8*** %5
%17 = call i32 @checkInput(i32 %15, i8** %16)
store i32 1, i32* %6
store i32 2, i32* %7
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 1
%20 = load i8*, i8** %19
%21 = call i64 @strcmp(i8* %20, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%22 = icmp eq i64 %21, 0
br i1 %22, label %23, label %26
23: ; preds = %2
store i32 0, i32* %6
%24 = load i32, i32* %7
%25 = add nsw i32 %24, -1
store i32 %25, i32* %7
br label %26
26: ; preds = %23, %2
%27 = load i32, i32* %6
%28 = icmp ne i32 %27, 0
br i1 %28, label %29, label %35
29: ; preds = %26
%30 = load i8**, i8*** %5
%31 = load i32, i32* %7
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i8*, i8** %30, i64 %32
%34 = load i8*, i8** %33
store i8* %34, i8** %8
br label %35
35: ; preds = %29, %26
store i32 1, i32* %9
%36 = load i8**, i8*** %5
%37 = load i32, i32* %7
%38 = add nsw i32 %37, 1
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds i8*, i8** %36, i64 %39
%41 = load i8*, i8** %40
%42 = call i64 @strcmp(i8* %41, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%43 = icmp eq i64 %42, 0
br i1 %43, label %44, label %45
44: ; preds = %35
store i32 0, i32* %9
br label %45
45: ; preds = %44, %35
%46 = load i8**, i8*** %5
%47 = load i32, i32* %7
%48 = add nsw i32 %47, 2
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds i8*, i8** %46, i64 %49
%51 = load i8*, i8** %50
store i8* %51, i8** %10
%52 = load i32, i32* @S_IRUSR
%53 = load i32, i32* @S_IWUSR
%54 = or i32 %52, %53
store i32 %54, i32* %11
store i32 32, i32* %13
%55 = load i32, i32* %6
%56 = icmp ne i32 %55, 0
br i1 %56, label %57, label %70
57: ; preds = %45
%58 = load i8*, i8** %8
%59 = load i32, i32* %11
%60 = call i32 @mkfifo(i8* %58, i32 %59)
%61 = icmp eq i32 %60, -1
br i1 %61, label %62, label %69
62: ; preds = %57
%63 = load i64, i64* @errno
%64 = load i64, i64* @EEXIST
%65 = icmp ne i64 %63, %64
br i1 %65, label %66, label %69
66: ; preds = %62
%67 = call i32 @perror(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0))
%68 = call i32 @exit(i32 1)
unreachable
69: ; preds = %62, %57
br label %78
70: ; preds = %45
%71 = getelementptr inbounds [2 x i32], [2 x i32]* %12, i64 0, i64 0
%72 = call i32 @pipe(i32* %71)
%73 = icmp eq i32 %72, -1
br i1 %73, label %74, label %77
74: ; preds = %70
%75 = call i32 @perror(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0))
%76 = call i32 @exit(i32 2)
unreachable
77: ; preds = %70
br label %78
78: ; preds = %77, %69
%79 = call i32 (...) @fork()
store i32 %79, i32* %14
%80 = icmp eq i32 %79, -1
br i1 %80, label %81, label %84
81: ; preds = %78
%82 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0))
%83 = call i32 @exit(i32 5)
unreachable
84: ; preds = %78
%85 = load i32, i32* %14
%86 = icmp eq i32 %85, 0
br i1 %86, label %87, label %119
87: ; preds = %84
%88 = load i32, i32* %6
%89 = icmp ne i32 %88, 0
br i1 %89, label %90, label %105
90: ; preds = %87
%91 = load i32, i32* %9
%92 = icmp ne i32 %91, 0
br i1 %92, label %93, label %98
93: ; preds = %90
%94 = load i8*, i8** %8
%95 = load i32, i32* %13
%96 = call i32 (...) @getppid()
%97 = call i32 @namedPipe(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.5, i64 0, i64 0), i8* %94, i32 %95, i32 %96, i32 1)
br label %104
98: ; preds = %90
%99 = load i8*, i8** %10
%100 = load i8*, i8** %8
%101 = load i32, i32* %13
%102 = call i32 (...) @getppid()
%103 = call i32 @namedPipe(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* %99, i8* %100, i32 %101, i32 %102, i32 0)
br label %104
104: ; preds = %98, %93
br label %118
105: ; preds = %87
%106 = load i32, i32* %9
%107 = icmp ne i32 %106, 0
br i1 %107, label %108, label %112
108: ; preds = %105
%109 = getelementptr inbounds [2 x i32], [2 x i32]* %12, i64 0, i64 0
%110 = load i32, i32* %13
%111 = call i32 @noNamedPipe(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.5, i64 0, i64 0), i32* %109, i32 %110, i32 1)
br label %117
112: ; preds = %105
%113 = load i8*, i8** %10
%114 = getelementptr inbounds [2 x i32], [2 x i32]* %12, i64 0, i64 0
%115 = load i32, i32* %13
%116 = call i32 @noNamedPipe(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* %113, i32* %114, i32 %115, i32 0)
br label %117
117: ; preds = %112, %108
br label %118
118: ; preds = %117, %104
br label %157
119: ; preds = %84
%120 = load i32, i32* %14
%121 = icmp eq i32 %120, -1
br i1 %121, label %122, label %125
122: ; preds = %119
%123 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0))
%124 = call i32 @exit(i32 5)
unreachable
125: ; preds = %119
%126 = load i32, i32* %6
%127 = icmp ne i32 %126, 0
br i1 %127, label %128, label %143
128: ; preds = %125
%129 = load i32, i32* %9
%130 = icmp ne i32 %129, 0
br i1 %130, label %131, label %137
131: ; preds = %128
%132 = load i8*, i8** %10
%133 = load i8*, i8** %8
%134 = load i32, i32* %13
%135 = load i32, i32* %14
%136 = call i32 @namedPipe(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i8* %132, i8* %133, i32 %134, i32 %135, i32 0)
br label %142
137: ; preds = %128
%138 = load i8*, i8** %8
%139 = load i32, i32* %13
%140 = load i32, i32* %14
%141 = call i32 @namedPipe(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.5, i64 0, i64 0), i8* %138, i32 %139, i32 %140, i32 1)
br label %142
142: ; preds = %137, %131
br label %156
143: ; preds = %125
%144 = load i32, i32* %9
%145 = icmp ne i32 %144, 0
br i1 %145, label %146, label %151
146: ; preds = %143
%147 = load i8*, i8** %10
%148 = getelementptr inbounds [2 x i32], [2 x i32]* %12, i64 0, i64 0
%149 = load i32, i32* %13
%150 = call i32 @noNamedPipe(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i8* %147, i32* %148, i32 %149, i32 0)
br label %155
151: ; preds = %143
%152 = getelementptr inbounds [2 x i32], [2 x i32]* %12, i64 0, i64 0
%153 = load i32, i32* %13
%154 = call i32 @noNamedPipe(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.5, i64 0, i64 0), i32* %152, i32 %153, i32 1)
br label %155
155: ; preds = %151, %146
br label %156
156: ; preds = %155, %142
br label %157
157: ; preds = %156, %118
br label %158
158: ; preds = %157
%159 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [2 x i8] c"u\00"
@.str.1 = [2 x i8] c"c\00"
@S_IRUSR = global i32 0
@S_IWUSR = global i32 0
@errno = global i64 0
@EEXIST = global i64 0
@.str.2 = [36 x i8] c"Could not generate pipe, exiting...\00"
@.str.4 = [6 x i8] c"Child\00"
@.str.5 = [1 x i8] zeroinitializer
@.str.6 = [7 x i8] c"Parent\00"
@str = [33 x i8] c"Unable to fork child, exiting...\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca [2 x i32]
%4 = tail call i32 @checkInput(i32 %0, i8** %1)
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i64 @strcmp(i8* %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i64 %7, 0
%9 = select i1 %8, i32 1, i32 2
br i1 %8, label %14, label %10
10: ; preds = %2
%11 = zext i32 %9 to i64
%12 = getelementptr inbounds i8*, i8** %1, i64 %11
%13 = load i8*, i8** %12
br label %14
14: ; preds = %10, %2
%15 = phi i8* [ %13, %10 ], [ undef, %2 ]
%16 = add nuw nsw i32 %9, 1
%17 = zext i32 %16 to i64
%18 = getelementptr inbounds i8*, i8** %1, i64 %17
%19 = load i8*, i8** %18
%20 = tail call i64 @strcmp(i8* %19, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%21 = icmp eq i64 %20, 0
%22 = add nuw nsw i32 %9, 2
%23 = zext i32 %22 to i64
%24 = getelementptr inbounds i8*, i8** %1, i64 %23
%25 = load i8*, i8** %24
%26 = load i32, i32* @S_IRUSR
%27 = load i32, i32* @S_IWUSR
%28 = bitcast [2 x i32]* %3 to i8*
br i1 %8, label %40, label %29
29: ; preds = %14
%30 = or i32 %27, %26
%31 = tail call i32 @mkfifo(i8* %15, i32 %30)
%32 = icmp eq i32 %31, -1
br i1 %32, label %33, label %47
33: ; preds = %29
%34 = load i64, i64* @errno
%35 = load i64, i64* @EEXIST
%36 = icmp eq i64 %34, %35
br i1 %36, label %47, label %37
37: ; preds = %33
%38 = tail call i32 @perror(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0))
%39 = tail call i32 @exit(i32 1)
unreachable
40: ; preds = %14
%41 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
%42 = call i32 @pipe(i32* %41)
%43 = icmp eq i32 %42, -1
br i1 %43, label %44, label %47
44: ; preds = %40
%45 = call i32 @perror(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0))
%46 = call i32 @exit(i32 2)
unreachable
47: ; preds = %40, %29, %33
%48 = call i32 (...) @fork()
switch i32 %48, label %65 [
i32 -1, label %49
i32 0, label %52
]
49: ; preds = %47
%50 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str, i64 0, i64 0))
%51 = call i32 @exit(i32 5)
unreachable
52: ; preds = %47
br i1 %8, label %59, label %53
53: ; preds = %52
%54 = call i32 (...) @getppid()
br i1 %21, label %57, label %55
55: ; preds = %53
%56 = call i32 @namedPipe(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.5, i64 0, i64 0), i8* %15, i32 32, i32 %54, i32 1)
br label %77
57: ; preds = %53
%58 = call i32 @namedPipe(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* %25, i8* %15, i32 32, i32 %54, i32 0)
br label %77
59: ; preds = %52
%60 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
br i1 %21, label %63, label %61
61: ; preds = %59
%62 = call i32 @noNamedPipe(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.5, i64 0, i64 0), i32* %60, i32 32, i32 1)
br label %77
63: ; preds = %59
%64 = call i32 @noNamedPipe(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* %25, i32* %60, i32 32, i32 0)
br label %77
65: ; preds = %47
br i1 %8, label %71, label %66
66: ; preds = %65
br i1 %21, label %69, label %67
67: ; preds = %66
%68 = call i32 @namedPipe(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i8* %25, i8* %15, i32 32, i32 %48, i32 0)
br label %77
69: ; preds = %66
%70 = call i32 @namedPipe(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.5, i64 0, i64 0), i8* %15, i32 32, i32 %48, i32 1)
br label %77
71: ; preds = %65
%72 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
br i1 %21, label %75, label %73
73: ; preds = %71
%74 = call i32 @noNamedPipe(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i8* %25, i32* %72, i32 32, i32 0)
br label %77
75: ; preds = %71
%76 = call i32 @noNamedPipe(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.5, i64 0, i64 0), i32* %72, i32 32, i32 1)
br label %77
77: ; preds = %61, %63, %55, %57, %73, %75, %67, %69
%78 = call i32 @exit(i32 0)
unreachable
}