// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %rax
movq %rdi, %rbx
leaq 0x3762b(%rip), %rcx     # 0x7d03b
pushq $0x1
popq %rsi
xorl %edx, %edx
callq 0x1a500
movq %rax, %r14
leaq 0x39558(%rip), %rcx     # 0x7ef7c
pushq $0x2
popq %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x1a4b0
movq %rax, %r13
pushq $0x4
popq %rsi
movq %rbx, %rdi
callq 0x191a0
movq %rax, %r15
pushq $0x3
popq %rsi
movq %rsp, %r12
leaq 0x4(%rsp), %rbp
movq %rbx, %rdi
movq %r12, %rdx
movq %rbp, %rcx
callq 0x19090
cmpl $0x0, (%rbp)
movl (%r12), %ecx
je 0x45aa3
pushq $0x1
popq %r8
movl $0x90, %edx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x197e0
pushq $-0x1
popq %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x18680
pushq $0x3
popq %rsi
movq %rbx, %rdi
movq %rax, %rdx
callq 0x18420
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbp
shlq $0x3, %rcx
movq %rbx, %rdi
movq %rcx, %rsi
callq 0x18050
testq %rax, %rax
je 0x45b25
movq %rax, %r12
movq %r14, %rdi
callq 0x19eb0
movq 0x50(%rax), %rax
movl (%rsp), %edx
movq %r14, %rdi
movq %r13, %rsi
movq %rbp, %r13
movq %rbp, %rcx
movq %r15, %r8
movq %r12, %r9
callq *0x180(%rax)
movl %eax, %ebp
movl (%rsp), %ecx
pushq $0x1
popq %r8
movl $0x90, %edx
movq %rbx, %rdi
movq %r13, %rsi
callq 0x197e0
testl %ebp, %ebp
je 0x45b56
movq %rbx, %rdi
movq %r12, %rsi
callq 0x182e0
movq %rbx, %rdi
xorl %esi, %esi
movl %ebp, %edx
callq 0x18980
movq %rbx, %rdi
callq 0x199c0
jmp 0x45a94
movl (%rsp), %ecx
pushq $0x1
popq %r8
movl $0x90, %edx
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x197e0
pushq $-0x6
popq %rdi
callq 0x19950
movq %rbx, %rdi
movq %rax, %rsi
xorl %eax, %eax
callq 0x19bc0
jmp 0x45a94
xorl %r13d, %r13d
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x187d0
pushq $-0x2
popq %rbp
movl (%rsp), %eax
cmpq %rax, %r13
jae 0x45b94
movq (%r12,%r13,8), %rsi
movq %rbx, %rdi
movq %r14, %rdx
movq %r15, %rcx
callq 0x46492
incq %r13
movq %rbx, %rdi
movl %ebp, %esi
movq %r13, %rdx
callq 0x19120
jmp 0x45b68
movq %rbx, %rdi
movq %r12, %rsi
callq 0x182e0
pushq $0x1
popq %rax
jmp 0x45a94