// File: /workspace/github_cpp_makefile_star2_O2/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 0x35d1c(%rip), %rcx     # 0x7eef4
pushq $0x1
popq %rbp
leaq 0x10(%rsp), %r15
movl %ebp, %esi
movq %r15, %rdx
callq 0x1a500
movq %rax, %r14
movq (%r15), %r15
movq 0x48(%r15), %rax
cmpq $0x0, 0x78(%rax)
je 0x49246
leaq 0x472d7(%rip), %rcx     # 0x904d9
pushq $0x2
popq %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x1a500
movq %rax, %rbp
leaq 0xc(%rsp), %r13
movq %rbx, %rdi
movq %r13, %rsi
callq 0x18040
movq %rax, %r12
cmpl $0x0, (%r13)
je 0x4929a
pushq $0x1
popq %rbp
movq %rbx, %rdi
movq %r12, %rsi
movl %ebp, %edx
callq 0x19150
movq %rbx, %rdi
xorl %esi, %esi
jmp 0x492d2
cmpq $0x0, 0x70(%rax)
je 0x492f4
leaq 0x47281(%rip), %rcx     # 0x904d9
pushq $0x2
popq %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x1a500
movq %rax, %r12
pushq $-0x1
popq %rsi
pushq $0x34
popq %rdx
leaq 0xc(%rsp), %r13
movq %rbx, %rdi
movq %r13, %rcx
callq 0x19dc0
movq %rax, %r15
cmpl $0x0, (%r13)
je 0x49307
pushq $0x1
popq %rdx
movq %rbx, %rdi
movq %r15, %rsi
xorl %ecx, %ecx
callq 0x19620
jmp 0x492d9
pushq $0x18
popq %rdx
leaq 0xc(%rsp), %r13
movq %rbx, %rdi
movl $0x3b9c9ad8, %esi       # imm = 0x3B9C9AD8
movq %r13, %rcx
callq 0x19dc0
cmpl $0x0, (%r13)
je 0x49329
pushq $0x1
popq %rbp
movq %rbx, %rdi
movq %rax, %r14
movq %r12, %rsi
movl %ebp, %edx
callq 0x19150
movq %rbx, %rdi
movq %r14, %rsi
movl %ebp, %edx
callq 0x19150
movq %rbx, %rdi
callq 0x199c0
movl %eax, %ebp
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x482c0(%rip), %rsi     # 0x915bb
movq %rbx, %rdi
xorl %eax, %eax
callq 0x19bc0
jmp 0x492e1
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 0x49377
xorl %esi, %esi
movl %eax, %edx
jmp 0x4936d
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 0x493a6
movl %eax, %ebp
pushq $0x1
popq %r14
movq %rbx, %rdi
movq %r12, %rsi
movl %r14d, %edx
callq 0x19150
movq %rbx, %rdi
movq %r13, %rsi
movl %r14d, %edx
callq 0x19150
movq %rbx, %rdi
xorl %esi, %esi
movl %ebp, %edx
callq 0x18980
jmp 0x492d9
movq %r15, %rsi
callq 0x19580
movq 0x10(%rsp), %rdx
movq %rbx, %rdi
movq %r14, %rsi
movq %r12, %rcx
callq 0x49f23
movq %rbx, %rdi
movq %r15, %rsi
movl %ebp, %edx
xorl %ecx, %ecx
callq 0x19620
jmp 0x492e3
movq %rbx, %rdi
movq %r12, %rsi
callq 0x1a4d0
movq 0x10(%r13), %rcx
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x49f23
pushq $0x1
popq %rbp
movq %rbx, %rdi
movq %r12, %rsi
movl %ebp, %edx
callq 0x19150
movq %rbx, %rdi
movq %r13, %rsi
movl %ebp, %edx
callq 0x19150
jmp 0x492e3