#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 scalar_t__ ssize_t;
typedef scalar_t__ pid_t;
typedef int /*<<< orphan*/ a;

/* Variables and functions */
int /*<<< orphan*/ O_CLOEXEC;
int /*<<< orphan*/ SIGKILL;
int /*<<< orphan*/ WEXITSTATUS(int);
scalar_t__ WIFEXITED(int);
scalar_t__ WIFSIGNALED(int);
int /*<<< orphan*/ WTERMSIG(int);
int /*<<< orphan*/ child();
scalar_t__ close(int);
int /*<<< orphan*/ err(int, char *);
int /*<<< orphan*/ errx(int, char *, ...);
int /*<<< orphan*/ execv(char *, char **);
scalar_t__ fork();
scalar_t__ kill(scalar_t__, int /*<<< orphan*/);
scalar_t__ pipe2(int *, int /*<<< orphan*/);
int /*<<< orphan*/ puts(char *);
scalar_t__ read(int, long *, int);
int /*<<< orphan*/ setbuf(int /*<<< orphan*/, int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
scalar_t__ waitpid(scalar_t__, int *, int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  setbuf(stdout, NULL);
  setbuf(stderr, NULL);
  if (argc < 1) {
    errx(1, "Invalid argc: %d", argc);
  } else if (argc > 1) {
    child();
  }
  int p[2];
  if (pipe2(p, O_CLOEXEC) < 0) {
    err(1, "pipe2");
  }
  pid_t pid = fork();
  if (pid < 0) {
    err(1, "fork");
  } else if (pid == 0) {
    char *arg[] = {argv[0], "xxx", NULL};
    execv(argv[0], arg);
    err(1, "execve");
  }
  if (close(p[1]) < 0) {
    err(1, "close");
  }
  long a = 0;
  ssize_t x = read(p[0], &a, sizeof(a));
  if (x < 0) {
    err(1, "read");
  } else if (x > 0) {
    errx(1, "read got unexpected data");
  }
  if (kill(pid, SIGKILL) < 0) {
    err(1, "kill");
  }
  int status = 0;
  if (waitpid(pid, &status, 0) != pid) {
    err(1, "wait");
  }
  if (WIFEXITED(status)) {
    errx(1, "child exited with: %d", WEXITSTATUS(status));
  } else if (WIFSIGNALED(status)) {
    if (WTERMSIG(status) != SIGKILL) {
      errx(1, "child received an unexpected signal: %d", WTERMSIG(status));
    }
  } else {
    errx(1, "this cannot happen");
  }
  puts("TEST OK");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2db3(%rip),%rax
mov    (%rax),%edi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <setbuf@plt>
mov    0x2db1(%rip),%rax
mov    (%rax),%edi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <setbuf@plt>
cmpl   $0x1,-0x8(%rbp)
jge    125f <main+0x5f>
mov    -0x8(%rbp),%edx
mov    $0x1,%edi
lea    0xdad(%rip),%rsi
mov    $0x0,%al
call   1060 <errx@plt>
jmp    1275 <main+0x75>
cmpl   $0x1,-0x8(%rbp)
jle    1270 <main+0x70>
mov    $0x0,%al
call   1030 <child@plt>
jmp    1275 <main+0x75>
lea    -0x18(%rbp),%rdi
mov    0x2d40(%rip),%rax
mov    (%rax),%esi
call   10f0 <pipe2@plt>
cmp    $0x0,%rax
jge    12a2 <main+0xa2>
mov    $0x1,%edi
lea    0xd74(%rip),%rsi
call   10b0 <err@plt>
mov    $0x0,%al
call   1120 <fork@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jge    12ce <main+0xce>
mov    $0x1,%edi
lea    0xd53(%rip),%rsi
call   10b0 <err@plt>
jmp    131d <main+0x11d>
cmpq   $0x0,-0x20(%rbp)
jne    1318 <main+0x118>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x40(%rbp)
lea    0xd31(%rip),%rax
mov    %rax,-0x38(%rbp)
movq   $0x0,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    -0x40(%rbp),%rsi
call   1110 <execv@plt>
mov    $0x1,%edi
lea    0xd0d(%rip),%rsi
call   10b0 <err@plt>
jmp    131d <main+0x11d>
mov    -0x14(%rbp),%edi
call   1070 <close@plt>
cmp    $0x0,%rax
jge    1340 <main+0x140>
mov    $0x1,%edi
lea    0xcec(%rip),%rsi
call   10b0 <err@plt>
movq   $0x0,-0x48(%rbp)
mov    -0x18(%rbp),%edi
lea    -0x48(%rbp),%rsi
mov    $0x8,%edx
call   1080 <read@plt>
mov    %rax,-0x50(%rbp)
cmpq   $0x0,-0x50(%rbp)
jge    137e <main+0x17e>
mov    $0x1,%edi
lea    0xcb9(%rip),%rsi
call   10b0 <err@plt>
jmp    13a1 <main+0x1a1>
cmpq   $0x0,-0x50(%rbp)
jle    139c <main+0x19c>
mov    $0x1,%edi
lea    0xc9d(%rip),%rsi
mov    $0x0,%al
call   1060 <errx@plt>
jmp    13a1 <main+0x1a1>
mov    -0x20(%rbp),%rdi
mov    0x2c2c(%rip),%rax
mov    (%rax),%esi
call   10a0 <kill@plt>
cmp    $0x0,%rax
jge    13ce <main+0x1ce>
mov    $0x1,%edi
lea    0xc82(%rip),%rsi
call   10b0 <err@plt>
movl   $0x0,-0x54(%rbp)
mov    -0x20(%rbp),%rdi
lea    -0x54(%rbp),%rsi
xor    %edx,%edx
call   10e0 <waitpid@plt>
cmp    -0x20(%rbp),%rax
je     13ff <main+0x1ff>
mov    $0x1,%edi
lea    0xc56(%rip),%rsi
call   10b0 <err@plt>
mov    -0x54(%rbp),%edi
call   1100 <WIFEXITED@plt>
cmp    $0x0,%rax
je     1433 <main+0x233>
mov    -0x54(%rbp),%edi
call   10d0 <WEXITSTATUS@plt>
mov    %eax,%edx
mov    $0x1,%edi
lea    0xc2e(%rip),%rsi
mov    $0x0,%al
call   1060 <errx@plt>
jmp    1496 <main+0x296>
mov    -0x54(%rbp),%edi
call   1090 <WIFSIGNALED@plt>
cmp    $0x0,%rax
je     147e <main+0x27e>
mov    -0x54(%rbp),%edi
call   10c0 <WTERMSIG@plt>
mov    0x2b84(%rip),%rcx
cmp    (%rcx),%eax
je     1479 <main+0x279>
mov    -0x54(%rbp),%edi
call   10c0 <WTERMSIG@plt>
mov    %eax,%edx
mov    $0x1,%edi
lea    0xbf9(%rip),%rsi
mov    $0x0,%al
call   1060 <errx@plt>
jmp    1491 <main+0x291>
mov    $0x1,%edi
lea    0xc09(%rip),%rsi
mov    $0x0,%al
call   1060 <errx@plt>
jmp    1496 <main+0x296>
lea    0xc09(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x28,%rsp
mov    %rsi,%r14
mov    %edi,%ebx
mov    0x2dbd(%rip),%rax
mov    (%rax),%edi
xor    %esi,%esi
call   1050 <setbuf@plt>
mov    0x2dbd(%rip),%rax
mov    (%rax),%edi
xor    %esi,%esi
call   1050 <setbuf@plt>
test   %ebx,%ebx
jle    123e <main+0x3e>
cmp    $0x1,%ebx
je     1253 <main+0x53>
xor    %eax,%eax
call   1030 <child@plt>
jmp    1253 <main+0x53>
lea    0xdbb(%rip),%rsi
mov    $0x1,%edi
mov    %ebx,%edx
xor    %eax,%eax
call   1060 <errx@plt>
mov    0x2d66(%rip),%rax
mov    (%rax),%esi
lea    0x8(%rsp),%rdi
call   10f0 <pipe2@plt>
test   %rax,%rax
jns    127c <main+0x7c>
lea    0xd9f(%rip),%rsi
mov    $0x1,%edi
call   10b0 <err@plt>
xor    %eax,%eax
call   1120 <fork@plt>
mov    %rax,%rbx
test   %rax,%rax
js     12bd <main+0xbd>
jne    12ce <main+0xce>
mov    (%r14),%rdi
mov    %rdi,0x10(%rsp)
lea    0xd80(%rip),%rax
mov    %rax,0x18(%rsp)
movq   $0x0,0x20(%rsp)
lea    0x10(%rsp),%rsi
call   1110 <execv@plt>
lea    0xd65(%rip),%rsi
jmp    12c4 <main+0xc4>
lea    0xd53(%rip),%rsi
mov    $0x1,%edi
call   10b0 <err@plt>
mov    0xc(%rsp),%edi
call   1070 <close@plt>
test   %rax,%rax
jns    12ed <main+0xed>
lea    0xd44(%rip),%rsi
mov    $0x1,%edi
call   10b0 <err@plt>
movq   $0x0,0x10(%rsp)
mov    0x8(%rsp),%edi
lea    0x10(%rsp),%rsi
mov    $0x8,%edx
call   1080 <read@plt>
test   %rax,%rax
js     1325 <main+0x125>
je     1336 <main+0x136>
lea    0xd1b(%rip),%rsi
mov    $0x1,%edi
xor    %eax,%eax
call   1060 <errx@plt>
jmp    1336 <main+0x136>
lea    0xd01(%rip),%rsi
mov    $0x1,%edi
call   10b0 <err@plt>
mov    0x2c9b(%rip),%r14
mov    (%r14),%esi
mov    %rbx,%rdi
call   10a0 <kill@plt>
test   %rax,%rax
jns    135e <main+0x15e>
lea    0xcf7(%rip),%rsi
mov    $0x1,%edi
call   10b0 <err@plt>
movl   $0x0,0x4(%rsp)
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
xor    %edx,%edx
call   10e0 <waitpid@plt>
cmp    %rbx,%rax
je     138b <main+0x18b>
lea    0xccf(%rip),%rsi
mov    $0x1,%edi
call   10b0 <err@plt>
mov    0x4(%rsp),%edi
call   1100 <WIFEXITED@plt>
mov    0x4(%rsp),%edi
test   %rax,%rax
je     13cd <main+0x1cd>
call   10d0 <WEXITSTATUS@plt>
lea    0xcac(%rip),%rsi
mov    $0x1,%edi
mov    %eax,%edx
xor    %eax,%eax
call   1060 <errx@plt>
lea    0xce8(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret
call   1090 <WIFSIGNALED@plt>
test   %rax,%rax
je     13f7 <main+0x1f7>
mov    0x4(%rsp),%edi
call   10c0 <WTERMSIG@plt>
cmp    (%r14),%eax
je     13b7 <main+0x1b7>
mov    0x4(%rsp),%edi
call   10c0 <WTERMSIG@plt>
lea    0xc76(%rip),%rsi
jmp    13a9 <main+0x1a9>
lea    0xc95(%rip),%rsi
mov    $0x1,%edi
xor    %eax,%eax
call   1060 <errx@plt>
jmp    13b7 <main+0x1b7>

LLVM IR (-O0):
@stdout = global i32 0
@stderr = global i32 0
@.str = [17 x i8] c"Invalid argc: %d\00"
@O_CLOEXEC = global i32 0
@.str.1 = [6 x i8] c"pipe2\00"
@.str.2 = [5 x i8] c"fork\00"
@.str.3 = [4 x i8] c"xxx\00"
@.str.4 = [7 x i8] c"execve\00"
@.str.5 = [6 x i8] c"close\00"
@.str.6 = [5 x i8] c"read\00"
@.str.7 = [25 x i8] c"read got unexpected data\00"
@SIGKILL = global i32 0
@.str.8 = [5 x i8] c"kill\00"
@.str.9 = [5 x i8] c"wait\00"
@.str.10 = [22 x i8] c"child exited with: %d\00"
@.str.11 = [40 x i8] c"child received an unexpected signal: %d\00"
@.str.12 = [19 x i8] c"this cannot happen\00"
@.str.13 = [8 x i8] c"TEST OK\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [2 x i32]
%7 = alloca i64
%8 = alloca [3 x i8*]
%9 = alloca i64
%10 = alloca i64
%11 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = load i32, i32* @stdout
%13 = call i32 @setbuf(i32 %12, i32* null)
%14 = load i32, i32* @stderr
%15 = call i32 @setbuf(i32 %14, i32* null)
%16 = load i32, i32* %4
%17 = icmp slt i32 %16, 1
br i1 %17, label %18, label %21
18: ; preds = %2
%19 = load i32, i32* %4
%20 = call i32 (i32, i8*, ...) @errx(i32 1, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %19)
br label %27
21: ; preds = %2
%22 = load i32, i32* %4
%23 = icmp sgt i32 %22, 1
br i1 %23, label %24, label %26
24: ; preds = %21
%25 = call i32 (...) @child()
br label %26
26: ; preds = %24, %21
br label %27
27: ; preds = %26, %18
%28 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
%29 = load i32, i32* @O_CLOEXEC
%30 = call i64 @pipe2(i32* %28, i32 %29)
%31 = icmp slt i64 %30, 0
br i1 %31, label %32, label %34
32: ; preds = %27
%33 = call i32 @err(i32 1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
br label %34
34: ; preds = %32, %27
%35 = call i64 (...) @fork()
store i64 %35, i64* %7
%36 = load i64, i64* %7
%37 = icmp slt i64 %36, 0
br i1 %37, label %38, label %40
38: ; preds = %34
%39 = call i32 @err(i32 1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %57
40: ; preds = %34
%41 = load i64, i64* %7
%42 = icmp eq i64 %41, 0
br i1 %42, label %43, label %56
43: ; preds = %40
%44 = getelementptr inbounds [3 x i8*], [3 x i8*]* %8, i64 0, i64 0
%45 = load i8**, i8*** %5
%46 = getelementptr inbounds i8*, i8** %45, i64 0
%47 = load i8*, i8** %46
store i8* %47, i8** %44
%48 = getelementptr inbounds i8*, i8** %44, i64 1
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8** %48
%49 = getelementptr inbounds i8*, i8** %48, i64 1
store i8* null, i8** %49
%50 = load i8**, i8*** %5
%51 = getelementptr inbounds i8*, i8** %50, i64 0
%52 = load i8*, i8** %51
%53 = getelementptr inbounds [3 x i8*], [3 x i8*]* %8, i64 0, i64 0
%54 = call i32 @execv(i8* %52, i8** %53)
%55 = call i32 @err(i32 1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
br label %56
56: ; preds = %43, %40
br label %57
57: ; preds = %56, %38
%58 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 1
%59 = load i32, i32* %58
%60 = call i64 @close(i32 %59)
%61 = icmp slt i64 %60, 0
br i1 %61, label %62, label %64
62: ; preds = %57
%63 = call i32 @err(i32 1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
br label %64
64: ; preds = %62, %57
store i64 0, i64* %9
%65 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
%66 = load i32, i32* %65
%67 = call i64 @read(i32 %66, i64* %9, i32 8)
store i64 %67, i64* %10
%68 = load i64, i64* %10
%69 = icmp slt i64 %68, 0
br i1 %69, label %70, label %72
70: ; preds = %64
%71 = call i32 @err(i32 1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
br label %78
72: ; preds = %64
%73 = load i64, i64* %10
%74 = icmp sgt i64 %73, 0
br i1 %74, label %75, label %77
75: ; preds = %72
%76 = call i32 (i32, i8*, ...) @errx(i32 1, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0))
br label %77
77: ; preds = %75, %72
br label %78
78: ; preds = %77, %70
%79 = load i64, i64* %7
%80 = load i32, i32* @SIGKILL
%81 = call i64 @kill(i64 %79, i32 %80)
%82 = icmp slt i64 %81, 0
br i1 %82, label %83, label %85
83: ; preds = %78
%84 = call i32 @err(i32 1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
br label %85
85: ; preds = %83, %78
store i32 0, i32* %11
%86 = load i64, i64* %7
%87 = call i64 @waitpid(i64 %86, i32* %11, i32 0)
%88 = load i64, i64* %7
%89 = icmp ne i64 %87, %88
br i1 %89, label %90, label %92
90: ; preds = %85
%91 = call i32 @err(i32 1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0))
br label %92
92: ; preds = %90, %85
%93 = load i32, i32* %11
%94 = call i64 @WIFEXITED(i32 %93)
%95 = icmp ne i64 %94, 0
br i1 %95, label %96, label %100
96: ; preds = %92
%97 = load i32, i32* %11
%98 = call i32 @WEXITSTATUS(i32 %97)
%99 = call i32 (i32, i8*, ...) @errx(i32 1, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.10, i64 0, i64 0), i32 %98)
br label %117
100: ; preds = %92
%101 = load i32, i32* %11
%102 = call i64 @WIFSIGNALED(i32 %101)
%103 = icmp ne i64 %102, 0
br i1 %103, label %104, label %114
104: ; preds = %100
%105 = load i32, i32* %11
%106 = call i32 @WTERMSIG(i32 %105)
%107 = load i32, i32* @SIGKILL
%108 = icmp ne i32 %106, %107
br i1 %108, label %109, label %113
109: ; preds = %104
%110 = load i32, i32* %11
%111 = call i32 @WTERMSIG(i32 %110)
%112 = call i32 (i32, i8*, ...) @errx(i32 1, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.11, i64 0, i64 0), i32 %111)
br label %113
113: ; preds = %109, %104
br label %116
114: ; preds = %100
%115 = call i32 (i32, i8*, ...) @errx(i32 1, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.12, i64 0, i64 0))
br label %116
116: ; preds = %114, %113
br label %117
117: ; preds = %116, %96
%118 = call i32 @puts(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.13, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@stdout = global i32 0
@stderr = global i32 0
@.str = [17 x i8] c"Invalid argc: %d\00"
@O_CLOEXEC = global i32 0
@.str.1 = [6 x i8] c"pipe2\00"
@.str.2 = [5 x i8] c"fork\00"
@.str.3 = [4 x i8] c"xxx\00"
@.str.4 = [7 x i8] c"execve\00"
@.str.5 = [6 x i8] c"close\00"
@.str.6 = [5 x i8] c"read\00"
@.str.7 = [25 x i8] c"read got unexpected data\00"
@SIGKILL = global i32 0
@.str.8 = [5 x i8] c"kill\00"
@.str.9 = [5 x i8] c"wait\00"
@.str.10 = [22 x i8] c"child exited with: %d\00"
@.str.11 = [40 x i8] c"child received an unexpected signal: %d\00"
@.str.12 = [19 x i8] c"this cannot happen\00"
@.str.13 = [8 x i8] c"TEST OK\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [2 x i32]
%4 = alloca [3 x i8*]
%5 = alloca i64
%6 = alloca i32
%7 = load i32, i32* @stdout
%8 = tail call i32 @setbuf(i32 %7, i32* null)
%9 = load i32, i32* @stderr
%10 = tail call i32 @setbuf(i32 %9, i32* null)
%11 = icmp slt i32 %0, 1
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = tail call i32 (i32, i8*, ...) @errx(i32 1, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %0)
br label %18
14: ; preds = %2
%15 = icmp eq i32 %0, 1
br i1 %15, label %18, label %16
16: ; preds = %14
%17 = tail call i32 (...) @child()
br label %18
18: ; preds = %14, %16, %12
%19 = bitcast [2 x i32]* %3 to i8*
%20 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
%21 = load i32, i32* @O_CLOEXEC
%22 = call i64 @pipe2(i32* %20, i32 %21)
%23 = icmp slt i64 %22, 0
br i1 %23, label %24, label %26
24: ; preds = %18
%25 = call i32 @err(i32 1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
br label %26
26: ; preds = %24, %18
%27 = call i64 (...) @fork()
%28 = icmp slt i64 %27, 0
br i1 %28, label %29, label %31
29: ; preds = %26
%30 = call i32 @err(i32 1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %41
31: ; preds = %26
%32 = icmp eq i64 %27, 0
br i1 %32, label %33, label %41
33: ; preds = %31
%34 = bitcast [3 x i8*]* %4 to i8*
%35 = getelementptr inbounds [3 x i8*], [3 x i8*]* %4, i64 0, i64 0
%36 = load i8*, i8** %1
store i8* %36, i8** %35
%37 = getelementptr inbounds [3 x i8*], [3 x i8*]* %4, i64 0, i64 1
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8** %37
%38 = getelementptr inbounds [3 x i8*], [3 x i8*]* %4, i64 0, i64 2
store i8* null, i8** %38
%39 = call i32 @execv(i8* %36, i8** %35)
%40 = call i32 @err(i32 1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
br label %41
41: ; preds = %31, %33, %29
%42 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 1
%43 = load i32, i32* %42
%44 = call i64 @close(i32 %43)
%45 = icmp slt i64 %44, 0
br i1 %45, label %46, label %48
46: ; preds = %41
%47 = call i32 @err(i32 1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
br label %48
48: ; preds = %46, %41
%49 = bitcast i64* %5 to i8*
store i64 0, i64* %5
%50 = load i32, i32* %20
%51 = call i64 @read(i32 %50, i64* %5, i32 8)
%52 = icmp slt i64 %51, 0
br i1 %52, label %53, label %55
53: ; preds = %48
%54 = call i32 @err(i32 1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
br label %59
55: ; preds = %48
%56 = icmp eq i64 %51, 0
br i1 %56, label %59, label %57
57: ; preds = %55
%58 = call i32 (i32, i8*, ...) @errx(i32 1, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0))
br label %59
59: ; preds = %55, %57, %53
%60 = load i32, i32* @SIGKILL
%61 = call i64 @kill(i64 %27, i32 %60)
%62 = icmp slt i64 %61, 0
br i1 %62, label %63, label %65
63: ; preds = %59
%64 = call i32 @err(i32 1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
br label %65
65: ; preds = %63, %59
%66 = bitcast i32* %6 to i8*
store i32 0, i32* %6
%67 = call i64 @waitpid(i64 %27, i32* %6, i32 0)
%68 = icmp eq i64 %67, %27
br i1 %68, label %71, label %69
69: ; preds = %65
%70 = call i32 @err(i32 1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0))
br label %71
71: ; preds = %69, %65
%72 = load i32, i32* %6
%73 = call i64 @WIFEXITED(i32 %72)
%74 = icmp eq i64 %73, 0
%75 = load i32, i32* %6
br i1 %74, label %79, label %76
76: ; preds = %71
%77 = call i32 @WEXITSTATUS(i32 %75)
%78 = call i32 (i32, i8*, ...) @errx(i32 1, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.10, i64 0, i64 0), i32 %77)
br label %93
79: ; preds = %71
%80 = call i64 @WIFSIGNALED(i32 %75)
%81 = icmp eq i64 %80, 0
br i1 %81, label %91, label %82
82: ; preds = %79
%83 = load i32, i32* %6
%84 = call i32 @WTERMSIG(i32 %83)
%85 = load i32, i32* @SIGKILL
%86 = icmp eq i32 %84, %85
br i1 %86, label %93, label %87
87: ; preds = %82
%88 = load i32, i32* %6
%89 = call i32 @WTERMSIG(i32 %88)
%90 = call i32 (i32, i8*, ...) @errx(i32 1, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.11, i64 0, i64 0), i32 %89)
br label %93
91: ; preds = %79
%92 = call i32 (i32, i8*, ...) @errx(i32 1, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.12, i64 0, i64 0))
br label %93
93: ; preds = %91, %87, %82, %76
%94 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.13, i64 0, i64 0))
ret i32 0
}