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

/* Variables and functions */
int EXIT_FAILURE;
int EXIT_SUCCESS;
int WEXITSTATUS(int);
scalar_t__ WIFEXITED(int);
scalar_t__ WIFSIGNALED(int);
int WTERMSIG(int);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ dup2(int, int);
int /*<<< orphan*/ execve(char const *, char **, char **);
int /*<<< orphan*/ exit(int);
int fork();
int /*<<< orphan*/ perror(char *);
int pipe(int *);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ read(int, char *, int);
scalar_t__ strstr(char *, char *);
int waitpid(int, int *, int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  char const *test_bin = argv[2];
  int des_p[2];
  if (pipe(des_p) == -1) {
    perror("Pipe failed");
    exit(1);
  }
  pid_t cpid, w;
  int status;
  cpid = fork();
  if (cpid == -1) {
    perror("fork");
    exit(EXIT_FAILURE);
  }
  if (cpid == 0) {
    close(des_p[0]);
    close(1);
    close(2);
    dup2(des_p[1], 1);
    dup2(des_p[1], 2);
    close(des_p[1]);
    char *argv[] = {test_bin, 0};
    char *envp[] = {"LD_PRELOAD=../src/.libs/libstack_debug.so", 0};
    execve(test_bin, argv, envp);
    perror("execvp in child failed");
    exit(1);
  } else {
    char buffer[1024];
    close(des_p[1]);
    do {
      w = waitpid(cpid, &status, 0);
      if (w == -1) {
        perror("waitpid");
        exit(EXIT_FAILURE);
      }
      if (WIFEXITED(status) || WIFSIGNALED(status)) {
        if (WIFEXITED(status))
          printf("exited (status = %d)\n", WEXITSTATUS(status));
        else if (WIFSIGNALED(status))
          printf("killed (signal = %d)\n", WTERMSIG(status));
        while (read(des_p[0], buffer, sizeof(buffer)) != 0) {
          printf("parent: ((((((((%s))))))))\n", buffer);
          if (strstr(buffer, "End of trace"))
            exit(EXIT_SUCCESS);
          else
            exit(EXIT_FAILURE);
        }
      }
    } while (!WIFEXITED(status) && !WIFSIGNALED(status));
    printf("this should not be reached");
    exit(EXIT_FAILURE);
  }
  printf("this should not be reached");
  exit(EXIT_FAILURE);
  return EXIT_FAILURE;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x460,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x18(%rbp)
lea    -0x20(%rbp),%rdi
call   1060 <pipe@plt>
cmp    $0xffffffff,%eax
jne    123d <main+0x4d>
lea    0xdd2(%rip),%rdi
call   10d0 <perror@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
mov    $0x0,%al
call   1100 <fork@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0xffffffff,-0x24(%rbp)
jne    126b <main+0x7b>
lea    0xdb4(%rip),%rdi
call   10d0 <perror@plt>
mov    0x2d7c(%rip),%rax
mov    (%rax),%edi
call   10f0 <exit@plt>
cmpl   $0x0,-0x24(%rbp)
jne    1300 <main+0x110>
mov    -0x20(%rbp),%edi
call   1050 <close@plt>
mov    $0x1,%edi
call   1050 <close@plt>
mov    $0x2,%edi
call   1050 <close@plt>
mov    -0x1c(%rbp),%edi
mov    $0x1,%esi
call   1030 <dup2@plt>
mov    -0x1c(%rbp),%edi
mov    $0x2,%esi
call   1030 <dup2@plt>
mov    -0x1c(%rbp),%edi
call   1050 <close@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x40(%rbp)
movq   $0x0,-0x38(%rbp)
mov    0x2b36(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    0x2b33(%rip),%rax
mov    %rax,-0x48(%rbp)
mov    -0x18(%rbp),%rdi
lea    -0x40(%rbp),%rsi
lea    -0x50(%rbp),%rdx
call   1080 <execve@plt>
lea    0xd4a(%rip),%rdi
call   10d0 <perror@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
mov    -0x1c(%rbp),%edi
call   1050 <close@plt>
mov    -0x24(%rbp),%edi
lea    -0x2c(%rbp),%rsi
xor    %edx,%edx
call   10c0 <waitpid@plt>
mov    %eax,-0x28(%rbp)
cmpl   $0xffffffff,-0x28(%rbp)
jne    133d <main+0x14d>
lea    0xd28(%rip),%rdi
call   10d0 <perror@plt>
mov    0x2caa(%rip),%rax
mov    (%rax),%edi
call   10f0 <exit@plt>
mov    -0x2c(%rbp),%edi
call   10e0 <WIFEXITED@plt>
cmp    $0x0,%rax
jne    1361 <main+0x171>
mov    -0x2c(%rbp),%edi
call   1090 <WIFSIGNALED@plt>
cmp    $0x0,%rax
je     1435 <main+0x245>
mov    -0x2c(%rbp),%edi
call   10e0 <WIFEXITED@plt>
cmp    $0x0,%rax
je     1390 <main+0x1a0>
mov    -0x2c(%rbp),%edi
call   10b0 <WEXITSTATUS@plt>
mov    %eax,%esi
lea    0xcd6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    13bf <main+0x1cf>
mov    -0x2c(%rbp),%edi
call   1090 <WIFSIGNALED@plt>
cmp    $0x0,%rax
je     13ba <main+0x1ca>
mov    -0x2c(%rbp),%edi
call   10a0 <WTERMSIG@plt>
mov    %eax,%esi
lea    0xcbd(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    13bf <main+0x1cf>
jmp    13c4 <main+0x1d4>
mov    -0x20(%rbp),%edi
lea    -0x450(%rbp),%rsi
mov    $0x400,%edx
call   1070 <read@plt>
cmp    $0x0,%rax
je     1430 <main+0x240>
lea    -0x450(%rbp),%rsi
lea    0xc96(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x450(%rbp),%rdi
lea    0xc9d(%rip),%rsi
call   1110 <strstr@plt>
cmp    $0x0,%rax
je     1422 <main+0x232>
mov    0x2bbd(%rip),%rax
mov    (%rax),%edi
call   10f0 <exit@plt>
mov    0x2bb7(%rip),%rax
mov    (%rax),%edi
call   10f0 <exit@plt>
jmp    1435 <main+0x245>
jmp    143a <main+0x24a>
mov    -0x2c(%rbp),%edi
call   10e0 <WIFEXITED@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x451(%rbp)
jne    146e <main+0x27e>
mov    -0x2c(%rbp),%edi
call   1090 <WIFSIGNALED@plt>
cmp    $0x0,%rax
setne  %al
xor    $0xff,%al
mov    %al,-0x451(%rbp)
mov    -0x451(%rbp),%al
test   $0x1,%al
jne    1308 <main+0x118>
lea    0xc2c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2b4f(%rip),%rax
mov    (%rax),%edi
call   10f0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x420,%rsp
mov    0x10(%rsi),%r14
lea    0x8(%rsp),%rdi
call   1060 <pipe@plt>
cmp    $0xffffffff,%eax
jne    121f <main+0x2f>
lea    0xde6(%rip),%rdi
jmp    12bb <main+0xcb>
xor    %eax,%eax
call   1100 <fork@plt>
test   %eax,%eax
je     1246 <main+0x56>
mov    %eax,%ebx
cmp    $0xffffffff,%eax
jne    12ca <main+0xda>
lea    0xdd0(%rip),%rdi
call   10d0 <perror@plt>
jmp    13dd <main+0x1ed>
mov    0x8(%rsp),%edi
call   1050 <close@plt>
mov    $0x1,%edi
call   1050 <close@plt>
mov    $0x2,%edi
call   1050 <close@plt>
mov    0xc(%rsp),%edi
mov    $0x1,%esi
call   1030 <dup2@plt>
mov    0xc(%rsp),%edi
mov    $0x2,%esi
call   1030 <dup2@plt>
mov    0xc(%rsp),%edi
call   1050 <close@plt>
mov    %r14,0x20(%rsp)
movq   $0x0,0x28(%rsp)
movaps 0x2b63(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
lea    0x20(%rsp),%rsi
lea    0x10(%rsp),%rdx
mov    %r14,%rdi
call   1080 <execve@plt>
lea    0xd80(%rip),%rdi
call   10d0 <perror@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
mov    0xc(%rsp),%edi
call   1050 <close@plt>
lea    0x10(%rsp),%r14
lea    0xd91(%rip),%r15
lea    0x20(%rsp),%r12
lea    0xd6f(%rip),%r13
nopl   0x0(%rax,%rax,1)
mov    %ebx,%edi
mov    %r14,%rsi
xor    %edx,%edx
call   10c0 <waitpid@plt>
cmp    $0xffffffff,%eax
je     13a5 <main+0x1b5>
mov    0x10(%rsp),%edi
call   10e0 <WIFEXITED@plt>
test   %rax,%rax
jne    1321 <main+0x131>
mov    0x10(%rsp),%edi
call   1090 <WIFSIGNALED@plt>
test   %rax,%rax
je     1375 <main+0x185>
mov    0x10(%rsp),%edi
call   10e0 <WIFEXITED@plt>
mov    0x10(%rsp),%edi
test   %rax,%rax
je     1340 <main+0x150>
call   10b0 <WEXITSTATUS@plt>
mov    %r13,%rdi
jmp    1356 <main+0x166>
nopl   (%rax)
call   1090 <WIFSIGNALED@plt>
test   %rax,%rax
je     135f <main+0x16f>
mov    0x10(%rsp),%edi
call   10a0 <WTERMSIG@plt>
mov    %r15,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rsp),%edi
mov    %r12,%rsi
mov    $0x400,%edx
call   1070 <read@plt>
test   %rax,%rax
jne    13b3 <main+0x1c3>
mov    0x10(%rsp),%edi
call   10e0 <WIFEXITED@plt>
test   %rax,%rax
jne    1395 <main+0x1a5>
mov    0x10(%rsp),%edi
call   1090 <WIFSIGNALED@plt>
test   %rax,%rax
je     12f0 <main+0x100>
lea    0xd13(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    13dd <main+0x1ed>
lea    0xca6(%rip),%rdi
call   10d0 <perror@plt>
jmp    13dd <main+0x1ed>
lea    0xccc(%rip),%rdi
lea    0x20(%rsp),%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xcd2(%rip),%rsi
mov    %rbx,%rdi
call   1110 <strstr@plt>
test   %rax,%rax
jne    13eb <main+0x1fb>
mov    0x2bfc(%rip),%rax
mov    (%rax),%edi
call   10f0 <exit@plt>
mov    0x2be6(%rip),%rax
mov    (%rax),%edi
call   10f0 <exit@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"Pipe failed\00"
@.str.1 = [5 x i8] c"fork\00"
@EXIT_FAILURE = global i32 0
@.str.2 = [42 x i8] c"LD_PRELOAD=../src/.libs/libstack_debug.so\00"
@__const.main.envp = [2 x i8*] [i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i32 0, i32 0), i8* null]
@.str.3 = [23 x i8] c"execvp in child failed\00"
@.str.4 = [8 x i8] c"waitpid\00"
@.str.5 = [22 x i8] c"exited (status = %d)\0A\00"
@.str.6 = [22 x i8] c"killed (signal = %d)\0A\00"
@.str.7 = [28 x i8] c"parent: ((((((((%s))))))))\0A\00"
@.str.8 = [13 x i8] c"End of trace\00"
@EXIT_SUCCESS = global i32 0
@.str.9 = [27 x i8] c"this should not be reached\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca [2 x i32]
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca [2 x i8*]
%12 = alloca [2 x i8*]
%13 = alloca [1024 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 2
%16 = load i8*, i8** %15
store i8* %16, i8** %6
%17 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
%18 = call i32 @pipe(i32* %17)
%19 = icmp eq i32 %18, -1
br i1 %19, label %20, label %23
20: ; preds = %2
%21 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%22 = call i32 @exit(i32 1)
unreachable
23: ; preds = %2
%24 = call i32 (...) @fork()
store i32 %24, i32* %8
%25 = load i32, i32* %8
%26 = icmp eq i32 %25, -1
br i1 %26, label %27, label %31
27: ; preds = %23
%28 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%29 = load i32, i32* @EXIT_FAILURE
%30 = call i32 @exit(i32 %29)
unreachable
31: ; preds = %23
%32 = load i32, i32* %8
%33 = icmp eq i32 %32, 0
br i1 %33, label %34, label %59
34: ; preds = %31
%35 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
%36 = load i32, i32* %35
%37 = call i32 @close(i32 %36)
%38 = call i32 @close(i32 1)
%39 = call i32 @close(i32 2)
%40 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 1
%41 = load i32, i32* %40
%42 = call i32 @dup2(i32 %41, i32 1)
%43 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 1
%44 = load i32, i32* %43
%45 = call i32 @dup2(i32 %44, i32 2)
%46 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 1
%47 = load i32, i32* %46
%48 = call i32 @close(i32 %47)
%49 = getelementptr inbounds [2 x i8*], [2 x i8*]* %11, i64 0, i64 0
%50 = load i8*, i8** %6
store i8* %50, i8** %49
%51 = getelementptr inbounds i8*, i8** %49, i64 1
store i8* null, i8** %51
%52 = bitcast [2 x i8*]* %12 to i8*
%53 = load i8*, i8** %6
%54 = getelementptr inbounds [2 x i8*], [2 x i8*]* %11, i64 0, i64 0
%55 = getelementptr inbounds [2 x i8*], [2 x i8*]* %12, i64 0, i64 0
%56 = call i32 @execve(i8* %53, i8** %54, i8** %55)
%57 = call i32 @perror(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0))
%58 = call i32 @exit(i32 1)
unreachable
59: ; preds = %31
%60 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 1
%61 = load i32, i32* %60
%62 = call i32 @close(i32 %61)
br label %63
63: ; preds = %127, %59
%64 = load i32, i32* %8
%65 = call i32 @waitpid(i32 %64, i32* %10, i32 0)
store i32 %65, i32* %9
%66 = load i32, i32* %9
%67 = icmp eq i32 %66, -1
br i1 %67, label %68, label %72
68: ; preds = %63
%69 = call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
%70 = load i32, i32* @EXIT_FAILURE
%71 = call i32 @exit(i32 %70)
unreachable
72: ; preds = %63
%73 = load i32, i32* %10
%74 = call i64 @WIFEXITED(i32 %73)
%75 = icmp ne i64 %74, 0
br i1 %75, label %80, label %76
76: ; preds = %72
%77 = load i32, i32* %10
%78 = call i64 @WIFSIGNALED(i32 %77)
%79 = icmp ne i64 %78, 0
br i1 %79, label %80, label %117
80: ; preds = %76, %72
%81 = load i32, i32* %10
%82 = call i64 @WIFEXITED(i32 %81)
%83 = icmp ne i64 %82, 0
br i1 %83, label %84, label %88
84: ; preds = %80
%85 = load i32, i32* %10
%86 = call i32 @WEXITSTATUS(i32 %85)
%87 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), i32 %86)
br label %97
88: ; preds = %80
%89 = load i32, i32* %10
%90 = call i64 @WIFSIGNALED(i32 %89)
%91 = icmp ne i64 %90, 0
br i1 %91, label %92, label %96
92: ; preds = %88
%93 = load i32, i32* %10
%94 = call i32 @WTERMSIG(i32 %93)
%95 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0), i32 %94)
br label %96
96: ; preds = %92, %88
br label %97
97: ; preds = %96, %84
br label %98
98: ; preds = %97
%99 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
%100 = load i32, i32* %99
%101 = getelementptr inbounds [1024 x i8], [1024 x i8]* %13, i64 0, i64 0
%102 = call i64 @read(i32 %100, i8* %101, i32 1024)
%103 = icmp ne i64 %102, 0
br i1 %103, label %104, label %116
104: ; preds = %98
%105 = getelementptr inbounds [1024 x i8], [1024 x i8]* %13, i64 0, i64 0
%106 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.7, i64 0, i64 0), i8* %105)
%107 = getelementptr inbounds [1024 x i8], [1024 x i8]* %13, i64 0, i64 0
%108 = call i64 @strstr(i8* %107, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0))
%109 = icmp ne i64 %108, 0
br i1 %109, label %110, label %113
110: ; preds = %104
%111 = load i32, i32* @EXIT_SUCCESS
%112 = call i32 @exit(i32 %111)
unreachable
113: ; preds = %104
%114 = load i32, i32* @EXIT_FAILURE
%115 = call i32 @exit(i32 %114)
unreachable
116: ; preds = %98
br label %117
117: ; preds = %116, %76
br label %118
118: ; preds = %117
%119 = load i32, i32* %10
%120 = call i64 @WIFEXITED(i32 %119)
%121 = icmp ne i64 %120, 0
br i1 %121, label %127, label %122
122: ; preds = %118
%123 = load i32, i32* %10
%124 = call i64 @WIFSIGNALED(i32 %123)
%125 = icmp ne i64 %124, 0
%126 = xor i1 %125, true
br label %127
127: ; preds = %122, %118
%128 = phi i1 [ false, %118 ], [ %126, %122 ]
br i1 %128, label %63, label %129
129: ; preds = %127
%130 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.9, i64 0, i64 0))
%131 = load i32, i32* @EXIT_FAILURE
%132 = call i32 @exit(i32 %131)
unreachable
}

LLVM IR (-O2):
@.str = [12 x i8] c"Pipe failed\00"
@.str.1 = [5 x i8] c"fork\00"
@EXIT_FAILURE = global i32 0
@.str.2 = [42 x i8] c"LD_PRELOAD=../src/.libs/libstack_debug.so\00"
@__const.main.envp = [2 x i8*] [i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i32 0, i32 0), i8* null]
@.str.3 = [23 x i8] c"execvp in child failed\00"
@.str.4 = [8 x i8] c"waitpid\00"
@.str.5 = [22 x i8] c"exited (status = %d)\0A\00"
@.str.6 = [22 x i8] c"killed (signal = %d)\0A\00"
@.str.7 = [28 x i8] c"parent: ((((((((%s))))))))\0A\00"
@.str.8 = [13 x i8] c"End of trace\00"
@EXIT_SUCCESS = global i32 0
@.str.9 = [27 x i8] c"this should not be reached\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [2 x i32]
%4 = alloca i32
%5 = alloca [2 x i8*]
%6 = alloca [2 x i8*]
%7 = alloca [1024 x i8]
%8 = getelementptr inbounds i8*, i8** %1, i64 2
%9 = load i8*, i8** %8
%10 = bitcast [2 x i32]* %3 to i8*
%11 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
%12 = call i32 @pipe(i32* %11)
%13 = icmp eq i32 %12, -1
br i1 %13, label %14, label %17
14: ; preds = %2
%15 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%16 = call i32 @exit(i32 1)
unreachable
17: ; preds = %2
%18 = bitcast i32* %4 to i8*
%19 = call i32 (...) @fork()
switch i32 %19, label %44 [
i32 -1, label %20
i32 0, label %24
]
20: ; preds = %17
%21 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%22 = load i32, i32* @EXIT_FAILURE
%23 = call i32 @exit(i32 %22)
unreachable
24: ; preds = %17
%25 = load i32, i32* %11
%26 = call i32 @close(i32 %25)
%27 = call i32 @close(i32 1)
%28 = call i32 @close(i32 2)
%29 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 1
%30 = load i32, i32* %29
%31 = call i32 @dup2(i32 %30, i32 1)
%32 = load i32, i32* %29
%33 = call i32 @dup2(i32 %32, i32 2)
%34 = load i32, i32* %29
%35 = call i32 @close(i32 %34)
%36 = bitcast [2 x i8*]* %5 to i8*
%37 = getelementptr inbounds [2 x i8*], [2 x i8*]* %5, i64 0, i64 0
store i8* %9, i8** %37
%38 = getelementptr inbounds [2 x i8*], [2 x i8*]* %5, i64 0, i64 1
store i8* null, i8** %38
%39 = bitcast [2 x i8*]* %6 to i8*
%40 = getelementptr inbounds [2 x i8*], [2 x i8*]* %6, i64 0, i64 0
%41 = call i32 @execve(i8* %9, i8** %37, i8** %40)
%42 = call i32 @perror(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0))
%43 = call i32 @exit(i32 1)
unreachable
44: ; preds = %17
%45 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%46 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 1
%47 = load i32, i32* %46
%48 = call i32 @close(i32 %47)
br label %49
49: ; preds = %97, %44
%50 = call i32 @waitpid(i32 %19, i32* %4, i32 0)
%51 = icmp eq i32 %50, -1
br i1 %51, label %52, label %56
52: ; preds = %49
%53 = call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
%54 = load i32, i32* @EXIT_FAILURE
%55 = call i32 @exit(i32 %54)
unreachable
56: ; preds = %49
%57 = load i32, i32* %4
%58 = call i64 @WIFEXITED(i32 %57)
%59 = icmp eq i64 %58, 0
br i1 %59, label %60, label %64
60: ; preds = %56
%61 = load i32, i32* %4
%62 = call i64 @WIFSIGNALED(i32 %61)
%63 = icmp eq i64 %62, 0
br i1 %63, label %93, label %64
64: ; preds = %60, %56
%65 = load i32, i32* %4
%66 = call i64 @WIFEXITED(i32 %65)
%67 = icmp eq i64 %66, 0
%68 = load i32, i32* %4
br i1 %67, label %72, label %69
69: ; preds = %64
%70 = call i32 @WEXITSTATUS(i32 %68)
%71 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), i32 %70)
br label %79
72: ; preds = %64
%73 = call i64 @WIFSIGNALED(i32 %68)
%74 = icmp eq i64 %73, 0
br i1 %74, label %79, label %75
75: ; preds = %72
%76 = load i32, i32* %4
%77 = call i32 @WTERMSIG(i32 %76)
%78 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0), i32 %77)
br label %79
79: ; preds = %69, %75, %72
%80 = load i32, i32* %11
%81 = call i64 @read(i32 %80, i8* %45, i32 1024)
%82 = icmp eq i64 %81, 0
br i1 %82, label %93, label %83
83: ; preds = %79
%84 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.7, i64 0, i64 0), i8* %45)
%85 = call i64 @strstr(i8* %45, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0))
%86 = icmp eq i64 %85, 0
br i1 %86, label %90, label %87
87: ; preds = %83
%88 = load i32, i32* @EXIT_SUCCESS
%89 = call i32 @exit(i32 %88)
unreachable
90: ; preds = %83
%91 = load i32, i32* @EXIT_FAILURE
%92 = call i32 @exit(i32 %91)
unreachable
93: ; preds = %60, %79
%94 = load i32, i32* %4
%95 = call i64 @WIFEXITED(i32 %94)
%96 = icmp eq i64 %95, 0
br i1 %96, label %97, label %101
97: ; preds = %93
%98 = load i32, i32* %4
%99 = call i64 @WIFSIGNALED(i32 %98)
%100 = icmp eq i64 %99, 0
br i1 %100, label %49, label %101
101: ; preds = %93, %97
%102 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.9, i64 0, i64 0))
%103 = load i32, i32* @EXIT_FAILURE
%104 = call i32 @exit(i32 %103)
unreachable
}