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

/* Variables and functions */
int /*<<< orphan*/ O_RDONLY;
int /*<<< orphan*/ SIGTERM;
int close(int);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ exit(int);
int kill(int, int /*<<< orphan*/);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ sprintf(char *, char *, int);
int /*<<< orphan*/ strerror(int /*<<< orphan*/);
int /*<<< orphan*/ test_daemon();
int test_fork_id(int);
int /*<<< orphan*/ test_init(int, char **);
int /*<<< orphan*/ test_msg(char *, ...);
int /*<<< orphan*/ test_waitsig();
int waitpid(int, int /*<<< orphan*/ *, int /*<<< orphan*/);
int main(int argc, char **argv) {
  int pid, err = 0;
  int proc_fd;
  char name[64];
  test_init(argc, argv);
  pid = test_fork_id(-1);
  if (pid < 0) {
    test_msg("ERR: %s:%d: "
             "Can't fork"
             " (errno = %d (%s))\n",
             "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
             "2022-01-22/02-19-57/repos/LK4D4/criu/refs/heads/master/test/zdtm/"
             "live/static/child_opened_proc.c",
             25, errno, strerror(errno));
    exit(1);
  }
  if (!pid) {
    test_waitsig();
    return 0;
  }
  sprintf(name, "/proc/%d/stat", pid);
  proc_fd = open(name, O_RDONLY);
  if (proc_fd == -1) {
    test_msg("ERR: %s:%d: "
             "can't open %s: %m\n"
             " (errno = %d (%s))\n",
             "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
             "2022-01-22/02-19-57/repos/LK4D4/criu/refs/heads/master/test/zdtm/"
             "live/static/child_opened_proc.c",
             37, name, errno, strerror(errno));
    err++;
    goto out;
  }
  test_daemon();
  test_waitsig();
  if (close(proc_fd) == -1) {
    test_msg("ERR: %s:%d: "
             "Failed to close %s\n"
             " (errno = %d (%s))\n",
             "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
             "2022-01-22/02-19-57/repos/LK4D4/criu/refs/heads/master/test/zdtm/"
             "live/static/child_opened_proc.c",
             45, name, errno, strerror(errno));
    err++;
  }
out:
  if (kill(pid, SIGTERM) == -1) {
    test_msg("ERR: %s:%d: "
             "Failed to terminate child\n"
             " (errno = %d (%s))\n",
             "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
             "2022-01-22/02-19-57/repos/LK4D4/criu/refs/heads/master/test/zdtm/"
             "live/static/child_opened_proc.c",
             50, errno, strerror(errno));
    err++;
  } else {
    if (waitpid(pid, NULL, 0) != pid) {
      test_msg("ERR: %s:%d: "
               "Failed to collect killed child\n"
               " (errno = %d (%s))\n",
               "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
               "outputs/2022-01-22/02-19-57/repos/LK4D4/criu/refs/heads/master/"
               "test/zdtm/live/static/child_opened_proc.c",
               54, errno, strerror(errno));
      err++;
    }
  }
  if (!err)
    test_msg("PASS\n");
  return err;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <test_init@plt>
mov    $0xffffffff,%edi
call   10a0 <test_fork_id@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    1247 <main+0x87>
mov    0x2dc6(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x64(%rbp)
mov    0x2dba(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
mov    -0x64(%rbp),%ecx
mov    %eax,%r8d
lea    0xdd6(%rip),%rdi
lea    0xdf9(%rip),%rsi
mov    $0x19,%edx
mov    $0x0,%al
call   1060 <test_msg@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
cmpl   $0x0,-0x14(%rbp)
jne    1264 <main+0xa4>
mov    $0x0,%al
call   1070 <test_waitsig@plt>
movl   $0x0,-0x4(%rbp)
jmp    144a <main+0x28a>
lea    -0x60(%rbp),%rdi
mov    -0x14(%rbp),%edx
lea    0xe59(%rip),%rsi
call   10c0 <sprintf@plt>
lea    -0x60(%rbp),%rdi
mov    0x2d66(%rip),%rax
mov    (%rax),%esi
call   10b0 <open@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0xffffffff,-0x1c(%rbp)
jne    12eb <main+0x12b>
lea    -0x60(%rbp),%rax
mov    %rax,-0x70(%rbp)
mov    0x2d2b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x68(%rbp)
mov    0x2d1f(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
mov    -0x70(%rbp),%rcx
mov    -0x68(%rbp),%r8d
mov    %eax,%r9d
lea    0xe0f(%rip),%rdi
lea    0xd59(%rip),%rsi
mov    $0x25,%edx
mov    $0x0,%al
call   1060 <test_msg@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    135f <main+0x19f>
mov    $0x0,%al
call   1040 <test_daemon@plt>
mov    $0x0,%al
call   1070 <test_waitsig@plt>
mov    -0x1c(%rbp),%edi
call   1050 <close@plt>
cmp    $0xffffffff,%eax
jne    135a <main+0x19a>
lea    -0x60(%rbp),%rax
mov    %rax,-0x80(%rbp)
mov    0x2cb7(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x74(%rbp)
mov    0x2cab(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
mov    -0x80(%rbp),%rcx
mov    -0x74(%rbp),%r8d
mov    %eax,%r9d
lea    0xdcd(%rip),%rdi
lea    0xce5(%rip),%rsi
mov    $0x2d,%edx
mov    $0x0,%al
call   1060 <test_msg@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    135f <main+0x19f>
mov    -0x14(%rbp),%edi
mov    0x2c77(%rip),%rax
mov    (%rax),%esi
call   1080 <kill@plt>
cmp    $0xffffffff,%eax
jne    13c7 <main+0x207>
mov    0x2c50(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x84(%rbp)
mov    0x2c41(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
mov    -0x84(%rbp),%ecx
mov    %eax,%r8d
lea    0xd98(%rip),%rdi
lea    0xc7d(%rip),%rsi
mov    $0x32,%edx
mov    $0x0,%al
call   1060 <test_msg@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    142c <main+0x26c>
mov    -0x14(%rbp),%edi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1090 <waitpid@plt>
cmp    -0x14(%rbp),%eax
je     1427 <main+0x267>
mov    0x2beb(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x88(%rbp)
mov    0x2bdc(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
mov    -0x88(%rbp),%ecx
mov    %eax,%r8d
lea    0xd6d(%rip),%rdi
lea    0xc18(%rip),%rsi
mov    $0x36,%edx
mov    $0x0,%al
call   1060 <test_msg@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    142c <main+0x26c>
cmpl   $0x0,-0x18(%rbp)
jne    1444 <main+0x284>
lea    0xd7a(%rip),%rdi
mov    $0x0,%al
call   1060 <test_msg@plt>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x40,%rsp
call   1030 <test_init@plt>
mov    $0xffffffff,%edi
call   10a0 <test_fork_id@plt>
test   %eax,%eax
js     1346 <main+0x186>
je     1233 <main+0x73>
mov    %eax,%ebx
lea    0xee1(%rip),%rsi
mov    %rsp,%rbp
mov    %rbp,%rdi
mov    %eax,%edx
call   10c0 <sprintf@plt>
mov    0x2dea(%rip),%rax
mov    (%rax),%esi
mov    %rbp,%rdi
call   10b0 <open@plt>
cmp    $0xffffffff,%eax
je     1241 <main+0x81>
mov    %eax,%ebp
xor    %eax,%eax
call   1040 <test_daemon@plt>
xor    %eax,%eax
call   1070 <test_waitsig@plt>
mov    %ebp,%edi
call   1050 <close@plt>
cmp    $0xffffffff,%eax
je     126c <main+0xac>
mov    $0x1,%ebp
mov    $0x1,%r14b
jmp    12a7 <main+0xe7>
xor    %ebp,%ebp
xor    %eax,%eax
call   1070 <test_waitsig@plt>
jmp    133b <main+0x17b>
mov    0x2d88(%rip),%rax
mov    (%rax),%ebp
mov    %ebp,%edi
call   10e0 <strerror@plt>
lea    0xe81(%rip),%rdi
lea    0xdcb(%rip),%rsi
xor    %r14d,%r14d
mov    %rsp,%rcx
mov    $0x25,%edx
jmp    1295 <main+0xd5>
mov    0x2d5d(%rip),%rax
mov    (%rax),%ebp
mov    %ebp,%edi
call   10e0 <strerror@plt>
lea    0xe88(%rip),%rdi
lea    0xda0(%rip),%rsi
xor    %r14d,%r14d
mov    %rsp,%rcx
mov    $0x2d,%edx
mov    %ebp,%r8d
mov    %eax,%r9d
xor    %eax,%eax
call   1060 <test_msg@plt>
mov    $0x2,%ebp
mov    0x2d32(%rip),%rax
mov    (%rax),%esi
mov    %ebx,%edi
call   1080 <kill@plt>
cmp    $0xffffffff,%eax
je     12e7 <main+0x127>
mov    %ebx,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1090 <waitpid@plt>
cmp    %ebx,%eax
jne    130c <main+0x14c>
mov    $0x1,%ebp
test   %r14b,%r14b
je     133b <main+0x17b>
lea    0xedb(%rip),%rdi
xor    %ebp,%ebp
xor    %eax,%eax
call   1060 <test_msg@plt>
jmp    133b <main+0x17b>
mov    0x2ce2(%rip),%rax
mov    (%rax),%ebx
mov    %ebx,%edi
call   10e0 <strerror@plt>
lea    0xe40(%rip),%rdi
lea    0xd25(%rip),%rsi
mov    $0x32,%edx
jmp    132f <main+0x16f>
mov    0x2cbd(%rip),%rax
mov    (%rax),%ebx
mov    %ebx,%edi
call   10e0 <strerror@plt>
lea    0xe55(%rip),%rdi
lea    0xd00(%rip),%rsi
mov    $0x36,%edx
mov    %ebx,%ecx
mov    %eax,%r8d
xor    %eax,%eax
call   1060 <test_msg@plt>
mov    %ebp,%eax
add    $0x40,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    0x2c83(%rip),%rax
mov    (%rax),%ebx
mov    %ebx,%edi
call   10e0 <strerror@plt>
lea    0xca3(%rip),%rdi
lea    0xcc6(%rip),%rsi
mov    $0x19,%edx
mov    %ebx,%ecx
mov    %eax,%r8d
xor    %eax,%eax
call   1060 <test_msg@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>

LLVM IR (-O0):
@.str = [42 x i8] c"ERR: %s:%d: Can't fork (errno = %d (%s))\0A\00"
@.str.1 = [161 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/LK4D4/criu/refs/heads/master/test/zdtm/live/static/child_opened_proc.c\00"
@errno = global i32 0
@.str.2 = [14 x i8] c"/proc/%d/stat\00"
@O_RDONLY = global i32 0
@.str.3 = [50 x i8] c"ERR: %s:%d: can't open %s: %m\0A (errno = %d (%s))\0A\00"
@.str.4 = [51 x i8] c"ERR: %s:%d: Failed to close %s\0A (errno = %d (%s))\0A\00"
@SIGTERM = global i32 0
@.str.5 = [58 x i8] c"ERR: %s:%d: Failed to terminate child\0A (errno = %d (%s))\0A\00"
@.str.6 = [63 x i8] c"ERR: %s:%d: Failed to collect killed child\0A (errno = %d (%s))\0A\00"
@.str.7 = [6 x i8] c"PASS\0A\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 i32
%9 = alloca [64 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %7
%10 = load i32, i32* %4
%11 = load i8**, i8*** %5
%12 = call i32 @test_init(i32 %10, i8** %11)
%13 = call i32 @test_fork_id(i32 -1)
store i32 %13, i32* %6
%14 = load i32, i32* %6
%15 = icmp slt i32 %14, 0
br i1 %15, label %16, label %22
16: ; preds = %2
%17 = load i32, i32* @errno
%18 = load i32, i32* @errno
%19 = call i32 @strerror(i32 %18)
%20 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([161 x i8], [161 x i8]* @.str.1, i64 0, i64 0), i32 25, i32 %17, i32 %19)
%21 = call i32 @exit(i32 1)
unreachable
22: ; preds = %2
%23 = load i32, i32* %6
%24 = icmp ne i32 %23, 0
br i1 %24, label %27, label %25
25: ; preds = %22
%26 = call i32 (...) @test_waitsig()
store i32 0, i32* %3
br label %91
27: ; preds = %22
%28 = getelementptr inbounds [64 x i8], [64 x i8]* %9, i64 0, i64 0
%29 = load i32, i32* %6
%30 = call i32 @sprintf(i8* %28, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 %29)
%31 = getelementptr inbounds [64 x i8], [64 x i8]* %9, i64 0, i64 0
%32 = load i32, i32* @O_RDONLY
%33 = call i32 @open(i8* %31, i32 %32)
store i32 %33, i32* %8
%34 = load i32, i32* %8
%35 = icmp eq i32 %34, -1
br i1 %35, label %36, label %44
36: ; preds = %27
%37 = getelementptr inbounds [64 x i8], [64 x i8]* %9, i64 0, i64 0
%38 = load i32, i32* @errno
%39 = load i32, i32* @errno
%40 = call i32 @strerror(i32 %39)
%41 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([161 x i8], [161 x i8]* @.str.1, i64 0, i64 0), i32 37, i8* %37, i32 %38, i32 %40)
%42 = load i32, i32* %7
%43 = add nsw i32 %42, 1
store i32 %43, i32* %7
br label %59
44: ; preds = %27
%45 = call i32 (...) @test_daemon()
%46 = call i32 (...) @test_waitsig()
%47 = load i32, i32* %8
%48 = call i32 @close(i32 %47)
%49 = icmp eq i32 %48, -1
br i1 %49, label %50, label %58
50: ; preds = %44
%51 = getelementptr inbounds [64 x i8], [64 x i8]* %9, i64 0, i64 0
%52 = load i32, i32* @errno
%53 = load i32, i32* @errno
%54 = call i32 @strerror(i32 %53)
%55 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([161 x i8], [161 x i8]* @.str.1, i64 0, i64 0), i32 45, i8* %51, i32 %52, i32 %54)
%56 = load i32, i32* %7
%57 = add nsw i32 %56, 1
store i32 %57, i32* %7
br label %58
58: ; preds = %50, %44
br label %59
59: ; preds = %58, %36
%60 = load i32, i32* %6
%61 = load i32, i32* @SIGTERM
%62 = call i32 @kill(i32 %60, i32 %61)
%63 = icmp eq i32 %62, -1
br i1 %63, label %64, label %71
64: ; preds = %59
%65 = load i32, i32* @errno
%66 = load i32, i32* @errno
%67 = call i32 @strerror(i32 %66)
%68 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([161 x i8], [161 x i8]* @.str.1, i64 0, i64 0), i32 50, i32 %65, i32 %67)
%69 = load i32, i32* %7
%70 = add nsw i32 %69, 1
store i32 %70, i32* %7
br label %84
71: ; preds = %59
%72 = load i32, i32* %6
%73 = call i32 @waitpid(i32 %72, i32* null, i32 0)
%74 = load i32, i32* %6
%75 = icmp ne i32 %73, %74
br i1 %75, label %76, label %83
76: ; preds = %71
%77 = load i32, i32* @errno
%78 = load i32, i32* @errno
%79 = call i32 @strerror(i32 %78)
%80 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([161 x i8], [161 x i8]* @.str.1, i64 0, i64 0), i32 54, i32 %77, i32 %79)
%81 = load i32, i32* %7
%82 = add nsw i32 %81, 1
store i32 %82, i32* %7
br label %83
83: ; preds = %76, %71
br label %84
84: ; preds = %83, %64
%85 = load i32, i32* %7
%86 = icmp ne i32 %85, 0
br i1 %86, label %89, label %87
87: ; preds = %84
%88 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
br label %89
89: ; preds = %87, %84
%90 = load i32, i32* %7
store i32 %90, i32* %3
br label %91
91: ; preds = %89, %25
%92 = load i32, i32* %3
ret i32 %92
}

LLVM IR (-O2):
@.str = [42 x i8] c"ERR: %s:%d: Can't fork (errno = %d (%s))\0A\00"
@.str.1 = [161 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/LK4D4/criu/refs/heads/master/test/zdtm/live/static/child_opened_proc.c\00"
@errno = global i32 0
@.str.2 = [14 x i8] c"/proc/%d/stat\00"
@O_RDONLY = global i32 0
@.str.3 = [50 x i8] c"ERR: %s:%d: can't open %s: %m\0A (errno = %d (%s))\0A\00"
@.str.4 = [51 x i8] c"ERR: %s:%d: Failed to close %s\0A (errno = %d (%s))\0A\00"
@SIGTERM = global i32 0
@.str.5 = [58 x i8] c"ERR: %s:%d: Failed to terminate child\0A (errno = %d (%s))\0A\00"
@.str.6 = [63 x i8] c"ERR: %s:%d: Failed to collect killed child\0A (errno = %d (%s))\0A\00"
@.str.7 = [6 x i8] c"PASS\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca [64 x i8]
%4 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%5 = tail call i32 @test_init(i32 %0, i8** %1)
%6 = tail call i32 @test_fork_id(i32 -1)
%7 = icmp slt i32 %6, 0
br i1 %7, label %8, label %13
8: ; preds = %2
%9 = load i32, i32* @errno
%10 = tail call i32 @strerror(i32 %9)
%11 = tail call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([161 x i8], [161 x i8]* @.str.1, i64 0, i64 0), i32 25, i32 %9, i32 %10)
%12 = tail call i32 @exit(i32 1)
unreachable
13: ; preds = %2
%14 = icmp eq i32 %6, 0
br i1 %14, label %15, label %17
15: ; preds = %13
%16 = tail call i32 (...) @test_waitsig()
br label %55
17: ; preds = %13
%18 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 %6)
%19 = load i32, i32* @O_RDONLY
%20 = call i32 @open(i8* %4, i32 %19)
%21 = icmp eq i32 %20, -1
br i1 %21, label %22, label %26
22: ; preds = %17
%23 = load i32, i32* @errno
%24 = tail call i32 @strerror(i32 %23)
%25 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([161 x i8], [161 x i8]* @.str.1, i64 0, i64 0), i32 37, i8* %4, i32 %23, i32 %24)
br label %35
26: ; preds = %17
%27 = tail call i32 (...) @test_daemon()
%28 = tail call i32 (...) @test_waitsig()
%29 = tail call i32 @close(i32 %20)
%30 = icmp eq i32 %29, -1
br i1 %30, label %31, label %35
31: ; preds = %26
%32 = load i32, i32* @errno
%33 = tail call i32 @strerror(i32 %32)
%34 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([161 x i8], [161 x i8]* @.str.1, i64 0, i64 0), i32 45, i8* %4, i32 %32, i32 %33)
br label %35
35: ; preds = %26, %31, %22
%36 = phi i1 [ true, %26 ], [ false, %31 ], [ false, %22 ]
%37 = phi i32 [ 1, %26 ], [ 2, %31 ], [ 2, %22 ]
%38 = load i32, i32* @SIGTERM
%39 = call i32 @kill(i32 %6, i32 %38)
%40 = icmp eq i32 %39, -1
br i1 %40, label %41, label %45
41: ; preds = %35
%42 = load i32, i32* @errno
%43 = call i32 @strerror(i32 %42)
%44 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([161 x i8], [161 x i8]* @.str.1, i64 0, i64 0), i32 50, i32 %42, i32 %43)
br label %55
45: ; preds = %35
%46 = call i32 @waitpid(i32 %6, i32* null, i32 0)
%47 = icmp eq i32 %46, %6
br i1 %47, label %52, label %48
48: ; preds = %45
%49 = load i32, i32* @errno
%50 = call i32 @strerror(i32 %49)
%51 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([161 x i8], [161 x i8]* @.str.1, i64 0, i64 0), i32 54, i32 %49, i32 %50)
br label %55
52: ; preds = %45
br i1 %36, label %53, label %55
53: ; preds = %52
%54 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
br label %55
55: ; preds = %48, %41, %52, %53, %15
%56 = phi i32 [ 0, %15 ], [ 0, %53 ], [ 1, %52 ], [ %37, %48 ], [ %37, %41 ]
ret i32 %56
}