// File: /workspace/github_cpp_makefile_star2_O3/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 0x2512b
movq (%rax), %r13
movq 0x20(%rax), %rbp
jmp 0x25130
xorl %ebp, %ebp
xorl %r13d, %r13d
movq (%r15), %rbx
movq 0x40(%r15), %r14
leaq 0x68de9(%rip), %rsi     # 0x8df27
movq %r12, %rdi
movq %r15, %rdx
callq 0x18ef0
leaq 0x68dfb(%rip), %rsi     # 0x8df4b
movq %r12, %rdi
movq %r15, %rdx
callq 0x18ef0
leaq 0x67973(%rip), %rsi     # 0x8cad5
movq %r12, %rdi
movq %r15, %rdx
callq 0x18ef0
leaq 0x68df3(%rip), %rsi     # 0x8df67
movq %r12, %rdi
movq %r15, %rdx
callq 0x18ef0
leaq 0x68172(%rip), %rsi     # 0x8d2f8
movq %r12, %rdi
movq %r15, %rdx
callq 0x18ef0
leaq 0x68de4(%rip), %rsi     # 0x8df7c
movq %r12, %rdi
movq %r15, %rdx
callq 0x18ef0
leaq 0x67779(%rip), %rsi     # 0x8c923
movq %r12, %rdi
movq %r15, %rdx
callq 0x18ef0
leaq 0x68482(%rip), %rsi     # 0x8d63e
movq %r12, %rdi
movq %r15, %rdx
callq 0x18ef0
leaq 0x68dc8(%rip), %rsi     # 0x8df96
movq %r12, %rdi
movq %r15, %rdx
callq 0x18ef0
leaq 0x68dcb(%rip), %rsi     # 0x8dfab
movq %r12, %rdi
movq %r15, %rdx
callq 0x18ef0
leaq 0x68dca(%rip), %rsi     # 0x8dfbc
movq %r12, %rdi
movq %r15, %rdx
callq 0x18ef0
leaq 0x66dfc(%rip), %rsi     # 0x8c000
movq %r12, %rdi
movq %r15, %rdx
callq 0x18ef0
leaq 0x67784(%rip), %rsi     # 0x8c99a
movq %r12, %rdi
movq %r15, %rdx
callq 0x18ef0
leaq 0x67783(%rip), %rsi     # 0x8c9ab
movq %r12, %rdi
movq %r15, %rdx
callq 0x18ef0
leaq 0x68d9b(%rip), %rsi     # 0x8dfd5
movq %r12, %rdi
movq %r15, %rdx
callq 0x18ef0
leaq 0x68da2(%rip), %rsi     # 0x8dfee
movq %r12, %rdi
movq %r15, %rdx
callq 0x18ef0
leaq 0x68da7(%rip), %rsi     # 0x8e005
movq %r12, %rdi
movq %r15, %rdx
callq 0x18ef0
leaq 0x676c7(%rip), %rsi     # 0x8c937
movq %r12, %rdi
movq %r15, %rdx
callq 0x18ef0
leaq 0x68982(%rip), %rsi     # 0x8dc04
movq %r12, %rdi
movq %r15, %rdx
callq 0x18ef0
leaq 0x68889(%rip), %rsi     # 0x8db1d
movq %r12, %rdi
movq %r15, %rdx
callq 0x18ef0
leaq 0x67769(%rip), %rsi     # 0x8ca0f
movq %r12, %rdi
movq %r15, %rdx
callq 0x18ef0
leaq 0x68730(%rip), %rsi     # 0x8d9e8
movq %r12, %rdi
movq %r15, %rdx
callq 0x18ef0
movq 0x50(%r15), %rsi
testq %rsi, %rsi
je 0x252d4
movq %r12, %rdi
callq 0x182d0
movq %r12, %rdi
movq %r15, %rsi
callq 0x18d20
testl %eax, %eax
je 0x25318
movq 0x9acde(%rip), %rax     # 0xbffc8
cmpl $0x0, (%rax)
je 0x25300
leaq 0x68d26(%rip), %rdi     # 0x8e01c
movq %rbx, %rsi
xorl %eax, %eax
callq 0x18960
testq %rbp, %rbp
je 0x2530a
movq %rbx, %rdi
callq *%rbp
testq %r13, %r13
je 0x25318
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
nopl (%rax)