// File: /workspace/github_cpp_makefile_star2_O1/stetre[P]moonvulkan/src/cmd.c
// Function: CmdBindVertexBuffers
static int CmdBindVertexBuffers(lua_State *L)
    {
    int err;
    uint32_t count, count1;
    VkBuffer *buffers = NULL;
    VkDeviceSize *offsets = NULL;
    VkDeviceSize *sizes = NULL;
    VkDeviceSize *strides = NULL;
    ud_t *ud;
    VkCommandBuffer cb = checkcommand_buffer(L, 1, &ud);
    uint32_t first = luaL_checkinteger(L, 2);
#define CLEANUP do {                    \
        if(buffers) Free(L, buffers);   \
        if(offsets) Free(L, offsets);   \
        if(sizes) Free(L, sizes);       \
        if(strides) Free(L, strides);   \
} while(0)

    buffers = checkbufferlist(L, 3, &count, &err);
    if(err) { CLEANUP; return argerrorc(L, 3, err); }
    
    offsets = checkdevicesizelist(L, 4, &count1, &err);
    if(err) { CLEANUP; return argerrorc(L, 4, err); }
    if(count1 != count) { CLEANUP; return argerrorc(L, 4, ERR_LENGTH); }

    if(lua_isnoneornil(L, 5) && lua_isnoneornil(L, 6))
        ud->ddt->CmdBindVertexBuffers(cb, first, count, buffers, offsets);
    else
        {
        if(!TestDevicePfn(L, ud, CmdBindVertexBuffers2EXT))
            {
            CLEANUP;
            CheckDevicePfn(L, ud, CmdBindVertexBuffers2EXT); // to raise an error
            return 0;
            }
        else
            {
            sizes = checkdevicesizelist(L, 5, &count1, &err);
            if(err < 0) { CLEANUP; return argerrorc(L, 5, err); }
            if((count1 != 0) && (count1 != count)) { CLEANUP; return argerrorc(L, 5, ERR_LENGTH); }
            strides = checkdevicesizelist(L, 6, &count1, &err);
            if(err < 0) { CLEANUP; return argerrorc(L, 6, err); }
            if((count1 != 0) && (count1 != count)) { CLEANUP; return argerrorc(L, 6, ERR_LENGTH); }
            ud->ddt->CmdBindVertexBuffers2EXT(cb, first, count, buffers, offsets, sizes, strides);
            }
        }
    CLEANUP;
#undef CLEANUP
    return 0;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdi, %rbx
leaq 0x74331(%rip), %rcx     # 0x8f909
leaq 0x28(%rsp), %rdx
movl $0x1, %esi
callq 0x1a520
movq %rax, %rbp
movq %rbx, %rdi
movl $0x2, %esi
callq 0x190f0
movq %rax, %r13
leaq 0x739ff(%rip), %r8      # 0x8f000
leaq 0x1c(%rsp), %rdx
leaq 0x14(%rsp), %r14
movq %rbx, %rdi
movl $0x3, %esi
movq %r14, %rcx
callq 0x199f0
movq %rax, %r15
cmpl $0x0, (%r14)
je 0x1b64a
testq %r15, %r15
je 0x1b634
movq %rbx, %rdi
movq %r15, %rsi
callq 0x182e0
movl 0x14(%rsp), %edi
callq 0x19970
movq %rbx, %rdi
movl $0x3, %esi
jmp 0x1b793
leaq 0x18(%rsp), %rdx
leaq 0x14(%rsp), %r12
movq %rbx, %rdi
movl $0x4, %esi
movq %r12, %rcx
callq 0x19eb0
movq %rax, %r14
cmpl $0x0, (%r12)
je 0x1b697
testq %r15, %r15
je 0x1b67e
movq %rbx, %rdi
movq %r15, %rsi
callq 0x182e0
testq %r14, %r14
je 0x1b68e
movq %rbx, %rdi
movq %r14, %rsi
callq 0x182e0
movl 0x14(%rsp), %edi
jmp 0x1b786
movl 0x18(%rsp), %eax
cmpl 0x1c(%rsp), %eax
jne 0x1b761
movq %rbx, %rdi
movl $0x5, %esi
callq 0x1a130
testl %eax, %eax
jg 0x1b6cb
movq %rbx, %rdi
movl $0x6, %esi
callq 0x1a130
testl %eax, %eax
jle 0x1b8b6
movq 0x28(%rsp), %rax
movq 0x50(%rax), %rax
cmpq $0x0, 0x7b8(%rax)
je 0x1b7ae
leaq 0x18(%rsp), %rdx
leaq 0x14(%rsp), %r12
movq %rbx, %rdi
movl $0x5, %esi
movq %r12, %rcx
callq 0x19eb0
movq %rax, 0x20(%rsp)
cmpl $0x0, (%r12)
js 0x1b7f6
movl 0x18(%rsp), %eax
testl %eax, %eax
je 0x1b841
cmpl 0x1c(%rsp), %eax
je 0x1b841
testq %r15, %r15
je 0x1b732
movq %rbx, %rdi
movq %r15, %rsi
callq 0x182e0
testq %r14, %r14
movq 0x20(%rsp), %r15
je 0x1b747
movq %rbx, %rdi
movq %r14, %rsi
callq 0x182e0
testq %r15, %r15
je 0x1b757
movq %rbx, %rdi
movq %r15, %rsi
callq 0x182e0
movl $0xfffffff9, %edi       # imm = 0xFFFFFFF9
jmp 0x1b82f
testq %r15, %r15
je 0x1b771
movq %rbx, %rdi
movq %r15, %rsi
callq 0x182e0
testq %r14, %r14
je 0x1b781
movq %rbx, %rdi
movq %r14, %rsi
callq 0x182e0
movl $0xfffffff9, %edi       # imm = 0xFFFFFFF9
callq 0x19970
movq %rbx, %rdi
movl $0x4, %esi
movq %rax, %rdx
callq 0x18420
movl %eax, %ebp
movl %ebp, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
testq %r15, %r15
je 0x1b7be
movq %rbx, %rdi
movq %r15, %rsi
callq 0x182e0
testq %r14, %r14
je 0x1b7ce
movq %rbx, %rdi
movq %r14, %rsi
callq 0x182e0
movq 0x28(%rsp), %rax
movq 0x50(%rax), %rax
xorl %ebp, %ebp
cmpq $0x0, 0x7b8(%rax)
jne 0x1b79d
leaq 0x74182(%rip), %rsi     # 0x8f96c
movq %rbx, %rdi
xorl %eax, %eax
callq 0x19be0
jmp 0x1b79b
testq %r15, %r15
je 0x1b806
movq %rbx, %rdi
movq %r15, %rsi
callq 0x182e0
testq %r14, %r14
movq 0x20(%rsp), %r15
je 0x1b81b
movq %rbx, %rdi
movq %r14, %rsi
callq 0x182e0
testq %r15, %r15
je 0x1b82b
movq %rbx, %rdi
movq %r15, %rsi
callq 0x182e0
movl 0x14(%rsp), %edi
callq 0x19970
movq %rbx, %rdi
movl $0x5, %esi
jmp 0x1b793
leaq 0x18(%rsp), %rdx
leaq 0x14(%rsp), %r12
movq %rbx, %rdi
movl $0x6, %esi
movq %r12, %rcx
callq 0x19eb0
movq %rax, 0x30(%rsp)
cmpl $0x0, (%r12)
js 0x1b926
movl 0x18(%rsp), %eax
testl %eax, %eax
sete %cl
movl 0x1c(%rsp), %edx
cmpl %edx, %eax
sete %al
orb %cl, %al
je 0x1b976
movq 0x28(%rsp), %rax
movq 0x50(%rax), %rax
movq 0x30(%rsp), %rcx
movq %rcx, (%rsp)
movq %rbp, %rdi
movl %r13d, %esi
movq %rcx, %r13
movq %r15, %rcx
movq %r14, %r8
movq 0x20(%rsp), %r12
movq %r12, %r9
callq *0x7b8(%rax)
jmp 0x1b8db
movq 0x28(%rsp), %rax
movq 0x50(%rax), %rax
movl 0x1c(%rsp), %edx
movq %rbp, %rdi
movl %r13d, %esi
movq %r15, %rcx
movq %r14, %r8
callq *0x330(%rax)
xorl %r12d, %r12d
xorl %r13d, %r13d
testq %r15, %r15
je 0x1b8eb
movq %rbx, %rdi
movq %r15, %rsi
callq 0x182e0
testq %r14, %r14
je 0x1b8fb
movq %rbx, %rdi
movq %r14, %rsi
callq 0x182e0
testq %r12, %r12
je 0x1b90b
movq %rbx, %rdi
movq %r12, %rsi
callq 0x182e0
xorl %ebp, %ebp
testq %r13, %r13
je 0x1b79d
movq %rbx, %rdi
movq %r13, %rsi
callq 0x182e0
jmp 0x1b79d
testq %r15, %r15
je 0x1b936
movq %rbx, %rdi
movq %r15, %rsi
callq 0x182e0
testq %r14, %r14
movq 0x20(%rsp), %r15
movq 0x30(%rsp), %r12
je 0x1b950
movq %rbx, %rdi
movq %r14, %rsi
callq 0x182e0
testq %r15, %r15
je 0x1b960
movq %rbx, %rdi
movq %r15, %rsi
callq 0x182e0
testq %r12, %r12
je 0x1b970
movq %rbx, %rdi
movq %r12, %rsi
callq 0x182e0
movl 0x14(%rsp), %edi
jmp 0x1b9c5
testq %r15, %r15
je 0x1b986
movq %rbx, %rdi
movq %r15, %rsi
callq 0x182e0
testq %r14, %r14
movq 0x20(%rsp), %r15
movq 0x30(%rsp), %r12
je 0x1b9a0
movq %rbx, %rdi
movq %r14, %rsi
callq 0x182e0
testq %r15, %r15
je 0x1b9b0
movq %rbx, %rdi
movq %r15, %rsi
callq 0x182e0
testq %r12, %r12
je 0x1b9c0
movq %rbx, %rdi
movq %r12, %rsi
callq 0x182e0
movl $0xfffffff9, %edi       # imm = 0xFFFFFFF9
callq 0x19970
movq %rbx, %rdi
movl $0x6, %esi
jmp 0x1b793