#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 int /*<<< orphan*/ key_t;

/* Variables and functions */
int /*<<< orphan*/ EXIT_SUCCESS;
int IPC_CREAT;
int IPC_EXCL;
int /*<<< orphan*/ errno;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int msgget(int /*<<< orphan*/, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *);
void create_it(void) {
  int msgid;
  if ((msgid = msgget((key_t)1234, 0666 | IPC_CREAT | IPC_EXCL)) == -1) {
    perror("msgget");
    exit(errno);
  };
  printf("Message Queue successfully created\n");
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<create_it>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2e79(%rip),%rax
mov    (%rax),%esi
or     $0x1b6,%esi
mov    0x2e92(%rip),%rax
or     (%rax),%esi
mov    $0x4d2,%edi
call   1030 <msgget@plt>
mov    %eax,-0x4(%rbp)
cmp    $0xffffffff,%eax
jne    1190 <create_it+0x50>
lea    0xe83(%rip),%rdi
call   1050 <perror@plt>
mov    0x2e4f(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
lea    0xe70(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e2d(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<create_it>:
push   %rax
mov    0x2e80(%rip),%rax
mov    (%rax),%esi
mov    0x2e9f(%rip),%rax
or     (%rax),%esi
or     $0x1b6,%esi
mov    $0x4d2,%edi
call   1030 <msgget@plt>
cmp    $0xffffffff,%eax
jne    1182 <create_it+0x42>
lea    0xe91(%rip),%rdi
call   1050 <perror@plt>
mov    0x2e5d(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
lea    0xe7e(%rip),%rdi
call   1040 <puts@plt>
mov    0x2e3b(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@IPC_CREAT = global i32 0
@IPC_EXCL = global i32 0
@.str = [7 x i8] c"msgget\00"
@errno = global i32 0
@.str.1 = [36 x i8] c"Message Queue successfully created\0A\00"
@EXIT_SUCCESS = global i32 0
define void @create_it() {
%1 = alloca i32
%2 = load i32, i32* @IPC_CREAT
%3 = or i32 438, %2
%4 = load i32, i32* @IPC_EXCL
%5 = or i32 %3, %4
%6 = call i32 @msgget(i32 1234, i32 %5)
store i32 %6, i32* %1
%7 = icmp eq i32 %6, -1
br i1 %7, label %8, label %12
8: ; preds = %0
%9 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%10 = load i32, i32* @errno
%11 = call i32 @exit(i32 %10)
unreachable
12: ; preds = %0
%13 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0))
%14 = load i32, i32* @EXIT_SUCCESS
%15 = call i32 @exit(i32 %14)
unreachable
}

LLVM IR (-O2):
@IPC_CREAT = global i32 0
@IPC_EXCL = global i32 0
@.str = [7 x i8] c"msgget\00"
@errno = global i32 0
@EXIT_SUCCESS = global i32 0
@str = [35 x i8] c"Message Queue successfully created\00"
define void @create_it() {
%1 = load i32, i32* @IPC_CREAT
%2 = load i32, i32* @IPC_EXCL
%3 = or i32 %1, %2
%4 = or i32 %3, 438
%5 = tail call i32 @msgget(i32 1234, i32 %4)
%6 = icmp eq i32 %5, -1
br i1 %6, label %7, label %11
7: ; preds = %0
%8 = tail call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%9 = load i32, i32* @errno
%10 = tail call i32 @exit(i32 %9)
unreachable
11: ; preds = %0
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str, i64 0, i64 0))
%13 = load i32, i32* @EXIT_SUCCESS
%14 = tail call i32 @exit(i32 %13)
unreachable
}