#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 */
struct sockaddr_un {
  int /*<<< orphan*/ sun_path;
  int /*<<< orphan*/ sun_family;
};
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
int /*<<< orphan*/ AF_UNIX;
int /*<<< orphan*/ EAGAIN;
int /*<<< orphan*/ PF_UNIX;
int SOCK_DGRAM;
int SOCK_NONBLOCK;
scalar_t__ bind(int, struct sockaddr_un *, unsigned int);
scalar_t__ connect(int, struct sockaddr_un *, unsigned int);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ memcpy(int /*<<< orphan*/, char *, int);
int read(int, char *, int);
int socket(int /*<<< orphan*/, int, int /*<<< orphan*/);
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) {
  struct sockaddr_un addr;
  unsigned int addrlen;
  int srv, clnt1, clnt2, ret;
  char buf[1024];
  test_init(argc, argv);
  srv = socket(PF_UNIX, SOCK_DGRAM | SOCK_NONBLOCK, 0);
  if (srv < 0) {
    test_msg("ERR: %s:%d: "
             "socket"
             " (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/socket_dgram_data.c",
             28, errno, strerror(errno));
    return 1;
  }
  clnt1 = socket(PF_UNIX, SOCK_DGRAM | SOCK_NONBLOCK, 0);
  if (clnt1 < 0) {
    test_msg("ERR: %s:%d: "
             "socket"
             " (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/socket_dgram_data.c",
             33, errno, strerror(errno));
    return 1;
  }
  clnt2 = socket(PF_UNIX, SOCK_DGRAM | SOCK_NONBLOCK, 0);
  if (clnt2 < 0) {
    test_msg("ERR: %s:%d: "
             "socket"
             " (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/socket_dgram_data.c",
             38, errno, strerror(errno));
    return 1;
  }
  addr.sun_family = AF_UNIX;
  memcpy(addr.sun_path, "\0socket_snd_srv", sizeof("\0socket_snd_srv"));
  addrlen = sizeof(addr.sun_family) + sizeof("\0socket_snd_srv");
  if (bind(srv, &addr, addrlen)) {
    test_msg("FAIL: %s:%d: "
             "bind\n"
             " (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/socket_dgram_data.c",
             47, errno, strerror(errno));
    exit(1);
  }
  if (connect(clnt1, &addr, addrlen)) {
    test_msg("FAIL: %s:%d: "
             "connect\n"
             " (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/socket_dgram_data.c",
             51, errno, strerror(errno));
    exit(1);
  }
  if (connect(clnt2, &addr, addrlen)) {
    test_msg("FAIL: %s:%d: "
             "connect\n"
             " (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/socket_dgram_data.c",
             55, errno, strerror(errno));
    exit(1);
  }
  if (write(clnt1, "hello", sizeof("hello")) != sizeof("hello")) {
    test_msg("ERR: %s:%d: "
             "write"
             " (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/socket_dgram_data.c",
             60, errno, strerror(errno));
    return 1;
  }
  test_daemon();
  test_waitsig();
  ret = read(srv, buf, sizeof(buf));
  buf[ret > 0 ? ret : 0] = 0;
  if (ret != sizeof("hello")) {
    test_msg("FAIL: %s:%d: "
             "%d: %s"
             " (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/socket_dgram_data.c",
             70, ret, buf, errno, strerror(errno));
    return 1;
  }
  ret = read(srv, buf, sizeof(buf));
  if (ret != -1 || errno != EAGAIN) {
    test_msg("FAIL: %s:%d: "
             "unexpected data: %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/socket_dgram_data.c",
             76, ret, errno, strerror(errno));
    return 1;
  }
  test_msg("PASS\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x480,%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    0x2e0c(%rip),%rax
mov    (%rax),%edi
mov    0x2de3(%rip),%rax
mov    (%rax),%esi
mov    0x2dca(%rip),%rax
or     (%rax),%esi
xor    %edx,%edx
call   10e0 <socket@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
jge    1260 <main+0xa0>
mov    0x2da5(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x434(%rbp)
mov    0x2d96(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    -0x434(%rbp),%ecx
mov    %eax,%r8d
lea    0xdbf(%rip),%rdi
lea    0xdde(%rip),%rsi
mov    $0x1c,%edx
mov    $0x0,%al
call   1060 <test_msg@plt>
movl   $0x1,-0x4(%rbp)
jmp    1695 <main+0x4d5>
mov    0x2d91(%rip),%rax
mov    (%rax),%edi
mov    0x2d68(%rip),%rax
mov    (%rax),%esi
mov    0x2d4f(%rip),%rax
or     (%rax),%esi
xor    %edx,%edx
call   10e0 <socket@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jge    12db <main+0x11b>
mov    0x2d2a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x438(%rbp)
mov    0x2d1b(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    -0x438(%rbp),%ecx
mov    %eax,%r8d
lea    0xd44(%rip),%rdi
lea    0xd63(%rip),%rsi
mov    $0x21,%edx
mov    $0x0,%al
call   1060 <test_msg@plt>
movl   $0x1,-0x4(%rbp)
jmp    1695 <main+0x4d5>
mov    0x2d16(%rip),%rax
mov    (%rax),%edi
mov    0x2ced(%rip),%rax
mov    (%rax),%esi
mov    0x2cd4(%rip),%rax
or     (%rax),%esi
xor    %edx,%edx
call   10e0 <socket@plt>
mov    %eax,-0x28(%rbp)
cmpl   $0x0,-0x28(%rbp)
jge    1356 <main+0x196>
mov    0x2caf(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x43c(%rbp)
mov    0x2ca0(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    -0x43c(%rbp),%ecx
mov    %eax,%r8d
lea    0xcc9(%rip),%rdi
lea    0xce8(%rip),%rsi
mov    $0x26,%edx
mov    $0x0,%al
call   1060 <test_msg@plt>
movl   $0x1,-0x4(%rbp)
jmp    1695 <main+0x4d5>
mov    0x2c83(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%edi
lea    0xe43(%rip),%rsi
mov    $0x10,%edx
call   1090 <memcpy@plt>
movl   $0x14,-0x1c(%rbp)
mov    -0x20(%rbp),%edi
mov    -0x1c(%rbp),%edx
lea    -0x18(%rbp),%rsi
call   10a0 <bind@plt>
cmp    $0x0,%rax
je     13e0 <main+0x220>
mov    0x2c23(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x440(%rbp)
mov    0x2c14(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    -0x440(%rbp),%ecx
mov    %eax,%r8d
lea    0xd11(%rip),%rdi
lea    0xc5c(%rip),%rsi
mov    $0x2f,%edx
mov    $0x0,%al
call   1060 <test_msg@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
mov    -0x24(%rbp),%edi
mov    -0x1c(%rbp),%edx
lea    -0x18(%rbp),%rsi
call   10c0 <connect@plt>
cmp    $0x0,%rax
je     1443 <main+0x283>
mov    0x2bc0(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x444(%rbp)
mov    0x2bb1(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    -0x444(%rbp),%ecx
mov    %eax,%r8d
lea    0xcd4(%rip),%rdi
lea    0xbf9(%rip),%rsi
mov    $0x33,%edx
mov    $0x0,%al
call   1060 <test_msg@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
mov    -0x28(%rbp),%edi
mov    -0x1c(%rbp),%edx
lea    -0x18(%rbp),%rsi
call   10c0 <connect@plt>
cmp    $0x0,%rax
je     14a6 <main+0x2e6>
mov    0x2b5d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x448(%rbp)
mov    0x2b4e(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    -0x448(%rbp),%ecx
mov    %eax,%r8d
lea    0xc71(%rip),%rdi
lea    0xb96(%rip),%rsi
mov    $0x37,%edx
mov    $0x0,%al
call   1060 <test_msg@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
mov    -0x24(%rbp),%edi
lea    0xc73(%rip),%rsi
mov    $0x6,%edx
call   1040 <write@plt>
cltq
cmp    $0x6,%rax
je     1512 <main+0x352>
mov    0x2af3(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x44c(%rbp)
mov    0x2ae4(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    -0x44c(%rbp),%ecx
mov    %eax,%r8d
lea    0xc36(%rip),%rdi
lea    0xb2c(%rip),%rsi
mov    $0x3c,%edx
mov    $0x0,%al
call   1060 <test_msg@plt>
movl   $0x1,-0x4(%rbp)
jmp    1695 <main+0x4d5>
mov    $0x0,%al
call   1050 <test_daemon@plt>
mov    $0x0,%al
call   1080 <test_waitsig@plt>
mov    -0x20(%rbp),%edi
lea    -0x430(%rbp),%rsi
mov    $0x400,%edx
call   1070 <read@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0x0,-0x2c(%rbp)
jle    154f <main+0x38f>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x450(%rbp)
jmp    155c <main+0x39c>
xor    %eax,%eax
mov    %eax,-0x450(%rbp)
jmp    155c <main+0x39c>
mov    -0x450(%rbp),%eax
cltq
movb   $0x0,-0x430(%rbp,%rax,1)
movslq -0x2c(%rbp),%rax
cmp    $0x6,%rax
je     15eb <main+0x42b>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x464(%rbp)
lea    -0x430(%rbp),%rax
mov    %rax,-0x460(%rbp)
mov    0x2a28(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x454(%rbp)
mov    0x2a19(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    -0x464(%rbp),%ecx
mov    -0x460(%rbp),%r8
mov    -0x454(%rbp),%r9d
lea    0xb85(%rip),%rdi
lea    0xa56(%rip),%rsi
mov    $0x46,%edx
mov    %eax,(%rsp)
mov    $0x0,%al
call   1060 <test_msg@plt>
movl   $0x1,-0x4(%rbp)
jmp    1695 <main+0x4d5>
mov    -0x20(%rbp),%edi
lea    -0x430(%rbp),%rsi
mov    $0x400,%edx
call   1070 <read@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0xffffffff,-0x2c(%rbp)
jne    1624 <main+0x464>
mov    0x29ad(%rip),%rax
mov    (%rax),%eax
mov    0x2994(%rip),%rcx
cmp    (%rcx),%eax
je     1680 <main+0x4c0>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x46c(%rbp)
mov    0x298c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x468(%rbp)
mov    0x297d(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    -0x46c(%rbp),%ecx
mov    -0x468(%rbp),%r8d
mov    %eax,%r9d
lea    0xb14(%rip),%rdi
lea    0x9be(%rip),%rsi
mov    $0x4c,%edx
mov    $0x0,%al
call   1060 <test_msg@plt>
movl   $0x1,-0x4(%rbp)
jmp    1695 <main+0x4d5>
lea    0xb22(%rip),%rdi
mov    $0x0,%al
call   1060 <test_msg@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x480,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x410,%rsp
call   1030 <test_init@plt>
mov    0x2e1d(%rip),%rbp
mov    0x0(%rbp),%edi
mov    0x2df3(%rip),%r14
mov    0x2ddc(%rip),%rbx
mov    (%rbx),%esi
or     (%r14),%esi
xor    %edx,%edx
call   10e0 <socket@plt>
test   %eax,%eax
js     1342 <main+0x182>
mov    %eax,%r15d
mov    0x0(%rbp),%edi
mov    (%rbx),%esi
or     (%r14),%esi
xor    %edx,%edx
call   10e0 <socket@plt>
test   %eax,%eax
js     1367 <main+0x1a7>
mov    %eax,%r12d
mov    0x0(%rbp),%edi
mov    (%rbx),%esi
or     (%r14),%esi
xor    %edx,%edx
call   10e0 <socket@plt>
test   %eax,%eax
js     138c <main+0x1cc>
mov    %eax,%r14d
mov    0x2da2(%rip),%rax
mov    (%rax),%eax
mov    %eax,0xc(%rsp)
lea    0xf64(%rip),%rsi
mov    $0x10,%edx
call   1090 <memcpy@plt>
lea    0x8(%rsp),%rsi
mov    %r15d,%edi
mov    $0x14,%edx
call   10a0 <bind@plt>
test   %rax,%rax
jne    145d <main+0x29d>
lea    0x8(%rsp),%rsi
mov    %r12d,%edi
mov    $0x14,%edx
call   10c0 <connect@plt>
test   %rax,%rax
jne    1482 <main+0x2c2>
lea    0x8(%rsp),%rsi
mov    %r14d,%edi
mov    $0x14,%edx
call   10c0 <connect@plt>
test   %rax,%rax
jne    14a7 <main+0x2e7>
lea    0xe76(%rip),%rsi
mov    %r12d,%edi
mov    $0x6,%edx
call   1040 <write@plt>
cmp    $0x6,%eax
jne    13b1 <main+0x1f1>
xor    %ebx,%ebx
xor    %eax,%eax
call   1050 <test_daemon@plt>
xor    %eax,%eax
call   1080 <test_waitsig@plt>
lea    0x10(%rsp),%rsi
mov    %r15d,%edi
mov    $0x400,%edx
call   1070 <read@plt>
test   %eax,%eax
cmovns %eax,%ebx
movb   $0x0,0x10(%rsp,%rbx,1)
cmp    $0x6,%eax
jne    13f7 <main+0x237>
lea    0x10(%rsp),%rsi
mov    %r15d,%edi
mov    $0x400,%edx
call   1070 <read@plt>
mov    %eax,%ebx
mov    0x2cad(%rip),%rax
mov    (%rax),%ebp
cmp    $0xffffffff,%ebx
jne    1432 <main+0x272>
mov    0x2c8b(%rip),%rax
cmp    (%rax),%ebp
jne    1432 <main+0x272>
lea    0xe75(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1060 <test_msg@plt>
jmp    13e5 <main+0x225>
mov    0x2c77(%rip),%rax
mov    (%rax),%ebx
mov    %ebx,%edi
call   10d0 <strerror@plt>
lea    0xca7(%rip),%rdi
lea    0xcc6(%rip),%rsi
mov    $0x1c,%edx
jmp    13d4 <main+0x214>
mov    0x2c52(%rip),%rax
mov    (%rax),%ebx
mov    %ebx,%edi
call   10d0 <strerror@plt>
lea    0xc82(%rip),%rdi
lea    0xca1(%rip),%rsi
mov    $0x21,%edx
jmp    13d4 <main+0x214>
mov    0x2c2d(%rip),%rax
mov    (%rax),%ebx
mov    %ebx,%edi
call   10d0 <strerror@plt>
lea    0xc5d(%rip),%rdi
lea    0xc7c(%rip),%rsi
mov    $0x26,%edx
jmp    13d4 <main+0x214>
mov    0x2c08(%rip),%rax
mov    (%rax),%ebx
mov    %ebx,%edi
call   10d0 <strerror@plt>
lea    0xd61(%rip),%rdi
lea    0xc57(%rip),%rsi
mov    $0x3c,%edx
mov    %ebx,%ecx
mov    %eax,%r8d
xor    %eax,%eax
call   1060 <test_msg@plt>
mov    $0x1,%ebx
mov    %ebx,%eax
add    $0x410,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %eax,%ebp
mov    0x2bc0(%rip),%rax
mov    (%rax),%ebx
mov    %ebx,%edi
call   10d0 <strerror@plt>
mov    %eax,(%rsp)
lea    0xd3b(%rip),%rdi
lea    0xc0c(%rip),%rsi
lea    0x10(%rsp),%r8
mov    $0x46,%edx
mov    %ebp,%ecx
mov    %ebx,%r9d
xor    %eax,%eax
call   1060 <test_msg@plt>
jmp    13e0 <main+0x220>
mov    %ebp,%edi
call   10d0 <strerror@plt>
lea    0xd35(%rip),%rdi
lea    0xbdf(%rip),%rsi
mov    $0x4c,%edx
mov    %ebx,%ecx
mov    %ebp,%r8d
mov    %eax,%r9d
xor    %eax,%eax
call   1060 <test_msg@plt>
jmp    13e0 <main+0x220>
mov    0x2b5c(%rip),%rax
mov    (%rax),%ebx
mov    %ebx,%edi
call   10d0 <strerror@plt>
lea    0xc60(%rip),%rdi
lea    0xbab(%rip),%rsi
mov    $0x2f,%edx
jmp    14ca <main+0x30a>
mov    0x2b37(%rip),%rax
mov    (%rax),%ebx
mov    %ebx,%edi
call   10d0 <strerror@plt>
lea    0xc61(%rip),%rdi
lea    0xb86(%rip),%rsi
mov    $0x33,%edx
jmp    14ca <main+0x30a>
mov    0x2b12(%rip),%rax
mov    (%rax),%ebx
mov    %ebx,%edi
call   10d0 <strerror@plt>
lea    0xc3c(%rip),%rdi
lea    0xb61(%rip),%rsi
mov    $0x37,%edx
mov    %ebx,%ecx
mov    %eax,%r8d
xor    %eax,%eax
call   1060 <test_msg@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>

LLVM IR (-O0):
%struct.sockaddr_un = type { i32, i32 }
@PF_UNIX = global i32 0
@SOCK_DGRAM = global i32 0
@SOCK_NONBLOCK = global i32 0
@.str = [38 x i8] c"ERR: %s:%d: socket (errno = %d (%s))\0A\00"
@.str.1 = [174 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/socket_dgram_data.c\00"
@errno = global i32 0
@AF_UNIX = global i32 0
@.str.2 = [16 x i8] c"\00socket_snd_srv\00"
@.str.3 = [38 x i8] c"FAIL: %s:%d: bind\0A (errno = %d (%s))\0A\00"
@.str.4 = [41 x i8] c"FAIL: %s:%d: connect\0A (errno = %d (%s))\0A\00"
@.str.5 = [6 x i8] c"hello\00"
@.str.6 = [37 x i8] c"ERR: %s:%d: write (errno = %d (%s))\0A\00"
@.str.7 = [39 x i8] c"FAIL: %s:%d: %d: %s (errno = %d (%s))\0A\00"
@EAGAIN = global i32 0
@.str.8 = [52 x i8] c"FAIL: %s:%d: unexpected data: %d (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 %struct.sockaddr_un
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca [1024 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%13 = load i32, i32* %4
%14 = load i8**, i8*** %5
%15 = call i32 @test_init(i32 %13, i8** %14)
%16 = load i32, i32* @PF_UNIX
%17 = load i32, i32* @SOCK_DGRAM
%18 = load i32, i32* @SOCK_NONBLOCK
%19 = or i32 %17, %18
%20 = call i32 @socket(i32 %16, i32 %19, i32 0)
store i32 %20, i32* %8
%21 = load i32, i32* %8
%22 = icmp slt i32 %21, 0
br i1 %22, label %23, label %28
23: ; preds = %2
%24 = load i32, i32* @errno
%25 = load i32, i32* @errno
%26 = call i32 @strerror(i32 %25)
%27 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([174 x i8], [174 x i8]* @.str.1, i64 0, i64 0), i32 28, i32 %24, i32 %26)
store i32 1, i32* %3
br label %145
28: ; preds = %2
%29 = load i32, i32* @PF_UNIX
%30 = load i32, i32* @SOCK_DGRAM
%31 = load i32, i32* @SOCK_NONBLOCK
%32 = or i32 %30, %31
%33 = call i32 @socket(i32 %29, i32 %32, i32 0)
store i32 %33, i32* %9
%34 = load i32, i32* %9
%35 = icmp slt i32 %34, 0
br i1 %35, label %36, label %41
36: ; preds = %28
%37 = load i32, i32* @errno
%38 = load i32, i32* @errno
%39 = call i32 @strerror(i32 %38)
%40 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([174 x i8], [174 x i8]* @.str.1, i64 0, i64 0), i32 33, i32 %37, i32 %39)
store i32 1, i32* %3
br label %145
41: ; preds = %28
%42 = load i32, i32* @PF_UNIX
%43 = load i32, i32* @SOCK_DGRAM
%44 = load i32, i32* @SOCK_NONBLOCK
%45 = or i32 %43, %44
%46 = call i32 @socket(i32 %42, i32 %45, i32 0)
store i32 %46, i32* %10
%47 = load i32, i32* %10
%48 = icmp slt i32 %47, 0
br i1 %48, label %49, label %54
49: ; preds = %41
%50 = load i32, i32* @errno
%51 = load i32, i32* @errno
%52 = call i32 @strerror(i32 %51)
%53 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([174 x i8], [174 x i8]* @.str.1, i64 0, i64 0), i32 38, i32 %50, i32 %52)
store i32 1, i32* %3
br label %145
54: ; preds = %41
%55 = load i32, i32* @AF_UNIX
%56 = getelementptr inbounds %struct.sockaddr_un, %struct.sockaddr_un* %6, i32 0, i32 1
store i32 %55, i32* %56
%57 = getelementptr inbounds %struct.sockaddr_un, %struct.sockaddr_un* %6, i32 0, i32 0
%58 = load i32, i32* %57
%59 = call i32 @memcpy(i32 %58, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32 16)
store i32 20, i32* %7
%60 = load i32, i32* %8
%61 = load i32, i32* %7
%62 = call i64 @bind(i32 %60, %struct.sockaddr_un* %6, i32 %61)
%63 = icmp ne i64 %62, 0
br i1 %63, label %64, label %70
64: ; preds = %54
%65 = load i32, i32* @errno
%66 = load i32, i32* @errno
%67 = call i32 @strerror(i32 %66)
%68 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([174 x i8], [174 x i8]* @.str.1, i64 0, i64 0), i32 47, i32 %65, i32 %67)
%69 = call i32 @exit(i32 1)
unreachable
70: ; preds = %54
%71 = load i32, i32* %9
%72 = load i32, i32* %7
%73 = call i64 @connect(i32 %71, %struct.sockaddr_un* %6, i32 %72)
%74 = icmp ne i64 %73, 0
br i1 %74, label %75, label %81
75: ; preds = %70
%76 = load i32, i32* @errno
%77 = load i32, i32* @errno
%78 = call i32 @strerror(i32 %77)
%79 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([174 x i8], [174 x i8]* @.str.1, i64 0, i64 0), i32 51, i32 %76, i32 %78)
%80 = call i32 @exit(i32 1)
unreachable
81: ; preds = %70
%82 = load i32, i32* %10
%83 = load i32, i32* %7
%84 = call i64 @connect(i32 %82, %struct.sockaddr_un* %6, i32 %83)
%85 = icmp ne i64 %84, 0
br i1 %85, label %86, label %92
86: ; preds = %81
%87 = load i32, i32* @errno
%88 = load i32, i32* @errno
%89 = call i32 @strerror(i32 %88)
%90 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([174 x i8], [174 x i8]* @.str.1, i64 0, i64 0), i32 55, i32 %87, i32 %89)
%91 = call i32 @exit(i32 1)
unreachable
92: ; preds = %81
%93 = load i32, i32* %9
%94 = call i32 @write(i32 %93, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 6)
%95 = sext i32 %94 to i64
%96 = icmp ne i64 %95, 6
br i1 %96, label %97, label %102
97: ; preds = %92
%98 = load i32, i32* @errno
%99 = load i32, i32* @errno
%100 = call i32 @strerror(i32 %99)
%101 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([174 x i8], [174 x i8]* @.str.1, i64 0, i64 0), i32 60, i32 %98, i32 %100)
store i32 1, i32* %3
br label %145
102: ; preds = %92
%103 = call i32 (...) @test_daemon()
%104 = call i32 (...) @test_waitsig()
%105 = load i32, i32* %8
%106 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%107 = call i32 @read(i32 %105, i8* %106, i32 1024)
store i32 %107, i32* %11
%108 = load i32, i32* %11
%109 = icmp sgt i32 %108, 0
br i1 %109, label %110, label %112
110: ; preds = %102
%111 = load i32, i32* %11
br label %113
112: ; preds = %102
br label %113
113: ; preds = %112, %110
%114 = phi i32 [ %111, %110 ], [ 0, %112 ]
%115 = sext i32 %114 to i64
%116 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 %115
store i8 0, i8* %116
%117 = load i32, i32* %11
%118 = sext i32 %117 to i64
%119 = icmp ne i64 %118, 6
br i1 %119, label %120, label %127
120: ; preds = %113
%121 = load i32, i32* %11
%122 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%123 = load i32, i32* @errno
%124 = load i32, i32* @errno
%125 = call i32 @strerror(i32 %124)
%126 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([174 x i8], [174 x i8]* @.str.1, i64 0, i64 0), i32 70, i32 %121, i8* %122, i32 %123, i32 %125)
store i32 1, i32* %3
br label %145
127: ; preds = %113
%128 = load i32, i32* %8
%129 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%130 = call i32 @read(i32 %128, i8* %129, i32 1024)
store i32 %130, i32* %11
%131 = load i32, i32* %11
%132 = icmp ne i32 %131, -1
br i1 %132, label %137, label %133
133: ; preds = %127
%134 = load i32, i32* @errno
%135 = load i32, i32* @EAGAIN
%136 = icmp ne i32 %134, %135
br i1 %136, label %137, label %143
137: ; preds = %133, %127
%138 = load i32, i32* %11
%139 = load i32, i32* @errno
%140 = load i32, i32* @errno
%141 = call i32 @strerror(i32 %140)
%142 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([174 x i8], [174 x i8]* @.str.1, i64 0, i64 0), i32 76, i32 %138, i32 %139, i32 %141)
store i32 1, i32* %3
br label %145
143: ; preds = %133
%144 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0))
store i32 0, i32* %3
br label %145
145: ; preds = %143, %137, %120, %97, %49, %36, %23
%146 = load i32, i32* %3
ret i32 %146
}

LLVM IR (-O2):
%struct.sockaddr_un = type { i32, i32 }
@PF_UNIX = global i32 0
@SOCK_DGRAM = global i32 0
@SOCK_NONBLOCK = global i32 0
@.str = [38 x i8] c"ERR: %s:%d: socket (errno = %d (%s))\0A\00"
@.str.1 = [174 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/socket_dgram_data.c\00"
@errno = global i32 0
@AF_UNIX = global i32 0
@.str.2 = [16 x i8] c"\00socket_snd_srv\00"
@.str.3 = [38 x i8] c"FAIL: %s:%d: bind\0A (errno = %d (%s))\0A\00"
@.str.4 = [41 x i8] c"FAIL: %s:%d: connect\0A (errno = %d (%s))\0A\00"
@.str.5 = [6 x i8] c"hello\00"
@.str.6 = [37 x i8] c"ERR: %s:%d: write (errno = %d (%s))\0A\00"
@.str.7 = [39 x i8] c"FAIL: %s:%d: %d: %s (errno = %d (%s))\0A\00"
@EAGAIN = global i32 0
@.str.8 = [52 x i8] c"FAIL: %s:%d: unexpected data: %d (errno = %d (%s))\0A\00"
@.str.9 = [6 x i8] c"PASS\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca %struct.sockaddr_un
%4 = alloca [1024 x i8]
%5 = bitcast %struct.sockaddr_un* %3 to i8*
%6 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%7 = tail call i32 @test_init(i32 %0, i8** %1)
%8 = load i32, i32* @PF_UNIX
%9 = load i32, i32* @SOCK_DGRAM
%10 = load i32, i32* @SOCK_NONBLOCK
%11 = or i32 %10, %9
%12 = tail call i32 @socket(i32 %8, i32 %11, i32 0)
%13 = icmp slt i32 %12, 0
br i1 %13, label %14, label %18
14: ; preds = %2
%15 = load i32, i32* @errno
%16 = tail call i32 @strerror(i32 %15)
%17 = tail call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([174 x i8], [174 x i8]* @.str.1, i64 0, i64 0), i32 28, i32 %15, i32 %16)
br label %99
18: ; preds = %2
%19 = load i32, i32* @PF_UNIX
%20 = load i32, i32* @SOCK_DGRAM
%21 = load i32, i32* @SOCK_NONBLOCK
%22 = or i32 %21, %20
%23 = tail call i32 @socket(i32 %19, i32 %22, i32 0)
%24 = icmp slt i32 %23, 0
br i1 %24, label %25, label %29
25: ; preds = %18
%26 = load i32, i32* @errno
%27 = tail call i32 @strerror(i32 %26)
%28 = tail call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([174 x i8], [174 x i8]* @.str.1, i64 0, i64 0), i32 33, i32 %26, i32 %27)
br label %99
29: ; preds = %18
%30 = load i32, i32* @PF_UNIX
%31 = load i32, i32* @SOCK_DGRAM
%32 = load i32, i32* @SOCK_NONBLOCK
%33 = or i32 %32, %31
%34 = tail call i32 @socket(i32 %30, i32 %33, i32 0)
%35 = icmp slt i32 %34, 0
br i1 %35, label %36, label %40
36: ; preds = %29
%37 = load i32, i32* @errno
%38 = tail call i32 @strerror(i32 %37)
%39 = tail call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([174 x i8], [174 x i8]* @.str.1, i64 0, i64 0), i32 38, i32 %37, i32 %38)
br label %99
40: ; preds = %29
%41 = load i32, i32* @AF_UNIX
%42 = getelementptr inbounds %struct.sockaddr_un, %struct.sockaddr_un* %3, i64 0, i32 1
store i32 %41, i32* %42
%43 = tail call i32 @memcpy(i32 undef, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32 16)
%44 = call i64 @bind(i32 %12, %struct.sockaddr_un* %3, i32 20)
%45 = icmp eq i64 %44, 0
br i1 %45, label %51, label %46
46: ; preds = %40
%47 = load i32, i32* @errno
%48 = call i32 @strerror(i32 %47)
%49 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([174 x i8], [174 x i8]* @.str.1, i64 0, i64 0), i32 47, i32 %47, i32 %48)
%50 = call i32 @exit(i32 1)
unreachable
51: ; preds = %40
%52 = call i64 @connect(i32 %23, %struct.sockaddr_un* %3, i32 20)
%53 = icmp eq i64 %52, 0
br i1 %53, label %59, label %54
54: ; preds = %51
%55 = load i32, i32* @errno
%56 = call i32 @strerror(i32 %55)
%57 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([174 x i8], [174 x i8]* @.str.1, i64 0, i64 0), i32 51, i32 %55, i32 %56)
%58 = call i32 @exit(i32 1)
unreachable
59: ; preds = %51
%60 = call i64 @connect(i32 %34, %struct.sockaddr_un* %3, i32 20)
%61 = icmp eq i64 %60, 0
br i1 %61, label %67, label %62
62: ; preds = %59
%63 = load i32, i32* @errno
%64 = call i32 @strerror(i32 %63)
%65 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([174 x i8], [174 x i8]* @.str.1, i64 0, i64 0), i32 55, i32 %63, i32 %64)
%66 = call i32 @exit(i32 1)
unreachable
67: ; preds = %59
%68 = call i32 @write(i32 %23, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 6)
%69 = icmp eq i32 %68, 6
br i1 %69, label %74, label %70
70: ; preds = %67
%71 = load i32, i32* @errno
%72 = call i32 @strerror(i32 %71)
%73 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([174 x i8], [174 x i8]* @.str.1, i64 0, i64 0), i32 60, i32 %71, i32 %72)
br label %99
74: ; preds = %67
%75 = call i32 (...) @test_daemon()
%76 = call i32 (...) @test_waitsig()
%77 = call i32 @read(i32 %12, i8* %6, i32 1024)
%78 = icmp sgt i32 %77, 0
%79 = select i1 %78, i32 %77, i32 0
%80 = zext i32 %79 to i64
%81 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 %80
store i8 0, i8* %81
%82 = icmp eq i32 %77, 6
br i1 %82, label %87, label %83
83: ; preds = %74
%84 = load i32, i32* @errno
%85 = call i32 @strerror(i32 %84)
%86 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([174 x i8], [174 x i8]* @.str.1, i64 0, i64 0), i32 70, i32 %77, i8* %6, i32 %84, i32 %85)
br label %99
87: ; preds = %74
%88 = call i32 @read(i32 %12, i8* %6, i32 1024)
%89 = icmp eq i32 %88, -1
%90 = load i32, i32* @errno
%91 = load i32, i32* @EAGAIN
%92 = icmp eq i32 %90, %91
%93 = select i1 %89, i1 %92, i1 false
br i1 %93, label %97, label %94
94: ; preds = %87
%95 = call i32 @strerror(i32 %90)
%96 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([174 x i8], [174 x i8]* @.str.1, i64 0, i64 0), i32 76, i32 %88, i32 %90, i32 %95)
br label %99
97: ; preds = %87
%98 = call i32 (i8*, ...) @test_msg(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0))
br label %99
99: ; preds = %97, %94, %83, %70, %36, %25, %14
%100 = phi i32 [ 1, %14 ], [ 1, %25 ], [ 1, %36 ], [ 1, %70 ], [ 1, %83 ], [ 1, %94 ], [ 0, %97 ]
ret i32 %100
}