#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 /*<<< orphan*/ mbox_property(int, unsigned int *);
unsigned int mem_alloc(int file_desc, unsigned int size, unsigned int align,
                       unsigned int flags) {
  int i = 0;
  unsigned int p[32];
  p[i++] = 0;
  p[i++] = 0x00000000;
  p[i++] = 0x3000c;
  p[i++] = 12;
  p[i++] = 12;
  p[i++] = size;
  p[i++] = align;
  p[i++] = flags;
  p[i++] = 0x00000000;
  p[0] = i * sizeof *p;
  mbox_property(file_desc, p);
  return p[5];
}


x86 assembly (clang, -O0):
<mem_alloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x14(%rbp)
cltq
movl   $0x0,-0xa0(%rbp,%rax,4)
mov    -0x14(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x14(%rbp)
cltq
movl   $0x0,-0xa0(%rbp,%rax,4)
mov    -0x14(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x14(%rbp)
cltq
movl   $0x3000c,-0xa0(%rbp,%rax,4)
mov    -0x14(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x14(%rbp)
cltq
movl   $0xc,-0xa0(%rbp,%rax,4)
mov    -0x14(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x14(%rbp)
cltq
movl   $0xc,-0xa0(%rbp,%rax,4)
mov    -0x8(%rbp),%ecx
mov    -0x14(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x14(%rbp)
cltq
mov    %ecx,-0xa0(%rbp,%rax,4)
mov    -0xc(%rbp),%ecx
mov    -0x14(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x14(%rbp)
cltq
mov    %ecx,-0xa0(%rbp,%rax,4)
mov    -0x10(%rbp),%ecx
mov    -0x14(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x14(%rbp)
cltq
mov    %ecx,-0xa0(%rbp,%rax,4)
mov    -0x14(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x14(%rbp)
cltq
movl   $0x0,-0xa0(%rbp,%rax,4)
movslq -0x14(%rbp),%rax
shl    $0x2,%rax
mov    %eax,-0xa0(%rbp)
mov    -0x4(%rbp),%edi
lea    -0xa0(%rbp),%rsi
call   1030 <mbox_property@plt>
mov    -0x8c(%rbp),%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mem_alloc>:
sub    $0x88,%rsp
movl   $0xc,0x10(%rsp)
mov    %esi,0x14(%rsp)
mov    %edx,0x18(%rsp)
mov    %ecx,0x1c(%rsp)
movl   $0x0,0x20(%rsp)
movaps 0xec6(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rsi
call   1030 <mbox_property@plt>
mov    0x14(%rsp),%eax
add    $0x88,%rsp
ret

LLVM IR (-O0):
define i32 @mem_alloc(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca [32 x i32]
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
store i32 0, i32* %9
%11 = load i32, i32* %9
%12 = add nsw i32 %11, 1
store i32 %12, i32* %9
%13 = sext i32 %11 to i64
%14 = getelementptr inbounds [32 x i32], [32 x i32]* %10, i64 0, i64 %13
store i32 0, i32* %14
%15 = load i32, i32* %9
%16 = add nsw i32 %15, 1
store i32 %16, i32* %9
%17 = sext i32 %15 to i64
%18 = getelementptr inbounds [32 x i32], [32 x i32]* %10, i64 0, i64 %17
store i32 0, i32* %18
%19 = load i32, i32* %9
%20 = add nsw i32 %19, 1
store i32 %20, i32* %9
%21 = sext i32 %19 to i64
%22 = getelementptr inbounds [32 x i32], [32 x i32]* %10, i64 0, i64 %21
store i32 196620, i32* %22
%23 = load i32, i32* %9
%24 = add nsw i32 %23, 1
store i32 %24, i32* %9
%25 = sext i32 %23 to i64
%26 = getelementptr inbounds [32 x i32], [32 x i32]* %10, i64 0, i64 %25
store i32 12, i32* %26
%27 = load i32, i32* %9
%28 = add nsw i32 %27, 1
store i32 %28, i32* %9
%29 = sext i32 %27 to i64
%30 = getelementptr inbounds [32 x i32], [32 x i32]* %10, i64 0, i64 %29
store i32 12, i32* %30
%31 = load i32, i32* %6
%32 = load i32, i32* %9
%33 = add nsw i32 %32, 1
store i32 %33, i32* %9
%34 = sext i32 %32 to i64
%35 = getelementptr inbounds [32 x i32], [32 x i32]* %10, i64 0, i64 %34
store i32 %31, i32* %35
%36 = load i32, i32* %7
%37 = load i32, i32* %9
%38 = add nsw i32 %37, 1
store i32 %38, i32* %9
%39 = sext i32 %37 to i64
%40 = getelementptr inbounds [32 x i32], [32 x i32]* %10, i64 0, i64 %39
store i32 %36, i32* %40
%41 = load i32, i32* %8
%42 = load i32, i32* %9
%43 = add nsw i32 %42, 1
store i32 %43, i32* %9
%44 = sext i32 %42 to i64
%45 = getelementptr inbounds [32 x i32], [32 x i32]* %10, i64 0, i64 %44
store i32 %41, i32* %45
%46 = load i32, i32* %9
%47 = add nsw i32 %46, 1
store i32 %47, i32* %9
%48 = sext i32 %46 to i64
%49 = getelementptr inbounds [32 x i32], [32 x i32]* %10, i64 0, i64 %48
store i32 0, i32* %49
%50 = load i32, i32* %9
%51 = sext i32 %50 to i64
%52 = mul i64 %51, 4
%53 = trunc i64 %52 to i32
%54 = getelementptr inbounds [32 x i32], [32 x i32]* %10, i64 0, i64 0
store i32 %53, i32* %54
%55 = load i32, i32* %5
%56 = getelementptr inbounds [32 x i32], [32 x i32]* %10, i64 0, i64 0
%57 = call i32 @mbox_property(i32 %55, i32* %56)
%58 = getelementptr inbounds [32 x i32], [32 x i32]* %10, i64 0, i64 5
%59 = load i32, i32* %58
ret i32 %59
}

LLVM IR (-O2):
define i32 @mem_alloc(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca [32 x i32]
%6 = bitcast [32 x i32]* %5 to i8*
%7 = getelementptr inbounds [32 x i32], [32 x i32]* %5, i64 0, i64 0
%8 = getelementptr inbounds [32 x i32], [32 x i32]* %5, i64 0, i64 4
store i32 12, i32* %8
%9 = getelementptr inbounds [32 x i32], [32 x i32]* %5, i64 0, i64 5
store i32 %1, i32* %9
%10 = getelementptr inbounds [32 x i32], [32 x i32]* %5, i64 0, i64 6
store i32 %2, i32* %10
%11 = getelementptr inbounds [32 x i32], [32 x i32]* %5, i64 0, i64 7
store i32 %3, i32* %11
%12 = getelementptr inbounds [32 x i32], [32 x i32]* %5, i64 0, i64 8
store i32 0, i32* %12
%13 = bitcast [32 x i32]* %5 to <4 x i32>*
store <4 x i32> <i32 36, i32 0, i32 196620, i32 12>, <4 x i32>* %13
%14 = call i32 @mbox_property(i32 %0, i32* %7)
%15 = load i32, i32* %9
ret i32 %15
}