#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 */

/* Variables and functions */
int O_CREAT;
int O_EXCL;
int O_RDWR;
int S_IRUSR;
int S_IWUSR;
int shm_open(char *, int, int);
int /*<<< orphan*/ shm_unlink(char *);
int main(int argc, char **argv) {
  char shm_name[] = "shm_name_elektra_test_compile";
  shm_unlink(shm_name);
  int shm_fd = shm_open(shm_name, O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xec7(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xec4(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xec2(%rip),%eax
mov    %eax,-0x18(%rbp)
mov    0xebc(%rip),%ax
mov    %ax,-0x14(%rbp)
lea    -0x30(%rbp),%rdi
call   1040 <shm_unlink@plt>
lea    -0x30(%rbp),%rdi
mov    0x2e68(%rip),%rax
mov    (%rax),%esi
mov    0x2e77(%rip),%rax
or     (%rax),%esi
mov    0x2e3e(%rip),%rax
or     (%rax),%esi
mov    0x2e2d(%rip),%rax
mov    (%rax),%edx
mov    0x2e3c(%rip),%rax
or     (%rax),%edx
call   1030 <shm_open@plt>
mov    %eax,-0x34(%rbp)
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
movups 0xee2(%rip),%xmm0
movups %xmm0,0xe(%rsp)
movaps 0xec8(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1040 <shm_unlink@plt>
mov    0x2e92(%rip),%rax
mov    0x2ea3(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    0x2e68(%rip),%rax
or     (%rax),%esi
mov    0x2e57(%rip),%rax
mov    0x2e68(%rip),%rcx
mov    (%rcx),%edx
or     (%rax),%edx
mov    %rbx,%rdi
call   1030 <shm_open@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.shm_name = [30 x i8] c"shm_name_elektra_test_compile\00"
@O_RDWR = global i32 0
@O_CREAT = global i32 0
@O_EXCL = global i32 0
@S_IRUSR = global i32 0
@S_IWUSR = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca [30 x i8]
%6 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
%7 = bitcast [30 x i8]* %5 to i8*
%8 = getelementptr inbounds [30 x i8], [30 x i8]* %5, i64 0, i64 0
%9 = call i32 @shm_unlink(i8* %8)
%10 = getelementptr inbounds [30 x i8], [30 x i8]* %5, i64 0, i64 0
%11 = load i32, i32* @O_RDWR
%12 = load i32, i32* @O_CREAT
%13 = or i32 %11, %12
%14 = load i32, i32* @O_EXCL
%15 = or i32 %13, %14
%16 = load i32, i32* @S_IRUSR
%17 = load i32, i32* @S_IWUSR
%18 = or i32 %16, %17
%19 = call i32 @shm_open(i8* %10, i32 %15, i32 %18)
store i32 %19, i32* %6
ret i32 0
}

LLVM IR (-O2):
@__const.main.shm_name = [30 x i8] c"shm_name_elektra_test_compile\00"
@O_RDWR = global i32 0
@O_CREAT = global i32 0
@O_EXCL = global i32 0
@S_IRUSR = global i32 0
@S_IWUSR = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [30 x i8]
%4 = getelementptr inbounds [30 x i8], [30 x i8]* %3, i64 0, i64 0
%5 = call i32 @shm_unlink(i8* %4)
%6 = load i32, i32* @O_RDWR
%7 = load i32, i32* @O_CREAT
%8 = or i32 %7, %6
%9 = load i32, i32* @O_EXCL
%10 = or i32 %8, %9
%11 = load i32, i32* @S_IRUSR
%12 = load i32, i32* @S_IWUSR
%13 = or i32 %12, %11
%14 = call i32 @shm_open(i8* %4, i32 %10, i32 %13)
ret i32 0
}