#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 mq_attr {
  int mq_msgsize;
  int mq_maxmsg;
};
typedef scalar_t__ ssize_t;
typedef scalar_t__ mqd_t;

/* Variables and functions */
int O_CREAT;
int O_RDWR;
int S_IRUSR;
int S_IWUSR;
int getpid();
scalar_t__ mq_close(scalar_t__);
scalar_t__ mq_open(char *, int, int, struct mq_attr *);
scalar_t__ mq_receive(scalar_t__, char *, int, int /*<<< orphan*/ *);
scalar_t__ mq_send(scalar_t__, char const *, scalar_t__, int);
scalar_t__ mq_unlink(char *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sprintf(char *, char *, int);
int /*<<< orphan*/ strcmp(char *, char *);
scalar_t__ strlen(char const *);
int main(void) {
  char mqname[50], msgrv1[40], msgrv2[40];
  const char *msgptr1 = "test message1";
  const char *msgptr2 = "test message2 with differnet length";
  mqd_t mqdes;
  int prio1 = 1, prio2 = 2;
  struct mq_attr attr = {.mq_msgsize = 40, .mq_maxmsg = 40};
  int unresolved = 0, failure = 0;
  sprintf(mqname,
          "/"
          "mq_receive"
          "_"
          "8-1"
          "_%d",
          getpid());
  mqdes = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr);
  if (mqdes == (mqd_t)-1) {
    perror("unexpected error: "
           "mq_receive"
           " "
           "8-1"
           ": "
           "mq_open");
    unresolved = 1;
  }
  if (mq_send(mqdes, msgptr1, strlen(msgptr1), prio1) != 0) {
    perror("unexpected error: "
           "mq_receive"
           " "
           "8-1"
           ": "
           "mq_send");
    unresolved = 1;
  }
  if (mq_send(mqdes, msgptr2, strlen(msgptr2), prio2) != 0) {
    perror("unexpected error: "
           "mq_receive"
           " "
           "8-1"
           ": "
           "mq_send");
    unresolved = 1;
  }
  if (mq_receive(mqdes, msgrv1, 40, NULL) != (ssize_t)strlen(msgptr2)) {
    printf("FAIL: mq_receive didn't return the selected message "
           "size correctly\n");
    failure = 1;
  }
  if (mq_receive(mqdes, msgrv2, 40, NULL) != (ssize_t)strlen(msgptr1)) {
    printf("FAIL: mq_receive didn't return the selected message "
           "size correctly\n");
    failure = 1;
  }
  if (!strcmp(msgrv1, msgrv2)) {
    printf("FAIL: mq_receive received the same message twice\n");
    failure = 1;
  }
  if (mq_close(mqdes) != 0) {
    perror("unexpected error: "
           "mq_receive"
           " "
           "8-1"
           ": "
           "mq_close");
    unresolved = 1;
  }
  if (mq_unlink(mqname) != 0) {
    perror("unexpected error: "
           "mq_receive"
           " "
           "8-1"
           ": "
           "mq_unlink");
    unresolved = 1;
  }
  if (failure == 1) {
    printf("Test FAILED\n");
    return 1;
  }
  if (unresolved == 1) {
    printf("Test UNRESOLVED\n");
    return 2;
  }
  printf("Test PASSED\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe37(%rip),%rax
mov    %rax,-0xa8(%rbp)
lea    0xe37(%rip),%rax
mov    %rax,-0xb0(%rbp)
movl   $0x1,-0xbc(%rbp)
movl   $0x2,-0xc0(%rbp)
mov    0xf9b(%rip),%rax
mov    %rax,-0xc8(%rbp)
movl   $0x0,-0xcc(%rbp)
movl   $0x0,-0xd0(%rbp)
lea    -0x40(%rbp),%rax
mov    %rax,-0xd8(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    -0xd8(%rbp),%rdi
mov    %eax,%edx
lea    0xdfc(%rip),%rsi
call   10c0 <sprintf@plt>
lea    -0x40(%rbp),%rdi
mov    0x2db2(%rip),%rax
mov    (%rax),%esi
mov    0x2d91(%rip),%rax
or     (%rax),%esi
mov    0x2d70(%rip),%rax
mov    (%rax),%edx
mov    0x2d77(%rip),%rax
or     (%rax),%edx
lea    -0xc8(%rbp),%rcx
call   1090 <mq_open@plt>
mov    %rax,-0xb8(%rbp)
cmpq   $0xffffffffffffffff,-0xb8(%rbp)
ff
jne    129a <main+0xea>
lea    0xdba(%rip),%rdi
call   10b0 <perror@plt>
movl   $0x1,-0xcc(%rbp)
mov    -0xb8(%rbp),%rax
mov    %rax,-0xe8(%rbp)
mov    -0xa8(%rbp),%rax
mov    %rax,-0xe0(%rbp)
mov    -0xa8(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0xe8(%rbp),%rdi
mov    -0xe0(%rbp),%rsi
mov    %rax,%rdx
mov    -0xbc(%rbp),%ecx
call   1070 <mq_send@plt>
cmp    $0x0,%rax
je     12fe <main+0x14e>
lea    0xd80(%rip),%rdi
call   10b0 <perror@plt>
movl   $0x1,-0xcc(%rbp)
mov    -0xb8(%rbp),%rax
mov    %rax,-0xf8(%rbp)
mov    -0xb0(%rbp),%rax
mov    %rax,-0xf0(%rbp)
mov    -0xb0(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0xf8(%rbp),%rdi
mov    -0xf0(%rbp),%rsi
mov    %rax,%rdx
mov    -0xc0(%rbp),%ecx
call   1070 <mq_send@plt>
cmp    $0x0,%rax
je     1362 <main+0x1b2>
lea    0xd1c(%rip),%rdi
call   10b0 <perror@plt>
movl   $0x1,-0xcc(%rbp)
mov    -0xb8(%rbp),%rdi
lea    -0x70(%rbp),%rsi
mov    $0x28,%edx
xor    %eax,%eax
mov    %eax,%ecx
call   10a0 <mq_receive@plt>
mov    %rax,-0x100(%rbp)
mov    -0xb0(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rcx
mov    -0x100(%rbp),%rax
cmp    %rcx,%rax
je     13b7 <main+0x207>
lea    0xcf1(%rip),%rdi
call   1050 <printf@plt>
movl   $0x1,-0xd0(%rbp)
mov    -0xb8(%rbp),%rdi
lea    -0xa0(%rbp),%rsi
mov    $0x28,%edx
xor    %eax,%eax
mov    %eax,%ecx
call   10a0 <mq_receive@plt>
mov    %rax,-0x108(%rbp)
mov    -0xa8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rcx
mov    -0x108(%rbp),%rax
cmp    %rcx,%rax
je     140f <main+0x25f>
lea    0xc99(%rip),%rdi
call   1050 <printf@plt>
movl   $0x1,-0xd0(%rbp)
lea    -0x70(%rbp),%rdi
lea    -0xa0(%rbp),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%eax
jne    143e <main+0x28e>
lea    0xcae(%rip),%rdi
call   1050 <printf@plt>
movl   $0x1,-0xd0(%rbp)
mov    -0xb8(%rbp),%rdi
call   1060 <mq_close@plt>
cmp    $0x0,%rax
je     146a <main+0x2ba>
lea    0xcb4(%rip),%rdi
call   10b0 <perror@plt>
movl   $0x1,-0xcc(%rbp)
lea    -0x40(%rbp),%rdi
call   10d0 <mq_unlink@plt>
cmp    $0x0,%rax
je     1493 <main+0x2e3>
lea    0xcb6(%rip),%rdi
call   10b0 <perror@plt>
movl   $0x1,-0xcc(%rbp)
cmpl   $0x1,-0xd0(%rbp)
jne    14b8 <main+0x308>
lea    0xcbf(%rip),%rdi
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    14f0 <main+0x340>
cmpl   $0x1,-0xcc(%rbp)
jne    14dd <main+0x32d>
lea    0xca7(%rip),%rdi
call   1050 <printf@plt>
movl   $0x2,-0x4(%rbp)
jmp    14f0 <main+0x340>
lea    0xca0(%rip),%rdi
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0xb0,%rsp
movabs $0x2800000028,%rax
mov    %rax,0x8(%rsp)
xor    %r14d,%r14d
xor    %eax,%eax
call   1040 <getpid@plt>
lea    0xe67(%rip),%rsi
lea    0x70(%rsp),%rbx
mov    %rbx,%rdi
mov    %eax,%edx
call   10b0 <sprintf@plt>
mov    0x2e17(%rip),%rax
mov    0x2df8(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    0x2dd5(%rip),%rax
mov    0x2dde(%rip),%rcx
mov    (%rcx),%edx
or     (%rax),%edx
lea    0x8(%rsp),%rcx
mov    %rbx,%rdi
call   1080 <mq_open@plt>
mov    %rax,%rbx
cmp    $0xffffffffffffffff,%rax
je     133d <main+0x19d>
lea    0xde1(%rip),%rsi
mov    $0xd,%edx
mov    %rbx,%rdi
mov    $0x1,%ecx
call   1060 <mq_send@plt>
test   %rax,%rax
jne    1354 <main+0x1b4>
lea    0xdcd(%rip),%rsi
mov    $0x23,%edx
mov    %rbx,%rdi
mov    $0x2,%ecx
call   1060 <mq_send@plt>
test   %rax,%rax
jne    136b <main+0x1cb>
xor    %ebp,%ebp
lea    0x40(%rsp),%rsi
mov    %rbx,%rdi
mov    $0x28,%edx
xor    %ecx,%ecx
call   1090 <mq_receive@plt>
cmp    $0x23,%rax
je     1289 <main+0xe9>
lea    0xeca(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%ebp
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
mov    $0x28,%edx
xor    %ecx,%ecx
call   1090 <mq_receive@plt>
cmp    $0xd,%rax
je     12b4 <main+0x114>
lea    0xe9f(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%ebp
lea    0x40(%rsp),%rdi
lea    0x10(%rsp),%rsi
call   1070 <strcmp@plt>
test   %eax,%eax
jne    12d8 <main+0x138>
lea    0xe22(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%ebp
mov    %rbx,%rdi
call   1050 <mq_close@plt>
test   %rax,%rax
jne    1382 <main+0x1e2>
lea    0x70(%rsp),%rdi
call   10c0 <mq_unlink@plt>
test   %rax,%rax
jne    1399 <main+0x1f9>
test   %ebp,%ebp
je     130e <main+0x16e>
mov    $0x1,%ebx
lea    0xe31(%rip),%rdi
jmp    132a <main+0x18a>
test   %r14d,%r14d
je     1321 <main+0x181>
mov    $0x2,%ebx
lea    0xe0e(%rip),%rdi
jmp    132a <main+0x18a>
xor    %ebx,%ebx
lea    0xdf7(%rip),%rdi
call   1030 <puts@plt>
mov    %ebx,%eax
add    $0xb0,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret
lea    0xd01(%rip),%rdi
call   10a0 <perror@plt>
mov    $0x1,%r14d
jmp    1218 <main+0x78>
lea    0xd14(%rip),%rdi
call   10a0 <perror@plt>
mov    $0x1,%r14d
jmp    123a <main+0x9a>
lea    0xcfd(%rip),%rdi
call   10a0 <perror@plt>
mov    $0x1,%r14d
jmp    125c <main+0xbc>
lea    0xd10(%rip),%rdi
call   10a0 <perror@plt>
mov    $0x1,%r14d
jmp    12e9 <main+0x149>
lea    0xd24(%rip),%rdi
call   10a0 <perror@plt>
test   %ebp,%ebp
jne    1300 <main+0x160>
jmp    1313 <main+0x173>

LLVM IR (-O0):
%struct.mq_attr = type { i32, i32 }
@.str = [14 x i8] c"test message1\00"
@.str.1 = [36 x i8] c"test message2 with differnet length\00"
@__const.main.attr = %struct.mq_attr { i32 40, i32 40 }
@.str.2 = [19 x i8] c"/mq_receive_8-1_%d\00"
@O_CREAT = global i32 0
@O_RDWR = global i32 0
@S_IRUSR = global i32 0
@S_IWUSR = global i32 0
@.str.3 = [42 x i8] c"unexpected error: mq_receive 8-1: mq_open\00"
@.str.4 = [42 x i8] c"unexpected error: mq_receive 8-1: mq_send\00"
@.str.5 = [68 x i8] c"FAIL: mq_receive didn't return the selected message size correctly\0A\00"
@.str.6 = [50 x i8] c"FAIL: mq_receive received the same message twice\0A\00"
@.str.7 = [43 x i8] c"unexpected error: mq_receive 8-1: mq_close\00"
@.str.8 = [44 x i8] c"unexpected error: mq_receive 8-1: mq_unlink\00"
@.str.9 = [13 x i8] c"Test FAILED\0A\00"
@.str.10 = [17 x i8] c"Test UNRESOLVED\0A\00"
@.str.11 = [13 x i8] c"Test PASSED\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [50 x i8]
%3 = alloca [40 x i8]
%4 = alloca [40 x i8]
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i32
%9 = alloca i32
%10 = alloca %struct.mq_attr
%11 = alloca i32
%12 = alloca i32
store i32 0, i32* %1
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8** %5
store i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), i8** %6
store i32 1, i32* %8
store i32 2, i32* %9
%13 = bitcast %struct.mq_attr* %10 to i8*
store i32 0, i32* %11
store i32 0, i32* %12
%14 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%15 = call i32 (...) @getpid()
%16 = call i32 @sprintf(i8* %14, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i32 %15)
%17 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%18 = load i32, i32* @O_CREAT
%19 = load i32, i32* @O_RDWR
%20 = or i32 %18, %19
%21 = load i32, i32* @S_IRUSR
%22 = load i32, i32* @S_IWUSR
%23 = or i32 %21, %22
%24 = call i64 @mq_open(i8* %17, i32 %20, i32 %23, %struct.mq_attr* %10)
store i64 %24, i64* %7
%25 = load i64, i64* %7
%26 = icmp eq i64 %25, -1
br i1 %26, label %27, label %29
27: ; preds = %0
%28 = call i32 @perror(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.3, i64 0, i64 0))
store i32 1, i32* %11
br label %29
29: ; preds = %27, %0
%30 = load i64, i64* %7
%31 = load i8*, i8** %5
%32 = load i8*, i8** %5
%33 = call i64 @strlen(i8* %32)
%34 = load i32, i32* %8
%35 = call i64 @mq_send(i64 %30, i8* %31, i64 %33, i32 %34)
%36 = icmp ne i64 %35, 0
br i1 %36, label %37, label %39
37: ; preds = %29
%38 = call i32 @perror(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.4, i64 0, i64 0))
store i32 1, i32* %11
br label %39
39: ; preds = %37, %29
%40 = load i64, i64* %7
%41 = load i8*, i8** %6
%42 = load i8*, i8** %6
%43 = call i64 @strlen(i8* %42)
%44 = load i32, i32* %9
%45 = call i64 @mq_send(i64 %40, i8* %41, i64 %43, i32 %44)
%46 = icmp ne i64 %45, 0
br i1 %46, label %47, label %49
47: ; preds = %39
%48 = call i32 @perror(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.4, i64 0, i64 0))
store i32 1, i32* %11
br label %49
49: ; preds = %47, %39
%50 = load i64, i64* %7
%51 = getelementptr inbounds [40 x i8], [40 x i8]* %3, i64 0, i64 0
%52 = call i64 @mq_receive(i64 %50, i8* %51, i32 40, i32* null)
%53 = load i8*, i8** %6
%54 = call i64 @strlen(i8* %53)
%55 = icmp ne i64 %52, %54
br i1 %55, label %56, label %58
56: ; preds = %49
%57 = call i32 @printf(i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str.5, i64 0, i64 0))
store i32 1, i32* %12
br label %58
58: ; preds = %56, %49
%59 = load i64, i64* %7
%60 = getelementptr inbounds [40 x i8], [40 x i8]* %4, i64 0, i64 0
%61 = call i64 @mq_receive(i64 %59, i8* %60, i32 40, i32* null)
%62 = load i8*, i8** %5
%63 = call i64 @strlen(i8* %62)
%64 = icmp ne i64 %61, %63
br i1 %64, label %65, label %67
65: ; preds = %58
%66 = call i32 @printf(i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str.5, i64 0, i64 0))
store i32 1, i32* %12
br label %67
67: ; preds = %65, %58
%68 = getelementptr inbounds [40 x i8], [40 x i8]* %3, i64 0, i64 0
%69 = getelementptr inbounds [40 x i8], [40 x i8]* %4, i64 0, i64 0
%70 = call i32 @strcmp(i8* %68, i8* %69)
%71 = icmp ne i32 %70, 0
br i1 %71, label %74, label %72
72: ; preds = %67
%73 = call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.6, i64 0, i64 0))
store i32 1, i32* %12
br label %74
74: ; preds = %72, %67
%75 = load i64, i64* %7
%76 = call i64 @mq_close(i64 %75)
%77 = icmp ne i64 %76, 0
br i1 %77, label %78, label %80
78: ; preds = %74
%79 = call i32 @perror(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.7, i64 0, i64 0))
store i32 1, i32* %11
br label %80
80: ; preds = %78, %74
%81 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%82 = call i64 @mq_unlink(i8* %81)
%83 = icmp ne i64 %82, 0
br i1 %83, label %84, label %86
84: ; preds = %80
%85 = call i32 @perror(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.8, i64 0, i64 0))
store i32 1, i32* %11
br label %86
86: ; preds = %84, %80
%87 = load i32, i32* %12
%88 = icmp eq i32 %87, 1
br i1 %88, label %89, label %91
89: ; preds = %86
%90 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.9, i64 0, i64 0))
store i32 1, i32* %1
br label %98
91: ; preds = %86
%92 = load i32, i32* %11
%93 = icmp eq i32 %92, 1
br i1 %93, label %94, label %96
94: ; preds = %91
%95 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.10, i64 0, i64 0))
store i32 2, i32* %1
br label %98
96: ; preds = %91
%97 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.11, i64 0, i64 0))
store i32 0, i32* %1
br label %98
98: ; preds = %96, %94, %89
%99 = load i32, i32* %1
ret i32 %99
}

LLVM IR (-O2):
%struct.mq_attr = type { i32, i32 }
@.str = [14 x i8] c"test message1\00"
@.str.1 = [36 x i8] c"test message2 with differnet length\00"
@.str.2 = [19 x i8] c"/mq_receive_8-1_%d\00"
@O_CREAT = global i32 0
@O_RDWR = global i32 0
@S_IRUSR = global i32 0
@S_IWUSR = global i32 0
@.str.3 = [42 x i8] c"unexpected error: mq_receive 8-1: mq_open\00"
@.str.4 = [42 x i8] c"unexpected error: mq_receive 8-1: mq_send\00"
@.str.7 = [43 x i8] c"unexpected error: mq_receive 8-1: mq_close\00"
@.str.8 = [44 x i8] c"unexpected error: mq_receive 8-1: mq_unlink\00"
@str = [49 x i8] c"FAIL: mq_receive received the same message twice\00"
@str.12 = [12 x i8] c"Test PASSED\00"
@str.13 = [16 x i8] c"Test UNRESOLVED\00"
@str.14 = [12 x i8] c"Test FAILED\00"
@str.16 = [67 x i8] c"FAIL: mq_receive didn't return the selected message size correctly\00"
define i32 @main() {
%1 = alloca [50 x i8]
%2 = alloca [40 x i8]
%3 = alloca [40 x i8]
%4 = alloca i64
%5 = bitcast i64* %4 to %struct.mq_attr*
%6 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 0
%7 = getelementptr inbounds [40 x i8], [40 x i8]* %2, i64 0, i64 0
%8 = getelementptr inbounds [40 x i8], [40 x i8]* %3, i64 0, i64 0
%9 = bitcast i64* %4 to i8*
store i64 171798691880, i64* %4
%10 = tail call i32 (...) @getpid()
%11 = call i32 @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i32 %10)
%12 = load i32, i32* @O_CREAT
%13 = load i32, i32* @O_RDWR
%14 = or i32 %13, %12
%15 = load i32, i32* @S_IRUSR
%16 = load i32, i32* @S_IWUSR
%17 = or i32 %16, %15
%18 = call i64 @mq_open(i8* %6, i32 %14, i32 %17, %struct.mq_attr* %5)
%19 = icmp eq i64 %18, -1
br i1 %19, label %20, label %22
20: ; preds = %0
%21 = call i32 @perror(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.3, i64 0, i64 0))
br label %22
22: ; preds = %20, %0
%23 = phi i32 [ 1, %20 ], [ 0, %0 ]
%24 = call i64 @mq_send(i64 %18, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i64 13, i32 1)
%25 = icmp eq i64 %24, 0
br i1 %25, label %28, label %26
26: ; preds = %22
%27 = call i32 @perror(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.4, i64 0, i64 0))
br label %28
28: ; preds = %26, %22
%29 = phi i32 [ 1, %26 ], [ %23, %22 ]
%30 = call i64 @mq_send(i64 %18, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), i64 35, i32 2)
%31 = icmp eq i64 %30, 0
br i1 %31, label %34, label %32
32: ; preds = %28
%33 = call i32 @perror(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.4, i64 0, i64 0))
br label %34
34: ; preds = %32, %28
%35 = phi i32 [ 1, %32 ], [ %29, %28 ]
%36 = call i64 @mq_receive(i64 %18, i8* %7, i32 40, i32* null)
%37 = icmp eq i64 %36, 35
br i1 %37, label %40, label %38
38: ; preds = %34
%39 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([67 x i8], [67 x i8]* @str.16, i64 0, i64 0))
br label %40
40: ; preds = %38, %34
%41 = phi i32 [ 1, %38 ], [ 0, %34 ]
%42 = call i64 @mq_receive(i64 %18, i8* %8, i32 40, i32* null)
%43 = icmp eq i64 %42, 13
br i1 %43, label %46, label %44
44: ; preds = %40
%45 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([67 x i8], [67 x i8]* @str.16, i64 0, i64 0))
br label %46
46: ; preds = %44, %40
%47 = phi i32 [ 1, %44 ], [ %41, %40 ]
%48 = call i32 @strcmp(i8* %7, i8* %8)
%49 = icmp eq i32 %48, 0
br i1 %49, label %50, label %52
50: ; preds = %46
%51 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @str, i64 0, i64 0))
br label %52
52: ; preds = %50, %46
%53 = phi i32 [ %47, %46 ], [ 1, %50 ]
%54 = call i64 @mq_close(i64 %18)
%55 = icmp eq i64 %54, 0
br i1 %55, label %58, label %56
56: ; preds = %52
%57 = call i32 @perror(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.7, i64 0, i64 0))
br label %58
58: ; preds = %56, %52
%59 = phi i32 [ 1, %56 ], [ %35, %52 ]
%60 = call i64 @mq_unlink(i8* %6)
%61 = icmp eq i64 %60, 0
br i1 %61, label %62, label %64
62: ; preds = %58
%63 = icmp eq i32 %53, 1
br i1 %63, label %70, label %67
64: ; preds = %58
%65 = call i32 @perror(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.8, i64 0, i64 0))
%66 = icmp eq i32 %53, 1
br i1 %66, label %70, label %69
67: ; preds = %62
%68 = icmp eq i32 %59, 1
br i1 %68, label %69, label %70
69: ; preds = %64, %67
br label %70
70: ; preds = %67, %62, %64, %69
%71 = phi i8* [ getelementptr inbounds ([16 x i8], [16 x i8]* @str.13, i64 0, i64 0), %69 ], [ getelementptr inbounds ([12 x i8], [12 x i8]* @str.14, i64 0, i64 0), %64 ], [ getelementptr inbounds ([12 x i8], [12 x i8]* @str.14, i64 0, i64 0), %62 ], [ getelementptr inbounds ([12 x i8], [12 x i8]* @str.12, i64 0, i64 0), %67 ]
%72 = phi i32 [ 2, %69 ], [ 1, %64 ], [ 1, %62 ], [ 0, %67 ]
%73 = call i32 @puts(i8* dereferenceable(1) %71)
ret i32 %72
}