#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__ pid_t;

/* Variables and functions */
int /*<<< orphan*/ SIGTERM;
int WEXITSTATUS(int);
scalar_t__ WIFEXITED(int);
scalar_t__ WIFSIGNALED(int);
int /*<<< orphan*/ WTERMSIG(int);
int /*<<< orphan*/ _exit(int);
int errno;
int /*<<< orphan*/ execlp(char *, char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ exit(int);
scalar_t__ fork();
scalar_t__ kill(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ strerror(int);
int /*<<< orphan*/ test_daemon();
int /*<<< orphan*/ test_init(int, char **);
int /*<<< orphan*/ test_msg(char *, ...);
int /*<<< orphan*/ test_waitsig();
scalar_t__ vfork();
scalar_t__ wait(int *);
int main(int argc, char **argv) {
  int ret = 0;
  pid_t pid;
  test_init(argc, argv);
  pid = fork();
  if (pid < 0) {
    test_msg("ERR: %s:%d: "
             "fork failed: %m",
             "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
             "2022-01-22/02-19-57/repos/fbocharov/criu/refs/heads/master/test/"
             "zdtm/live/static/vfork00.c",
             26);
    exit(1);
  }
  if (pid == 0) {
    int ret2;
    pid = vfork();
    if (pid < 0)
      ret = errno;
    test_waitsig();
    if (pid == 0)
      execlp("/bin/true", "true", NULL);
    if (wait(&ret2) != pid)
      ret = errno;
    _exit(ret);
  }
  test_daemon();
  test_waitsig();
  if (kill(0, SIGTERM)) {
    test_msg("FAIL: %s:%d: "
             "terminating the children failed: %m"
             " (errno = %d (%s))\n",
             "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
             "2022-01-22/02-19-57/repos/fbocharov/criu/refs/heads/master/test/"
             "zdtm/live/static/vfork00.c",
             57, errno, strerror(errno));
    exit(1);
  }
  if (wait(&ret) != pid) {
    test_msg("FAIL: %s:%d: "
             "wait() returned wrong pid: %m"
             " (errno = %d (%s))\n",
             "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
             "2022-01-22/02-19-57/repos/fbocharov/criu/refs/heads/master/test/"
             "zdtm/live/static/vfork00.c",
             62, errno, strerror(errno));
    exit(1);
  }
  if (WIFEXITED(ret)) {
    ret = WEXITSTATUS(ret);
    if (ret) {
      test_msg("FAIL: %s:%d: "
               "child exited with nonzero code %d (%s)"
               " (errno = %d (%s))\n",
               "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
               "outputs/2022-01-22/02-19-57/repos/fbocharov/criu/refs/heads/"
               "master/test/zdtm/live/static/vfork00.c",
               69, ret, strerror(ret), errno, strerror(errno));
      exit(1);
    }
  }
  if (WIFSIGNALED(ret)) {
    test_msg("FAIL: %s:%d: "
             "child exited on unexpected signal %d"
             " (errno = %d (%s))\n",
             "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
             "2022-01-22/02-19-57/repos/fbocharov/criu/refs/heads/master/test/"
             "zdtm/live/static/vfork00.c",
             74, WTERMSIG(ret), errno, strerror(errno));
    exit(1);
  }
  test_msg("PASS\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1040 <test_init@plt>
mov    $0x0,%al
call   1120 <fork@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jge    1263 <main+0x63>
lea    0xdba(%rip),%rdi
lea    0xdcf(%rip),%rsi
mov    $0x1a,%edx
mov    $0x0,%al
call   1060 <test_msg@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
cmpq   $0x0,-0x20(%rbp)
jne    12e0 <main+0xe0>
mov    $0x0,%al
call   10c0 <vfork@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jge    1290 <main+0x90>
mov    0x2d4d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1070 <test_waitsig@plt>
cmpq   $0x0,-0x20(%rbp)
jne    12b9 <main+0xb9>
lea    0xe0e(%rip),%rdi
lea    0xe0c(%rip),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   10f0 <execlp@plt>
lea    -0x24(%rbp),%rdi
call   1110 <wait@plt>
cmp    -0x20(%rbp),%rax
je     12d8 <main+0xd8>
mov    0x2d05(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1030 <_exit@plt>
mov    $0x0,%al
call   1050 <test_daemon@plt>
mov    $0x0,%al
call   1070 <test_waitsig@plt>
mov    0x2cf3(%rip),%rax
mov    (%rax),%esi
xor    %edi,%edi
call   1090 <kill@plt>
cmp    $0x0,%rax
je     134c <main+0x14c>
mov    0x2cc9(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x28(%rbp)
mov    0x2cbd(%rip),%rax
mov    (%rax),%edi
call   1100 <strerror@plt>
mov    -0x28(%rbp),%ecx
mov    %eax,%r8d
lea    0xd92(%rip),%rdi
lea    0xce6(%rip),%rsi
mov    $0x39,%edx
mov    $0x0,%al
call   1060 <test_msg@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
lea    -0x14(%rbp),%rdi
call   1110 <wait@plt>
cmp    -0x20(%rbp),%rax
je     13a3 <main+0x1a3>
mov    0x2c72(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x2c(%rbp)
mov    0x2c66(%rip),%rax
mov    (%rax),%edi
call   1100 <strerror@plt>
mov    -0x2c(%rbp),%ecx
mov    %eax,%r8d
lea    0xd7f(%rip),%rdi
lea    0xc8f(%rip),%rsi
mov    $0x3e,%edx
mov    $0x0,%al
call   1060 <test_msg@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
mov    -0x14(%rbp),%edi
call   10d0 <WIFEXITED@plt>
cmp    $0x0,%rax
je     142c <main+0x22c>
mov    -0x14(%rbp),%edi
call   10b0 <WEXITSTATUS@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1427 <main+0x227>
mov    -0x14(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    -0x14(%rbp),%edi
call   1100 <strerror@plt>
mov    %eax,-0x34(%rbp)
mov    0x2bf6(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x30(%rbp)
mov    0x2bea(%rip),%rax
mov    (%rax),%edi
call   1100 <strerror@plt>
mov    -0x38(%rbp),%ecx
mov    -0x34(%rbp),%r8d
mov    -0x30(%rbp),%r9d
lea    0xd3c(%rip),%rdi
lea    0xc0e(%rip),%rsi
mov    $0x45,%edx
mov    %eax,(%rsp)
mov    $0x0,%al
call   1060 <test_msg@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
jmp    142c <main+0x22c>
mov    -0x14(%rbp),%edi
call   1080 <WIFSIGNALED@plt>
cmp    $0x0,%rax
je     1491 <main+0x291>
mov    -0x14(%rbp),%edi
call   10a0 <WTERMSIG@plt>
mov    %eax,-0x40(%rbp)
mov    0x2b88(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x3c(%rbp)
mov    0x2b7c(%rip),%rax
mov    (%rax),%edi
call   1100 <strerror@plt>
mov    -0x40(%rbp),%ecx
mov    -0x3c(%rbp),%r8d
mov    %eax,%r9d
lea    0xd16(%rip),%rdi
lea    0xba1(%rip),%rsi
mov    $0x4a,%edx
mov    $0x0,%al
call   1060 <test_msg@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
lea    0xd37(%rip),%rdi
mov    $0x0,%al
call   1060 <test_msg@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
movl   $0x0,0x8(%rsp)
call   1040 <test_init@plt>
xor    %eax,%eax
call   1120 <fork@plt>
test   %rax,%rax
js     12b4 <main+0xb4>
je     12d8 <main+0xd8>
mov    %rax,%rbx
xor    %eax,%eax
call   1050 <test_daemon@plt>
xor    %eax,%eax
call   1070 <test_waitsig@plt>
mov    0x2da5(%rip),%rax
mov    (%rax),%esi
xor    %edi,%edi
call   1090 <kill@plt>
test   %rax,%rax
jne    1304 <main+0x104>
lea    0x8(%rsp),%rdi
call   1110 <wait@plt>
cmp    %rbx,%rax
jne    1329 <main+0x129>
mov    0x8(%rsp),%edi
call   10d0 <WIFEXITED@plt>
mov    0x8(%rsp),%edi
test   %rax,%rax
je     128d <main+0x8d>
call   10b0 <WEXITSTATUS@plt>
mov    %eax,0x8(%rsp)
xor    %edi,%edi
test   %eax,%eax
jne    139a <main+0x19a>
call   1080 <WIFSIGNALED@plt>
test   %rax,%rax
jne    1362 <main+0x162>
lea    0xf2d(%rip),%rdi
xor    %eax,%eax
call   1060 <test_msg@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret
lea    0xd45(%rip),%rdi
lea    0xd5a(%rip),%rsi
mov    $0x1a,%edx
xor    %eax,%eax
call   1060 <test_msg@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
xor    %r14d,%r14d
xor    %eax,%eax
call   10c0 <vfork@plt>
mov    %rax,%rbx
test   %rax,%rax
jns    13e5 <main+0x1e5>
mov    0x2ce3(%rip),%rax
mov    (%rax),%r14d
xor    %eax,%eax
call   1070 <test_waitsig@plt>
jmp    1409 <main+0x209>
mov    0x2ccd(%rip),%rax
mov    (%rax),%ebx
mov    %ebx,%edi
call   1100 <strerror@plt>
lea    0xda6(%rip),%rdi
lea    0xcfa(%rip),%rsi
mov    $0x39,%edx
jmp    134c <main+0x14c>
mov    0x2ca8(%rip),%rax
mov    (%rax),%ebx
mov    %ebx,%edi
call   1100 <strerror@plt>
lea    0xdc5(%rip),%rdi
lea    0xcd5(%rip),%rsi
mov    $0x3e,%edx
mov    %ebx,%ecx
mov    %eax,%r8d
xor    %eax,%eax
call   1060 <test_msg@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
mov    0x8(%rsp),%edi
call   10a0 <WTERMSIG@plt>
mov    %eax,%ebx
mov    0x2c64(%rip),%rax
mov    (%rax),%ebp
mov    %ebp,%edi
call   1100 <strerror@plt>
lea    0xe06(%rip),%rdi
lea    0xc91(%rip),%rsi
mov    $0x4a,%edx
mov    %ebx,%ecx
mov    %ebp,%r8d
mov    %eax,%r9d
jmp    13d4 <main+0x1d4>
mov    %eax,%ebx
mov    %eax,%edi
call   1100 <strerror@plt>
mov    %eax,%r14d
mov    0x2c2b(%rip),%rax
mov    (%rax),%ebp
mov    %ebp,%edi
call   1100 <strerror@plt>
mov    %eax,(%rsp)
lea    0xd83(%rip),%rdi
lea    0xc55(%rip),%rsi
mov    $0x45,%edx
mov    %ebx,%ecx
mov    %r14d,%r8d
mov    %ebp,%r9d
xor    %eax,%eax
call   1060 <test_msg@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
xor    %eax,%eax
call   1070 <test_waitsig@plt>
test   %rbx,%rbx
jne    1409 <main+0x209>
lea    0xcbf(%rip),%rdi
lea    0xcbd(%rip),%rsi
xor    %r14d,%r14d
xor    %edx,%edx
call   10f0 <execlp@plt>
lea    0xc(%rsp),%rdi
call   1110 <wait@plt>
cmp    %rbx,%rax
je     1427 <main+0x227>
mov    0x2bb9(%rip),%rax
mov    (%rax),%r14d
mov    %r14d,0x8(%rsp)
mov    %r14d,%edi
call   1030 <_exit@plt>

LLVM IR (-O0):
@.str = [28 x i8] c"ERR: %s:%d: fork failed: %m\00"
@.str.1 = [155 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/fbocharov/criu/refs/heads/master/test/zdtm/live/static/vfork00.c\00"
@errno = global i32 0
@.str.2 = [10 x i8] c"/bin/true\00"
@.str.3 = [5 x i8] c"true\00"
@SIGTERM = global i32 0
@.str.4 = [68 x i8] c"FAIL: %s:%d: terminating the children failed: %m (errno = %d (%s))\0A\00"
@.str.5 = [62 x i8] c"FAIL: %s:%d: wait() returned wrong pid: %m (errno = %d (%s))\0A\00"
@.str.6 = [71 x i8] c"FAIL: %s:%d: child exited with nonzero code %d (%s) (errno = %d (%s))\0A\00"
@.str.7 = [69 x i8] c"FAIL: %s:%d: child exited on unexpected signal %d (errno = %d (%s))\0A\00"
@.str.8 = [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 i64
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
%9 = load i32, i32* %4
%10 = load i8**, i8*** %5
%11 = call i32 @test_init(i32 %9, i8** %10)
%12 = call i64 (...) @fork()
store i64 %12, i64* %7
%13 = load i64, i64* %7
%14 = icmp slt i64 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %2
%16 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([155 x i8], [155 x i8]* @.str.1, i64 0, i64 0), i32 26)
%17 = call i32 @exit(i32 1)
unreachable
18: ; preds = %2
%19 = load i64, i64* %7
%20 = icmp eq i64 %19, 0
br i1 %20, label %21, label %42
21: ; preds = %18
%22 = call i64 (...) @vfork()
store i64 %22, i64* %7
%23 = load i64, i64* %7
%24 = icmp slt i64 %23, 0
br i1 %24, label %25, label %27
25: ; preds = %21
%26 = load i32, i32* @errno
store i32 %26, i32* %6
br label %27
27: ; preds = %25, %21
%28 = call i32 (...) @test_waitsig()
%29 = load i64, i64* %7
%30 = icmp eq i64 %29, 0
br i1 %30, label %31, label %33
31: ; preds = %27
%32 = call i32 @execlp(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32* null)
br label %33
33: ; preds = %31, %27
%34 = call i64 @wait(i32* %8)
%35 = load i64, i64* %7
%36 = icmp ne i64 %34, %35
br i1 %36, label %37, label %39
37: ; preds = %33
%38 = load i32, i32* @errno
store i32 %38, i32* %6
br label %39
39: ; preds = %37, %33
%40 = load i32, i32* %6
%41 = call i32 @_exit(i32 %40)
unreachable
42: ; preds = %18
%43 = call i32 (...) @test_daemon()
%44 = call i32 (...) @test_waitsig()
%45 = load i32, i32* @SIGTERM
%46 = call i64 @kill(i32 0, i32 %45)
%47 = icmp ne i64 %46, 0
br i1 %47, label %48, label %54
48: ; preds = %42
%49 = load i32, i32* @errno
%50 = load i32, i32* @errno
%51 = call i32 @strerror(i32 %50)
%52 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([155 x i8], [155 x i8]* @.str.1, i64 0, i64 0), i32 57, i32 %49, i32 %51)
%53 = call i32 @exit(i32 1)
unreachable
54: ; preds = %42
%55 = call i64 @wait(i32* %6)
%56 = load i64, i64* %7
%57 = icmp ne i64 %55, %56
br i1 %57, label %58, label %64
58: ; preds = %54
%59 = load i32, i32* @errno
%60 = load i32, i32* @errno
%61 = call i32 @strerror(i32 %60)
%62 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([155 x i8], [155 x i8]* @.str.1, i64 0, i64 0), i32 62, i32 %59, i32 %61)
%63 = call i32 @exit(i32 1)
unreachable
64: ; preds = %54
%65 = load i32, i32* %6
%66 = call i64 @WIFEXITED(i32 %65)
%67 = icmp ne i64 %66, 0
br i1 %67, label %68, label %83
68: ; preds = %64
%69 = load i32, i32* %6
%70 = call i32 @WEXITSTATUS(i32 %69)
store i32 %70, i32* %6
%71 = load i32, i32* %6
%72 = icmp ne i32 %71, 0
br i1 %72, label %73, label %82
73: ; preds = %68
%74 = load i32, i32* %6
%75 = load i32, i32* %6
%76 = call i32 @strerror(i32 %75)
%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 ([71 x i8], [71 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([155 x i8], [155 x i8]* @.str.1, i64 0, i64 0), i32 69, i32 %74, i32 %76, i32 %77, i32 %79)
%81 = call i32 @exit(i32 1)
unreachable
82: ; preds = %68
br label %83
83: ; preds = %82, %64
%84 = load i32, i32* %6
%85 = call i64 @WIFSIGNALED(i32 %84)
%86 = icmp ne i64 %85, 0
br i1 %86, label %87, label %95
87: ; preds = %83
%88 = load i32, i32* %6
%89 = call i32 @WTERMSIG(i32 %88)
%90 = load i32, i32* @errno
%91 = load i32, i32* @errno
%92 = call i32 @strerror(i32 %91)
%93 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([155 x i8], [155 x i8]* @.str.1, i64 0, i64 0), i32 74, i32 %89, i32 %90, i32 %92)
%94 = call i32 @exit(i32 1)
unreachable
95: ; preds = %83
%96 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [28 x i8] c"ERR: %s:%d: fork failed: %m\00"
@.str.1 = [155 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/fbocharov/criu/refs/heads/master/test/zdtm/live/static/vfork00.c\00"
@errno = global i32 0
@.str.2 = [10 x i8] c"/bin/true\00"
@.str.3 = [5 x i8] c"true\00"
@SIGTERM = global i32 0
@.str.4 = [68 x i8] c"FAIL: %s:%d: terminating the children failed: %m (errno = %d (%s))\0A\00"
@.str.5 = [62 x i8] c"FAIL: %s:%d: wait() returned wrong pid: %m (errno = %d (%s))\0A\00"
@.str.6 = [71 x i8] c"FAIL: %s:%d: child exited with nonzero code %d (%s) (errno = %d (%s))\0A\00"
@.str.7 = [69 x i8] c"FAIL: %s:%d: child exited on unexpected signal %d (errno = %d (%s))\0A\00"
@.str.8 = [6 x i8] c"PASS\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%6 = tail call i32 @test_init(i32 %0, i8** %1)
%7 = tail call i64 (...) @fork()
%8 = icmp slt i64 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %2
%10 = tail call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([155 x i8], [155 x i8]* @.str.1, i64 0, i64 0), i32 26)
%11 = tail call i32 @exit(i32 1)
unreachable
12: ; preds = %2
%13 = icmp eq i64 %7, 0
br i1 %13, label %14, label %35
14: ; preds = %12
%15 = bitcast i32* %4 to i8*
%16 = tail call i64 (...) @vfork()
%17 = icmp slt i64 %16, 0
br i1 %17, label %18, label %21
18: ; preds = %14
%19 = load i32, i32* @errno
%20 = tail call i32 (...) @test_waitsig()
br label %26
21: ; preds = %14
%22 = tail call i32 (...) @test_waitsig()
%23 = icmp eq i64 %16, 0
br i1 %23, label %24, label %26
24: ; preds = %21
%25 = tail call i32 @execlp(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32* null)
br label %26
26: ; preds = %18, %24, %21
%27 = phi i32 [ %19, %18 ], [ 0, %24 ], [ 0, %21 ]
%28 = call i64 @wait(i32* %4)
%29 = icmp eq i64 %28, %16
br i1 %29, label %32, label %30
30: ; preds = %26
%31 = load i32, i32* @errno
store i32 %31, i32* %3
br label %32
32: ; preds = %30, %26
%33 = phi i32 [ %31, %30 ], [ %27, %26 ]
%34 = call i32 @_exit(i32 %33)
unreachable
35: ; preds = %12
%36 = tail call i32 (...) @test_daemon()
%37 = tail call i32 (...) @test_waitsig()
%38 = load i32, i32* @SIGTERM
%39 = tail call i64 @kill(i32 0, i32 %38)
%40 = icmp eq i64 %39, 0
br i1 %40, label %46, label %41
41: ; preds = %35
%42 = load i32, i32* @errno
%43 = tail call i32 @strerror(i32 %42)
%44 = tail call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([155 x i8], [155 x i8]* @.str.1, i64 0, i64 0), i32 57, i32 %42, i32 %43)
%45 = tail call i32 @exit(i32 1)
unreachable
46: ; preds = %35
%47 = call i64 @wait(i32* %3)
%48 = icmp eq i64 %47, %7
br i1 %48, label %54, label %49
49: ; preds = %46
%50 = load i32, i32* @errno
%51 = call i32 @strerror(i32 %50)
%52 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([155 x i8], [155 x i8]* @.str.1, i64 0, i64 0), i32 62, i32 %50, i32 %51)
%53 = call i32 @exit(i32 1)
unreachable
54: ; preds = %46
%55 = load i32, i32* %3
%56 = call i64 @WIFEXITED(i32 %55)
%57 = icmp eq i64 %56, 0
%58 = load i32, i32* %3
br i1 %57, label %68, label %59
59: ; preds = %54
%60 = call i32 @WEXITSTATUS(i32 %58)
store i32 %60, i32* %3
%61 = icmp eq i32 %60, 0
br i1 %61, label %68, label %62
62: ; preds = %59
%63 = call i32 @strerror(i32 %60)
%64 = load i32, i32* @errno
%65 = call i32 @strerror(i32 %64)
%66 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([155 x i8], [155 x i8]* @.str.1, i64 0, i64 0), i32 69, i32 %60, i32 %63, i32 %64, i32 %65)
%67 = call i32 @exit(i32 1)
unreachable
68: ; preds = %54, %59
%69 = phi i32 [ 0, %59 ], [ %58, %54 ]
%70 = call i64 @WIFSIGNALED(i32 %69)
%71 = icmp eq i64 %70, 0
br i1 %71, label %79, label %72
72: ; preds = %68
%73 = load i32, i32* %3
%74 = call i32 @WTERMSIG(i32 %73)
%75 = load i32, i32* @errno
%76 = call i32 @strerror(i32 %75)
%77 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([155 x i8], [155 x i8]* @.str.1, i64 0, i64 0), i32 74, i32 %74, i32 %75, i32 %76)
%78 = call i32 @exit(i32 1)
unreachable
79: ; preds = %68
%80 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
ret i32 0
}