// File: /workspace/github_cpp_makefile_star2_O3/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 0x43830(%rip), %rcx     # 0x8c03b
movl $0x1, %esi
xorl %edx, %edx
callq 0x1a4e0
movq %rax, 0x18(%rsp)
leaq 0x45759(%rip), %rcx     # 0x8df7c
movq %rbx, %rdi
movl $0x2, %esi
xorl %edx, %edx
callq 0x1a490
movq %rax, %r14
movq %rbx, %rdi
movl $0x4, %esi
callq 0x191b0
movq %rax, %r15
leaq 0xc(%rsp), %r12
leaq 0x24(%rsp), %rbp
movq %rbx, %rdi
movl $0x3, %esi
movq %r12, %rdx
movq %rbp, %rcx
callq 0x190a0
movq %rax, %r13
cmpl $0x0, (%rbp)
movl (%r12), %ecx
je 0x488b3
movl $0x90, %edx
movq %rbx, %rdi
movq %r13, %rsi
movl $0x1, %r8d
callq 0x197d0
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
xorl %edx, %edx
callq 0x18680
movq %rbx, %rdi
movl $0x3, %esi
movq %rax, %rdx
callq 0x18410
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 0x48948
movq %rax, %r12
movq %r15, %r14
movq %r15, %rdi
callq 0x19e90
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 0x197d0
movq %rbx, %rdi
testl %ebp, %ebp
je 0x4897e
movq %r12, %rsi
callq 0x182d0
movq %rbx, %rdi
xorl %esi, %esi
movl %ebp, %edx
callq 0x18980
movq %rbx, %rdi
callq 0x199a0
jmp 0x488a4
movl 0xc(%rsp), %ecx
movl $0x90, %edx
movq %rbx, %rdi
movq %r13, %rsi
movl $0x1, %r8d
callq 0x197d0
movl $0xfffffffa, %edi       # imm = 0xFFFFFFFA
callq 0x19930
movq %rbx, %rdi
movq %rax, %rsi
xorl %eax, %eax
callq 0x19ba0
jmp 0x488a4
xorl %esi, %esi
xorl %edx, %edx
callq 0x187d0
cmpl $0x0, 0xc(%rsp)
je 0x489bf
xorl %r13d, %r13d
movq (%r12,%r13,8), %rsi
movq %rbx, %rdi
movq %r14, %rdx
movq %r15, %rcx
callq 0x49342
incq %r13
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
movq %r13, %rdx
callq 0x19130
movl 0xc(%rsp), %eax
cmpq %rax, %r13
jb 0x48991
movq %rbx, %rdi
movq %r12, %rsi
callq 0x182d0
movl $0x1, %eax
jmp 0x488a4