// File: /workspace/github_c_makefile_star2_O0/stetre[P]moonglmath/src/mat.c
// Function: Matfromvecs
static int Matfromvecs(lua_State *L, size_t nr, size_t nc, unsigned int row)
/* if row=1, expects all row vectors
 * if row=0, expects all column vectors
 */
    {
    size_t i,j, n;  
    mat_t m;
    vec_t v[4];
    size_t size[4];
    unsigned int isrow[4];
    
    for(i=0; i<4; i++)
        vec_clear(v[i]);
    
    n = row==1 ? nr : nc;
    for(i=0; i < n; i++)
        {
        if(testvec(L, i+1, v[i], &size[i], &isrow[i]) && (isrow[i] != row))
            return luaL_argerror(L, i+i, "expected all row or all column vectors");
        }

    if(row)
        {
        /* v[i] = i-th row */
        for(i=0; i<nr; i++)
            for(j=0; j<nc; j++)
                m[i][j] = v[i][j];
        }
    else
        {
        /* v[j] = j-th column */
        for(i=0; i<nr; i++)
            for(j=0; j<nc; j++)
                m[i][j] = v[j][i];
        }
    return pushmat(L, m, nr, nc, nr, nc);
    }

// Assembly:
subq $0x188, %rsp            # imm = 0x188
movq %rdi, 0x178(%rsp)
movq %rsi, 0x170(%rsp)
movq %rdx, 0x168(%rsp)
movl %ecx, 0x164(%rsp)
movq $0x0, 0x158(%rsp)
cmpq $0x4, 0x158(%rsp)
jae 0x18363
movq 0x158(%rsp), %rax
leaq 0x40(%rsp), %rdi
shlq $0x5, %rax
addq %rax, %rdi
xorl %esi, %esi
movl $0x20, %edx
callq 0x8530
movq 0x158(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x158(%rsp)
jmp 0x18322
cmpl $0x1, 0x164(%rsp)
jne 0x1837c
movq 0x170(%rsp), %rax
movq %rax, 0x8(%rsp)
jmp 0x18389
movq 0x168(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x8(%rsp), %rax
movq %rax, 0x148(%rsp)
movq $0x0, 0x158(%rsp)
movq 0x158(%rsp), %rax
cmpq 0x148(%rsp), %rax
jae 0x18476
movq 0x178(%rsp), %rdi
movq 0x158(%rsp), %rax
addq $0x1, %rax
movl %eax, %esi
movq 0x158(%rsp), %rax
leaq 0x40(%rsp), %rdx
shlq $0x5, %rax
addq %rax, %rdx
movq 0x158(%rsp), %rax
leaq 0x20(%rsp), %rcx
shlq $0x3, %rax
addq %rax, %rcx
movq 0x158(%rsp), %rax
leaq 0x10(%rsp), %r8
shlq $0x2, %rax
addq %rax, %r8
callq 0x8b00
cmpl $0x0, %eax
je 0x1845b
movq 0x158(%rsp), %rax
movl 0x10(%rsp,%rax,4), %eax
cmpl 0x164(%rsp), %eax
je 0x1845b
movq 0x178(%rsp), %rdi
movq 0x158(%rsp), %rax
addq 0x158(%rsp), %rax
movl %eax, %esi
leaq 0xb218(%rip), %rdx      # 0x23662
callq 0x81b0
movl %eax, 0x184(%rsp)
jmp 0x18633
jmp 0x1845d
movq 0x158(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x158(%rsp)
jmp 0x183a2
cmpl $0x0, 0x164(%rsp)
je 0x1853f
movq $0x0, 0x158(%rsp)
movq 0x158(%rsp), %rax
cmpq 0x170(%rsp), %rax
jae 0x1853a
movq $0x0, 0x150(%rsp)
movq 0x150(%rsp), %rax
cmpq 0x168(%rsp), %rax
jae 0x1851f
movq 0x158(%rsp), %rcx
leaq 0x40(%rsp), %rax
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x150(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq 0x158(%rsp), %rcx
leaq 0xc0(%rsp), %rax
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x150(%rsp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movq 0x150(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x150(%rsp)
jmp 0x184b2
jmp 0x18521
movq 0x158(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x158(%rsp)
jmp 0x18490
jmp 0x185f7
movq $0x0, 0x158(%rsp)
movq 0x158(%rsp), %rax
cmpq 0x170(%rsp), %rax
jae 0x185f5
movq $0x0, 0x150(%rsp)
movq 0x150(%rsp), %rax
cmpq 0x168(%rsp), %rax
jae 0x185da
movq 0x150(%rsp), %rcx
leaq 0x40(%rsp), %rax
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x158(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq 0x158(%rsp), %rcx
leaq 0xc0(%rsp), %rax
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x150(%rsp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movq 0x150(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x150(%rsp)
jmp 0x1856d
jmp 0x185dc
movq 0x158(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x158(%rsp)
jmp 0x1854b
jmp 0x185f7
movq 0x178(%rsp), %rdi
leaq 0xc0(%rsp), %rsi
movq 0x170(%rsp), %rdx
movq 0x168(%rsp), %rcx
movq 0x170(%rsp), %r8
movq 0x168(%rsp), %r9
callq 0x8500
movl %eax, 0x184(%rsp)
movl 0x184(%rsp), %eax
addq $0x188, %rsp            # imm = 0x188
retq
nopw %cs:(%rax,%rax)