#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 timespec {
  scalar_t__ tv_nsec;
  void *tv_sec;
};
struct mq_attr {
  int mq_maxmsg;
  int mq_msgsize;
  int mq_flags;
  int mq_curmsgs;
};
typedef int ssize_t;
typedef int /*<<< orphan*/ pid_t;
typedef int /*<<< orphan*/ name;
typedef scalar_t__ mqd_t;
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
int /*<<< orphan*/ CLOCK_REALTIME;
scalar_t__ ENAMETOOLONG;
scalar_t__ ETIMEDOUT;
int NAME_MAX;
int O_CREAT;
int O_EXCL;
int O_NONBLOCK;
int /*<<< orphan*/ O_RDONLY;
int O_RDWR;
int /*<<< orphan*/ add_temp_mq(char *);
scalar_t__ clock_gettime(int /*<<< orphan*/, struct timespec *);
scalar_t__ errno;
int getpid();
scalar_t__ memcmp(char *, char *, int);
int /*<<< orphan*/ memset(char *, char, int);
scalar_t__ mq_close(scalar_t__);
scalar_t__ mq_getattr(scalar_t__, struct mq_attr *);
scalar_t__ mq_open(char *, int, int, ...);
int mq_receive(scalar_t__, char *, int, unsigned int *);
scalar_t__ mq_send(scalar_t__, char *, int, int);
int mq_timedreceive(scalar_t__, char *, int, int /*<<< orphan*/ *,
                    struct timespec *);
scalar_t__ mq_timedsend(scalar_t__, char *, int, int, struct timespec *);
scalar_t__ mq_unlink(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ puts(char *);
int snprintf(char *, int, char *, int);
int /*<<< orphan*/ strcpy(char *, char *);
void *time(int /*<<< orphan*/ *);
int do_test(void) {
  int result = 0;
  char name[sizeof "/tst-mqueue4-" + sizeof(pid_t) * 3 + NAME_MAX];
  char *p;
  p = name + snprintf(name, sizeof(name), "/tst-mqueue4-%u", getpid());
  struct mq_attr attr = {.mq_maxmsg = 2, .mq_msgsize = 2};
  mqd_t q = mq_open(name, O_CREAT | O_EXCL | O_RDWR, 0600, &attr);
  if (q == (mqd_t)-1) {
    printf("mq_open failed with: %m\n");
    return result;
  } else
    add_temp_mq(name);
  *p = '.';
  memset(p + 1, 'x', NAME_MAX + 1 - (p - name));
  name[NAME_MAX + 1] = '\0';
  mqd_t q2 = mq_open(name, O_CREAT | O_EXCL | O_RDWR, 0600, &attr);
  if (q2 == (mqd_t)-1) {
    printf("mq_open with NAME_MAX long name compoment failed with: %m\n");
    result = 1;
  }
  if (mq_unlink(name) != 0) {
    printf("mq_unlink failed: %m\n");
    result = 1;
  }
  if (mq_close(q2) != 0) {
    printf("mq_close failed: %m\n");
    result = 1;
  }
  name[NAME_MAX + 1] = 'x';
  name[NAME_MAX + 2] = '\0';
  q2 = mq_open(name, O_CREAT | O_EXCL | O_RDWR, 0600, &attr);
  if (q2 != (mqd_t)-1) {
    puts("mq_open with too long name component unexpectedly succeeded");
    mq_unlink(name);
    mq_close(q2);
    result = 1;
  } else if (errno != ENAMETOOLONG) {
    printf("mq_open with too long name component did not fail with "
           "ENAMETOOLONG: %m\n");
    result = 1;
  }
  if (mq_unlink(name) == 0) {
    puts("mq_unlink with too long name component unexpectedly succeeded");
    result = 1;
  } else if (errno != ENAMETOOLONG) {
    printf("mq_unlink with too long name component did not fail with "
           "ENAMETOOLONG: %m\n");
    result = 1;
  }
  *p = '\0';
  attr.mq_maxmsg = 1;
  attr.mq_msgsize = 3;
  q2 = mq_open(name, O_CREAT | O_RDWR, 0600, &attr);
  if (q2 == (mqd_t)-1) {
    printf("mq_open without O_EXCL failed with %m\n");
    result = 1;
  }
  char buf[3];
  strcpy(buf, "jk");
  if (mq_send(q, buf, 2, 4) != 0) {
    printf("mq_send failed: %m\n");
    result = 1;
  }
  if (mq_send(q, buf + 1, 1, 5) != 0) {
    printf("mq_send failed: %m\n");
    result = 1;
  }
  if (mq_getattr(q2, &attr) != 0) {
    printf("mq_getattr failed: %m\n");
    result = 1;
  }
  if ((attr.mq_flags & O_NONBLOCK) || attr.mq_maxmsg != 2 ||
      attr.mq_msgsize != 2 || attr.mq_curmsgs != 2) {
    printf("mq_getattr returned unexpected { .mq_flags = %ld,\n"
           ".mq_maxmsg = %ld, .mq_msgsize = %ld, .mq_curmsgs = %ld }\n",
           attr.mq_flags, attr.mq_maxmsg, attr.mq_msgsize, attr.mq_curmsgs);
    result = 1;
  }
  struct timespec ts;
  if (clock_gettime(CLOCK_REALTIME, &ts) == 0)
    ++ts.tv_sec;
  else {
    ts.tv_sec = time(NULL) + 1;
    ts.tv_nsec = 0;
  }
  if (mq_timedsend(q2, buf, 1, 1, &ts) == 0) {
    puts("mq_timedsend unexpectedly succeeded");
    result = 1;
  } else if (errno != ETIMEDOUT) {
    printf("mq_timedsend did not fail with ETIMEDOUT: %m\n");
    result = 1;
  }
  if (mq_close(q2) != 0) {
    printf("mq_close failed: %m\n");
    result = 1;
  }
  q2 = mq_open(name, O_RDONLY, 0600);
  if (q2 == (mqd_t)-1) {
    printf("mq_open without O_CREAT failed with %m\n");
    result = 1;
  }
  mqd_t q3 = mq_open(name, O_RDONLY, 0600);
  if (q3 == (mqd_t)-1) {
    printf("mq_open without O_CREAT failed with %m\n");
    result = 1;
  }
  memset(buf, ' ', sizeof(buf));
  unsigned int prio;
  ssize_t rets = mq_receive(q2, buf, 2, &prio);
  if (rets != 1) {
    if (rets == -1)
      printf("mq_receive failed with: %m\n");
    else
      printf("mq_receive returned %zd != 1\n", rets);
    result = 1;
  } else if (prio != 5 || memcmp(buf, "k  ", 3) != 0) {
    printf("mq_receive returned prio %u (2) buf \"%c%c%c\" (\"k  \")\n", prio,
           buf[0], buf[1], buf[2]);
    result = 1;
  }
  if (mq_getattr(q3, &attr) != 0) {
    printf("mq_getattr failed: %m\n");
    result = 1;
  }
  if ((attr.mq_flags & O_NONBLOCK) || attr.mq_maxmsg != 2 ||
      attr.mq_msgsize != 2 || attr.mq_curmsgs != 1) {
    printf("mq_getattr returned unexpected { .mq_flags = %ld,\n"
           ".mq_maxmsg = %ld, .mq_msgsize = %ld, .mq_curmsgs = %ld }\n",
           attr.mq_flags, attr.mq_maxmsg, attr.mq_msgsize, attr.mq_curmsgs);
    result = 1;
  }
  rets = mq_receive(q3, buf, 2, NULL);
  if (rets != 2) {
    if (rets == -1)
      printf("mq_receive failed with: %m\n");
    else
      printf("mq_receive returned %zd != 2\n", rets);
    result = 1;
  } else if (memcmp(buf, "jk ", 3) != 0) {
    printf("mq_receive returned buf \"%c%c%c\" != \"jk \"\n", buf[0], buf[1],
           buf[2]);
    result = 1;
  }
  if (clock_gettime(CLOCK_REALTIME, &ts) == 0)
    ++ts.tv_sec;
  else {
    ts.tv_sec = time(NULL) + 1;
    ts.tv_nsec = 0;
  }
  if (mq_timedreceive(q2, buf, 2, NULL, &ts) != -1) {
    puts("mq_timedreceive on empty queue unexpectedly succeeded");
    result = 1;
  } else if (errno != ETIMEDOUT) {
    printf("mq_timedreceive on empty queue did not fail with "
           "ETIMEDOUT: %m\n");
    result = 1;
  }
  if (mq_unlink(name) != 0) {
    printf("mq_unlink failed: %m\n");
    result = 1;
  }
  if (mq_close(q) != 0) {
    printf("mq_close failed: %m\n");
    result = 1;
  }
  if (mq_close(q2) != 0) {
    printf("mq_close failed: %m\n");
    result = 1;
  }
  if (mq_close(q3) != 0) {
    printf("mq_close failed: %m\n");
    result = 1;
  }
  return result;
}


x86 assembly (clang, -O0):
<do_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x8(%rbp)
mov    0x2d57(%rip),%rax
movslq (%rax),%rdx
mov    %rdx,%rax
add    $0x1a,%rax
mov    %rsp,%rcx
mov    %rcx,-0x10(%rbp)
add    $0x29,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x78(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x18(%rbp)
mov    %eax,-0x7c(%rbp)
mov    $0x0,%al
call   1060 <getpid@plt>
mov    -0x7c(%rbp),%esi
mov    -0x78(%rbp),%rdi
mov    %eax,%ecx
lea    0xd83(%rip),%rdx
call   10a0 <snprintf@plt>
mov    -0x78(%rbp),%rdi
movslq %eax,%rcx
mov    %rdi,%rax
add    %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    0x1176(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0x1173(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0x2d48(%rip),%rax
mov    (%rax),%esi
mov    0x2d07(%rip),%rax
or     (%rax),%esi
mov    0x2d1e(%rip),%rax
or     (%rax),%esi
mov    $0x180,%edx
lea    -0x30(%rbp),%rcx
mov    $0x0,%al
call   10f0 <mq_open@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0xffffffffffffffff,-0x38(%rbp)
jne    1303 <do_test+0xe3>
lea    0xd26(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
movl   $0x1,-0x3c(%rbp)
jmp    1b15 <do_test+0x8f5>
mov    -0x78(%rbp),%rdi
call   1130 <add_temp_mq@plt>
mov    -0x78(%rbp),%rdx
mov    -0x20(%rbp),%rax
movb   $0x2e,(%rax)
mov    -0x20(%rbp),%rdi
add    $0x1,%rdi
mov    0x2c6a(%rip),%rax
mov    (%rax),%eax
add    $0x1,%eax
cltq
mov    -0x20(%rbp),%rcx
sub    %rdx,%rcx
sub    %rcx,%rax
mov    %eax,%edx
mov    $0x78,%esi
call   10b0 <memset@plt>
mov    -0x78(%rbp),%rdi
mov    0x2c42(%rip),%rax
mov    (%rax),%eax
add    $0x1,%eax
cltq
movb   $0x0,(%rdi,%rax,1)
mov    0x2c98(%rip),%rax
mov    (%rax),%esi
mov    0x2c57(%rip),%rax
or     (%rax),%esi
mov    0x2c6e(%rip),%rax
or     (%rax),%esi
mov    $0x180,%edx
lea    -0x30(%rbp),%rcx
mov    $0x0,%al
call   10f0 <mq_open@plt>
mov    %rax,-0x48(%rbp)
cmpq   $0xffffffffffffffff,-0x48(%rbp)
jne    13a8 <do_test+0x188>
lea    0xc8f(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
movl   $0x1,-0x8(%rbp)
mov    -0x78(%rbp),%rdi
call   1120 <mq_unlink@plt>
cmp    $0x0,%rax
je     13d0 <do_test+0x1b0>
lea    0xca2(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
movl   $0x1,-0x8(%rbp)
mov    -0x48(%rbp),%rdi
call   10c0 <mq_close@plt>
cmp    $0x0,%rax
je     13f8 <do_test+0x1d8>
lea    0xc90(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
movl   $0x1,-0x8(%rbp)
mov    -0x78(%rbp),%rdi
mov    0x2b8d(%rip),%rax
mov    (%rax),%eax
add    $0x1,%eax
cltq
movb   $0x78,(%rdi,%rax,1)
mov    0x2b7b(%rip),%rax
mov    (%rax),%eax
add    $0x2,%eax
cltq
movb   $0x0,(%rdi,%rax,1)
mov    0x2bd1(%rip),%rax
mov    (%rax),%esi
mov    0x2b90(%rip),%rax
or     (%rax),%esi
mov    0x2ba7(%rip),%rax
or     (%rax),%esi
mov    $0x180,%edx
lea    -0x30(%rbp),%rcx
mov    $0x0,%al
call   10f0 <mq_open@plt>
mov    %rax,-0x48(%rbp)
cmpq   $0xffffffffffffffff,-0x48(%rbp)
je     1484 <do_test+0x264>
lea    0xc2e(%rip),%rdi
call   1040 <puts@plt>
mov    -0x78(%rbp),%rdi
call   1120 <mq_unlink@plt>
mov    -0x48(%rbp),%rdi
call   10c0 <mq_close@plt>
movl   $0x1,-0x8(%rbp)
jmp    14b8 <do_test+0x298>
mov    0x2b2d(%rip),%rax
mov    (%rax),%rax
mov    0x2b0b(%rip),%rcx
cmp    (%rcx),%rax
je     14b3 <do_test+0x293>
lea    0xc26(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
movl   $0x1,-0x8(%rbp)
jmp    14b8 <do_test+0x298>
mov    -0x78(%rbp),%rdi
call   1120 <mq_unlink@plt>
cmp    $0x0,%rax
jne    14e3 <do_test+0x2c3>
lea    0xc42(%rip),%rdi
call   1040 <puts@plt>
movl   $0x1,-0x8(%rbp)
jmp    1517 <do_test+0x2f7>
mov    0x2ace(%rip),%rax
mov    (%rax),%rax
mov    0x2aac(%rip),%rcx
cmp    (%rcx),%rax
je     1512 <do_test+0x2f2>
lea    0xc4e(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
movl   $0x1,-0x8(%rbp)
jmp    1517 <do_test+0x2f7>
mov    -0x78(%rbp),%rdi
mov    -0x20(%rbp),%rax
movb   $0x0,(%rax)
movl   $0x1,-0x30(%rbp)
movl   $0x3,-0x2c(%rbp)
mov    0x2ac1(%rip),%rax
mov    (%rax),%esi
mov    0x2aa0(%rip),%rax
or     (%rax),%esi
mov    $0x180,%edx
lea    -0x30(%rbp),%rcx
mov    $0x0,%al
call   10f0 <mq_open@plt>
mov    %rax,-0x48(%rbp)
cmpq   $0xffffffffffffffff,-0x48(%rbp)
jne    1576 <do_test+0x356>
lea    0xc35(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
movl   $0x1,-0x8(%rbp)
lea    -0x4b(%rbp),%rdi
lea    0xc43(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x38(%rbp),%rdi
lea    -0x4b(%rbp),%rsi
mov    $0x2,%edx
mov    $0x4,%ecx
call   10d0 <mq_send@plt>
cmp    $0x0,%rax
je     15bc <do_test+0x39c>
lea    0xc19(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
movl   $0x1,-0x8(%rbp)
mov    -0x38(%rbp),%rdi
lea    -0x4b(%rbp),%rsi
add    $0x1,%rsi
mov    $0x1,%edx
mov    $0x5,%ecx
call   10d0 <mq_send@plt>
cmp    $0x0,%rax
je     15f6 <do_test+0x3d6>
lea    0xbdf(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
movl   $0x1,-0x8(%rbp)
mov    -0x48(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1140 <mq_getattr@plt>
cmp    $0x0,%rax
je     1622 <do_test+0x402>
lea    0xbc7(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
movl   $0x1,-0x8(%rbp)
mov    -0x28(%rbp),%eax
mov    0x29ac(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
jne    1655 <do_test+0x435>
cmpl   $0x2,-0x30(%rbp)
jne    1655 <do_test+0x435>
cmpl   $0x2,-0x2c(%rbp)
jne    1655 <do_test+0x435>
cmpl   $0x2,-0x24(%rbp)
je     1677 <do_test+0x457>
mov    -0x28(%rbp),%esi
mov    -0x30(%rbp),%edx
mov    -0x2c(%rbp),%ecx
mov    -0x24(%rbp),%r8d
lea    0xb89(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
movl   $0x1,-0x8(%rbp)
mov    0x292a(%rip),%rax
mov    (%rax),%edi
lea    -0x60(%rbp),%rsi
call   1050 <clock_gettime@plt>
cmp    $0x0,%rax
jne    16a4 <do_test+0x484>
mov    -0x58(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x58(%rbp)
jmp    16bd <do_test+0x49d>
xor    %eax,%eax
mov    %eax,%edi
call   1100 <time@plt>
add    $0x1,%rax
mov    %rax,-0x58(%rbp)
movq   $0x0,-0x60(%rbp)
mov    -0x48(%rbp),%rdi
lea    -0x4b(%rbp),%rsi
mov    $0x1,%ecx
lea    -0x60(%rbp),%r8
mov    %ecx,%edx
call   1080 <mq_timedsend@plt>
cmp    $0x0,%rax
jne    16f7 <do_test+0x4d7>
lea    0xb78(%rip),%rdi
call   1040 <puts@plt>
movl   $0x1,-0x8(%rbp)
jmp    172b <do_test+0x50b>
mov    0x28ba(%rip),%rax
mov    (%rax),%rax
mov    0x28a8(%rip),%rcx
cmp    (%rcx),%rax
je     1726 <do_test+0x506>
lea    0xb6a(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
movl   $0x1,-0x8(%rbp)
jmp    172b <do_test+0x50b>
mov    -0x48(%rbp),%rdi
call   10c0 <mq_close@plt>
cmp    $0x0,%rax
je     1753 <do_test+0x533>
lea    0x935(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
movl   $0x1,-0x8(%rbp)
mov    -0x78(%rbp),%rdi
mov    0x2872(%rip),%rax
mov    (%rax),%esi
mov    $0x180,%edx
mov    $0x0,%al
call   10f0 <mq_open@plt>
mov    %rax,-0x48(%rbp)
cmpq   $0xffffffffffffffff,-0x48(%rbp)
jne    1790 <do_test+0x570>
lea    0xb2e(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
movl   $0x1,-0x8(%rbp)
mov    -0x78(%rbp),%rdi
mov    0x2835(%rip),%rax
mov    (%rax),%esi
mov    $0x180,%edx
mov    $0x0,%al
call   10f0 <mq_open@plt>
mov    %rax,-0x68(%rbp)
cmpq   $0xffffffffffffffff,-0x68(%rbp)
jne    17cd <do_test+0x5ad>
lea    0xaf1(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
movl   $0x1,-0x8(%rbp)
lea    -0x4b(%rbp),%rdi
mov    $0x20,%esi
mov    $0x3,%edx
call   10b0 <memset@plt>
mov    -0x48(%rbp),%rdi
lea    -0x4b(%rbp),%rsi
mov    $0x2,%edx
lea    -0x6c(%rbp),%rcx
call   1110 <mq_receive@plt>
mov    %eax,-0x70(%rbp)
cmpl   $0x1,-0x70(%rbp)
je     183d <do_test+0x61d>
cmpl   $0xffffffff,-0x70(%rbp)
jne    1820 <do_test+0x600>
lea    0xac4(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
jmp    1831 <do_test+0x611>
mov    -0x70(%rbp),%esi
lea    0xaca(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
movl   $0x1,-0x8(%rbp)
jmp    1890 <do_test+0x670>
cmpl   $0x5,-0x6c(%rbp)
jne    1866 <do_test+0x646>
lea    -0x4b(%rbp),%rdi
lea    0xac0(%rip),%rsi
mov    $0x3,%edx
call   10e0 <memcmp@plt>
cmp    $0x0,%rax
je     188b <do_test+0x66b>
mov    -0x6c(%rbp),%esi
movsbl -0x4b(%rbp),%edx
movsbl -0x4a(%rbp),%ecx
movsbl -0x49(%rbp),%r8d
lea    0xa99(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
movl   $0x1,-0x8(%rbp)
jmp    1890 <do_test+0x670>
mov    -0x68(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1140 <mq_getattr@plt>
cmp    $0x0,%rax
je     18bc <do_test+0x69c>
lea    0x92d(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
movl   $0x1,-0x8(%rbp)
mov    -0x28(%rbp),%eax
mov    0x2712(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
jne    18ef <do_test+0x6cf>
cmpl   $0x2,-0x30(%rbp)
jne    18ef <do_test+0x6cf>
cmpl   $0x2,-0x2c(%rbp)
jne    18ef <do_test+0x6cf>
cmpl   $0x1,-0x24(%rbp)
je     1911 <do_test+0x6f1>
mov    -0x28(%rbp),%esi
mov    -0x30(%rbp),%edx
mov    -0x2c(%rbp),%ecx
mov    -0x24(%rbp),%r8d
lea    0x8ef(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
movl   $0x1,-0x8(%rbp)
mov    -0x68(%rbp),%rdi
lea    -0x4b(%rbp),%rsi
mov    $0x2,%edx
xor    %eax,%eax
mov    %eax,%ecx
call   1110 <mq_receive@plt>
mov    %eax,-0x70(%rbp)
cmpl   $0x2,-0x70(%rbp)
je     196e <do_test+0x74e>
cmpl   $0xffffffff,-0x70(%rbp)
jne    1951 <do_test+0x731>
lea    0x993(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
jmp    1962 <do_test+0x742>
mov    -0x70(%rbp),%esi
lea    0x9f1(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
movl   $0x1,-0x8(%rbp)
jmp    19b3 <do_test+0x793>
lea    -0x4b(%rbp),%rdi
lea    0x9f1(%rip),%rsi
mov    $0x3,%edx
call   10e0 <memcmp@plt>
cmp    $0x0,%rax
je     19ae <do_test+0x78e>
movsbl -0x4b(%rbp),%esi
movsbl -0x4a(%rbp),%edx
movsbl -0x49(%rbp),%ecx
lea    0x9ce(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
movl   $0x1,-0x8(%rbp)
jmp    19b3 <do_test+0x793>
mov    0x25ee(%rip),%rax
mov    (%rax),%edi
lea    -0x60(%rbp),%rsi
call   1050 <clock_gettime@plt>
cmp    $0x0,%rax
jne    19e0 <do_test+0x7c0>
mov    -0x58(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x58(%rbp)
jmp    19f9 <do_test+0x7d9>
xor    %eax,%eax
mov    %eax,%edi
call   1100 <time@plt>
add    $0x1,%rax
mov    %rax,-0x58(%rbp)
movq   $0x0,-0x60(%rbp)
mov    -0x48(%rbp),%rdi
lea    -0x4b(%rbp),%rsi
mov    $0x2,%edx
xor    %eax,%eax
mov    %eax,%ecx
lea    -0x60(%rbp),%r8
call   1070 <mq_timedreceive@plt>
cmp    $0xffffffff,%eax
je     1a34 <do_test+0x814>
lea    0x976(%rip),%rdi
call   1040 <puts@plt>
movl   $0x1,-0x8(%rbp)
jmp    1a68 <do_test+0x848>
mov    0x257d(%rip),%rax
mov    (%rax),%rax
mov    0x256b(%rip),%rcx
cmp    (%rcx),%rax
je     1a63 <do_test+0x843>
lea    0x97a(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
movl   $0x1,-0x8(%rbp)
jmp    1a68 <do_test+0x848>
mov    -0x78(%rbp),%rdi
call   1120 <mq_unlink@plt>
cmp    $0x0,%rax
je     1a90 <do_test+0x870>
lea    0x5e2(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
movl   $0x1,-0x8(%rbp)
mov    -0x38(%rbp),%rdi
call   10c0 <mq_close@plt>
cmp    $0x0,%rax
je     1ab8 <do_test+0x898>
lea    0x5d0(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
movl   $0x1,-0x8(%rbp)
mov    -0x48(%rbp),%rdi
call   10c0 <mq_close@plt>
cmp    $0x0,%rax
je     1ae0 <do_test+0x8c0>
lea    0x5a8(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
movl   $0x1,-0x8(%rbp)
mov    -0x68(%rbp),%rdi
call   10c0 <mq_close@plt>
cmp    $0x0,%rax
je     1b08 <do_test+0x8e8>
lea    0x580(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
movl   $0x1,-0x3c(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_test>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    0x2d58(%rip),%r13
movslq 0x0(%r13),%rax
lea    0x1a(%rax),%r15d
mov    %rsp,%rbx
add    $0x29,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
xor    %eax,%eax
call   1060 <getpid@plt>
lea    0xda1(%rip),%rdx
mov    %rbx,%rdi
mov    %r15d,%esi
mov    %eax,%ecx
call   10a0 <snprintf@plt>
mov    %eax,%r15d
movups 0x119a(%rip),%xmm0
mov    0x2d7b(%rip),%r12
mov    0x2d3c(%rip),%rax
mov    (%rax),%esi
or     (%r12),%esi
movaps %xmm0,-0x40(%rbp)
mov    0x2d4b(%rip),%rax
or     (%rax),%esi
lea    -0x40(%rbp),%rcx
mov    %rbx,%rdi
mov    $0x180,%edx
xor    %eax,%eax
call   10f0 <mq_open@plt>
mov    %rax,-0x60(%rbp)
cmp    $0xffffffffffffffff,%rax
je     13ed <do_test+0x1cd>
movslq %r15d,%r14
lea    (%rbx,%r14,1),%r15
mov    %rbx,%rdi
call   1130 <add_temp_mq@plt>
movb   $0x2e,(%r15)
mov    %r15,-0x68(%rbp)
lea    0x1(%r15),%rdi
mov    %rbx,%r15
mov    0x0(%r13),%edx
sub    %r14d,%edx
xor    %r14d,%r14d
add    $0x1,%edx
mov    $0x78,%esi
call   10b0 <memset@plt>
movslq 0x0(%r13),%rax
mov    0x2cc8(%rip),%r13
movb   $0x0,0x1(%rax,%rbx,1)
mov    0x0(%r13),%esi
or     (%r12),%esi
mov    0x2cd4(%rip),%r12
or     (%r12),%esi
lea    -0x40(%rbp),%rcx
mov    %rbx,%rdi
mov    $0x180,%edx
xor    %eax,%eax
call   10f0 <mq_open@plt>
mov    %rax,%rbx
cmp    $0xffffffffffffffff,%rax
jne    1340 <do_test+0x120>
lea    0xcf6(%rip),%rdi
xor    %eax,%eax
call   1090 <printf@plt>
mov    $0x1,%r14d
mov    %r15,%rdi
call   1120 <mq_unlink@plt>
test   %rax,%rax
je     1361 <do_test+0x141>
lea    0xd10(%rip),%rdi
xor    %eax,%eax
call   1090 <printf@plt>
mov    $0x1,%r14d
mov    %rbx,%rdi
call   10c0 <mq_close@plt>
test   %rax,%rax
je     1382 <do_test+0x162>
lea    0xd05(%rip),%rdi
xor    %eax,%eax
call   1090 <printf@plt>
mov    $0x1,%r14d
mov    0x2c07(%rip),%rax
movslq (%rax),%rax
movw   $0x78,0x1(%rax,%r15,1)
mov    0x0(%r13),%esi
mov    0x2c59(%rip),%rax
or     (%rax),%esi
or     (%r12),%esi
lea    -0x40(%rbp),%rcx
mov    %r15,%rdi
mov    $0x180,%edx
xor    %eax,%eax
call   10f0 <mq_open@plt>
cmp    $0xffffffffffffffff,%rax
je     1403 <do_test+0x1e3>
mov    %rax,%rbx
lea    0xcc7(%rip),%rdi
call   1040 <puts@plt>
mov    %r15,%rdi
call   1120 <mq_unlink@plt>
mov    %rbx,%rdi
call   10c0 <mq_close@plt>
mov    $0x1,%r14d
mov    -0x60(%rbp),%r13
mov    -0x68(%rbp),%rbx
jmp    1435 <do_test+0x215>
lea    0xc1c(%rip),%rdi
xor    %r14d,%r14d
xor    %eax,%eax
call   1090 <printf@plt>
jmp    192d <do_test+0x70d>
mov    0x2bae(%rip),%rax
mov    (%rax),%rax
mov    0x2b8c(%rip),%rcx
cmp    (%rcx),%rax
mov    -0x60(%rbp),%r13
mov    -0x68(%rbp),%rbx
je     1435 <do_test+0x215>
lea    0xca3(%rip),%rdi
xor    %eax,%eax
call   1090 <printf@plt>
mov    $0x1,%r14d
mov    %r15,%rdi
call   1120 <mq_unlink@plt>
test   %rax,%rax
je     1468 <do_test+0x248>
mov    0x2b6f(%rip),%rax
mov    (%rax),%rax
mov    0x2b4d(%rip),%rcx
cmp    (%rcx),%rax
je     147a <do_test+0x25a>
lea    0xcf3(%rip),%rdi
xor    %eax,%eax
call   1090 <printf@plt>
jmp    1474 <do_test+0x254>
lea    0xca5(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%r14d
movb   $0x0,(%rbx)
movabs $0x300000001,%rax
mov    %rax,-0x40(%rbp)
mov    (%r12),%esi
mov    0x2b62(%rip),%rax
or     (%rax),%esi
lea    -0x40(%rbp),%rcx
mov    %r15,%rdi
mov    $0x180,%edx
xor    %eax,%eax
call   10f0 <mq_open@plt>
mov    %rax,%r12
cmp    $0xffffffffffffffff,%rax
jne    14c8 <do_test+0x2a8>
lea    0xce2(%rip),%rdi
xor    %eax,%eax
call   1090 <printf@plt>
mov    $0x1,%r14d
lea    0xcf5(%rip),%rsi
lea    -0x2b(%rbp),%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
mov    $0x2,%edx
mov    $0x4,%ecx
call   10d0 <mq_send@plt>
test   %rax,%rax
je     1509 <do_test+0x2e9>
lea    0xccb(%rip),%rdi
xor    %eax,%eax
call   1090 <printf@plt>
mov    $0x1,%r14d
lea    -0x2a(%rbp),%rsi
mov    %r13,%rdi
mov    $0x1,%edx
mov    $0x5,%ecx
call   10d0 <mq_send@plt>
test   %rax,%rax
je     1538 <do_test+0x318>
lea    0xc9c(%rip),%rdi
xor    %eax,%eax
call   1090 <printf@plt>
mov    $0x1,%r14d
lea    -0x40(%rbp),%rsi
mov    %r12,%rdi
call   1140 <mq_getattr@plt>
test   %rax,%rax
je     155d <do_test+0x33d>
lea    0xc8b(%rip),%rdi
xor    %eax,%eax
call   1090 <printf@plt>
mov    $0x1,%r14d
mov    -0x38(%rbp),%esi
mov    0x2a71(%rip),%rax
mov    -0x40(%rbp),%edx
mov    -0x3c(%rbp),%ecx
mov    -0x34(%rbp),%r8d
test   %esi,(%rax)
jne    1585 <do_test+0x365>
cmp    $0x2,%edx
jne    1585 <do_test+0x365>
cmp    $0x2,%ecx
jne    1585 <do_test+0x365>
cmp    $0x2,%r8d
je     1599 <do_test+0x379>
lea    0xc66(%rip),%rdi
xor    %eax,%eax
call   1090 <printf@plt>
mov    $0x1,%r14d
mov    0x2a08(%rip),%rax
mov    (%rax),%edi
lea    -0x58(%rbp),%rsi
call   1050 <clock_gettime@plt>
test   %rax,%rax
je     15c9 <do_test+0x3a9>
xor    %edi,%edi
call   1100 <time@plt>
add    $0x1,%rax
mov    %rax,-0x50(%rbp)
movq   $0x0,-0x58(%rbp)
jmp    15ce <do_test+0x3ae>
addq   $0x1,-0x50(%rbp)
lea    -0x2b(%rbp),%rsi
lea    -0x58(%rbp),%r8
mov    %r12,%rdi
mov    $0x1,%edx
mov    $0x1,%ecx
call   1080 <mq_timedsend@plt>
test   %rax,%rax
je     1613 <do_test+0x3f3>
mov    0x29c4(%rip),%rax
mov    (%rax),%rax
mov    0x29b2(%rip),%rcx
cmp    (%rcx),%rax
je     1625 <do_test+0x405>
lea    0xc78(%rip),%rdi
xor    %eax,%eax
call   1090 <printf@plt>
jmp    161f <do_test+0x3ff>
lea    0xc44(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%r14d
mov    %r12,%rdi
call   10c0 <mq_close@plt>
test   %rax,%rax
je     1646 <do_test+0x426>
lea    0xa41(%rip),%rdi
xor    %eax,%eax
call   1090 <printf@plt>
mov    $0x1,%r14d
mov    0x2983(%rip),%rbx
mov    (%rbx),%esi
mov    %r15,%rdi
mov    $0x180,%edx
xor    %eax,%eax
call   10f0 <mq_open@plt>
mov    %rax,%r12
cmp    $0xffffffffffffffff,%rax
jne    167b <do_test+0x45b>
lea    0xc42(%rip),%rdi
xor    %eax,%eax
call   1090 <printf@plt>
mov    $0x1,%r14d
mov    (%rbx),%esi
mov    %r15,%rdi
mov    $0x180,%edx
xor    %eax,%eax
call   10f0 <mq_open@plt>
mov    %rax,%r13
cmp    $0xffffffffffffffff,%rax
jne    16a9 <do_test+0x489>
lea    0xc14(%rip),%rdi
xor    %eax,%eax
call   1090 <printf@plt>
mov    $0x1,%r14d
lea    -0x2b(%rbp),%rbx
mov    %rbx,%rdi
mov    $0x20,%esi
mov    $0x3,%edx
call   10b0 <memset@plt>
lea    -0x44(%rbp),%rcx
mov    %r12,%rdi
mov    %rbx,%rsi
mov    $0x2,%edx
call   1110 <mq_receive@plt>
cmp    $0x1,%eax
je     16ed <do_test+0x4cd>
cmp    $0xffffffff,%eax
jne    172f <do_test+0x50f>
lea    0xbf4(%rip),%rdi
xor    %eax,%eax
call   1090 <printf@plt>
jmp    173f <do_test+0x51f>
mov    -0x44(%rbp),%esi
cmp    $0x5,%esi
jne    1712 <do_test+0x4f2>
lea    0xc16(%rip),%rsi
lea    -0x2b(%rbp),%rdi
mov    $0x3,%edx
call   10e0 <memcmp@plt>
test   %rax,%rax
je     1745 <do_test+0x525>
mov    -0x44(%rbp),%esi
movsbl -0x2b(%rbp),%edx
movsbl -0x2a(%rbp),%ecx
movsbl -0x29(%rbp),%r8d
lea    0xbf0(%rip),%rdi
xor    %eax,%eax
call   1090 <printf@plt>
jmp    173f <do_test+0x51f>
lea    0xbbe(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1090 <printf@plt>
mov    $0x1,%r14d
lea    -0x40(%rbp),%rsi
mov    %r13,%rdi
call   1140 <mq_getattr@plt>
test   %rax,%rax
je     176a <do_test+0x54a>
lea    0xa7e(%rip),%rdi
xor    %eax,%eax
call   1090 <printf@plt>
mov    $0x1,%r14d
mov    -0x38(%rbp),%esi
mov    -0x40(%rbp),%edx
mov    -0x3c(%rbp),%ecx
mov    -0x34(%rbp),%r8d
mov    0x285a(%rip),%rax
test   %esi,(%rax)
jne    1792 <do_test+0x572>
cmp    $0x2,%edx
jne    1792 <do_test+0x572>
cmp    $0x2,%ecx
jne    1792 <do_test+0x572>
cmp    $0x1,%r8d
je     17a6 <do_test+0x586>
lea    0xa59(%rip),%rdi
xor    %eax,%eax
call   1090 <printf@plt>
mov    $0x1,%r14d
lea    -0x2b(%rbp),%rsi
mov    %r13,%rdi
mov    $0x2,%edx
xor    %ecx,%ecx
call   1110 <mq_receive@plt>
cmp    $0x2,%eax
je     17d3 <do_test+0x5b3>
cmp    $0xffffffff,%eax
jne    1809 <do_test+0x5e9>
lea    0xb0e(%rip),%rdi
xor    %eax,%eax
call   1090 <printf@plt>
jmp    1819 <do_test+0x5f9>
lea    0xb90(%rip),%rsi
lea    -0x2b(%rbp),%rdi
mov    $0x3,%edx
call   10e0 <memcmp@plt>
test   %rax,%rax
je     181f <do_test+0x5ff>
movsbl -0x2b(%rbp),%esi
movsbl -0x2a(%rbp),%edx
movsbl -0x29(%rbp),%ecx
lea    0xb6e(%rip),%rdi
xor    %eax,%eax
call   1090 <printf@plt>
jmp    1819 <do_test+0x5f9>
lea    0xb3c(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1090 <printf@plt>
mov    $0x1,%r14d
mov    0x2782(%rip),%rax
mov    (%rax),%edi
lea    -0x58(%rbp),%rsi
call   1050 <clock_gettime@plt>
test   %rax,%rax
je     184f <do_test+0x62f>
xor    %edi,%edi
call   1100 <time@plt>
add    $0x1,%rax
mov    %rax,-0x50(%rbp)
movq   $0x0,-0x58(%rbp)
jmp    1854 <do_test+0x634>
addq   $0x1,-0x50(%rbp)
lea    -0x2b(%rbp),%rsi
lea    -0x58(%rbp),%r8
mov    %r12,%rdi
mov    $0x2,%edx
xor    %ecx,%ecx
call   1070 <mq_timedreceive@plt>
cmp    $0xffffffff,%eax
je     187e <do_test+0x65e>
lea    0xb22(%rip),%rdi
call   1040 <puts@plt>
jmp    18a2 <do_test+0x682>
mov    0x2733(%rip),%rax
mov    (%rax),%rax
mov    0x2721(%rip),%rcx
cmp    (%rcx),%rax
je     18a8 <do_test+0x688>
lea    0xb34(%rip),%rdi
xor    %eax,%eax
call   1090 <printf@plt>
mov    $0x1,%r14d
mov    %r15,%rdi
call   1120 <mq_unlink@plt>
test   %rax,%rax
je     18c9 <do_test+0x6a9>
lea    0x7a8(%rip),%rdi
xor    %eax,%eax
call   1090 <printf@plt>
mov    $0x1,%r14d
mov    -0x60(%rbp),%rdi
call   10c0 <mq_close@plt>
test   %rax,%rax
je     18eb <do_test+0x6cb>
lea    0x79c(%rip),%rdi
xor    %eax,%eax
call   1090 <printf@plt>
mov    $0x1,%r14d
mov    %r12,%rdi
call   10c0 <mq_close@plt>
test   %rax,%rax
je     190c <do_test+0x6ec>
lea    0x77b(%rip),%rdi
xor    %eax,%eax
call   1090 <printf@plt>
mov    $0x1,%r14d
mov    %r13,%rdi
call   10c0 <mq_close@plt>
test   %rax,%rax
je     192d <do_test+0x70d>
lea    0x75a(%rip),%rdi
xor    %eax,%eax
call   1090 <printf@plt>
mov    $0x1,%r14d
mov    %r14d,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.mq_attr = type { i32, i32, i32, i32 }
%struct.timespec = type { i64, i8* }
@NAME_MAX = global i32 0
@.str = [16 x i8] c"/tst-mqueue4-%u\00"
@__const.do_test.attr = %struct.mq_attr { i32 2, i32 2, i32 0, i32 0 }
@O_CREAT = global i32 0
@O_EXCL = global i32 0
@O_RDWR = global i32 0
@.str.1 = [25 x i8] c"mq_open failed with: %m\0A\00"
@.str.2 = [59 x i8] c"mq_open with NAME_MAX long name compoment failed with: %m\0A\00"
@.str.3 = [22 x i8] c"mq_unlink failed: %m\0A\00"
@.str.4 = [21 x i8] c"mq_close failed: %m\0A\00"
@.str.5 = [60 x i8] c"mq_open with too long name component unexpectedly succeeded\00"
@errno = global i64 0
@ENAMETOOLONG = global i64 0
@.str.6 = [73 x i8] c"mq_open with too long name component did not fail with ENAMETOOLONG: %m\0A\00"
@.str.7 = [62 x i8] c"mq_unlink with too long name component unexpectedly succeeded\00"
@.str.8 = [75 x i8] c"mq_unlink with too long name component did not fail with ENAMETOOLONG: %m\0A\00"
@.str.9 = [39 x i8] c"mq_open without O_EXCL failed with %m\0A\00"
@.str.10 = [3 x i8] c"jk\00"
@.str.11 = [20 x i8] c"mq_send failed: %m\0A\00"
@.str.12 = [23 x i8] c"mq_getattr failed: %m\0A\00"
@O_NONBLOCK = global i32 0
@.str.13 = [108 x i8] c"mq_getattr returned unexpected { .mq_flags = %ld,\0A.mq_maxmsg = %ld, .mq_msgsize = %ld, .mq_curmsgs = %ld }\0A\00"
@CLOCK_REALTIME = global i32 0
@.str.14 = [36 x i8] c"mq_timedsend unexpectedly succeeded\00"
@ETIMEDOUT = global i64 0
@.str.15 = [46 x i8] c"mq_timedsend did not fail with ETIMEDOUT: %m\0A\00"
@O_RDONLY = global i32 0
@.str.16 = [40 x i8] c"mq_open without O_CREAT failed with %m\0A\00"
@.str.17 = [28 x i8] c"mq_receive failed with: %m\0A\00"
@.str.18 = [30 x i8] c"mq_receive returned %zd != 1\0A\00"
@.str.19 = [4 x i8] c"k \00"
@.str.20 = [54 x i8] c"mq_receive returned prio %u (2) buf \22%c%c%c\22 (\22k \22)\0A\00"
@.str.21 = [30 x i8] c"mq_receive returned %zd != 2\0A\00"
@.str.22 = [4 x i8] c"jk \00"
@.str.23 = [43 x i8] c"mq_receive returned buf \22%c%c%c\22 != \22jk \22\0A\00"
@.str.24 = [54 x i8] c"mq_timedreceive on empty queue unexpectedly succeeded\00"
@.str.25 = [64 x i8] c"mq_timedreceive on empty queue did not fail with ETIMEDOUT: %m\0A\00"
define i32 @do_test() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8*
%6 = alloca %struct.mq_attr
%7 = alloca i64
%8 = alloca i32
%9 = alloca i64
%10 = alloca [3 x i8]
%11 = alloca %struct.timespec
%12 = alloca i64
%13 = alloca i32
%14 = alloca i32
store i32 0, i32* %2
%15 = load i32, i32* @NAME_MAX
%16 = sext i32 %15 to i64
%17 = add i64 26, %16
%18 = call i8* @llvm.stacksave()
store i8* %18, i8** %3
%19 = alloca i8, i64 %17
store i64 %17, i64* %4
%20 = trunc i64 %17 to i32
%21 = call i32 (...) @getpid()
%22 = call i32 @snprintf(i8* %19, i32 %20, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %21)
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i8, i8* %19, i64 %23
store i8* %24, i8** %5
%25 = bitcast %struct.mq_attr* %6 to i8*
%26 = load i32, i32* @O_CREAT
%27 = load i32, i32* @O_EXCL
%28 = or i32 %26, %27
%29 = load i32, i32* @O_RDWR
%30 = or i32 %28, %29
%31 = call i64 (i8*, i32, i32, ...) @mq_open(i8* %19, i32 %30, i32 384, %struct.mq_attr* %6)
store i64 %31, i64* %7
%32 = load i64, i64* %7
%33 = icmp eq i64 %32, -1
br i1 %33, label %34, label %37
34: ; preds = %0
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
%36 = load i32, i32* %2
store i32 %36, i32* %1
store i32 1, i32* %8
br label %383
37: ; preds = %0
%38 = call i32 @add_temp_mq(i8* %19)
br label %39
39: ; preds = %37
%40 = load i8*, i8** %5
store i8 46, i8* %40
%41 = load i8*, i8** %5
%42 = getelementptr inbounds i8, i8* %41, i64 1
%43 = load i32, i32* @NAME_MAX
%44 = add nsw i32 %43, 1
%45 = sext i32 %44 to i64
%46 = load i8*, i8** %5
%47 = ptrtoint i8* %46 to i64
%48 = ptrtoint i8* %19 to i64
%49 = sub i64 %47, %48
%50 = sub nsw i64 %45, %49
%51 = trunc i64 %50 to i32
%52 = call i32 @memset(i8* %42, i8 signext 120, i32 %51)
%53 = load i32, i32* @NAME_MAX
%54 = add nsw i32 %53, 1
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds i8, i8* %19, i64 %55
store i8 0, i8* %56
%57 = load i32, i32* @O_CREAT
%58 = load i32, i32* @O_EXCL
%59 = or i32 %57, %58
%60 = load i32, i32* @O_RDWR
%61 = or i32 %59, %60
%62 = call i64 (i8*, i32, i32, ...) @mq_open(i8* %19, i32 %61, i32 384, %struct.mq_attr* %6)
store i64 %62, i64* %9
%63 = load i64, i64* %9
%64 = icmp eq i64 %63, -1
br i1 %64, label %65, label %67
65: ; preds = %39
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %2
br label %67
67: ; preds = %65, %39
%68 = call i64 @mq_unlink(i8* %19)
%69 = icmp ne i64 %68, 0
br i1 %69, label %70, label %72
70: ; preds = %67
%71 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
store i32 1, i32* %2
br label %72
72: ; preds = %70, %67
%73 = load i64, i64* %9
%74 = call i64 @mq_close(i64 %73)
%75 = icmp ne i64 %74, 0
br i1 %75, label %76, label %78
76: ; preds = %72
%77 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
store i32 1, i32* %2
br label %78
78: ; preds = %76, %72
%79 = load i32, i32* @NAME_MAX
%80 = add nsw i32 %79, 1
%81 = sext i32 %80 to i64
%82 = getelementptr inbounds i8, i8* %19, i64 %81
store i8 120, i8* %82
%83 = load i32, i32* @NAME_MAX
%84 = add nsw i32 %83, 2
%85 = sext i32 %84 to i64
%86 = getelementptr inbounds i8, i8* %19, i64 %85
store i8 0, i8* %86
%87 = load i32, i32* @O_CREAT
%88 = load i32, i32* @O_EXCL
%89 = or i32 %87, %88
%90 = load i32, i32* @O_RDWR
%91 = or i32 %89, %90
%92 = call i64 (i8*, i32, i32, ...) @mq_open(i8* %19, i32 %91, i32 384, %struct.mq_attr* %6)
store i64 %92, i64* %9
%93 = load i64, i64* %9
%94 = icmp ne i64 %93, -1
br i1 %94, label %95, label %100
95: ; preds = %78
%96 = call i32 @puts(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.5, i64 0, i64 0))
%97 = call i64 @mq_unlink(i8* %19)
%98 = load i64, i64* %9
%99 = call i64 @mq_close(i64 %98)
store i32 1, i32* %2
br label %107
100: ; preds = %78
%101 = load i64, i64* @errno
%102 = load i64, i64* @ENAMETOOLONG
%103 = icmp ne i64 %101, %102
br i1 %103, label %104, label %106
104: ; preds = %100
%105 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str.6, i64 0, i64 0))
store i32 1, i32* %2
br label %106
106: ; preds = %104, %100
br label %107
107: ; preds = %106, %95
%108 = call i64 @mq_unlink(i8* %19)
%109 = icmp eq i64 %108, 0
br i1 %109, label %110, label %112
110: ; preds = %107
%111 = call i32 @puts(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.7, i64 0, i64 0))
store i32 1, i32* %2
br label %119
112: ; preds = %107
%113 = load i64, i64* @errno
%114 = load i64, i64* @ENAMETOOLONG
%115 = icmp ne i64 %113, %114
br i1 %115, label %116, label %118
116: ; preds = %112
%117 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str.8, i64 0, i64 0))
store i32 1, i32* %2
br label %118
118: ; preds = %116, %112
br label %119
119: ; preds = %118, %110
%120 = load i8*, i8** %5
store i8 0, i8* %120
%121 = getelementptr inbounds %struct.mq_attr, %struct.mq_attr* %6, i32 0, i32 0
store i32 1, i32* %121
%122 = getelementptr inbounds %struct.mq_attr, %struct.mq_attr* %6, i32 0, i32 1
store i32 3, i32* %122
%123 = load i32, i32* @O_CREAT
%124 = load i32, i32* @O_RDWR
%125 = or i32 %123, %124
%126 = call i64 (i8*, i32, i32, ...) @mq_open(i8* %19, i32 %125, i32 384, %struct.mq_attr* %6)
store i64 %126, i64* %9
%127 = load i64, i64* %9
%128 = icmp eq i64 %127, -1
br i1 %128, label %129, label %131
129: ; preds = %119
%130 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.9, i64 0, i64 0))
store i32 1, i32* %2
br label %131
131: ; preds = %129, %119
%132 = getelementptr inbounds [3 x i8], [3 x i8]* %10, i64 0, i64 0
%133 = call i32 @strcpy(i8* %132, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0))
%134 = load i64, i64* %7
%135 = getelementptr inbounds [3 x i8], [3 x i8]* %10, i64 0, i64 0
%136 = call i64 @mq_send(i64 %134, i8* %135, i32 2, i32 4)
%137 = icmp ne i64 %136, 0
br i1 %137, label %138, label %140
138: ; preds = %131
%139 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.11, i64 0, i64 0))
store i32 1, i32* %2
br label %140
140: ; preds = %138, %131
%141 = load i64, i64* %7
%142 = getelementptr inbounds [3 x i8], [3 x i8]* %10, i64 0, i64 0
%143 = getelementptr inbounds i8, i8* %142, i64 1
%144 = call i64 @mq_send(i64 %141, i8* %143, i32 1, i32 5)
%145 = icmp ne i64 %144, 0
br i1 %145, label %146, label %148
146: ; preds = %140
%147 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.11, i64 0, i64 0))
store i32 1, i32* %2
br label %148
148: ; preds = %146, %140
%149 = load i64, i64* %9
%150 = call i64 @mq_getattr(i64 %149, %struct.mq_attr* %6)
%151 = icmp ne i64 %150, 0
br i1 %151, label %152, label %154
152: ; preds = %148
%153 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.12, i64 0, i64 0))
store i32 1, i32* %2
br label %154
154: ; preds = %152, %148
%155 = getelementptr inbounds %struct.mq_attr, %struct.mq_attr* %6, i32 0, i32 2
%156 = load i32, i32* %155
%157 = load i32, i32* @O_NONBLOCK
%158 = and i32 %156, %157
%159 = icmp ne i32 %158, 0
br i1 %159, label %172, label %160
160: ; preds = %154
%161 = getelementptr inbounds %struct.mq_attr, %struct.mq_attr* %6, i32 0, i32 0
%162 = load i32, i32* %161
%163 = icmp ne i32 %162, 2
br i1 %163, label %172, label %164
164: ; preds = %160
%165 = getelementptr inbounds %struct.mq_attr, %struct.mq_attr* %6, i32 0, i32 1
%166 = load i32, i32* %165
%167 = icmp ne i32 %166, 2
br i1 %167, label %172, label %168
168: ; preds = %164
%169 = getelementptr inbounds %struct.mq_attr, %struct.mq_attr* %6, i32 0, i32 3
%170 = load i32, i32* %169
%171 = icmp ne i32 %170, 2
br i1 %171, label %172, label %182
172: ; preds = %168, %164, %160, %154
%173 = getelementptr inbounds %struct.mq_attr, %struct.mq_attr* %6, i32 0, i32 2
%174 = load i32, i32* %173
%175 = getelementptr inbounds %struct.mq_attr, %struct.mq_attr* %6, i32 0, i32 0
%176 = load i32, i32* %175
%177 = getelementptr inbounds %struct.mq_attr, %struct.mq_attr* %6, i32 0, i32 1
%178 = load i32, i32* %177
%179 = getelementptr inbounds %struct.mq_attr, %struct.mq_attr* %6, i32 0, i32 3
%180 = load i32, i32* %179
%181 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([108 x i8], [108 x i8]* @.str.13, i64 0, i64 0), i32 %174, i32 %176, i32 %178, i32 %180)
store i32 1, i32* %2
br label %182
182: ; preds = %172, %168
%183 = load i32, i32* @CLOCK_REALTIME
%184 = call i64 @clock_gettime(i32 %183, %struct.timespec* %11)
%185 = icmp eq i64 %184, 0
br i1 %185, label %186, label %190
186: ; preds = %182
%187 = getelementptr inbounds %struct.timespec, %struct.timespec* %11, i32 0, i32 1
%188 = load i8*, i8** %187
%189 = getelementptr inbounds i8, i8* %188, i32 1
store i8* %189, i8** %187
br label %195
190: ; preds = %182
%191 = call i8* @time(i32* null)
%192 = getelementptr i8, i8* %191, i64 1
%193 = getelementptr inbounds %struct.timespec, %struct.timespec* %11, i32 0, i32 1
store i8* %192, i8** %193
%194 = getelementptr inbounds %struct.timespec, %struct.timespec* %11, i32 0, i32 0
store i64 0, i64* %194
br label %195
195: ; preds = %190, %186
%196 = load i64, i64* %9
%197 = getelementptr inbounds [3 x i8], [3 x i8]* %10, i64 0, i64 0
%198 = call i64 @mq_timedsend(i64 %196, i8* %197, i32 1, i32 1, %struct.timespec* %11)
%199 = icmp eq i64 %198, 0
br i1 %199, label %200, label %202
200: ; preds = %195
%201 = call i32 @puts(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.14, i64 0, i64 0))
store i32 1, i32* %2
br label %209
202: ; preds = %195
%203 = load i64, i64* @errno
%204 = load i64, i64* @ETIMEDOUT
%205 = icmp ne i64 %203, %204
br i1 %205, label %206, label %208
206: ; preds = %202
%207 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.15, i64 0, i64 0))
store i32 1, i32* %2
br label %208
208: ; preds = %206, %202
br label %209
209: ; preds = %208, %200
%210 = load i64, i64* %9
%211 = call i64 @mq_close(i64 %210)
%212 = icmp ne i64 %211, 0
br i1 %212, label %213, label %215
213: ; preds = %209
%214 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
store i32 1, i32* %2
br label %215
215: ; preds = %213, %209
%216 = load i32, i32* @O_RDONLY
%217 = call i64 (i8*, i32, i32, ...) @mq_open(i8* %19, i32 %216, i32 384)
store i64 %217, i64* %9
%218 = load i64, i64* %9
%219 = icmp eq i64 %218, -1
br i1 %219, label %220, label %222
220: ; preds = %215
%221 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.16, i64 0, i64 0))
store i32 1, i32* %2
br label %222
222: ; preds = %220, %215
%223 = load i32, i32* @O_RDONLY
%224 = call i64 (i8*, i32, i32, ...) @mq_open(i8* %19, i32 %223, i32 384)
store i64 %224, i64* %12
%225 = load i64, i64* %12
%226 = icmp eq i64 %225, -1
br i1 %226, label %227, label %229
227: ; preds = %222
%228 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.16, i64 0, i64 0))
store i32 1, i32* %2
br label %229
229: ; preds = %227, %222
%230 = getelementptr inbounds [3 x i8], [3 x i8]* %10, i64 0, i64 0
%231 = call i32 @memset(i8* %230, i8 signext 32, i32 3)
%232 = load i64, i64* %9
%233 = getelementptr inbounds [3 x i8], [3 x i8]* %10, i64 0, i64 0
%234 = call i32 @mq_receive(i64 %232, i8* %233, i32 2, i32* %13)
store i32 %234, i32* %14
%235 = load i32, i32* %14
%236 = icmp ne i32 %235, 1
br i1 %236, label %237, label %246
237: ; preds = %229
%238 = load i32, i32* %14
%239 = icmp eq i32 %238, -1
br i1 %239, label %240, label %242
240: ; preds = %237
%241 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.17, i64 0, i64 0))
br label %245
242: ; preds = %237
%243 = load i32, i32* %14
%244 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.18, i64 0, i64 0), i32 %243)
br label %245
245: ; preds = %242, %240
store i32 1, i32* %2
br label %266
246: ; preds = %229
%247 = load i32, i32* %13
%248 = icmp ne i32 %247, 5
br i1 %248, label %253, label %249
249: ; preds = %246
%250 = getelementptr inbounds [3 x i8], [3 x i8]* %10, i64 0, i64 0
%251 = call i64 @memcmp(i8* %250, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.19, i64 0, i64 0), i32 3)
%252 = icmp ne i64 %251, 0
br i1 %252, label %253, label %265
253: ; preds = %249, %246
%254 = load i32, i32* %13
%255 = getelementptr inbounds [3 x i8], [3 x i8]* %10, i64 0, i64 0
%256 = load i8, i8* %255
%257 = sext i8 %256 to i32
%258 = getelementptr inbounds [3 x i8], [3 x i8]* %10, i64 0, i64 1
%259 = load i8, i8* %258
%260 = sext i8 %259 to i32
%261 = getelementptr inbounds [3 x i8], [3 x i8]* %10, i64 0, i64 2
%262 = load i8, i8* %261
%263 = sext i8 %262 to i32
%264 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.20, i64 0, i64 0), i32 %254, i32 %257, i32 %260, i32 %263)
store i32 1, i32* %2
br label %265
265: ; preds = %253, %249
br label %266
266: ; preds = %265, %245
%267 = load i64, i64* %12
%268 = call i64 @mq_getattr(i64 %267, %struct.mq_attr* %6)
%269 = icmp ne i64 %268, 0
br i1 %269, label %270, label %272
270: ; preds = %266
%271 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.12, i64 0, i64 0))
store i32 1, i32* %2
br label %272
272: ; preds = %270, %266
%273 = getelementptr inbounds %struct.mq_attr, %struct.mq_attr* %6, i32 0, i32 2
%274 = load i32, i32* %273
%275 = load i32, i32* @O_NONBLOCK
%276 = and i32 %274, %275
%277 = icmp ne i32 %276, 0
br i1 %277, label %290, label %278
278: ; preds = %272
%279 = getelementptr inbounds %struct.mq_attr, %struct.mq_attr* %6, i32 0, i32 0
%280 = load i32, i32* %279
%281 = icmp ne i32 %280, 2
br i1 %281, label %290, label %282
282: ; preds = %278
%283 = getelementptr inbounds %struct.mq_attr, %struct.mq_attr* %6, i32 0, i32 1
%284 = load i32, i32* %283
%285 = icmp ne i32 %284, 2
br i1 %285, label %290, label %286
286: ; preds = %282
%287 = getelementptr inbounds %struct.mq_attr, %struct.mq_attr* %6, i32 0, i32 3
%288 = load i32, i32* %287
%289 = icmp ne i32 %288, 1
br i1 %289, label %290, label %300
290: ; preds = %286, %282, %278, %272
%291 = getelementptr inbounds %struct.mq_attr, %struct.mq_attr* %6, i32 0, i32 2
%292 = load i32, i32* %291
%293 = getelementptr inbounds %struct.mq_attr, %struct.mq_attr* %6, i32 0, i32 0
%294 = load i32, i32* %293
%295 = getelementptr inbounds %struct.mq_attr, %struct.mq_attr* %6, i32 0, i32 1
%296 = load i32, i32* %295
%297 = getelementptr inbounds %struct.mq_attr, %struct.mq_attr* %6, i32 0, i32 3
%298 = load i32, i32* %297
%299 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([108 x i8], [108 x i8]* @.str.13, i64 0, i64 0), i32 %292, i32 %294, i32 %296, i32 %298)
store i32 1, i32* %2
br label %300
300: ; preds = %290, %286
%301 = load i64, i64* %12
%302 = getelementptr inbounds [3 x i8], [3 x i8]* %10, i64 0, i64 0
%303 = call i32 @mq_receive(i64 %301, i8* %302, i32 2, i32* null)
store i32 %303, i32* %14
%304 = load i32, i32* %14
%305 = icmp ne i32 %304, 2
br i1 %305, label %306, label %315
306: ; preds = %300
%307 = load i32, i32* %14
%308 = icmp eq i32 %307, -1
br i1 %308, label %309, label %311
309: ; preds = %306
%310 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.17, i64 0, i64 0))
br label %314
311: ; preds = %306
%312 = load i32, i32* %14
%313 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.21, i64 0, i64 0), i32 %312)
br label %314
314: ; preds = %311, %309
store i32 1, i32* %2
br label %331
315: ; preds = %300
%316 = getelementptr inbounds [3 x i8], [3 x i8]* %10, i64 0, i64 0
%317 = call i64 @memcmp(i8* %316, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.22, i64 0, i64 0), i32 3)
%318 = icmp ne i64 %317, 0
br i1 %318, label %319, label %330
319: ; preds = %315
%320 = getelementptr inbounds [3 x i8], [3 x i8]* %10, i64 0, i64 0
%321 = load i8, i8* %320
%322 = sext i8 %321 to i32
%323 = getelementptr inbounds [3 x i8], [3 x i8]* %10, i64 0, i64 1
%324 = load i8, i8* %323
%325 = sext i8 %324 to i32
%326 = getelementptr inbounds [3 x i8], [3 x i8]* %10, i64 0, i64 2
%327 = load i8, i8* %326
%328 = sext i8 %327 to i32
%329 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.23, i64 0, i64 0), i32 %322, i32 %325, i32 %328)
store i32 1, i32* %2
br label %330
330: ; preds = %319, %315
br label %331
331: ; preds = %330, %314
%332 = load i32, i32* @CLOCK_REALTIME
%333 = call i64 @clock_gettime(i32 %332, %struct.timespec* %11)
%334 = icmp eq i64 %333, 0
br i1 %334, label %335, label %339
335: ; preds = %331
%336 = getelementptr inbounds %struct.timespec, %struct.timespec* %11, i32 0, i32 1
%337 = load i8*, i8** %336
%338 = getelementptr inbounds i8, i8* %337, i32 1
store i8* %338, i8** %336
br label %344
339: ; preds = %331
%340 = call i8* @time(i32* null)
%341 = getelementptr i8, i8* %340, i64 1
%342 = getelementptr inbounds %struct.timespec, %struct.timespec* %11, i32 0, i32 1
store i8* %341, i8** %342
%343 = getelementptr inbounds %struct.timespec, %struct.timespec* %11, i32 0, i32 0
store i64 0, i64* %343
br label %344
344: ; preds = %339, %335
%345 = load i64, i64* %9
%346 = getelementptr inbounds [3 x i8], [3 x i8]* %10, i64 0, i64 0
%347 = call i32 @mq_timedreceive(i64 %345, i8* %346, i32 2, i32* null, %struct.timespec* %11)
%348 = icmp ne i32 %347, -1
br i1 %348, label %349, label %351
349: ; preds = %344
%350 = call i32 @puts(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.24, i64 0, i64 0))
store i32 1, i32* %2
br label %358
351: ; preds = %344
%352 = load i64, i64* @errno
%353 = load i64, i64* @ETIMEDOUT
%354 = icmp ne i64 %352, %353
br i1 %354, label %355, label %357
355: ; preds = %351
%356 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.25, i64 0, i64 0))
store i32 1, i32* %2
br label %357
357: ; preds = %355, %351
br label %358
358: ; preds = %357, %349
%359 = call i64 @mq_unlink(i8* %19)
%360 = icmp ne i64 %359, 0
br i1 %360, label %361, label %363
361: ; preds = %358
%362 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
store i32 1, i32* %2
br label %363
363: ; preds = %361, %358
%364 = load i64, i64* %7
%365 = call i64 @mq_close(i64 %364)
%366 = icmp ne i64 %365, 0
br i1 %366, label %367, label %369
367: ; preds = %363
%368 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
store i32 1, i32* %2
br label %369
369: ; preds = %367, %363
%370 = load i64, i64* %9
%371 = call i64 @mq_close(i64 %370)
%372 = icmp ne i64 %371, 0
br i1 %372, label %373, label %375
373: ; preds = %369
%374 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
store i32 1, i32* %2
br label %375
375: ; preds = %373, %369
%376 = load i64, i64* %12
%377 = call i64 @mq_close(i64 %376)
%378 = icmp ne i64 %377, 0
br i1 %378, label %379, label %381
379: ; preds = %375
%380 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
store i32 1, i32* %2
br label %381
381: ; preds = %379, %375
%382 = load i32, i32* %2
store i32 %382, i32* %1
store i32 1, i32* %8
br label %383
383: ; preds = %381, %34
%384 = load i8*, i8** %3
%385 = load i32, i32* %1
ret i32 %385
}

LLVM IR (-O2):
%struct.mq_attr = type { i32, i32, i32, i32 }
%struct.timespec = type { i64, i8* }
@NAME_MAX = global i32 0
@.str = [16 x i8] c"/tst-mqueue4-%u\00"
@__const.do_test.attr = %struct.mq_attr { i32 2, i32 2, i32 0, i32 0 }
@O_CREAT = global i32 0
@O_EXCL = global i32 0
@O_RDWR = global i32 0
@.str.1 = [25 x i8] c"mq_open failed with: %m\0A\00"
@.str.2 = [59 x i8] c"mq_open with NAME_MAX long name compoment failed with: %m\0A\00"
@.str.3 = [22 x i8] c"mq_unlink failed: %m\0A\00"
@.str.4 = [21 x i8] c"mq_close failed: %m\0A\00"
@.str.5 = [60 x i8] c"mq_open with too long name component unexpectedly succeeded\00"
@errno = global i64 0
@ENAMETOOLONG = global i64 0
@.str.6 = [73 x i8] c"mq_open with too long name component did not fail with ENAMETOOLONG: %m\0A\00"
@.str.7 = [62 x i8] c"mq_unlink with too long name component unexpectedly succeeded\00"
@.str.8 = [75 x i8] c"mq_unlink with too long name component did not fail with ENAMETOOLONG: %m\0A\00"
@.str.9 = [39 x i8] c"mq_open without O_EXCL failed with %m\0A\00"
@.str.10 = [3 x i8] c"jk\00"
@.str.11 = [20 x i8] c"mq_send failed: %m\0A\00"
@.str.12 = [23 x i8] c"mq_getattr failed: %m\0A\00"
@O_NONBLOCK = global i32 0
@.str.13 = [108 x i8] c"mq_getattr returned unexpected { .mq_flags = %ld,\0A.mq_maxmsg = %ld, .mq_msgsize = %ld, .mq_curmsgs = %ld }\0A\00"
@CLOCK_REALTIME = global i32 0
@.str.14 = [36 x i8] c"mq_timedsend unexpectedly succeeded\00"
@ETIMEDOUT = global i64 0
@.str.15 = [46 x i8] c"mq_timedsend did not fail with ETIMEDOUT: %m\0A\00"
@O_RDONLY = global i32 0
@.str.16 = [40 x i8] c"mq_open without O_CREAT failed with %m\0A\00"
@.str.17 = [28 x i8] c"mq_receive failed with: %m\0A\00"
@.str.18 = [30 x i8] c"mq_receive returned %zd != 1\0A\00"
@.str.19 = [4 x i8] c"k \00"
@.str.20 = [54 x i8] c"mq_receive returned prio %u (2) buf \22%c%c%c\22 (\22k \22)\0A\00"
@.str.21 = [30 x i8] c"mq_receive returned %zd != 2\0A\00"
@.str.22 = [4 x i8] c"jk \00"
@.str.23 = [43 x i8] c"mq_receive returned buf \22%c%c%c\22 != \22jk \22\0A\00"
@.str.24 = [54 x i8] c"mq_timedreceive on empty queue unexpectedly succeeded\00"
@.str.25 = [64 x i8] c"mq_timedreceive on empty queue did not fail with ETIMEDOUT: %m\0A\00"
define i32 @do_test() {
%1 = alloca %struct.mq_attr
%2 = alloca [3 x i8]
%3 = alloca %struct.timespec
%4 = alloca i32
%5 = load i32, i32* @NAME_MAX
%6 = sext i32 %5 to i64
%7 = add nsw i64 %6, 26
%8 = alloca i8, i64 %7
%9 = trunc i64 %7 to i32
%10 = tail call i32 (...) @getpid()
%11 = call i32 @snprintf(i8* %8, i32 %9, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i8, i8* %8, i64 %12
%14 = bitcast %struct.mq_attr* %1 to i8*
%15 = load i32, i32* @O_CREAT
%16 = load i32, i32* @O_EXCL
%17 = or i32 %16, %15
%18 = load i32, i32* @O_RDWR
%19 = or i32 %17, %18
%20 = call i64 (i8*, i32, i32, ...) @mq_open(i8* %8, i32 %19, i32 384, %struct.mq_attr* %1)
%21 = icmp eq i64 %20, -1
br i1 %21, label %22, label %24
22: ; preds = %0
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
br label %311
24: ; preds = %0
%25 = call i32 @add_temp_mq(i8* %8)
store i8 46, i8* %13
%26 = getelementptr inbounds i8, i8* %13, i64 1
%27 = load i32, i32* @NAME_MAX
%28 = sub i32 1, %11
%29 = add i32 %28, %27
%30 = call i32 @memset(i8* %26, i8 signext 120, i32 %29)
%31 = load i32, i32* @NAME_MAX
%32 = add nsw i32 %31, 1
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i8, i8* %8, i64 %33
store i8 0, i8* %34
%35 = load i32, i32* @O_CREAT
%36 = load i32, i32* @O_EXCL
%37 = or i32 %36, %35
%38 = load i32, i32* @O_RDWR
%39 = or i32 %37, %38
%40 = call i64 (i8*, i32, i32, ...) @mq_open(i8* %8, i32 %39, i32 384, %struct.mq_attr* %1)
%41 = icmp eq i64 %40, -1
br i1 %41, label %42, label %44
42: ; preds = %24
%43 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @.str.2, i64 0, i64 0))
br label %44
44: ; preds = %42, %24
%45 = phi i32 [ 1, %42 ], [ 0, %24 ]
%46 = call i64 @mq_unlink(i8* %8)
%47 = icmp eq i64 %46, 0
br i1 %47, label %50, label %48
48: ; preds = %44
%49 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
br label %50
50: ; preds = %48, %44
%51 = phi i32 [ 1, %48 ], [ %45, %44 ]
%52 = call i64 @mq_close(i64 %40)
%53 = icmp eq i64 %52, 0
br i1 %53, label %56, label %54
54: ; preds = %50
%55 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
br label %56
56: ; preds = %54, %50
%57 = phi i32 [ 1, %54 ], [ %51, %50 ]
%58 = load i32, i32* @NAME_MAX
%59 = add nsw i32 %58, 1
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds i8, i8* %8, i64 %60
store i8 120, i8* %61
%62 = add nsw i32 %58, 2
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds i8, i8* %8, i64 %63
store i8 0, i8* %64
%65 = load i32, i32* @O_CREAT
%66 = load i32, i32* @O_EXCL
%67 = or i32 %66, %65
%68 = load i32, i32* @O_RDWR
%69 = or i32 %67, %68
%70 = call i64 (i8*, i32, i32, ...) @mq_open(i8* %8, i32 %69, i32 384, %struct.mq_attr* %1)
%71 = icmp eq i64 %70, -1
br i1 %71, label %76, label %72
72: ; preds = %56
%73 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @.str.5, i64 0, i64 0))
%74 = call i64 @mq_unlink(i8* %8)
%75 = call i64 @mq_close(i64 %70)
br label %82
76: ; preds = %56
%77 = load i64, i64* @errno
%78 = load i64, i64* @ENAMETOOLONG
%79 = icmp eq i64 %77, %78
br i1 %79, label %82, label %80
80: ; preds = %76
%81 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([73 x i8], [73 x i8]* @.str.6, i64 0, i64 0))
br label %82
82: ; preds = %76, %80, %72
%83 = phi i32 [ 1, %72 ], [ 1, %80 ], [ %57, %76 ]
%84 = call i64 @mq_unlink(i8* %8)
%85 = icmp eq i64 %84, 0
br i1 %85, label %86, label %88
86: ; preds = %82
%87 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([62 x i8], [62 x i8]* @.str.7, i64 0, i64 0))
br label %94
88: ; preds = %82
%89 = load i64, i64* @errno
%90 = load i64, i64* @ENAMETOOLONG
%91 = icmp eq i64 %89, %90
br i1 %91, label %94, label %92
92: ; preds = %88
%93 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([75 x i8], [75 x i8]* @.str.8, i64 0, i64 0))
br label %94
94: ; preds = %88, %92, %86
%95 = phi i32 [ 1, %86 ], [ 1, %92 ], [ %83, %88 ]
store i8 0, i8* %13
%96 = getelementptr inbounds %struct.mq_attr, %struct.mq_attr* %1, i64 0, i32 0
store i32 1, i32* %96
%97 = getelementptr inbounds %struct.mq_attr, %struct.mq_attr* %1, i64 0, i32 1
store i32 3, i32* %97
%98 = load i32, i32* @O_CREAT
%99 = load i32, i32* @O_RDWR
%100 = or i32 %99, %98
%101 = call i64 (i8*, i32, i32, ...) @mq_open(i8* %8, i32 %100, i32 384, %struct.mq_attr* %1)
%102 = icmp eq i64 %101, -1
br i1 %102, label %103, label %105
103: ; preds = %94
%104 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.9, i64 0, i64 0))
br label %105
105: ; preds = %103, %94
%106 = phi i32 [ 1, %103 ], [ %95, %94 ]
%107 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 0
%108 = call i32 @strcpy(i8* %107, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0))
%109 = call i64 @mq_send(i64 %20, i8* %107, i32 2, i32 4)
%110 = icmp eq i64 %109, 0
br i1 %110, label %113, label %111
111: ; preds = %105
%112 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.11, i64 0, i64 0))
br label %113
113: ; preds = %111, %105
%114 = phi i32 [ 1, %111 ], [ %106, %105 ]
%115 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 1
%116 = call i64 @mq_send(i64 %20, i8* %115, i32 1, i32 5)
%117 = icmp eq i64 %116, 0
br i1 %117, label %120, label %118
118: ; preds = %113
%119 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.11, i64 0, i64 0))
br label %120
120: ; preds = %118, %113
%121 = phi i32 [ 1, %118 ], [ %114, %113 ]
%122 = call i64 @mq_getattr(i64 %101, %struct.mq_attr* %1)
%123 = icmp eq i64 %122, 0
br i1 %123, label %126, label %124
124: ; preds = %120
%125 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.12, i64 0, i64 0))
br label %126
126: ; preds = %124, %120
%127 = phi i32 [ 1, %124 ], [ %121, %120 ]
%128 = getelementptr inbounds %struct.mq_attr, %struct.mq_attr* %1, i64 0, i32 2
%129 = load i32, i32* %128
%130 = load i32, i32* @O_NONBLOCK
%131 = and i32 %130, %129
%132 = icmp ne i32 %131, 0
%133 = load i32, i32* %96
%134 = icmp ne i32 %133, 2
%135 = select i1 %132, i1 true, i1 %134
%136 = load i32, i32* %97
%137 = icmp ne i32 %136, 2
%138 = select i1 %135, i1 true, i1 %137
%139 = getelementptr inbounds %struct.mq_attr, %struct.mq_attr* %1, i64 0, i32 3
%140 = load i32, i32* %139
%141 = icmp ne i32 %140, 2
%142 = select i1 %138, i1 true, i1 %141
br i1 %142, label %143, label %145
143: ; preds = %126
%144 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([108 x i8], [108 x i8]* @.str.13, i64 0, i64 0), i32 %129, i32 %133, i32 %136, i32 %140)
br label %145
145: ; preds = %126, %143
%146 = phi i32 [ 1, %143 ], [ %127, %126 ]
%147 = bitcast %struct.timespec* %3 to i8*
%148 = load i32, i32* @CLOCK_REALTIME
%149 = call i64 @clock_gettime(i32 %148, %struct.timespec* %3)
%150 = icmp eq i64 %149, 0
br i1 %150, label %151, label %155
151: ; preds = %145
%152 = getelementptr inbounds %struct.timespec, %struct.timespec* %3, i64 0, i32 1
%153 = load i8*, i8** %152
%154 = getelementptr inbounds i8, i8* %153, i64 1
store i8* %154, i8** %152
br label %160
155: ; preds = %145
%156 = call i8* @time(i32* null)
%157 = getelementptr i8, i8* %156, i64 1
%158 = getelementptr inbounds %struct.timespec, %struct.timespec* %3, i64 0, i32 1
store i8* %157, i8** %158
%159 = getelementptr inbounds %struct.timespec, %struct.timespec* %3, i64 0, i32 0
store i64 0, i64* %159
br label %160
160: ; preds = %155, %151
%161 = call i64 @mq_timedsend(i64 %101, i8* %107, i32 1, i32 1, %struct.timespec* %3)
%162 = icmp eq i64 %161, 0
br i1 %162, label %163, label %165
163: ; preds = %160
%164 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.14, i64 0, i64 0))
br label %171
165: ; preds = %160
%166 = load i64, i64* @errno
%167 = load i64, i64* @ETIMEDOUT
%168 = icmp eq i64 %166, %167
br i1 %168, label %171, label %169
169: ; preds = %165
%170 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.15, i64 0, i64 0))
br label %171
171: ; preds = %165, %169, %163
%172 = phi i32 [ 1, %163 ], [ 1, %169 ], [ %146, %165 ]
%173 = call i64 @mq_close(i64 %101)
%174 = icmp eq i64 %173, 0
br i1 %174, label %177, label %175
175: ; preds = %171
%176 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
br label %177
177: ; preds = %175, %171
%178 = phi i32 [ 1, %175 ], [ %172, %171 ]
%179 = load i32, i32* @O_RDONLY
%180 = call i64 (i8*, i32, i32, ...) @mq_open(i8* %8, i32 %179, i32 384)
%181 = icmp eq i64 %180, -1
br i1 %181, label %182, label %184
182: ; preds = %177
%183 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.16, i64 0, i64 0))
br label %184
184: ; preds = %182, %177
%185 = phi i32 [ 1, %182 ], [ %178, %177 ]
%186 = load i32, i32* @O_RDONLY
%187 = call i64 (i8*, i32, i32, ...) @mq_open(i8* %8, i32 %186, i32 384)
%188 = icmp eq i64 %187, -1
br i1 %188, label %189, label %191
189: ; preds = %184
%190 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.16, i64 0, i64 0))
br label %191
191: ; preds = %189, %184
%192 = phi i32 [ 1, %189 ], [ %185, %184 ]
%193 = call i32 @memset(i8* %107, i8 signext 32, i32 3)
%194 = bitcast i32* %4 to i8*
%195 = call i32 @mq_receive(i64 %180, i8* %107, i32 2, i32* %4)
switch i32 %195, label %198 [
i32 1, label %200
i32 -1, label %196
]
196: ; preds = %191
%197 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.17, i64 0, i64 0))
br label %218
198: ; preds = %191
%199 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.18, i64 0, i64 0), i32 %195)
br label %218
200: ; preds = %191
%201 = load i32, i32* %4
%202 = icmp eq i32 %201, 5
br i1 %202, label %203, label %208
203: ; preds = %200
%204 = call i64 @memcmp(i8* %107, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.19, i64 0, i64 0), i32 3)
%205 = icmp eq i64 %204, 0
br i1 %205, label %218, label %206
206: ; preds = %203
%207 = load i32, i32* %4
br label %208
208: ; preds = %206, %200
%209 = phi i32 [ %207, %206 ], [ %201, %200 ]
%210 = load i8, i8* %107
%211 = sext i8 %210 to i32
%212 = load i8, i8* %115
%213 = sext i8 %212 to i32
%214 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 2
%215 = load i8, i8* %214
%216 = sext i8 %215 to i32
%217 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @.str.20, i64 0, i64 0), i32 %209, i32 %211, i32 %213, i32 %216)
br label %218
218: ; preds = %196, %198, %203, %208
%219 = phi i32 [ 1, %208 ], [ %192, %203 ], [ 1, %198 ], [ 1, %196 ]
%220 = call i64 @mq_getattr(i64 %187, %struct.mq_attr* %1)
%221 = icmp eq i64 %220, 0
br i1 %221, label %224, label %222
222: ; preds = %218
%223 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.12, i64 0, i64 0))
br label %224
224: ; preds = %222, %218
%225 = phi i32 [ 1, %222 ], [ %219, %218 ]
%226 = load i32, i32* %128
%227 = load i32, i32* @O_NONBLOCK
%228 = and i32 %227, %226
%229 = icmp ne i32 %228, 0
%230 = load i32, i32* %96
%231 = icmp ne i32 %230, 2
%232 = select i1 %229, i1 true, i1 %231
%233 = load i32, i32* %97
%234 = icmp ne i32 %233, 2
%235 = select i1 %232, i1 true, i1 %234
%236 = load i32, i32* %139
%237 = icmp ne i32 %236, 1
%238 = select i1 %235, i1 true, i1 %237
br i1 %238, label %239, label %241
239: ; preds = %224
%240 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([108 x i8], [108 x i8]* @.str.13, i64 0, i64 0), i32 %226, i32 %230, i32 %233, i32 %236)
br label %241
241: ; preds = %224, %239
%242 = phi i32 [ 1, %239 ], [ %225, %224 ]
%243 = call i32 @mq_receive(i64 %187, i8* %107, i32 2, i32* null)
switch i32 %243, label %246 [
i32 2, label %248
i32 -1, label %244
]
244: ; preds = %241
%245 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.17, i64 0, i64 0))
br label %260
246: ; preds = %241
%247 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.21, i64 0, i64 0), i32 %243)
br label %260
248: ; preds = %241
%249 = call i64 @memcmp(i8* %107, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.22, i64 0, i64 0), i32 3)
%250 = icmp eq i64 %249, 0
br i1 %250, label %260, label %251
251: ; preds = %248
%252 = load i8, i8* %107
%253 = sext i8 %252 to i32
%254 = load i8, i8* %115
%255 = sext i8 %254 to i32
%256 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 2
%257 = load i8, i8* %256
%258 = sext i8 %257 to i32
%259 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.23, i64 0, i64 0), i32 %253, i32 %255, i32 %258)
br label %260
260: ; preds = %244, %246, %248, %251
%261 = phi i32 [ 1, %251 ], [ %242, %248 ], [ 1, %246 ], [ 1, %244 ]
%262 = load i32, i32* @CLOCK_REALTIME
%263 = call i64 @clock_gettime(i32 %262, %struct.timespec* %3)
%264 = icmp eq i64 %263, 0
br i1 %264, label %265, label %269
265: ; preds = %260
%266 = getelementptr inbounds %struct.timespec, %struct.timespec* %3, i64 0, i32 1
%267 = load i8*, i8** %266
%268 = getelementptr inbounds i8, i8* %267, i64 1
store i8* %268, i8** %266
br label %274
269: ; preds = %260
%270 = call i8* @time(i32* null)
%271 = getelementptr i8, i8* %270, i64 1
%272 = getelementptr inbounds %struct.timespec, %struct.timespec* %3, i64 0, i32 1
store i8* %271, i8** %272
%273 = getelementptr inbounds %struct.timespec, %struct.timespec* %3, i64 0, i32 0
store i64 0, i64* %273
br label %274
274: ; preds = %269, %265
%275 = call i32 @mq_timedreceive(i64 %180, i8* %107, i32 2, i32* null, %struct.timespec* %3)
%276 = icmp eq i32 %275, -1
br i1 %276, label %279, label %277
277: ; preds = %274
%278 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @.str.24, i64 0, i64 0))
br label %285
279: ; preds = %274
%280 = load i64, i64* @errno
%281 = load i64, i64* @ETIMEDOUT
%282 = icmp eq i64 %280, %281
br i1 %282, label %285, label %283
283: ; preds = %279
%284 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([64 x i8], [64 x i8]* @.str.25, i64 0, i64 0))
br label %285
285: ; preds = %279, %283, %277
%286 = phi i32 [ 1, %277 ], [ 1, %283 ], [ %261, %279 ]
%287 = call i64 @mq_unlink(i8* %8)
%288 = icmp eq i64 %287, 0
br i1 %288, label %291, label %289
289: ; preds = %285
%290 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
br label %291
291: ; preds = %289, %285
%292 = phi i32 [ 1, %289 ], [ %286, %285 ]
%293 = call i64 @mq_close(i64 %20)
%294 = icmp eq i64 %293, 0
br i1 %294, label %297, label %295
295: ; preds = %291
%296 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
br label %297
297: ; preds = %295, %291
%298 = phi i32 [ 1, %295 ], [ %292, %291 ]
%299 = call i64 @mq_close(i64 %180)
%300 = icmp eq i64 %299, 0
br i1 %300, label %303, label %301
301: ; preds = %297
%302 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
br label %303
303: ; preds = %301, %297
%304 = phi i32 [ 1, %301 ], [ %298, %297 ]
%305 = call i64 @mq_close(i64 %187)
%306 = icmp eq i64 %305, 0
br i1 %306, label %309, label %307
307: ; preds = %303
%308 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
br label %309
309: ; preds = %307, %303
%310 = phi i32 [ 1, %307 ], [ %304, %303 ]
br label %311
311: ; preds = %309, %22
%312 = phi i32 [ 0, %22 ], [ %310, %309 ]
ret i32 %312
}