// File: /workspace/github_c_makefile_star2_O0/stetre[P]moonglmath/src/datahandling.c
// Function: moonglmath_testdata
int testdata(lua_State *L, int type, size_t n, void *dst, size_t dstsize)
/* expects, on top of the stack, a flat table containing n elements of the given type
 * dst must point to at least n * sizeoftype(type) bytes of memory, where
 * the data will be packed according to the given type
 */
    {
    int err = 0;
    switch(type)
        {
#define P(T) do { err = Pack##T(L, n, dst, dstsize, NULL); } while(0)
        case MOONGLMATH_TYPE_CHAR:   P(int8_t); break;
        case MOONGLMATH_TYPE_UCHAR:  P(uint8_t); break;
        case MOONGLMATH_TYPE_SHORT:  P(int16_t); break;
        case MOONGLMATH_TYPE_USHORT: P(uint16_t); break;
        case MOONGLMATH_TYPE_INT:    P(int32_t); break;
        case MOONGLMATH_TYPE_UINT:   P(uint32_t); break;
        case MOONGLMATH_TYPE_LONG:   P(int64_t); break;
        case MOONGLMATH_TYPE_ULONG:  P(uint64_t); break;
        case MOONGLMATH_TYPE_FLOAT:  P(float); break;
        case MOONGLMATH_TYPE_DOUBLE: P(double); break;
        default:
            return unexpected(L);
#undef P
        }
    return err;
    }

// Assembly:
subq $0x48, %rsp
movq %rdi, 0x38(%rsp)
movl %esi, 0x34(%rsp)
movq %rdx, 0x28(%rsp)
movq %rcx, 0x20(%rsp)
movq %r8, 0x18(%rsp)
movl $0x0, 0x14(%rsp)
movl 0x34(%rsp), %eax
decl %eax
movl %eax, %ecx
movq %rcx, 0x8(%rsp)
subl $0x9, %eax
ja 0xb400
movq 0x8(%rsp), %rax
leaq 0x17f82(%rip), %rcx     # 0x231e8
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
jmp 0xb271
movq 0x38(%rsp), %rdi
movq 0x28(%rsp), %rsi
movq 0x20(%rsp), %rdx
movq 0x18(%rsp), %rcx
xorl %eax, %eax
movl %eax, %r8d
callq 0xb440
movl %eax, 0x14(%rsp)
jmp 0xb425
jmp 0xb29a
movq 0x38(%rsp), %rdi
movq 0x28(%rsp), %rsi
movq 0x20(%rsp), %rdx
movq 0x18(%rsp), %rcx
xorl %eax, %eax
movl %eax, %r8d
callq 0xb550
movl %eax, 0x14(%rsp)
jmp 0xb425
jmp 0xb2c3
movq 0x38(%rsp), %rdi
movq 0x28(%rsp), %rsi
movq 0x20(%rsp), %rdx
movq 0x18(%rsp), %rcx
xorl %eax, %eax
movl %eax, %r8d
callq 0xb660
movl %eax, 0x14(%rsp)
jmp 0xb425
jmp 0xb2ec
movq 0x38(%rsp), %rdi
movq 0x28(%rsp), %rsi
movq 0x20(%rsp), %rdx
movq 0x18(%rsp), %rcx
xorl %eax, %eax
movl %eax, %r8d
callq 0xb770
movl %eax, 0x14(%rsp)
jmp 0xb425
jmp 0xb315
movq 0x38(%rsp), %rdi
movq 0x28(%rsp), %rsi
movq 0x20(%rsp), %rdx
movq 0x18(%rsp), %rcx
xorl %eax, %eax
movl %eax, %r8d
callq 0xb880
movl %eax, 0x14(%rsp)
jmp 0xb425
jmp 0xb33e
movq 0x38(%rsp), %rdi
movq 0x28(%rsp), %rsi
movq 0x20(%rsp), %rdx
movq 0x18(%rsp), %rcx
xorl %eax, %eax
movl %eax, %r8d
callq 0xb990
movl %eax, 0x14(%rsp)
jmp 0xb425
jmp 0xb367
movq 0x38(%rsp), %rdi
movq 0x28(%rsp), %rsi
movq 0x20(%rsp), %rdx
movq 0x18(%rsp), %rcx
xorl %eax, %eax
movl %eax, %r8d
callq 0xbaa0
movl %eax, 0x14(%rsp)
jmp 0xb425
jmp 0xb390
movq 0x38(%rsp), %rdi
movq 0x28(%rsp), %rsi
movq 0x20(%rsp), %rdx
movq 0x18(%rsp), %rcx
xorl %eax, %eax
movl %eax, %r8d
callq 0xbbb0
movl %eax, 0x14(%rsp)
jmp 0xb425
jmp 0xb3b6
movq 0x38(%rsp), %rdi
movq 0x28(%rsp), %rsi
movq 0x20(%rsp), %rdx
movq 0x18(%rsp), %rcx
xorl %eax, %eax
movl %eax, %r8d
callq 0xbcc0
movl %eax, 0x14(%rsp)
jmp 0xb425
jmp 0xb3dc
movq 0x38(%rsp), %rdi
movq 0x28(%rsp), %rsi
movq 0x20(%rsp), %rdx
movq 0x18(%rsp), %rcx
xorl %eax, %eax
movl %eax, %r8d
callq 0xbdd0
movl %eax, 0x14(%rsp)
jmp 0xb425
movq 0x38(%rsp), %rdi
leaq 0x17c68(%rip), %rsi     # 0x23074
leaq 0x17e4d(%rip), %rdx     # 0x23260
movl $0x130, %ecx            # imm = 0x130
movb $0x0, %al
callq 0x8b30
movl %eax, 0x44(%rsp)
jmp 0xb42d
movl 0x14(%rsp), %eax
movl %eax, 0x44(%rsp)
movl 0x44(%rsp), %eax
addq $0x48, %rsp
retq
nopw %cs:(%rax,%rax)