// File: /workspace/github_cpp_makefile_star2_O2/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 0x58d7e(%rip), %rcx     # 0x7d03b
pushq $0x1
popq %rsi
leaq 0x20(%rsp), %rdx
callq 0x1a500
movq %rax, %r14
pushq $0x2
popq %rsi
movq %rbx, %rdi
callq 0x1a110
cmpl $0x5, %eax
jne 0x2432c
pushq $0x2
popq %rsi
leaq 0xc(%rsp), %r12
movq %rbx, %rdi
movq %r12, %rdx
callq 0x18240
movq %rax, %r15
cmpl $0x0, (%r12)
je 0x243aa
pushq $0x1
popq %rdx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x19150
pushq $-0x1
popq %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x18680
pushq $0x2
popq %rsi
movq %rbx, %rdi
movq %rax, %rdx
callq 0x18420
jmp 0x24420
movq %r14, 0x18(%rsp)
pushq $0x2
popq %rsi
movq %rbx, %rdi
callq 0x190d0
movq %rax, %r12
pushq $0x3
popq %rsi
movq %rbx, %rdi
callq 0x190d0
movq %rax, %r13
pushq $0x4
popq %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x19290
movq %rax, %rbp
pushq $0x20
popq %rdx
leaq 0xc(%rsp), %r14
movq %rbx, %rdi
movl $0x3b9d006b, %esi       # imm = 0x3B9D006B
movq %r14, %rcx
callq 0x19dc0
movq %rax, %r15
cmpl $0x0, (%r14)
je 0x24399
pushq $0x1
popq %rdx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x19150
movq %rbx, %rdi
callq 0x199c0
jmp 0x24420
movl %r12d, 0x14(%r15)
movl %r13d, 0x18(%r15)
movl %ebp, 0x10(%r15)
movq 0x18(%rsp), %r14
movq 0x20(%rsp), %rax
movq 0x50(%rax), %rax
movq 0x450(%rax), %rcx
testq %rcx, %rcx
je 0x243d5
cmpl $0x0, 0x10(%r15)
je 0x243d5
leaq 0x10(%rsp), %rdx
movq %r14, %rdi
movq %r15, %rsi
callq *%rcx
jmp 0x243e8
movl 0x14(%r15), %esi
movl 0x18(%r15), %edx
leaq 0x10(%rsp), %rcx
movq %r14, %rdi
callq *0x8(%rax)
pushq $0x1
popq %rbp
movq %rbx, %rdi
movq %r15, %rsi
movl %ebp, %edx
callq 0x19150
movq 0x10(%rsp), %rsi
testq %rsi, %rsi
je 0x2440f
movq %rbx, %rdi
movq %r14, %rdx
callq 0x189d0
jmp 0x24422
leaq 0x5ac1e(%rip), %rsi     # 0x7f034
movq %rbx, %rdi
xorl %eax, %eax
callq 0x19bc0
movl %eax, %ebp
movl %ebp, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq