// File: /workspace/github_c_makefile_star2_O0/stetre[P]moonnuklear/src/utils.c
// Function: moonnuklear_checkstringlist
char** checkstringlist(lua_State *L, int arg, int *count, int *err)
    {
    int t;
    char** list;
    const char* s;
    int i;
    *count = 0;
    *err = 0;
    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 = (char**)MallocNoErr(L, sizeof(char*) * (*count + 1));
    if(!list)
        { *err = ERR_MEMORY; return NULL; }
    for(i=0; i<*count; i++)
        {
        t = lua_rawgeti(L, arg, i+1);
        if(t != LUA_TSTRING)
            {
            lua_pop(L, 1);
            freestringlist(L, list, *count);
            *count = 0;
            *err = ERR_TYPE;
            return NULL;
            }
        s = lua_tostring(L, -1);
        list[i] = Strdup(L, s);
        lua_pop(L, 1);
        }
    /* list[*count]=NULL; */
    return list;
    }

// Assembly:
subq $0x48, %rsp
movq %rdi, 0x38(%rsp)
movl %esi, 0x34(%rsp)
movq %rdx, 0x28(%rsp)
movq %rcx, 0x20(%rsp)
movq 0x28(%rsp), %rax
movl $0x0, (%rax)
movq 0x20(%rsp), %rax
movl $0x0, (%rax)
movq 0x38(%rsp), %rdi
movl 0x34(%rsp), %esi
callq 0x15090
cmpl $0x0, %eax
jg 0xa1299
movq 0x20(%rsp), %rax
movl $0x1, (%rax)
movq $0x0, 0x40(%rsp)
jmp 0xa1423
movq 0x38(%rsp), %rdi
movl 0x34(%rsp), %esi
callq 0x15090
cmpl $0x5, %eax
je 0xa12c5
movq 0x20(%rsp), %rax
movl $0xfffffffc, (%rax)     # imm = 0xFFFFFFFC
movq $0x0, 0x40(%rsp)
jmp 0xa1423
movq 0x38(%rsp), %rdi
movl 0x34(%rsp), %esi
callq 0x150b0
movl %eax, %ecx
movq 0x28(%rsp), %rax
movl %ecx, (%rax)
movq 0x28(%rsp), %rax
cmpl $0x0, (%rax)
jne 0xa12ff
movq 0x20(%rsp), %rax
movl $0xfffffffb, (%rax)     # imm = 0xFFFFFFFB
movq $0x0, 0x40(%rsp)
jmp 0xa1423
movq 0x38(%rsp), %rdi
movq 0x28(%rsp), %rax
movl (%rax), %eax
addl $0x1, %eax
movslq %eax, %rsi
shlq $0x3, %rsi
callq 0x13ca0
movq %rax, 0x10(%rsp)
cmpq $0x0, 0x10(%rsp)
jne 0xa1340
movq 0x20(%rsp), %rax
movl $0xfffffffa, (%rax)     # imm = 0xFFFFFFFA
movq $0x0, 0x40(%rsp)
jmp 0xa1423
movl $0x0, 0x4(%rsp)
movl 0x4(%rsp), %eax
movq 0x28(%rsp), %rcx
cmpl (%rcx), %eax
jge 0xa1419
movq 0x38(%rsp), %rdi
movl 0x34(%rsp), %esi
movl 0x4(%rsp), %eax
addl $0x1, %eax
movslq %eax, %rdx
callq 0x13a30
movl %eax, 0x1c(%rsp)
cmpl $0x4, 0x1c(%rsp)
je 0xa13c2
movq 0x38(%rsp), %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x131a0
movq 0x38(%rsp), %rdi
movq 0x10(%rsp), %rsi
movq 0x28(%rsp), %rax
movl (%rax), %edx
callq 0x13dc0
movq 0x28(%rsp), %rax
movl $0x0, (%rax)
movq 0x20(%rsp), %rax
movl $0xfffffffe, (%rax)     # imm = 0xFFFFFFFE
movq $0x0, 0x40(%rsp)
jmp 0xa1423
movq 0x38(%rsp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
xorl %eax, %eax
movl %eax, %edx
callq 0x136c0
movq %rax, 0x8(%rsp)
movq 0x38(%rsp), %rdi
movq 0x8(%rsp), %rsi
callq 0x148e0
movq %rax, %rdx
movq 0x10(%rsp), %rax
movslq 0x4(%rsp), %rcx
movq %rdx, (%rax,%rcx,8)
movq 0x38(%rsp), %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x131a0
movl 0x4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x4(%rsp)
jmp 0xa1348
movq 0x10(%rsp), %rax
movq %rax, 0x40(%rsp)
movq 0x40(%rsp), %rax
addq $0x48, %rsp
retq
nopl (%rax)