#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 sigevent {
  int sigev_signo;
  int /*<<< orphan*/ sigev_notify;
};
struct mq_attr {
  int /*<<< orphan*/ mq_msgsize;
};
typedef scalar_t__ ssize_t;
typedef int /*<<< orphan*/ sigset_t;
typedef int mqd_t;

/* Variables and functions */
scalar_t__ EAGAIN;
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ EXIT_SUCCESS;
int O_NONBLOCK;
int O_RDONLY;
int /*<<< orphan*/ SIGEV_SIGNAL;
int SIGUSR1;
int /*<<< orphan*/ SIG_BLOCK;
scalar_t__ errno;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
void *malloc(int /*<<< orphan*/);
int mq_getattr(int, struct mq_attr *);
int mq_notify(int, struct sigevent *);
int mq_open(char *, int);
scalar_t__ mq_receive(int, void *, int /*<<< orphan*/, int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sigaddset(int /*<<< orphan*/ *, int);
int /*<<< orphan*/ sigemptyset(int /*<<< orphan*/ *);
int /*<<< orphan*/ sigprocmask(int /*<<< orphan*/, int /*<<< orphan*/ *,
                               int /*<<< orphan*/ *);
scalar_t__ sigwait(int /*<<< orphan*/ *, int *);
char *strerror(scalar_t__);
int main(int argc, char **argv) {
  int signo;
  mqd_t mqd;
  void *buff;
  ssize_t n;
  sigset_t newmask;
  struct mq_attr attr;
  struct sigevent sigev;
  if (2 != argc) {
    printf("usage: %s <name>\n", argv[0]);
    exit(EXIT_FAILURE);
  }
  if (-1 == (mqd = mq_open(argv[1], O_RDONLY | O_NONBLOCK))) {
    printf("mq_open error: %s\n", strerror(errno));
    exit(EXIT_FAILURE);
  }
  if (-1 == mq_getattr(mqd, &attr)) {
    printf("mq_getattr error: %s\n", strerror(errno));
    exit(EXIT_FAILURE);
  }
  if (NULL == (buff = malloc(attr.mq_msgsize))) {
    printf("malloc error\n");
    exit(EXIT_FAILURE);
  }
  sigemptyset(&newmask);
  sigaddset(&newmask, SIGUSR1);
  sigprocmask(SIG_BLOCK, &newmask, NULL);
  sigev.sigev_notify = SIGEV_SIGNAL;
  sigev.sigev_signo = SIGUSR1;
  if (-1 == mq_notify(mqd, &sigev)) {
    printf("mq_notify error: %s\n", strerror(errno));
    exit(EXIT_FAILURE);
  }
  for (;;) {
    if (0 != sigwait(&newmask, &signo)) {
      printf("sigwait error\n");
    }
    if (signo == SIGUSR1) {
      if (-1 == mq_notify(mqd, &sigev)) {
        printf("mq_notify error: %s\n", strerror(errno));
        exit(EXIT_FAILURE);
      }
      while (0 <= (n = mq_receive(mqd, buff, attr.mq_msgsize, NULL))) {
        printf("SIGUSR1 received, read %ld bytes\n", (long)n);
      }
      if (EAGAIN == errno) {
        printf("mq_receive error");
      }
    }
  }
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x2,%eax
cmp    -0x8(%rbp),%eax
je     1207 <main+0x47>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe0e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2db0(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    0x2dc2(%rip),%rax
mov    (%rax),%esi
mov    0x2dc1(%rip),%rax
or     (%rax),%esi
call   1060 <mq_open@plt>
mov    %eax,%ecx
mov    %ecx,-0x18(%rbp)
mov    $0xffffffff,%eax
cmp    %ecx,%eax
jne    1266 <main+0xa6>
mov    0x2d81(%rip),%rax
mov    (%rax),%rdi
call   10c0 <strerror@plt>
mov    %rax,%rsi
lea    0xdc1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2d51(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
mov    -0x18(%rbp),%edi
lea    -0x30(%rbp),%rsi
call   10e0 <mq_getattr@plt>
mov    %eax,%ecx
mov    $0xffffffff,%eax
cmp    %ecx,%eax
jne    12af <main+0xef>
mov    0x2d38(%rip),%rax
mov    (%rax),%rdi
call   10c0 <strerror@plt>
mov    %rax,%rsi
lea    0xd8b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2d08(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
mov    -0x30(%rbp),%edi
call   1070 <malloc@plt>
mov    %rax,%rcx
mov    %rcx,-0x20(%rbp)
xor    %eax,%eax
cmp    %rcx,%rax
jne    12e5 <main+0x125>
lea    0xd6b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2cd2(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
lea    -0x2c(%rbp),%rdi
call   1050 <sigemptyset@plt>
mov    0x2cf3(%rip),%rax
mov    (%rax),%esi
lea    -0x2c(%rbp),%rdi
call   10d0 <sigaddset@plt>
mov    0x2cb1(%rip),%rax
mov    (%rax),%edi
lea    -0x2c(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1030 <sigprocmask@plt>
mov    0x2cb3(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x34(%rbp)
mov    0x2cbf(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x38(%rbp)
mov    -0x18(%rbp),%edi
lea    -0x38(%rbp),%rsi
call   1090 <mq_notify@plt>
mov    %eax,%ecx
mov    $0xffffffff,%eax
cmp    %ecx,%eax
jne    1377 <main+0x1b7>
mov    0x2c70(%rip),%rax
mov    (%rax),%rdi
call   10c0 <strerror@plt>
mov    %rax,%rsi
lea    0xce7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2c40(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
jmp    137c <main+0x1bc>
lea    -0x2c(%rbp),%rdi
lea    -0x14(%rbp),%rsi
call   10a0 <sigwait@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
je     13a5 <main+0x1e5>
lea    0xcc0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
mov    0x2c39(%rip),%rcx
cmp    (%rcx),%eax
jne    146e <main+0x2ae>
mov    -0x18(%rbp),%edi
lea    -0x38(%rbp),%rsi
call   1090 <mq_notify@plt>
mov    %eax,%ecx
mov    $0xffffffff,%eax
cmp    %ecx,%eax
jne    1400 <main+0x240>
mov    0x2be7(%rip),%rax
mov    (%rax),%rdi
call   10c0 <strerror@plt>
mov    %rax,%rsi
lea    0xc5e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2bb7(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
jmp    1405 <main+0x245>
mov    -0x18(%rbp),%edi
mov    -0x20(%rbp),%rsi
mov    -0x30(%rbp),%edx
xor    %eax,%eax
mov    %eax,%ecx
call   1080 <mq_receive@plt>
mov    %rax,%rcx
mov    %rcx,-0x28(%rbp)
xor    %eax,%eax
cmp    %rcx,%rax
jg     1441 <main+0x281>
mov    -0x28(%rbp),%rsi
lea    0xc38(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1405 <main+0x245>
mov    0x2b58(%rip),%rax
mov    (%rax),%rax
mov    0x2b6e(%rip),%rcx
cmp    (%rcx),%rax
jne    1469 <main+0x2a9>
lea    0xc2d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    146e <main+0x2ae>
jmp    137c <main+0x1bc>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
cmp    $0x2,%edi
jne    121e <main+0x4e>
mov    0x8(%rsi),%rdi
mov    0x2dea(%rip),%rax
mov    0x2deb(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
call   1070 <mq_open@plt>
cmp    $0xffffffff,%eax
jne    122d <main+0x5d>
mov    0x2db6(%rip),%rax
mov    (%rax),%rdi
call   10d0 <strerror@plt>
lea    0xdf9(%rip),%rdi
jmp    12e6 <main+0x116>
mov    (%rsi),%rsi
lea    0xdd8(%rip),%rdi
jmp    12e9 <main+0x119>
mov    %eax,%ebp
mov    %rsp,%rsi
mov    %eax,%edi
call   10f0 <mq_getattr@plt>
cmp    $0xffffffff,%eax
jne    1259 <main+0x89>
mov    0x2d7b(%rip),%rax
mov    (%rax),%rdi
call   10d0 <strerror@plt>
lea    0xdd1(%rip),%rdi
jmp    12e6 <main+0x116>
mov    (%rsp),%edi
call   1080 <malloc@plt>
test   %rax,%rax
jne    1274 <main+0xa4>
lea    0xe24(%rip),%rdi
call   1040 <puts@plt>
jmp    12f0 <main+0x120>
mov    %rax,%rbx
lea    0x10(%rsp),%r14
mov    %r14,%rdi
call   1060 <sigemptyset@plt>
mov    0x2d5d(%rip),%r12
mov    (%r12),%esi
mov    %r14,%rdi
call   10e0 <sigaddset@plt>
mov    0x2d1a(%rip),%rax
mov    (%rax),%edi
mov    %r14,%rsi
xor    %edx,%edx
call   1030 <sigprocmask@plt>
mov    0x2d1f(%rip),%rax
mov    (%rax),%eax
mov    %eax,0xc(%rsp)
mov    (%r12),%eax
mov    %eax,0x8(%rsp)
lea    0x8(%rsp),%rsi
mov    %ebp,%edi
call   10a0 <mq_notify@plt>
cmp    $0xffffffff,%eax
jne    12fe <main+0x12e>
mov    0x2ce9(%rip),%rax
mov    (%rax),%rdi
call   10d0 <strerror@plt>
lea    0xd55(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x2cb9(%rip),%rax
mov    (%rax),%edi
call   10c0 <exit@plt>
lea    0x10(%rsp),%r14
lea    0x14(%rsp),%r15
lea    0xd41(%rip),%r13
nop
mov    %r14,%rdi
mov    %r15,%rsi
call   10b0 <sigwait@plt>
test   %rax,%rax
je     132c <main+0x15c>
lea    0xd5c(%rip),%rdi
call   1040 <puts@plt>
mov    0x14(%rsp),%eax
cmp    (%r12),%eax
jne    1310 <main+0x140>
mov    %ebp,%edi
lea    0x8(%rsp),%rsi
call   10a0 <mq_notify@plt>
cmp    $0xffffffff,%eax
je     12d0 <main+0x100>
nopw   0x0(%rax,%rax,1)
mov    (%rsp),%edx
mov    %ebp,%edi
mov    %rbx,%rsi
xor    %ecx,%ecx
call   1090 <mq_receive@plt>
test   %rax,%rax
js     1380 <main+0x1b0>
mov    %r13,%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    1350 <main+0x180>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    0x2c19(%rip),%rax
mov    (%rax),%rax
mov    0x2c2f(%rip),%rcx
cmp    (%rcx),%rax
jne    1310 <main+0x140>
lea    0xcd1(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    1310 <main+0x140>

LLVM IR (-O0):
%struct.mq_attr = type { i32 }
%struct.sigevent = type { i32, i32 }
@.str = [18 x i8] c"usage: %s <name>\0A\00"
@EXIT_FAILURE = global i32 0
@O_RDONLY = global i32 0
@O_NONBLOCK = global i32 0
@.str.1 = [19 x i8] c"mq_open error: %s\0A\00"
@errno = global i64 0
@.str.2 = [22 x i8] c"mq_getattr error: %s\0A\00"
@.str.3 = [14 x i8] c"malloc error\0A\00"
@SIGUSR1 = global i32 0
@SIG_BLOCK = global i32 0
@SIGEV_SIGNAL = global i32 0
@.str.4 = [21 x i8] c"mq_notify error: %s\0A\00"
@.str.5 = [15 x i8] c"sigwait error\0A\00"
@.str.6 = [34 x i8] c"SIGUSR1 received, read %ld bytes\0A\00"
@EAGAIN = global i64 0
@.str.7 = [17 x i8] c"mq_receive error\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i64
%10 = alloca i32
%11 = alloca %struct.mq_attr
%12 = alloca %struct.sigevent
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%13 = load i32, i32* %4
%14 = icmp ne i32 2, %13
br i1 %14, label %15, label %22
15: ; preds = %2
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 0
%18 = load i8*, i8** %17
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %18)
%20 = load i32, i32* @EXIT_FAILURE
%21 = call i32 @exit(i32 %20)
unreachable
22: ; preds = %2
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 1
%25 = load i8*, i8** %24
%26 = load i32, i32* @O_RDONLY
%27 = load i32, i32* @O_NONBLOCK
%28 = or i32 %26, %27
%29 = call i32 @mq_open(i8* %25, i32 %28)
store i32 %29, i32* %7
%30 = icmp eq i32 -1, %29
br i1 %30, label %31, label %37
31: ; preds = %22
%32 = load i64, i64* @errno
%33 = call i8* @strerror(i64 %32)
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %33)
%35 = load i32, i32* @EXIT_FAILURE
%36 = call i32 @exit(i32 %35)
unreachable
37: ; preds = %22
%38 = load i32, i32* %7
%39 = call i32 @mq_getattr(i32 %38, %struct.mq_attr* %11)
%40 = icmp eq i32 -1, %39
br i1 %40, label %41, label %47
41: ; preds = %37
%42 = load i64, i64* @errno
%43 = call i8* @strerror(i64 %42)
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i8* %43)
%45 = load i32, i32* @EXIT_FAILURE
%46 = call i32 @exit(i32 %45)
unreachable
47: ; preds = %37
%48 = getelementptr inbounds %struct.mq_attr, %struct.mq_attr* %11, i32 0, i32 0
%49 = load i32, i32* %48
%50 = call i8* @malloc(i32 %49)
store i8* %50, i8** %8
%51 = icmp eq i8* null, %50
br i1 %51, label %52, label %56
52: ; preds = %47
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
%54 = load i32, i32* @EXIT_FAILURE
%55 = call i32 @exit(i32 %54)
unreachable
56: ; preds = %47
%57 = call i32 @sigemptyset(i32* %10)
%58 = load i32, i32* @SIGUSR1
%59 = call i32 @sigaddset(i32* %10, i32 %58)
%60 = load i32, i32* @SIG_BLOCK
%61 = call i32 @sigprocmask(i32 %60, i32* %10, i32* null)
%62 = load i32, i32* @SIGEV_SIGNAL
%63 = getelementptr inbounds %struct.sigevent, %struct.sigevent* %12, i32 0, i32 1
store i32 %62, i32* %63
%64 = load i32, i32* @SIGUSR1
%65 = getelementptr inbounds %struct.sigevent, %struct.sigevent* %12, i32 0, i32 0
store i32 %64, i32* %65
%66 = load i32, i32* %7
%67 = call i32 @mq_notify(i32 %66, %struct.sigevent* %12)
%68 = icmp eq i32 -1, %67
br i1 %68, label %69, label %75
69: ; preds = %56
%70 = load i64, i64* @errno
%71 = call i8* @strerror(i64 %70)
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i8* %71)
%73 = load i32, i32* @EXIT_FAILURE
%74 = call i32 @exit(i32 %73)
unreachable
75: ; preds = %56
br label %76
76: ; preds = %113, %75
%77 = call i64 @sigwait(i32* %10, i32* %6)
%78 = icmp ne i64 0, %77
br i1 %78, label %79, label %81
79: ; preds = %76
%80 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0))
br label %81
81: ; preds = %79, %76
%82 = load i32, i32* %6
%83 = load i32, i32* @SIGUSR1
%84 = icmp eq i32 %82, %83
br i1 %84, label %85, label %113
85: ; preds = %81
%86 = load i32, i32* %7
%87 = call i32 @mq_notify(i32 %86, %struct.sigevent* %12)
%88 = icmp eq i32 -1, %87
br i1 %88, label %89, label %95
89: ; preds = %85
%90 = load i64, i64* @errno
%91 = call i8* @strerror(i64 %90)
%92 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i8* %91)
%93 = load i32, i32* @EXIT_FAILURE
%94 = call i32 @exit(i32 %93)
unreachable
95: ; preds = %85
br label %96
96: ; preds = %103, %95
%97 = load i32, i32* %7
%98 = load i8*, i8** %8
%99 = getelementptr inbounds %struct.mq_attr, %struct.mq_attr* %11, i32 0, i32 0
%100 = load i32, i32* %99
%101 = call i64 @mq_receive(i32 %97, i8* %98, i32 %100, i32* null)
store i64 %101, i64* %9
%102 = icmp sle i64 0, %101
br i1 %102, label %103, label %106
103: ; preds = %96
%104 = load i64, i64* %9
%105 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.6, i64 0, i64 0), i64 %104)
br label %96
106: ; preds = %96
%107 = load i64, i64* @EAGAIN
%108 = load i64, i64* @errno
%109 = icmp eq i64 %107, %108
br i1 %109, label %110, label %112
110: ; preds = %106
%111 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.7, i64 0, i64 0))
br label %112
112: ; preds = %110, %106
br label %113
113: ; preds = %112, %81
br label %76
}

LLVM IR (-O2):
%struct.mq_attr = type { i32 }
%struct.sigevent = type { i32, i32 }
@.str = [18 x i8] c"usage: %s <name>\0A\00"
@EXIT_FAILURE = global i32 0
@O_RDONLY = global i32 0
@O_NONBLOCK = global i32 0
@.str.1 = [19 x i8] c"mq_open error: %s\0A\00"
@errno = global i64 0
@.str.2 = [22 x i8] c"mq_getattr error: %s\0A\00"
@SIGUSR1 = global i32 0
@SIG_BLOCK = global i32 0
@SIGEV_SIGNAL = global i32 0
@.str.4 = [21 x i8] c"mq_notify error: %s\0A\00"
@.str.6 = [34 x i8] c"SIGUSR1 received, read %ld bytes\0A\00"
@EAGAIN = global i64 0
@.str.7 = [17 x i8] c"mq_receive error\00"
@EXIT_SUCCESS = global i32 0
@str = [14 x i8] c"sigwait error\00"
@str.8 = [13 x i8] c"malloc error\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca %struct.mq_attr
%6 = alloca %struct.sigevent
%7 = bitcast i32* %3 to i8*
%8 = bitcast i32* %4 to i8*
%9 = bitcast %struct.mq_attr* %5 to i8*
%10 = bitcast %struct.sigevent* %6 to i8*
%11 = icmp eq i32 %0, 2
br i1 %11, label %17, label %12
12: ; preds = %2
%13 = load i8*, i8** %1
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %13)
%15 = load i32, i32* @EXIT_FAILURE
%16 = tail call i32 @exit(i32 %15)
unreachable
17: ; preds = %2
%18 = getelementptr inbounds i8*, i8** %1, i64 1
%19 = load i8*, i8** %18
%20 = load i32, i32* @O_RDONLY
%21 = load i32, i32* @O_NONBLOCK
%22 = or i32 %21, %20
%23 = tail call i32 @mq_open(i8* %19, i32 %22)
%24 = icmp eq i32 %23, -1
br i1 %24, label %25, label %31
25: ; preds = %17
%26 = load i64, i64* @errno
%27 = tail call i8* @strerror(i64 %26)
%28 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %27)
%29 = load i32, i32* @EXIT_FAILURE
%30 = tail call i32 @exit(i32 %29)
unreachable
31: ; preds = %17
%32 = call i32 @mq_getattr(i32 %23, %struct.mq_attr* %5)
%33 = icmp eq i32 %32, -1
br i1 %33, label %34, label %40
34: ; preds = %31
%35 = load i64, i64* @errno
%36 = call i8* @strerror(i64 %35)
%37 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i8* %36)
%38 = load i32, i32* @EXIT_FAILURE
%39 = call i32 @exit(i32 %38)
unreachable
40: ; preds = %31
%41 = getelementptr inbounds %struct.mq_attr, %struct.mq_attr* %5, i64 0, i32 0
%42 = load i32, i32* %41
%43 = call i8* @malloc(i32 %42)
%44 = icmp eq i8* %43, null
br i1 %44, label %45, label %49
45: ; preds = %40
%46 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.8, i64 0, i64 0))
%47 = load i32, i32* @EXIT_FAILURE
%48 = call i32 @exit(i32 %47)
unreachable
49: ; preds = %40
%50 = call i32 @sigemptyset(i32* %4)
%51 = load i32, i32* @SIGUSR1
%52 = call i32 @sigaddset(i32* %4, i32 %51)
%53 = load i32, i32* @SIG_BLOCK
%54 = call i32 @sigprocmask(i32 %53, i32* %4, i32* null)
%55 = load i32, i32* @SIGEV_SIGNAL
%56 = getelementptr inbounds %struct.sigevent, %struct.sigevent* %6, i64 0, i32 1
store i32 %55, i32* %56
%57 = load i32, i32* @SIGUSR1
%58 = getelementptr inbounds %struct.sigevent, %struct.sigevent* %6, i64 0, i32 0
store i32 %57, i32* %58
%59 = call i32 @mq_notify(i32 %23, %struct.sigevent* %6)
%60 = icmp eq i32 %59, -1
br i1 %60, label %61, label %67
61: ; preds = %49
%62 = load i64, i64* @errno
%63 = call i8* @strerror(i64 %62)
%64 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i8* %63)
%65 = load i32, i32* @EXIT_FAILURE
%66 = call i32 @exit(i32 %65)
unreachable
67: ; preds = %49, %99
%68 = call i64 @sigwait(i32* %4, i32* %3)
%69 = icmp eq i64 %68, 0
br i1 %69, label %72, label %70
70: ; preds = %67
%71 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
br label %72
72: ; preds = %70, %67
%73 = load i32, i32* %3
%74 = load i32, i32* @SIGUSR1
%75 = icmp eq i32 %73, %74
br i1 %75, label %76, label %99
76: ; preds = %72
%77 = call i32 @mq_notify(i32 %23, %struct.sigevent* %6)
%78 = icmp eq i32 %77, -1
br i1 %78, label %83, label %79
79: ; preds = %76
%80 = load i32, i32* %41
%81 = call i64 @mq_receive(i32 %23, i8* %43, i32 %80, i32* null)
%82 = icmp sgt i64 %81, -1
br i1 %82, label %89, label %95
83: ; preds = %76
%84 = load i64, i64* @errno
%85 = call i8* @strerror(i64 %84)
%86 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i8* %85)
%87 = load i32, i32* @EXIT_FAILURE
%88 = call i32 @exit(i32 %87)
unreachable
89: ; preds = %79, %89
%90 = phi i64 [ %93, %89 ], [ %81, %79 ]
%91 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.6, i64 0, i64 0), i64 %90)
%92 = load i32, i32* %41
%93 = call i64 @mq_receive(i32 %23, i8* %43, i32 %92, i32* null)
%94 = icmp sgt i64 %93, -1
br i1 %94, label %89, label %95
95: ; preds = %89, %79
%96 = load i64, i64* @EAGAIN
%97 = load i64, i64* @errno
%98 = icmp eq i64 %96, %97
br i1 %98, label %100, label %99
99: ; preds = %95, %100, %72
br label %67
100: ; preds = %95
%101 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.7, i64 0, i64 0))
br label %99
}