#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*/ P_PID;
int /*<<< orphan*/ SIGCONT;
int /*<<< orphan*/ SIGSTOP;
int WCONTINUED;
scalar_t__ WIFEXITED(int);
scalar_t__ WIFSTOPPED(int);
int WNOWAIT;
int WSTOPPED;
int WUNTRACED;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ kill(scalar_t__, int /*<<< orphan*/);
scalar_t__ pipe(int *);
int read(int, char *, int);
int /*<<< orphan*/ strerror(int /*<<< orphan*/);
int /*<<< orphan*/ test_daemon();
scalar_t__ test_fork_id(int);
int /*<<< orphan*/ test_init(int, char **);
int /*<<< orphan*/ test_msg(char *, ...);
int /*<<< orphan*/ test_waitsig();
scalar_t__ waitid(int /*<<< orphan*/, scalar_t__, int /*<<< orphan*/ *, int);
int waitpid(scalar_t__, int *, int);
int /*<<< orphan*/ write(int, char *, int);
int main(int argc, char **argv) {
  pid_t pid;
  int p[2], ret, status;
  test_init(argc, argv);
  if (pipe(p)) {
    test_msg("ERR: %s:%d: "
             "Unable to create pipe"
             " (errno = %d (%s))\n",
             "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
             "2022-01-22/02-19-57/repos/AuthenticEshkinKot/criu/refs/heads/"
             "master/test/zdtm/live/static/stopped.c",
             21, errno, strerror(errno));
    return 1;
  }
  pid = test_fork_id(-1);
  if (pid < 0)
    return -1;
  else if (pid == 0) {
    char c;
    close(p[1]);
    ret = read(p[0], &c, 1);
    if (ret != 1) {
      test_msg("ERR: %s:%d: "
               "Unable to read: %d"
               " (errno = %d (%s))\n",
               "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
               "outputs/2022-01-22/02-19-57/repos/AuthenticEshkinKot/criu/refs/"
               "heads/master/test/zdtm/live/static/stopped.c",
               34, ret, errno, strerror(errno));
      return 1;
    }
    return 0;
  }
  close(p[0]);
  kill(pid, SIGSTOP);
  if (waitid(P_PID, pid, NULL, WNOWAIT | WSTOPPED) < 0) {
    test_msg("ERR: %s:%d: "
             "waitid"
             " (errno = %d (%s))\n",
             "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
             "2022-01-22/02-19-57/repos/AuthenticEshkinKot/criu/refs/heads/"
             "master/test/zdtm/live/static/stopped.c",
             44, errno, strerror(errno));
    return 1;
  }
  write(p[1], "0", 1);
  close(p[1]);
  test_daemon();
  test_waitsig();
  if (waitpid(pid, &status, WUNTRACED | WCONTINUED) == -1) {
    test_msg("ERR: %s:%d: "
             "Unable to wait child"
             " (errno = %d (%s))\n",
             "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
             "2022-01-22/02-19-57/repos/AuthenticEshkinKot/criu/refs/heads/"
             "master/test/zdtm/live/static/stopped.c",
             62, errno, strerror(errno));
    goto out;
  }
  if (WIFSTOPPED(status))
    test_msg("The procces stopped\n");
  else {
    test_msg("FAIL: %s:%d: "
             "The process doesn't stopped"
             " (errno = %d (%s))\n",
             "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
             "2022-01-22/02-19-57/repos/AuthenticEshkinKot/criu/refs/heads/"
             "master/test/zdtm/live/static/stopped.c",
             69, errno, strerror(errno));
    goto out;
  }
  kill(pid, SIGCONT);
  if (waitpid(pid, &status, 0) == -1) {
    test_msg("ERR: %s:%d: "
             "Unable to wait child"
             " (errno = %d (%s))\n",
             "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
             "2022-01-22/02-19-57/repos/AuthenticEshkinKot/criu/refs/heads/"
             "master/test/zdtm/live/static/stopped.c",
             76, errno, strerror(errno));
    goto out;
  }
  if (WIFEXITED(status))
    test_msg("PASS\n");
  else
    test_msg("FAIL: %s:%d: "
             "The process doesn't continue"
             " (errno = %d (%s))\n",
             "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
             "2022-01-22/02-19-57/repos/AuthenticEshkinKot/criu/refs/heads/"
             "master/test/zdtm/live/static/stopped.c",
             83, errno, strerror(errno));
out:
  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)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <test_init@plt>
lea    -0x20(%rbp),%rdi
call   1070 <pipe@plt>
cmp    $0x0,%rax
je     126b <main+0x7b>
mov    0x2d8c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x30(%rbp)
mov    0x2d80(%rip),%rax
mov    (%rax),%edi
call   1100 <strerror@plt>
mov    -0x30(%rbp),%ecx
mov    %eax,%r8d
lea    0xdb4(%rip),%rdi
lea    0xde2(%rip),%rsi
mov    $0x15,%edx
mov    $0x0,%al
call   1080 <test_msg@plt>
movl   $0x1,-0x4(%rbp)
jmp    157d <main+0x38d>
mov    $0xffffffff,%edi
call   10e0 <test_fork_id@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jge    1290 <main+0xa0>
movl   $0xffffffff,-0x4(%rbp)
jmp    157d <main+0x38d>
cmpq   $0x0,-0x18(%rbp)
jne    131d <main+0x12d>
mov    -0x1c(%rbp),%edi
call   1060 <close@plt>
mov    -0x20(%rbp),%edi
lea    -0x29(%rbp),%rsi
mov    $0x1,%edx
call   1090 <read@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x1,-0x24(%rbp)
je     1311 <main+0x121>
mov    -0x24(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    0x2cea(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x34(%rbp)
mov    0x2cde(%rip),%rax
mov    (%rax),%edi
call   1100 <strerror@plt>
mov    -0x38(%rbp),%ecx
mov    -0x34(%rbp),%r8d
mov    %eax,%r9d
lea    0xde7(%rip),%rdi
lea    0xd3c(%rip),%rsi
mov    $0x22,%edx
mov    $0x0,%al
call   1080 <test_msg@plt>
movl   $0x1,-0x4(%rbp)
jmp    157d <main+0x38d>
movl   $0x0,-0x4(%rbp)
jmp    157d <main+0x38d>
jmp    1322 <main+0x132>
mov    -0x20(%rbp),%edi
call   1060 <close@plt>
mov    -0x18(%rbp),%rdi
mov    0x2c7b(%rip),%rax
mov    (%rax),%esi
call   10b0 <kill@plt>
mov    0x2c8d(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rsi
mov    0x2c90(%rip),%rax
mov    (%rax),%ecx
mov    0x2c97(%rip),%rax
or     (%rax),%ecx
xor    %eax,%eax
mov    %eax,%edx
call   1110 <waitid@plt>
cmp    $0x0,%rax
jge    13b4 <main+0x1c4>
mov    0x2c43(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x3c(%rbp)
mov    0x2c37(%rip),%rax
mov    (%rax),%edi
call   1100 <strerror@plt>
mov    -0x3c(%rbp),%ecx
mov    %eax,%r8d
lea    0xd76(%rip),%rdi
lea    0xc99(%rip),%rsi
mov    $0x2c,%edx
mov    $0x0,%al
call   1080 <test_msg@plt>
movl   $0x1,-0x4(%rbp)
jmp    157d <main+0x38d>
mov    -0x1c(%rbp),%edi
lea    0xd73(%rip),%rsi
mov    $0x1,%edx
call   1040 <write@plt>
mov    -0x1c(%rbp),%edi
call   1060 <close@plt>
mov    $0x0,%al
call   1050 <test_daemon@plt>
mov    $0x0,%al
call   10a0 <test_waitsig@plt>
mov    -0x18(%rbp),%rdi
mov    0x2bd7(%rip),%rax
mov    (%rax),%edx
mov    0x2bae(%rip),%rax
or     (%rax),%edx
lea    -0x28(%rbp),%rsi
call   10d0 <waitpid@plt>
cmp    $0xffffffff,%eax
jne    1445 <main+0x255>
mov    0x2bab(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x40(%rbp)
mov    0x2b9f(%rip),%rax
mov    (%rax),%edi
call   1100 <strerror@plt>
mov    -0x40(%rbp),%ecx
mov    %eax,%r8d
lea    0xd06(%rip),%rdi
lea    0xc01(%rip),%rsi
mov    $0x3e,%edx
mov    $0x0,%al
call   1080 <test_msg@plt>
jmp    1576 <main+0x386>
mov    -0x28(%rbp),%edi
call   10c0 <WIFSTOPPED@plt>
cmp    $0x0,%rax
je     146a <main+0x27a>
lea    0xd09(%rip),%rdi
mov    $0x0,%al
call   1080 <test_msg@plt>
jmp    14a9 <main+0x2b9>
mov    0x2b47(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x44(%rbp)
mov    0x2b3b(%rip),%rax
mov    (%rax),%edi
call   1100 <strerror@plt>
mov    -0x44(%rbp),%ecx
mov    %eax,%r8d
lea    0xceb(%rip),%rdi
lea    0xb9d(%rip),%rsi
mov    $0x45,%edx
mov    $0x0,%al
call   1080 <test_msg@plt>
jmp    1576 <main+0x386>
mov    -0x18(%rbp),%rdi
mov    0x2b24(%rip),%rax
mov    (%rax),%esi
call   10b0 <kill@plt>
mov    -0x18(%rbp),%rdi
lea    -0x28(%rbp),%rsi
xor    %edx,%edx
call   10d0 <waitpid@plt>
cmp    $0xffffffff,%eax
jne    1512 <main+0x322>
mov    0x2ade(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x48(%rbp)
mov    0x2ad2(%rip),%rax
mov    (%rax),%edi
call   1100 <strerror@plt>
mov    -0x48(%rbp),%ecx
mov    %eax,%r8d
lea    0xc39(%rip),%rdi
lea    0xb34(%rip),%rsi
mov    $0x4c,%edx
mov    $0x0,%al
call   1080 <test_msg@plt>
jmp    1576 <main+0x386>
mov    -0x28(%rbp),%edi
call   10f0 <WIFEXITED@plt>
cmp    $0x0,%rax
je     1537 <main+0x347>
lea    0xc8d(%rip),%rdi
mov    $0x0,%al
call   1080 <test_msg@plt>
jmp    1571 <main+0x381>
mov    0x2a7a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4c(%rbp)
mov    0x2a6e(%rip),%rax
mov    (%rax),%edi
call   1100 <strerror@plt>
mov    -0x4c(%rbp),%ecx
mov    %eax,%r8d
lea    0xc60(%rip),%rdi
lea    0xad0(%rip),%rsi
mov    $0x53,%edx
mov    $0x0,%al
call   1080 <test_msg@plt>
jmp    1576 <main+0x386>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
call   1030 <test_init@plt>
lea    0x8(%rsp),%rdi
call   1070 <pipe@plt>
test   %rax,%rax
je     124b <main+0x5b>
mov    0x2da5(%rip),%rax
mov    (%rax),%ebx
mov    %ebx,%edi
call   1100 <strerror@plt>
lea    0xddd(%rip),%rdi
lea    0xe0b(%rip),%rsi
mov    $0x15,%edx
mov    %ebx,%ecx
mov    %eax,%r8d
xor    %eax,%eax
call   1080 <test_msg@plt>
mov    $0x1,%ebx
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    $0xffffffff,%ebx
mov    $0xffffffff,%edi
call   10e0 <test_fork_id@plt>
test   %rax,%rax
js     1240 <main+0x50>
je     1372 <main+0x182>
mov    %rax,%r14
mov    0x8(%rsp),%edi
call   1060 <close@plt>
mov    0x2d38(%rip),%rax
mov    (%rax),%esi
mov    %r14,%rdi
call   10b0 <kill@plt>
mov    0x2d47(%rip),%rax
mov    (%rax),%edi
mov    0x2d4e(%rip),%rax
mov    0x2d57(%rip),%rcx
mov    (%rcx),%ecx
or     (%rax),%ecx
mov    %r14,%rsi
xor    %edx,%edx
call   1110 <waitid@plt>
test   %rax,%rax
js     13d2 <main+0x1e2>
mov    0xc(%rsp),%edi
lea    0xe76(%rip),%rsi
mov    $0x1,%edx
call   1040 <write@plt>
mov    0xc(%rsp),%edi
call   1060 <close@plt>
xor    %ebx,%ebx
xor    %eax,%eax
call   1050 <test_daemon@plt>
xor    %eax,%eax
call   10a0 <test_waitsig@plt>
mov    0x2cdb(%rip),%rax
mov    0x2cb4(%rip),%rcx
mov    (%rcx),%edx
or     (%rax),%edx
mov    %rsp,%rsi
mov    %r14,%rdi
call   10d0 <waitpid@plt>
cmp    $0xffffffff,%eax
je     13fa <main+0x20a>
mov    (%rsp),%edi
call   10c0 <WIFSTOPPED@plt>
test   %rax,%rax
je     141f <main+0x22f>
lea    0xe4b(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1080 <test_msg@plt>
mov    0x2cac(%rip),%rax
mov    (%rax),%esi
mov    %r14,%rdi
call   10b0 <kill@plt>
mov    %rsp,%rsi
mov    %r14,%rdi
xor    %edx,%edx
call   10d0 <waitpid@plt>
cmp    $0xffffffff,%eax
je     1446 <main+0x256>
mov    (%rsp),%edi
call   10f0 <WIFEXITED@plt>
test   %rax,%rax
je     146b <main+0x27b>
lea    0xe54(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1080 <test_msg@plt>
jmp    1240 <main+0x50>
mov    0xc(%rsp),%edi
call   1060 <close@plt>
mov    0x8(%rsp),%edi
lea    0x7(%rsp),%rsi
mov    $0x1,%edx
call   1090 <read@plt>
xor    %ebx,%ebx
cmp    $0x1,%eax
je     1240 <main+0x50>
mov    %eax,%ebp
mov    0x2c16(%rip),%rax
mov    (%rax),%ebx
mov    %ebx,%edi
call   1100 <strerror@plt>
lea    0xd27(%rip),%rdi
lea    0xc7c(%rip),%rsi
mov    $0x22,%edx
mov    %ebp,%ecx
mov    %ebx,%r8d
mov    %eax,%r9d
xor    %eax,%eax
call   1080 <test_msg@plt>
jmp    123b <main+0x4b>
mov    0x2bdf(%rip),%rax
mov    (%rax),%ebx
mov    %ebx,%edi
call   1100 <strerror@plt>
lea    0xd22(%rip),%rdi
lea    0xc45(%rip),%rsi
mov    $0x2c,%edx
jmp    122f <main+0x3f>
mov    0x2bb7(%rip),%rax
mov    (%rax),%ebp
mov    %ebp,%edi
call   1100 <strerror@plt>
lea    0xd22(%rip),%rdi
lea    0xc1d(%rip),%rsi
mov    $0x3e,%edx
jmp    1490 <main+0x2a0>
mov    0x2b92(%rip),%rax
mov    (%rax),%ebp
mov    %ebp,%edi
call   1100 <strerror@plt>
lea    0xd46(%rip),%rdi
lea    0xbf8(%rip),%rsi
xor    %ebx,%ebx
mov    $0x45,%edx
jmp    1490 <main+0x2a0>
mov    0x2b6b(%rip),%rax
mov    (%rax),%ebp
mov    %ebp,%edi
call   1100 <strerror@plt>
lea    0xcd6(%rip),%rdi
lea    0xbd1(%rip),%rsi
mov    $0x4c,%edx
jmp    1490 <main+0x2a0>
mov    0x2b46(%rip),%rax
mov    (%rax),%ebp
mov    %ebp,%edi
call   1100 <strerror@plt>
lea    0xd3c(%rip),%rdi
lea    0xbac(%rip),%rsi
xor    %ebx,%ebx
mov    $0x53,%edx
mov    %ebp,%ecx
mov    %eax,%r8d
xor    %eax,%eax
call   1080 <test_msg@plt>
jmp    1240 <main+0x50>

LLVM IR (-O0):
@.str = [53 x i8] c"ERR: %s:%d: Unable to create pipe (errno = %d (%s))\0A\00"
@.str.1 = [164 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/AuthenticEshkinKot/criu/refs/heads/master/test/zdtm/live/static/stopped.c\00"
@errno = global i32 0
@.str.2 = [50 x i8] c"ERR: %s:%d: Unable to read: %d (errno = %d (%s))\0A\00"
@SIGSTOP = global i32 0
@P_PID = global i32 0
@WNOWAIT = global i32 0
@WSTOPPED = global i32 0
@.str.3 = [38 x i8] c"ERR: %s:%d: waitid (errno = %d (%s))\0A\00"
@.str.4 = [2 x i8] c"0\00"
@WUNTRACED = global i32 0
@WCONTINUED = global i32 0
@.str.5 = [52 x i8] c"ERR: %s:%d: Unable to wait child (errno = %d (%s))\0A\00"
@.str.6 = [21 x i8] c"The procces stopped\0A\00"
@.str.7 = [60 x i8] c"FAIL: %s:%d: The process doesn't stopped (errno = %d (%s))\0A\00"
@SIGCONT = global i32 0
@.str.8 = [6 x i8] c"PASS\0A\00"
@.str.9 = [61 x i8] c"FAIL: %s:%d: The process doesn't continue (errno = %d (%s))\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca [2 x i32]
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = load i32, i32* %4
%12 = load i8**, i8*** %5
%13 = call i32 @test_init(i32 %11, i8** %12)
%14 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
%15 = call i64 @pipe(i32* %14)
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %22
17: ; preds = %2
%18 = load i32, i32* @errno
%19 = load i32, i32* @errno
%20 = call i32 @strerror(i32 %19)
%21 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([164 x i8], [164 x i8]* @.str.1, i64 0, i64 0), i32 21, i32 %18, i32 %20)
store i32 1, i32* %3
br label %122
22: ; preds = %2
%23 = call i64 @test_fork_id(i32 -1)
store i64 %23, i64* %6
%24 = load i64, i64* %6
%25 = icmp slt i64 %24, 0
br i1 %25, label %26, label %27
26: ; preds = %22
store i32 -1, i32* %3
br label %122
27: ; preds = %22
%28 = load i64, i64* %6
%29 = icmp eq i64 %28, 0
br i1 %29, label %30, label %46
30: ; preds = %27
%31 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 1
%32 = load i32, i32* %31
%33 = call i32 @close(i32 %32)
%34 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
%35 = load i32, i32* %34
%36 = call i32 @read(i32 %35, i8* %10, i32 1)
store i32 %36, i32* %8
%37 = load i32, i32* %8
%38 = icmp ne i32 %37, 1
br i1 %38, label %39, label %45
39: ; preds = %30
%40 = load i32, i32* %8
%41 = load i32, i32* @errno
%42 = load i32, i32* @errno
%43 = call i32 @strerror(i32 %42)
%44 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([164 x i8], [164 x i8]* @.str.1, i64 0, i64 0), i32 34, i32 %40, i32 %41, i32 %43)
store i32 1, i32* %3
br label %122
45: ; preds = %30
store i32 0, i32* %3
br label %122
46: ; preds = %27
br label %47
47: ; preds = %46
%48 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
%49 = load i32, i32* %48
%50 = call i32 @close(i32 %49)
%51 = load i64, i64* %6
%52 = load i32, i32* @SIGSTOP
%53 = call i32 @kill(i64 %51, i32 %52)
%54 = load i32, i32* @P_PID
%55 = load i64, i64* %6
%56 = load i32, i32* @WNOWAIT
%57 = load i32, i32* @WSTOPPED
%58 = or i32 %56, %57
%59 = call i64 @waitid(i32 %54, i64 %55, i32* null, i32 %58)
%60 = icmp slt i64 %59, 0
br i1 %60, label %61, label %66
61: ; preds = %47
%62 = load i32, i32* @errno
%63 = load i32, i32* @errno
%64 = call i32 @strerror(i32 %63)
%65 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([164 x i8], [164 x i8]* @.str.1, i64 0, i64 0), i32 44, i32 %62, i32 %64)
store i32 1, i32* %3
br label %122
66: ; preds = %47
%67 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 1
%68 = load i32, i32* %67
%69 = call i32 @write(i32 %68, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i32 1)
%70 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 1
%71 = load i32, i32* %70
%72 = call i32 @close(i32 %71)
%73 = call i32 (...) @test_daemon()
%74 = call i32 (...) @test_waitsig()
%75 = load i64, i64* %6
%76 = load i32, i32* @WUNTRACED
%77 = load i32, i32* @WCONTINUED
%78 = or i32 %76, %77
%79 = call i32 @waitpid(i64 %75, i32* %9, i32 %78)
%80 = icmp eq i32 %79, -1
br i1 %80, label %81, label %86
81: ; preds = %66
%82 = load i32, i32* @errno
%83 = load i32, i32* @errno
%84 = call i32 @strerror(i32 %83)
%85 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([164 x i8], [164 x i8]* @.str.1, i64 0, i64 0), i32 62, i32 %82, i32 %84)
br label %121
86: ; preds = %66
%87 = load i32, i32* %9
%88 = call i64 @WIFSTOPPED(i32 %87)
%89 = icmp ne i64 %88, 0
br i1 %89, label %90, label %92
90: ; preds = %86
%91 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0))
br label %97
92: ; preds = %86
%93 = load i32, i32* @errno
%94 = load i32, i32* @errno
%95 = call i32 @strerror(i32 %94)
%96 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([164 x i8], [164 x i8]* @.str.1, i64 0, i64 0), i32 69, i32 %93, i32 %95)
br label %121
97: ; preds = %90
%98 = load i64, i64* %6
%99 = load i32, i32* @SIGCONT
%100 = call i32 @kill(i64 %98, i32 %99)
%101 = load i64, i64* %6
%102 = call i32 @waitpid(i64 %101, i32* %9, i32 0)
%103 = icmp eq i32 %102, -1
br i1 %103, label %104, label %109
104: ; preds = %97
%105 = load i32, i32* @errno
%106 = load i32, i32* @errno
%107 = call i32 @strerror(i32 %106)
%108 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([164 x i8], [164 x i8]* @.str.1, i64 0, i64 0), i32 76, i32 %105, i32 %107)
br label %121
109: ; preds = %97
%110 = load i32, i32* %9
%111 = call i64 @WIFEXITED(i32 %110)
%112 = icmp ne i64 %111, 0
br i1 %112, label %113, label %115
113: ; preds = %109
%114 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
br label %120
115: ; preds = %109
%116 = load i32, i32* @errno
%117 = load i32, i32* @errno
%118 = call i32 @strerror(i32 %117)
%119 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([164 x i8], [164 x i8]* @.str.1, i64 0, i64 0), i32 83, i32 %116, i32 %118)
br label %120
120: ; preds = %115, %113
br label %121
121: ; preds = %120, %104, %92, %81
store i32 0, i32* %3
br label %122
122: ; preds = %121, %61, %45, %39, %26, %17
%123 = load i32, i32* %3
ret i32 %123
}

LLVM IR (-O2):
@.str = [53 x i8] c"ERR: %s:%d: Unable to create pipe (errno = %d (%s))\0A\00"
@.str.1 = [164 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/AuthenticEshkinKot/criu/refs/heads/master/test/zdtm/live/static/stopped.c\00"
@errno = global i32 0
@.str.2 = [50 x i8] c"ERR: %s:%d: Unable to read: %d (errno = %d (%s))\0A\00"
@SIGSTOP = global i32 0
@P_PID = global i32 0
@WNOWAIT = global i32 0
@WSTOPPED = global i32 0
@.str.3 = [38 x i8] c"ERR: %s:%d: waitid (errno = %d (%s))\0A\00"
@.str.4 = [2 x i8] c"0\00"
@WUNTRACED = global i32 0
@WCONTINUED = global i32 0
@.str.5 = [52 x i8] c"ERR: %s:%d: Unable to wait child (errno = %d (%s))\0A\00"
@.str.6 = [21 x i8] c"The procces stopped\0A\00"
@.str.7 = [60 x i8] c"FAIL: %s:%d: The process doesn't stopped (errno = %d (%s))\0A\00"
@SIGCONT = global i32 0
@.str.8 = [6 x i8] c"PASS\0A\00"
@.str.9 = [61 x i8] c"FAIL: %s:%d: The process doesn't continue (errno = %d (%s))\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca [2 x i32]
%4 = alloca i32
%5 = alloca i8
%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 i64 @pipe(i32* %9)
%11 = icmp eq i64 %10, 0
br i1 %11, label %16, label %12
12: ; preds = %2
%13 = load i32, i32* @errno
%14 = call i32 @strerror(i32 %13)
%15 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([164 x i8], [164 x i8]* @.str.1, i64 0, i64 0), i32 21, i32 %13, i32 %14)
br label %94
16: ; preds = %2
%17 = call i64 @test_fork_id(i32 -1)
%18 = icmp slt i64 %17, 0
br i1 %18, label %94, label %19
19: ; preds = %16
%20 = icmp eq i64 %17, 0
br i1 %20, label %21, label %34
21: ; preds = %19
%22 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 1
%23 = load i32, i32* %22
%24 = call i32 @close(i32 %23)
%25 = load i32, i32* %9
%26 = call i32 @read(i32 %25, i8* %5, i32 1)
%27 = icmp eq i32 %26, 1
br i1 %27, label %32, label %28
28: ; preds = %21
%29 = load i32, i32* @errno
%30 = call i32 @strerror(i32 %29)
%31 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([164 x i8], [164 x i8]* @.str.1, i64 0, i64 0), i32 34, i32 %26, i32 %29, i32 %30)
br label %32
32: ; preds = %21, %28
%33 = phi i32 [ 1, %28 ], [ 0, %21 ]
br label %94
34: ; preds = %19
%35 = load i32, i32* %9
%36 = call i32 @close(i32 %35)
%37 = load i32, i32* @SIGSTOP
%38 = call i32 @kill(i64 %17, i32 %37)
%39 = load i32, i32* @P_PID
%40 = load i32, i32* @WNOWAIT
%41 = load i32, i32* @WSTOPPED
%42 = or i32 %41, %40
%43 = call i64 @waitid(i32 %39, i64 %17, i32* null, i32 %42)
%44 = icmp slt i64 %43, 0
br i1 %44, label %45, label %49
45: ; preds = %34
%46 = load i32, i32* @errno
%47 = call i32 @strerror(i32 %46)
%48 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([164 x i8], [164 x i8]* @.str.1, i64 0, i64 0), i32 44, i32 %46, i32 %47)
br label %94
49: ; preds = %34
%50 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 1
%51 = load i32, i32* %50
%52 = call i32 @write(i32 %51, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i32 1)
%53 = load i32, i32* %50
%54 = call i32 @close(i32 %53)
%55 = call i32 (...) @test_daemon()
%56 = call i32 (...) @test_waitsig()
%57 = load i32, i32* @WUNTRACED
%58 = load i32, i32* @WCONTINUED
%59 = or i32 %58, %57
%60 = call i32 @waitpid(i64 %17, i32* %4, i32 %59)
%61 = icmp eq i32 %60, -1
br i1 %61, label %62, label %66
62: ; preds = %49
%63 = load i32, i32* @errno
%64 = call i32 @strerror(i32 %63)
%65 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([164 x i8], [164 x i8]* @.str.1, i64 0, i64 0), i32 62, i32 %63, i32 %64)
br label %94
66: ; preds = %49
%67 = load i32, i32* %4
%68 = call i64 @WIFSTOPPED(i32 %67)
%69 = icmp eq i64 %68, 0
br i1 %69, label %76, label %70
70: ; preds = %66
%71 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0))
%72 = load i32, i32* @SIGCONT
%73 = call i32 @kill(i64 %17, i32 %72)
%74 = call i32 @waitpid(i64 %17, i32* %4, i32 0)
%75 = icmp eq i32 %74, -1
br i1 %75, label %80, label %84
76: ; preds = %66
%77 = load i32, i32* @errno
%78 = call i32 @strerror(i32 %77)
%79 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([164 x i8], [164 x i8]* @.str.1, i64 0, i64 0), i32 69, i32 %77, i32 %78)
br label %94
80: ; preds = %70
%81 = load i32, i32* @errno
%82 = call i32 @strerror(i32 %81)
%83 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([164 x i8], [164 x i8]* @.str.1, i64 0, i64 0), i32 76, i32 %81, i32 %82)
br label %94
84: ; preds = %70
%85 = load i32, i32* %4
%86 = call i64 @WIFEXITED(i32 %85)
%87 = icmp eq i64 %86, 0
br i1 %87, label %90, label %88
88: ; preds = %84
%89 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
br label %94
90: ; preds = %84
%91 = load i32, i32* @errno
%92 = call i32 @strerror(i32 %91)
%93 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([164 x i8], [164 x i8]* @.str.1, i64 0, i64 0), i32 83, i32 %91, i32 %92)
br label %94
94: ; preds = %62, %76, %80, %90, %88, %16, %45, %32, %12
%95 = phi i32 [ 1, %12 ], [ %33, %32 ], [ 1, %45 ], [ -1, %16 ], [ 0, %88 ], [ 0, %90 ], [ 0, %80 ], [ 0, %76 ], [ 0, %62 ]
ret i32 %95
}