// File: /workspace/github_cpp_makefile_star2_O1/stetre[P]moonvulkan/src/device.c
// Function: freedevice
static int freedevice(lua_State *L, ud_t *ud)
    {
    VkDevice device = (VkDevice)(uintptr_t)ud->handle;
    const VkAllocationCallbacks *allocator = ud->allocator;
    PFN_vkDeviceWaitIdle DeviceWaitIdle = NULL;
    PFN_vkDestroyDevice DestroyDevice = NULL;
    if(ud->ddt)
        {
        DeviceWaitIdle = ud->ddt->DeviceWaitIdle;
        DestroyDevice = ud->ddt->DestroyDevice;
        }
    freechildren(L, SAMPLER_YCBCR_CONVERSION_MT, ud);
    freechildren(L, VALIDATION_CACHE_MT, ud);
    freechildren(L, DESCRIPTOR_UPDATE_TEMPLATE_MT, ud);
    freechildren(L, SWAPCHAIN_MT, ud);
    freechildren(L, COMMAND_POOL_MT, ud);
    freechildren(L, PIPELINE_CACHE_MT, ud);
    freechildren(L, PIPELINE_MT, ud);
    freechildren(L, SAMPLER_MT, ud);
    freechildren(L, SEMAPHORE_MT, ud);
    freechildren(L, FENCE_MT, ud);
    freechildren(L, DEVICE_MEMORY_MT, ud);
    freechildren(L, BUFFER_MT, ud);
    freechildren(L, IMAGE_MT, ud);
    freechildren(L, EVENT_MT, ud);
    freechildren(L, SHADER_MODULE_MT, ud);
    freechildren(L, FRAMEBUFFER_MT, ud);
    freechildren(L, RENDER_PASS_MT, ud);
    freechildren(L, PIPELINE_LAYOUT_MT, ud);
    freechildren(L, DESCRIPTOR_SET_LAYOUT_MT, ud);
    freechildren(L, DESCRIPTOR_POOL_MT, ud);
    freechildren(L, QUERY_POOL_MT, ud);
    freechildren(L, QUEUE_MT, ud);
    if(ud->ddt) Free(L, ud->ddt);
    if(!freeuserdata(L, ud))
        return 0; /* double call */
    TRACE_DELETE(device, "device");
    if(DeviceWaitIdle) DeviceWaitIdle(device);
    if(DestroyDevice) DestroyDevice(device, allocator);
    return 0;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r15
movq %rdi, %r12
movq 0x50(%rsi), %rax
testq %rax, %rax
je 0x251f0
movq (%rax), %r13
movq 0x20(%rax), %rbp
jmp 0x251f5
xorl %ebp, %ebp
xorl %r13d, %r13d
movq (%r15), %rbx
movq 0x40(%r15), %r14
leaq 0x6bd24(%rip), %rsi     # 0x90f27
movq %r12, %rdi
movq %r15, %rdx
callq 0x18f00
leaq 0x6bd36(%rip), %rsi     # 0x90f4b
movq %r12, %rdi
movq %r15, %rdx
callq 0x18f00
leaq 0x6a8ae(%rip), %rsi     # 0x8fad5
movq %r12, %rdi
movq %r15, %rdx
callq 0x18f00
leaq 0x6bd2e(%rip), %rsi     # 0x90f67
movq %r12, %rdi
movq %r15, %rdx
callq 0x18f00
leaq 0x6b0ad(%rip), %rsi     # 0x902f8
movq %r12, %rdi
movq %r15, %rdx
callq 0x18f00
leaq 0x6bd1f(%rip), %rsi     # 0x90f7c
movq %r12, %rdi
movq %r15, %rdx
callq 0x18f00
leaq 0x6a6b4(%rip), %rsi     # 0x8f923
movq %r12, %rdi
movq %r15, %rdx
callq 0x18f00
leaq 0x6b3bd(%rip), %rsi     # 0x9063e
movq %r12, %rdi
movq %r15, %rdx
callq 0x18f00
leaq 0x6bd03(%rip), %rsi     # 0x90f96
movq %r12, %rdi
movq %r15, %rdx
callq 0x18f00
leaq 0x6bd06(%rip), %rsi     # 0x90fab
movq %r12, %rdi
movq %r15, %rdx
callq 0x18f00
leaq 0x6bd05(%rip), %rsi     # 0x90fbc
movq %r12, %rdi
movq %r15, %rdx
callq 0x18f00
leaq 0x69d37(%rip), %rsi     # 0x8f000
movq %r12, %rdi
movq %r15, %rdx
callq 0x18f00
leaq 0x6a6bf(%rip), %rsi     # 0x8f99a
movq %r12, %rdi
movq %r15, %rdx
callq 0x18f00
leaq 0x6a6be(%rip), %rsi     # 0x8f9ab
movq %r12, %rdi
movq %r15, %rdx
callq 0x18f00
leaq 0x6bcd6(%rip), %rsi     # 0x90fd5
movq %r12, %rdi
movq %r15, %rdx
callq 0x18f00
leaq 0x6bcdd(%rip), %rsi     # 0x90fee
movq %r12, %rdi
movq %r15, %rdx
callq 0x18f00
leaq 0x6bce2(%rip), %rsi     # 0x91005
movq %r12, %rdi
movq %r15, %rdx
callq 0x18f00
leaq 0x6a602(%rip), %rsi     # 0x8f937
movq %r12, %rdi
movq %r15, %rdx
callq 0x18f00
leaq 0x6b8bd(%rip), %rsi     # 0x90c04
movq %r12, %rdi
movq %r15, %rdx
callq 0x18f00
leaq 0x6b7c4(%rip), %rsi     # 0x90b1d
movq %r12, %rdi
movq %r15, %rdx
callq 0x18f00
leaq 0x6a6a4(%rip), %rsi     # 0x8fa0f
movq %r12, %rdi
movq %r15, %rdx
callq 0x18f00
leaq 0x6b66b(%rip), %rsi     # 0x909e8
movq %r12, %rdi
movq %r15, %rdx
callq 0x18f00
movq 0x50(%r15), %rsi
testq %rsi, %rsi
je 0x25399
movq %r12, %rdi
callq 0x182e0
movq %r12, %rdi
movq %r15, %rsi
callq 0x18d30
testl %eax, %eax
je 0x253dd
movq 0x9dc19(%rip), %rax     # 0xc2fc8
cmpl $0x0, (%rax)
je 0x253c5
leaq 0x6bc61(%rip), %rdi     # 0x9101c
movq %rbx, %rsi
xorl %eax, %eax
callq 0x18970
testq %rbp, %rbp
je 0x253cf
movq %rbx, %rdi
callq *%rbp
testq %r13, %r13
je 0x253dd
movq %rbx, %rdi
movq %r14, %rsi
callq *%r13
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop