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

/* Variables and functions */
int EINVAL;
int /*<<< orphan*/ STDERR_FILENO;
int /*<<< orphan*/ STDIN_FILENO;
int /*<<< orphan*/ STDOUT_FILENO;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ dup2(int, int /*<<< orphan*/);
int /*<<< orphan*/ execvp(char const *, char *const *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ *fdopen(int, char *);
int fork();
scalar_t__ pipe(int *);
pid_t my_popen(const char *bin_path, char *const *argv, FILE **stdinf,
               FILE **stdoutf, FILE **stderrf) {
  int i_pfd[2];
  int o_pfd[2];
  int e_pfd[2];
  pid_t pid;
  if (stdinf == NULL && stdoutf == NULL && stderrf == NULL)
    return EINVAL;
  if (stdinf != NULL)
    if (pipe(i_pfd) < 0)
      return -1;
  if (stdoutf != NULL)
    if (pipe(o_pfd) < 0)
      return -1;
  if (stderrf != NULL)
    if (pipe(e_pfd) < 0)
      return -1;
  pid = fork();
  if (pid == -1)
    return -1;
  if (pid == 0) {
    if (stdinf != NULL) {
      close(i_pfd[1]);
      dup2(i_pfd[0], STDIN_FILENO);
      close(i_pfd[0]);
    }
    if (stdoutf != NULL) {
      close(o_pfd[0]);
      dup2(o_pfd[1], STDOUT_FILENO);
      close(o_pfd[1]);
    }
    if (stderrf != NULL) {
      close(e_pfd[0]);
      dup2(e_pfd[1], STDERR_FILENO);
      close(e_pfd[1]);
    }
    exit(execvp(bin_path, argv));
  }
  if (stdinf != NULL) {
    close(i_pfd[0]);
    *stdinf = fdopen(i_pfd[1], "w");
  }
  if (stdoutf != NULL) {
    close(o_pfd[1]);
    *stdoutf = fdopen(o_pfd[0], "r");
  }
  if (stderrf != NULL) {
    close(e_pfd[1]);
    *stderrf = fdopen(e_pfd[0], "r");
  }
  return pid;
}


x86 assembly (clang, -O0):
<my_popen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    11be <my_popen+0x4e>
cmpq   $0x0,-0x28(%rbp)
jne    11be <my_popen+0x4e>
cmpq   $0x0,-0x30(%rbp)
jne    11be <my_popen+0x4e>
mov    0x2e1c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1397 <my_popen+0x227>
cmpq   $0x0,-0x20(%rbp)
je     11ed <my_popen+0x7d>
lea    -0x38(%rbp),%rdi
call   1050 <pipe@plt>
cmp    $0x0,%rax
jge    11e8 <my_popen+0x78>
movl   $0xffffffff,-0x4(%rbp)
jmp    1397 <my_popen+0x227>
jmp    11ed <my_popen+0x7d>
cmpq   $0x0,-0x28(%rbp)
je     121c <my_popen+0xac>
lea    -0x40(%rbp),%rdi
call   1050 <pipe@plt>
cmp    $0x0,%rax
jge    1217 <my_popen+0xa7>
movl   $0xffffffff,-0x4(%rbp)
jmp    1397 <my_popen+0x227>
jmp    121c <my_popen+0xac>
cmpq   $0x0,-0x30(%rbp)
je     124b <my_popen+0xdb>
lea    -0x48(%rbp),%rdi
call   1050 <pipe@plt>
cmp    $0x0,%rax
jge    1246 <my_popen+0xd6>
movl   $0xffffffff,-0x4(%rbp)
jmp    1397 <my_popen+0x227>
jmp    124b <my_popen+0xdb>
mov    $0x0,%al
call   1090 <fork@plt>
mov    %eax,-0x4c(%rbp)
cmpl   $0xffffffff,-0x4c(%rbp)
jne    126b <my_popen+0xfb>
movl   $0xffffffff,-0x4(%rbp)
jmp    1397 <my_popen+0x227>
cmpl   $0x0,-0x4c(%rbp)
jne    130d <my_popen+0x19d>
cmpq   $0x0,-0x20(%rbp)
je     12a1 <my_popen+0x131>
mov    -0x34(%rbp),%edi
call   1040 <close@plt>
mov    -0x38(%rbp),%edi
mov    0x2d36(%rip),%rax
mov    (%rax),%esi
call   1030 <dup2@plt>
mov    -0x38(%rbp),%edi
call   1040 <close@plt>
cmpq   $0x0,-0x28(%rbp)
je     12cd <my_popen+0x15d>
mov    -0x40(%rbp),%edi
call   1040 <close@plt>
mov    -0x3c(%rbp),%edi
mov    0x2d32(%rip),%rax
mov    (%rax),%esi
call   1030 <dup2@plt>
mov    -0x3c(%rbp),%edi
call   1040 <close@plt>
cmpq   $0x0,-0x30(%rbp)
je     12f9 <my_popen+0x189>
mov    -0x48(%rbp),%edi
call   1040 <close@plt>
mov    -0x44(%rbp),%edi
mov    0x2cee(%rip),%rax
mov    (%rax),%esi
call   1030 <dup2@plt>
mov    -0x44(%rbp),%edi
call   1040 <close@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1070 <execvp@plt>
mov    %eax,%edi
call   1080 <exit@plt>
cmpq   $0x0,-0x20(%rbp)
je     1339 <my_popen+0x1c9>
mov    -0x38(%rbp),%edi
call   1040 <close@plt>
mov    -0x34(%rbp),%edi
lea    0xcd6(%rip),%rsi
call   1060 <fdopen@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
cmpq   $0x0,-0x28(%rbp)
je     1365 <my_popen+0x1f5>
mov    -0x3c(%rbp),%edi
call   1040 <close@plt>
mov    -0x40(%rbp),%edi
lea    0xcac(%rip),%rsi
call   1060 <fdopen@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
mov    %rcx,(%rax)
cmpq   $0x0,-0x30(%rbp)
je     1391 <my_popen+0x221>
mov    -0x44(%rbp),%edi
call   1040 <close@plt>
mov    -0x48(%rbp),%edi
lea    0xc80(%rip),%rsi
call   1060 <fdopen@plt>
mov    %rax,%rcx
mov    -0x30(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x4c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_popen>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r8,%r12
mov    %rcx,%r13
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %rdi,%r15
test   %rdx,%rdx
jne    11aa <my_popen+0x3a>
test   %r13,%r13
jne    11aa <my_popen+0x3a>
test   %r12,%r12
jne    11aa <my_popen+0x3a>
mov    0x2e2d(%rip),%rax
mov    (%rax),%ebp
jmp    1269 <my_popen+0xf9>
test   %rbx,%rbx
je     11c2 <my_popen+0x52>
lea    0x10(%rsp),%rdi
call   1050 <pipe@plt>
test   %rax,%rax
js     1264 <my_popen+0xf4>
test   %r13,%r13
je     11da <my_popen+0x6a>
lea    0x8(%rsp),%rdi
call   1050 <pipe@plt>
test   %rax,%rax
js     1264 <my_popen+0xf4>
test   %r12,%r12
je     11ec <my_popen+0x7c>
mov    %rsp,%rdi
call   1050 <pipe@plt>
test   %rax,%rax
js     1264 <my_popen+0xf4>
xor    %eax,%eax
call   1090 <fork@plt>
mov    %eax,%ebp
cmp    $0xffffffff,%eax
je     1269 <my_popen+0xf9>
test   %ebp,%ebp
je     127a <my_popen+0x10a>
test   %rbx,%rbx
je     121f <my_popen+0xaf>
mov    0x10(%rsp),%edi
call   1040 <close@plt>
mov    0x14(%rsp),%edi
lea    0xde9(%rip),%rsi
call   1060 <fdopen@plt>
mov    %rax,(%rbx)
test   %r13,%r13
je     1241 <my_popen+0xd1>
mov    0xc(%rsp),%edi
call   1040 <close@plt>
mov    0x8(%rsp),%edi
lea    0xdca(%rip),%rsi
call   1060 <fdopen@plt>
mov    %rax,0x0(%r13)
test   %r12,%r12
je     1269 <my_popen+0xf9>
mov    0x4(%rsp),%edi
call   1040 <close@plt>
mov    (%rsp),%edi
lea    0xda9(%rip),%rsi
call   1060 <fdopen@plt>
mov    %rax,(%r12)
jmp    1269 <my_popen+0xf9>
mov    $0xffffffff,%ebp
mov    %ebp,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
test   %rbx,%rbx
jne    12be <my_popen+0x14e>
test   %r13,%r13
jne    12e7 <my_popen+0x177>
test   %r12,%r12
je     12ac <my_popen+0x13c>
mov    (%rsp),%edi
call   1040 <close@plt>
mov    0x4(%rsp),%edi
mov    0x2d3c(%rip),%rax
mov    (%rax),%esi
call   1030 <dup2@plt>
mov    0x4(%rsp),%edi
call   1040 <close@plt>
mov    %r15,%rdi
mov    %r14,%rsi
call   1070 <execvp@plt>
mov    %eax,%edi
call   1080 <exit@plt>
mov    0x14(%rsp),%edi
call   1040 <close@plt>
mov    0x10(%rsp),%edi
mov    0x2cf6(%rip),%rax
mov    (%rax),%esi
call   1030 <dup2@plt>
mov    0x10(%rsp),%edi
call   1040 <close@plt>
test   %r13,%r13
je     1284 <my_popen+0x114>
mov    0x8(%rsp),%edi
call   1040 <close@plt>
mov    0xc(%rsp),%edi
mov    0x2cf5(%rip),%rax
mov    (%rax),%esi
call   1030 <dup2@plt>
mov    0xc(%rsp),%edi
call   1040 <close@plt>
test   %r12,%r12
jne    1289 <my_popen+0x119>
jmp    12ac <my_popen+0x13c>

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

LLVM IR (-O2):
@EINVAL = global i32 0
@STDIN_FILENO = global i32 0
@STDOUT_FILENO = global i32 0
@STDERR_FILENO = global i32 0
@.str = [2 x i8] c"w\00"
@.str.1 = [2 x i8] c"r\00"
define i32 @my_popen(i8* %0, i8** %1, i32** writeonly %2, i32** writeonly %3, i32** writeonly %4) {
%6 = alloca [2 x i32]
%7 = alloca [2 x i32]
%8 = alloca [2 x i32]
%9 = bitcast [2 x i32]* %6 to i8*
%10 = bitcast [2 x i32]* %7 to i8*
%11 = bitcast [2 x i32]* %8 to i8*
%12 = icmp eq i32** %2, null
%13 = icmp eq i32** %3, null
%14 = and i1 %12, %13
%15 = icmp eq i32** %4, null
%16 = and i1 %14, %15
br i1 %16, label %17, label %19
17: ; preds = %5
%18 = load i32, i32* @EINVAL
br label %96
19: ; preds = %5
br i1 %12, label %24, label %20
20: ; preds = %19
%21 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
%22 = call i64 @pipe(i32* %21)
%23 = icmp slt i64 %22, 0
br i1 %23, label %96, label %24
24: ; preds = %20, %19
br i1 %13, label %29, label %25
25: ; preds = %24
%26 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
%27 = call i64 @pipe(i32* %26)
%28 = icmp slt i64 %27, 0
br i1 %28, label %96, label %29
29: ; preds = %25, %24
br i1 %15, label %34, label %30
30: ; preds = %29
%31 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 0
%32 = call i64 @pipe(i32* %31)
%33 = icmp slt i64 %32, 0
br i1 %33, label %96, label %34
34: ; preds = %30, %29
%35 = call i32 (...) @fork()
switch i32 %35, label %72 [
i32 -1, label %96
i32 0, label %36
]
36: ; preds = %34
br i1 %12, label %47, label %37
37: ; preds = %36
%38 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 1
%39 = load i32, i32* %38
%40 = call i32 @close(i32 %39)
%41 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
%42 = load i32, i32* %41
%43 = load i32, i32* @STDIN_FILENO
%44 = call i32 @dup2(i32 %42, i32 %43)
%45 = load i32, i32* %41
%46 = call i32 @close(i32 %45)
br label %47
47: ; preds = %37, %36
br i1 %13, label %58, label %48
48: ; preds = %47
%49 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
%50 = load i32, i32* %49
%51 = call i32 @close(i32 %50)
%52 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 1
%53 = load i32, i32* %52
%54 = load i32, i32* @STDOUT_FILENO
%55 = call i32 @dup2(i32 %53, i32 %54)
%56 = load i32, i32* %52
%57 = call i32 @close(i32 %56)
br label %58
58: ; preds = %48, %47
br i1 %15, label %69, label %59
59: ; preds = %58
%60 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 0
%61 = load i32, i32* %60
%62 = call i32 @close(i32 %61)
%63 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 1
%64 = load i32, i32* %63
%65 = load i32, i32* @STDERR_FILENO
%66 = call i32 @dup2(i32 %64, i32 %65)
%67 = load i32, i32* %63
%68 = call i32 @close(i32 %67)
br label %69
69: ; preds = %59, %58
%70 = call i32 @execvp(i8* %0, i8** %1)
%71 = call i32 @exit(i32 %70)
unreachable
72: ; preds = %34
br i1 %12, label %80, label %73
73: ; preds = %72
%74 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
%75 = load i32, i32* %74
%76 = call i32 @close(i32 %75)
%77 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 1
%78 = load i32, i32* %77
%79 = call i32* @fdopen(i32 %78, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %79, i32** %2
br label %80
80: ; preds = %73, %72
br i1 %13, label %88, label %81
81: ; preds = %80
%82 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 1
%83 = load i32, i32* %82
%84 = call i32 @close(i32 %83)
%85 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
%86 = load i32, i32* %85
%87 = call i32* @fdopen(i32 %86, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %87, i32** %3
br label %88
88: ; preds = %81, %80
br i1 %15, label %96, label %89
89: ; preds = %88
%90 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 1
%91 = load i32, i32* %90
%92 = call i32 @close(i32 %91)
%93 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 0
%94 = load i32, i32* %93
%95 = call i32* @fdopen(i32 %94, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %95, i32** %4
br label %96
96: ; preds = %88, %89, %34, %30, %25, %20, %17
%97 = phi i32 [ %18, %17 ], [ -1, %20 ], [ -1, %25 ], [ -1, %30 ], [ %35, %34 ], [ %35, %89 ], [ %35, %88 ]
ret i32 %97
}