// File: /workspace/github_cpp_makefile_star2_O3/stetre[P]moonvulkan/src/display_mode.c
// Function: Create
static int Create(lua_State *L)
    {
    int err;
    ud_t *display_ud;
    VkResult ec;
    VkDisplayModeKHR display_mode;
    VkDisplayModeCreateInfoKHR* info = NULL;
    VkDisplayKHR display = checkdisplay(L, 1, &display_ud);
    VkPhysicalDevice physical_device = (VkPhysicalDevice)(uintptr_t)display_ud->parent_ud->handle;
    const VkAllocationCallbacks *allocator = NULL;
    CheckInstancePfn(L, display_ud, CreateDisplayModeKHR);

#define CLEANUP zfreeVkDisplayModeCreateInfoKHR(L, info, 1)
    if(lua_istable(L, 2))
        {
        info = zcheckVkDisplayModeCreateInfoKHR(L, 2, &err);
        if(err) { CLEANUP; return argerror(L, 2); }
        allocator = optallocator(L, 3);
        }
    else
        {
#define CLEANUP1 zfreeVkDisplayModeParametersKHR(L, parameters, 1)
        VkDisplayModeCreateFlagsKHR flags = checkflags(L, 2);
        VkDisplayModeParametersKHR* parameters = zcheckVkDisplayModeParametersKHR(L, 3, &err);
        if(err) { CLEANUP1; return argerror(L, 3); }
        info = znewVkDisplayModeCreateInfoKHR(L, &err);
        if(err) { CLEANUP; CLEANUP1; return lua_error(L); }
#undef CLEANUP1
        info->flags = flags;
        memcpy(&info->parameters, parameters, sizeof(VkDisplayModeParametersKHR));
        Free(L, parameters); /* no zfree here */
        allocator = optallocator(L, 4);
        }
    ec = display_ud->idt->CreateDisplayModeKHR(physical_device, display, info, allocator, &display_mode);
    CLEANUP;
#undef CLEANUP
    CheckError(L, ec);
    pushdisplaymode(L, display_mode, display_ud, allocator);
    return 1;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
leaq 0x66803(%rip), %rcx     # 0x8e64e
leaq 0x8(%rsp), %r15
movl $0x1, %esi
movq %r15, %rdx
callq 0x1a4e0
movq %rax, %r14
movq (%r15), %rax
movq 0x48(%rax), %rcx
cmpq $0x0, 0xb8(%rcx)
je 0x27ed6
movq 0x10(%rax), %rax
movq (%rax), %r15
movq %rbx, %rdi
movl $0x2, %esi
callq 0x1a0f0
cmpl $0x5, %eax
jne 0x27eec
leaq 0x4(%rsp), %r13
movq %rbx, %rdi
movl $0x2, %esi
movq %r13, %rdx
callq 0x1a110
movq %rax, %r12
cmpl $0x0, (%r13)
je 0x27f51
movq %rbx, %rdi
movq %r12, %rsi
movl $0x1, %edx
callq 0x19160
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
xorl %edx, %edx
callq 0x18680
movq %rbx, %rdi
movl $0x2, %esi
jmp 0x27f44
leaq 0x66a3e(%rip), %rsi     # 0x8e91b
movq %rbx, %rdi
xorl %eax, %eax
callq 0x19ba0
jmp 0x28024
movq %rbx, %rdi
movl $0x2, %esi
callq 0x18f60
movq %rax, %rbp
leaq 0x4(%rsp), %r12
movq %rbx, %rdi
movl $0x3, %esi
movq %r12, %rdx
callq 0x1a170
movq %rax, %r13
cmpl $0x0, (%r12)
je 0x27f58
movq %rbx, %rdi
movq %r13, %rsi
movl $0x1, %edx
xorl %ecx, %ecx
callq 0x19610
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
xorl %edx, %edx
callq 0x18680
movq %rbx, %rdi
movl $0x3, %esi
movq %rax, %rdx
callq 0x18410
jmp 0x28024
movl $0x3, %esi
jmp 0x27fc7
leaq 0x4(%rsp), %rcx
movl $0x20, %edx
movq %rbx, %rdi
movl $0x3b9ad1d0, %esi       # imm = 0x3B9AD1D0
callq 0x19da0
movq %rax, %r12
leaq 0x4(%rsp), %rax
cmpl $0x0, (%rax)
je 0x27fa0
movq %rbx, %rdi
movq %r12, %rsi
movl $0x1, %edx
callq 0x19160
movq %rbx, %rdi
movq %r13, %rsi
movl $0x1, %edx
xorl %ecx, %ecx
callq 0x19610
jmp 0x2801c
movl %ebp, 0x10(%r12)
movq (%r13), %rax
movq %rax, 0x14(%r12)
movl 0x8(%r13), %eax
movl %eax, 0x1c(%r12)
movq %rbx, %rdi
movq %r13, %rsi
callq 0x182d0
movl $0x4, %esi
movq %rbx, %rdi
callq 0x191b0
movq %rax, %r13
movq 0x8(%rsp), %rax
movq 0x48(%rax), %rax
leaq 0x10(%rsp), %r8
movq %r15, %rdi
movq %r14, %rsi
movq %r12, %rdx
movq %r13, %rcx
callq *0xb8(%rax)
movl %eax, %r14d
movl $0x1, %ebp
movq %rbx, %rdi
movq %r12, %rsi
movl $0x1, %edx
callq 0x19160
testl %r14d, %r14d
je 0x28037
movq %rbx, %rdi
xorl %esi, %esi
movl %r14d, %edx
callq 0x18980
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
movq 0x10(%rsp), %rsi
movq 0x8(%rsp), %rdx
movq %rbx, %rdi
movq %r13, %rcx
callq 0x287ad
jmp 0x28026