#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef scalar_t__ time_t;
struct timespec {
  scalar_t__ tv_nsec;
  scalar_t__ tv_sec;
};
struct mq_attr {
  int mq_msgsize;
  int mq_maxmsg;
};
typedef scalar_t__ mqd_t;

/* Variables and functions */
int O_CREAT;
int O_RDWR;
int S_IRUSR;
int S_IWUSR;
scalar_t__ WEXITSTATUS(int);
int fork();
int getpid();
scalar_t__ mq_close(scalar_t__);
scalar_t__ mq_open(char *, int, int, struct mq_attr *);
int mq_send(scalar_t__, char const *, int /*<<< orphan*/, int);
scalar_t__ mq_timedreceive(scalar_t__, char *, int, int /*<<< orphan*/ *,
                           struct timespec *);
scalar_t__ mq_unlink(char *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ sprintf(char *, char *, int);
int /*<<< orphan*/ strlen(char const *);
int /*<<< orphan*/ wait(int *);
int main(void) {
  char mqname[50], msgrv[40];
  const char *msgptr = "test message ";
  mqd_t mqdes;
  int prio = 1;
  int pid;
  struct timespec ts;
  struct mq_attr attr;
  int unresolved = 0, failure = 0;
  sprintf(mqname,
          "/"
          "mq_timedreceive"
          "_"
          "5-1"
          "_%d",
          getpid());
  attr.mq_msgsize = 40;
  attr.mq_maxmsg = 40;
  mqdes = mq_open(mqname, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR, &attr);
  if (mqdes == (mqd_t)-1) {
    perror("unexpected error: "
           "mq_timedreceive"
           " "
           "5-1"
           ": "
           "mq_open");
    unresolved = 1;
  }
  pid = fork();
  if (pid != 0) {
    int status;
    ts.tv_sec = (time_t)((1UL << ((sizeof(time_t) << 3) - 1)) - 1);
    ts.tv_nsec = 0;
    if (mq_timedreceive(mqdes, msgrv, 40, NULL, &ts) > 0) {
      wait(&status);
      if (WEXITSTATUS(status)) {
        printf("mq_send error\n");
        unresolved = 1;
      }
    } else {
      printf("mq_timedreceive didn't block on waiting\n");
      wait(NULL);
      perror("unexpected error: "
             "mq_timedreceive"
             " "
             "5-1"
             ": "
             "mq_timedreceive");
      failure = 1;
    }
    if (mq_close(mqdes) != 0) {
      perror("unexpected error: "
             "mq_timedreceive"
             " "
             "5-1"
             ": "
             "mq_close");
      unresolved = 1;
    }
    if (mq_unlink(mqname) != 0) {
      perror("unexpected error: "
             "mq_timedreceive"
             " "
             "5-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;
  } else {
    sleep(2);
    if (mq_send(mqdes, msgptr, strlen(msgptr), prio) == -1) {
      perror("unexpected error: "
             "mq_timedreceive"
             " "
             "5-1"
             ": "
             "mq_send");
      return 2;
    }
    return 0;
  }
  return 2;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe07(%rip),%rax
mov    %rax,-0x78(%rbp)
movl   $0x1,-0x84(%rbp)
movl   $0x0,-0xa4(%rbp)
movl   $0x0,-0xa8(%rbp)
lea    -0x40(%rbp),%rax
mov    %rax,-0xb8(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    -0xb8(%rbp),%rdi
mov    %eax,%edx
lea    0xdd1(%rip),%rsi
call   10c0 <sprintf@plt>
movl   $0x28,-0xa0(%rbp)
movl   $0x28,-0x9c(%rbp)
lea    -0x40(%rbp),%rdi
mov    0x2d97(%rip),%rax
mov    (%rax),%esi
mov    0x2d76(%rip),%rax
or     (%rax),%esi
mov    0x2d55(%rip),%rax
mov    (%rax),%edx
mov    0x2d5c(%rip),%rax
or     (%rax),%edx
lea    -0xa0(%rbp),%rcx
call   1090 <mq_open@plt>
mov    %rax,-0x80(%rbp)
cmpq   $0xffffffffffffffff,-0x80(%rbp)
jne    12af <main+0xcf>
lea    0xd86(%rip),%rdi
call   10b0 <perror@plt>
movl   $0x1,-0xa4(%rbp)
mov    $0x0,%al
call   1100 <fork@plt>
mov    %eax,-0x88(%rbp)
cmpl   $0x0,-0x88(%rbp)
je     1427 <main+0x247>
movabs $0x7fffffffffffffff,%rax
ff ff 7f
mov    %rax,-0x90(%rbp)
movq   $0x0,-0x98(%rbp)
mov    -0x80(%rbp),%rdi
lea    -0x70(%rbp),%rsi
mov    $0x28,%edx
xor    %eax,%eax
mov    %eax,%ecx
lea    -0x98(%rbp),%r8
call   1040 <mq_timedreceive@plt>
cmp    $0x0,%rax
jle    1348 <main+0x168>
lea    -0xac(%rbp),%rdi
call   10f0 <wait@plt>
mov    -0xac(%rbp),%edi
call   10a0 <WEXITSTATUS@plt>
cmp    $0x0,%rax
je     1343 <main+0x163>
lea    0xd21(%rip),%rdi
call   1060 <printf@plt>
movl   $0x1,-0xa4(%rbp)
jmp    1373 <main+0x193>
lea    0xd15(%rip),%rdi
call   1060 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   10f0 <wait@plt>
lea    0xd29(%rip),%rdi
call   10b0 <perror@plt>
movl   $0x1,-0xa8(%rbp)
mov    -0x80(%rbp),%rdi
call   1070 <mq_close@plt>
cmp    $0x0,%rax
je     139c <main+0x1bc>
lea    0xd37(%rip),%rdi
call   10b0 <perror@plt>
movl   $0x1,-0xa4(%rbp)
lea    -0x40(%rbp),%rdi
call   10d0 <mq_unlink@plt>
cmp    $0x0,%rax
je     13c5 <main+0x1e5>
lea    0xd3e(%rip),%rdi
call   10b0 <perror@plt>
movl   $0x1,-0xa4(%rbp)
cmpl   $0x1,-0xa8(%rbp)
jne    13ea <main+0x20a>
lea    0xd4c(%rip),%rdi
call   1060 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1493 <main+0x2b3>
cmpl   $0x1,-0xa4(%rbp)
jne    140f <main+0x22f>
lea    0xd34(%rip),%rdi
call   1060 <printf@plt>
movl   $0x2,-0x4(%rbp)
jmp    1493 <main+0x2b3>
lea    0xd2d(%rip),%rdi
call   1060 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1493 <main+0x2b3>
mov    $0x2,%edi
call   10e0 <sleep@plt>
mov    -0x80(%rbp),%rax
mov    %rax,-0xc8(%rbp)
mov    -0x78(%rbp),%rax
mov    %rax,-0xc0(%rbp)
mov    -0x78(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0xc8(%rbp),%rdi
mov    -0xc0(%rbp),%rsi
mov    %eax,%edx
mov    -0x84(%rbp),%ecx
call   1080 <mq_send@plt>
cmp    $0xffffffff,%eax
jne    148c <main+0x2ac>
lea    0xcd5(%rip),%rdi
call   10b0 <perror@plt>
movl   $0x2,-0x4(%rbp)
jmp    1493 <main+0x2b3>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x90,%rsp
xor    %r14d,%r14d
xor    %eax,%eax
call   1040 <getpid@plt>
lea    0xe22(%rip),%rsi
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
mov    %eax,%edx
call   10c0 <sprintf@plt>
movabs $0x2800000028,%rax
mov    %rax,0x8(%rsp)
mov    0x2dd7(%rip),%rax
mov    0x2db8(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    0x2d95(%rip),%rax
mov    0x2d9e(%rip),%rcx
mov    (%rcx),%edx
or     (%rax),%edx
lea    0x8(%rsp),%rcx
mov    %rbx,%rdi
call   1090 <mq_open@plt>
mov    %rax,%rbx
cmp    $0xffffffffffffffff,%rax
je     136c <main+0x18c>
xor    %ebp,%ebp
xor    %eax,%eax
call   1100 <fork@plt>
test   %eax,%eax
je     12fa <main+0x11a>
movaps 0xd90(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
lea    0x60(%rsp),%rsi
lea    0x10(%rsp),%r8
mov    %rbx,%rdi
mov    $0x28,%edx
xor    %ecx,%ecx
call   1050 <mq_timedreceive@plt>
test   %rax,%rax
jle    1383 <main+0x1a3>
lea    0x4(%rsp),%rdi
call   10f0 <wait@plt>
mov    0x4(%rsp),%edi
call   10a0 <WEXITSTATUS@plt>
test   %rax,%rax
je     12c1 <main+0xe1>
lea    0xec6(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%r14d
xor    %ebp,%ebp
mov    %rbx,%rdi
call   1070 <mq_close@plt>
test   %rax,%rax
jne    13aa <main+0x1ca>
lea    0x20(%rsp),%rdi
call   10d0 <mq_unlink@plt>
test   %rax,%rax
jne    13c1 <main+0x1e1>
test   %bpl,%bpl
je     133d <main+0x15d>
mov    $0x1,%ebp
lea    0xe78(%rip),%rdi
jmp    1359 <main+0x179>
mov    $0x2,%edi
call   10e0 <sleep@plt>
lea    0xd05(%rip),%r14
mov    %r14,%rdi
call   1060 <strlen@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %eax,%edx
mov    $0x1,%ecx
call   1080 <mq_send@plt>
cmp    $0xffffffff,%eax
jne    135e <main+0x17e>
lea    0xdcc(%rip),%rdi
call   10b0 <perror@plt>
mov    $0x2,%ebp
jmp    135e <main+0x17e>
test   %r14d,%r14d
je     1350 <main+0x170>
mov    $0x2,%ebp
lea    0xe12(%rip),%rdi
jmp    1359 <main+0x179>
xor    %ebp,%ebp
lea    0xdfb(%rip),%rdi
call   1030 <puts@plt>
mov    %ebp,%eax
add    $0x90,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret
lea    0xcc3(%rip),%rdi
call   10b0 <perror@plt>
mov    $0x1,%r14d
jmp    1258 <main+0x78>
lea    0xda2(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   10f0 <wait@plt>
lea    0xcc8(%rip),%rdi
call   10b0 <perror@plt>
mov    $0x1,%bpl
jmp    12c3 <main+0xe3>
lea    0xceb(%rip),%rdi
call   10b0 <perror@plt>
mov    $0x1,%r14d
jmp    12d4 <main+0xf4>
lea    0xd04(%rip),%rdi
call   10b0 <perror@plt>
test   %bpl,%bpl
jne    12ec <main+0x10c>
jmp    1342 <main+0x162>

LLVM IR (-O0):
%struct.timespec = type { i64, i64 }
%struct.mq_attr = type { i32, i32 }
@.str = [14 x i8] c"test message \00"
@.str.1 = [24 x i8] c"/mq_timedreceive_5-1_%d\00"
@O_CREAT = global i32 0
@O_RDWR = global i32 0
@S_IRUSR = global i32 0
@S_IWUSR = global i32 0
@.str.2 = [47 x i8] c"unexpected error: mq_timedreceive 5-1: mq_open\00"
@.str.3 = [15 x i8] c"mq_send error\0A\00"
@.str.4 = [41 x i8] c"mq_timedreceive didn't block on waiting\0A\00"
@.str.5 = [55 x i8] c"unexpected error: mq_timedreceive 5-1: mq_timedreceive\00"
@.str.6 = [48 x i8] c"unexpected error: mq_timedreceive 5-1: mq_close\00"
@.str.7 = [49 x i8] c"unexpected error: mq_timedreceive 5-1: mq_unlink\00"
@.str.8 = [13 x i8] c"Test FAILED\0A\00"
@.str.9 = [17 x i8] c"Test UNRESOLVED\0A\00"
@.str.10 = [13 x i8] c"Test PASSED\0A\00"
@.str.11 = [47 x i8] c"unexpected error: mq_timedreceive 5-1: mq_send\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [50 x i8]
%3 = alloca [40 x i8]
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i32
%7 = alloca i32
%8 = alloca %struct.timespec
%9 = alloca %struct.mq_attr
%10 = alloca i32
%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** %4
store i32 1, i32* %6
store i32 0, i32* %10
store i32 0, i32* %11
%13 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%14 = call i32 (...) @getpid()
%15 = call i32 @sprintf(i8* %13, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i32 %14)
%16 = getelementptr inbounds %struct.mq_attr, %struct.mq_attr* %9, i32 0, i32 0
store i32 40, i32* %16
%17 = getelementptr inbounds %struct.mq_attr, %struct.mq_attr* %9, i32 0, i32 1
store i32 40, i32* %17
%18 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%19 = load i32, i32* @O_CREAT
%20 = load i32, i32* @O_RDWR
%21 = or i32 %19, %20
%22 = load i32, i32* @S_IRUSR
%23 = load i32, i32* @S_IWUSR
%24 = or i32 %22, %23
%25 = call i64 @mq_open(i8* %18, i32 %21, i32 %24, %struct.mq_attr* %9)
store i64 %25, i64* %5
%26 = load i64, i64* %5
%27 = icmp eq i64 %26, -1
br i1 %27, label %28, label %30
28: ; preds = %0
%29 = call i32 @perror(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %10
br label %30
30: ; preds = %28, %0
%31 = call i32 (...) @fork()
store i32 %31, i32* %7
%32 = load i32, i32* %7
%33 = icmp ne i32 %32, 0
br i1 %33, label %34, label %77
34: ; preds = %30
%35 = getelementptr inbounds %struct.timespec, %struct.timespec* %8, i32 0, i32 1
store i64 9223372036854775807, i64* %35
%36 = getelementptr inbounds %struct.timespec, %struct.timespec* %8, i32 0, i32 0
store i64 0, i64* %36
%37 = load i64, i64* %5
%38 = getelementptr inbounds [40 x i8], [40 x i8]* %3, i64 0, i64 0
%39 = call i64 @mq_timedreceive(i64 %37, i8* %38, i32 40, i32* null, %struct.timespec* %8)
%40 = icmp sgt i64 %39, 0
br i1 %40, label %41, label %49
41: ; preds = %34
%42 = call i32 @wait(i32* %12)
%43 = load i32, i32* %12
%44 = call i64 @WEXITSTATUS(i32 %43)
%45 = icmp ne i64 %44, 0
br i1 %45, label %46, label %48
46: ; preds = %41
%47 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
store i32 1, i32* %10
br label %48
48: ; preds = %46, %41
br label %53
49: ; preds = %34
%50 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.4, i64 0, i64 0))
%51 = call i32 @wait(i32* null)
%52 = call i32 @perror(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.5, i64 0, i64 0))
store i32 1, i32* %11
br label %53
53: ; preds = %49, %48
%54 = load i64, i64* %5
%55 = call i64 @mq_close(i64 %54)
%56 = icmp ne i64 %55, 0
br i1 %56, label %57, label %59
57: ; preds = %53
%58 = call i32 @perror(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.6, i64 0, i64 0))
store i32 1, i32* %10
br label %59
59: ; preds = %57, %53
%60 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%61 = call i64 @mq_unlink(i8* %60)
%62 = icmp ne i64 %61, 0
br i1 %62, label %63, label %65
63: ; preds = %59
%64 = call i32 @perror(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.7, i64 0, i64 0))
store i32 1, i32* %10
br label %65
65: ; preds = %63, %59
%66 = load i32, i32* %11
%67 = icmp eq i32 %66, 1
br i1 %67, label %68, label %70
68: ; preds = %65
%69 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0))
store i32 1, i32* %1
br label %89
70: ; preds = %65
%71 = load i32, i32* %10
%72 = icmp eq i32 %71, 1
br i1 %72, label %73, label %75
73: ; preds = %70
%74 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.9, i64 0, i64 0))
store i32 2, i32* %1
br label %89
75: ; preds = %70
%76 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.10, i64 0, i64 0))
store i32 0, i32* %1
br label %89
77: ; preds = %30
%78 = call i32 @sleep(i32 2)
%79 = load i64, i64* %5
%80 = load i8*, i8** %4
%81 = load i8*, i8** %4
%82 = call i32 @strlen(i8* %81)
%83 = load i32, i32* %6
%84 = call i32 @mq_send(i64 %79, i8* %80, i32 %82, i32 %83)
%85 = icmp eq i32 %84, -1
br i1 %85, label %86, label %88
86: ; preds = %77
%87 = call i32 @perror(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.11, i64 0, i64 0))
store i32 2, i32* %1
br label %89
88: ; preds = %77
store i32 0, i32* %1
br label %89
89: ; preds = %88, %86, %75, %73, %68
%90 = load i32, i32* %1
ret i32 %90
}

LLVM IR (-O2):
%struct.timespec = type { i64, i64 }
%struct.mq_attr = type { i32, i32 }
@.str = [14 x i8] c"test message \00"
@.str.1 = [24 x i8] c"/mq_timedreceive_5-1_%d\00"
@O_CREAT = global i32 0
@O_RDWR = global i32 0
@S_IRUSR = global i32 0
@S_IWUSR = global i32 0
@.str.2 = [47 x i8] c"unexpected error: mq_timedreceive 5-1: mq_open\00"
@.str.5 = [55 x i8] c"unexpected error: mq_timedreceive 5-1: mq_timedreceive\00"
@.str.6 = [48 x i8] c"unexpected error: mq_timedreceive 5-1: mq_close\00"
@.str.7 = [49 x i8] c"unexpected error: mq_timedreceive 5-1: mq_unlink\00"
@.str.11 = [47 x i8] c"unexpected error: mq_timedreceive 5-1: mq_send\00"
@str = [40 x i8] c"mq_timedreceive didn't block on waiting\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.15 = [14 x i8] c"mq_send error\00"
define i32 @main() {
%1 = alloca [50 x i8]
%2 = alloca [40 x i8]
%3 = alloca <2 x i64>
%4 = bitcast <2 x i64>* %3 to %struct.timespec*
%5 = alloca %struct.mq_attr
%6 = alloca i32
%7 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 0
%8 = getelementptr inbounds [40 x i8], [40 x i8]* %2, i64 0, i64 0
%9 = bitcast <2 x i64>* %3 to i8*
%10 = bitcast %struct.mq_attr* %5 to i8*
%11 = tail call i32 (...) @getpid()
%12 = call i32 @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i32 %11)
%13 = getelementptr inbounds %struct.mq_attr, %struct.mq_attr* %5, i64 0, i32 0
store i32 40, i32* %13
%14 = getelementptr inbounds %struct.mq_attr, %struct.mq_attr* %5, i64 0, i32 1
store i32 40, i32* %14
%15 = load i32, i32* @O_CREAT
%16 = load i32, i32* @O_RDWR
%17 = or i32 %16, %15
%18 = load i32, i32* @S_IRUSR
%19 = load i32, i32* @S_IWUSR
%20 = or i32 %19, %18
%21 = call i64 @mq_open(i8* %7, i32 %17, i32 %20, %struct.mq_attr* %5)
%22 = icmp eq i64 %21, -1
br i1 %22, label %23, label %25
23: ; preds = %0
%24 = call i32 @perror(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.2, i64 0, i64 0))
br label %25
25: ; preds = %23, %0
%26 = phi i32 [ 1, %23 ], [ 0, %0 ]
%27 = call i32 (...) @fork()
%28 = icmp eq i32 %27, 0
br i1 %28, label %65, label %29
29: ; preds = %25
%30 = bitcast i32* %6 to i8*
store <2 x i64> <i64 0, i64 9223372036854775807>, <2 x i64>* %3
%31 = call i64 @mq_timedreceive(i64 %21, i8* %8, i32 40, i32* null, %struct.timespec* %4)
%32 = icmp sgt i64 %31, 0
br i1 %32, label %33, label %40
33: ; preds = %29
%34 = call i32 @wait(i32* %6)
%35 = load i32, i32* %6
%36 = call i64 @WEXITSTATUS(i32 %35)
%37 = icmp eq i64 %36, 0
br i1 %37, label %44, label %38
38: ; preds = %33
%39 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.15, i64 0, i64 0))
br label %44
40: ; preds = %29
%41 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str, i64 0, i64 0))
%42 = call i32 @wait(i32* null)
%43 = call i32 @perror(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.5, i64 0, i64 0))
br label %44
44: ; preds = %33, %38, %40
%45 = phi i32 [ 1, %38 ], [ %26, %33 ], [ %26, %40 ]
%46 = phi i1 [ false, %38 ], [ false, %33 ], [ true, %40 ]
%47 = call i64 @mq_close(i64 %21)
%48 = icmp eq i64 %47, 0
br i1 %48, label %51, label %49
49: ; preds = %44
%50 = call i32 @perror(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.6, i64 0, i64 0))
br label %51
51: ; preds = %49, %44
%52 = phi i32 [ 1, %49 ], [ %45, %44 ]
%53 = call i64 @mq_unlink(i8* %7)
%54 = icmp eq i64 %53, 0
br i1 %54, label %55, label %56
55: ; preds = %51
br i1 %46, label %61, label %58
56: ; preds = %51
%57 = call i32 @perror(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.7, i64 0, i64 0))
br i1 %46, label %61, label %60
58: ; preds = %55
%59 = icmp eq i32 %52, 1
br i1 %59, label %60, label %61
60: ; preds = %56, %58
br label %61
61: ; preds = %58, %55, %56, %60
%62 = phi i8* [ getelementptr inbounds ([16 x i8], [16 x i8]* @str.13, i64 0, i64 0), %60 ], [ getelementptr inbounds ([12 x i8], [12 x i8]* @str.14, i64 0, i64 0), %56 ], [ getelementptr inbounds ([12 x i8], [12 x i8]* @str.14, i64 0, i64 0), %55 ], [ getelementptr inbounds ([12 x i8], [12 x i8]* @str.12, i64 0, i64 0), %58 ]
%63 = phi i32 [ 2, %60 ], [ 1, %56 ], [ 1, %55 ], [ 0, %58 ]
%64 = call i32 @puts(i8* dereferenceable(1) %62)
br label %72
65: ; preds = %25
%66 = call i32 @sleep(i32 2)
%67 = call i32 @strlen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%68 = call i32 @mq_send(i64 %21, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %67, i32 1)
%69 = icmp eq i32 %68, -1
br i1 %69, label %70, label %72
70: ; preds = %65
%71 = call i32 @perror(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.11, i64 0, i64 0))
br label %72
72: ; preds = %65, %70, %61
%73 = phi i32 [ %63, %61 ], [ 2, %70 ], [ 0, %65 ]
ret i32 %73
}