// File: /workspace/github_cpp_makefile_star2_O2/stetre[P]moonvulkan/src/shader_module.c
// Function: Create
static int Create(lua_State *L)
    {
    int err;
    ud_t *ud, *device_ud;
    VkResult ec;
    VkShaderModule shader_module;
    VkShaderModuleCreateInfo* info;
    size_t size;
    const char *code;
    VkDevice device = checkdevice(L, 1, &device_ud);
    const VkAllocationCallbacks *allocator = NULL;
#define CLEANUP zfreeVkShaderModuleCreateInfo(L, info, 1)
    if(lua_istable(L, 2))
        {
        allocator = optallocator(L, 3);
        info = zcheckVkShaderModuleCreateInfo(L, 2, &err);
        if(err) { CLEANUP; return argerror(L, 2); }
        lua_getfield(L, 2, "code");
        code = luaL_optlstring(L, -1, NULL, &size);
        }
    else
        {
        VkFlags flags = checkflags(L, 2);
        info = znewVkShaderModuleCreateInfo(L, &err);
        if(err) { CLEANUP; return lua_error(L); }
        info->flags = flags;
        code = luaL_optlstring(L, 3, NULL, &size);
        }

    if(!code || (size == 0))
        return luaL_error(L, "missing shader code");
    info->codeSize = size;
    info->pCode = (uint32_t*)code;
    ec = device_ud->ddt->CreateShaderModule(device, info, allocator, &shader_module);
    CLEANUP;
    CheckError(L, ec);
#undef CLEANUP
    TRACE_CREATE(shader_module, "shader_module");
    ud = newuserdata_nondispatchable(L, shader_module, SHADER_MODULE_MT);
    ud->parent_ud = device_ud;
    ud->device = device;
    ud->instance = device_ud->instance;
    ud->allocator = allocator;
    ud->destructor = freeshader_module;
    ud->ddt = device_ud->ddt;
    return 1;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
leaq 0x34310(%rip), %rcx     # 0x7d03b
pushq $0x1
popq %rsi
leaq 0x18(%rsp), %rdx
callq 0x1a500
movq %rax, %r14
pushq $0x2
popq %rsi
movq %rbx, %rdi
callq 0x1a110
cmpl $0x5, %eax
jne 0x48da4
pushq $0x3
popq %rsi
movq %rbx, %rdi
callq 0x191a0
movq %rax, %r15
pushq $0x2
popq %rsi
leaq 0xc(%rsp), %r13
movq %rbx, %rdi
movq %r13, %rdx
callq 0x18570
movq %rax, %r12
cmpl $0x0, (%r13)
je 0x48de5
pushq $0x1
popq %rdx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x19150
pushq $-0x1
popq %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x18680
pushq $0x2
popq %rsi
movq %rbx, %rdi
movq %rax, %rdx
callq 0x18420
jmp 0x48e9a
pushq $0x2
popq %rsi
movq %rbx, %rdi
callq 0x18f50
movq %rax, %r15
pushq $0x10
popq %rsi
pushq $0x28
popq %rdx
leaq 0xc(%rsp), %r13
movq %rbx, %rdi
movq %r13, %rcx
callq 0x19dc0
movq %rax, %r12
cmpl $0x0, (%r13)
je 0x48dfc
pushq $0x1
popq %rdx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x19150
jmp 0x48e92
leaq 0x484cb(%rip), %rdx     # 0x912b7
pushq $0x2
popq %rsi
movq %rbx, %rdi
callq 0x1a460
pushq $-0x1
popq %rsi
jmp 0x48e07
movl %r15d, 0x10(%r12)
pushq $0x3
popq %rsi
xorl %r15d, %r15d
leaq 0x20(%rsp), %r13
movq %rbx, %rdi
xorl %edx, %edx
movq %r13, %rcx
callq 0x188a0
testq %rax, %rax
sete %dl
movq (%r13), %rcx
testq %rcx, %rcx
sete %sil
orb %dl, %sil
cmpb $0x1, %sil
jne 0x48e46
leaq 0x4846e(%rip), %rsi     # 0x912a8
movq %rbx, %rdi
xorl %eax, %eax
callq 0x19bc0
jmp 0x48e9a
movq %rcx, 0x18(%r12)
movq %rax, 0x20(%r12)
movq 0x18(%rsp), %rax
movq 0x50(%rax), %rax
leaq 0x10(%rsp), %rcx
movq %r14, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq *0x150(%rax)
movl %eax, %r13d
pushq $0x1
popq %rbp
movq %rbx, %rdi
movq %r12, %rsi
movl %ebp, %edx
callq 0x19150
testl %r13d, %r13d
je 0x48ead
movq %rbx, %rdi
xorl %esi, %esi
movl %r13d, %edx
callq 0x18980
movq %rbx, %rdi
callq 0x199c0
movl %eax, %ebp
movl %ebp, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x720e4(%rip), %rax     # 0xbaf98
cmpl $0x0, (%rax)
je 0x48ecc
movq 0x10(%rsp), %rsi
leaq 0x483f7(%rip), %rdi     # 0x912bc
xorl %eax, %eax
callq 0x18960
movq 0x10(%rsp), %rsi
leaq 0x360fd(%rip), %rdx     # 0x7efd5
movq %rbx, %rdi
xorl %ecx, %ecx
callq 0x18330
movq 0x18(%rsp), %rcx
movq %rcx, 0x10(%rax)
movq %r14, 0x20(%rax)
movq 0x18(%rcx), %rdx
movq %rdx, 0x18(%rax)
movq %r15, 0x40(%rax)
leaq 0x3b(%rip), %rdx        # 0x48f3d
movq %rdx, 0x8(%rax)
movq 0x50(%rcx), %rcx
movq %rcx, 0x50(%rax)
jmp 0x48e9c