#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 */
typedef struct msgmbuf TYPE_3__;
typedef struct msgsbuf TYPE_2__;
typedef struct TYPE_4__ TYPE_1__;

/* Type definitions */
struct TYPE_4__ {
  int uid;
  int gid;
};
struct msqid_ds {
  int msg_qbytes;
  TYPE_1__ msg_perm;
};
typedef int /*<<< orphan*/ key_t;
struct msgmbuf {
  int mtype;
  char *mtext;
};
struct msgsbuf {
  int mtype;
  char *mtext;
};

/* Variables and functions */
int IPC_CREAT;
int IPC_EXCL;
int IPC_NOWAIT;
int /*<<< orphan*/ IPC_RMID;
int /*<<< orphan*/ IPC_SET;
int MSG_NOERROR;
int /*<<< orphan*/ ftok(char *, char);
int /*<<< orphan*/ msg_stat(int, struct msqid_ds);
int msgctl(int, int /*<<< orphan*/, struct msqid_ds *);
int msgget(int /*<<< orphan*/, int);
int msgrcv(int, TYPE_3__ *, int, int, int);
int msgsnd(int, TYPE_2__ *, int, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char **argv) {
  int gflags, sflags, rflags;
  key_t key;
  int msgid;
  int reval;
  struct msgsbuf {
    int mtype;
    char mtext[1];
  } msg_sbuf;
  struct msgmbuf {
    int mtype;
    char mtext[10];
  } msg_rbuf;
  struct msqid_ds msg_ginfo, msg_sinfo;
  char *msgpath = "/etc/mtab";
  key = ftok(msgpath, 'a');
  gflags = IPC_CREAT | IPC_EXCL;
  msgid = msgget(key, gflags | 00666);
  if (msgid == -1) {
    perror("msg create error");
    return -1;
  }
  msg_stat(msgid, msg_ginfo);
  sflags = IPC_NOWAIT;
  msg_sbuf.mtype = 10;
  msg_sbuf.mtext[0] = 'a';
  reval = msgsnd(msgid, &msg_sbuf, sizeof(msg_sbuf.mtext), sflags);
  if (reval == -1) {
    perror("message send error");
  }
  msg_stat(msgid, msg_ginfo);
  rflags = IPC_NOWAIT | MSG_NOERROR;
  reval = msgrcv(msgid, &msg_rbuf, 4, 10, rflags);
  if (reval == -1)
    perror("read msg error");
  else
    printf("read from msg queue %d bytes\n", reval);
  msg_stat(msgid, msg_ginfo);
  msg_sinfo.msg_perm.uid = 8;
  msg_sinfo.msg_perm.gid = 8;
  msg_sinfo.msg_qbytes = 16388;
  reval = msgctl(msgid, IPC_SET, &msg_sinfo);
  if (reval == -1) {
    perror("msg set info error");
  }
  msg_stat(msgid, msg_ginfo);
  reval = msgctl(msgid, IPC_RMID, NULL);
  if (reval == -1) {
    perror("unlink msg queue error");
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe60(%rip),%rax
mov    %rax,-0x68(%rbp)
mov    -0x68(%rbp),%rdi
mov    $0x61,%esi
call   1090 <ftok@plt>
mov    %eax,-0x20(%rbp)
mov    0x2e04(%rip),%rax
mov    (%rax),%eax
mov    0x2e2b(%rip),%rcx
or     (%rcx),%eax
mov    %eax,-0x14(%rbp)
mov    -0x20(%rbp),%edi
mov    -0x14(%rbp),%esi
or     $0x1b6,%esi
call   1030 <msgget@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0xffffffff,-0x24(%rbp)
jne    1200 <main+0x80>
lea    0xe1b(%rip),%rdi
call   1080 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    13b6 <main+0x236>
mov    -0x24(%rbp),%edi
mov    -0x50(%rbp),%rax
mov    %rax,-0x78(%rbp)
mov    -0x48(%rbp),%eax
mov    %eax,-0x70(%rbp)
mov    -0x78(%rbp),%rsi
mov    -0x70(%rbp),%edx
call   1060 <msg_stat@plt>
mov    0x2dc4(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
movl   $0xa,-0x30(%rbp)
movb   $0x61,-0x2c(%rbp)
mov    -0x24(%rbp),%edi
lea    -0x30(%rbp),%rsi
mov    -0x18(%rbp),%ecx
mov    $0x1,%edx
call   1050 <msgsnd@plt>
mov    %eax,-0x28(%rbp)
cmpl   $0xffffffff,-0x28(%rbp)
jne    1261 <main+0xe1>
lea    0xdbf(%rip),%rdi
call   1080 <perror@plt>
mov    -0x24(%rbp),%edi
mov    -0x50(%rbp),%rax
mov    %rax,-0x88(%rbp)
mov    -0x48(%rbp),%eax
mov    %eax,-0x80(%rbp)
mov    -0x88(%rbp),%rsi
mov    -0x80(%rbp),%edx
call   1060 <msg_stat@plt>
mov    0x2d5d(%rip),%rax
mov    (%rax),%eax
mov    0x2d1c(%rip),%rcx
or     (%rcx),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x24(%rbp),%edi
lea    -0x40(%rbp),%rsi
mov    -0x1c(%rbp),%r8d
mov    $0x4,%edx
mov    $0xa,%ecx
call   10a0 <msgrcv@plt>
mov    %eax,-0x28(%rbp)
cmpl   $0xffffffff,-0x28(%rbp)
jne    12d1 <main+0x151>
lea    0xd67(%rip),%rdi
call   1080 <perror@plt>
jmp    12e0 <main+0x160>
mov    -0x28(%rbp),%esi
lea    0xd62(%rip),%rdi
call   1040 <printf@plt>
mov    -0x24(%rbp),%edi
mov    -0x50(%rbp),%rax
mov    %rax,-0x98(%rbp)
mov    -0x48(%rbp),%eax
mov    %eax,-0x90(%rbp)
mov    -0x98(%rbp),%rsi
mov    -0x90(%rbp),%edx
call   1060 <msg_stat@plt>
movl   $0x8,-0x5c(%rbp)
movl   $0x8,-0x58(%rbp)
movl   $0x4004,-0x60(%rbp)
mov    -0x24(%rbp),%edi
mov    0x2cb0(%rip),%rax
mov    (%rax),%esi
lea    -0x60(%rbp),%rdx
call   1070 <msgctl@plt>
mov    %eax,-0x28(%rbp)
cmpl   $0xffffffff,-0x28(%rbp)
jne    134c <main+0x1cc>
lea    0xd14(%rip),%rdi
call   1080 <perror@plt>
mov    -0x24(%rbp),%edi
mov    -0x50(%rbp),%rax
mov    %rax,-0xa8(%rbp)
mov    -0x48(%rbp),%eax
mov    %eax,-0xa0(%rbp)
mov    -0xa8(%rbp),%rsi
mov    -0xa0(%rbp),%edx
call   1060 <msg_stat@plt>
mov    -0x24(%rbp),%edi
mov    0x2c49(%rip),%rax
mov    (%rax),%esi
xor    %eax,%eax
mov    %eax,%edx
call   1070 <msgctl@plt>
mov    %eax,-0x28(%rbp)
cmpl   $0xffffffff,-0x28(%rbp)
jne    13af <main+0x22f>
lea    0xcd0(%rip),%rdi
call   1080 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    13b6 <main+0x236>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x28,%rsp
lea    0xe72(%rip),%rdi
mov    $0x61,%esi
call   1090 <ftok@plt>
mov    0x2e21(%rip),%rcx
mov    (%rcx),%esi
mov    0x2e48(%rip),%rcx
or     (%rcx),%esi
or     $0x1b6,%esi
mov    %eax,%edi
call   1030 <msgget@plt>
cmp    $0xffffffff,%eax
je     129c <main+0x11c>
mov    %eax,%ebx
mov    %eax,%edi
call   1060 <msg_stat@plt>
mov    0x2e18(%rip),%r14
mov    (%r14),%ecx
movl   $0xa,(%rsp)
movb   $0x61,0x4(%rsp)
mov    %rsp,%rsi
mov    %ebx,%edi
mov    $0x1,%edx
call   1050 <msgsnd@plt>
cmp    $0xffffffff,%eax
je     12a5 <main+0x125>
mov    %ebx,%edi
call   1060 <msg_stat@plt>
mov    0x2dab(%rip),%rax
mov    (%rax),%r8d
or     (%r14),%r8d
lea    0x18(%rsp),%rsi
mov    %ebx,%edi
mov    $0x4,%edx
mov    $0xa,%ecx
call   10a0 <msgrcv@plt>
cmp    $0xffffffff,%eax
je     12b6 <main+0x136>
lea    0xe0c(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    %ebx,%edi
call   1060 <msg_stat@plt>
movl   $0x8,0x10(%rsp)
movabs $0x800004004,%rax
mov    %rax,0x8(%rsp)
mov    0x2d7b(%rip),%rax
mov    (%rax),%esi
lea    0x8(%rsp),%rdx
mov    %ebx,%edi
call   1070 <msgctl@plt>
cmp    $0xffffffff,%eax
je     12c7 <main+0x147>
mov    %ebx,%edi
call   1060 <msg_stat@plt>
mov    0x2d4a(%rip),%rax
mov    (%rax),%esi
xor    %r14d,%r14d
mov    %ebx,%edi
xor    %edx,%edx
call   1070 <msgctl@plt>
cmp    $0xffffffff,%eax
je     12d5 <main+0x155>
mov    %r14d,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret
lea    0xd67(%rip),%rdi
jmp    12dc <main+0x15c>
lea    0xd6f(%rip),%rdi
call   1080 <perror@plt>
jmp    11f7 <main+0x77>
lea    0xd71(%rip),%rdi
call   1080 <perror@plt>
jmp    1238 <main+0xb8>
lea    0xd8d(%rip),%rdi
call   1080 <perror@plt>
jmp    1270 <main+0xf0>
lea    0xd92(%rip),%rdi
call   1080 <perror@plt>
mov    $0xffffffff,%r14d
jmp    1291 <main+0x111>

LLVM IR (-O0):
%struct.msgsbuf = type { i32, [1 x i8] }
%struct.msgmbuf = type { i32, [10 x i8] }
%struct.msqid_ds = type { i32, %struct.TYPE_4__ }
%struct.TYPE_4__ = type { i32, i32 }
%struct.msgsbuf.0 = type { i32, i8* }
%struct.msgmbuf.1 = type { i32, i8* }
@.str = [10 x i8] c"/etc/mtab\00"
@IPC_CREAT = global i32 0
@IPC_EXCL = global i32 0
@.str.1 = [17 x i8] c"msg create error\00"
@IPC_NOWAIT = global i32 0
@.str.2 = [19 x i8] c"message send error\00"
@MSG_NOERROR = global i32 0
@.str.3 = [15 x i8] c"read msg error\00"
@.str.4 = [30 x i8] c"read from msg queue %d bytes\0A\00"
@IPC_SET = global i32 0
@.str.5 = [19 x i8] c"msg set info error\00"
@IPC_RMID = global i32 0
@.str.6 = [23 x i8] c"unlink msg queue error\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 i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca %struct.msgsbuf
%13 = alloca %struct.msgmbuf
%14 = alloca %struct.msqid_ds
%15 = alloca %struct.msqid_ds
%16 = alloca i8*
%17 = alloca { i64, i32 }
%18 = alloca { i64, i32 }
%19 = alloca { i64, i32 }
%20 = alloca { i64, i32 }
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8** %16
%21 = load i8*, i8** %16
%22 = call i32 @ftok(i8* %21, i8 signext 97)
store i32 %22, i32* %9
%23 = load i32, i32* @IPC_CREAT
%24 = load i32, i32* @IPC_EXCL
%25 = or i32 %23, %24
store i32 %25, i32* %6
%26 = load i32, i32* %9
%27 = load i32, i32* %6
%28 = or i32 %27, 438
%29 = call i32 @msgget(i32 %26, i32 %28)
store i32 %29, i32* %10
%30 = load i32, i32* %10
%31 = icmp eq i32 %30, -1
br i1 %31, label %32, label %34
32: ; preds = %2
%33 = call i32 @perror(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %3
br label %116
34: ; preds = %2
%35 = load i32, i32* %10
%36 = bitcast { i64, i32 }* %17 to i8*
%37 = bitcast %struct.msqid_ds* %14 to i8*
%38 = getelementptr inbounds { i64, i32 }, { i64, i32 }* %17, i32 0, i32 0
%39 = load i64, i64* %38
%40 = getelementptr inbounds { i64, i32 }, { i64, i32 }* %17, i32 0, i32 1
%41 = load i32, i32* %40
%42 = call i32 @msg_stat(i32 %35, i64 %39, i32 %41)
%43 = load i32, i32* @IPC_NOWAIT
store i32 %43, i32* %7
%44 = getelementptr inbounds %struct.msgsbuf, %struct.msgsbuf* %12, i32 0, i32 0
store i32 10, i32* %44
%45 = getelementptr inbounds %struct.msgsbuf, %struct.msgsbuf* %12, i32 0, i32 1
%46 = getelementptr inbounds [1 x i8], [1 x i8]* %45, i64 0, i64 0
store i8 97, i8* %46
%47 = load i32, i32* %10
%48 = bitcast %struct.msgsbuf* %12 to %struct.msgsbuf.0*
%49 = load i32, i32* %7
%50 = call i32 @msgsnd(i32 %47, %struct.msgsbuf.0* %48, i32 1, i32 %49)
store i32 %50, i32* %11
%51 = load i32, i32* %11
%52 = icmp eq i32 %51, -1
br i1 %52, label %53, label %55
53: ; preds = %34
%54 = call i32 @perror(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
br label %55
55: ; preds = %53, %34
%56 = load i32, i32* %10
%57 = bitcast { i64, i32 }* %18 to i8*
%58 = bitcast %struct.msqid_ds* %14 to i8*
%59 = getelementptr inbounds { i64, i32 }, { i64, i32 }* %18, i32 0, i32 0
%60 = load i64, i64* %59
%61 = getelementptr inbounds { i64, i32 }, { i64, i32 }* %18, i32 0, i32 1
%62 = load i32, i32* %61
%63 = call i32 @msg_stat(i32 %56, i64 %60, i32 %62)
%64 = load i32, i32* @IPC_NOWAIT
%65 = load i32, i32* @MSG_NOERROR
%66 = or i32 %64, %65
store i32 %66, i32* %8
%67 = load i32, i32* %10
%68 = bitcast %struct.msgmbuf* %13 to %struct.msgmbuf.1*
%69 = load i32, i32* %8
%70 = call i32 @msgrcv(i32 %67, %struct.msgmbuf.1* %68, i32 4, i32 10, i32 %69)
store i32 %70, i32* %11
%71 = load i32, i32* %11
%72 = icmp eq i32 %71, -1
br i1 %72, label %73, label %75
73: ; preds = %55
%74 = call i32 @perror(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
br label %78
75: ; preds = %55
%76 = load i32, i32* %11
%77 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0), i32 %76)
br label %78
78: ; preds = %75, %73
%79 = load i32, i32* %10
%80 = bitcast { i64, i32 }* %19 to i8*
%81 = bitcast %struct.msqid_ds* %14 to i8*
%82 = getelementptr inbounds { i64, i32 }, { i64, i32 }* %19, i32 0, i32 0
%83 = load i64, i64* %82
%84 = getelementptr inbounds { i64, i32 }, { i64, i32 }* %19, i32 0, i32 1
%85 = load i32, i32* %84
%86 = call i32 @msg_stat(i32 %79, i64 %83, i32 %85)
%87 = getelementptr inbounds %struct.msqid_ds, %struct.msqid_ds* %15, i32 0, i32 1
%88 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %87, i32 0, i32 0
store i32 8, i32* %88
%89 = getelementptr inbounds %struct.msqid_ds, %struct.msqid_ds* %15, i32 0, i32 1
%90 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %89, i32 0, i32 1
store i32 8, i32* %90
%91 = getelementptr inbounds %struct.msqid_ds, %struct.msqid_ds* %15, i32 0, i32 0
store i32 16388, i32* %91
%92 = load i32, i32* %10
%93 = load i32, i32* @IPC_SET
%94 = call i32 @msgctl(i32 %92, i32 %93, %struct.msqid_ds* %15)
store i32 %94, i32* %11
%95 = load i32, i32* %11
%96 = icmp eq i32 %95, -1
br i1 %96, label %97, label %99
97: ; preds = %78
%98 = call i32 @perror(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0))
br label %99
99: ; preds = %97, %78
%100 = load i32, i32* %10
%101 = bitcast { i64, i32 }* %20 to i8*
%102 = bitcast %struct.msqid_ds* %14 to i8*
%103 = getelementptr inbounds { i64, i32 }, { i64, i32 }* %20, i32 0, i32 0
%104 = load i64, i64* %103
%105 = getelementptr inbounds { i64, i32 }, { i64, i32 }* %20, i32 0, i32 1
%106 = load i32, i32* %105
%107 = call i32 @msg_stat(i32 %100, i64 %104, i32 %106)
%108 = load i32, i32* %10
%109 = load i32, i32* @IPC_RMID
%110 = call i32 @msgctl(i32 %108, i32 %109, %struct.msqid_ds* null)
store i32 %110, i32* %11
%111 = load i32, i32* %11
%112 = icmp eq i32 %111, -1
br i1 %112, label %113, label %115
113: ; preds = %99
%114 = call i32 @perror(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0))
store i32 -1, i32* %3
br label %116
115: ; preds = %99
store i32 0, i32* %3
br label %116
116: ; preds = %115, %113, %32
%117 = load i32, i32* %3
ret i32 %117
}

LLVM IR (-O2):
%struct.msgsbuf = type { i32, [1 x i8] }
%struct.msgmbuf.1 = type { i32, i8* }
%struct.msqid_ds = type { i32, %struct.TYPE_4__ }
%struct.TYPE_4__ = type { i32, i32 }
%struct.msgsbuf.0 = type { i32, i8* }
@.str = [10 x i8] c"/etc/mtab\00"
@IPC_CREAT = global i32 0
@IPC_EXCL = global i32 0
@.str.1 = [17 x i8] c"msg create error\00"
@IPC_NOWAIT = global i32 0
@.str.2 = [19 x i8] c"message send error\00"
@MSG_NOERROR = global i32 0
@.str.3 = [15 x i8] c"read msg error\00"
@.str.4 = [30 x i8] c"read from msg queue %d bytes\0A\00"
@IPC_SET = global i32 0
@.str.5 = [19 x i8] c"msg set info error\00"
@IPC_RMID = global i32 0
@.str.6 = [23 x i8] c"unlink msg queue error\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca %struct.msgsbuf
%4 = alloca %struct.msgmbuf.1
%5 = alloca %struct.msqid_ds
%6 = bitcast %struct.msgsbuf* %3 to i8*
%7 = bitcast %struct.msgmbuf.1* %4 to i8*
%8 = bitcast %struct.msqid_ds* %5 to i8*
%9 = tail call i32 @ftok(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8 signext 97)
%10 = load i32, i32* @IPC_CREAT
%11 = load i32, i32* @IPC_EXCL
%12 = or i32 %10, %11
%13 = or i32 %12, 438
%14 = tail call i32 @msgget(i32 %9, i32 %13)
%15 = icmp eq i32 %14, -1
br i1 %15, label %16, label %18
16: ; preds = %2
%17 = tail call i32 @perror(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
br label %56
18: ; preds = %2
%19 = tail call i32 @msg_stat(i32 %14, i64 undef, i32 undef)
%20 = load i32, i32* @IPC_NOWAIT
%21 = getelementptr inbounds %struct.msgsbuf, %struct.msgsbuf* %3, i64 0, i32 0
store i32 10, i32* %21
%22 = getelementptr inbounds %struct.msgsbuf, %struct.msgsbuf* %3, i64 0, i32 1, i64 0
store i8 97, i8* %22
%23 = bitcast %struct.msgsbuf* %3 to %struct.msgsbuf.0*
%24 = call i32 @msgsnd(i32 %14, %struct.msgsbuf.0* %23, i32 1, i32 %20)
%25 = icmp eq i32 %24, -1
br i1 %25, label %26, label %28
26: ; preds = %18
%27 = call i32 @perror(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
br label %28
28: ; preds = %26, %18
%29 = call i32 @msg_stat(i32 %14, i64 undef, i32 undef)
%30 = load i32, i32* @IPC_NOWAIT
%31 = load i32, i32* @MSG_NOERROR
%32 = or i32 %31, %30
%33 = call i32 @msgrcv(i32 %14, %struct.msgmbuf.1* %4, i32 4, i32 10, i32 %32)
%34 = icmp eq i32 %33, -1
br i1 %34, label %35, label %37
35: ; preds = %28
%36 = call i32 @perror(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
br label %39
37: ; preds = %28
%38 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0), i32 %33)
br label %39
39: ; preds = %37, %35
%40 = call i32 @msg_stat(i32 %14, i64 undef, i32 undef)
%41 = getelementptr inbounds %struct.msqid_ds, %struct.msqid_ds* %5, i64 0, i32 1, i32 0
store i32 8, i32* %41
%42 = getelementptr inbounds %struct.msqid_ds, %struct.msqid_ds* %5, i64 0, i32 1, i32 1
store i32 8, i32* %42
%43 = getelementptr inbounds %struct.msqid_ds, %struct.msqid_ds* %5, i64 0, i32 0
store i32 16388, i32* %43
%44 = load i32, i32* @IPC_SET
%45 = call i32 @msgctl(i32 %14, i32 %44, %struct.msqid_ds* %5)
%46 = icmp eq i32 %45, -1
br i1 %46, label %47, label %49
47: ; preds = %39
%48 = call i32 @perror(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0))
br label %49
49: ; preds = %47, %39
%50 = call i32 @msg_stat(i32 %14, i64 undef, i32 undef)
%51 = load i32, i32* @IPC_RMID
%52 = call i32 @msgctl(i32 %14, i32 %51, %struct.msqid_ds* null)
%53 = icmp eq i32 %52, -1
br i1 %53, label %54, label %56
54: ; preds = %49
%55 = call i32 @perror(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0))
br label %56
56: ; preds = %49, %54, %16
%57 = phi i32 [ -1, %16 ], [ -1, %54 ], [ 0, %49 ]
ret i32 %57
}