// File: /workspace/github_c_makefile_star2_O3/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 0xa847
movq %r14, %rdi
movl %ebx, %esi
callq 0x4730
cmpl $0x5, %eax
jne 0xa84e
leaq 0x3f56(%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 0x3700(%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 0xa873
movq %r12, 0x10(%rsp)
leaq 0x3ef5(%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 0xa87f
leaq 0x36ea(%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 0xa88b
cmpl $0x0, 0x4(%rsp)
je 0xa897
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 0xa93e
testl %r13d, %r13d
sete %al
movzwl %dx, %ecx
cmpl %ecx, %r13d
sete %cl
orb %al, %cl
je 0xa83b
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 0xa8b3
leaq 0x3dc8(%rip), %rdx      # 0xe60a
jmp 0xa960
movl $0x1, %edi
jmp 0xa853
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 0x3d56(%rip), %rdx      # 0xe5d0
jmp 0xa960
leaq 0x3d5b(%rip), %rdx      # 0xe5e1
jmp 0xa960
leaq 0x3d63(%rip), %rdx      # 0xe5f5
jmp 0xa960
testl %ebp, %ebp
je 0xa947
testl %r13d, %r13d
je 0xa950
orl %ebp, %r13d
orl 0x8(%rsp), %r13d
movl %r13d, %edx
movl %edx, 0x10(%r15)
leaq 0x29be(%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 0xa959
leaq 0x28c1(%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 0xa96a
leaq 0x3d41(%rip), %rdx      # 0xe67d
jmp 0xa960
leaq 0x3cc8(%rip), %rdx      # 0xe60d
jmp 0xa960
leaq 0x3cee(%rip), %rdx      # 0xe63c
jmp 0xa960
leaq 0x3cf4(%rip), %rdx      # 0xe64b
jmp 0xa960
leaq 0x3cfd(%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