// File: /workspace/github_cpp_makefile_star2_O3/stetre[P]moonvulkan/src/device_memory.c
// Function: GetDeviceImageSparseMemoryRequirements
static int GetDeviceImageSparseMemoryRequirements(lua_State *L)
    {
    int err;
    uint32_t count, i;
    ud_t *ud;
    VkDeviceImageMemoryRequirementsKHR *info = NULL;
    VkSparseImageMemoryRequirements2 *req = NULL;
    VkDevice device = checkdevice(L, 1, &ud);
    CheckDevicePfn(L, ud, GetDeviceImageSparseMemoryRequirementsKHR);
#define CLEANUP do {                                                \
    zfreeVkDeviceImageMemoryRequirementsKHR(L, info, 1);            \
    zfreearrayVkSparseImageMemoryRequirements2(L, req, count, 1);   \
} while(0)
    info = zcheckVkDeviceImageMemoryRequirementsKHR(L, 2, &err);
    if(err) { CLEANUP; return argerror(L, 2); }
    lua_newtable(L);
    ud->ddt->GetDeviceImageSparseMemoryRequirementsKHR(device, info, &count, NULL);
    if(count == 0) { CLEANUP; return 1; }
    req = znewchainarrayVkSparseImageMemoryRequirements2(L, count, &err);
    if(err) { CLEANUP; return lua_error(L); }
    ud->ddt->GetDeviceImageSparseMemoryRequirementsKHR(device, info, &count, req);
    for(i = 0; i <count; i++)
        {
        zpushVkSparseImageMemoryRequirements2(L, &req[i]);
        lua_rawseti(L, -2, i+1);
        }
    CLEANUP;
#undef CLEANUP
    return 1;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
leaq 0x65bc8(%rip), %rcx     # 0x8c03b
leaq 0x10(%rsp), %r14
movl $0x1, %esi
movq %r14, %rdx
callq 0x1a4e0
movq %rax, %r12
movq (%r14), %rax
movq 0x50(%rax), %rax
cmpq $0x0, 0x878(%rax)
je 0x264fd
leaq 0xc(%rsp), %r15
movq %rbx, %rdi
movl $0x2, %esi
movq %r15, %rdx
callq 0x185c0
movq %rax, %r14
cmpl $0x0, (%r15)
je 0x26521
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0x19160
movl $0x40, %edx
movq %rbx, %rdi
xorl %esi, %esi
movl $0x1, %r8d
callq 0x197d0
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
xorl %edx, %edx
callq 0x18680
movq %rbx, %rdi
movl $0x2, %esi
movq %rax, %rdx
callq 0x18410
jmp 0x2650e
leaq 0x67f37(%rip), %rsi     # 0x8e43b
movq %rbx, %rdi
xorl %eax, %eax
callq 0x19ba0
movl %eax, %ebp
movl %ebp, %eax
addq $0x18, %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 0x10(%rsp), %rax
movq 0x50(%rax), %rax
leaq 0x8(%rsp), %r15
movq %r12, %rdi
movq %r14, %rsi
movq %r15, %rdx
xorl %ecx, %ecx
callq *0x878(%rax)
movl (%r15), %esi
testl %esi, %esi
je 0x265a4
leaq 0xc(%rsp), %r13
movq %rbx, %rdi
movq %r13, %rdx
callq 0x19bd0
movq %rax, %r15
cmpl $0x0, (%r13)
je 0x265c9
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0x19160
movl 0x8(%rsp), %ecx
movl $0x40, %edx
movq %rbx, %rdi
movq %r15, %rsi
movl $0x1, %r8d
callq 0x197d0
movq %rbx, %rdi
callq 0x199a0
jmp 0x2650e
movl $0x1, %ebp
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0x19160
movl 0x8(%rsp), %ecx
movl $0x40, %edx
movq %rbx, %rdi
xorl %esi, %esi
jmp 0x26645
movq 0x10(%rsp), %rax
movq 0x50(%rax), %rax
leaq 0x8(%rsp), %r13
movq %r12, %rdi
movq %r14, %rsi
movq %r13, %rdx
movq %r15, %rcx
callq *0x878(%rax)
cmpl $0x0, (%r13)
je 0x26621
xorl %r12d, %r12d
movq %r15, %r13
movq %rbx, %rdi
movq %r13, %rsi
callq 0x1a070
incq %r12
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
movq %r12, %rdx
callq 0x19130
movl 0x8(%rsp), %eax
addq $0x40, %r13
cmpq %rax, %r12
jb 0x265f6
movl $0x1, %ebp
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0x19160
movl 0x8(%rsp), %ecx
movl $0x40, %edx
movq %rbx, %rdi
movq %r15, %rsi
movl $0x1, %r8d
callq 0x197d0
jmp 0x26510