// File: /workspace/github_c_makefile_star2_O2/stetre[P]moonglmath/src/hostmem.c
// Function: Create
static int Create(lua_State *L, int arg, size_t alignment)
    {
    const char *data = NULL;
    char *ptr;
    size_t size;
    (void)alignment;

    if(lua_type(L, arg) == LUA_TSTRING)
        {
        if(!lua_isnoneornil(L, arg+1))
            return CreatePack(L, arg, alignment);
    
        data = luaL_checklstring(L, arg, &size);
        if(size == 0) 
            return luaL_argerror(L, arg, errstring(ERR_LENGTH));
        }
    else
        {
        size = luaL_checkinteger(L, arg);
        if(size == 0) 
            return luaL_argerror(L, arg, errstring(ERR_VALUE));
        }
#if defined(MACOS) /* @@TODO */
    ptr = (char*)Malloc(L, size);
#else
    ptr = (char*)AlignedAlloc(alignment, size);
#endif
    if(!ptr)
        return luaL_error(L, "failed to allocate page aligned memory");
            
    if(data)
        memcpy(ptr, data, size);
    else
        memset(ptr, 0, size);

    CreateAllocated(L, ptr, size);
    return 1;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %r14
movl %esi, %r12d
movq %rdi, %rbx
callq 0x8cf0
cmpl $0x4, %eax
jne 0xd273
leal 0x1(%r12), %ebp
movq %rbx, %rdi
movl %ebp, %esi
callq 0x8cf0
testl %eax, %eax
jle 0xd290
pushq $0x1
popq %r15
movq %rbx, %rdi
movl %r15d, %esi
movl %r12d, %edx
callq 0x8050
movl %eax, %r12d
movq %rbx, %rdi
movl %ebp, %esi
callq 0x84c0
movslq %eax, %r13
movl %r12d, 0xc(%rsp)
movl %r12d, %edi
callq 0x8240
movq %rax, %r12
imulq %r13, %r12
testq %r12, %r12
je 0xd2fd
movq %r14, %rdi
movq %r12, %rsi
callq 0x8d50
testq %rax, %rax
je 0xd33e
movq %rax, %r14
movq %rbx, %rdi
movl 0xc(%rsp), %esi
movq %r13, %rdx
movq %rax, %rcx
movq %r12, %r8
callq 0x85f0
testl %eax, %eax
je 0xd388
movl %eax, %r13d
movq %r14, %rdi
callq 0x8090
movl %r13d, %edi
jmp 0xd300
movq %rbx, %rdi
movl %r12d, %esi
callq 0x8740
movq %rax, 0x10(%rsp)
testq %rax, %rax
je 0xd2da
movq %rax, %r15
xorl %r13d, %r13d
jmp 0xd2b2
leaq 0x10(%rsp), %r15
movq %rbx, %rdi
movl %r12d, %esi
movq %r15, %rdx
callq 0x8600
movq (%r15), %r15
testq %r15, %r15
je 0xd35d
movq %rax, %r13
movq %r14, %rdi
movq %r15, %rsi
callq 0x8d50
testq %rax, %rax
je 0xd2ea
movq %rax, %r14
movq %rax, %rdi
testq %r13, %r13
je 0xd320
movq %r13, %rsi
movq %r15, %rdx
callq 0x87d0
jmp 0xd32a
pushq $-0x3
popq %rdi
callq 0x8550
movq %rbx, %rdi
movl %r12d, %esi
jmp 0xd30a
leaq 0x916c(%rip), %rsi      # 0x1645d
movq %rbx, %rdi
xorl %eax, %eax
callq 0x8b00
jmp 0xd373
pushq $-0x8
popq %rdi
callq 0x8550
movq %rbx, %rdi
movl %ebp, %esi
movq %rax, %rdx
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x81c0
xorl %esi, %esi
movq %r15, %rdx
callq 0x8530
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0xd398
pushq $0x1
popq %r15
jmp 0xd376
leaq 0x9118(%rip), %rsi      # 0x1645d
movq %rbx, %rdi
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x8b00
pushq $-0x8
popq %rdi
callq 0x8550
movq %rbx, %rdi
movl %r12d, %esi
movq %rax, %rdx
callq 0x81c0
movl %eax, %r15d
movl %r15d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0xd398
jmp 0xd376