// File: stetre[P]moonvulkan/src/cmd.c
// Function: CmdBindTransformFeedbackBuffers
static int CmdBindTransformFeedbackBuffers(lua_State *L)
    {
    int err = 0, errargc=1;
    ud_t *ud;
    uint32_t first_binding, count, count1;
    VkBuffer* buffers = NULL;
    VkDeviceSize *offsets = NULL;
    VkDeviceSize *sizes = NULL;
    VkCommandBuffer cb = checkcommand_buffer(L, 1, &ud);
    CheckDevicePfn(L, ud, CmdBindTransformFeedbackBuffersEXT);

    first_binding = luaL_checkinteger(L, 2);

    buffers = checkbufferlist(L, 3, &count, &err);
    if(err) { errargc=3; goto failure; }

    offsets = checkdevicesizelist(L, 4, &count1, &err);
    if(err == ERR_NOTPRESENT) err = 0;
    else if(err) { errargc=4; goto failure; }
    if(count1 != count) { err=ERR_LENGTH; errargc=4; goto failure; }

    sizes = checkdevicesizelist(L, 5, &count1, &err);
    if(err == ERR_NOTPRESENT) err = 0;
    else if(err) { errargc=5; goto failure; }
    else if(count1 != count) { err=ERR_LENGTH; errargc=5; goto failure; }

    ud->ddt->CmdBindTransformFeedbackBuffersEXT(cb, first_binding, count, buffers, offsets, sizes);
failure:
    if(buffers) Free(L, buffers);
    if(offsets) Free(L, offsets);
    if(sizes) Free(L, sizes);
    return err ? argerrorc(L, errargc, err) : 0;
    }

// Assembly:
subq $0x68, %rsp
movq %rdi, 0x58(%rsp)
movl $0x0, 0x54(%rsp)
movl $0x1, 0x50(%rsp)
movq $0x0, 0x30(%rsp)
movq $0x0, 0x28(%rsp)
movq $0x0, 0x20(%rsp)
movq 0x58(%rsp), %rdi
movl $0x1, %esi
leaq 0x48(%rsp), %rdx
leaq 0xaff1f(%rip), %rcx     # 0xcf909
callq 0x1a640
movq %rax, 0x18(%rsp)
movq 0x48(%rsp), %rax
movq 0x50(%rax), %rax
cmpq $0x0, 0x570(%rax)
jne 0x1fa23
movq 0x58(%rsp), %rdi
leaq 0xb031b(%rip), %rsi     # 0xcfd2e
movb $0x0, %al
callq 0x19ce0
movl %eax, 0x64(%rsp)
jmp 0x1fbf1
jmp 0x1fa25
movq 0x58(%rsp), %rdi
movl $0x2, %esi
callq 0x19190
movl %eax, 0x44(%rsp)
movq 0x58(%rsp), %rdi
movl $0x3, %esi
leaq 0x40(%rsp), %rdx
leaq 0x54(%rsp), %rcx
leaq 0xaf5ad(%rip), %r8      # 0xcf000
callq 0x19ae0
movq %rax, 0x30(%rsp)
cmpl $0x0, 0x54(%rsp)
je 0x1fa71
movl $0x3, 0x50(%rsp)
jmp 0x1fb63
movq 0x58(%rsp), %rdi
movl $0x4, %esi
leaq 0x3c(%rsp), %rdx
leaq 0x54(%rsp), %rcx
callq 0x19fb0
movq %rax, 0x28(%rsp)
cmpl $0x1, 0x54(%rsp)
jne 0x1faa0
movl $0x0, 0x54(%rsp)
jmp 0x1fab6
cmpl $0x0, 0x54(%rsp)
je 0x1fab4
movl $0x4, 0x50(%rsp)
jmp 0x1fb63
jmp 0x1fab6
movl 0x3c(%rsp), %eax
cmpl 0x40(%rsp), %eax
je 0x1fad5
movl $0xfffffff9, 0x54(%rsp) # imm = 0xFFFFFFF9
movl $0x4, 0x50(%rsp)
jmp 0x1fb63
movq 0x58(%rsp), %rdi
movl $0x5, %esi
leaq 0x3c(%rsp), %rdx
leaq 0x54(%rsp), %rcx
callq 0x19fb0
movq %rax, 0x20(%rsp)
cmpl $0x1, 0x54(%rsp)
jne 0x1fb04
movl $0x0, 0x54(%rsp)
jmp 0x1fb35
cmpl $0x0, 0x54(%rsp)
je 0x1fb15
movl $0x5, 0x50(%rsp)
jmp 0x1fb63
movl 0x3c(%rsp), %eax
cmpl 0x40(%rsp), %eax
je 0x1fb31
movl $0xfffffff9, 0x54(%rsp) # imm = 0xFFFFFFF9
movl $0x5, 0x50(%rsp)
jmp 0x1fb63
jmp 0x1fb33
jmp 0x1fb35
movq 0x48(%rsp), %rax
movq 0x50(%rax), %rax
movq 0x570(%rax), %rax
movq 0x18(%rsp), %rdi
movl 0x44(%rsp), %esi
movl 0x40(%rsp), %edx
movq 0x30(%rsp), %rcx
movq 0x28(%rsp), %r8
movq 0x20(%rsp), %r9
callq *%rax
cmpq $0x0, 0x30(%rsp)
je 0x1fb7a
movq 0x58(%rsp), %rdi
movq 0x30(%rsp), %rsi
callq 0x18300
cmpq $0x0, 0x28(%rsp)
je 0x1fb91
movq 0x58(%rsp), %rdi
movq 0x28(%rsp), %rsi
callq 0x18300
cmpq $0x0, 0x20(%rsp)
je 0x1fba8
movq 0x58(%rsp), %rdi
movq 0x20(%rsp), %rsi
callq 0x18300
cmpl $0x0, 0x54(%rsp)
je 0x1fbe1
movq 0x58(%rsp), %rax
movq %rax, 0x8(%rsp)
movl 0x50(%rsp), %eax
movl %eax, 0x10(%rsp)
movl 0x54(%rsp), %edi
callq 0x19a60
movq 0x8(%rsp), %rdi
movl 0x10(%rsp), %esi
movq %rax, %rdx
callq 0x18460
movl %eax, 0x14(%rsp)
jmp 0x1fbe9
xorl %eax, %eax
movl %eax, 0x14(%rsp)
jmp 0x1fbe9
movl 0x14(%rsp), %eax
movl %eax, 0x64(%rsp)
movl 0x64(%rsp), %eax
addq $0x68, %rsp
retq
nopw (%rax,%rax)