// File: /workspace/github_cpp_makefile_star2_O2/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 0x57593(%rip), %rcx     # 0x7d03b
pushq $0x1
popq %rbp
leaq 0x8(%rsp), %r14
movl %ebp, %esi
movq %r14, %rdx
callq 0x1a500
movq %rax, %r12
movq (%r14), %rax
movq 0x50(%rax), %rax
cmpq $0x0, 0x878(%rax)
je 0x25b27
pushq $0x2
popq %rsi
leaq 0x4(%rsp), %r15
movq %rbx, %rdi
movq %r15, %rdx
callq 0x185d0
movq %rax, %r14
cmpl $0x0, (%r15)
je 0x25b4b
pushq $0x1
popq %rbp
movq %rbx, %rdi
movq %r14, %rsi
movl %ebp, %edx
callq 0x19150
pushq $0x40
popq %rdx
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 0x25b38
leaq 0x5990d(%rip), %rsi     # 0x7f43b
movq %rbx, %rdi
xorl %eax, %eax
callq 0x19bc0
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 0x8(%rsp), %rax
movq 0x50(%rax), %rax
movq %rsp, %r15
movq %r12, %rdi
movq %r14, %rsi
movq %r15, %rdx
xorl %ecx, %ecx
callq *0x878(%rax)
movl (%r15), %esi
testl %esi, %esi
je 0x25bc5
leaq 0x4(%rsp), %r15
movq %rbx, %rdi
movq %r15, %rdx
callq 0x19bf0
movq %rax, %r13
cmpl $0x0, (%r15)
je 0x25be2
pushq $0x1
popq %rbp
movq %rbx, %rdi
movq %r14, %rsi
movl %ebp, %edx
callq 0x19150
movl (%rsp), %ecx
pushq $0x40
popq %rdx
movq %rbx, %rdi
movq %r13, %rsi
movl %ebp, %r8d
callq 0x197e0
movq %rbx, %rdi
callq 0x199c0
jmp 0x25b38
pushq $0x1
popq %rbp
movq %rbx, %rdi
movq %r14, %rsi
movl %ebp, %edx
callq 0x19150
movl (%rsp), %ecx
pushq $0x40
popq %rdx
movq %rbx, %rdi
xorl %esi, %esi
jmp 0x25c4e
movq 0x8(%rsp), %rax
movq 0x50(%rax), %rax
movq %rsp, %rdx
movq %r12, %rdi
movq %r14, %rsi
movq %r13, %rcx
callq *0x878(%rax)
xorl %r12d, %r12d
movq %r13, %r15
pushq $-0x2
popq %r13
movq %r15, 0x10(%rsp)
movl (%rsp), %eax
movq %rbx, %rdi
cmpq %rax, %r12
jae 0x25c36
movq %r15, %rsi
callq 0x1a090
incq %r12
movq %rbx, %rdi
movl %r13d, %esi
movq %r12, %rdx
callq 0x19120
addq $0x40, %r15
jmp 0x25c0c
movq %r14, %rsi
movl %ebp, %edx
callq 0x19150
movl (%rsp), %ecx
pushq $0x40
popq %rdx
movq %rbx, %rdi
movq 0x10(%rsp), %rsi
movl %ebp, %r8d
callq 0x197e0
jmp 0x25b3a