// File: /workspace/github_cpp_makefile_star2_O2/stetre[P]moonvulkan/src/pipeline.c
// Function: GetPipelineExecutableProperties
static int GetPipelineExecutableProperties(lua_State *L)
    {
    ud_t *ud;
    int err;
    VkResult ec;
    uint32_t count, remaining, tot, i;
    VkPipelineInfoKHR* info=NULL;
    VkPipelineExecutablePropertiesKHR* properties = NULL; //[N]
    VkPipeline pipeline = checkpipeline(L, 1, &ud);
    CheckDevicePfn(L, ud, GetPipelineExecutablePropertiesKHR);
#define CLEANUP do {                                                    \
    zfreeVkPipelineInfoKHR(L, info, 1);                                 \
    zfreearrayVkPipelineExecutablePropertiesKHR(L, properties, N, 1);   \
} while(0)
    if(lua_istable(L, 2))
        {
        info = zcheckVkPipelineInfoKHR(L, 2, &err);
        if(err) { CLEANUP; return argerror(L, 2); }
        }
    else
        {
        info = znewVkPipelineInfoKHR(L, &err);
        if(err) { CLEANUP; return lua_error(L); }
        }
    info->pipeline = pipeline;
    properties = znewchainarrayVkPipelineExecutablePropertiesKHR(L, N, &err);
    if(err) { CLEANUP; lua_error(L); }
    ec = ud->ddt->GetPipelineExecutablePropertiesKHR(ud->device, info, &remaining, NULL);
    if(ec) { CLEANUP; CheckError(L, ec); }
    lua_newtable(L);
    if(remaining==0) { CLEANUP; return 1; }
    tot = 0;
    do {
        if(remaining > N)
            { count = N; remaining -= N; }
        else
            { count = remaining; remaining = 0; }
        ec = ud->ddt->GetPipelineExecutablePropertiesKHR(ud->device, info, &count, properties);
        if(ec && ec != VK_INCOMPLETE) { CLEANUP; CheckError(L, ec); }
        for(i = 0; i < count; i++)
            {
            zpushVkPipelineExecutablePropertiesKHR(L, &properties[i]);
            lua_rawseti(L, -2, ++tot);
            }
        } while (remaining > 0);
    CLEANUP;
#undef CLEANUP
    return 1;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
leaq 0x37bbe(%rip), %rcx     # 0x7d923
pushq $0x1
popq %rsi
leaq 0x18(%rsp), %r15
movq %r15, %rdx
callq 0x1a500
movq %rax, %r14
movq (%r15), %rax
movq 0x50(%rax), %rax
cmpq $0x0, 0x658(%rax)
je 0x45dff
pushq $0x2
popq %rsi
movq %rbx, %rdi
callq 0x1a110
cmpl $0x5, %eax
jne 0x45e15
pushq $0x2
popq %rsi
leaq 0xc(%rsp), %r12
movq %rbx, %rdi
movq %r12, %rdx
callq 0x18da0
movq %rax, %r13
cmpl $0x0, (%r12)
je 0x45e61
pushq $0x1
popq %rbp
movq %rbx, %rdi
movq %r13, %rsi
movl %ebp, %edx
callq 0x19150
pushq $0x20
popq %rcx
movl $0x218, %edx            # imm = 0x218
movq %rbx, %rdi
xorl %esi, %esi
movl %ebp, %r8d
callq 0x197e0
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 0x45f10
leaq 0x4ae69(%rip), %rsi     # 0x90c6f
movq %rbx, %rdi
xorl %eax, %eax
callq 0x19bc0
jmp 0x45f10
pushq $0x18
popq %rdx
leaq 0xc(%rsp), %r12
movq %rbx, %rdi
movl $0x3b9ee4c9, %esi       # imm = 0x3B9EE4C9
movq %r12, %rcx
callq 0x19dc0
movq %rax, %r13
cmpl $0x0, (%r12)
je 0x45e61
pushq $0x1
popq %rbp
movq %rbx, %rdi
movq %r13, %rsi
movl %ebp, %edx
callq 0x19150
pushq $0x20
popq %rcx
movl $0x218, %edx            # imm = 0x218
movq %rbx, %rdi
xorl %esi, %esi
movl %ebp, %r8d
callq 0x197e0
jmp 0x45f08
movq %r14, 0x10(%r13)
pushq $0x20
popq %rsi
leaq 0xc(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rdx
callq 0x18450
movq %rax, %r15
cmpl $0x0, (%r14)
je 0x45eb1
pushq $0x1
popq %r14
movq %rbx, %rdi
movq %r13, %rsi
movl %r14d, %edx
callq 0x19150
pushq $0x20
popq %rcx
movl $0x218, %edx            # imm = 0x218
movq %rbx, %rdi
movq %r15, %rsi
movl %r14d, %r8d
callq 0x197e0
movq %rbx, %rdi
callq 0x199c0
movq 0x18(%rsp), %rax
movq 0x20(%rax), %rdi
movq 0x50(%rax), %rax
leaq 0x4(%rsp), %rdx
movq %r13, %rsi
xorl %ecx, %ecx
callq *0x658(%rax)
testl %eax, %eax
je 0x45f23
movl %eax, %r14d
pushq $0x1
popq %rbp
movq %rbx, %rdi
movq %r13, %rsi
movl %ebp, %edx
callq 0x19150
pushq $0x20
popq %rcx
movl $0x218, %edx            # imm = 0x218
movq %rbx, %rdi
movq %r15, %rsi
movl %ebp, %r8d
callq 0x197e0
movq %rbx, %rdi
xorl %esi, %esi
movl %r14d, %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 %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x187d0
movl 0x4(%rsp), %eax
testl %eax, %eax
je 0x45ff2
movq %r13, 0x10(%rsp)
pushq $-0x2
popq %r12
xorl %r13d, %r13d
movq %r15, 0x20(%rsp)
movl %eax, %ecx
subl $0x20, %ecx
pushq $0x20
popq %rdx
cmovael %edx, %eax
movl $0x0, %edx
cmovbl %edx, %ecx
movl %eax, 0x8(%rsp)
movl %ecx, 0x4(%rsp)
movq 0x18(%rsp), %rax
movq 0x20(%rax), %rdi
movq 0x50(%rax), %rax
movq 0x10(%rsp), %rsi
leaq 0x8(%rsp), %rdx
movq %r15, %rcx
callq *0x658(%rax)
cmpl $0x5, %eax
je 0x45f97
movl %eax, %r14d
testl %eax, %eax
jne 0x4601d
movl %r13d, %ebp
movq %r15, %r14
xorl %r15d, %r15d
movl 0x8(%rsp), %eax
cmpq %rax, %r15
jae 0x45fd1
movq %rbx, %rdi
movq %r14, %rsi
callq 0x18380
leal (%r15,%rbp), %edx
incl %edx
movq %rbx, %rdi
movl %r12d, %esi
callq 0x19120
incq %r15
addq $0x218, %r14            # imm = 0x218
jmp 0x45fa0
movl 0x4(%rsp), %eax
addl %r15d, %r13d
testl %eax, %eax
movq 0x20(%rsp), %r15
jne 0x45f4c
movq %rbx, %rdi
movq 0x10(%rsp), %rsi
pushq $0x1
popq %rbp
jmp 0x45ffb
pushq $0x1
popq %rbp
movq %rbx, %rdi
movq %r13, %rsi
movl %ebp, %edx
callq 0x19150
pushq $0x20
popq %rcx
movl $0x218, %edx            # imm = 0x218
movq %rbx, %rdi
movq %r15, %rsi
movl %ebp, %r8d
callq 0x197e0
jmp 0x45f12
pushq $0x1
popq %rbp
movq %rbx, %rdi
movq 0x10(%rsp), %rsi
jmp 0x45ede