// File: stetre[P]moonvulkan/src/pipeline.c
// Function: GetPipelineExecutableInternalRepresentations
static int GetPipelineExecutableInternalRepresentations(lua_State *L)
    {
    ud_t *ud;
    int err;
    VkResult ec;
    uint32_t count, remaining, tot, i;
    VkPipelineExecutableInfoKHR* info=NULL;
    VkPipelineExecutableInternalRepresentationKHR* representations = NULL; //[N]
    VkPipeline pipeline = checkpipeline(L, 1, &ud);
    CheckDevicePfn(L, ud, GetPipelineExecutableInternalRepresentationsKHR);
#define CLEANUP do {                                                                    \
    zfreeVkPipelineExecutableInfoKHR(L, info, 1);                                       \
    zfreearrayVkPipelineExecutableInternalRepresentationKHR(L, representations, N, 1);  \
} while(0)
    info = zcheckVkPipelineExecutableInfoKHR(L, 2, &err);
    info->pipeline = pipeline;
    representations = znewchainarrayVkPipelineExecutableInternalRepresentationKHR(L, N, &err);
    if(err) { CLEANUP; lua_error(L); }
    ec = ud->ddt->GetPipelineExecutableInternalRepresentationsKHR(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->GetPipelineExecutableInternalRepresentationsKHR(ud->device, info, &count, representations);
        if(ec && ec != VK_INCOMPLETE) { CLEANUP; CheckError(L, ec); }
        for(i = 0; i < count; i++)
            {
            zpushVkPipelineExecutableInternalRepresentationKHR(L, &representations[i]);
            lua_rawseti(L, -2, ++tot);
            }
        } while (remaining > 0);
    CLEANUP;
#undef CLEANUP
    return 1;
    }

// Assembly:
subq $0x48, %rsp
movq %rdi, 0x38(%rsp)
movq $0x0, 0x10(%rsp)
movq $0x0, 0x8(%rsp)
movq 0x38(%rsp), %rdi
movl $0x1, %esi
leaq 0x30(%rsp), %rdx
leaq 0x70fd2(%rip), %rcx     # 0xcf923
callq 0x1a640
movq %rax, (%rsp)
movq 0x30(%rsp), %rax
movq 0x50(%rax), %rax
cmpq $0x0, 0x668(%rax)
jne 0x5e989
movq 0x38(%rsp), %rdi
leaq 0x84318(%rip), %rsi     # 0xe2c91
movb $0x0, %al
callq 0x19ce0
movl %eax, 0x44(%rsp)
jmp 0x5ec77
jmp 0x5e98b
movq 0x38(%rsp), %rdi
movl $0x2, %esi
leaq 0x2c(%rsp), %rdx
callq 0x1a430
movq %rax, 0x10(%rsp)
movq (%rsp), %rcx
movq 0x10(%rsp), %rax
movq %rcx, 0x10(%rax)
movq 0x38(%rsp), %rdi
movl $0x20, %esi
leaq 0x2c(%rsp), %rdx
callq 0x18e40
movq %rax, 0x8(%rsp)
cmpl $0x0, 0x2c(%rsp)
je 0x5ea10
jmp 0x5e9d3
movq 0x38(%rsp), %rdi
movq 0x10(%rsp), %rsi
movl $0x1, %edx
callq 0x19210
movq 0x38(%rsp), %rdi
movq 0x8(%rsp), %rsi
movl $0x228, %edx            # imm = 0x228
movl $0x20, %ecx
movl $0x1, %r8d
callq 0x198d0
movq 0x38(%rsp), %rdi
callq 0x19ad0
movq 0x30(%rsp), %rax
movq 0x50(%rax), %rax
movq 0x668(%rax), %rax
movq 0x30(%rsp), %rcx
movq 0x20(%rcx), %rdi
movq 0x10(%rsp), %rsi
leaq 0x20(%rsp), %rdx
xorl %ecx, %ecx
callq *%rax
movl %eax, 0x28(%rsp)
cmpl $0x0, 0x28(%rsp)
je 0x5eaa7
jmp 0x5ea44
movq 0x38(%rsp), %rdi
movq 0x10(%rsp), %rsi
movl $0x1, %edx
callq 0x19210
movq 0x38(%rsp), %rdi
movq 0x8(%rsp), %rsi
movl $0x228, %edx            # imm = 0x228
movl $0x20, %ecx
movl $0x1, %r8d
callq 0x198d0
jmp 0x5ea79
cmpl $0x0, 0x28(%rsp)
je 0x5eaa3
movq 0x38(%rsp), %rdi
movl 0x28(%rsp), %edx
xorl %esi, %esi
callq 0x18a00
movq 0x38(%rsp), %rdi
callq 0x19ad0
movl %eax, 0x44(%rsp)
jmp 0x5ec77
jmp 0x5eaa5
jmp 0x5eaa7
movq 0x38(%rsp), %rdi
xorl %edx, %edx
movl %edx, %esi
callq 0x18830
cmpl $0x0, 0x20(%rsp)
jne 0x5eafe
jmp 0x5eabe
movq 0x38(%rsp), %rdi
movq 0x10(%rsp), %rsi
movl $0x1, %edx
callq 0x19210
movq 0x38(%rsp), %rdi
movq 0x8(%rsp), %rsi
movl $0x228, %edx            # imm = 0x228
movl $0x20, %ecx
movl $0x1, %r8d
callq 0x198d0
movl $0x1, 0x44(%rsp)
jmp 0x5ec77
movl $0x0, 0x1c(%rsp)
cmpl $0x20, 0x20(%rsp)
jbe 0x5eb22
movl $0x20, 0x24(%rsp)
movl 0x20(%rsp), %eax
subl $0x20, %eax
movl %eax, 0x20(%rsp)
jmp 0x5eb32
movl 0x20(%rsp), %eax
movl %eax, 0x24(%rsp)
movl $0x0, 0x20(%rsp)
movq 0x30(%rsp), %rax
movq 0x50(%rax), %rax
movq 0x668(%rax), %rax
movq 0x30(%rsp), %rcx
movq 0x20(%rcx), %rdi
movq 0x10(%rsp), %rsi
movq 0x8(%rsp), %rcx
leaq 0x24(%rsp), %rdx
callq *%rax
movl %eax, 0x28(%rsp)
cmpl $0x0, 0x28(%rsp)
je 0x5ebd3
cmpl $0x5, 0x28(%rsp)
je 0x5ebd3
jmp 0x5eb70
movq 0x38(%rsp), %rdi
movq 0x10(%rsp), %rsi
movl $0x1, %edx
callq 0x19210
movq 0x38(%rsp), %rdi
movq 0x8(%rsp), %rsi
movl $0x228, %edx            # imm = 0x228
movl $0x20, %ecx
movl $0x1, %r8d
callq 0x198d0
jmp 0x5eba5
cmpl $0x0, 0x28(%rsp)
je 0x5ebcf
movq 0x38(%rsp), %rdi
movl 0x28(%rsp), %edx
xorl %esi, %esi
callq 0x18a00
movq 0x38(%rsp), %rdi
callq 0x19ad0
movl %eax, 0x44(%rsp)
jmp 0x5ec77
jmp 0x5ebd1
jmp 0x5ebd3
movl $0x0, 0x18(%rsp)
movl 0x18(%rsp), %eax
cmpl 0x24(%rsp), %eax
jae 0x5ec2d
movq 0x38(%rsp), %rdi
movq 0x8(%rsp), %rsi
movl 0x18(%rsp), %eax
imulq $0x228, %rax, %rax      # imm = 0x228
addq %rax, %rsi
callq 0x19650
movq 0x38(%rsp), %rdi
movl 0x1c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1c(%rsp)
movl %eax, %eax
movl %eax, %edx
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x191e0
movl 0x18(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x18(%rsp)
jmp 0x5ebdb
jmp 0x5ec2f
cmpl $0x0, 0x20(%rsp)
ja 0x5eb06
jmp 0x5ec3c
movq 0x38(%rsp), %rdi
movq 0x10(%rsp), %rsi
movl $0x1, %edx
callq 0x19210
movq 0x38(%rsp), %rdi
movq 0x8(%rsp), %rsi
movl $0x228, %edx            # imm = 0x228
movl $0x20, %ecx
movl $0x1, %r8d
callq 0x198d0
movl $0x1, 0x44(%rsp)
movl 0x44(%rsp), %eax
addq $0x48, %rsp
retq