// File: /workspace/github_cpp_makefile_star2_O2/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 0x5831f(%rip), %rcx     # 0x7f64e
pushq $0x1
popq %rsi
leaq 0x8(%rsp), %r15
movq %r15, %rdx
callq 0x1a500
movq %rax, %r14
movq (%r15), %rax
movq 0x48(%rax), %rcx
cmpq $0x0, 0xb8(%rcx)
je 0x273aa
movq 0x10(%rax), %rax
movq (%rax), %r15
pushq $0x2
popq %rsi
movq %rbx, %rdi
callq 0x1a110
pushq $0x2
popq %rsi
cmpl $0x5, %eax
jne 0x273c0
leaq 0x4(%rsp), %r13
movq %rbx, %rdi
movq %r13, %rdx
callq 0x1a130
movq %rax, %r12
cmpl $0x0, (%r13)
je 0x27418
pushq $0x1
popq %rdx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x19150
pushq $-0x1
popq %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x18680
pushq $0x2
jmp 0x27407
leaq 0x5856a(%rip), %rsi     # 0x7f91b
movq %rbx, %rdi
xorl %eax, %eax
callq 0x19bc0
jmp 0x274dc
movq %rbx, %rdi
callq 0x18f50
movq %rax, %rbp
pushq $0x3
popq %rsi
leaq 0x4(%rsp), %r12
movq %rbx, %rdi
movq %r12, %rdx
callq 0x1a190
movq %rax, %r13
cmpl $0x0, (%r12)
je 0x2741c
pushq $0x1
popq %rdx
movq %rbx, %rdi
movq %r13, %rsi
xorl %ecx, %ecx
callq 0x19620
pushq $-0x1
popq %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x18680
pushq $0x3
popq %rsi
movq %rbx, %rdi
movq %rax, %rdx
callq 0x18420
jmp 0x274dc
pushq $0x3
jmp 0x27483
pushq $0x20
popq %rdx
leaq 0x4(%rsp), %rcx
movq %rbx, %rdi
movl $0x3b9ad1d0, %esi       # imm = 0x3B9AD1D0
callq 0x19dc0
movq %rax, %r12
leaq 0x4(%rsp), %rax
cmpl $0x0, (%rax)
je 0x2745f
pushq $0x1
popq %rbp
movq %rbx, %rdi
movq %r12, %rsi
movl %ebp, %edx
callq 0x19150
movq %rbx, %rdi
movq %r13, %rsi
movl %ebp, %edx
xorl %ecx, %ecx
callq 0x19620
jmp 0x274d4
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 0x182e0
pushq $0x4
popq %rsi
movq %rbx, %rdi
callq 0x191a0
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
pushq $0x1
popq %rbp
movq %rbx, %rdi
movq %r12, %rsi
movl %ebp, %edx
callq 0x19150
testl %r14d, %r14d
je 0x274ef
movq %rbx, %rdi
xorl %esi, %esi
movl %r14d, %edx
callq 0x18980
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
movq 0x10(%rsp), %rsi
movq 0x8(%rsp), %rdx
movq %rbx, %rdi
movq %r13, %rcx
callq 0x27c20
jmp 0x274de