// File: /workspace/github_cpp_makefile_star2_O1/stetre[P]moonvulkan/src/device.c
// Function: GetDeviceQueue
static int GetDeviceQueue(lua_State *L)
    {
    int err;
    VkQueue queue;
    ud_t *ud;
    VkDeviceQueueInfo2* info;
    VkDevice device = checkdevice(L, 1, &ud);
#define CLEANUP zfreeVkDeviceQueueInfo2(L, info, 1)
    if(lua_istable(L, 2))
        {
        info = zcheckVkDeviceQueueInfo2(L, 2, &err);
        if(err) { CLEANUP; return argerror(L, 2); }
        }
    else
        {
        uint32_t queueFamilyIndex = luaL_checkinteger(L, 2);
        uint32_t queueIndex = luaL_checkinteger(L, 3);
        VkFlags flags = optflags(L, 4, 0);
        info = znewVkDeviceQueueInfo2(L, &err);
        if(err) { CLEANUP; return lua_error(L); }
        info->queueFamilyIndex = queueFamilyIndex;
        info->queueIndex = queueIndex;
        info->flags = flags;
        }
    if(ud->ddt->GetDeviceQueue2 && info->flags != 0)
        ud->ddt->GetDeviceQueue2(device, info, &queue);
    else
        ud->ddt->GetDeviceQueue(device, info->queueFamilyIndex, info->queueIndex, &queue);
    CLEANUP;
#undef CLEANUP
    if(!queue) return luaL_error(L, "cannot retrieve queue");
    pushqueue(L, queue, device);
    return 1;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
leaq 0x6a40b(%rip), %rcx     # 0x8f03b
leaq 0x20(%rsp), %rdx
movl $0x1, %esi
callq 0x1a520
movq %rax, %r14
movq %rbx, %rdi
movl $0x2, %esi
callq 0x1a130
cmpl $0x5, %eax
jne 0x24cab
leaq 0xc(%rsp), %r12
movq %rbx, %rdi
movl $0x2, %esi
movq %r12, %rdx
callq 0x18240
movq %rax, %r15
cmpl $0x0, (%r12)
je 0x24d3c
movq %rbx, %rdi
movq %r15, %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 0x24db7
movq %r14, %r12
movq %rbx, %rdi
movl $0x2, %esi
callq 0x190f0
movq %rax, 0x18(%rsp)
movq %rbx, %rdi
movl $0x3, %esi
callq 0x190f0
movq %rax, %r13
movq %rbx, %rdi
movl $0x4, %esi
xorl %edx, %edx
callq 0x192b0
movq %rax, %rbp
leaq 0xc(%rsp), %r14
movl $0x20, %edx
movq %rbx, %rdi
movl $0x3b9d006b, %esi       # imm = 0x3B9D006B
movq %r14, %rcx
callq 0x19de0
movq %rax, %r15
movl (%r14), %r14d
testl %r14d, %r14d
je 0x24d23
movq %rbx, %rdi
movq %r15, %rsi
movl $0x1, %edx
callq 0x19170
movq %rbx, %rdi
callq 0x199e0
movl %eax, %ebp
jmp 0x24d34
movq 0x18(%rsp), %rax
movl %eax, 0x14(%r15)
movl %r13d, 0x18(%r15)
movl %ebp, 0x10(%r15)
testl %r14d, %r14d
movq %r12, %r14
jne 0x24db9
movq 0x20(%rsp), %rax
movq 0x50(%rax), %rax
movq 0x450(%rax), %rcx
testq %rcx, %rcx
je 0x24d67
cmpl $0x0, 0x10(%r15)
je 0x24d67
leaq 0x10(%rsp), %rdx
movq %r14, %rdi
movq %r15, %rsi
callq *%rcx
jmp 0x24d7a
movl 0x14(%r15), %esi
movl 0x18(%r15), %edx
leaq 0x10(%rsp), %rcx
movq %r14, %rdi
callq *0x8(%rax)
movl $0x1, %ebp
movq %rbx, %rdi
movq %r15, %rsi
movl $0x1, %edx
callq 0x19170
movq 0x10(%rsp), %rsi
testq %rsi, %rsi
je 0x24da6
movq %rbx, %rdi
movq %r14, %rdx
callq 0x189e0
jmp 0x24db9
leaq 0x6c287(%rip), %rsi     # 0x91034
movq %rbx, %rdi
xorl %eax, %eax
callq 0x19be0
movl %eax, %ebp
movl %ebp, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq