// File: /workspace/github_cpp_makefile_star2_O1/stetre[P]moonvulkan/src/objects.c
// Function: moonvulkan_checkxxxlist_nondispatchable
uint64_t* checkxxxlist_nondispatchable(lua_State *L, int arg, uint32_t *count, int *err, ud_t ***ud, const char *mt)
/* if ud != NULL, at return it will point to the array of ud_t* for the elements
 * i.e. ud[i] = the ud for element i  (also this array must be Free'd by the caller).
 */
    {
    uint64_t* list;
    uint32_t i;

    *count = 0;
    *err = 0;
    if(ud) *ud = NULL;
    if(lua_isnoneornil(L, arg))
        { *err = ERR_NOTPRESENT; return NULL; }
    if(lua_type(L, arg) != LUA_TTABLE)
        { *err = ERR_TABLE; return NULL; }
    *count = luaL_len(L, arg);
    if(*count == 0)
        { *err = ERR_EMPTY; return NULL; }
    list = (uint64_t*)MallocNoErr(L, sizeof(uint64_t) * (*count));
    if(!list)
        { *count = 0; *err = ERR_MEMORY; return NULL; }
    if(ud)
        {
        *ud = (ud_t**)MallocNoErr(L, sizeof(ud_t*) *(*count));
        if(!*ud)
            { Free(L, list); *count = 0; *err = ERR_MEMORY; return NULL; }
        }
    
    if(ud)
        {
        for(i=0; i<*count; i++)
            {
            lua_rawgeti(L, arg, i+1);
            (void)testxxx(L, -1, ud[i], mt);
            if(!*ud[i])
                {  Free(L, list); Free(L, *ud); *count = 0; *err = ERR_TYPE; return NULL; }
            list[i] = (*ud[i])->handle;
            lua_pop(L, 1);
            }
        }
    else
        {
        for(i=0; i<*count; i++)
            {
            lua_rawgeti(L, arg, i+1);
            list[i] = (uint64_t)testxxx(L, -1, NULL, mt);
            if(!list[i])
                { Free(L, list); *count = 0; *err = ERR_TYPE; return NULL; }
            lua_pop(L, 1);
            }
        }
    return list;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r9, 0x8(%rsp)
movq %r8, %r12
movq %rcx, %r14
movq %rdx, %r13
movl %esi, %ebp
movq %rdi, %r15
xorl %eax, %eax
movl %eax, (%rdx)
movl %eax, (%rcx)
testq %r8, %r8
je 0x46da0
movq $0x0, (%r12)
movq %r15, %rdi
movl %ebp, %esi
callq 0x1a130
testl %eax, %eax
jle 0x46e9c
movq %r15, %rdi
movl %ebp, %esi
callq 0x1a130
movl $0xfffffffc, %ebx       # imm = 0xFFFFFFFC
cmpl $0x5, %eax
jne 0x46f61
movq %r15, %rdi
movl %ebp, %esi
callq 0x1a160
movl %eax, (%r13)
testl %eax, %eax
je 0x46ea6
movq %r13, (%rsp)
movl %eax, %esi
shlq $0x3, %rsi
movq %r15, %rdi
callq 0x18050
movl $0xfffffffa, %ebx       # imm = 0xFFFFFFFA
testq %rax, %rax
je 0x46f57
movq %rax, %r13
movq (%rsp), %rax
movl (%rax), %esi
testq %r12, %r12
je 0x46eb0
shlq $0x3, %rsi
movq %r15, %rdi
callq 0x18050
movq %rax, (%r12)
testq %rax, %rax
je 0x46f17
movq (%rsp), %rax
cmpl $0x0, (%rax)
je 0x46f67
movq %r14, 0x10(%rsp)
xorl %ebx, %ebx
leaq 0x1(%rbx), %r14
movq %r15, %rdi
movl %ebp, %esi
movq %r14, %rdx
callq 0x18980
movq (%r12,%rbx,8), %rdx
movq %r15, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movq 0x8(%rsp), %rcx
callq 0x1a4d0
movq (%r12,%rbx,8), %rax
movq (%rax), %rax
testq %rax, %rax
je 0x46f24
movq (%rax), %rax
movq %rax, (%r13,%rbx,8)
movq %r15, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x18150
movq %r14, %rbx
movq (%rsp), %rax
cmpl (%rax), %r14d
jb 0x46e3f
jmp 0x46f67
movl $0x1, %ebx
jmp 0x46f61
movl $0xfffffffb, %ebx       # imm = 0xFFFFFFFB
jmp 0x46f61
testq %rsi, %rsi
je 0x46f67
xorl %ebx, %ebx
leaq 0x1(%rbx), %r12
movq %r15, %rdi
movl %ebp, %esi
movq %r12, %rdx
callq 0x18980
movq %r15, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movq 0x8(%rsp), %rdx
callq 0x1a1e0
testq %rax, %rax
je 0x46ee9
testb $0x1, 0x28(%rax)
jne 0x46eed
xorl %eax, %eax
jmp 0x46ef0
movq (%rax), %rax
movq %rax, (%r13,%rbx,8)
testq %rax, %rax
je 0x46f47
movq %r15, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x18150
movq (%rsp), %rax
movl (%rax), %eax
movq %r12, %rbx
cmpq %rax, %r12
jb 0x46ebb
jmp 0x46f67
movq %r15, %rdi
movq %r13, %rsi
callq 0x182e0
jmp 0x46f57
movq %r15, %rdi
movq %r13, %rsi
callq 0x182e0
movq (%r12), %rsi
movq %r15, %rdi
callq 0x182e0
movl $0xfffffffe, %ebx       # imm = 0xFFFFFFFE
movq 0x10(%rsp), %r14
jmp 0x46f57
movq %r15, %rdi
movq %r13, %rsi
callq 0x182e0
movl $0xfffffffe, %ebx       # imm = 0xFFFFFFFE
movq (%rsp), %rax
movl $0x0, (%rax)
movl %ebx, (%r14)
xorl %r13d, %r13d
movq %r13, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)