// File: /workspace/github_cpp_makefile_star2_O1/stetre[P]moonvulkan/src/surface.c
// Function: GetPhysicalDeviceSurfaceCapabilities
static int GetPhysicalDeviceSurfaceCapabilities(lua_State *L)
    {
    int err;
    VkResult ec;
    VkSurfaceKHR surface;
    VkSurfaceCapabilitiesKHR* capabilities;
    ud_t *ud;
    VkPhysicalDevice physdev = checkphysical_device(L, 1, &ud);

    if(ud->idt->GetPhysicalDeviceSurfaceCapabilities2KHR)
        return GetPhysicalDeviceSurfaceCapabilities2(L, physdev, ud);
    CheckInstancePfn(L, ud, GetPhysicalDeviceSurfaceCapabilitiesKHR);

    surface = checksurface(L, 2, NULL);
#define CLEANUP zfreeVkSurfaceCapabilitiesKHR(L, capabilities, 1);
    capabilities = znewVkSurfaceCapabilitiesKHR(L, &err);
    if(err) { CLEANUP; return lua_error(L); }
    ec = ud->idt->GetPhysicalDeviceSurfaceCapabilitiesKHR(physdev, surface, capabilities);
    CheckError(L, ec);
    zpushVkSurfaceCapabilitiesKHR(L, capabilities);
    PushSupportedSurfaceCounters(L, physdev, ud, surface);
    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 0x44a09(%rip), %rcx     # 0x90ef4
leaq 0x10(%rsp), %r15
movl $0x1, %esi
movq %r15, %rdx
callq 0x1a520
movq %rax, %r14
movq (%r15), %r15
movq 0x48(%r15), %rax
cmpq $0x0, 0x78(%rax)
je 0x4c55b
leaq 0x55fa1(%rip), %rcx     # 0xa24b6
movq %rbx, %rdi
movl $0x2, %esi
xorl %edx, %edx
callq 0x1a520
movq %rax, %rbp
leaq 0xc(%rsp), %r13
movq %rbx, %rdi
movq %r13, %rsi
callq 0x18040
movq %rax, %r12
cmpl $0x0, (%r13)
je 0x4c5bb
movq %rbx, %rdi
movq %r12, %rsi
movl $0x1, %edx
callq 0x19170
movq %rbx, %rdi
xorl %esi, %esi
jmp 0x4c5f5
cmpq $0x0, 0x70(%rax)
je 0x4c61a
leaq 0x55f49(%rip), %rcx     # 0xa24b6
movq %rbx, %rdi
movl $0x2, %esi
xorl %edx, %edx
callq 0x1a520
movq %rax, %r12
leaq 0xc(%rsp), %r13
movl $0x34, %edx
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movq %r13, %rcx
callq 0x19de0
movq %rax, %r15
cmpl $0x0, (%r13)
je 0x4c62d
movq %rbx, %rdi
movq %r15, %rsi
movl $0x1, %edx
xorl %ecx, %ecx
callq 0x19640
jmp 0x4c5ff
leaq 0xc(%rsp), %r13
movl $0x18, %edx
movq %rbx, %rdi
movl $0x3b9c9ad8, %esi       # imm = 0x3B9C9AD8
movq %r13, %rcx
callq 0x19de0
cmpl $0x0, (%r13)
je 0x4c64f
movq %rbx, %rdi
movq %rax, %r14
movq %r12, %rsi
movl $0x1, %edx
callq 0x19170
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0x19170
movq %rbx, %rdi
callq 0x199e0
movl %eax, %ebp
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x56f7a(%rip), %rsi     # 0xa359b
movq %rbx, %rdi
xorl %eax, %eax
callq 0x19be0
jmp 0x4c607
movq 0x10(%rsp), %rax
movq 0x48(%rax), %rax
movq %r14, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq *0x70(%rax)
movq %rbx, %rdi
testl %eax, %eax
je 0x4c69d
xorl %esi, %esi
movl %eax, %edx
jmp 0x4c693
movq %rbp, 0x10(%rax)
movq 0x48(%r15), %rcx
movq %r14, %rdi
movq %rax, %r13
movq %rax, %rsi
movq %r12, %rdx
callq *0x78(%rcx)
testl %eax, %eax
je 0x4c6d4
movl %eax, %ebp
movq %rbx, %rdi
movq %r12, %rsi
movl $0x1, %edx
callq 0x19170
movq %rbx, %rdi
movq %r13, %rsi
movl $0x1, %edx
callq 0x19170
movq %rbx, %rdi
xorl %esi, %esi
movl %ebp, %edx
callq 0x18990
jmp 0x4c5ff
movq %r15, %rsi
callq 0x195a0
movq 0x10(%rsp), %rdx
movq %rbx, %rdi
movq %r14, %rsi
movq %r12, %rcx
callq 0x4d30a
movl $0x1, %ebp
movq %rbx, %rdi
movq %r15, %rsi
movl $0x1, %edx
xorl %ecx, %ecx
callq 0x19640
jmp 0x4c609
movq %rbx, %rdi
movq %r12, %rsi
callq 0x1a4f0
movq 0x10(%r13), %rcx
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x4d30a
movl $0x1, %ebp
movq %rbx, %rdi
movq %r12, %rsi
movl $0x1, %edx
callq 0x19170
movq %rbx, %rdi
movq %r13, %rsi
movl $0x1, %edx
callq 0x19170
jmp 0x4c609