// File: /workspace/github_cpp_makefile_star2_O2/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 0x623ea(%rip), %rcx     # 0x7d909
pushq $0x1
popq %rsi
leaq 0x28(%rsp), %rdx
callq 0x1a500
movq %rax, %rbp
pushq $0x2
popq %rsi
movq %rbx, %rdi
callq 0x190d0
movq %rax, %r13
leaq 0x61abc(%rip), %r8      # 0x7d000
pushq $0x3
popq %rsi
leaq 0x1c(%rsp), %rdx
leaq 0x14(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rcx
callq 0x199d0
movq %rax, %r15
movl (%r14), %edi
testl %edi, %edi
je 0x1b586
testq %r15, %r15
je 0x1b57a
movq %rbx, %rdi
movq %r15, %rsi
callq 0x182e0
movl 0x14(%rsp), %edi
callq 0x19950
pushq $0x3
jmp 0x1b6bd
pushq $0x4
popq %rsi
leaq 0x18(%rsp), %rdx
leaq 0x14(%rsp), %r12
movq %rbx, %rdi
movq %r12, %rcx
callq 0x19e90
movq %rax, %r14
cmpl $0x0, (%r12)
je 0x1b5d1
testq %r15, %r15
je 0x1b5b8
movq %rbx, %rdi
movq %r15, %rsi
callq 0x182e0
testq %r14, %r14
je 0x1b5c8
movq %rbx, %rdi
movq %r14, %rsi
callq 0x182e0
movl 0x14(%rsp), %edi
jmp 0x1b6b6
movl 0x18(%rsp), %eax
cmpl 0x1c(%rsp), %eax
jne 0x1b693
pushq $0x5
popq %rsi
movq %rbx, %rdi
callq 0x1a110
testl %eax, %eax
jg 0x1b601
pushq $0x6
popq %rsi
movq %rbx, %rdi
callq 0x1a110
testl %eax, %eax
jle 0x1b7dc
movq 0x28(%rsp), %rax
movq 0x50(%rax), %rax
cmpq $0x0, 0x7b8(%rax)
je 0x1b6dc
pushq $0x5
popq %rsi
leaq 0x18(%rsp), %rdx
leaq 0x14(%rsp), %r12
movq %rbx, %rdi
movq %r12, %rcx
callq 0x19e90
movq %rax, 0x20(%rsp)
cmpl $0x0, (%r12)
js 0x1b724
movl 0x18(%rsp), %eax
testl %eax, %eax
je 0x1b769
cmpl 0x1c(%rsp), %eax
je 0x1b769
testq %r15, %r15
je 0x1b666
movq %rbx, %rdi
movq %r15, %rsi
callq 0x182e0
testq %r14, %r14
movq 0x20(%rsp), %r15
je 0x1b67b
movq %rbx, %rdi
movq %r14, %rsi
callq 0x182e0
testq %r15, %r15
je 0x1b68b
movq %rbx, %rdi
movq %r15, %rsi
callq 0x182e0
pushq $-0x7
popq %rdi
jmp 0x1b75d
testq %r15, %r15
je 0x1b6a3
movq %rbx, %rdi
movq %r15, %rsi
callq 0x182e0
testq %r14, %r14
je 0x1b6b3
movq %rbx, %rdi
movq %r14, %rsi
callq 0x182e0
pushq $-0x7
popq %rdi
callq 0x19950
pushq $0x4
popq %rsi
movq %rbx, %rdi
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 0x1b6ec
movq %rbx, %rdi
movq %r15, %rsi
callq 0x182e0
testq %r14, %r14
je 0x1b6fc
movq %rbx, %rdi
movq %r14, %rsi
callq 0x182e0
movq 0x28(%rsp), %rax
movq 0x50(%rax), %rax
xorl %ebp, %ebp
cmpq $0x0, 0x7b8(%rax)
jne 0x1b6cb
leaq 0x62254(%rip), %rsi     # 0x7d96c
movq %rbx, %rdi
xorl %eax, %eax
callq 0x19bc0
jmp 0x1b6c9
testq %r15, %r15
je 0x1b734
movq %rbx, %rdi
movq %r15, %rsi
callq 0x182e0
testq %r14, %r14
movq 0x20(%rsp), %r15
je 0x1b749
movq %rbx, %rdi
movq %r14, %rsi
callq 0x182e0
testq %r15, %r15
je 0x1b759
movq %rbx, %rdi
movq %r15, %rsi
callq 0x182e0
movl 0x14(%rsp), %edi
callq 0x19950
pushq $0x5
jmp 0x1b6bd
pushq $0x6
popq %rsi
leaq 0x18(%rsp), %rdx
leaq 0x14(%rsp), %r12
movq %rbx, %rdi
movq %r12, %rcx
callq 0x19e90
movq %rax, 0x30(%rsp)
cmpl $0x0, (%r12)
js 0x1b84c
movl 0x18(%rsp), %eax
testl %eax, %eax
sete %cl
movl 0x1c(%rsp), %edx
cmpl %edx, %eax
sete %al
orb %cl, %al
je 0x1b89c
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 0x1b801
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 0x1b811
movq %rbx, %rdi
movq %r15, %rsi
callq 0x182e0
testq %r14, %r14
je 0x1b821
movq %rbx, %rdi
movq %r14, %rsi
callq 0x182e0
testq %r12, %r12
je 0x1b831
movq %rbx, %rdi
movq %r12, %rsi
callq 0x182e0
xorl %ebp, %ebp
testq %r13, %r13
je 0x1b6cb
movq %rbx, %rdi
movq %r13, %rsi
callq 0x182e0
jmp 0x1b6cb
testq %r15, %r15
je 0x1b85c
movq %rbx, %rdi
movq %r15, %rsi
callq 0x182e0
testq %r14, %r14
movq 0x20(%rsp), %r15
movq 0x30(%rsp), %r12
je 0x1b876
movq %rbx, %rdi
movq %r14, %rsi
callq 0x182e0
testq %r15, %r15
je 0x1b886
movq %rbx, %rdi
movq %r15, %rsi
callq 0x182e0
testq %r12, %r12
je 0x1b896
movq %rbx, %rdi
movq %r12, %rsi
callq 0x182e0
movl 0x14(%rsp), %edi
jmp 0x1b8e9
testq %r15, %r15
je 0x1b8ac
movq %rbx, %rdi
movq %r15, %rsi
callq 0x182e0
testq %r14, %r14
movq 0x20(%rsp), %r15
movq 0x30(%rsp), %r12
je 0x1b8c6
movq %rbx, %rdi
movq %r14, %rsi
callq 0x182e0
testq %r15, %r15
je 0x1b8d6
movq %rbx, %rdi
movq %r15, %rsi
callq 0x182e0
testq %r12, %r12
je 0x1b8e6
movq %rbx, %rdi
movq %r12, %rsi
callq 0x182e0
pushq $-0x7
popq %rdi
callq 0x19950
pushq $0x6
jmp 0x1b6bd