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

/* Variables and functions */
int /*<<< orphan*/ SIGTERM;
scalar_t__ WEXITSTATUS(int);
int /*<<< orphan*/ WIFEXITED(int);
int /*<<< orphan*/ WIFSIGNALED(int);
int /*<<< orphan*/ WTERMSIG(int);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ exit(int);
scalar_t__ getpgid(int /*<<< orphan*/);
scalar_t__ getpid();
scalar_t__ getppid();
scalar_t__ getsid(int /*<<< orphan*/);
int /*<<< orphan*/ kill(int, int /*<<< orphan*/);
int /*<<< orphan*/ pipe(int *);
int /*<<< orphan*/ read(int, int *, int);
int /*<<< orphan*/ setpgid(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ setsid();
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();
scalar_t__ waitpid(int, int *, int /*<<< orphan*/);
int main(int argc, char **argv) {
  int tmp_pipe[2], i;
  int pids[2], syncfd[2], stat, fail = 0;
  test_init(argc, argv);
  pipe(tmp_pipe);
  pids[0] = test_fork_id(-1);
  if (pids[0] == 0) {
    close(tmp_pipe[0]);
    setsid();
    close(tmp_pipe[1]);
    test_waitsig();
    if (getpid() != getsid(0))
      exit(1);
    if (getpid() != getpgid(0))
      exit(2);
    test_msg("P1 OK\n");
    exit(0);
  }
  close(tmp_pipe[1]);
  syncfd[0] = tmp_pipe[0];
  pipe(tmp_pipe);
  pids[1] = test_fork_id(-1);
  if (pids[1] == 0) {
    int tmp_pipe_sub[2], pid;
    close(tmp_pipe[0]);
    setsid();
    pipe(tmp_pipe_sub);
    pid = test_fork_id(-1);
    if (pid == 0) {
      close(tmp_pipe[1]);
      close(tmp_pipe_sub[0]);
      setpgid(0, 0);
      close(tmp_pipe_sub[1]);
      test_waitsig();
      if (getsid(0) != getppid())
        exit(1);
      if (getpgid(0) != getpid())
        exit(1);
      exit(0);
    }
    close(tmp_pipe_sub[1]);
    read(tmp_pipe_sub[0], &stat, 1);
    close(tmp_pipe_sub[0]);
    close(tmp_pipe[1]);
    test_waitsig();
    if (getpid() != getsid(0))
      exit(1);
    if (getpid() != getpgid(0))
      exit(2);
    kill(pid, SIGTERM);
    if (waitpid(pid, &stat, 0) < 0) {
      test_msg("ERR: %s:%d: "
               "Unable to wait P2 %d"
               " (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/xids00.c",
               87, pid, errno, strerror(errno));
      exit(3);
    } else if (!WIFEXITED(stat) || WEXITSTATUS(stat)) {
      test_msg("ERR: %s:%d: "
               "P2 stat %d/%d/%d/%d"
               " (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/xids00.c",
               90, WIFEXITED(stat), WEXITSTATUS(stat), WIFSIGNALED(stat),
               WTERMSIG(stat), errno, strerror(errno));
      exit(3);
    }
    exit(0);
  }
  close(tmp_pipe[1]);
  syncfd[1] = tmp_pipe[0];
  read(syncfd[0], &stat, 1);
  close(syncfd[0]);
  read(syncfd[1], &stat, 1);
  close(syncfd[1]);
  test_daemon();
  test_waitsig();
  for (i = 0; i < sizeof(pids) / sizeof(pids[0]); i++)
    kill(pids[i], SIGTERM);
  for (i = 0; i < sizeof(pids) / sizeof(pids[0]); i++) {
    if (waitpid(pids[i], &stat, 0) < 0) {
      test_msg("ERR: %s:%d: "
               "Unable to wait %d"
               " (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/xids00.c",
               113, pids[i], errno, strerror(errno));
      fail = 1;
    } else if (!WIFEXITED(stat) || WEXITSTATUS(stat)) {
      test_msg("ERR: %s:%d: "
               "P%d stat %d/%d/%d/%d"
               " (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/xids00.c",
               116, i, WIFEXITED(stat), WEXITSTATUS(stat), WIFSIGNALED(stat),
               WTERMSIG(stat), errno, strerror(errno));
      fail = 1;
    }
  }
  if (fail)
    test_msg("FAIL: %s:%d: "
             "Something failed"
             " (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/xids00.c",
             123, errno, strerror(errno));
  else
    test_msg("PASS\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0xe8,%rsp
movl   $0x0,-0xc(%rbp)
mov    %edi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0x0,-0x3c(%rbp)
mov    -0x10(%rbp),%edi
mov    -0x18(%rbp),%rsi
call   1030 <test_init@plt>
lea    -0x20(%rbp),%rdi
call   1080 <pipe@plt>
mov    $0xffffffff,%edi
call   1120 <test_fork_id@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0x0,-0x2c(%rbp)
jne    1338 <main+0xd8>
mov    -0x20(%rbp),%edi
call   1070 <close@plt>
mov    $0x0,%al
call   1090 <setsid@plt>
mov    -0x1c(%rbp),%edi
call   1070 <close@plt>
mov    $0x0,%al
call   10c0 <test_waitsig@plt>
mov    $0x0,%al
call   1040 <getpid@plt>
mov    %rax,-0x50(%rbp)
xor    %edi,%edi
call   1060 <getsid@plt>
mov    %rax,%rcx
mov    -0x50(%rbp),%rax
cmp    %rcx,%rax
je     12f7 <main+0x97>
mov    $0x1,%edi
call   1170 <exit@plt>
mov    $0x0,%al
call   1040 <getpid@plt>
mov    %rax,-0x58(%rbp)
xor    %edi,%edi
call   1130 <getpgid@plt>
mov    %rax,%rcx
mov    -0x58(%rbp),%rax
cmp    %rcx,%rax
je     1323 <main+0xc3>
mov    $0x2,%edi
call   1170 <exit@plt>
lea    0xcd6(%rip),%rdi
mov    $0x0,%al
call   10a0 <test_msg@plt>
xor    %edi,%edi
call   1170 <exit@plt>
mov    -0x1c(%rbp),%edi
call   1070 <close@plt>
mov    -0x20(%rbp),%eax
mov    %eax,-0x34(%rbp)
lea    -0x20(%rbp),%rdi
call   1080 <pipe@plt>
mov    $0xffffffff,%edi
call   1120 <test_fork_id@plt>
mov    %eax,-0x28(%rbp)
cmpl   $0x0,-0x28(%rbp)
jne    15f3 <main+0x393>
mov    -0x20(%rbp),%edi
call   1070 <close@plt>
mov    $0x0,%al
call   1090 <setsid@plt>
lea    -0x44(%rbp),%rdi
call   1080 <pipe@plt>
mov    $0xffffffff,%edi
call   1120 <test_fork_id@plt>
mov    %eax,-0x48(%rbp)
cmpl   $0x0,-0x48(%rbp)
jne    141c <main+0x1bc>
mov    -0x1c(%rbp),%edi
call   1070 <close@plt>
mov    -0x44(%rbp),%edi
call   1070 <close@plt>
xor    %esi,%esi
mov    %esi,%edi
call   1140 <setpgid@plt>
mov    -0x40(%rbp),%edi
call   1070 <close@plt>
mov    $0x0,%al
call   10c0 <test_waitsig@plt>
xor    %edi,%edi
call   1060 <getsid@plt>
mov    %rax,-0x60(%rbp)
mov    $0x0,%al
call   1160 <getppid@plt>
mov    %rax,%rcx
mov    -0x60(%rbp),%rax
cmp    %rcx,%rax
je     13e9 <main+0x189>
mov    $0x1,%edi
call   1170 <exit@plt>
xor    %edi,%edi
call   1130 <getpgid@plt>
mov    %rax,-0x68(%rbp)
mov    $0x0,%al
call   1040 <getpid@plt>
mov    %rax,%rcx
mov    -0x68(%rbp),%rax
cmp    %rcx,%rax
je     1415 <main+0x1b5>
mov    $0x1,%edi
call   1170 <exit@plt>
xor    %edi,%edi
call   1170 <exit@plt>
mov    -0x40(%rbp),%edi
call   1070 <close@plt>
mov    -0x44(%rbp),%edi
lea    -0x38(%rbp),%rsi
mov    $0x1,%edx
call   10b0 <read@plt>
mov    -0x44(%rbp),%edi
call   1070 <close@plt>
mov    -0x1c(%rbp),%edi
call   1070 <close@plt>
mov    $0x0,%al
call   10c0 <test_waitsig@plt>
mov    $0x0,%al
call   1040 <getpid@plt>
mov    %rax,-0x70(%rbp)
xor    %edi,%edi
call   1060 <getsid@plt>
mov    %rax,%rcx
mov    -0x70(%rbp),%rax
cmp    %rcx,%rax
je     1478 <main+0x218>
mov    $0x1,%edi
call   1170 <exit@plt>
mov    $0x0,%al
call   1040 <getpid@plt>
mov    %rax,-0x78(%rbp)
xor    %edi,%edi
call   1130 <getpgid@plt>
mov    %rax,%rcx
mov    -0x78(%rbp),%rax
cmp    %rcx,%rax
je     14a4 <main+0x244>
mov    $0x2,%edi
call   1170 <exit@plt>
mov    -0x48(%rbp),%edi
mov    0x2b3a(%rip),%rax
mov    (%rax),%esi
call   10e0 <kill@plt>
mov    -0x48(%rbp),%edi
lea    -0x38(%rbp),%rsi
xor    %edx,%edx
call   1110 <waitpid@plt>
cmp    $0x0,%rax
jge    151b <main+0x2bb>
mov    -0x48(%rbp),%eax
mov    %eax,-0x80(%rbp)
mov    0x2afe(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x7c(%rbp)
mov    0x2af2(%rip),%rax
mov    (%rax),%edi
call   1180 <strerror@plt>
mov    -0x80(%rbp),%ecx
mov    -0x7c(%rbp),%r8d
mov    %eax,%r9d
lea    0xb09(%rip),%rdi
lea    0xb36(%rip),%rsi
mov    $0x57,%edx
mov    $0x0,%al
call   10a0 <test_msg@plt>
mov    $0x3,%edi
call   1170 <exit@plt>
mov    -0x38(%rbp),%edi
call   1150 <WIFEXITED@plt>
cmp    $0x0,%eax
je     153e <main+0x2de>
mov    -0x38(%rbp),%edi
call   1100 <WEXITSTATUS@plt>
cmp    $0x0,%rax
je     15e7 <main+0x387>
mov    -0x38(%rbp),%edi
call   1150 <WIFEXITED@plt>
mov    %eax,-0x9c(%rbp)
mov    -0x38(%rbp),%edi
call   1100 <WEXITSTATUS@plt>
mov    %rax,-0x98(%rbp)
mov    -0x38(%rbp),%edi
call   10d0 <WIFSIGNALED@plt>
mov    %eax,-0x8c(%rbp)
mov    -0x38(%rbp),%edi
call   10f0 <WTERMSIG@plt>
mov    %eax,-0x88(%rbp)
mov    0x2a5a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x84(%rbp)
mov    0x2a4b(%rip),%rax
mov    (%rax),%edi
call   1180 <strerror@plt>
mov    -0x9c(%rbp),%ecx
mov    -0x98(%rbp),%r8
mov    -0x8c(%rbp),%r9d
mov    -0x88(%rbp),%r11d
mov    -0x84(%rbp),%r10d
lea    0xb14(%rip),%rdi
lea    0xa77(%rip),%rsi
mov    $0x5a,%edx
mov    %r11d,(%rsp)
mov    %r10d,0x8(%rsp)
mov    %eax,0x10(%rsp)
mov    $0x0,%al
call   10a0 <test_msg@plt>
mov    $0x3,%edi
call   1170 <exit@plt>
jmp    15ec <main+0x38c>
xor    %edi,%edi
call   1170 <exit@plt>
mov    -0x1c(%rbp),%edi
call   1070 <close@plt>
mov    -0x20(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x34(%rbp),%edi
lea    -0x38(%rbp),%rsi
mov    $0x1,%edx
call   10b0 <read@plt>
mov    -0x34(%rbp),%edi
call   1070 <close@plt>
mov    -0x30(%rbp),%edi
lea    -0x38(%rbp),%rsi
mov    $0x1,%edx
call   10b0 <read@plt>
mov    -0x30(%rbp),%edi
call   1070 <close@plt>
mov    $0x0,%al
call   1050 <test_daemon@plt>
mov    $0x0,%al
call   10c0 <test_waitsig@plt>
movl   $0x0,-0x24(%rbp)
movslq -0x24(%rbp),%rax
cmp    $0x2,%rax
jae    167a <main+0x41a>
movslq -0x24(%rbp),%rax
mov    -0x2c(%rbp,%rax,4),%edi
mov    0x2983(%rip),%rax
mov    (%rax),%esi
call   10e0 <kill@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1648 <main+0x3e8>
movl   $0x0,-0x24(%rbp)
movslq -0x24(%rbp),%rax
cmp    $0x2,%rax
jae    17f7 <main+0x597>
movslq -0x24(%rbp),%rax
mov    -0x2c(%rbp,%rax,4),%edi
lea    -0x38(%rbp),%rsi
xor    %edx,%edx
call   1110 <waitpid@plt>
cmp    $0x0,%rax
jge    170d <main+0x4ad>
movslq -0x24(%rbp),%rax
mov    -0x2c(%rbp,%rax,4),%eax
mov    %eax,-0xa4(%rbp)
mov    0x2917(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xa0(%rbp)
mov    0x2908(%rip),%rax
mov    (%rax),%edi
call   1180 <strerror@plt>
mov    -0xa4(%rbp),%ecx
mov    -0xa0(%rbp),%r8d
mov    %eax,%r9d
lea    0xa16(%rip),%rdi
lea    0x946(%rip),%rsi
mov    $0x71,%edx
mov    $0x0,%al
call   10a0 <test_msg@plt>
movl   $0x1,-0x3c(%rbp)
jmp    17e4 <main+0x584>
mov    -0x38(%rbp),%edi
call   1150 <WIFEXITED@plt>
cmp    $0x0,%eax
je     1730 <main+0x4d0>
mov    -0x38(%rbp),%edi
call   1100 <WEXITSTATUS@plt>
cmp    $0x0,%rax
je     17df <main+0x57f>
mov    -0x24(%rbp),%eax
mov    %eax,-0xc0(%rbp)
mov    -0x38(%rbp),%edi
call   1150 <WIFEXITED@plt>
mov    %eax,-0xbc(%rbp)
mov    -0x38(%rbp),%edi
call   1100 <WEXITSTATUS@plt>
mov    %rax,-0xb8(%rbp)
mov    -0x38(%rbp),%edi
call   10d0 <WIFSIGNALED@plt>
mov    %eax,%ebx
mov    -0x38(%rbp),%edi
call   10f0 <WTERMSIG@plt>
mov    %eax,-0xac(%rbp)
mov    0x2863(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xa8(%rbp)
mov    0x2854(%rip),%rax
mov    (%rax),%edi
call   1180 <strerror@plt>
mov    -0xc0(%rbp),%ecx
mov    -0xbc(%rbp),%r8d
mov    -0xb8(%rbp),%r9
mov    -0xac(%rbp),%r11d
mov    -0xa8(%rbp),%r10d
lea    0x981(%rip),%rdi
lea    0x880(%rip),%rsi
mov    $0x74,%edx
mov    %ebx,(%rsp)
mov    %r11d,0x8(%rsp)
mov    %r10d,0x10(%rsp)
mov    %eax,0x18(%rsp)
mov    $0x0,%al
call   10a0 <test_msg@plt>
movl   $0x1,-0x3c(%rbp)
jmp    17e4 <main+0x584>
jmp    17e9 <main+0x589>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1681 <main+0x421>
cmpl   $0x0,-0x3c(%rbp)
je     1846 <main+0x5e6>
mov    0x27d0(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc4(%rbp)
mov    0x27c1(%rip),%rax
mov    (%rax),%edi
call   1180 <strerror@plt>
mov    -0xc4(%rbp),%ecx
mov    %eax,%r8d
lea    0x93b(%rip),%rdi
lea    0x806(%rip),%rsi
mov    $0x7b,%edx
mov    $0x0,%al
call   10a0 <test_msg@plt>
jmp    1854 <main+0x5f4>
lea    0x94d(%rip),%rdi
mov    $0x0,%al
call   10a0 <test_msg@plt>
xor    %eax,%eax
add    $0xe8,%rsp
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
call   1030 <test_init@plt>
lea    0x10(%rsp),%rdi
call   1080 <pipe@plt>
mov    $0xffffffff,%edi
call   1120 <test_fork_id@plt>
test   %eax,%eax
je     153c <main+0x2dc>
mov    %eax,%r12d
mov    0x14(%rsp),%edi
call   1070 <close@plt>
mov    0x10(%rsp),%ebx
lea    0x10(%rsp),%rdi
call   1080 <pipe@plt>
mov    $0xffffffff,%edi
call   1120 <test_fork_id@plt>
test   %eax,%eax
je     15a5 <main+0x345>
mov    %eax,%r14d
mov    0x14(%rsp),%edi
call   1070 <close@plt>
mov    0x10(%rsp),%ebp
lea    0xc(%rsp),%r15
mov    %ebx,%edi
mov    %r15,%rsi
mov    $0x1,%edx
call   10b0 <read@plt>
mov    %ebx,%edi
call   1070 <close@plt>
mov    %ebp,%edi
mov    %r15,%rsi
mov    $0x1,%edx
call   10b0 <read@plt>
mov    %ebp,%edi
call   1070 <close@plt>
xor    %eax,%eax
call   1050 <test_daemon@plt>
xor    %eax,%eax
call   10c0 <test_waitsig@plt>
mov    0x2cd7(%rip),%rbx
mov    (%rbx),%esi
mov    %r12d,%edi
call   10e0 <kill@plt>
mov    (%rbx),%esi
mov    %r14d,%edi
call   10e0 <kill@plt>
mov    %r12d,%edi
mov    %r15,%rsi
xor    %edx,%edx
call   1110 <waitpid@plt>
test   %rax,%rax
js     13d0 <main+0x170>
mov    0xc(%rsp),%edi
call   1150 <WIFEXITED@plt>
test   %eax,%eax
je     135a <main+0xfa>
mov    0xc(%rsp),%edi
call   1100 <WEXITSTATUS@plt>
test   %rax,%rax
je     1407 <main+0x1a7>
mov    0xc(%rsp),%edi
call   1150 <WIFEXITED@plt>
mov    %eax,%r12d
mov    0xc(%rsp),%edi
call   1100 <WEXITSTATUS@plt>
mov    %rax,%r13
mov    0xc(%rsp),%edi
call   10d0 <WIFSIGNALED@plt>
mov    %rax,0x20(%rsp)
mov    0xc(%rsp),%edi
call   10f0 <WTERMSIG@plt>
mov    %eax,%r15d
mov    0x2c45(%rip),%rax
mov    (%rax),%ebx
mov    %ebx,%edi
call   1180 <strerror@plt>
mov    %eax,%ebp
lea    0xd90(%rip),%rdi
lea    0xc8f(%rip),%rsi
mov    $0x74,%edx
xor    %ecx,%ecx
mov    %r12d,%r8d
mov    %r13,%r9
xor    %eax,%eax
push   %rbp
xor    %ebp,%ebp
push   %rbx
push   %r15
push   0x38(%rsp)
call   10a0 <test_msg@plt>
add    $0x20,%rsp
jmp    140a <main+0x1aa>
mov    0x2c01(%rip),%rax
mov    (%rax),%ebx
mov    %ebx,%edi
call   1180 <strerror@plt>
lea    0xd1d(%rip),%rdi
lea    0xc4d(%rip),%rsi
xor    %ebp,%ebp
mov    $0x71,%edx
mov    %r12d,%ecx
mov    %ebx,%r8d
mov    %eax,%r9d
xor    %eax,%eax
call   10a0 <test_msg@plt>
jmp    140a <main+0x1aa>
mov    $0x1,%bpl
lea    0xc(%rsp),%rsi
mov    %r14d,%edi
xor    %edx,%edx
call   1110 <waitpid@plt>
test   %rax,%rax
js     14b4 <main+0x254>
mov    0xc(%rsp),%edi
call   1150 <WIFEXITED@plt>
test   %eax,%eax
je     1441 <main+0x1e1>
mov    0xc(%rsp),%edi
call   1100 <WEXITSTATUS@plt>
test   %rax,%rax
je     1527 <main+0x2c7>
mov    0xc(%rsp),%edi
call   1150 <WIFEXITED@plt>
mov    %eax,%r15d
mov    0xc(%rsp),%edi
call   1100 <WEXITSTATUS@plt>
mov    %rax,%r12
mov    0xc(%rsp),%edi
call   10d0 <WIFSIGNALED@plt>
mov    %eax,%r14d
mov    0xc(%rsp),%edi
call   10f0 <WTERMSIG@plt>
mov    %eax,%r13d
mov    0x2b60(%rip),%rax
mov    (%rax),%ebx
mov    %ebx,%edi
call   1180 <strerror@plt>
mov    %eax,%ebp
lea    0xcab(%rip),%rdi
lea    0xbaa(%rip),%rsi
mov    $0x74,%edx
mov    $0x1,%ecx
mov    %r15d,%r8d
mov    %r12,%r9
xor    %eax,%eax
push   %rbp
push   %rbx
push   %r13
push   %r14
call   10a0 <test_msg@plt>
add    $0x20,%rsp
jmp    14e7 <main+0x287>
mov    0x2b1d(%rip),%rax
mov    (%rax),%ebx
mov    %ebx,%edi
call   1180 <strerror@plt>
lea    0xc39(%rip),%rdi
lea    0xb69(%rip),%rsi
mov    $0x71,%edx
mov    %r14d,%ecx
mov    %ebx,%r8d
mov    %eax,%r9d
xor    %eax,%eax
call   10a0 <test_msg@plt>
mov    0x2aea(%rip),%rax
mov    (%rax),%ebx
mov    %ebx,%edi
call   1180 <strerror@plt>
lea    0xc6b(%rip),%rdi
lea    0xb36(%rip),%rsi
mov    $0x7b,%edx
mov    %ebx,%ecx
mov    %eax,%r8d
xor    %eax,%eax
call   10a0 <test_msg@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
test   %bpl,%bpl
je     14e7 <main+0x287>
lea    0xc67(%rip),%rdi
xor    %eax,%eax
call   10a0 <test_msg@plt>
jmp    1516 <main+0x2b6>
mov    0x10(%rsp),%edi
call   1070 <close@plt>
xor    %eax,%eax
call   1090 <setsid@plt>
mov    0x14(%rsp),%edi
call   1070 <close@plt>
xor    %eax,%eax
call   10c0 <test_waitsig@plt>
xor    %eax,%eax
call   1040 <getpid@plt>
mov    %rax,%rbx
xor    %edi,%edi
call   1060 <getsid@plt>
cmp    %rax,%rbx
jne    16f5 <main+0x495>
xor    %eax,%eax
call   1040 <getpid@plt>
mov    %rax,%rbx
xor    %edi,%edi
call   1130 <getpgid@plt>
cmp    %rax,%rbx
jne    16ff <main+0x49f>
lea    0xa69(%rip),%rdi
xor    %eax,%eax
call   10a0 <test_msg@plt>
xor    %edi,%edi
call   1170 <exit@plt>
mov    0x10(%rsp),%edi
call   1070 <close@plt>
xor    %eax,%eax
call   1090 <setsid@plt>
lea    0x18(%rsp),%rdi
call   1080 <pipe@plt>
mov    $0xffffffff,%edi
call   1120 <test_fork_id@plt>
test   %eax,%eax
jne    1633 <main+0x3d3>
mov    0x14(%rsp),%edi
call   1070 <close@plt>
mov    0x18(%rsp),%edi
call   1070 <close@plt>
xor    %edi,%edi
xor    %esi,%esi
call   1140 <setpgid@plt>
mov    0x1c(%rsp),%edi
call   1070 <close@plt>
xor    %eax,%eax
call   10c0 <test_waitsig@plt>
xor    %edi,%edi
call   1060 <getsid@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1160 <getppid@plt>
cmp    %rax,%rbx
jne    16f5 <main+0x495>
xor    %edi,%edi
call   1130 <getpgid@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1040 <getpid@plt>
cmp    %rax,%rbx
jne    16f5 <main+0x495>
xor    %edi,%edi
call   1170 <exit@plt>
mov    %eax,%ebx
mov    0x1c(%rsp),%edi
call   1070 <close@plt>
mov    0x18(%rsp),%edi
lea    0xc(%rsp),%rsi
mov    $0x1,%edx
call   10b0 <read@plt>
mov    0x18(%rsp),%edi
call   1070 <close@plt>
mov    0x14(%rsp),%edi
call   1070 <close@plt>
xor    %eax,%eax
call   10c0 <test_waitsig@plt>
xor    %eax,%eax
call   1040 <getpid@plt>
mov    %rax,%rbp
xor    %edi,%edi
call   1060 <getsid@plt>
cmp    %rax,%rbp
jne    16f5 <main+0x495>
xor    %eax,%eax
call   1040 <getpid@plt>
mov    %rax,%rbp
xor    %edi,%edi
call   1130 <getpgid@plt>
cmp    %rax,%rbp
jne    16ff <main+0x49f>
mov    0x294b(%rip),%rax
mov    (%rax),%esi
mov    %ebx,%edi
call   10e0 <kill@plt>
lea    0xc(%rsp),%rsi
mov    %ebx,%edi
xor    %edx,%edx
call   1110 <waitpid@plt>
test   %rax,%rax
jns    1709 <main+0x4a9>
mov    0x2918(%rip),%rax
mov    (%rax),%ebp
mov    %ebp,%edi
call   1180 <strerror@plt>
lea    0x937(%rip),%rdi
lea    0x964(%rip),%rsi
mov    $0x57,%edx
mov    %ebx,%ecx
mov    %ebp,%r8d
mov    %eax,%r9d
xor    %eax,%eax
call   10a0 <test_msg@plt>
mov    $0x3,%edi
call   1170 <exit@plt>
mov    $0x1,%edi
call   1170 <exit@plt>
mov    $0x2,%edi
call   1170 <exit@plt>
mov    0xc(%rsp),%edi
call   1150 <WIFEXITED@plt>
test   %eax,%eax
je     1728 <main+0x4c8>
mov    0xc(%rsp),%edi
call   1100 <WEXITSTATUS@plt>
test   %rax,%rax
je     162c <main+0x3cc>
mov    0xc(%rsp),%edi
call   1150 <WIFEXITED@plt>
mov    %eax,%r14d
mov    0xc(%rsp),%edi
call   1100 <WEXITSTATUS@plt>
mov    %rax,%r15
mov    0xc(%rsp),%edi
call   10d0 <WIFSIGNALED@plt>
mov    %eax,%r13d
mov    0xc(%rsp),%edi
call   10f0 <WTERMSIG@plt>
mov    %eax,%r12d
mov    0x2879(%rip),%rax
mov    (%rax),%ebp
mov    %ebp,%edi
call   1180 <strerror@plt>
mov    %eax,%ebx
sub    $0x8,%rsp
lea    0x95c(%rip),%rdi
lea    0x8bf(%rip),%rsi
mov    $0x5a,%edx
mov    %r14d,%ecx
mov    %r15,%r8
mov    %r13d,%r9d
xor    %eax,%eax
push   %rbx
push   %rbp
push   %r12
call   10a0 <test_msg@plt>
add    $0x20,%rsp
mov    $0x3,%edi
call   1170 <exit@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"P1 OK\0A\00"
@SIGTERM = global i32 0
@.str.1 = [52 x i8] c"ERR: %s:%d: Unable to wait P2 %d (errno = %d (%s))\0A\00"
@.str.2 = [150 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/xids00.c\00"
@errno = global i32 0
@.str.3 = [51 x i8] c"ERR: %s:%d: P2 stat %d/%d/%d/%d (errno = %d (%s))\0A\00"
@.str.4 = [49 x i8] c"ERR: %s:%d: Unable to wait %d (errno = %d (%s))\0A\00"
@.str.5 = [52 x i8] c"ERR: %s:%d: P%d stat %d/%d/%d/%d (errno = %d (%s))\0A\00"
@.str.6 = [49 x i8] c"FAIL: %s:%d: Something failed (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 [2 x i32]
%7 = alloca i32
%8 = alloca [2 x i32]
%9 = alloca [2 x i32]
%10 = alloca i32
%11 = alloca i32
%12 = alloca [2 x i32]
%13 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %11
%14 = load i32, i32* %4
%15 = load i8**, i8*** %5
%16 = call i32 @test_init(i32 %14, i8** %15)
%17 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
%18 = call i32 @pipe(i32* %17)
%19 = call i32 @test_fork_id(i32 -1)
%20 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 0
store i32 %19, i32* %20
%21 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 0
%22 = load i32, i32* %21
%23 = icmp eq i32 %22, 0
br i1 %23, label %24, label %47
24: ; preds = %2
%25 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
%26 = load i32, i32* %25
%27 = call i32 @close(i32 %26)
%28 = call i32 (...) @setsid()
%29 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 1
%30 = load i32, i32* %29
%31 = call i32 @close(i32 %30)
%32 = call i32 (...) @test_waitsig()
%33 = call i64 (...) @getpid()
%34 = call i64 @getsid(i32 0)
%35 = icmp ne i64 %33, %34
br i1 %35, label %36, label %38
36: ; preds = %24
%37 = call i32 @exit(i32 1)
unreachable
38: ; preds = %24
%39 = call i64 (...) @getpid()
%40 = call i64 @getpgid(i32 0)
%41 = icmp ne i64 %39, %40
br i1 %41, label %42, label %44
42: ; preds = %38
%43 = call i32 @exit(i32 2)
unreachable
44: ; preds = %38
%45 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%46 = call i32 @exit(i32 0)
unreachable
47: ; preds = %2
%48 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 1
%49 = load i32, i32* %48
%50 = call i32 @close(i32 %49)
%51 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
%52 = load i32, i32* %51
%53 = getelementptr inbounds [2 x i32], [2 x i32]* %9, i64 0, i64 0
store i32 %52, i32* %53
%54 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
%55 = call i32 @pipe(i32* %54)
%56 = call i32 @test_fork_id(i32 -1)
%57 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 1
store i32 %56, i32* %57
%58 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 1
%59 = load i32, i32* %58
%60 = icmp eq i32 %59, 0
br i1 %60, label %61, label %160
61: ; preds = %47
%62 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
%63 = load i32, i32* %62
%64 = call i32 @close(i32 %63)
%65 = call i32 (...) @setsid()
%66 = getelementptr inbounds [2 x i32], [2 x i32]* %12, i64 0, i64 0
%67 = call i32 @pipe(i32* %66)
%68 = call i32 @test_fork_id(i32 -1)
store i32 %68, i32* %13
%69 = load i32, i32* %13
%70 = icmp eq i32 %69, 0
br i1 %70, label %71, label %96
71: ; preds = %61
%72 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 1
%73 = load i32, i32* %72
%74 = call i32 @close(i32 %73)
%75 = getelementptr inbounds [2 x i32], [2 x i32]* %12, i64 0, i64 0
%76 = load i32, i32* %75
%77 = call i32 @close(i32 %76)
%78 = call i32 @setpgid(i32 0, i32 0)
%79 = getelementptr inbounds [2 x i32], [2 x i32]* %12, i64 0, i64 1
%80 = load i32, i32* %79
%81 = call i32 @close(i32 %80)
%82 = call i32 (...) @test_waitsig()
%83 = call i64 @getsid(i32 0)
%84 = call i64 (...) @getppid()
%85 = icmp ne i64 %83, %84
br i1 %85, label %86, label %88
86: ; preds = %71
%87 = call i32 @exit(i32 1)
unreachable
88: ; preds = %71
%89 = call i64 @getpgid(i32 0)
%90 = call i64 (...) @getpid()
%91 = icmp ne i64 %89, %90
br i1 %91, label %92, label %94
92: ; preds = %88
%93 = call i32 @exit(i32 1)
unreachable
94: ; preds = %88
%95 = call i32 @exit(i32 0)
unreachable
96: ; preds = %61
%97 = getelementptr inbounds [2 x i32], [2 x i32]* %12, i64 0, i64 1
%98 = load i32, i32* %97
%99 = call i32 @close(i32 %98)
%100 = getelementptr inbounds [2 x i32], [2 x i32]* %12, i64 0, i64 0
%101 = load i32, i32* %100
%102 = call i32 @read(i32 %101, i32* %10, i32 1)
%103 = getelementptr inbounds [2 x i32], [2 x i32]* %12, i64 0, i64 0
%104 = load i32, i32* %103
%105 = call i32 @close(i32 %104)
%106 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 1
%107 = load i32, i32* %106
%108 = call i32 @close(i32 %107)
%109 = call i32 (...) @test_waitsig()
%110 = call i64 (...) @getpid()
%111 = call i64 @getsid(i32 0)
%112 = icmp ne i64 %110, %111
br i1 %112, label %113, label %115
113: ; preds = %96
%114 = call i32 @exit(i32 1)
unreachable
115: ; preds = %96
%116 = call i64 (...) @getpid()
%117 = call i64 @getpgid(i32 0)
%118 = icmp ne i64 %116, %117
br i1 %118, label %119, label %121
119: ; preds = %115
%120 = call i32 @exit(i32 2)
unreachable
121: ; preds = %115
%122 = load i32, i32* %13
%123 = load i32, i32* @SIGTERM
%124 = call i32 @kill(i32 %122, i32 %123)
%125 = load i32, i32* %13
%126 = call i64 @waitpid(i32 %125, i32* %10, i32 0)
%127 = icmp slt i64 %126, 0
br i1 %127, label %128, label %135
128: ; preds = %121
%129 = load i32, i32* %13
%130 = load i32, i32* @errno
%131 = load i32, i32* @errno
%132 = call i32 @strerror(i32 %131)
%133 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([150 x i8], [150 x i8]* @.str.2, i64 0, i64 0), i32 87, i32 %129, i32 %130, i32 %132)
%134 = call i32 @exit(i32 3)
unreachable
135: ; preds = %121
%136 = load i32, i32* %10
%137 = call i32 @WIFEXITED(i32 %136)
%138 = icmp ne i32 %137, 0
br i1 %138, label %139, label %143
139: ; preds = %135
%140 = load i32, i32* %10
%141 = call i64 @WEXITSTATUS(i32 %140)
%142 = icmp ne i64 %141, 0
br i1 %142, label %143, label %157
143: ; preds = %139, %135
%144 = load i32, i32* %10
%145 = call i32 @WIFEXITED(i32 %144)
%146 = load i32, i32* %10
%147 = call i64 @WEXITSTATUS(i32 %146)
%148 = load i32, i32* %10
%149 = call i32 @WIFSIGNALED(i32 %148)
%150 = load i32, i32* %10
%151 = call i32 @WTERMSIG(i32 %150)
%152 = load i32, i32* @errno
%153 = load i32, i32* @errno
%154 = call i32 @strerror(i32 %153)
%155 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([150 x i8], [150 x i8]* @.str.2, i64 0, i64 0), i32 90, i32 %145, i64 %147, i32 %149, i32 %151, i32 %152, i32 %154)
%156 = call i32 @exit(i32 3)
unreachable
157: ; preds = %139
br label %158
158: ; preds = %157
%159 = call i32 @exit(i32 0)
unreachable
160: ; preds = %47
%161 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 1
%162 = load i32, i32* %161
%163 = call i32 @close(i32 %162)
%164 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
%165 = load i32, i32* %164
%166 = getelementptr inbounds [2 x i32], [2 x i32]* %9, i64 0, i64 1
store i32 %165, i32* %166
%167 = getelementptr inbounds [2 x i32], [2 x i32]* %9, i64 0, i64 0
%168 = load i32, i32* %167
%169 = call i32 @read(i32 %168, i32* %10, i32 1)
%170 = getelementptr inbounds [2 x i32], [2 x i32]* %9, i64 0, i64 0
%171 = load i32, i32* %170
%172 = call i32 @close(i32 %171)
%173 = getelementptr inbounds [2 x i32], [2 x i32]* %9, i64 0, i64 1
%174 = load i32, i32* %173
%175 = call i32 @read(i32 %174, i32* %10, i32 1)
%176 = getelementptr inbounds [2 x i32], [2 x i32]* %9, i64 0, i64 1
%177 = load i32, i32* %176
%178 = call i32 @close(i32 %177)
%179 = call i32 (...) @test_daemon()
%180 = call i32 (...) @test_waitsig()
store i32 0, i32* %7
br label %181
181: ; preds = %192, %160
%182 = load i32, i32* %7
%183 = sext i32 %182 to i64
%184 = icmp ult i64 %183, 2
br i1 %184, label %185, label %195
185: ; preds = %181
%186 = load i32, i32* %7
%187 = sext i32 %186 to i64
%188 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 %187
%189 = load i32, i32* %188
%190 = load i32, i32* @SIGTERM
%191 = call i32 @kill(i32 %189, i32 %190)
br label %192
192: ; preds = %185
%193 = load i32, i32* %7
%194 = add nsw i32 %193, 1
store i32 %194, i32* %7
br label %181
195: ; preds = %181
store i32 0, i32* %7
br label %196
196: ; preds = %240, %195
%197 = load i32, i32* %7
%198 = sext i32 %197 to i64
%199 = icmp ult i64 %198, 2
br i1 %199, label %200, label %243
200: ; preds = %196
%201 = load i32, i32* %7
%202 = sext i32 %201 to i64
%203 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 %202
%204 = load i32, i32* %203
%205 = call i64 @waitpid(i32 %204, i32* %10, i32 0)
%206 = icmp slt i64 %205, 0
br i1 %206, label %207, label %216
207: ; preds = %200
%208 = load i32, i32* %7
%209 = sext i32 %208 to i64
%210 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 %209
%211 = load i32, i32* %210
%212 = load i32, i32* @errno
%213 = load i32, i32* @errno
%214 = call i32 @strerror(i32 %213)
%215 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([150 x i8], [150 x i8]* @.str.2, i64 0, i64 0), i32 113, i32 %211, i32 %212, i32 %214)
store i32 1, i32* %11
br label %239
216: ; preds = %200
%217 = load i32, i32* %10
%218 = call i32 @WIFEXITED(i32 %217)
%219 = icmp ne i32 %218, 0
br i1 %219, label %220, label %224
220: ; preds = %216
%221 = load i32, i32* %10
%222 = call i64 @WEXITSTATUS(i32 %221)
%223 = icmp ne i64 %222, 0
br i1 %223, label %224, label %238
224: ; preds = %220, %216
%225 = load i32, i32* %7
%226 = load i32, i32* %10
%227 = call i32 @WIFEXITED(i32 %226)
%228 = load i32, i32* %10
%229 = call i64 @WEXITSTATUS(i32 %228)
%230 = load i32, i32* %10
%231 = call i32 @WIFSIGNALED(i32 %230)
%232 = load i32, i32* %10
%233 = call i32 @WTERMSIG(i32 %232)
%234 = load i32, i32* @errno
%235 = load i32, i32* @errno
%236 = call i32 @strerror(i32 %235)
%237 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([150 x i8], [150 x i8]* @.str.2, i64 0, i64 0), i32 116, i32 %225, i32 %227, i64 %229, i32 %231, i32 %233, i32 %234, i32 %236)
store i32 1, i32* %11
br label %238
238: ; preds = %224, %220
br label %239
239: ; preds = %238, %207
br label %240
240: ; preds = %239
%241 = load i32, i32* %7
%242 = add nsw i32 %241, 1
store i32 %242, i32* %7
br label %196
243: ; preds = %196
%244 = load i32, i32* %11
%245 = icmp ne i32 %244, 0
br i1 %245, label %246, label %251
246: ; preds = %243
%247 = load i32, i32* @errno
%248 = load i32, i32* @errno
%249 = call i32 @strerror(i32 %248)
%250 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([150 x i8], [150 x i8]* @.str.2, i64 0, i64 0), i32 123, i32 %247, i32 %249)
br label %253
251: ; preds = %243
%252 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
br label %253
253: ; preds = %251, %246
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"P1 OK\0A\00"
@SIGTERM = global i32 0
@.str.1 = [52 x i8] c"ERR: %s:%d: Unable to wait P2 %d (errno = %d (%s))\0A\00"
@.str.2 = [150 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/xids00.c\00"
@errno = global i32 0
@.str.3 = [51 x i8] c"ERR: %s:%d: P2 stat %d/%d/%d/%d (errno = %d (%s))\0A\00"
@.str.4 = [49 x i8] c"ERR: %s:%d: Unable to wait %d (errno = %d (%s))\0A\00"
@.str.5 = [52 x i8] c"ERR: %s:%d: P%d stat %d/%d/%d/%d (errno = %d (%s))\0A\00"
@.str.6 = [49 x i8] c"FAIL: %s:%d: Something failed (errno = %d (%s))\0A\00"
@.str.7 = [6 x i8] c"PASS\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca [2 x i32]
%4 = alloca i32
%5 = alloca [2 x i32]
%6 = bitcast [2 x i32]* %3 to i8*
%7 = bitcast i32* %4 to i8*
%8 = tail call i32 @test_init(i32 %0, i8** %1)
%9 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
%10 = call i32 @pipe(i32* %9)
%11 = call i32 @test_fork_id(i32 -1)
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %35
13: ; preds = %2
%14 = load i32, i32* %9
%15 = call i32 @close(i32 %14)
%16 = call i32 (...) @setsid()
%17 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 1
%18 = load i32, i32* %17
%19 = call i32 @close(i32 %18)
%20 = call i32 (...) @test_waitsig()
%21 = call i64 (...) @getpid()
%22 = call i64 @getsid(i32 0)
%23 = icmp eq i64 %21, %22
br i1 %23, label %26, label %24
24: ; preds = %13
%25 = call i32 @exit(i32 1)
unreachable
26: ; preds = %13
%27 = call i64 (...) @getpid()
%28 = call i64 @getpgid(i32 0)
%29 = icmp eq i64 %27, %28
br i1 %29, label %32, label %30
30: ; preds = %26
%31 = call i32 @exit(i32 2)
unreachable
32: ; preds = %26
%33 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%34 = call i32 @exit(i32 0)
unreachable
35: ; preds = %2
%36 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 1
%37 = load i32, i32* %36
%38 = call i32 @close(i32 %37)
%39 = load i32, i32* %9
%40 = call i32 @pipe(i32* %9)
%41 = call i32 @test_fork_id(i32 -1)
%42 = icmp eq i32 %41, 0
br i1 %42, label %43, label %130
43: ; preds = %35
%44 = bitcast [2 x i32]* %5 to i8*
%45 = load i32, i32* %9
%46 = call i32 @close(i32 %45)
%47 = call i32 (...) @setsid()
%48 = getelementptr inbounds [2 x i32], [2 x i32]* %5, i64 0, i64 0
%49 = call i32 @pipe(i32* %48)
%50 = call i32 @test_fork_id(i32 -1)
%51 = icmp eq i32 %50, 0
br i1 %51, label %52, label %75
52: ; preds = %43
%53 = load i32, i32* %36
%54 = call i32 @close(i32 %53)
%55 = load i32, i32* %48
%56 = call i32 @close(i32 %55)
%57 = call i32 @setpgid(i32 0, i32 0)
%58 = getelementptr inbounds [2 x i32], [2 x i32]* %5, i64 0, i64 1
%59 = load i32, i32* %58
%60 = call i32 @close(i32 %59)
%61 = call i32 (...) @test_waitsig()
%62 = call i64 @getsid(i32 0)
%63 = call i64 (...) @getppid()
%64 = icmp eq i64 %62, %63
br i1 %64, label %67, label %65
65: ; preds = %52
%66 = call i32 @exit(i32 1)
unreachable
67: ; preds = %52
%68 = call i64 @getpgid(i32 0)
%69 = call i64 (...) @getpid()
%70 = icmp eq i64 %68, %69
br i1 %70, label %73, label %71
71: ; preds = %67
%72 = call i32 @exit(i32 1)
unreachable
73: ; preds = %67
%74 = call i32 @exit(i32 0)
unreachable
75: ; preds = %43
%76 = getelementptr inbounds [2 x i32], [2 x i32]* %5, i64 0, i64 1
%77 = load i32, i32* %76
%78 = call i32 @close(i32 %77)
%79 = load i32, i32* %48
%80 = call i32 @read(i32 %79, i32* %4, i32 1)
%81 = load i32, i32* %48
%82 = call i32 @close(i32 %81)
%83 = load i32, i32* %36
%84 = call i32 @close(i32 %83)
%85 = call i32 (...) @test_waitsig()
%86 = call i64 (...) @getpid()
%87 = call i64 @getsid(i32 0)
%88 = icmp eq i64 %86, %87
br i1 %88, label %91, label %89
89: ; preds = %75
%90 = call i32 @exit(i32 1)
unreachable
91: ; preds = %75
%92 = call i64 (...) @getpid()
%93 = call i64 @getpgid(i32 0)
%94 = icmp eq i64 %92, %93
br i1 %94, label %97, label %95
95: ; preds = %91
%96 = call i32 @exit(i32 2)
unreachable
97: ; preds = %91
%98 = load i32, i32* @SIGTERM
%99 = call i32 @kill(i32 %50, i32 %98)
%100 = call i64 @waitpid(i32 %50, i32* %4, i32 0)
%101 = icmp slt i64 %100, 0
br i1 %101, label %102, label %107
102: ; preds = %97
%103 = load i32, i32* @errno
%104 = call i32 @strerror(i32 %103)
%105 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([150 x i8], [150 x i8]* @.str.2, i64 0, i64 0), i32 87, i32 %50, i32 %103, i32 %104)
%106 = call i32 @exit(i32 3)
unreachable
107: ; preds = %97
%108 = load i32, i32* %4
%109 = call i32 @WIFEXITED(i32 %108)
%110 = icmp eq i32 %109, 0
br i1 %110, label %115, label %111
111: ; preds = %107
%112 = load i32, i32* %4
%113 = call i64 @WEXITSTATUS(i32 %112)
%114 = icmp eq i64 %113, 0
br i1 %114, label %128, label %115
115: ; preds = %111, %107
%116 = load i32, i32* %4
%117 = call i32 @WIFEXITED(i32 %116)
%118 = load i32, i32* %4
%119 = call i64 @WEXITSTATUS(i32 %118)
%120 = load i32, i32* %4
%121 = call i32 @WIFSIGNALED(i32 %120)
%122 = load i32, i32* %4
%123 = call i32 @WTERMSIG(i32 %122)
%124 = load i32, i32* @errno
%125 = call i32 @strerror(i32 %124)
%126 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([150 x i8], [150 x i8]* @.str.2, i64 0, i64 0), i32 90, i32 %117, i64 %119, i32 %121, i32 %123, i32 %124, i32 %125)
%127 = call i32 @exit(i32 3)
unreachable
128: ; preds = %111
%129 = call i32 @exit(i32 0)
unreachable
130: ; preds = %35
%131 = load i32, i32* %36
%132 = call i32 @close(i32 %131)
%133 = load i32, i32* %9
%134 = call i32 @read(i32 %39, i32* %4, i32 1)
%135 = call i32 @close(i32 %39)
%136 = call i32 @read(i32 %133, i32* %4, i32 1)
%137 = call i32 @close(i32 %133)
%138 = call i32 (...) @test_daemon()
%139 = call i32 (...) @test_waitsig()
%140 = load i32, i32* @SIGTERM
%141 = call i32 @kill(i32 %11, i32 %140)
%142 = load i32, i32* @SIGTERM
%143 = call i32 @kill(i32 %41, i32 %142)
%144 = call i64 @waitpid(i32 %11, i32* %4, i32 0)
%145 = icmp slt i64 %144, 0
br i1 %145, label %146, label %150
146: ; preds = %130
%147 = load i32, i32* @errno
%148 = call i32 @strerror(i32 %147)
%149 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([150 x i8], [150 x i8]* @.str.2, i64 0, i64 0), i32 113, i32 %11, i32 %147, i32 %148)
br label %170
150: ; preds = %130
%151 = load i32, i32* %4
%152 = call i32 @WIFEXITED(i32 %151)
%153 = icmp eq i32 %152, 0
br i1 %153, label %158, label %154
154: ; preds = %150
%155 = load i32, i32* %4
%156 = call i64 @WEXITSTATUS(i32 %155)
%157 = icmp eq i64 %156, 0
br i1 %157, label %170, label %158
158: ; preds = %154, %150
%159 = load i32, i32* %4
%160 = call i32 @WIFEXITED(i32 %159)
%161 = load i32, i32* %4
%162 = call i64 @WEXITSTATUS(i32 %161)
%163 = load i32, i32* %4
%164 = call i32 @WIFSIGNALED(i32 %163)
%165 = load i32, i32* %4
%166 = call i32 @WTERMSIG(i32 %165)
%167 = load i32, i32* @errno
%168 = call i32 @strerror(i32 %167)
%169 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([150 x i8], [150 x i8]* @.str.2, i64 0, i64 0), i32 116, i32 0, i32 %160, i64 %162, i32 %164, i32 %166, i32 %167, i32 %168)
br label %170
170: ; preds = %146, %158, %154
%171 = phi i1 [ false, %146 ], [ false, %158 ], [ true, %154 ]
%172 = call i64 @waitpid(i32 %41, i32* %4, i32 0)
%173 = icmp slt i64 %172, 0
br i1 %173, label %194, label %174
174: ; preds = %170
%175 = load i32, i32* %4
%176 = call i32 @WIFEXITED(i32 %175)
%177 = icmp eq i32 %176, 0
br i1 %177, label %182, label %178
178: ; preds = %174
%179 = load i32, i32* %4
%180 = call i64 @WEXITSTATUS(i32 %179)
%181 = icmp eq i64 %180, 0
br i1 %181, label %198, label %182
182: ; preds = %178, %174
%183 = load i32, i32* %4
%184 = call i32 @WIFEXITED(i32 %183)
%185 = load i32, i32* %4
%186 = call i64 @WEXITSTATUS(i32 %185)
%187 = load i32, i32* %4
%188 = call i32 @WIFSIGNALED(i32 %187)
%189 = load i32, i32* %4
%190 = call i32 @WTERMSIG(i32 %189)
%191 = load i32, i32* @errno
%192 = call i32 @strerror(i32 %191)
%193 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([150 x i8], [150 x i8]* @.str.2, i64 0, i64 0), i32 116, i32 1, i32 %184, i64 %186, i32 %188, i32 %190, i32 %191, i32 %192)
br label %199
194: ; preds = %170
%195 = load i32, i32* @errno
%196 = call i32 @strerror(i32 %195)
%197 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([150 x i8], [150 x i8]* @.str.2, i64 0, i64 0), i32 113, i32 %41, i32 %195, i32 %196)
br label %199
198: ; preds = %178
br i1 %171, label %203, label %199
199: ; preds = %182, %194, %198
%200 = load i32, i32* @errno
%201 = call i32 @strerror(i32 %200)
%202 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([150 x i8], [150 x i8]* @.str.2, i64 0, i64 0), i32 123, i32 %200, i32 %201)
br label %205
203: ; preds = %198
%204 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
br label %205
205: ; preds = %203, %199
ret i32 0
}