// File: /workspace/github_c_makefile_star2_O1/stetre[P]moonsndfile/src/structs.c
// Function: moonsndfile_checkinfo
int checkinfo(lua_State *L, int arg, SF_INFO *p)
    {
    int err, isnum;
    int code, format, subformat, endianness;
    if(lua_isnoneornil(L, arg))
        return luaL_argerror(L, arg, errstring(ERR_NOTPRESENT));
    if(lua_type(L, arg) != LUA_TTABLE)
        return luaL_argerror(L, arg, errstring(ERR_TABLE));

    lua_getfield(L, arg, "code");
    code = lua_tointegerx(L, -1, &isnum); lua_pop(L, 1);

    lua_getfield(L, arg, "format");
    format = testformat(L, -1, &err); lua_pop(L, 1);
    if(err<0) return luaL_argerror(L, arg, "invalid 'format'");

    lua_getfield(L, arg, "subformat");
    subformat = testsubformat(L, -1, &err); lua_pop(L, 1);
    if(err<0) return luaL_argerror(L, arg, "invalid 'subformat'");

    lua_getfield(L, arg, "endianness");
    endianness = testendianness(L, -1, &err); lua_pop(L, 1);
    if(err < 0) return luaL_argerror(L, arg, "invalid 'endianness'");/* defaults to 0 */

    if(isnum)
        {
        if(format && format != (code & SF_FORMAT_TYPEMASK))
            return luaL_argerror(L, arg, "format is present and does not match with code");
        if(subformat && subformat != (code & SF_FORMAT_SUBMASK))
            return luaL_argerror(L, arg, "subformat is present and does not match with code");
        if(endianness && endianness != (code & SF_FORMAT_ENDMASK))
            return luaL_argerror(L, arg, "subformat is present and does not match with code");
        p->format = code;
        }
    else
        {
        if(format==0)
            return luaL_argerror(L, arg, "missing format");
        if(subformat==0)
            return luaL_argerror(L, arg, "missing subformat");
        p->format = format | subformat | endianness;
        }

    lua_getfield(L, arg, "samplerate");
    p->samplerate = lua_tointegerx(L, -1, &isnum); lua_pop(L, 1);
    if(!isnum) return luaL_argerror(L, arg, "missing or invalid 'samplerate'");

    lua_getfield(L, arg, "channels");
    p->channels = lua_tointegerx(L, -1, &isnum); lua_pop(L, 1);
    if(!isnum) return luaL_argerror(L, arg, "missing or invalid 'channels'");

    return 0;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %r15
movl %esi, %ebx
movq %rdi, %r14
callq 0x4730
testl %eax, %eax
jle 0xa853
movq %r14, %rdi
movl %ebx, %esi
callq 0x4730
cmpl $0x5, %eax
jne 0xa85a
leaq 0x3f4a(%rip), %rdx      # 0xe637
movq %r14, %rdi
movl %ebx, %esi
callq 0x47e0
leaq 0x4(%rsp), %rdx
movq %r14, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x4170
movq %rax, %r12
movq %r14, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x4080
leaq 0x36f4(%rip), %rdx      # 0xde14
movq %r14, %rdi
movl %ebx, %esi
callq 0x47e0
leaq 0xc(%rsp), %r13
movq %r14, %rdi
movl $0x1, %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq %r13, %rcx
callq 0x4600
movl %eax, %ebp
movq %r14, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x4080
cmpl $0x0, (%r13)
js 0xa87f
movq %r12, 0x10(%rsp)
leaq 0x3ee9(%rip), %rdx      # 0xe653
movq %r14, %rdi
movl %ebx, %esi
callq 0x47e0
leaq 0xc(%rsp), %r12
movq %r14, %rdi
movl $0x2, %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq %r12, %rcx
callq 0x4600
movl %eax, %r13d
movq %r14, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x4080
cmpl $0x0, (%r12)
js 0xa88b
leaq 0x36de(%rip), %rdx      # 0xde8e
movq %r14, %rdi
movl %ebx, %esi
callq 0x47e0
leaq 0xc(%rsp), %r12
movq %r14, %rdi
movl $0x3, %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq %r12, %rcx
callq 0x4600
movl %eax, 0x8(%rsp)
movq %r14, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x4080
cmpl $0x0, (%r12)
js 0xa897
cmpl $0x0, 0x4(%rsp)
je 0xa8a3
testl %ebp, %ebp
sete %al
movq 0x10(%rsp), %rdx
movl %edx, %ecx
andl $0xfff0000, %ecx        # imm = 0xFFF0000
cmpl %ecx, %ebp
sete %cl
orb %al, %cl
je 0xa94a
testl %r13d, %r13d
sete %al
movzwl %dx, %ecx
cmpl %ecx, %r13d
sete %cl
orb %al, %cl
je 0xa847
movl 0x8(%rsp), %esi
testl %esi, %esi
sete %al
movl %edx, %ecx
andl $0x30000000, %ecx       # imm = 0x30000000
cmpl %ecx, %esi
sete %cl
orb %al, %cl
jne 0xa8bf
leaq 0x3dbc(%rip), %rdx      # 0xe60a
jmp 0xa96c
movl $0x1, %edi
jmp 0xa85f
movl $0xfffffffc, %edi       # imm = 0xFFFFFFFC
callq 0x4660
movq %r14, %rdi
movl %ebx, %esi
movq %rax, %rdx
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x4110
leaq 0x3d4a(%rip), %rdx      # 0xe5d0
jmp 0xa96c
leaq 0x3d4f(%rip), %rdx      # 0xe5e1
jmp 0xa96c
leaq 0x3d57(%rip), %rdx      # 0xe5f5
jmp 0xa96c
testl %ebp, %ebp
je 0xa953
testl %r13d, %r13d
je 0xa95c
orl %ebp, %r13d
orl 0x8(%rsp), %r13d
movl %r13d, %edx
movl %edx, 0x10(%r15)
leaq 0x29b2(%rip), %rdx      # 0xd27c
movq %r14, %rdi
movl %ebx, %esi
callq 0x47e0
leaq 0x4(%rsp), %r12
movq %r14, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movq %r12, %rdx
callq 0x4170
movl %eax, 0x8(%r15)
movq %r14, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x4080
cmpl $0x0, (%r12)
je 0xa965
leaq 0x28b5(%rip), %rdx      # 0xd1bd
movq %r14, %rdi
movl %ebx, %esi
callq 0x47e0
leaq 0x4(%rsp), %r12
movq %r14, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
movq %r12, %rdx
callq 0x4170
movl %eax, 0xc(%r15)
movq %r14, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x4080
xorl %eax, %eax
cmpl $0x0, (%r12)
jne 0xa976
leaq 0x3d35(%rip), %rdx      # 0xe67d
jmp 0xa96c
leaq 0x3cbc(%rip), %rdx      # 0xe60d
jmp 0xa96c
leaq 0x3ce2(%rip), %rdx      # 0xe63c
jmp 0xa96c
leaq 0x3ce8(%rip), %rdx      # 0xe64b
jmp 0xa96c
leaq 0x3cf1(%rip), %rdx      # 0xe65d
movq %r14, %rdi
movl %ebx, %esi
callq 0x4110
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq