// File: /workspace/github_cpp_makefile_star2_O1/stetre[P]moonvulkan/src/event.c
// Function: Create
static int Create(lua_State *L)
    {
    int err;
    ud_t *ud, *device_ud;
    VkResult ec;
    VkEvent event;
    VkEventCreateInfo* info;
    VkDevice device = checkdevice(L, 1, &device_ud);
    const VkAllocationCallbacks *allocator = NULL;
#define CLEANUP zfreeVkEventCreateInfo(L, info, 1)
    if(lua_istable(L, 2))
        {
        allocator = optallocator(L, 3);
        info = zcheckVkEventCreateInfo(L, 2, &err);
        if(err) { CLEANUP; return argerror(L, 2); }
        }
    else
        {
        VkFlags flags = optflags(L, 2, 0);
        info = znewVkEventCreateInfo(L, &err);
        if(err) { CLEANUP; return lua_error(L); }
        info->flags = flags;
        }
    ec = device_ud->ddt->CreateEvent(device, info, allocator, &event);
    CLEANUP;
    CheckError(L, ec);
#undef CLEANUP
    TRACE_CREATE(event, "event");
    ud = newuserdata_nondispatchable(L, event, EVENT_MT);
    ud->parent_ud = device_ud;
    ud->device = device;
    ud->instance = device_ud->instance;
    ud->allocator = allocator;
    ud->destructor = freeevent;
    ud->ddt = device_ud->ddt;
    return 1;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
leaq 0x594c0(%rip), %rcx     # 0x8f03b
leaq 0x10(%rsp), %rdx
movl $0x1, %esi
callq 0x1a520
movq %rax, %r14
movq %rbx, %rdi
movl $0x2, %esi
callq 0x1a130
movq %rbx, %rdi
cmpl $0x5, %eax
jne 0x35c06
movl $0x3, %esi
callq 0x191c0
movq %rax, %r15
leaq 0x4(%rsp), %r13
movq %rbx, %rdi
movl $0x2, %esi
movq %r13, %rdx
callq 0x1a220
movq %rax, %r12
cmpl $0x0, (%r13)
je 0x35c64
movq %rbx, %rdi
movq %r12, %rsi
movl $0x1, %edx
callq 0x19170
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
xorl %edx, %edx
callq 0x18690
movq %rbx, %rdi
movl $0x2, %esi
movq %rax, %rdx
callq 0x18420
jmp 0x35d13
movl $0x2, %esi
xorl %edx, %edx
callq 0x192b0
movq %rax, %r15
leaq 0x4(%rsp), %r13
movl $0x18, %edx
movq %rbx, %rdi
movl $0xa, %esi
movq %r13, %rcx
callq 0x19de0
movq %rax, %r12
movl (%r13), %ebp
testl %ebp, %ebp
je 0x35c54
movq %rbx, %rdi
movq %r12, %rsi
movl $0x1, %edx
callq 0x19170
movq %rbx, %rdi
callq 0x199e0
jmp 0x35c59
movl %r15d, 0x10(%r12)
testl %ebp, %ebp
jne 0x35d13
xorl %r15d, %r15d
movq 0x10(%rsp), %rax
movq 0x50(%rax), %rax
leaq 0x8(%rsp), %rcx
movq %r14, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq *0xc8(%rax)
movl %eax, %ebp
movq %rbx, %rdi
movq %r12, %rsi
movl $0x1, %edx
callq 0x19170
testl %ebp, %ebp
je 0x35cad
movq %rbx, %rdi
xorl %esi, %esi
movl %ebp, %edx
callq 0x18990
movq %rbx, %rdi
callq 0x199e0
jmp 0x35d13
movq 0x8d314(%rip), %rax     # 0xc2fc8
cmpl $0x0, (%rax)
je 0x35ccc
movq 0x8(%rsp), %rsi
leaq 0x63e3f(%rip), %rdi     # 0x99b04
xorl %eax, %eax
callq 0x18970
movq 0x8(%rsp), %rsi
leaq 0x59cd3(%rip), %rdx     # 0x8f9ab
movq %rbx, %rdi
xorl %ecx, %ecx
callq 0x18330
movq 0x10(%rsp), %rcx
movq %rcx, 0x10(%rax)
movq %r14, 0x20(%rax)
movq 0x18(%rcx), %rdx
movq %rdx, 0x18(%rax)
movq %r15, 0x40(%rax)
leaq 0x189(%rip), %rdx       # 0x35e8b
movq %rdx, 0x8(%rax)
movq 0x50(%rcx), %rcx
movq %rcx, 0x50(%rax)
movl $0x1, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq