#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 */
union bpf_attr {
  int map_type;
  void *map_flags;
  void *max_entries;
  void *value_size;
  void *key_size;
};
typedef void *uint32_t;
typedef enum bpf_map_type { ____Placeholder_bpf_map_type } bpf_map_type;
typedef int /*<<< orphan*/ attr;

/* Variables and functions */
int /*<<< orphan*/ BPF_MAP_CREATE;
int bpf(int /*<<< orphan*/, union bpf_attr *, int);
int bpf_map_create(enum bpf_map_type type, uint32_t size_key,
                   uint32_t size_value, uint32_t max_elem, uint32_t flags) {
  union bpf_attr attr = {};
  attr.map_type = type;
  attr.key_size = size_key;
  attr.value_size = size_value;
  attr.max_entries = max_elem;
  attr.map_flags = flags;
  return bpf(BPF_MAP_CREATE, &attr, sizeof(attr));
}


x86 assembly (clang, -O0):
<bpf_map_create>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    0xece(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    0x2e85(%rip),%rax
mov    (%rax),%edi
lea    -0x30(%rbp),%rsi
mov    $0x8,%edx
call   1030 <bpf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bpf_map_create>:
push   %rax
mov    %r8,(%rsp)
mov    0x2ecc(%rip),%rax
mov    (%rax),%edi
mov    %rsp,%rsi
mov    $0x8,%edx
call   1030 <bpf@plt>
pop    %rcx
ret

LLVM IR (-O0):
%union.bpf_attr = type { i8* }
@__const.bpf_map_create.attr = { i32, [4 x i8] } { i32 0, [4 x i8] undef }
@BPF_MAP_CREATE = global i32 0
define i32 @bpf_map_create(i32 %0, i8* %1, i8* %2, i8* %3, i8* %4) {
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca %union.bpf_attr
store i32 %0, i32* %6
store i8* %1, i8** %7
store i8* %2, i8** %8
store i8* %3, i8** %9
store i8* %4, i8** %10
%12 = bitcast %union.bpf_attr* %11 to i8*
%13 = load i32, i32* %6
%14 = bitcast %union.bpf_attr* %11 to i32*
store i32 %13, i32* %14
%15 = load i8*, i8** %7
%16 = bitcast %union.bpf_attr* %11 to i8**
store i8* %15, i8** %16
%17 = load i8*, i8** %8
%18 = bitcast %union.bpf_attr* %11 to i8**
store i8* %17, i8** %18
%19 = load i8*, i8** %9
%20 = bitcast %union.bpf_attr* %11 to i8**
store i8* %19, i8** %20
%21 = load i8*, i8** %10
%22 = bitcast %union.bpf_attr* %11 to i8**
store i8* %21, i8** %22
%23 = load i32, i32* @BPF_MAP_CREATE
%24 = call i32 @bpf(i32 %23, %union.bpf_attr* %11, i32 8)
ret i32 %24
}

LLVM IR (-O2):
%union.bpf_attr = type { i8* }
@BPF_MAP_CREATE = global i32 0
define i32 @bpf_map_create(i32 %0, i8* nocapture readnone %1, i8* nocapture readnone %2, i8* nocapture readnone %3, i8* %4) {
%6 = alloca %union.bpf_attr
%7 = bitcast %union.bpf_attr* %6 to i8*
%8 = getelementptr inbounds %union.bpf_attr, %union.bpf_attr* %6, i64 0, i32 0
store i8* %4, i8** %8
%9 = load i32, i32* @BPF_MAP_CREATE
%10 = call i32 @bpf(i32 %9, %union.bpf_attr* %6, i32 8)
ret i32 %10
}