// File: /workspace/github_cpp_makefile_star2_O3/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 0x41d35(%rip), %rcx     # 0x8def4
leaq 0x8(%rsp), %r15
movl $0x1, %esi
movq %r15, %rdx
callq 0x1a4e0
movq %rax, %rbp
movq (%r15), %r14
movq 0x48(%r14), %rax
cmpq $0x0, 0x78(%rax)
je 0x4c22f
leaq 0x532f0(%rip), %rcx     # 0x9f4d9
movq %rbx, %rdi
movl $0x2, %esi
xorl %edx, %edx
callq 0x1a4e0
movq %rax, %r13
leaq 0x4(%rsp), %r12
movq %rbx, %rdi
movq %r12, %rsi
callq 0x18040
movq %rax, %r15
cmpl $0x0, (%r12)
je 0x4c28f
movq %rbx, %rdi
movq %r15, %rsi
movl $0x1, %edx
callq 0x19160
movq %rbx, %rdi
xorl %esi, %esi
jmp 0x4c2cd
cmpq $0x0, 0x70(%rax)
je 0x4c2f2
leaq 0x53298(%rip), %rcx     # 0x9f4d9
movq %rbx, %rdi
movl $0x2, %esi
xorl %edx, %edx
callq 0x1a4e0
movq %rax, %r12
leaq 0x4(%rsp), %r13
movl $0x34, %edx
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movq %r13, %rcx
callq 0x19da0
movq %rax, %r15
cmpl $0x0, (%r13)
je 0x4c305
movq %rbx, %rdi
movq %r15, %rsi
movl $0x1, %edx
xorl %ecx, %ecx
callq 0x19610
jmp 0x4c2d7
movq %rbp, 0x10(%rsp)
leaq 0x4(%rsp), %rbp
movl $0x18, %edx
movq %rbx, %rdi
movl $0x3b9c9ad8, %esi       # imm = 0x3B9C9AD8
movq %rbp, %rcx
callq 0x19da0
movq %rax, %r12
cmpl $0x0, (%rbp)
je 0x4c327
movq %rbx, %rdi
movq %r15, %rsi
movl $0x1, %edx
callq 0x19160
movq %rbx, %rdi
movq %r12, %rsi
movl $0x1, %edx
callq 0x19160
movq %rbx, %rdi
callq 0x199a0
movl %eax, %ebp
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x542c2(%rip), %rsi     # 0xa05bb
movq %rbx, %rdi
xorl %eax, %eax
callq 0x19ba0
jmp 0x4c2df
movq 0x8(%rsp), %rax
movq 0x48(%rax), %rax
movq %rbp, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq *0x70(%rax)
movq %rbx, %rdi
testl %eax, %eax
je 0x4c378
xorl %esi, %esi
movl %eax, %edx
jmp 0x4c36e
movq %r13, 0x10(%r12)
movq 0x48(%r14), %rax
movq 0x10(%rsp), %r13
movq %r13, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq *0x78(%rax)
testl %eax, %eax
je 0x4c3ba
movl %eax, %ebp
movq %rbx, %rdi
movq %r15, %rsi
movl $0x1, %edx
callq 0x19160
movq %rbx, %rdi
movq %r12, %rsi
movl $0x1, %edx
callq 0x19160
movq %rbx, %rdi
xorl %esi, %esi
movl %ebp, %edx
callq 0x18980
jmp 0x4c2d7
movq %r15, %rsi
callq 0x19570
movq 0x8(%rsp), %rax
movq 0x48(%rax), %rax
movq 0x140(%rax), %rdx
movq %rbx, %rdi
movq %rbp, %rsi
movq %r12, %rcx
callq 0x4d005
movl $0x1, %ebp
movq %rbx, %rdi
movq %r15, %rsi
movl $0x1, %edx
xorl %ecx, %ecx
callq 0x19610
jmp 0x4c2e1
movq %rbx, %rdi
movq %r15, %rsi
callq 0x1a4b0
movq 0x10(%r12), %rcx
movq 0x48(%r14), %rax
movq 0x140(%rax), %rdx
movq %rbx, %rdi
movq %r13, %rsi
callq 0x4d005
movl $0x1, %ebp
movq %rbx, %rdi
movq %r15, %rsi
movl $0x1, %edx
callq 0x19160
movq %rbx, %rdi
movq %r12, %rsi
movl $0x1, %edx
callq 0x19160
jmp 0x4c2e1