// File: /workspace/github_cpp_makefile_star2_O1/stetre[P]moonvulkan/src/pipeline.c
// Function: CreateGraphics
static int CreateGraphics(lua_State *L)
    {
    int err;
    uint32_t count, i;
    VkResult ec;
    VkPipeline *pipeline;

    VkDevice device = checkdevice(L, 1, NULL);
    VkPipelineCache cache = testpipeline_cache(L, 2, NULL);
    const VkAllocationCallbacks *allocator = optallocator(L, 4);
#define CLEANUP zfreearrayVkGraphicsPipelineCreateInfo(L, info, count, 1)
    VkGraphicsPipelineCreateInfo *info = zcheckarrayVkGraphicsPipelineCreateInfo(L, 3, &count, &err);
    if(err) { CLEANUP; return argerror(L, 3); }

    pipeline = (VkPipeline*)MallocNoErr(L, count*sizeof(VkPipeline));
    if(!pipeline) { CLEANUP; return errmemory(L); }

    ec = UD(device)->ddt->CreateGraphicsPipelines(device, cache, count, info, allocator, pipeline);
    CLEANUP;
#undef CLEANUP
    if(ec)
        {
        Free(L, pipeline);
        CheckError(L, ec);
        }
    lua_newtable(L);
    for(i = 0; i < count; i++)
        {
        newpipeline(L, pipeline[i], device, allocator);
        lua_rawseti(L, -2, i+1);
        }
    Free(L, pipeline);
    return 1;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
leaq 0x46548(%rip), %rcx     # 0x8f03b
movl $0x1, %esi
xorl %edx, %edx
callq 0x1a520
movq %rax, 0x18(%rsp)
leaq 0x48471(%rip), %rcx     # 0x90f7c
movq %rbx, %rdi
movl $0x2, %esi
xorl %edx, %edx
callq 0x1a4d0
movq %rax, %r14
movq %rbx, %rdi
movl $0x4, %esi
callq 0x191c0
movq %rax, %r15
leaq 0xc(%rsp), %r12
leaq 0x24(%rsp), %rbp
movq %rbx, %rdi
movl $0x3, %esi
movq %r12, %rdx
movq %rbp, %rcx
callq 0x190b0
movq %rax, %r13
cmpl $0x0, (%rbp)
movl (%r12), %ecx
je 0x48b9b
movl $0x90, %edx
movq %rbx, %rdi
movq %r13, %rsi
movl $0x1, %r8d
callq 0x19800
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
xorl %edx, %edx
callq 0x18690
movq %rbx, %rdi
movl $0x3, %esi
movq %rax, %rdx
callq 0x18420
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r15, 0x10(%rsp)
movq 0x18(%rsp), %r15
movq %r14, %rbp
shlq $0x3, %rcx
movq %rbx, %rdi
movq %rcx, %rsi
callq 0x18050
testq %rax, %rax
je 0x48c30
movq %rax, %r12
movq %r15, %r14
movq %r15, %rdi
callq 0x19ed0
movq 0x50(%rax), %rax
movl 0xc(%rsp), %edx
movq %r15, %rdi
movq %rbp, %rsi
movq %r13, %rcx
movq 0x10(%rsp), %r15
movq %r15, %r8
movq %r12, %r9
callq *0x180(%rax)
movl %eax, %ebp
movl 0xc(%rsp), %ecx
movl $0x90, %edx
movq %rbx, %rdi
movq %r13, %rsi
movl $0x1, %r8d
callq 0x19800
movq %rbx, %rdi
testl %ebp, %ebp
je 0x48c66
movq %r12, %rsi
callq 0x182e0
movq %rbx, %rdi
xorl %esi, %esi
movl %ebp, %edx
callq 0x18990
movq %rbx, %rdi
callq 0x199e0
jmp 0x48b8c
movl 0xc(%rsp), %ecx
movl $0x90, %edx
movq %rbx, %rdi
movq %r13, %rsi
movl $0x1, %r8d
callq 0x19800
movl $0xfffffffa, %edi       # imm = 0xFFFFFFFA
callq 0x19970
movq %rbx, %rdi
movq %rax, %rsi
xorl %eax, %eax
callq 0x19be0
jmp 0x48b8c
xorl %esi, %esi
xorl %edx, %edx
callq 0x187e0
cmpl $0x0, 0xc(%rsp)
je 0x48ca7
xorl %r13d, %r13d
movq (%r12,%r13,8), %rsi
movq %rbx, %rdi
movq %r14, %rdx
movq %r15, %rcx
callq 0x4962d
incq %r13
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
movq %r13, %rdx
callq 0x19140
movl 0xc(%rsp), %eax
cmpq %rax, %r13
jb 0x48c79
movq %rbx, %rdi
movq %r12, %rsi
callq 0x182e0
movl $0x1, %eax
jmp 0x48b8c