// File: stetre[P]moonvulkan/src/physical_device.c
// Function: GetPhysicalDeviceSparseImageFormatProperties2
static int GetPhysicalDeviceSparseImageFormatProperties2(lua_State *L, VkPhysicalDevice physical_device, ud_t *ud)
    {
    int err;
    uint32_t i, count = 0;
    VkPhysicalDeviceSparseImageFormatInfo2* info = NULL;
    VkSparseImageFormatProperties2* props = NULL;

#define CLEANUP do {                                                \
    zfreeVkPhysicalDeviceSparseImageFormatInfo2(L, info, 1);        \
    zfreearrayVkSparseImageFormatProperties2(L, props, count, 1);   \
} while(0)
    info = zcheckVkPhysicalDeviceSparseImageFormatInfo2(L, 2, &err);
    if(err) { CLEANUP; return argerror(L, 2); }
    lua_newtable(L);
    ud->idt->GetPhysicalDeviceSparseImageFormatProperties2(physical_device, info, &count, NULL);
    if(count == 0) { CLEANUP; return 1; }
    props = znewchainarrayVkSparseImageFormatProperties2(L, count, &err);
    if(err) { CLEANUP; return lua_error(L); }
    ud->idt->GetPhysicalDeviceSparseImageFormatProperties2(physical_device, info, &count, props);
    for(i=0; i<count; i++)
        {
        zpushVkSparseImageFormatProperties2(L, &props[i]);
        lua_rawseti(L, -2, i+1);
        }
    CLEANUP;
#undef CLEANUP
    return 1;
    }

// Assembly:
subq $0x48, %rsp
movq %rdi, 0x38(%rsp)
movq %rsi, 0x30(%rsp)
movq %rdx, 0x28(%rsp)
movl $0x0, 0x1c(%rsp)
movq $0x0, 0x10(%rsp)
movq $0x0, 0x8(%rsp)
movq 0x38(%rsp), %rdi
movl $0x2, %esi
leaq 0x24(%rsp), %rdx
callq 0x19690
movq %rax, 0x10(%rsp)
cmpl $0x0, 0x24(%rsp)
je 0x5d8a7
jmp 0x5d83f
movq 0x38(%rsp), %rdi
movq 0x10(%rsp), %rsi
movl $0x1, %edx
callq 0x19210
movq 0x38(%rsp), %rdi
movq 0x8(%rsp), %rsi
movl 0x1c(%rsp), %ecx
movl $0x28, %edx
movl $0x1, %r8d
callq 0x198d0
movq 0x38(%rsp), %rax
movq %rax, (%rsp)
movq 0x38(%rsp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
xorl %eax, %eax
movl %eax, %edx
callq 0x186d0
movq (%rsp), %rdi
movq %rax, %rdx
movl $0x2, %esi
callq 0x18460
movl %eax, 0x44(%rsp)
jmp 0x5da3b
movq 0x38(%rsp), %rdi
xorl %edx, %edx
movl %edx, %esi
callq 0x18830
movq 0x28(%rsp), %rax
movq 0x48(%rax), %rax
movq 0x118(%rax), %rax
movq 0x30(%rsp), %rdi
movq 0x10(%rsp), %rsi
leaq 0x1c(%rsp), %rdx
xorl %ecx, %ecx
callq *%rax
cmpl $0x0, 0x1c(%rsp)
jne 0x5d920
jmp 0x5d8e1
movq 0x38(%rsp), %rdi
movq 0x10(%rsp), %rsi
movl $0x1, %edx
callq 0x19210
movq 0x38(%rsp), %rdi
movq 0x8(%rsp), %rsi
movl 0x1c(%rsp), %ecx
movl $0x28, %edx
movl $0x1, %r8d
callq 0x198d0
movl $0x1, 0x44(%rsp)
jmp 0x5da3b
movq 0x38(%rsp), %rdi
movl 0x1c(%rsp), %esi
leaq 0x24(%rsp), %rdx
callq 0x19a90
movq %rax, 0x8(%rsp)
cmpl $0x0, 0x24(%rsp)
je 0x5d986
jmp 0x5d941
movq 0x38(%rsp), %rdi
movq 0x10(%rsp), %rsi
movl $0x1, %edx
callq 0x19210
movq 0x38(%rsp), %rdi
movq 0x8(%rsp), %rsi
movl 0x1c(%rsp), %ecx
movl $0x28, %edx
movl $0x1, %r8d
callq 0x198d0
movq 0x38(%rsp), %rdi
callq 0x19ad0
movl %eax, 0x44(%rsp)
jmp 0x5da3b
movq 0x28(%rsp), %rax
movq 0x48(%rax), %rax
movq 0x118(%rax), %rax
movq 0x30(%rsp), %rdi
movq 0x10(%rsp), %rsi
movq 0x8(%rsp), %rcx
leaq 0x1c(%rsp), %rdx
callq *%rax
movl $0x0, 0x20(%rsp)
movl 0x20(%rsp), %eax
cmpl 0x1c(%rsp), %eax
jae 0x5d9ff
movq 0x38(%rsp), %rdi
movq 0x8(%rsp), %rsi
movl 0x20(%rsp), %eax
imulq $0x28, %rax, %rax
addq %rax, %rsi
callq 0x18480
movq 0x38(%rsp), %rdi
movl 0x20(%rsp), %eax
addl $0x1, %eax
movl %eax, %eax
movl %eax, %edx
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x191e0
movl 0x20(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x20(%rsp)
jmp 0x5d9b4
jmp 0x5da01
movq 0x38(%rsp), %rdi
movq 0x10(%rsp), %rsi
movl $0x1, %edx
callq 0x19210
movq 0x38(%rsp), %rdi
movq 0x8(%rsp), %rsi
movl 0x1c(%rsp), %ecx
movl $0x28, %edx
movl $0x1, %r8d
callq 0x198d0
movl $0x1, 0x44(%rsp)
movl 0x44(%rsp), %eax
addq $0x48, %rsp
retq
nopw %cs:(%rax,%rax)
nop