#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 timeval {
  double tv_sec;
  double tv_usec;
};
struct mq_attr {
  int mq_maxmsg;
  int mq_msgsize;
  scalar_t__ mq_flags;
};
typedef int /*<<< orphan*/ pid_t;
typedef int mqd_t;
typedef int mode_t;

/* Variables and functions */
int O_CREAT;
int O_RDWR;
int S_IRUSR;
int S_IWUSR;
int atoi(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
int mq_open(char *, int, int, struct mq_attr *);
scalar_t__ mq_send(int, char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ spawn(char *, char **, int, double);
int /*<<< orphan*/ sprintf(char *, char *, int, int);
int main(int argc, char *argv[]) {
  if (argc < 5) {
    printf("Incorrect number of arguments. \n");
    exit(1);
  }
  pid_t wpid;
  int status;
  struct timeval tv;
  double t1;
  int N = atoi(argv[1]);
  int B = atoi(argv[2]);
  int P = atoi(argv[3]);
  int C = atoi(argv[4]);
  if (N < 0 || B < 0 || P < 0 || C < 0) {
    printf("Not all arguments are positive integers. \n");
    exit(1);
  }
  mqd_t qdes;
  char *qname = "/m5mathew_mailbox";
  mode_t mode = S_IRUSR | S_IWUSR;
  struct mq_attr attr;
  attr.mq_maxmsg = B;
  attr.mq_msgsize = sizeof(int);
  attr.mq_flags = 0;
  qdes = mq_open(qname, O_RDWR | O_CREAT, mode, &attr);
  if (qdes == -1) {
    perror("mq_open() process has failed!!!");
    exit(1);
  }
  mqd_t qdes_cs;
  char *qname_cs = "/m5mathew_mailbox_cs";
  mode_t mode_cs = S_IRUSR | S_IWUSR;
  struct mq_attr attr_cs;
  attr_cs.mq_maxmsg = 1;
  attr_cs.mq_msgsize = sizeof(int);
  attr_cs.mq_flags = 0;
  qdes_cs = mq_open(qname_cs, O_RDWR | O_CREAT, mode_cs, &attr_cs);
  if (qdes_cs == -1) {
    perror("mq_open() for consumption failed");
    exit(1);
  }
  char *num_prod_cons;
  sprintf(num_prod_cons, " %d %d ", P, C);
  if (mq_send(qdes_cs, num_prod_cons, sizeof(int), 0) != 0) {
    perror("mq_send() failed");
    exit(1);
  }
  int i, j;
  gettimeofday(&tv, NULL);
  t1 = tv.tv_sec + tv.tv_usec / 1000000.0;
  for (i = 0; i < P; i++) {
    spawn("./produce", argv, i, 0.0);
  }
  for (j = 0; j < C; j++) {
    spawn("./consume", argv, j, t1);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x5,-0x8(%rbp)
jge    11c9 <main+0x39>
lea    0xe4e(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1090 <atoi@plt>
mov    %eax,-0x34(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1090 <atoi@plt>
mov    %eax,-0x38(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1090 <atoi@plt>
mov    %eax,-0x3c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
call   1090 <atoi@plt>
mov    %eax,-0x40(%rbp)
cmpl   $0x0,-0x34(%rbp)
jl     1231 <main+0xa1>
cmpl   $0x0,-0x38(%rbp)
jl     1231 <main+0xa1>
cmpl   $0x0,-0x3c(%rbp)
jl     1231 <main+0xa1>
cmpl   $0x0,-0x40(%rbp)
jge    1247 <main+0xb7>
lea    0xdf1(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
lea    0xe06(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    0x2d6f(%rip),%rax
mov    (%rax),%eax
mov    0x2d76(%rip),%rcx
or     (%rcx),%eax
mov    %eax,-0x54(%rbp)
mov    -0x38(%rbp),%eax
mov    %eax,-0x68(%rbp)
movl   $0x4,-0x64(%rbp)
movq   $0x0,-0x60(%rbp)
mov    -0x50(%rbp),%rdi
mov    0x2d59(%rip),%rax
mov    (%rax),%esi
mov    0x2d68(%rip),%rax
or     (%rax),%esi
mov    -0x54(%rbp),%edx
lea    -0x68(%rbp),%rcx
call   1060 <mq_open@plt>
mov    %eax,-0x44(%rbp)
cmpl   $0xffffffff,-0x44(%rbp)
jne    12c1 <main+0x131>
lea    0xdb4(%rip),%rdi
call   1080 <perror@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
lea    0xdbe(%rip),%rax
mov    %rax,-0x78(%rbp)
mov    0x2cf5(%rip),%rax
mov    (%rax),%eax
mov    0x2cfc(%rip),%rcx
or     (%rcx),%eax
mov    %eax,-0x7c(%rbp)
movl   $0x1,-0x90(%rbp)
movl   $0x4,-0x8c(%rbp)
movq   $0x0,-0x88(%rbp)
mov    -0x78(%rbp),%rdi
mov    0x2cd5(%rip),%rax
mov    (%rax),%esi
mov    0x2ce4(%rip),%rax
or     (%rax),%esi
mov    -0x7c(%rbp),%edx
lea    -0x90(%rbp),%rcx
call   1060 <mq_open@plt>
mov    %eax,-0x6c(%rbp)
cmpl   $0xffffffff,-0x6c(%rbp)
jne    1348 <main+0x1b8>
lea    0xd62(%rip),%rdi
call   1080 <perror@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
mov    -0x98(%rbp),%rdi
mov    -0x3c(%rbp),%edx
mov    -0x40(%rbp),%ecx
lea    0xd60(%rip),%rsi
call   10a0 <sprintf@plt>
mov    -0x6c(%rbp),%edi
mov    -0x98(%rbp),%rsi
mov    $0x4,%edx
xor    %ecx,%ecx
call   1050 <mq_send@plt>
cmp    $0x0,%rax
je     1397 <main+0x207>
lea    0xd3c(%rip),%rdi
call   1080 <perror@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
lea    -0x28(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <gettimeofday@plt>
movsd  -0x28(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  0xc4a(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movl   $0x0,-0x9c(%rbp)
mov    -0x9c(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jge    1409 <main+0x279>
mov    -0x10(%rbp),%rsi
mov    -0x9c(%rbp),%edx
lea    0xce8(%rip),%rdi
xorps  %xmm0,%xmm0
call   1070 <spawn@plt>
mov    -0x9c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x9c(%rbp)
jmp    13cd <main+0x23d>
movl   $0x0,-0xa0(%rbp)
mov    -0xa0(%rbp),%eax
cmp    -0x40(%rbp),%eax
jge    1451 <main+0x2c1>
mov    -0x10(%rbp),%rsi
mov    -0xa0(%rbp),%edx
movsd  -0x30(%rbp),%xmm0
lea    0xca7(%rip),%rdi
call   1070 <spawn@plt>
mov    -0xa0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xa0(%rbp)
jmp    1413 <main+0x283>
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
cmp    $0x4,%edi
jle    135b <main+0x1cb>
mov    %rsi,%r13
mov    0x8(%rsi),%rdi
call   1090 <atoi@plt>
mov    %eax,%ebx
mov    0x10(%r13),%rdi
call   1090 <atoi@plt>
mov    %eax,%r15d
mov    0x18(%r13),%rdi
call   1090 <atoi@plt>
mov    %eax,%r12d
mov    0x20(%r13),%rdi
call   1090 <atoi@plt>
test   %ebx,%ebx
js     1364 <main+0x1d4>
test   %r15d,%r15d
js     1364 <main+0x1d4>
test   %r12d,%r12d
js     1364 <main+0x1d4>
mov    %eax,%r14d
test   %eax,%eax
js     1364 <main+0x1d4>
mov    0x2dc6(%rip),%rax
mov    0x2dcf(%rip),%rbx
mov    (%rbx),%edx
or     (%rax),%edx
mov    %r15d,0x8(%rsp)
movl   $0x4,0xc(%rsp)
movq   $0x0,0x10(%rsp)
mov    0x2db6(%rip),%r15
mov    0x2dc7(%rip),%rbp
mov    0x0(%rbp),%esi
or     (%r15),%esi
lea    0xdca(%rip),%rdi
lea    0x8(%rsp),%rcx
call   1060 <mq_open@plt>
cmp    $0xffffffff,%eax
je     137a <main+0x1ea>
mov    (%rbx),%edx
mov    0x2d6e(%rip),%rax
or     (%rax),%edx
movabs $0x400000001,%rax
mov    %rax,0x18(%rsp)
movq   $0x0,0x20(%rsp)
mov    0x0(%rbp),%esi
or     (%r15),%esi
lea    0xdb9(%rip),%rdi
lea    0x18(%rsp),%rcx
call   1060 <mq_open@plt>
cmp    $0xffffffff,%eax
je     1383 <main+0x1f3>
mov    %eax,%ebx
lea    0xdd3(%rip),%rsi
mov    %r12d,%edx
mov    %r14d,%ecx
call   10a0 <sprintf@plt>
mov    %ebx,%edi
mov    $0x4,%edx
xor    %ecx,%ecx
call   1050 <mq_send@plt>
test   %rax,%rax
jne    138c <main+0x1fc>
xor    %ebp,%ebp
lea    0x28(%rsp),%rdi
xor    %esi,%esi
call   1040 <gettimeofday@plt>
movsd  0x30(%rsp),%xmm0
divsd  0xd25(%rip),%xmm0
addsd  0x28(%rsp),%xmm0
movsd  %xmm0,(%rsp)
test   %r12d,%r12d
je     1319 <main+0x189>
lea    0xd97(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xorpd  %xmm0,%xmm0
mov    %rbx,%rdi
mov    %r13,%rsi
mov    %ebp,%edx
call   1070 <spawn@plt>
add    $0x1,%ebp
cmp    %ebp,%r12d
jne    1300 <main+0x170>
test   %r14d,%r14d
jle    134a <main+0x1ba>
xor    %ebx,%ebx
lea    0xd6c(%rip),%rbp
nopw   0x0(%rax,%rax,1)
mov    %rbp,%rdi
mov    %r13,%rsi
mov    %ebx,%edx
movsd  (%rsp),%xmm0
call   1070 <spawn@plt>
add    $0x1,%ebx
cmp    %ebx,%r14d
jne    1330 <main+0x1a0>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xd65(%rip),%rdi
jmp    136b <main+0x1db>
lea    0xd32(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
lea    0xc99(%rip),%rdi
jmp    1393 <main+0x203>
lea    0xcc5(%rip),%rdi
jmp    1393 <main+0x203>
lea    0xce5(%rip),%rdi
call   1080 <perror@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>

LLVM IR (-O0):
%struct.timeval = type { double, double }
%struct.mq_attr = type { i32, i32, i64 }
@.str = [33 x i8] c"Incorrect number of arguments. \0A\00"
@.str.1 = [43 x i8] c"Not all arguments are positive integers. \0A\00"
@.str.2 = [18 x i8] c"/m5mathew_mailbox\00"
@S_IRUSR = global i32 0
@S_IWUSR = global i32 0
@O_RDWR = global i32 0
@O_CREAT = global i32 0
@.str.3 = [32 x i8] c"mq_open() process has failed!!!\00"
@.str.4 = [21 x i8] c"/m5mathew_mailbox_cs\00"
@.str.5 = [33 x i8] c"mq_open() for consumption failed\00"
@.str.6 = [8 x i8] c" %d %d \00"
@.str.7 = [17 x i8] c"mq_send() failed\00"
@.str.8 = [10 x i8] c"./produce\00"
@.str.9 = [10 x i8] c"./consume\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca %struct.timeval
%9 = alloca double
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i8*
%16 = alloca i32
%17 = alloca %struct.mq_attr
%18 = alloca i32
%19 = alloca i8*
%20 = alloca i32
%21 = alloca %struct.mq_attr
%22 = alloca i8*
%23 = alloca i32
%24 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%25 = load i32, i32* %4
%26 = icmp slt i32 %25, 5
br i1 %26, label %27, label %30
27: ; preds = %2
%28 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%29 = call i32 @exit(i32 1)
unreachable
30: ; preds = %2
%31 = load i8**, i8*** %5
%32 = getelementptr inbounds i8*, i8** %31, i64 1
%33 = load i8*, i8** %32
%34 = call i32 @atoi(i8* %33)
store i32 %34, i32* %10
%35 = load i8**, i8*** %5
%36 = getelementptr inbounds i8*, i8** %35, i64 2
%37 = load i8*, i8** %36
%38 = call i32 @atoi(i8* %37)
store i32 %38, i32* %11
%39 = load i8**, i8*** %5
%40 = getelementptr inbounds i8*, i8** %39, i64 3
%41 = load i8*, i8** %40
%42 = call i32 @atoi(i8* %41)
store i32 %42, i32* %12
%43 = load i8**, i8*** %5
%44 = getelementptr inbounds i8*, i8** %43, i64 4
%45 = load i8*, i8** %44
%46 = call i32 @atoi(i8* %45)
store i32 %46, i32* %13
%47 = load i32, i32* %10
%48 = icmp slt i32 %47, 0
br i1 %48, label %58, label %49
49: ; preds = %30
%50 = load i32, i32* %11
%51 = icmp slt i32 %50, 0
br i1 %51, label %58, label %52
52: ; preds = %49
%53 = load i32, i32* %12
%54 = icmp slt i32 %53, 0
br i1 %54, label %58, label %55
55: ; preds = %52
%56 = load i32, i32* %13
%57 = icmp slt i32 %56, 0
br i1 %57, label %58, label %61
58: ; preds = %55, %52, %49, %30
%59 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0))
%60 = call i32 @exit(i32 1)
unreachable
61: ; preds = %55
store i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8** %15
%62 = load i32, i32* @S_IRUSR
%63 = load i32, i32* @S_IWUSR
%64 = or i32 %62, %63
store i32 %64, i32* %16
%65 = load i32, i32* %11
%66 = getelementptr inbounds %struct.mq_attr, %struct.mq_attr* %17, i32 0, i32 0
store i32 %65, i32* %66
%67 = getelementptr inbounds %struct.mq_attr, %struct.mq_attr* %17, i32 0, i32 1
store i32 4, i32* %67
%68 = getelementptr inbounds %struct.mq_attr, %struct.mq_attr* %17, i32 0, i32 2
store i64 0, i64* %68
%69 = load i8*, i8** %15
%70 = load i32, i32* @O_RDWR
%71 = load i32, i32* @O_CREAT
%72 = or i32 %70, %71
%73 = load i32, i32* %16
%74 = call i32 @mq_open(i8* %69, i32 %72, i32 %73, %struct.mq_attr* %17)
store i32 %74, i32* %14
%75 = load i32, i32* %14
%76 = icmp eq i32 %75, -1
br i1 %76, label %77, label %80
77: ; preds = %61
%78 = call i32 @perror(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0))
%79 = call i32 @exit(i32 1)
unreachable
80: ; preds = %61
store i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i8** %19
%81 = load i32, i32* @S_IRUSR
%82 = load i32, i32* @S_IWUSR
%83 = or i32 %81, %82
store i32 %83, i32* %20
%84 = getelementptr inbounds %struct.mq_attr, %struct.mq_attr* %21, i32 0, i32 0
store i32 1, i32* %84
%85 = getelementptr inbounds %struct.mq_attr, %struct.mq_attr* %21, i32 0, i32 1
store i32 4, i32* %85
%86 = getelementptr inbounds %struct.mq_attr, %struct.mq_attr* %21, i32 0, i32 2
store i64 0, i64* %86
%87 = load i8*, i8** %19
%88 = load i32, i32* @O_RDWR
%89 = load i32, i32* @O_CREAT
%90 = or i32 %88, %89
%91 = load i32, i32* %20
%92 = call i32 @mq_open(i8* %87, i32 %90, i32 %91, %struct.mq_attr* %21)
store i32 %92, i32* %18
%93 = load i32, i32* %18
%94 = icmp eq i32 %93, -1
br i1 %94, label %95, label %98
95: ; preds = %80
%96 = call i32 @perror(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.5, i64 0, i64 0))
%97 = call i32 @exit(i32 1)
unreachable
98: ; preds = %80
%99 = load i8*, i8** %22
%100 = load i32, i32* %12
%101 = load i32, i32* %13
%102 = call i32 @sprintf(i8* %99, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), i32 %100, i32 %101)
%103 = load i32, i32* %18
%104 = load i8*, i8** %22
%105 = call i64 @mq_send(i32 %103, i8* %104, i32 4, i32 0)
%106 = icmp ne i64 %105, 0
br i1 %106, label %107, label %110
107: ; preds = %98
%108 = call i32 @perror(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.7, i64 0, i64 0))
%109 = call i32 @exit(i32 1)
unreachable
110: ; preds = %98
%111 = call i32 @gettimeofday(%struct.timeval* %8, i32* null)
%112 = getelementptr inbounds %struct.timeval, %struct.timeval* %8, i32 0, i32 0
%113 = load double, double* %112
%114 = getelementptr inbounds %struct.timeval, %struct.timeval* %8, i32 0, i32 1
%115 = load double, double* %114
%116 = fdiv double %115, 1.000000e+06
%117 = fadd double %113, %116
store double %117, double* %9
store i32 0, i32* %23
br label %118
118: ; preds = %126, %110
%119 = load i32, i32* %23
%120 = load i32, i32* %12
%121 = icmp slt i32 %119, %120
br i1 %121, label %122, label %129
122: ; preds = %118
%123 = load i8**, i8*** %5
%124 = load i32, i32* %23
%125 = call i32 @spawn(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0), i8** %123, i32 %124, double 0.000000e+00)
br label %126
126: ; preds = %122
%127 = load i32, i32* %23
%128 = add nsw i32 %127, 1
store i32 %128, i32* %23
br label %118
129: ; preds = %118
store i32 0, i32* %24
br label %130
130: ; preds = %139, %129
%131 = load i32, i32* %24
%132 = load i32, i32* %13
%133 = icmp slt i32 %131, %132
br i1 %133, label %134, label %142
134: ; preds = %130
%135 = load i8**, i8*** %5
%136 = load i32, i32* %24
%137 = load double, double* %9
%138 = call i32 @spawn(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0), i8** %135, i32 %136, double %137)
br label %139
139: ; preds = %134
%140 = load i32, i32* %24
%141 = add nsw i32 %140, 1
store i32 %141, i32* %24
br label %130
142: ; preds = %130
ret i32 0
}

LLVM IR (-O2):
%struct.timeval = type { double, double }
%struct.mq_attr = type { i32, i32, i64 }
@.str.2 = [18 x i8] c"/m5mathew_mailbox\00"
@S_IRUSR = global i32 0
@S_IWUSR = global i32 0
@O_RDWR = global i32 0
@O_CREAT = global i32 0
@.str.3 = [32 x i8] c"mq_open() process has failed!!!\00"
@.str.4 = [21 x i8] c"/m5mathew_mailbox_cs\00"
@.str.5 = [33 x i8] c"mq_open() for consumption failed\00"
@.str.6 = [8 x i8] c" %d %d \00"
@.str.7 = [17 x i8] c"mq_send() failed\00"
@.str.8 = [10 x i8] c"./produce\00"
@.str.9 = [10 x i8] c"./consume\00"
@str = [42 x i8] c"Not all arguments are positive integers. \00"
@str.10 = [32 x i8] c"Incorrect number of arguments. \00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca %struct.timeval
%4 = alloca %struct.mq_attr
%5 = alloca %struct.mq_attr
%6 = icmp slt i32 %0, 5
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.10, i64 0, i64 0))
%9 = tail call i32 @exit(i32 1)
unreachable
10: ; preds = %2
%11 = bitcast %struct.timeval* %3 to i8*
%12 = getelementptr inbounds i8*, i8** %1, i64 1
%13 = load i8*, i8** %12
%14 = tail call i32 @atoi(i8* %13)
%15 = getelementptr inbounds i8*, i8** %1, i64 2
%16 = load i8*, i8** %15
%17 = tail call i32 @atoi(i8* %16)
%18 = getelementptr inbounds i8*, i8** %1, i64 3
%19 = load i8*, i8** %18
%20 = tail call i32 @atoi(i8* %19)
%21 = getelementptr inbounds i8*, i8** %1, i64 4
%22 = load i8*, i8** %21
%23 = tail call i32 @atoi(i8* %22)
%24 = icmp slt i32 %14, 0
%25 = icmp slt i32 %17, 0
%26 = select i1 %24, i1 true, i1 %25
%27 = icmp slt i32 %20, 0
%28 = select i1 %26, i1 true, i1 %27
%29 = icmp slt i32 %23, 0
%30 = select i1 %28, i1 true, i1 %29
br i1 %30, label %31, label %34
31: ; preds = %10
%32 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str, i64 0, i64 0))
%33 = tail call i32 @exit(i32 1)
unreachable
34: ; preds = %10
%35 = load i32, i32* @S_IRUSR
%36 = load i32, i32* @S_IWUSR
%37 = or i32 %36, %35
%38 = bitcast %struct.mq_attr* %4 to i8*
%39 = getelementptr inbounds %struct.mq_attr, %struct.mq_attr* %4, i64 0, i32 0
store i32 %17, i32* %39
%40 = getelementptr inbounds %struct.mq_attr, %struct.mq_attr* %4, i64 0, i32 1
store i32 4, i32* %40
%41 = getelementptr inbounds %struct.mq_attr, %struct.mq_attr* %4, i64 0, i32 2
store i64 0, i64* %41
%42 = load i32, i32* @O_RDWR
%43 = load i32, i32* @O_CREAT
%44 = or i32 %43, %42
%45 = call i32 @mq_open(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 %44, i32 %37, %struct.mq_attr* %4)
%46 = icmp eq i32 %45, -1
br i1 %46, label %47, label %50
47: ; preds = %34
%48 = call i32 @perror(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0))
%49 = call i32 @exit(i32 1)
unreachable
50: ; preds = %34
%51 = load i32, i32* @S_IRUSR
%52 = load i32, i32* @S_IWUSR
%53 = or i32 %52, %51
%54 = bitcast %struct.mq_attr* %5 to i8*
%55 = getelementptr inbounds %struct.mq_attr, %struct.mq_attr* %5, i64 0, i32 0
store i32 1, i32* %55
%56 = getelementptr inbounds %struct.mq_attr, %struct.mq_attr* %5, i64 0, i32 1
store i32 4, i32* %56
%57 = getelementptr inbounds %struct.mq_attr, %struct.mq_attr* %5, i64 0, i32 2
store i64 0, i64* %57
%58 = load i32, i32* @O_RDWR
%59 = load i32, i32* @O_CREAT
%60 = or i32 %59, %58
%61 = call i32 @mq_open(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i32 %60, i32 %53, %struct.mq_attr* %5)
%62 = icmp eq i32 %61, -1
br i1 %62, label %63, label %66
63: ; preds = %50
%64 = call i32 @perror(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.5, i64 0, i64 0))
%65 = call i32 @exit(i32 1)
unreachable
66: ; preds = %50
%67 = call i32 @sprintf(i8* dereferenceable(1) undef, i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), i32 %20, i32 %23)
%68 = call i64 @mq_send(i32 %61, i8* undef, i32 4, i32 0)
%69 = icmp eq i64 %68, 0
br i1 %69, label %73, label %70
70: ; preds = %66
%71 = call i32 @perror(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.7, i64 0, i64 0))
%72 = call i32 @exit(i32 1)
unreachable
73: ; preds = %66
%74 = call i32 @gettimeofday(%struct.timeval* %3, i32* null)
%75 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i64 0, i32 0
%76 = load double, double* %75
%77 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i64 0, i32 1
%78 = load double, double* %77
%79 = fdiv double %78, 1.000000e+06
%80 = fadd double %76, %79
%81 = icmp eq i32 %20, 0
br i1 %81, label %82, label %84
82: ; preds = %84, %73
%83 = icmp sgt i32 %23, 0
br i1 %83, label %89, label %94
84: ; preds = %73, %84
%85 = phi i32 [ %87, %84 ], [ 0, %73 ]
%86 = call i32 @spawn(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0), i8** %1, i32 %85, double 0.000000e+00)
%87 = add nuw nsw i32 %85, 1
%88 = icmp eq i32 %87, %20
br i1 %88, label %82, label %84
89: ; preds = %82, %89
%90 = phi i32 [ %92, %89 ], [ 0, %82 ]
%91 = call i32 @spawn(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0), i8** %1, i32 %90, double %80)
%92 = add nuw nsw i32 %90, 1
%93 = icmp eq i32 %92, %23
br i1 %93, label %94, label %89
94: ; preds = %89, %82
ret i32 0
}