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

/* Variables and functions */
int /*<<< orphan*/ PF_UNIX;
int /*<<< orphan*/ SOCK_DGRAM;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ dup2(int, int);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ exit(int);
scalar_t__ pipe(int *);
int read(int, char *, int);
int recv_fd(int);
scalar_t__ send_fd(int, int);
scalar_t__ socketpair(int /*<<< orphan*/, int /*<<< orphan*/,
                      int /*<<< orphan*/, int *);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strerror(int /*<<< orphan*/);
int /*<<< orphan*/ test_daemon();
int /*<<< orphan*/ test_init(int, char **);
int /*<<< orphan*/ test_msg(char *, ...);
int /*<<< orphan*/ test_waitsig();
int write(int, char *, int);
int main(int argc, char **argv) {
  int sk[2], p[2];
  char buf[8];
  test_init(argc, argv);
  if (socketpair(PF_UNIX, SOCK_DGRAM, 0, sk) < 0) {
    test_msg("ERR: %s:%d: "
             "Can't make unix pair"
             " (errno = %d (%s))\n",
             "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
             "2022-01-22/02-19-57/repos/eabatalov/criu/refs/heads/master/test/"
             "zdtm/static/scm00.c",
             78, errno, strerror(errno));
    exit(1);
  }
  if (pipe(p) < 0) {
    test_msg("ERR: %s:%d: "
             "Can't make pipe"
             " (errno = %d (%s))\n",
             "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
             "2022-01-22/02-19-57/repos/eabatalov/criu/refs/heads/master/test/"
             "zdtm/static/scm00.c",
             83, errno, strerror(errno));
    exit(1);
  }
  if (send_fd(sk[0], p[0]) < 0) {
    test_msg("ERR: %s:%d: "
             "Can't send descriptor"
             " (errno = %d (%s))\n",
             "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
             "2022-01-22/02-19-57/repos/eabatalov/criu/refs/heads/master/test/"
             "zdtm/static/scm00.c",
             88, errno, strerror(errno));
    exit(1);
  }
  close(p[0]);
  dup2(p[1], p[0]);
  close(p[1]);
  p[1] = p[0];
  p[0] = -1;
  test_daemon();
  test_waitsig();
  p[0] = recv_fd(sk[1]);
  if (p[0] < 0) {
    test_msg("FAIL: %s:%d: "
             "Can't recv pipe back (%d)"
             " (errno = %d (%s))\n",
             "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
             "2022-01-22/02-19-57/repos/eabatalov/criu/refs/heads/master/test/"
             "zdtm/static/scm00.c",
             105, p[0], errno, strerror(errno));
    goto out;
  }
  if (write(p[1], "HELLO", sizeof("HELLO")) != sizeof("HELLO")) {
    test_msg("FAIL: %s:%d: "
             "Pipe write-broken"
             " (errno = %d (%s))\n",
             "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
             "2022-01-22/02-19-57/repos/eabatalov/criu/refs/heads/master/test/"
             "zdtm/static/scm00.c",
             110, errno, strerror(errno));
    goto out;
  }
  if (read(p[0], buf, sizeof(buf)) != sizeof("HELLO")) {
    test_msg("FAIL: %s:%d: "
             "Pipe read-broken"
             " (errno = %d (%s))\n",
             "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
             "2022-01-22/02-19-57/repos/eabatalov/criu/refs/heads/master/test/"
             "zdtm/static/scm00.c",
             115, errno, strerror(errno));
    goto out;
  }
  if (strcmp(buf, "HELLO")) {
    buf[sizeof(buf) - 1] = '\0';
    test_msg("FAIL: %s:%d: "
             "Pipe read-broken (%s)"
             " (errno = %d (%s))\n",
             "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
             "2022-01-22/02-19-57/repos/eabatalov/criu/refs/heads/master/test/"
             "zdtm/static/scm00.c",
             121, buf, errno, strerror(errno));
    goto out;
  }
  test_msg("PASS\n");
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>
mov    0x2ddf(%rip),%rax
mov    (%rax),%edi
mov    0x2dbe(%rip),%rax
mov    (%rax),%esi
lea    -0x18(%rbp),%rcx
xor    %edx,%edx
call   10e0 <socketpair@plt>
cmp    $0x0,%rax
jge    127d <main+0x8d>
mov    0x2d90(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x2c(%rbp)
mov    0x2d84(%rip),%rax
mov    (%rax),%edi
call   1110 <strerror@plt>
mov    -0x2c(%rbp),%ecx
mov    %eax,%r8d
lea    0xda0(%rip),%rdi
lea    0xdcd(%rip),%rsi
mov    $0x4e,%edx
mov    $0x0,%al
call   10a0 <test_msg@plt>
mov    $0x1,%edi
call   1100 <exit@plt>
lea    -0x20(%rbp),%rdi
call   1090 <pipe@plt>
cmp    $0x0,%rax
jge    12d4 <main+0xe4>
mov    0x2d39(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x30(%rbp)
mov    0x2d2d(%rip),%rax
mov    (%rax),%edi
call   1110 <strerror@plt>
mov    -0x30(%rbp),%ecx
mov    %eax,%r8d
lea    0xe11(%rip),%rdi
lea    0xd76(%rip),%rsi
mov    $0x53,%edx
mov    $0x0,%al
call   10a0 <test_msg@plt>
mov    $0x1,%edi
call   1100 <exit@plt>
mov    -0x18(%rbp),%edi
mov    -0x20(%rbp),%esi
call   1060 <send_fd@plt>
cmp    $0x0,%rax
jge    132d <main+0x13d>
mov    0x2ce0(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x34(%rbp)
mov    0x2cd4(%rip),%rax
mov    (%rax),%edi
call   1110 <strerror@plt>
mov    -0x34(%rbp),%ecx
mov    %eax,%r8d
lea    0xde7(%rip),%rdi
lea    0xd1d(%rip),%rsi
mov    $0x58,%edx
mov    $0x0,%al
call   10a0 <test_msg@plt>
mov    $0x1,%edi
call   1100 <exit@plt>
mov    -0x20(%rbp),%edi
call   1080 <close@plt>
mov    -0x1c(%rbp),%edi
mov    -0x20(%rbp),%esi
call   1050 <dup2@plt>
mov    -0x1c(%rbp),%edi
call   1080 <close@plt>
mov    -0x20(%rbp),%eax
mov    %eax,-0x1c(%rbp)
movl   $0xffffffff,-0x20(%rbp)
mov    $0x0,%al
call   1070 <test_daemon@plt>
mov    $0x0,%al
call   10c0 <test_waitsig@plt>
mov    -0x14(%rbp),%edi
call   10f0 <recv_fd@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
jge    13c1 <main+0x1d1>
mov    -0x20(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    0x2c4b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x38(%rbp)
mov    0x2c3f(%rip),%rax
mov    (%rax),%edi
call   1110 <strerror@plt>
mov    -0x3c(%rbp),%ecx
mov    -0x38(%rbp),%r8d
mov    %eax,%r9d
lea    0xd83(%rip),%rdi
lea    0xc84(%rip),%rsi
mov    $0x69,%edx
mov    $0x0,%al
call   10a0 <test_msg@plt>
jmp    14f4 <main+0x304>
mov    -0x1c(%rbp),%edi
lea    0xd9b(%rip),%rsi
mov    $0x6,%edx
call   1040 <write@plt>
cltq
cmp    $0x6,%rax
je     1420 <main+0x230>
mov    0x2be8(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x40(%rbp)
mov    0x2bdc(%rip),%rax
mov    (%rax),%edi
call   1110 <strerror@plt>
mov    -0x40(%rbp),%ecx
mov    %eax,%r8d
lea    0xd64(%rip),%rdi
lea    0xc25(%rip),%rsi
mov    $0x6e,%edx
mov    $0x0,%al
call   10a0 <test_msg@plt>
jmp    14f4 <main+0x304>
mov    -0x20(%rbp),%edi
lea    -0x28(%rbp),%rsi
mov    $0x8,%edx
call   10b0 <read@plt>
cltq
cmp    $0x6,%rax
je     147c <main+0x28c>
mov    0x2b8c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x44(%rbp)
mov    0x2b80(%rip),%rax
mov    (%rax),%edi
call   1110 <strerror@plt>
mov    -0x44(%rbp),%ecx
mov    %eax,%r8d
lea    0xd3a(%rip),%rdi
lea    0xbc9(%rip),%rsi
mov    $0x73,%edx
mov    $0x0,%al
call   10a0 <test_msg@plt>
jmp    14f4 <main+0x304>
lea    -0x28(%rbp),%rdi
lea    0xcdf(%rip),%rsi
call   10d0 <strcmp@plt>
cmp    $0x0,%rax
je     14e6 <main+0x2f6>
movb   $0x0,-0x21(%rbp)
lea    -0x28(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    0x2b27(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x48(%rbp)
mov    0x2b1b(%rip),%rax
mov    (%rax),%edi
call   1110 <strerror@plt>
mov    -0x50(%rbp),%rcx
mov    -0x48(%rbp),%r8d
mov    %eax,%r9d
lea    0xd01(%rip),%rdi
lea    0xb5f(%rip),%rsi
mov    $0x79,%edx
mov    $0x0,%al
call   10a0 <test_msg@plt>
jmp    14f4 <main+0x304>
lea    0xd18(%rip),%rdi
mov    $0x0,%al
call   10a0 <test_msg@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
call   1030 <test_init@plt>
mov    0x2df6(%rip),%rax
mov    (%rax),%edi
mov    0x2dd5(%rip),%rax
mov    (%rax),%esi
lea    0x10(%rsp),%rcx
xor    %edx,%edx
call   10e0 <socketpair@plt>
test   %rax,%rax
js     13ca <main+0x1da>
mov    %rsp,%rdi
call   1090 <pipe@plt>
test   %rax,%rax
js     13ef <main+0x1ff>
mov    0x10(%rsp),%edi
mov    (%rsp),%esi
call   1060 <send_fd@plt>
test   %rax,%rax
js     1414 <main+0x224>
mov    (%rsp),%edi
call   1080 <close@plt>
mov    (%rsp),%esi
mov    0x4(%rsp),%edi
call   1050 <dup2@plt>
mov    0x4(%rsp),%edi
call   1080 <close@plt>
mov    (%rsp),%eax
mov    %eax,0x4(%rsp)
movl   $0xffffffff,(%rsp)
xor    %eax,%eax
call   1070 <test_daemon@plt>
xor    %eax,%eax
call   10c0 <test_waitsig@plt>
mov    0x14(%rsp),%edi
call   10f0 <recv_fd@plt>
mov    %eax,(%rsp)
test   %eax,%eax
js     1327 <main+0x137>
mov    0x4(%rsp),%edi
lea    0xec6(%rip),%rsi
mov    $0x6,%edx
call   1040 <write@plt>
cmp    $0x6,%eax
jne    135d <main+0x16d>
mov    (%rsp),%edi
lea    0x8(%rsp),%rsi
mov    $0x8,%edx
call   10b0 <read@plt>
cmp    $0x6,%eax
jne    1382 <main+0x192>
lea    0xe91(%rip),%rsi
lea    0x8(%rsp),%rdi
call   10d0 <strcmp@plt>
test   %rax,%rax
je     13ba <main+0x1ca>
movb   $0x0,0xf(%rsp)
mov    0x2cdc(%rip),%rax
mov    (%rax),%ebx
mov    %ebx,%edi
call   1110 <strerror@plt>
lea    0xecb(%rip),%rdi
lea    0xd29(%rip),%rsi
lea    0x8(%rsp),%rcx
mov    $0x79,%edx
mov    %ebx,%r8d
mov    %eax,%r9d
xor    %eax,%eax
call   10a0 <test_msg@plt>
jmp    13b1 <main+0x1c1>
mov    %eax,%ebx
mov    0x2ca0(%rip),%rax
mov    (%rax),%ebp
mov    %ebp,%edi
call   1110 <strerror@plt>
lea    0xdec(%rip),%rdi
lea    0xced(%rip),%rsi
mov    $0x69,%edx
mov    %ebx,%ecx
mov    %ebp,%r8d
mov    %eax,%r9d
xor    %eax,%eax
call   10a0 <test_msg@plt>
jmp    13b1 <main+0x1c1>
mov    0x2c6c(%rip),%rax
mov    (%rax),%ebx
mov    %ebx,%edi
call   1110 <strerror@plt>
lea    0xdf8(%rip),%rdi
lea    0xcb9(%rip),%rsi
mov    $0x6e,%edx
jmp    13a5 <main+0x1b5>
mov    0x2c47(%rip),%rax
mov    (%rax),%ebx
mov    %ebx,%edi
call   1110 <strerror@plt>
lea    0xe05(%rip),%rdi
lea    0xc94(%rip),%rsi
mov    $0x73,%edx
mov    %ebx,%ecx
mov    %eax,%r8d
xor    %eax,%eax
call   10a0 <test_msg@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret
lea    0xe44(%rip),%rdi
xor    %eax,%eax
call   10a0 <test_msg@plt>
jmp    13b1 <main+0x1c1>
mov    0x2bff(%rip),%rax
mov    (%rax),%ebx
mov    %ebx,%edi
call   1110 <strerror@plt>
lea    0xc1f(%rip),%rdi
lea    0xc4c(%rip),%rsi
mov    $0x4e,%edx
jmp    1437 <main+0x247>
mov    0x2bda(%rip),%rax
mov    (%rax),%ebx
mov    %ebx,%edi
call   1110 <strerror@plt>
lea    0xcc2(%rip),%rdi
lea    0xc27(%rip),%rsi
mov    $0x53,%edx
jmp    1437 <main+0x247>
mov    0x2bb5(%rip),%rax
mov    (%rax),%ebx
mov    %ebx,%edi
call   1110 <strerror@plt>
lea    0xccc(%rip),%rdi
lea    0xc02(%rip),%rsi
mov    $0x58,%edx
mov    %ebx,%ecx
mov    %eax,%r8d
xor    %eax,%eax
call   10a0 <test_msg@plt>
mov    $0x1,%edi
call   1100 <exit@plt>

LLVM IR (-O0):
@PF_UNIX = global i32 0
@SOCK_DGRAM = global i32 0
@.str = [52 x i8] c"ERR: %s:%d: Can't make unix pair (errno = %d (%s))\0A\00"
@.str.1 = [148 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/eabatalov/criu/refs/heads/master/test/zdtm/static/scm00.c\00"
@errno = global i32 0
@.str.2 = [47 x i8] c"ERR: %s:%d: Can't make pipe (errno = %d (%s))\0A\00"
@.str.3 = [53 x i8] c"ERR: %s:%d: Can't send descriptor (errno = %d (%s))\0A\00"
@.str.4 = [58 x i8] c"FAIL: %s:%d: Can't recv pipe back (%d) (errno = %d (%s))\0A\00"
@.str.5 = [6 x i8] c"HELLO\00"
@.str.6 = [50 x i8] c"FAIL: %s:%d: Pipe write-broken (errno = %d (%s))\0A\00"
@.str.7 = [49 x i8] c"FAIL: %s:%d: Pipe read-broken (errno = %d (%s))\0A\00"
@.str.8 = [54 x i8] c"FAIL: %s:%d: Pipe read-broken (%s) (errno = %d (%s))\0A\00"
@.str.9 = [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 [2 x i32]
%8 = alloca [8 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %4
%10 = load i8**, i8*** %5
%11 = call i32 @test_init(i32 %9, i8** %10)
%12 = load i32, i32* @PF_UNIX
%13 = load i32, i32* @SOCK_DGRAM
%14 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
%15 = call i64 @socketpair(i32 %12, i32 %13, i32 0, i32* %14)
%16 = icmp slt i64 %15, 0
br i1 %16, label %17, label %23
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 ([52 x i8], [52 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([148 x i8], [148 x i8]* @.str.1, i64 0, i64 0), i32 78, i32 %18, i32 %20)
%22 = call i32 @exit(i32 1)
unreachable
23: ; preds = %2
%24 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
%25 = call i64 @pipe(i32* %24)
%26 = icmp slt i64 %25, 0
br i1 %26, label %27, label %33
27: ; preds = %23
%28 = load i32, i32* @errno
%29 = load i32, i32* @errno
%30 = call i32 @strerror(i32 %29)
%31 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([148 x i8], [148 x i8]* @.str.1, i64 0, i64 0), i32 83, i32 %28, i32 %30)
%32 = call i32 @exit(i32 1)
unreachable
33: ; preds = %23
%34 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
%35 = load i32, i32* %34
%36 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
%37 = load i32, i32* %36
%38 = call i64 @send_fd(i32 %35, i32 %37)
%39 = icmp slt i64 %38, 0
br i1 %39, label %40, label %46
40: ; preds = %33
%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 ([53 x i8], [53 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([148 x i8], [148 x i8]* @.str.1, i64 0, i64 0), i32 88, i32 %41, i32 %43)
%45 = call i32 @exit(i32 1)
unreachable
46: ; preds = %33
%47 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
%48 = load i32, i32* %47
%49 = call i32 @close(i32 %48)
%50 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 1
%51 = load i32, i32* %50
%52 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
%53 = load i32, i32* %52
%54 = call i32 @dup2(i32 %51, i32 %53)
%55 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 1
%56 = load i32, i32* %55
%57 = call i32 @close(i32 %56)
%58 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
%59 = load i32, i32* %58
%60 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 1
store i32 %59, i32* %60
%61 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
store i32 -1, i32* %61
%62 = call i32 (...) @test_daemon()
%63 = call i32 (...) @test_waitsig()
%64 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 1
%65 = load i32, i32* %64
%66 = call i32 @recv_fd(i32 %65)
%67 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
store i32 %66, i32* %67
%68 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
%69 = load i32, i32* %68
%70 = icmp slt i32 %69, 0
br i1 %70, label %71, label %78
71: ; preds = %46
%72 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
%73 = load i32, i32* %72
%74 = load i32, i32* @errno
%75 = load i32, i32* @errno
%76 = call i32 @strerror(i32 %75)
%77 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([148 x i8], [148 x i8]* @.str.1, i64 0, i64 0), i32 105, i32 %73, i32 %74, i32 %76)
br label %114
78: ; preds = %46
%79 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 1
%80 = load i32, i32* %79
%81 = call i32 @write(i32 %80, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 6)
%82 = sext i32 %81 to i64
%83 = icmp ne i64 %82, 6
br i1 %83, label %84, label %89
84: ; preds = %78
%85 = load i32, i32* @errno
%86 = load i32, i32* @errno
%87 = call i32 @strerror(i32 %86)
%88 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([148 x i8], [148 x i8]* @.str.1, i64 0, i64 0), i32 110, i32 %85, i32 %87)
br label %114
89: ; preds = %78
%90 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
%91 = load i32, i32* %90
%92 = getelementptr inbounds [8 x i8], [8 x i8]* %8, i64 0, i64 0
%93 = call i32 @read(i32 %91, i8* %92, i32 8)
%94 = sext i32 %93 to i64
%95 = icmp ne i64 %94, 6
br i1 %95, label %96, label %101
96: ; preds = %89
%97 = load i32, i32* @errno
%98 = load i32, i32* @errno
%99 = call i32 @strerror(i32 %98)
%100 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([148 x i8], [148 x i8]* @.str.1, i64 0, i64 0), i32 115, i32 %97, i32 %99)
br label %114
101: ; preds = %89
%102 = getelementptr inbounds [8 x i8], [8 x i8]* %8, i64 0, i64 0
%103 = call i64 @strcmp(i8* %102, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%104 = icmp ne i64 %103, 0
br i1 %104, label %105, label %112
105: ; preds = %101
%106 = getelementptr inbounds [8 x i8], [8 x i8]* %8, i64 0, i64 7
store i8 0, i8* %106
%107 = getelementptr inbounds [8 x i8], [8 x i8]* %8, i64 0, i64 0
%108 = load i32, i32* @errno
%109 = load i32, i32* @errno
%110 = call i32 @strerror(i32 %109)
%111 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([148 x i8], [148 x i8]* @.str.1, i64 0, i64 0), i32 121, i8* %107, i32 %108, i32 %110)
br label %114
112: ; preds = %101
%113 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0))
br label %114
114: ; preds = %112, %105, %96, %84, %71
ret i32 0
}

LLVM IR (-O2):
@PF_UNIX = global i32 0
@SOCK_DGRAM = global i32 0
@.str = [52 x i8] c"ERR: %s:%d: Can't make unix pair (errno = %d (%s))\0A\00"
@.str.1 = [148 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/eabatalov/criu/refs/heads/master/test/zdtm/static/scm00.c\00"
@errno = global i32 0
@.str.2 = [47 x i8] c"ERR: %s:%d: Can't make pipe (errno = %d (%s))\0A\00"
@.str.3 = [53 x i8] c"ERR: %s:%d: Can't send descriptor (errno = %d (%s))\0A\00"
@.str.4 = [58 x i8] c"FAIL: %s:%d: Can't recv pipe back (%d) (errno = %d (%s))\0A\00"
@.str.5 = [6 x i8] c"HELLO\00"
@.str.6 = [50 x i8] c"FAIL: %s:%d: Pipe write-broken (errno = %d (%s))\0A\00"
@.str.7 = [49 x i8] c"FAIL: %s:%d: Pipe read-broken (errno = %d (%s))\0A\00"
@.str.8 = [54 x i8] c"FAIL: %s:%d: Pipe read-broken (%s) (errno = %d (%s))\0A\00"
@.str.9 = [6 x i8] c"PASS\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca [2 x i32]
%4 = alloca [2 x i32]
%5 = alloca [8 x i8]
%6 = bitcast [2 x i32]* %3 to i8*
%7 = bitcast [2 x i32]* %4 to i8*
%8 = getelementptr inbounds [8 x i8], [8 x i8]* %5, i64 0, i64 0
%9 = tail call i32 @test_init(i32 %0, i8** %1)
%10 = load i32, i32* @PF_UNIX
%11 = load i32, i32* @SOCK_DGRAM
%12 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
%13 = call i64 @socketpair(i32 %10, i32 %11, i32 0, i32* %12)
%14 = icmp slt i64 %13, 0
br i1 %14, label %15, label %20
15: ; preds = %2
%16 = load i32, i32* @errno
%17 = call i32 @strerror(i32 %16)
%18 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([148 x i8], [148 x i8]* @.str.1, i64 0, i64 0), i32 78, i32 %16, i32 %17)
%19 = call i32 @exit(i32 1)
unreachable
20: ; preds = %2
%21 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 0
%22 = call i64 @pipe(i32* %21)
%23 = icmp slt i64 %22, 0
br i1 %23, label %24, label %29
24: ; preds = %20
%25 = load i32, i32* @errno
%26 = call i32 @strerror(i32 %25)
%27 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([148 x i8], [148 x i8]* @.str.1, i64 0, i64 0), i32 83, i32 %25, i32 %26)
%28 = call i32 @exit(i32 1)
unreachable
29: ; preds = %20
%30 = load i32, i32* %12
%31 = load i32, i32* %21
%32 = call i64 @send_fd(i32 %30, i32 %31)
%33 = icmp slt i64 %32, 0
br i1 %33, label %34, label %39
34: ; preds = %29
%35 = load i32, i32* @errno
%36 = call i32 @strerror(i32 %35)
%37 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([148 x i8], [148 x i8]* @.str.1, i64 0, i64 0), i32 88, i32 %35, i32 %36)
%38 = call i32 @exit(i32 1)
unreachable
39: ; preds = %29
%40 = load i32, i32* %21
%41 = call i32 @close(i32 %40)
%42 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 1
%43 = load i32, i32* %42
%44 = load i32, i32* %21
%45 = call i32 @dup2(i32 %43, i32 %44)
%46 = load i32, i32* %42
%47 = call i32 @close(i32 %46)
%48 = load i32, i32* %21
store i32 %48, i32* %42
store i32 -1, i32* %21
%49 = call i32 (...) @test_daemon()
%50 = call i32 (...) @test_waitsig()
%51 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 1
%52 = load i32, i32* %51
%53 = call i32 @recv_fd(i32 %52)
store i32 %53, i32* %21
%54 = icmp slt i32 %53, 0
br i1 %54, label %55, label %59
55: ; preds = %39
%56 = load i32, i32* @errno
%57 = call i32 @strerror(i32 %56)
%58 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([148 x i8], [148 x i8]* @.str.1, i64 0, i64 0), i32 105, i32 %53, i32 %56, i32 %57)
br label %85
59: ; preds = %39
%60 = load i32, i32* %42
%61 = call i32 @write(i32 %60, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 6)
%62 = icmp eq i32 %61, 6
br i1 %62, label %67, label %63
63: ; preds = %59
%64 = load i32, i32* @errno
%65 = call i32 @strerror(i32 %64)
%66 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([148 x i8], [148 x i8]* @.str.1, i64 0, i64 0), i32 110, i32 %64, i32 %65)
br label %85
67: ; preds = %59
%68 = load i32, i32* %21
%69 = call i32 @read(i32 %68, i8* %8, i32 8)
%70 = icmp eq i32 %69, 6
br i1 %70, label %75, label %71
71: ; preds = %67
%72 = load i32, i32* @errno
%73 = call i32 @strerror(i32 %72)
%74 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([148 x i8], [148 x i8]* @.str.1, i64 0, i64 0), i32 115, i32 %72, i32 %73)
br label %85
75: ; preds = %67
%76 = call i64 @strcmp(i8* %8, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%77 = icmp eq i64 %76, 0
br i1 %77, label %83, label %78
78: ; preds = %75
%79 = getelementptr inbounds [8 x i8], [8 x i8]* %5, i64 0, i64 7
store i8 0, i8* %79
%80 = load i32, i32* @errno
%81 = call i32 @strerror(i32 %80)
%82 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([148 x i8], [148 x i8]* @.str.1, i64 0, i64 0), i32 121, i8* %8, i32 %80, i32 %81)
br label %85
83: ; preds = %75
%84 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0))
br label %85
85: ; preds = %83, %78, %71, %63, %55
ret i32 0
}