// File: /workspace/github_cpp_makefile_star2_O3/stetre[P]moonvulkan/src/pipeline_cache.c
// Function: Create
static int Create(lua_State *L)
    {
    int err;
    ud_t *ud, *device_ud;
    VkResult ec;
    VkPipelineCache pipeline_cache;
    VkPipelineCacheCreateInfo* info;
    VkDevice device = checkdevice(L, 1, &device_ud);
    const VkAllocationCallbacks *allocator = NULL;
#define CLEANUP zfreeVkPipelineCacheCreateInfo(L, info, 1)
    if(lua_istable(L, 2))
        {
        allocator = optallocator(L, 3);
        info = zcheckVkPipelineCacheCreateInfo(L, 2, &err);
        if(err) { CLEANUP; return argerror(L, 2); }
        lua_getfield(L, 2, "initial_data");
        info->pInitialData = (void*)luaL_optlstring(L, -1, NULL, &info->initialDataSize);
        }
    else
        {
        info = znewVkPipelineCacheCreateInfo(L, &err);
        if(err) { CLEANUP; return lua_error(L); }
        info->flags = optflags(L, 2, 0);
        info->pInitialData = (void*)luaL_optlstring(L, 3, NULL, &info->initialDataSize);
        }
    ec = device_ud->ddt->CreatePipelineCache(device, info, allocator, &pipeline_cache);
    CLEANUP;
    CheckError(L, ec);
#undef CLEANUP
    TRACE_CREATE(pipeline_cache, "pipeline_cache");
    ud = newuserdata_nondispatchable(L, pipeline_cache, PIPELINE_CACHE_MT);
    ud->parent_ud = device_ud;
    ud->device = device;
    ud->instance = device_ud->instance;
    ud->allocator = allocator;
    ud->destructor = freepipeline_cache;
    ud->ddt = device_ud->ddt;
    return 1;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
leaq 0x42a80(%rip), %rcx     # 0x8c03b
leaq 0x10(%rsp), %rdx
movl $0x1, %esi
callq 0x1a4e0
movq %rax, %r14
movq %rbx, %rdi
movl $0x2, %esi
callq 0x1a0f0
cmpl $0x5, %eax
jne 0x49642
movq %rbx, %rdi
movl $0x3, %esi
callq 0x191b0
movq %rax, %r15
leaq 0x4(%rsp), %r13
movq %rbx, %rdi
movl $0x2, %esi
movq %r13, %rdx
callq 0x18100
movq %rax, %r12
cmpl $0x0, (%r13)
je 0x4967a
movq %rbx, %rdi
movq %r12, %rsi
movl $0x1, %edx
callq 0x19160
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
xorl %edx, %edx
callq 0x18680
movq %rbx, %rdi
movl $0x2, %esi
movq %rax, %rdx
callq 0x18410
jmp 0x49774
leaq 0x4(%rsp), %r15
movl $0x28, %edx
movq %rbx, %rdi
movl $0x11, %esi
movq %r15, %rcx
callq 0x19da0
movq %rax, %r12
cmpl $0x0, (%r15)
je 0x49695
movq %rbx, %rdi
movq %r12, %rsi
movl $0x1, %edx
callq 0x19160
jmp 0x49704
leaq 0x566fe(%rip), %rdx     # 0x9fd7f
movq %rbx, %rdi
movl $0x2, %esi
callq 0x1a440
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
jmp 0x496b1
xorl %r15d, %r15d
movq %rbx, %rdi
movl $0x2, %esi
xorl %edx, %edx
callq 0x192a0
movl %eax, 0x10(%r12)
movl $0x3, %esi
leaq 0x18(%r12), %rcx
movq %rbx, %rdi
xorl %edx, %edx
callq 0x188a0
movq %rax, 0x20(%r12)
movq 0x10(%rsp), %rax
movq 0x50(%rax), %rax
leaq 0x8(%rsp), %rcx
movq %r14, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq *0x160(%rax)
movl %eax, %ebp
movq %rbx, %rdi
movq %r12, %rsi
movl $0x1, %edx
callq 0x19160
testl %ebp, %ebp
je 0x4970e
movq %rbx, %rdi
xorl %esi, %esi
movl %ebp, %edx
callq 0x18980
movq %rbx, %rdi
callq 0x199a0
jmp 0x49774
movq 0x768b3(%rip), %rax     # 0xbffc8
cmpl $0x0, (%rax)
je 0x4972d
movq 0x8(%rsp), %rsi
leaq 0x56666(%rip), %rdi     # 0x9fd8c
xorl %eax, %eax
callq 0x18960
movq 0x8(%rsp), %rsi
leaq 0x44843(%rip), %rdx     # 0x8df7c
movq %rbx, %rdi
xorl %ecx, %ecx
callq 0x18320
movq 0x10(%rsp), %rcx
movq %rcx, 0x10(%rax)
movq %r14, 0x20(%rax)
movq 0x18(%rcx), %rdx
movq %rdx, 0x18(%rax)
movq %r15, 0x40(%rax)
leaq 0x207(%rip), %rdx       # 0x4996a
movq %rdx, 0x8(%rax)
movq 0x50(%rcx), %rcx
movq %rcx, 0x50(%rax)
movl $0x1, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq