// File: /workspace/github_cpp_makefile_star2_O3/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 0x71371(%rip), %rcx     # 0x8c909
leaq 0x28(%rsp), %rdx
movl $0x1, %esi
callq 0x1a4e0
movq %rax, %rbp
movq %rbx, %rdi
movl $0x2, %esi
callq 0x190e0
movq %rax, %r13
leaq 0x70a3f(%rip), %r8      # 0x8c000
leaq 0x1c(%rsp), %rdx
leaq 0x14(%rsp), %r14
movq %rbx, %rdi
movl $0x3, %esi
movq %r14, %rcx
callq 0x199b0
movq %rax, %r15
movl (%r14), %edi
testl %edi, %edi
je 0x1b60b
testq %r15, %r15
je 0x1b5f9
movq %rbx, %rdi
movq %r15, %rsi
callq 0x182d0
movl 0x14(%rsp), %edi
callq 0x19930
movq %rbx, %rdi
movl $0x3, %esi
jmp 0x1b754
leaq 0x18(%rsp), %rdx
leaq 0x14(%rsp), %r12
movq %rbx, %rdi
movl $0x4, %esi
movq %r12, %rcx
callq 0x19e70
movq %rax, %r14
cmpl $0x0, (%r12)
je 0x1b658
testq %r15, %r15
je 0x1b63f
movq %rbx, %rdi
movq %r15, %rsi
callq 0x182d0
testq %r14, %r14
je 0x1b64f
movq %rbx, %rdi
movq %r14, %rsi
callq 0x182d0
movl 0x14(%rsp), %edi
jmp 0x1b747
movl 0x18(%rsp), %eax
cmpl 0x1c(%rsp), %eax
jne 0x1b722
movq %rbx, %rdi
movl $0x5, %esi
callq 0x1a0f0
testl %eax, %eax
jg 0x1b68c
movq %rbx, %rdi
movl $0x6, %esi
callq 0x1a0f0
testl %eax, %eax
jle 0x1b877
movq 0x28(%rsp), %rax
movq 0x50(%rax), %rax
cmpq $0x0, 0x7b8(%rax)
je 0x1b76f
leaq 0x18(%rsp), %rdx
leaq 0x14(%rsp), %r12
movq %rbx, %rdi
movl $0x5, %esi
movq %r12, %rcx
callq 0x19e70
movq %rax, 0x20(%rsp)
cmpl $0x0, (%r12)
js 0x1b7b7
movl 0x18(%rsp), %eax
testl %eax, %eax
je 0x1b802
cmpl 0x1c(%rsp), %eax
je 0x1b802
testq %r15, %r15
je 0x1b6f3
movq %rbx, %rdi
movq %r15, %rsi
callq 0x182d0
testq %r14, %r14
movq 0x20(%rsp), %r15
je 0x1b708
movq %rbx, %rdi
movq %r14, %rsi
callq 0x182d0
testq %r15, %r15
je 0x1b718
movq %rbx, %rdi
movq %r15, %rsi
callq 0x182d0
movl $0xfffffff9, %edi       # imm = 0xFFFFFFF9
jmp 0x1b7f0
testq %r15, %r15
je 0x1b732
movq %rbx, %rdi
movq %r15, %rsi
callq 0x182d0
testq %r14, %r14
je 0x1b742
movq %rbx, %rdi
movq %r14, %rsi
callq 0x182d0
movl $0xfffffff9, %edi       # imm = 0xFFFFFFF9
callq 0x19930
movq %rbx, %rdi
movl $0x4, %esi
movq %rax, %rdx
callq 0x18410
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 0x1b77f
movq %rbx, %rdi
movq %r15, %rsi
callq 0x182d0
testq %r14, %r14
je 0x1b78f
movq %rbx, %rdi
movq %r14, %rsi
callq 0x182d0
movq 0x28(%rsp), %rax
movq 0x50(%rax), %rax
xorl %ebp, %ebp
cmpq $0x0, 0x7b8(%rax)
jne 0x1b75e
leaq 0x711c1(%rip), %rsi     # 0x8c96c
movq %rbx, %rdi
xorl %eax, %eax
callq 0x19ba0
jmp 0x1b75c
testq %r15, %r15
je 0x1b7c7
movq %rbx, %rdi
movq %r15, %rsi
callq 0x182d0
testq %r14, %r14
movq 0x20(%rsp), %r15
je 0x1b7dc
movq %rbx, %rdi
movq %r14, %rsi
callq 0x182d0
testq %r15, %r15
je 0x1b7ec
movq %rbx, %rdi
movq %r15, %rsi
callq 0x182d0
movl 0x14(%rsp), %edi
callq 0x19930
movq %rbx, %rdi
movl $0x5, %esi
jmp 0x1b754
leaq 0x18(%rsp), %rdx
leaq 0x14(%rsp), %r12
movq %rbx, %rdi
movl $0x6, %esi
movq %r12, %rcx
callq 0x19e70
movq %rax, 0x30(%rsp)
cmpl $0x0, (%r12)
js 0x1b8e7
movl 0x18(%rsp), %eax
testl %eax, %eax
sete %cl
movl 0x1c(%rsp), %edx
cmpl %edx, %eax
sete %al
orb %cl, %al
je 0x1b937
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 0x1b89c
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 0x1b8ac
movq %rbx, %rdi
movq %r15, %rsi
callq 0x182d0
testq %r14, %r14
je 0x1b8bc
movq %rbx, %rdi
movq %r14, %rsi
callq 0x182d0
testq %r12, %r12
je 0x1b8cc
movq %rbx, %rdi
movq %r12, %rsi
callq 0x182d0
xorl %ebp, %ebp
testq %r13, %r13
je 0x1b75e
movq %rbx, %rdi
movq %r13, %rsi
callq 0x182d0
jmp 0x1b75e
testq %r15, %r15
je 0x1b8f7
movq %rbx, %rdi
movq %r15, %rsi
callq 0x182d0
testq %r14, %r14
movq 0x20(%rsp), %r15
movq 0x30(%rsp), %r12
je 0x1b911
movq %rbx, %rdi
movq %r14, %rsi
callq 0x182d0
testq %r15, %r15
je 0x1b921
movq %rbx, %rdi
movq %r15, %rsi
callq 0x182d0
testq %r12, %r12
je 0x1b931
movq %rbx, %rdi
movq %r12, %rsi
callq 0x182d0
movl 0x14(%rsp), %edi
jmp 0x1b986
testq %r15, %r15
je 0x1b947
movq %rbx, %rdi
movq %r15, %rsi
callq 0x182d0
testq %r14, %r14
movq 0x20(%rsp), %r15
movq 0x30(%rsp), %r12
je 0x1b961
movq %rbx, %rdi
movq %r14, %rsi
callq 0x182d0
testq %r15, %r15
je 0x1b971
movq %rbx, %rdi
movq %r15, %rsi
callq 0x182d0
testq %r12, %r12
je 0x1b981
movq %rbx, %rdi
movq %r12, %rsi
callq 0x182d0
movl $0xfffffff9, %edi       # imm = 0xFFFFFFF9
callq 0x19930
movq %rbx, %rdi
movl $0x6, %esi
jmp 0x1b754