LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O3/stetre[P]moonvulkan/src/surface.c
// Function: GetDeviceGroupSurfacePresentModes
static int GetDeviceGroupSurfacePresentModes(lua_State *L)
    {
    VkResult ec;
    ud_t *ud;
    VkDeviceGroupPresentModeFlagsKHR modes;
    VkDevice device = checkdevice(L, 1, &ud);
    VkSurfaceKHR surface = checksurface(L, 2, NULL);
    CheckDevicePfn(L, ud, GetDeviceGroupSurfacePresentModesKHR);
    ec = ud->ddt->GetDeviceGroupSurfacePresentModesKHR(device, surface, &modes);
    CheckError(L, ec);
    pushflags(L, modes);
    return 1;
    }

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
leaq 0x3f362(%rip), %rcx     # 0x8c03b
leaq 0x8(%rsp), %r15
movl $0x1, %esi
movq %r15, %rdx
callq 0x1a4e0
movq %rax, %r14
leaq 0x527e4(%rip), %rcx     # 0x9f4d9
movq %rbx, %rdi
movl $0x2, %esi
xorl %edx, %edx
callq 0x1a4e0
movq (%r15), %rcx
movq 0x50(%rcx), %rcx
movq 0x550(%rcx), %rcx
testq %rcx, %rcx
je 0x4cd3e
leaq 0x4(%rsp), %rdx
movq %r14, %rdi
movq %rax, %rsi
callq *%rcx
testl %eax, %eax
je 0x4cd51
movq %rbx, %rdi
xorl %esi, %esi
movl %eax, %edx
callq 0x18980
movq %rbx, %rdi
callq 0x199a0
jmp 0x4cd62
leaq 0x539d5(%rip), %rsi     # 0xa071a
movq %rbx, %rdi
xorl %eax, %eax
callq 0x19ba0
jmp 0x4cd62
movl 0x4(%rsp), %esi
movq %rbx, %rdi
callq 0x19440
movl $0x1, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/stetre[P]moonvulkan/src/surface.c
// Function: GetPhysicalDevicePresentRectangles
static int GetPhysicalDevicePresentRectangles(lua_State *L)
    {
    int err;
    VkResult ec;
    ud_t *ud;
    uint32_t i, count = 0;
    VkRect2D* rects = NULL;
    VkPhysicalDevice physdev = checkphysical_device(L, 1, &ud);
    VkSurfaceKHR surface = checksurface(L, 2, NULL);
    CheckDevicePfn(L, ud, GetPhysicalDevicePresentRectanglesKHR);
    ec = ud->ddt->GetPhysicalDevicePresentRectanglesKHR(physdev, surface, &count, NULL);
    CheckError(L, ec);
#define CLEANUP zfreearrayVkRect2D(L, rects, count, 1)
    rects = znewarrayVkRect2D(L, count, &err);
    if(err) { CLEANUP; return lua_error(L); }
    ec = ud->ddt->GetPhysicalDevicePresentRectanglesKHR(physdev, surface, &count, rects);
    if(ec) { CLEANUP; CheckError(L, ec); return 0; }
    lua_newtable(L);
    for(i = 0; i < count; i++)
        {
        zpushVkRect2D(L, &rects[i]);
        lua_rawseti(L, -2, i+1);
        }
    CLEANUP;
#undef CLEANUP
    return 1;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movl $0x0, 0x4(%rsp)
leaq 0x41168(%rip), %rcx     # 0x8def4
leaq 0x8(%rsp), %r14
movl $0x1, %esi
movq %r14, %rdx
callq 0x1a4e0
movq %rax, %r15
leaq 0x52731(%rip), %rcx     # 0x9f4d9
movq %rbx, %rdi
movl $0x2, %esi
xorl %edx, %edx
callq 0x1a4e0
movq %rax, %r12
movq (%r14), %rax
movq 0x50(%rax), %rax
movq 0x558(%rax), %rax
testq %rax, %rax
je 0x4cdee
leaq 0x4(%rsp), %rdx
movq %r15, %rdi
movq %r12, %rsi
xorl %ecx, %ecx
callq *%rax
testl %eax, %eax
je 0x4ce01
movq %rbx, %rdi
xorl %esi, %esi
movl %eax, %edx
callq 0x18980
jmp 0x4ce46
leaq 0x5395f(%rip), %rsi     # 0xa0754
movq %rbx, %rdi
xorl %eax, %eax
callq 0x19ba0
jmp 0x4ce4e
movl 0x4(%rsp), %ecx
leaq 0x14(%rsp), %r13
movl $0x10, %edx
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movq %r13, %r8
callq 0x19810
movq %rax, %r14
cmpl $0x0, (%r13)
je 0x4ce61
movl 0x4(%rsp), %ecx
movl $0x10, %edx
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %r8d
xorl %r9d, %r9d
callq 0x18d30
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 0x8(%rsp), %rax
movq 0x50(%rax), %rax
leaq 0x4(%rsp), %rdx
movq %r15, %rdi
movq %r12, %rsi
movq %r14, %rcx
callq *0x558(%rax)
testl %eax, %eax
je 0x4cead
movl %eax, %ebp
movl 0x4(%rsp), %ecx
movl $0x10, %edx
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %r8d
xorl %r9d, %r9d
callq 0x18d30
movq %rbx, %rdi
xorl %esi, %esi
movl %ebp, %edx
jmp 0x4cde7
xorl %r15d, %r15d
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x187d0
cmpl $0x0, 0x4(%rsp)
je 0x4cef5
xorl %r12d, %r12d
movq %r14, %r13
movq %rbx, %rdi
movq %r13, %rsi
callq 0x1a3b0
incq %r12
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
movq %r12, %rdx
callq 0x19130
movl 0x4(%rsp), %r15d
addq $0x10, %r13
cmpq %r15, %r12
jb 0x4cec9
movl $0x1, %ebp
movl $0x10, %edx
movq %rbx, %rdi
movq %r14, %rsi
movl %r15d, %ecx
movl $0x1, %r8d
xorl %r9d, %r9d
callq 0x18d30
jmp 0x4ce50
// File: /workspace/github_cpp_makefile_star2_O3/stetre[P]moonvulkan/src/surface.c
// Function: GetDeviceGroupPresentCapabilities
static int GetDeviceGroupPresentCapabilities(lua_State *L)
    {
    int err;
    VkResult ec;
    ud_t *ud;
    VkDeviceGroupPresentCapabilitiesKHR* capabilities;
    VkDevice device = checkdevice(L, 1, &ud);
    CheckDevicePfn(L, ud, GetDeviceGroupPresentCapabilitiesKHR);
#define CLEANUP zfreeVkDeviceGroupPresentCapabilitiesKHR(L, capabilities, 1)
    capabilities = znewchainVkDeviceGroupPresentCapabilitiesKHR(L, &err);
    if(err) { CLEANUP; return lua_error(L); }
    ec = ud->ddt->GetDeviceGroupPresentCapabilitiesKHR(device, capabilities);
    if(ec) { CLEANUP; CheckError(L, ec); return 0; }
    zpushVkDeviceGroupPresentCapabilitiesKHR(L, capabilities);
    CLEANUP;
#undef CLEANUP
    return 1;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
leaq 0x3f10a(%rip), %rcx     # 0x8c03b
movq %rsp, %r14
movl $0x1, %esi
movq %r14, %rdx
callq 0x1a4e0
movq %rax, %r15
movq (%r14), %rax
movq 0x50(%rax), %rax
cmpq $0x0, 0x548(%rax)
je 0x4cf81
leaq 0xc(%rsp), %r12
movq %rbx, %rdi
movq %r12, %rsi
callq 0x18380
movq %rax, %r14
cmpl $0x0, (%r12)
je 0x4cf94
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0x19160
jmp 0x4cfca
leaq 0x53807(%rip), %rsi     # 0xa078f
movq %rbx, %rdi
xorl %eax, %eax
callq 0x19ba0
jmp 0x4cfd2
movq (%rsp), %rax
movq 0x50(%rax), %rax
movq %r15, %rdi
movq %r14, %rsi
callq *0x548(%rax)
testl %eax, %eax
je 0x4cfe3
movl %eax, %ebp
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0x19160
movq %rbx, %rdi
xorl %esi, %esi
movl %ebp, %edx
callq 0x18980
movq %rbx, %rdi
callq 0x199a0
movl %eax, %ebp
movl %ebp, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
movq %r14, %rsi
callq 0x19f90
movl $0x1, %ebp
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0x19160
jmp 0x4cfd4
// File: /workspace/github_cpp_makefile_star2_O3/stetre[P]moonvulkan/src/surface.c
// Function: PushSupportedSurfaceCounters
static int PushSupportedSurfaceCounters(lua_State *L, VkPhysicalDevice physdev, ud_t *ud, VkSurfaceKHR surface)
/* Calls GetPhysicalDeviceSurfaceCapabilities2EXT() to retrieve the supportedSurfaceCounters
 * field, and sets the field in the table on the top of the stack.
 * (Note that all other capabilities retrieved by this function are the same as in
 * GetPhysicalDeviceSurfaceCapabilitiesKHR(), so we don't bother about them).
 */
    {
    VkResult ec;
    VkSurfaceCapabilities2EXT caps;
    if(!ud->idt->GetPhysicalDeviceSurfaceCapabilities2EXT) return 0;
    memset(&caps, 0, sizeof(caps));
    caps.sType = VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_2_EXT;
    ec = ud->idt->GetPhysicalDeviceSurfaceCapabilities2EXT(physdev, surface, &caps);
    if(ec) return 0;
    pushflags(L, caps.supportedSurfaceCounters);
    lua_setfield(L, -2, "supported_surface_counters");
    return 0;
    }

// Assembly:
testq %rdx, %rdx
je 0x4d069
pushq %rbx
subq $0x50, %rsp
movq %rdx, %rax
movq %rdi, %rbx
xorps %xmm0, %xmm0
movq %rsp, %rdx
movaps %xmm0, (%rdx)
movaps %xmm0, 0x30(%rdx)
movaps %xmm0, 0x20(%rdx)
movaps %xmm0, 0x10(%rdx)
movq $0x0, 0x40(%rdx)
movl $0x3b9c2990, (%rdx)     # imm = 0x3B9C2990
movq %rsi, %rdi
movq %rcx, %rsi
callq *%rax
testl %eax, %eax
jne 0x4d064
movl 0x44(%rsp), %esi
movq %rbx, %rdi
callq 0x19440
leaq 0x535a1(%rip), %rdx     # 0xa05f8
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x18af0
addq $0x50, %rsp
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O3/stetre[P]moonvulkan/src/surface.c
// Function: newsurface
static int newsurface(lua_State *L, VkInstance instance, VkSurfaceKHR surface, const VkAllocationCallbacks *allocator)
    {
    ud_t *ud;
    TRACE_CREATE(surface, "surface");
    ud = newuserdata_nondispatchable(L, surface, SURFACE_MT);
    ud->parent_ud = UD(instance);
    ud->instance = instance;
    ud->destructor = freesurface;
    ud->allocator = allocator;
    ud->idt = UD(instance)->idt;
    return 1;
    }

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %r14
movq %rdx, %r15
movq %rsi, %rbx
movq %rdi, %r12
movq 0x72f43(%rip), %rax     # 0xbffc8
cmpl $0x0, (%rax)
je 0x4d09b
leaq 0x53625(%rip), %rdi     # 0xa06b6
movq %r15, %rsi
xorl %eax, %eax
callq 0x18960
leaq 0x52437(%rip), %rdx     # 0x9f4d9
movq %r12, %rdi
movq %r15, %rsi
xorl %ecx, %ecx
callq 0x18320
movq %rax, %r15
movq %rbx, %rdi
callq 0x19e90
movq %rax, 0x10(%r15)
movq %rbx, 0x18(%r15)
leaq 0x24(%rip), %rax        # 0x4d0ed
movq %rax, 0x8(%r15)
movq %r14, 0x40(%r15)
movq %rbx, %rdi
callq 0x19e90
movq 0x48(%rax), %rax
movq %rax, 0x48(%r15)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/stetre[P]moonvulkan/src/surface.c
// Function: freesurface
static int freesurface(lua_State *L, ud_t *ud)
    {
    VkSurfaceKHR surface = (VkSurfaceKHR)ud->handle;
    const VkAllocationCallbacks *allocator = ud->allocator;
    VkInstance instance = ud->instance;

    if(!freeuserdata(L, ud))
        return 0; /* double call */
    TRACE_DELETE(surface, "surface");
    UD(instance)->idt->DestroySurfaceKHR(instance, surface, allocator);
    return 0;
    }

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq (%rsi), %rbx
movq 0x18(%rsi), %r15
movq 0x40(%rsi), %r14
callq 0x18d20
testl %eax, %eax
je 0x4d13b
movq 0x72ebb(%rip), %rax     # 0xbffc8
cmpl $0x0, (%rax)
je 0x4d123
leaq 0x535b6(%rip), %rdi     # 0xa06cf
movq %rbx, %rsi
xorl %eax, %eax
callq 0x18960
movq %r15, %rdi
callq 0x19e90
movq 0x48(%rax), %rax
movq %r15, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq *0x60(%rax)
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/stetre[P]moonvulkan/src/swapchain.c
// Function: CreateSwapchain
static int CreateSwapchain(lua_State *L)
    {
    int err;
    ud_t *ud;
    VkResult ec;
    VkSwapchainKHR swapchain;
    VkSwapchainCreateInfoKHR *info;
    VkDevice device = checkdevice(L, 1, &ud);
    const VkAllocationCallbacks *allocator = optallocator(L, 3);
#define CLEANUP zfreeVkSwapchainCreateInfoKHR(L, info, 1)
    info = zcheckVkSwapchainCreateInfoKHR(L, 2, &err);
    if(err) { CLEANUP; return argerror(L, 2); }
    CheckDevicePfn(L, ud, CreateSwapchainKHR);
    ec = ud->ddt->CreateSwapchainKHR(device, info, allocator, &swapchain);
    CLEANUP;
#undef CLEANUP
    CheckError(L, ec);
    return newswapchain(L, swapchain, device, allocator);
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
leaq 0x3ed70(%rip), %rcx     # 0x8c03b
leaq 0x8(%rsp), %rdx
movl $0x1, %esi
callq 0x1a4e0
movq %rax, %r14
movq %rbx, %rdi
movl $0x3, %esi
callq 0x191b0
movq %rax, %r15
leaq 0x14(%rsp), %r13
movq %rbx, %rdi
movl $0x2, %esi
movq %r13, %rdx
callq 0x19df0
movq %rax, %r12
cmpl $0x0, (%r13)
je 0x4d34e
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
movq %rax, %rdx
callq 0x18410
movl %eax, %ebp
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x8(%rsp), %rax
movq 0x50(%rax), %rax
movq 0x248(%rax), %rax
testq %rax, %rax
je 0x4d3a5
movq %rsp, %rcx
movq %r14, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq *%rax
movl %eax, %r13d
movl $0x1, %ebp
movq %rbx, %rdi
movq %r12, %rsi
movl $0x1, %edx
callq 0x19160
testl %r13d, %r13d
je 0x4d3b8
movq %rbx, %rdi
xorl %esi, %esi
movl %r13d, %edx
callq 0x18980
movq %rbx, %rdi
callq 0x199a0
jmp 0x4d33b
leaq 0x534dc(%rip), %rsi     # 0xa0888
movq %rbx, %rdi
xorl %eax, %eax
callq 0x19ba0
jmp 0x4d33b
movq (%rsp), %rsi
movq %rbx, %rdi
movq %r14, %rdx
movq %r15, %rcx
callq 0x4dca3
jmp 0x4d33d
// File: /workspace/github_cpp_makefile_star2_O3/stetre[P]moonvulkan/src/swapchain.c
// Function: CreateSharedSwapchains
static int CreateSharedSwapchains(lua_State *L)
    {
    int err;
    VkResult ec;
    ud_t *ud;
    uint32_t count, i;
    VkSwapchainKHR *swapchains;
    VkSwapchainCreateInfoKHR* infos;
    VkDevice device = checkdevice(L, 1, &ud);
    const VkAllocationCallbacks *allocator = optallocator(L, 3);
    CheckDevicePfn(L, ud, CreateSharedSwapchainsKHR);
#define CLEANUP zfreearrayVkSwapchainCreateInfoKHR(L, infos, count, 1)
    infos = zcheckarrayVkSwapchainCreateInfoKHR(L, 2, &count, &err);
    swapchains = (VkSwapchainKHR*)MallocNoErr(L, count*sizeof(VkSwapchainKHR));
    if(!swapchains) { CLEANUP; return errmemory(L); }
    ec = ud->ddt->CreateSharedSwapchainsKHR(device, count, infos, allocator, swapchains);
    CLEANUP;
#undef CLEANUP
    if(ec) { Free(L, swapchains); CheckError(L, ec); }
    
    lua_newtable(L);
    for(i = 0; i < count; i++)
        {
        newswapchain(L, swapchains[i], device, allocator);
        lua_rawseti(L, -2, i+1);
        }
    Free(L, swapchains);
    return 0;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
leaq 0x3ec54(%rip), %rcx     # 0x8c03b
leaq 0x8(%rsp), %r12
movl $0x1, %esi
movq %r12, %rdx
callq 0x1a4e0
movq %rax, %r14
movq %rbx, %rdi
movl $0x3, %esi
callq 0x191b0
movq %rax, %r15
movq (%r12), %rax
movq 0x50(%rax), %rax
cmpq $0x0, 0x278(%rax)
je 0x4d4b7
leaq 0x4(%rsp), %r12
leaq 0x14(%rsp), %rcx
movq %rbx, %rdi
movl $0x2, %esi
movq %r12, %rdx
callq 0x18b00
movq %rax, %r13
movl (%r12), %esi
shlq $0x3, %rsi
movq %rbx, %rdi
callq 0x18050
testq %rax, %rax
je 0x4d4c3
movq %rax, %r12
movq 0x8(%rsp), %rax
movq 0x50(%rax), %rax
movl 0x4(%rsp), %esi
movq %r14, %rdi
movq %r13, %rdx
movq %r15, %rcx
movq %r12, %r8
callq *0x278(%rax)
movl %eax, %ebp
movl 0x4(%rsp), %ecx
movl $0x68, %edx
movq %rbx, %rdi
movq %r13, %rsi
movl $0x1, %r8d
callq 0x197d0
testl %ebp, %ebp
je 0x4d507
movq %rbx, %rdi
movq %r12, %rsi
callq 0x182d0
movq %rbx, %rdi
xorl %esi, %esi
movl %ebp, %edx
callq 0x18980
movq %rbx, %rdi
callq 0x199a0
jmp 0x4d4f4
leaq 0x53428(%rip), %rsi     # 0xa08e6
movq %rbx, %rdi
jmp 0x4d4ed
movl 0x4(%rsp), %ecx
movl $0x68, %edx
movq %rbx, %rdi
movq %r13, %rsi
movl $0x1, %r8d
callq 0x197d0
movl $0xfffffffa, %edi       # imm = 0xFFFFFFFA
callq 0x19930
movq %rbx, %rdi
movq %rax, %rsi
xorl %eax, %eax
callq 0x19ba0
movl %eax, %ebp
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %ebp, %ebp
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x187d0
cmpl $0x0, 0x4(%rsp)
je 0x4d54d
xorl %r13d, %r13d
movq (%r12,%r13,8), %rsi
movq %rbx, %rdi
movq %r14, %rdx
movq %r15, %rcx
callq 0x4dca3
incq %r13
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
movq %r13, %rdx
callq 0x19130
movl 0x4(%rsp), %eax
cmpq %rax, %r13
jb 0x4d51f
movq %rbx, %rdi
movq %r12, %rsi
callq 0x182d0
jmp 0x4d4f6
// File: /workspace/github_cpp_makefile_star2_O3/stetre[P]moonvulkan/src/swapchain.c
// Function: GetSwapchainImages
static int GetSwapchainImages(lua_State *L)
    {
    VkResult ec; 
    uint32_t count, i;
    VkImage *images;
    ud_t *ud; 
    VkSwapchainKHR swapchain = checkswapchain(L, 1, &ud);
    VkDevice device = ud->device;
    CheckDevicePfn(L, ud, GetSwapchainImagesKHR);
    ec = ud->ddt->GetSwapchainImagesKHR(device, swapchain, &count, NULL);
    CheckError(L, ec);
    
    lua_newtable(L);
    if(count == 0) return 1;
    
    images = (VkImage*)Malloc(L, sizeof(VkImage)*count);
    ec = ud->ddt->GetSwapchainImagesKHR(device, swapchain, &count, images);
    if(ec) { Free(L, images); CheckError(L, ec); }

    for(i = 0; i < count; i++)
        {
        pushimage_swapchain(L, images[i], ud); 
        lua_rawseti(L, -2, i+1);
        }
    
    Free(L, images);
    return 1;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
leaq 0x409c8(%rip), %rcx     # 0x8df67
leaq 0x8(%rsp), %r14
movl $0x1, %esi
movq %r14, %rdx
callq 0x1a4e0
movq %rax, %r15
movq (%r14), %rcx
movq 0x50(%rcx), %rax
movq 0x258(%rax), %rax
testq %rax, %rax
je 0x4d5f4
movq 0x20(%rcx), %r12
leaq 0x4(%rsp), %rdx
movq %r12, %rdi
movq %r15, %rsi
xorl %ecx, %ecx
callq *%rax
movq %rbx, %rdi
xorl %esi, %esi
testl %eax, %eax
je 0x4d616
movl %eax, %edx
callq 0x18980
movq %rbx, %rdi
callq 0x199a0
jmp 0x4d605
leaq 0x5331a(%rip), %rsi     # 0xa0915
movq %rbx, %rdi
xorl %eax, %eax
callq 0x19ba0
movl %eax, %ebp
movl %ebp, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
xorl %edx, %edx
callq 0x187d0
movl 0x4(%rsp), %esi
movl $0x1, %ebp
testq %rsi, %rsi
je 0x4d607
shlq $0x3, %rsi
movq %rbx, %rdi
callq 0x19200
movq %rax, %r14
movq 0x8(%rsp), %rax
movq 0x50(%rax), %rax
leaq 0x4(%rsp), %rdx
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rcx
callq *0x258(%rax)
testl %eax, %eax
je 0x4d676
movl %eax, %r15d
movq %rbx, %rdi
movq %r14, %rsi
callq 0x182d0
movq %rbx, %rdi
xorl %esi, %esi
movl %r15d, %edx
jmp 0x4d5e5
cmpl $0x0, 0x4(%rsp)
je 0x4d6ad
xorl %r15d, %r15d
movq (%r14,%r15,8), %rsi
movq 0x8(%rsp), %rdx
movq %rbx, %rdi
callq 0x18250
incq %r15
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
movq %r15, %rdx
callq 0x19130
movl 0x4(%rsp), %eax
cmpq %rax, %r15
jb 0x4d680
movq %rbx, %rdi
movq %r14, %rsi
callq 0x182d0
jmp 0x4d607
// File: /workspace/github_cpp_makefile_star2_O3/stetre[P]moonvulkan/src/swapchain.c
// Function: AcquireNextImage
static int AcquireNextImage(lua_State *L)
    {
    ud_t *ud;
    VkSwapchainKHR swapchain =  checkswapchain(L, 1, &ud);
    if((lua_type(L, 2) == LUA_TTABLE) && ud->ddt->AcquireNextImage2KHR)
        return AcquireNextImage2(L, swapchain, ud);
    return AcquireNextImage1(L, swapchain, ud);
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
leaq 0x40892(%rip), %rcx     # 0x8df67
leaq 0x10(%rsp), %r15
movl $0x1, %esi
movq %r15, %rdx
callq 0x1a4e0
movq %rax, %r14
movq %rbx, %rdi
movl $0x2, %esi
callq 0x1a0f0
movq (%r15), %rbp
cmpl $0x5, %eax
jne 0x4d768
movq 0x50(%rbp), %rax
cmpq $0x0, 0x560(%rax)
je 0x4d768
movq 0x20(%rbp), %r12
leaq 0x8(%rsp), %r13
movq %rbx, %rdi
movl $0x2, %esi
movq %r13, %rdx
callq 0x19b30
movq %rax, %r15
cmpl $0x0, (%r13)
je 0x4d80a
movq %rbx, %rdi
movq %r15, %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
movq %rax, %rdx
callq 0x18410
jmp 0x4d867
movq 0x20(%rbp), %r15
movq %rbx, %rdi
movl $0x2, %esi
callq 0x19b60
movq %rax, %r12
leaq 0x40813(%rip), %rcx     # 0x8df96
movq %rbx, %rdi
movl $0x3, %esi
xorl %edx, %edx
callq 0x1a490
movq %rax, %r13
leaq 0x4080f(%rip), %rcx     # 0x8dfab
movq %rbx, %rdi
movl $0x4, %esi
xorl %edx, %edx
callq 0x1a490
movq 0x50(%rbp), %rcx
movq 0x268(%rcx), %r10
testq %r10, %r10
je 0x4d7ed
leaq 0x8(%rsp), %r9
movq %r15, %rdi
movq %r14, %rsi
movq %r12, %rdx
movq %r13, %rcx
movq %rax, %r8
callq *%r10
movl %eax, %ebp
cmpl $0x3b9acdeb, %eax       # imm = 0x3B9ACDEB
je 0x4d7df
testl %ebp, %ebp
jne 0x4d800
movl 0x8(%rsp), %esi
movq %rbx, %rdi
callq 0x18b50
jmp 0x4d856
leaq 0x5314c(%rip), %rsi     # 0xa0940
movq %rbx, %rdi
xorl %eax, %eax
callq 0x19ba0
jmp 0x4d867
movq %rbx, %rdi
callq 0x19ce0
jmp 0x4d856
movq %r14, 0x10(%r15)
movq 0x50(%rbp), %rax
leaq 0xc(%rsp), %rdx
movq %r12, %rdi
movq %r15, %rsi
callq *0x560(%rax)
movl %eax, %ebp
cmpl $0x3b9acdeb, %eax       # imm = 0x3B9ACDEB
je 0x4d830
testl %ebp, %ebp
jne 0x4d83e
movl 0xc(%rsp), %esi
movq %rbx, %rdi
callq 0x18b50
jmp 0x4d846
movq %rbx, %rdi
callq 0x19ce0
movq %rbx, %rdi
movq %r15, %rsi
movl $0x1, %edx
callq 0x19160
movq %rbx, %rdi
xorl %esi, %esi
movl %ebp, %edx
callq 0x18980
movl $0x2, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/stetre[P]moonvulkan/src/swapchain.c
// Function: WaitForPresent
static int WaitForPresent(lua_State *L)
    {
    VkResult ec;
    ud_t *ud;
    VkSwapchainKHR swapchain =  checkswapchain(L, 1, &ud);
    uint64_t presentId = luaL_checkinteger(L, 2);
    uint64_t timeout = luaL_checkinteger(L, 3);
    CheckDevicePfn(L, ud, WaitForPresentKHR);
    ec = ud->ddt->WaitForPresentKHR(ud->device, swapchain, presentId, timeout);
    pushresult(L, ec);
    return 1;
    }

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdi, %r14
leaq 0x406da(%rip), %rcx     # 0x8df67
movl $0x1, %ebx
leaq 0x8(%rsp), %r13
movl $0x1, %esi
movq %r13, %rdx
callq 0x1a4e0
movq %rax, %r15
movq %r14, %rdi
movl $0x2, %esi
callq 0x190e0
movq %rax, %r12
movq %r14, %rdi
movl $0x3, %esi
callq 0x190e0
movq (%r13), %rcx
movq 0x50(%rcx), %rdx
movq 0x628(%rdx), %r8
testq %r8, %r8
je 0x4d8f6
movq 0x20(%rcx), %rdi
movq %r15, %rsi
movq %r12, %rdx
movq %rax, %rcx
callq *%r8
movq %r14, %rdi
xorl %esi, %esi
movl %eax, %edx
callq 0x18980
jmp 0x4d909
leaq 0x5306c(%rip), %rsi     # 0xa0969
movq %r14, %rdi
xorl %eax, %eax
callq 0x19ba0
movl %eax, %ebx
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/stetre[P]moonvulkan/src/swapchain.c
// Function: QueuePresent
static int QueuePresent(lua_State *L)
    {
    int err, per_swapchain_results;
    uint32_t i, n;
    VkResult ec;
    ud_t *ud;
    VkPresentInfoKHR  *info;
    VkQueue queue = checkqueue(L, 1, &ud);
    per_swapchain_results = optboolean(L, 3, 0);
    CheckDevicePfn(L, ud, QueuePresentKHR);
#define CLEANUP zfreeVkPresentInfoKHR(L, info, 1)
    info = zcheckVkPresentInfoKHR(L, 2, &err, per_swapchain_results);
    if(err) { CLEANUP; return argerror(L, 2); }
    ec = ud->ddt->QueuePresentKHR(queue, info);
    pushresult(L, ec);
    n = 1;
    if(per_swapchain_results)
        {   
        lua_newtable(L);
        for(i = 0; i < info->swapchainCount; i++)
            {
            pushresult(L, info->pResults[i]);
            lua_rawseti(L, -2, i+1);
            }
        n = 2;
        }
    CLEANUP;
#undef CLEANUP
    return n;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
leaq 0x400b9(%rip), %rcx     # 0x8d9e8
movq %rsp, %r14
movl $0x1, %esi
movq %r14, %rdx
callq 0x1a4e0
movq %rax, %r15
movq %rbx, %rdi
movl $0x3, %esi
xorl %edx, %edx
callq 0x197b0
movl %eax, %ebp
movq (%r14), %rax
movq 0x50(%rax), %rax
cmpq $0x0, 0x270(%rax)
je 0x4d9b6
leaq 0xc(%rsp), %r12
movq %rbx, %rdi
movl $0x2, %esi
movq %r12, %rdx
movl %ebp, %ecx
callq 0x18fd0
movq %rax, %r14
cmpl $0x0, (%r12)
je 0x4d9ce
movq %rbx, %rdi
movq %r14, %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
movq %rax, %rdx
callq 0x18410
jmp 0x4d9c7
leaq 0x52fd3(%rip), %rsi     # 0xa0990
movq %rbx, %rdi
xorl %eax, %eax
callq 0x19ba0
movl %eax, %ebp
jmp 0x4da52
movq (%rsp), %rax
movq 0x50(%rax), %rax
movq %r15, %rdi
movq %r14, %rsi
callq *0x270(%rax)
movq %rbx, %rdi
xorl %esi, %esi
movl %eax, %edx
callq 0x18980
testl %ebp, %ebp
je 0x4da3d
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x187d0
movl $0x2, %ebp
cmpl $0x0, 0x20(%r14)
je 0x4da42
xorl %r15d, %r15d
movq 0x38(%r14), %rax
movl (%rax,%r15,4), %edx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x18980
incq %r15
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
movq %r15, %rdx
callq 0x19130
movl 0x20(%r14), %eax
cmpq %rax, %r15
jb 0x4da0d
jmp 0x4da42
movl $0x1, %ebp
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0x19160
movl %ebp, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/stetre[P]moonvulkan/src/swapchain.c
// Function: GetSwapchainStatus
static int GetSwapchainStatus(lua_State *L)
    {
    VkResult ec;
    ud_t *ud;
    VkSwapchainKHR swapchain = checkswapchain(L, 1, &ud);
    VkDevice device = ud->device;
    CheckDevicePfn(L, ud, GetSwapchainStatusKHR);
    ec = ud->ddt->GetSwapchainStatusKHR(device, swapchain);
    pushresult(L, ec);
    return 1;
    }

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %r14
leaq 0x404f3(%rip), %rcx     # 0x8df67
movl $0x1, %ebx
leaq 0x8(%rsp), %r15
movl $0x1, %esi
movq %r15, %rdx
callq 0x1a4e0
movq (%r15), %rdx
movq 0x50(%rdx), %rcx
movq 0x260(%rcx), %rcx
testq %rcx, %rcx
je 0x4dab5
movq 0x20(%rdx), %rdi
movq %rax, %rsi
callq *%rcx
movq %r14, %rdi
xorl %esi, %esi
movl %eax, %edx
callq 0x18980
jmp 0x4dac8
leaq 0x52ef9(%rip), %rsi     # 0xa09b5
movq %r14, %rdi
xorl %eax, %eax
callq 0x19ba0
movl %eax, %ebx
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/stetre[P]moonvulkan/src/swapchain.c
// Function: SetHdrMetadata
static int SetHdrMetadata(lua_State *L)
    {
    ud_t **ud;
    int err;
    uint32_t count;
    VkHdrMetadataEXT *metadata;
    VkSwapchainKHR *swapchains;
#define CLEANUP do { zfreeVkHdrMetadataEXT(L, metadata, 1); Free(L, swapchains); Free(L, ud); } while(0)
    swapchains = checkswapchainlist(L, 1, &count, &err, &ud);
    if(err) return argerrorc(L, 1, err);
    CheckDevicePfn(L, ud[0], SetHdrMetadataEXT);
    metadata = zcheckVkHdrMetadataEXT(L, 2, &err);
    if(err) { CLEANUP; return argerror(L, 2); }
    ud[0]->ddt->SetHdrMetadataEXT(ud[0]->device, count, swapchains, metadata);
    CLEANUP;
#undef CLEANUP
    return 0;
    }

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
leaq 0x4047e(%rip), %r9      # 0x8df67
leaq 0x10(%rsp), %rdx
leaq 0x14(%rsp), %r15
leaq 0x8(%rsp), %r8
movl $0x1, %esi
movq %r15, %rcx
callq 0x19140
movl (%r15), %edi
testl %edi, %edi
je 0x4db2d
callq 0x19930
movq %rbx, %rdi
movl $0x1, %esi
movq %rax, %rdx
callq 0x18410
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %r14
movq 0x8(%rsp), %rax
movq (%rax), %rax
movq 0x50(%rax), %rax
cmpq $0x0, 0x4c8(%rax)
je 0x4dba9
leaq 0x14(%rsp), %r12
movq %rbx, %rdi
movl $0x2, %esi
movq %r12, %rdx
callq 0x1a530
movq %rax, %r15
cmpl $0x0, (%r12)
je 0x4dbbf
movq %rbx, %rdi
movq %r15, %rsi
movl $0x1, %edx
callq 0x19160
movq %rbx, %rdi
movq %r14, %rsi
callq 0x182d0
movq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x182d0
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
xorl %edx, %edx
callq 0x18680
movq %rbx, %rdi
movl $0x2, %esi
jmp 0x4db19
leaq 0x52e30(%rip), %rsi     # 0xa09e0
movq %rbx, %rdi
xorl %eax, %eax
callq 0x19ba0
jmp 0x4db21
movq 0x8(%rsp), %rax
movq (%rax), %rax
movq 0x20(%rax), %rdi
movq 0x50(%rax), %rax
movl 0x10(%rsp), %esi
movq %r14, %rdx
movq %r15, %rcx
callq *0x4c8(%rax)
movq %rbx, %rdi
movq %r15, %rsi
movl $0x1, %edx
callq 0x19160
movq %rbx, %rdi
movq %r14, %rsi
callq 0x182d0
movq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x182d0
xorl %eax, %eax
jmp 0x4db21
// File: /workspace/github_cpp_makefile_star2_O3/stetre[P]moonvulkan/src/swapchain.c
// Function: GetSwapchainCounter
static int GetSwapchainCounter(lua_State *L)
    {
    ud_t *ud;
    uint64_t val;
    VkSwapchainKHR swapchain = checkswapchain(L, 1, &ud);
    VkSurfaceCounterFlagBitsEXT counter = (VkSurfaceCounterFlagBitsEXT)optflags(L, 2, 0);
    CheckDevicePfn(L, ud, GetSwapchainCounterEXT);
    ud->ddt->GetSwapchainCounterEXT(ud->device, swapchain, counter, &val);
    lua_pushinteger(L, val);
    return 1;
    }

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %r14
leaq 0x40344(%rip), %rcx     # 0x8df67
movl $0x1, %ebx
leaq 0x10(%rsp), %r12
movl $0x1, %esi
movq %r12, %rdx
callq 0x1a4e0
movq %rax, %r15
movq %r14, %rdi
movl $0x2, %esi
xorl %edx, %edx
callq 0x192a0
movq (%r12), %rcx
movq 0x50(%rcx), %rdx
movq 0x2b0(%rdx), %r8
testq %r8, %r8
je 0x4dc82
movq 0x20(%rcx), %rdi
leaq 0x8(%rsp), %r12
movq %r15, %rsi
movl %eax, %edx
movq %r12, %rcx
callq *%r8
movq (%r12), %rsi
movq %r14, %rdi
callq 0x18b50
jmp 0x4dc95
leaq 0x52d7e(%rip), %rsi     # 0xa0a07
movq %r14, %rdi
xorl %eax, %eax
callq 0x19ba0
movl %eax, %ebx
movl %ebx, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/stetre[P]moonvulkan/src/swapchain.c
// Function: newswapchain
static int newswapchain(lua_State *L, VkSwapchainKHR swapchain, VkDevice device, const VkAllocationCallbacks *allocator)
    {
    ud_t *ud, *device_ud;
    device_ud = UD(device);
    TRACE_CREATE(swapchain, "swapchain");
    ud = newuserdata_nondispatchable(L, swapchain, SWAPCHAIN_MT);
    ud->parent_ud = device_ud;
    ud->device = device;
    ud->instance = device_ud->instance;
    ud->allocator = allocator;
    ud->destructor = freeswapchain;
    ud->ddt = device_ud->ddt;
    return 1;
    }

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rcx, %rbx
movq %rdx, %r14
movq %rsi, %r12
movq %rdi, %r13
movq %rdx, %rdi
callq 0x19e90
movq %rax, %r15
movq 0x722fe(%rip), %rax     # 0xbffc8
cmpl $0x0, (%rax)
je 0x4dce0
leaq 0x52bda(%rip), %rdi     # 0xa08b0
movq %r12, %rsi
xorl %eax, %eax
callq 0x18960
leaq 0x40280(%rip), %rdx     # 0x8df67
movq %r13, %rdi
movq %r12, %rsi
xorl %ecx, %ecx
callq 0x18320
movq %r15, 0x10(%rax)
movq %r14, 0x20(%rax)
movq 0x18(%r15), %rcx
movq %rcx, 0x18(%rax)
movq %rbx, 0x40(%rax)
leaq 0x16(%rip), %rcx        # 0x4dd25
movq %rcx, 0x8(%rax)
movq 0x50(%r15), %rcx
movq %rcx, 0x50(%rax)
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/stetre[P]moonvulkan/src/swapchain.c
// Function: freeswapchain
static int freeswapchain(lua_State *L, ud_t *ud)
    {
    VkSwapchainKHR swapchain = (VkSwapchainKHR)ud->handle;
    const VkAllocationCallbacks *allocator = ud->allocator;
    VkDevice device = ud->device;

    freechildren(L, IMAGE_MT, ud);

    if(!freeuserdata(L, ud)) return 0; /* double call */
    TRACE_DELETE(swapchain, "swapchain");
    UD(device)->ddt->DestroySwapchainKHR(device, swapchain, allocator);
    return 0;
    }

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rsi, %r12
movq %rdi, %r13
movq (%rsi), %rbx
movq 0x20(%rsi), %r15
movq 0x40(%rsi), %r14
leaq 0x3ec54(%rip), %rsi     # 0x8c99a
movq %r12, %rdx
callq 0x18ef0
movq %r13, %rdi
movq %r12, %rsi
callq 0x18d20
testl %eax, %eax
je 0x4dd95
movq 0x72264(%rip), %rax     # 0xbffc8
cmpl $0x0, (%rax)
je 0x4dd7a
leaq 0x52b5b(%rip), %rdi     # 0xa08cb
movq %rbx, %rsi
xorl %eax, %eax
callq 0x18960
movq %r15, %rdi
callq 0x19e90
movq 0x50(%rax), %rax
movq %r15, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq *0x250(%rax)
xorl %eax, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
nopl (%rax)
// File: /workspace/github_cpp_makefile_star2_O3/stetre[P]moonvulkan/src/udata.c
// Function: moonvulkan_udata_unref
int udata_unref(lua_State *L, uint64_t id)
/* unreference udata so that it will be garbage collected */
    {
//  printf("unref object %lu\n", id);
    udata_t *udata = udata_search(id);
    if(!udata) 
        return luaL_error(L, "invalid object identifier %I", id);
    if(udata->ref != LUA_NOREF)
        {
        luaL_unref(L, LUA_REGISTRYINDEX, udata->ref);
        udata->ref = LUA_NOREF;
        }
    return 0;
    }

// Assembly:
pushq %rbx
movq %rsi, %rdx
movq 0x72cfc(%rip), %rbx     # 0xc1398
testq %rbx, %rbx
je 0x4e6b2
cmpq %rdx, 0x20(%rbx)
ja 0x4e6ad
jae 0x4e6c1
addq $0x8, %rbx
movq (%rbx), %rbx
jmp 0x4e69c
leaq 0x523d4(%rip), %rsi     # 0xa0a8d
xorl %eax, %eax
popq %rbx
jmp 0x19ba0
movl 0x28(%rbx), %edx
cmpl $-0x2, %edx
je 0x4e6da
movl $0xfff0b9d8, %esi       # imm = 0xFFF0B9D8
callq 0x1a2a0
movl $0xfffffffe, 0x28(%rbx) # imm = 0xFFFFFFFE
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O3/stetre[P]moonvulkan/src/udata.c
// Function: moonvulkan_udata_free
int udata_free(lua_State *L, uint64_t id)
/* this should be called in the __gc metamethod
 */
    {
    udata_t *udata = udata_search(id);
//  printf("free object %lu\n", id);
    if(!udata) 
        return luaL_error(L, "invalid object identifier %I", id);
    /* release all references */
    if(udata->ref != LUA_NOREF)
        luaL_unref(L, LUA_REGISTRYINDEX, udata->ref);
    udata_remove(udata);
    Free(L, udata);
    /* mem is released by Lua at garbage collection */
    return 0;
    }

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rdx
movq %rdi, %rbx
movq 0x72ca9(%rip), %r14     # 0xc1398
testq %r14, %r14
je 0x4e705
cmpq %rdx, 0x20(%r14)
ja 0x4e700
jae 0x4e71d
addq $0x8, %r14
movq (%r14), %r14
jmp 0x4e6ef
leaq 0x52381(%rip), %rsi     # 0xa0a8d
movq %rbx, %rdi
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x19ba0
movl 0x28(%r14), %edx
cmpl $-0x2, %edx
je 0x4e733
movq %rbx, %rdi
movl $0xfff0b9d8, %esi       # imm = 0xFFF0B9D8
callq 0x1a2a0
movq %r14, %rdi
callq 0x4e750
movq %rbx, %rdi
movq %r14, %rsi
callq 0x182d0
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O3/stetre[P]moonvulkan/src/udata.c
// Function: moonvulkan_udata_push
int udata_push(lua_State *L, uint64_t id)
    {
    udata_t *udata = udata_search(id);
//  printf("free object %lu\n", id);
    if(!udata) 
        return luaL_error(L, "invalid object identifier %I", id);
    if(udata->ref == LUA_NOREF)
        return luaL_error(L, "unreferenced object");
    if(lua_rawgeti(L, LUA_REGISTRYINDEX, udata->ref) != LUA_TUSERDATA)
        return luaL_error(L, UNEXPECTED_ERROR);
    return 1; /* one value pushed */
    }

// Assembly:
pushq %rbx
movq %rsi, %rdx
movq %rdi, %rbx
movq 0x72841(%rip), %rax     # 0xc1398
testq %rax, %rax
je 0x4eb6d
cmpq %rdx, 0x20(%rax)
ja 0x4eb68
jae 0x4eb7f
addq $0x8, %rax
movq (%rax), %rax
jmp 0x4eb57
leaq 0x51f19(%rip), %rsi     # 0xa0a8d
movq %rbx, %rdi
xorl %eax, %eax
popq %rbx
jmp 0x19ba0
movslq 0x28(%rax), %rdx
cmpq $-0x2, %rdx
jne 0x4eb9b
leaq 0x51f1a(%rip), %rsi     # 0xa0aaa
movq %rbx, %rdi
xorl %eax, %eax
popq %rbx
jmp 0x19ba0
movq %rbx, %rdi
movl $0xfff0b9d8, %esi       # imm = 0xFFF0B9D8
callq 0x18970
cmpl $0x7, %eax
jne 0x4ebb4
movl $0x1, %eax
popq %rbx
retq
leaq 0x3ea14(%rip), %rsi     # 0x8d5cf
leaq 0x51efc(%rip), %rdx     # 0xa0abe
movq %rbx, %rdi
movl $0xa4, %ecx
xorl %eax, %eax
popq %rbx
jmp 0x19ba0
// File: /workspace/github_cpp_makefile_star2_O3/stetre[P]moonvulkan/src/udata.c
// Function: moonvulkan_udata_free_all
void udata_free_all(lua_State *L)
/* free all without unreferencing (for atexit()) */
    {
    udata_t *udata;
    while((udata = udata_first(0)))
        {
        udata_remove(udata);
        Free(L, udata);
        }
    }

// Assembly:
movq 0x727bf(%rip), %rax     # 0xc1398
testq %rax, %rax
je 0x4ec1d
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq %rax, %r14
cmpq $0x0, 0x20(%rax)
je 0x4ebf7
movq (%r14), %rax
testq %rax, %rax
jne 0x4ebe5
movq %r14, %rdi
callq 0x4e750
movq %rbx, %rdi
movq %r14, %rsi
callq 0x182d0
movq 0x72787(%rip), %rax     # 0xc1398
testq %rax, %rax
jne 0x4ebe5
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O3/stetre[P]moonvulkan/src/udata.c
// Function: moonvulkan_udata_scan
int udata_scan(lua_State *L, const char *mt,  
            void *info, int (*func)(lua_State *L, const void *mem, const char* mt, const void *info))
/* scans the udata database, and calls the func callback for every 'mt' object found
 * (the object may be deleted in the callback).
 * func must return 0 to continue the scan, !=0 to interrupt it.
 * returns 1 if interrupted, 0 otherwise
 */
    {
    int stop = 0;
    uint64_t id = 0;
    udata_t *udata;
    while((udata = udata_first(id)))
        {
        id = udata->id + 1;
        if(mt == udata->mt)
            {
            stop = func(L, (const void*)(udata->mem), mt, info);
            if(stop) return 1;
            }
        }
    return 0;
    }

// Assembly:
movq 0x72773(%rip), %rax     # 0xc1398
testq %rax, %rax
je 0x4eca7
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rcx, %rbx
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r12
xorl %edx, %edx
movq %rax, %rsi
xorl %ecx, %ecx
movq 0x20(%rsi), %r13
cmpq %rdx, %r13
jbe 0x4ec54
movq %rsi, %rcx
jmp 0x4ec5a
jae 0x4ec6d
addq $0x8, %rsi
movq (%rsi), %rsi
testq %rsi, %rsi
jne 0x4ec46
testq %rcx, %rcx
je 0x4ec9b
movq 0x20(%rcx), %r13
jmp 0x4ec70
movq %rsi, %rcx
cmpq %r15, 0x38(%rcx)
jne 0x4ec90
movq 0x30(%rcx), %rsi
movq %r12, %rdi
movq %r15, %rdx
movq %r14, %rcx
callq *%rbx
testl %eax, %eax
jne 0x4ecaa
movq 0x72708(%rip), %rax     # 0xc1398
incq %r13
movq %r13, %rdx
testq %rax, %rax
jne 0x4ec41
xorl %eax, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
xorl %eax, %eax
retq
movl $0x1, %eax
jmp 0x4ec9d
// File: /workspace/github_cpp_makefile_star2_O3/stetre[P]moonvulkan/src/udata.c
// Function: moonvulkan_udata_test
void *udata_test(lua_State *L, int arg, const char *mt)
/* same as luaL_testudata(), but succeeds also if the userdata has not
 * mt as metatable but as ancestor
 */ 
    {
    void *mem;
    int ok;
    if((mem = luaL_testudata(L, arg, mt)))
        return mem;
    
    if((mem = lua_touserdata(L, arg)) == NULL)
        return NULL;

    if(luaL_getmetatable(L, mt)!=LUA_TTABLE)
        { luaL_error(L, "cannot find metatable '%s'", mt); return NULL; }
    ok = is_subclass(L, arg, lua_gettop(L));
    lua_pop(L, 1);
    return ok ? mem : NULL;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %r15
movl %esi, %ebp
movq %rdi, %r14
callq 0x19480
movq %rax, %rbx
testq %rax, %rax
je 0x4ecdb
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %r14, %rdi
movl %ebp, %esi
callq 0x183b0
testq %rax, %rax
je 0x4ed2f
movq %rax, %rbx
movq %r14, %rdi
movl $0xfff0b9d8, %esi       # imm = 0xFFF0B9D8
movq %r15, %rdx
callq 0x1a440
cmpl $0x5, %eax
jne 0x4ed33
movq %r14, %rdi
callq 0x180a0
movq %r14, %rdi
movl %ebp, %esi
movl %eax, %edx
callq 0x4ed4b
movl %eax, %ebp
movq %r14, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x18150
xorl %eax, %eax
testl %ebp, %ebp
cmoveq %rax, %rbx
jmp 0x4eccd
xorl %ebx, %ebx
jmp 0x4eccd
leaq 0x51d8c(%rip), %rsi     # 0xa0ac6
xorl %ebx, %ebx
movq %r14, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x19ba0
jmp 0x4eccd
// File: /workspace/github_cpp_makefile_star2_O3/stetre[P]moonvulkan/src/udata.c
// Function: is_subclass
static int is_subclass(lua_State *L, int arg, int mt_index)
    {
    int ok;
    if(luaL_getmetafield(L, arg, "__index") == LUA_TNIL)
        return 0;
    if(lua_rawequal(L, mt_index, lua_gettop(L)))
        {
        lua_pop(L, 1);
        return 1;
        }
    ok = is_subclass(L, lua_gettop(L), mt_index);
    lua_pop(L, 1);
    return ok;
    }

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %edx, %ebp
movq %rdi, %rbx
leaq 0x51da3(%rip), %rdx     # 0xa0afe
callq 0x19a20
testl %eax, %eax
je 0x4eda8
movq %rbx, %rdi
callq 0x180a0
movq %rbx, %rdi
movl %ebp, %esi
movl %eax, %edx
callq 0x19900
movl $0x1, %r14d
testl %eax, %eax
jne 0x4ed99
movq %rbx, %rdi
callq 0x180a0
movq %rbx, %rdi
movl %eax, %esi
movl %ebp, %edx
callq 0x4ed4b
movl %eax, %r14d
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x18150
jmp 0x4edab
xorl %r14d, %r14d
movl %r14d, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/stetre[P]moonvulkan/src/udata.c
// Function: moonvulkan_udata_define
int udata_define(lua_State *L, const char* mt, const luaL_Reg* methods, const luaL_Reg* metamethods)
    {
    /* create the metatable */
    if(!luaL_newmetatable(L, mt))
        return luaL_error(L, "cannot create metatable '%s'", mt);
    lua_pushvalue(L, -1);
    lua_setfield(L, -2, "__index");
    if(metamethods)
        /* add metamethods */
        luaL_setfuncs(L, metamethods, 0);
    if(methods)
        {
        /* add methods */
        luaL_getsubtable(L, -1, "__index");
        luaL_setfuncs(L, methods, 0);
        lua_pop(L, 1);
        }
    lua_pop(L, 1);
    return 0;
    }

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %r15
movq %rdx, %r14
movq %rsi, %r12
movq %rdi, %rbx
callq 0x1a1f0
testl %eax, %eax
je 0x4ee55
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x18e90
leaq 0x51d16(%rip), %rdx     # 0xa0afe
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x18af0
testq %r15, %r15
je 0x4ee07
movq %rbx, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x183d0
testq %r14, %r14
je 0x4ee3a
leaq 0x51ceb(%rip), %rdx     # 0xa0afe
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x18c60
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x183d0
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x18150
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x18150
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0x51c85(%rip), %rsi     # 0xa0ae1
movq %rbx, %rdi
movq %r12, %rdx
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x19ba0
// File: /workspace/github_cpp_makefile_star2_O3/stetre[P]moonvulkan/src/udata.c
// Function: moonvulkan_udata_inherit
int udata_inherit(lua_State *L, const char *sub, const char *super)
/* Sets  metatable(sub).__index = metatable(super)
 *
 * This way, if one accesses a field/method of a 'sub' object which is not defined in
 * the 'sub' metatable, Lua searches for it in the 'super' metatable (i.e., the 'sub'
 * type inherits from 'super').
 */
    {
    if(luaL_getmetatable(L, sub)!=LUA_TTABLE)
        return luaL_error(L, "cannot find metatable '%s'", sub);
    luaL_getsubtable(L, -1, "__index");
    if(luaL_getmetatable(L, super)!=LUA_TTABLE)
        return luaL_error(L, "cannot find metatable '%s'", super);
    lua_setmetatable(L, -2);
    lua_pop(L, 2);
    return 0;
    }

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
movl $0xfff0b9d8, %esi       # imm = 0xFFF0B9D8
movq %r15, %rdx
callq 0x1a440
cmpl $0x5, %eax
jne 0x4eedf
leaq 0x51c63(%rip), %rdx     # 0xa0afe
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x18c60
movq %rbx, %rdi
movl $0xfff0b9d8, %esi       # imm = 0xFFF0B9D8
movq %r14, %rdx
callq 0x1a440
cmpl $0x5, %eax
jne 0x4eeee
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x19100
movq %rbx, %rdi
movl $0xfffffffd, %esi       # imm = 0xFFFFFFFD
callq 0x18150
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
leaq 0x51be0(%rip), %rsi     # 0xa0ac6
movq %rbx, %rdi
movq %r15, %rdx
jmp 0x4eefb
leaq 0x51bd1(%rip), %rsi     # 0xa0ac6
movq %rbx, %rdi
movq %r14, %rdx
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
jmp 0x19ba0
// File: /workspace/github_cpp_makefile_star2_O3/stetre[P]moonvulkan/src/udata.c
// Function: moonvulkan_udata_addmethods
int udata_addmethods(lua_State *L, const char* mt, const luaL_Reg* methods)
/* Adds methods to the metatable mt */
    {
    if(luaL_getmetatable(L, mt)!=LUA_TTABLE)
        return luaL_error(L, "cannot find metatable '%s'", mt);
    if(methods)
        {
        /* add methods */
        luaL_getsubtable(L, -1, "__index");
        luaL_setfuncs(L, methods, 0);
        lua_pop(L, 1);
        }
    lua_pop(L, 1);
    return 0;
    }

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
movl $0xfff0b9d8, %esi       # imm = 0xFFF0B9D8
movq %r15, %rdx
callq 0x1a440
cmpl $0x5, %eax
jne 0x4ef6f
testq %r14, %r14
je 0x4ef5a
leaq 0x51bcb(%rip), %rdx     # 0xa0afe
movq %rbx, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x18c60
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x183d0
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x18150
movq %rbx, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x18150
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
leaq 0x51b50(%rip), %rsi     # 0xa0ac6
movq %rbx, %rdi
movq %r15, %rdx
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
jmp 0x19ba0
// File: /workspace/github_cpp_makefile_star2_O3/stetre[P]moonvulkan/src/utils.c
// Function: moonvulkan_now
double now(void)
    {
#if _POSIX_C_SOURCE >= 199309L
    struct timespec ts;
    if(clock_gettime(CLOCK_MONOTONIC,&ts)!=0)
        { printf("clock_gettime error\n"); return -1; }
    return ts.tv_sec + ts.tv_nsec*1.0e-9;
#else
    struct timeval tv;
    if(gettimeofday(&tv, NULL) != 0)
        { printf("gettimeofday error\n"); return -1; }
    return tv.tv_sec + tv.tv_usec*1.0e-6;
#endif
    }

// Assembly:
subq $0x18, %rsp
leaq 0x8(%rsp), %rsi
movl $0x1, %edi
callq 0x185b0
testl %eax, %eax
je 0x4efc6
leaq 0x51c6c(%rip), %rdi     # 0xa0c23
callq 0x183a0
movsd 0x51b44(%rip), %xmm0    # 0xa0b08
jmp 0x4efe0
cvtsi2sdq 0x8(%rsp), %xmm1
cvtsi2sdq 0x10(%rsp), %xmm0
mulsd 0x51b34(%rip), %xmm0    # 0xa0b10
addsd %xmm1, %xmm0
addq $0x18, %rsp
retq
// File: /workspace/github_cpp_makefile_star2_O3/stetre[P]moonvulkan/src/utils.c
// Function: moonvulkan_checkstringlist
char** checkstringlist(lua_State *L, int arg, uint32_t *count, int *err)
    {
    int t;
    char** list;
    const char* s;
    uint32_t i;
    *count = 0;
    *err = 0;
    if(lua_isnoneornil(L, arg))
        { *err = ERR_NOTPRESENT; return NULL; }
    if(lua_type(L, arg) != LUA_TTABLE)
        { *err = ERR_TABLE; return NULL; }
    *count = luaL_len(L, arg);
    if(*count == 0)
        { *err = ERR_EMPTY; return NULL; }
    list = (char**)MallocNoErr(L, sizeof(char*) * (*count + 1));
    if(!list)
        { *err = ERR_MEMORY; return NULL; }
    for(i=0; i<*count; i++)
        {
        t = lua_rawgeti(L, arg, i+1);
        if(t != LUA_TSTRING)
            {
            lua_pop(L, 1);
            freestringlist(L, list, *count);
            *count = 0;
            *err = ERR_TYPE;
            return NULL;
            }
        s = lua_tostring(L, -1);
        list[i] = Strdup(L, s);
        lua_pop(L, 1);
        }
    /* list[*count]=NULL; */
    return list;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %rbx
movq %rdx, %r14
movl %esi, %ebp
movq %rdi, %r15
xorl %eax, %eax
movl %eax, (%rdx)
movl %eax, (%rcx)
callq 0x1a0f0
testl %eax, %eax
jle 0x4f303
movq %r15, %rdi
movl %ebp, %esi
callq 0x1a0f0
movl $0xfffffffc, %r13d      # imm = 0xFFFFFFFC
cmpl $0x5, %eax
jne 0x4f311
movq %r15, %rdi
movl %ebp, %esi
callq 0x1a120
movl %eax, (%r14)
testl %eax, %eax
je 0x4f30b
movq 0x72143(%rip), %r8      # 0xc13a0
movl $0xfffffffa, %r13d      # imm = 0xFFFFFFFA
testq %r8, %r8
je 0x4f311
leaq 0x8(,%rax,8), %rax
movabsq $0x7fffffff8, %rcx      # imm = 0x7FFFFFFF8
andq %rax, %rcx
movq 0x72120(%rip), %rdi     # 0xc13a8
xorl %esi, %esi
xorl %edx, %edx
movq %rcx, (%rsp)
callq *%r8
testq %rax, %rax
je 0x4f311
movq %rax, %r12
movq %rax, %rdi
xorl %esi, %esi
movq (%rsp), %rdx
callq 0x18b40
cmpl $0x0, (%r14)
je 0x4f317
movq %rbx, (%rsp)
xorl %ebx, %ebx
leaq 0x1(%rbx), %r13
movq %r15, %rdi
movl %ebp, %esi
movq %r13, %rdx
callq 0x18970
cmpl $0x4, %eax
jne 0x4f329
movq %r15, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
xorl %edx, %edx
callq 0x18680
movq %r15, %rdi
movq %rax, %rsi
callq 0x19070
movq %rax, (%r12,%rbx,8)
movq %r15, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x18150
movl (%r14), %eax
movq %r13, %rbx
cmpq %rax, %r13
jb 0x4f2b5
jmp 0x4f317
movl $0x1, %r13d
jmp 0x4f311
movl $0xfffffffb, %r13d      # imm = 0xFFFFFFFB
movl %r13d, (%rbx)
xorl %r12d, %r12d
movq %r12, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0xfffffffe, %r13d      # imm = 0xFFFFFFFE
movq %r15, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x18150
movl (%r14), %edx
movq %r12, %rsi
callq 0x198e0
movl $0x0, (%r14)
movq (%rsp), %rbx
jmp 0x4f311