// File: stetre[P]moonvulkan/src/cmd.c
// Function: CmdSetVertexInput
static int CmdSetVertexInput(lua_State *L)
    {
    int err;
    ud_t *ud;
    uint32_t bcount, acount;
    const VkVertexInputBindingDescription2EXT *bdescr = NULL;
    const VkVertexInputAttributeDescription2EXT *adescr = NULL;
    VkCommandBuffer cb = checkcommand_buffer(L, 1, &ud);
    CheckDevicePfn(L, ud, CmdSetVertexInputEXT);
#define CLEANUP do {                                                                    \
    if(bdescr) zfreearrayVkVertexInputBindingDescription2EXT(L, bdescr, bcount, 1);     \
    if(adescr) zfreearrayVkVertexInputAttributeDescription2EXT(L, adescr, acount, 1);   \
} while(0)
    bdescr = zcheckarrayVkVertexInputBindingDescription2EXT(L, 2, &bcount, &err);
    if(err < 0 && err != ERR_EMPTY) { CLEANUP; return argerror(L, 2); }
    adescr = zcheckarrayVkVertexInputAttributeDescription2EXT(L, 3, &acount, &err);
    if(err < 0 && err != ERR_EMPTY) { CLEANUP; return argerror(L, 3); }
    ud->ddt->CmdSetVertexInputEXT(cb, bcount, bdescr, acount, adescr);
    CLEANUP;
#undef CLEANUP
    return 0;
    }

// Assembly:
subq $0x58, %rsp
movq %rdi, 0x48(%rsp)
movq $0x0, 0x28(%rsp)
movq $0x0, 0x20(%rsp)
movq 0x48(%rsp), %rdi
movl $0x1, %esi
leaq 0x38(%rsp), %rdx
leaq 0xae8d8(%rip), %rcx     # 0xcf909
callq 0x1a640
movq %rax, 0x18(%rsp)
movq 0x38(%rsp), %rax
movq 0x50(%rax), %rax
cmpq $0x0, 0x810(%rax)
jne 0x2106a
movq 0x48(%rsp), %rdi
leaq 0xaf134(%rip), %rsi     # 0xd018e
movb $0x0, %al
callq 0x19ce0
movl %eax, 0x54(%rsp)
jmp 0x21260
jmp 0x2106c
movq 0x48(%rsp), %rdi
movl $0x2, %esi
leaq 0x34(%rsp), %rdx
leaq 0x44(%rsp), %rcx
callq 0x19f60
movq %rax, 0x28(%rsp)
cmpl $0x0, 0x44(%rsp)
jge 0x21128
cmpl $-0x5, 0x44(%rsp)
je 0x21128
jmp 0x210a2
cmpq $0x0, 0x28(%rsp)
je 0x210c8
movq 0x48(%rsp), %rdi
movq 0x28(%rsp), %rsi
movl 0x34(%rsp), %ecx
movl $0x20, %edx
movl $0x1, %r8d
callq 0x198d0
cmpq $0x0, 0x20(%rsp)
je 0x210ee
movq 0x48(%rsp), %rdi
movq 0x20(%rsp), %rsi
movl 0x30(%rsp), %ecx
movl $0x20, %edx
movl $0x1, %r8d
callq 0x198d0
jmp 0x210f0
movq 0x48(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x48(%rsp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
xorl %eax, %eax
movl %eax, %edx
callq 0x186d0
movq 0x10(%rsp), %rdi
movq %rax, %rdx
movl $0x2, %esi
callq 0x18460
movl %eax, 0x54(%rsp)
jmp 0x21260
movq 0x48(%rsp), %rdi
movl $0x3, %esi
leaq 0x30(%rsp), %rdx
leaq 0x44(%rsp), %rcx
callq 0x18660
movq %rax, 0x20(%rsp)
cmpl $0x0, 0x44(%rsp)
jge 0x211e1
cmpl $-0x5, 0x44(%rsp)
je 0x211e1
jmp 0x2115e
cmpq $0x0, 0x28(%rsp)
je 0x21184
movq 0x48(%rsp), %rdi
movq 0x28(%rsp), %rsi
movl 0x34(%rsp), %ecx
movl $0x20, %edx
movl $0x1, %r8d
callq 0x198d0
cmpq $0x0, 0x20(%rsp)
je 0x211aa
movq 0x48(%rsp), %rdi
movq 0x20(%rsp), %rsi
movl 0x30(%rsp), %ecx
movl $0x20, %edx
movl $0x1, %r8d
callq 0x198d0
jmp 0x211ac
movq 0x48(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x48(%rsp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
xorl %eax, %eax
movl %eax, %edx
callq 0x186d0
movq 0x8(%rsp), %rdi
movq %rax, %rdx
movl $0x3, %esi
callq 0x18460
movl %eax, 0x54(%rsp)
jmp 0x21260
movq 0x38(%rsp), %rax
movq 0x50(%rax), %rax
movq 0x810(%rax), %rax
movq 0x18(%rsp), %rdi
movl 0x34(%rsp), %esi
movq 0x28(%rsp), %rdx
movl 0x30(%rsp), %ecx
movq 0x20(%rsp), %r8
callq *%rax
cmpq $0x0, 0x28(%rsp)
je 0x21230
movq 0x48(%rsp), %rdi
movq 0x28(%rsp), %rsi
movl 0x34(%rsp), %ecx
movl $0x20, %edx
movl $0x1, %r8d
callq 0x198d0
cmpq $0x0, 0x20(%rsp)
je 0x21256
movq 0x48(%rsp), %rdi
movq 0x20(%rsp), %rsi
movl 0x30(%rsp), %ecx
movl $0x20, %edx
movl $0x1, %r8d
callq 0x198d0
jmp 0x21258
movl $0x0, 0x54(%rsp)
movl 0x54(%rsp), %eax
addq $0x58, %rsp
retq
nopl (%rax)