// File: /workspace/github_cpp_makefile_star2_O2/stetre[P]moonvulkan/src/physical_device.c
// Function: GetPhysicalDeviceSparseImageFormatProperties
static int GetPhysicalDeviceSparseImageFormatProperties(lua_State *L)
    {
    int err;
    ud_t *ud;
    uint32_t i, count = 0;
    VkPhysicalDeviceSparseImageFormatInfo2* info;
    VkSparseImageFormatProperties* props;
    VkPhysicalDevice physical_device = checkphysical_device(L, 1, &ud);
    if(ud->idt->GetPhysicalDeviceSparseImageFormatProperties2)
        return GetPhysicalDeviceSparseImageFormatProperties2(L, physical_device, ud);
#define CLEANUP zfreeVkPhysicalDeviceSparseImageFormatInfo2(L, info, 1)
    info = zcheckVkPhysicalDeviceSparseImageFormatInfo2(L, 2, &err);
    if(err) { CLEANUP; return argerror(L, 2); }

    lua_newtable(L);
    ud->idt->GetPhysicalDeviceSparseImageFormatProperties(physical_device, 
        info->format, info->type, info->samples, info->usage, info->tiling, &count, NULL);
    if(count == 0) { CLEANUP; return 1; }
    props = (VkSparseImageFormatProperties*)Malloc(L, sizeof(VkSparseImageFormatProperties)*count);
    ud->idt->GetPhysicalDeviceSparseImageFormatProperties(physical_device, 
        info->format, info->type, info->samples, info->usage, info->tiling, &count, props);
    for(i=0; i<count; i++)
        {
        zpushVkSparseImageFormatProperties(L, &props[i]);
        lua_rawseti(L, -2, i+1);
        }
    CLEANUP;
    Free(L, props);
#undef CLEANUP
    return 1;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
andl $0x0, 0x10(%rsp)
leaq 0x3a52d(%rip), %rcx     # 0x7eef4
pushq $0x1
popq %rbp
leaq 0x18(%rsp), %r15
movl %ebp, %esi
movq %r15, %rdx
callq 0x1a500
movq %rax, %r14
movq (%r15), %r13
movq 0x48(%r13), %rax
cmpq $0x0, 0x118(%rax)
je 0x44a37
andl $0x0, 0xc(%rsp)
pushq $0x2
popq %rsi
leaq 0x14(%rsp), %r12
movq %rbx, %rdi
movq %r12, %rdx
callq 0x195a0
movq %rax, %r15
cmpl $0x0, (%r12)
je 0x44a94
pushq $0x1
popq %rbp
movq %rbx, %rdi
movq %r15, %rsi
movl %ebp, %edx
callq 0x19150
pushq $0x28
popq %rdx
movq %rbx, %rdi
xorl %esi, %esi
xorl %ecx, %ecx
movl %ebp, %r8d
callq 0x197e0
jmp 0x44a66
pushq $0x2
popq %rsi
leaq 0x14(%rsp), %r12
movq %rbx, %rdi
movq %r12, %rdx
callq 0x195a0
movq %rax, %r15
cmpl $0x0, (%r12)
je 0x44b15
pushq $0x1
popq %rdx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x19150
pushq $-0x1
popq %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x18680
pushq $0x2
popq %rsi
movq %rbx, %rdi
movq %rax, %rdx
callq 0x18420
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
movq 0x48(%r13), %rax
leaq 0xc(%rsp), %r12
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
xorl %ecx, %ecx
callq *0x118(%rax)
movl (%r12), %esi
testl %esi, %esi
je 0x44bcf
leaq 0x14(%rsp), %rbp
movq %rbx, %rdi
movq %rbp, %rdx
callq 0x19980
movq %rax, %r12
cmpl $0x0, (%rbp)
je 0x44c0c
pushq $0x1
popq %rbp
movq %rbx, %rdi
movq %r15, %rsi
movl %ebp, %edx
callq 0x19150
movl 0xc(%rsp), %ecx
pushq $0x28
popq %rdx
movq %rbx, %rdi
movq %r12, %rsi
movl %ebp, %r8d
callq 0x197e0
movq %rbx, %rdi
callq 0x199c0
jmp 0x44a81
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x187d0
movq 0x18(%rsp), %rax
movq 0x48(%rax), %rax
movl 0x10(%r15), %esi
movl 0x14(%r15), %edx
movl 0x18(%r15), %ecx
movl 0x1c(%r15), %r8d
movl 0x20(%r15), %r9d
leaq 0x10(%rsp), %r13
movq %r14, %rdi
pushq $0x0
pushq %r13
callq *0x58(%rax)
addq $0x10, %rsp
movl (%r13), %eax
testq %rax, %rax
je 0x44c86
imulq $0x14, %rax, %rsi
movq %rbx, %rdi
callq 0x191f0
movq %rax, %r12
movq 0x18(%rsp), %rax
movq 0x48(%rax), %rax
movl 0x10(%r15), %esi
movl 0x14(%r15), %edx
movl 0x18(%r15), %ecx
movl 0x1c(%r15), %r8d
movl 0x20(%r15), %r9d
movq %r14, %rdi
pushq %r12
pushq %r13
callq *0x58(%rax)
addq $0x10, %rsp
xorl %r14d, %r14d
pushq $-0x2
popq %r13
movq %r12, 0x20(%rsp)
movl 0x10(%rsp), %eax
movq %rbx, %rdi
cmpq %rax, %r14
jae 0x44bf0
movq %r12, %rsi
callq 0x18cc0
incq %r14
movq %rbx, %rdi
movl %r13d, %esi
movq %r14, %rdx
callq 0x19120
addq $0x14, %r12
jmp 0x44ba4
pushq $0x1
popq %rbp
movq %rbx, %rdi
movq %r15, %rsi
movl %ebp, %edx
callq 0x19150
movl 0xc(%rsp), %ecx
pushq $0x28
popq %rdx
movq %rbx, %rdi
xorl %esi, %esi
jmp 0x44c79
movq %r15, %rsi
movl %ebp, %edx
callq 0x19150
movq %rbx, %rdi
movq 0x20(%rsp), %rsi
callq 0x182e0
jmp 0x44a83
movq 0x48(%r13), %rax
leaq 0xc(%rsp), %rdx
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rcx
callq *0x118(%rax)
pushq $0x1
popq %r14
pushq $-0x2
popq %rbp
movq %r12, %r13
leaq -0x1(%r14), %rax
movl 0xc(%rsp), %ecx
cmpq %rcx, %rax
jae 0x44c5c
movq %rbx, %rdi
movq %r13, %rsi
callq 0x18440
movq %rbx, %rdi
movl %ebp, %esi
movq %r14, %rdx
callq 0x19120
incq %r14
addq $0x28, %r13
jmp 0x44c2e
pushq $0x1
popq %rbp
movq %rbx, %rdi
movq %r15, %rsi
movl %ebp, %edx
callq 0x19150
movl 0xc(%rsp), %ecx
pushq $0x28
popq %rdx
movq %rbx, %rdi
movq %r12, %rsi
movl %ebp, %r8d
callq 0x197e0
jmp 0x44a83
pushq $0x1
popq %rbp
movq %rbx, %rdi
movq %r15, %rsi
movl %ebp, %edx
callq 0x19150
jmp 0x44a83