#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*/ SIGCONT;
int /*<<< orphan*/ SIGSTOP;
int WCONTINUED;
scalar_t__ WIFEXITED(int);
scalar_t__ WIFSTOPPED(int);
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();
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/LK4D4/criu/refs/heads/master/test/zdtm/"
             "live/static/stopped.c",
             19, 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/LK4D4/criu/refs/heads/master/"
               "test/zdtm/live/static/stopped.c",
               32, ret, errno, strerror(errno));
      return 1;
    }
    return 0;
  }
  close(p[0]);
  kill(pid, SIGSTOP);
  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/LK4D4/criu/refs/heads/master/test/zdtm/"
             "live/static/stopped.c",
             50, 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/LK4D4/criu/refs/heads/master/test/zdtm/"
             "live/static/stopped.c",
             57, 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/LK4D4/criu/refs/heads/master/test/zdtm/"
             "live/static/stopped.c",
             64, 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/LK4D4/criu/refs/heads/master/test/zdtm/"
             "live/static/stopped.c",
             71, 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     125b <main+0x7b>
mov    0x2db4(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x30(%rbp)
mov    0x2da8(%rip),%rax
mov    (%rax),%edi
call   1100 <strerror@plt>
mov    -0x30(%rbp),%ecx
mov    %eax,%r8d
lea    0xdc4(%rip),%rdi
lea    0xdf2(%rip),%rsi
mov    $0x13,%edx
mov    $0x0,%al
call   1080 <test_msg@plt>
movl   $0x1,-0x4(%rbp)
jmp    14f5 <main+0x315>
mov    $0xffffffff,%edi
call   10e0 <test_fork_id@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jge    1280 <main+0xa0>
movl   $0xffffffff,-0x4(%rbp)
jmp    14f5 <main+0x315>
cmpq   $0x0,-0x18(%rbp)
jne    130d <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     1301 <main+0x121>
mov    -0x24(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    0x2d12(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x34(%rbp)
mov    0x2d06(%rip),%rax
mov    (%rax),%edi
call   1100 <strerror@plt>
mov    -0x38(%rbp),%ecx
mov    -0x34(%rbp),%r8d
mov    %eax,%r9d
lea    0xdea(%rip),%rdi
lea    0xd4c(%rip),%rsi
mov    $0x20,%edx
mov    $0x0,%al
call   1080 <test_msg@plt>
movl   $0x1,-0x4(%rbp)
jmp    14f5 <main+0x315>
movl   $0x0,-0x4(%rbp)
jmp    14f5 <main+0x315>
jmp    1312 <main+0x132>
mov    -0x20(%rbp),%edi
call   1060 <close@plt>
mov    -0x18(%rbp),%rdi
mov    0x2ca3(%rip),%rax
mov    (%rax),%esi
call   10b0 <kill@plt>
mov    -0x1c(%rbp),%edi
lea    0xdc8(%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    0x2c77(%rip),%rax
mov    (%rax),%edx
mov    0x2c4e(%rip),%rax
or     (%rax),%edx
lea    -0x28(%rbp),%rsi
call   10d0 <waitpid@plt>
cmp    $0xffffffff,%eax
jne    13bd <main+0x1dd>
mov    0x2c4b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x3c(%rbp)
mov    0x2c3f(%rip),%rax
mov    (%rax),%edi
call   1100 <strerror@plt>
mov    -0x3c(%rbp),%ecx
mov    %eax,%r8d
lea    0xd5b(%rip),%rdi
lea    0xc89(%rip),%rsi
mov    $0x32,%edx
mov    $0x0,%al
call   1080 <test_msg@plt>
jmp    14ee <main+0x30e>
mov    -0x28(%rbp),%edi
call   10c0 <WIFSTOPPED@plt>
cmp    $0x0,%rax
je     13e2 <main+0x202>
lea    0xd5e(%rip),%rdi
mov    $0x0,%al
call   1080 <test_msg@plt>
jmp    1421 <main+0x241>
mov    0x2be7(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x40(%rbp)
mov    0x2bdb(%rip),%rax
mov    (%rax),%edi
call   1100 <strerror@plt>
mov    -0x40(%rbp),%ecx
mov    %eax,%r8d
lea    0xd40(%rip),%rdi
lea    0xc25(%rip),%rsi
mov    $0x39,%edx
mov    $0x0,%al
call   1080 <test_msg@plt>
jmp    14ee <main+0x30e>
mov    -0x18(%rbp),%rdi
mov    0x2bbc(%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    148a <main+0x2aa>
mov    0x2b7e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x44(%rbp)
mov    0x2b72(%rip),%rax
mov    (%rax),%edi
call   1100 <strerror@plt>
mov    -0x44(%rbp),%ecx
mov    %eax,%r8d
lea    0xc8e(%rip),%rdi
lea    0xbbc(%rip),%rsi
mov    $0x40,%edx
mov    $0x0,%al
call   1080 <test_msg@plt>
jmp    14ee <main+0x30e>
mov    -0x28(%rbp),%edi
call   10f0 <WIFEXITED@plt>
cmp    $0x0,%rax
je     14af <main+0x2cf>
lea    0xce2(%rip),%rdi
mov    $0x0,%al
call   1080 <test_msg@plt>
jmp    14e9 <main+0x309>
mov    0x2b1a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x48(%rbp)
mov    0x2b0e(%rip),%rax
mov    (%rax),%edi
call   1100 <strerror@plt>
mov    -0x48(%rbp),%ecx
mov    %eax,%r8d
lea    0xcb5(%rip),%rdi
lea    0xb58(%rip),%rsi
mov    $0x47,%edx
mov    $0x0,%al
call   1080 <test_msg@plt>
jmp    14ee <main+0x30e>
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     123b <main+0x5b>
mov    0x2dcd(%rip),%rax
mov    (%rax),%ebx
mov    %ebx,%edi
call   1100 <strerror@plt>
lea    0xded(%rip),%rdi
lea    0xe1b(%rip),%rsi
mov    $0x13,%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     1230 <main+0x50>
je     1334 <main+0x154>
mov    %rax,%r14
mov    0x8(%rsp),%edi
call   1060 <close@plt>
mov    0x2d60(%rip),%rax
mov    (%rax),%esi
mov    %r14,%rdi
call   10b0 <kill@plt>
mov    0xc(%rsp),%edi
lea    0xe81(%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    0x2d31(%rip),%rax
mov    0x2d0a(%rip),%rcx
mov    (%rcx),%edx
or     (%rax),%edx
mov    %rsp,%rsi
mov    %r14,%rdi
call   10d0 <waitpid@plt>
cmp    $0xffffffff,%eax
je     1394 <main+0x1b4>
mov    (%rsp),%edi
call   10c0 <WIFSTOPPED@plt>
test   %rax,%rax
je     13b9 <main+0x1d9>
lea    0xe56(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1080 <test_msg@plt>
mov    0x2cfa(%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     13e0 <main+0x200>
mov    (%rsp),%edi
call   10f0 <WIFEXITED@plt>
test   %rax,%rax
je     1405 <main+0x225>
lea    0xe5f(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1080 <test_msg@plt>
jmp    1230 <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     1230 <main+0x50>
mov    %eax,%ebp
mov    0x2c6c(%rip),%rax
mov    (%rax),%ebx
mov    %ebx,%edi
call   1100 <strerror@plt>
lea    0xd58(%rip),%rdi
lea    0xcba(%rip),%rsi
mov    $0x20,%edx
mov    %ebp,%ecx
mov    %ebx,%r8d
mov    %eax,%r9d
xor    %eax,%eax
call   1080 <test_msg@plt>
jmp    122b <main+0x4b>
mov    0x2c35(%rip),%rax
mov    (%rax),%ebp
mov    %ebp,%edi
call   1100 <strerror@plt>
lea    0xd55(%rip),%rdi
lea    0xc83(%rip),%rsi
mov    $0x32,%edx
jmp    142a <main+0x24a>
mov    0x2c10(%rip),%rax
mov    (%rax),%ebp
mov    %ebp,%edi
call   1100 <strerror@plt>
lea    0xd79(%rip),%rdi
lea    0xc5e(%rip),%rsi
xor    %ebx,%ebx
mov    $0x39,%edx
jmp    142a <main+0x24a>
mov    0x2be9(%rip),%rax
mov    (%rax),%ebp
mov    %ebp,%edi
call   1100 <strerror@plt>
lea    0xd09(%rip),%rdi
lea    0xc37(%rip),%rsi
mov    $0x40,%edx
jmp    142a <main+0x24a>
mov    0x2bc4(%rip),%rax
mov    (%rax),%ebp
mov    %ebp,%edi
call   1100 <strerror@plt>
lea    0xd6f(%rip),%rdi
lea    0xc12(%rip),%rsi
xor    %ebx,%ebx
mov    $0x47,%edx
mov    %ebp,%ecx
mov    %eax,%r8d
xor    %eax,%eax
call   1080 <test_msg@plt>
jmp    1230 <main+0x50>

LLVM IR (-O0):
@.str = [53 x i8] c"ERR: %s:%d: Unable to create pipe (errno = %d (%s))\0A\00"
@.str.1 = [151 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/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
@.str.3 = [2 x i8] c"0\00"
@WUNTRACED = global i32 0
@WCONTINUED = global i32 0
@.str.4 = [52 x i8] c"ERR: %s:%d: Unable to wait child (errno = %d (%s))\0A\00"
@.str.5 = [21 x i8] c"The procces stopped\0A\00"
@.str.6 = [60 x i8] c"FAIL: %s:%d: The process doesn't stopped (errno = %d (%s))\0A\00"
@SIGCONT = global i32 0
@.str.7 = [6 x i8] c"PASS\0A\00"
@.str.8 = [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 ([151 x i8], [151 x i8]* @.str.1, i64 0, i64 0), i32 19, i32 %18, i32 %20)
store i32 1, i32* %3
br label %109
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 %109
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 ([151 x i8], [151 x i8]* @.str.1, i64 0, i64 0), i32 32, i32 %40, i32 %41, i32 %43)
store i32 1, i32* %3
br label %109
45: ; preds = %30
store i32 0, i32* %3
br label %109
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 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 1
%55 = load i32, i32* %54
%56 = call i32 @write(i32 %55, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i32 1)
%57 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 1
%58 = load i32, i32* %57
%59 = call i32 @close(i32 %58)
%60 = call i32 (...) @test_daemon()
%61 = call i32 (...) @test_waitsig()
%62 = load i64, i64* %6
%63 = load i32, i32* @WUNTRACED
%64 = load i32, i32* @WCONTINUED
%65 = or i32 %63, %64
%66 = call i32 @waitpid(i64 %62, i32* %9, i32 %65)
%67 = icmp eq i32 %66, -1
br i1 %67, label %68, label %73
68: ; preds = %47
%69 = load i32, i32* @errno
%70 = load i32, i32* @errno
%71 = call i32 @strerror(i32 %70)
%72 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([151 x i8], [151 x i8]* @.str.1, i64 0, i64 0), i32 50, i32 %69, i32 %71)
br label %108
73: ; preds = %47
%74 = load i32, i32* %9
%75 = call i64 @WIFSTOPPED(i32 %74)
%76 = icmp ne i64 %75, 0
br i1 %76, label %77, label %79
77: ; preds = %73
%78 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0))
br label %84
79: ; preds = %73
%80 = load i32, i32* @errno
%81 = load i32, i32* @errno
%82 = call i32 @strerror(i32 %81)
%83 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([151 x i8], [151 x i8]* @.str.1, i64 0, i64 0), i32 57, i32 %80, i32 %82)
br label %108
84: ; preds = %77
%85 = load i64, i64* %6
%86 = load i32, i32* @SIGCONT
%87 = call i32 @kill(i64 %85, i32 %86)
%88 = load i64, i64* %6
%89 = call i32 @waitpid(i64 %88, i32* %9, i32 0)
%90 = icmp eq i32 %89, -1
br i1 %90, label %91, label %96
91: ; preds = %84
%92 = load i32, i32* @errno
%93 = load i32, i32* @errno
%94 = call i32 @strerror(i32 %93)
%95 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([151 x i8], [151 x i8]* @.str.1, i64 0, i64 0), i32 64, i32 %92, i32 %94)
br label %108
96: ; preds = %84
%97 = load i32, i32* %9
%98 = call i64 @WIFEXITED(i32 %97)
%99 = icmp ne i64 %98, 0
br i1 %99, label %100, label %102
100: ; preds = %96
%101 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
br label %107
102: ; preds = %96
%103 = load i32, i32* @errno
%104 = load i32, i32* @errno
%105 = call i32 @strerror(i32 %104)
%106 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([151 x i8], [151 x i8]* @.str.1, i64 0, i64 0), i32 71, i32 %103, i32 %105)
br label %107
107: ; preds = %102, %100
br label %108
108: ; preds = %107, %91, %79, %68
store i32 0, i32* %3
br label %109
109: ; preds = %108, %45, %39, %26, %17
%110 = load i32, i32* %3
ret i32 %110
}

LLVM IR (-O2):
@.str = [53 x i8] c"ERR: %s:%d: Unable to create pipe (errno = %d (%s))\0A\00"
@.str.1 = [151 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/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
@.str.3 = [2 x i8] c"0\00"
@WUNTRACED = global i32 0
@WCONTINUED = global i32 0
@.str.4 = [52 x i8] c"ERR: %s:%d: Unable to wait child (errno = %d (%s))\0A\00"
@.str.5 = [21 x i8] c"The procces stopped\0A\00"
@.str.6 = [60 x i8] c"FAIL: %s:%d: The process doesn't stopped (errno = %d (%s))\0A\00"
@SIGCONT = global i32 0
@.str.7 = [6 x i8] c"PASS\0A\00"
@.str.8 = [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 ([151 x i8], [151 x i8]* @.str.1, i64 0, i64 0), i32 19, i32 %13, i32 %14)
br label %83
16: ; preds = %2
%17 = call i64 @test_fork_id(i32 -1)
%18 = icmp slt i64 %17, 0
br i1 %18, label %83, 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 ([151 x i8], [151 x i8]* @.str.1, i64 0, i64 0), i32 32, i32 %26, i32 %29, i32 %30)
br label %32
32: ; preds = %21, %28
%33 = phi i32 [ 1, %28 ], [ 0, %21 ]
br label %83
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 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 1
%40 = load i32, i32* %39
%41 = call i32 @write(i32 %40, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i32 1)
%42 = load i32, i32* %39
%43 = call i32 @close(i32 %42)
%44 = call i32 (...) @test_daemon()
%45 = call i32 (...) @test_waitsig()
%46 = load i32, i32* @WUNTRACED
%47 = load i32, i32* @WCONTINUED
%48 = or i32 %47, %46
%49 = call i32 @waitpid(i64 %17, i32* %4, i32 %48)
%50 = icmp eq i32 %49, -1
br i1 %50, label %51, label %55
51: ; preds = %34
%52 = load i32, i32* @errno
%53 = call i32 @strerror(i32 %52)
%54 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([151 x i8], [151 x i8]* @.str.1, i64 0, i64 0), i32 50, i32 %52, i32 %53)
br label %83
55: ; preds = %34
%56 = load i32, i32* %4
%57 = call i64 @WIFSTOPPED(i32 %56)
%58 = icmp eq i64 %57, 0
br i1 %58, label %65, label %59
59: ; preds = %55
%60 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0))
%61 = load i32, i32* @SIGCONT
%62 = call i32 @kill(i64 %17, i32 %61)
%63 = call i32 @waitpid(i64 %17, i32* %4, i32 0)
%64 = icmp eq i32 %63, -1
br i1 %64, label %69, label %73
65: ; preds = %55
%66 = load i32, i32* @errno
%67 = call i32 @strerror(i32 %66)
%68 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([151 x i8], [151 x i8]* @.str.1, i64 0, i64 0), i32 57, i32 %66, i32 %67)
br label %83
69: ; preds = %59
%70 = load i32, i32* @errno
%71 = call i32 @strerror(i32 %70)
%72 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([151 x i8], [151 x i8]* @.str.1, i64 0, i64 0), i32 64, i32 %70, i32 %71)
br label %83
73: ; preds = %59
%74 = load i32, i32* %4
%75 = call i64 @WIFEXITED(i32 %74)
%76 = icmp eq i64 %75, 0
br i1 %76, label %79, label %77
77: ; preds = %73
%78 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
br label %83
79: ; preds = %73
%80 = load i32, i32* @errno
%81 = call i32 @strerror(i32 %80)
%82 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([151 x i8], [151 x i8]* @.str.1, i64 0, i64 0), i32 71, i32 %80, i32 %81)
br label %83
83: ; preds = %51, %65, %69, %79, %77, %16, %32, %12
%84 = phi i32 [ 1, %12 ], [ %33, %32 ], [ -1, %16 ], [ 0, %77 ], [ 0, %79 ], [ 0, %69 ], [ 0, %65 ], [ 0, %51 ]
ret i32 %84
}