// File: /workspace/github_c_makefile_star2_O2/stetre[P]moonglmath/src/mat.c
// Function: Mat
static int Mat(lua_State *L, size_t nr, size_t nc)
/* mat()  -> square identity
 * mat(m)  m=matrix (any size)
 * mat(v1,...,vnr) nr row vectors,
 * mat(v1,...,vnc) nc column vectors,
 * mat(val1, val2, ...)  values in row-major order
 */
    {
    mat_t m;
    size_t mr, mc, i, j, arg;
    unsigned int isrow;
    checkmatsize(L, nr, nc);
    arg = 1;
    if(lua_isnoneornil(L, arg)) /* square identity (or all zeros if nr != nc) */
        {
        mat_clear(m);
        if(nr == nc)
            for(i = 0; i< nr; i++) m[i][i] = 1;
        return pushmat(L, m, nr, nc, nr, nc);
        }

    if(testmat(L, arg, m, &mr, &mc)) /* initialization from matrix */
        return pushmat(L, m, mr, mc, nr, nc);

    if(testvec(L, arg, NULL, NULL, &isrow)) /*initialization from vectors */
        return Matfromvecs(L, nr, nc, isrow);

    checkmatsize(L, nr, nc);
    for(i = 0; i < nr; i++)
        for(j = 0; j < nc; j++)
            m[i][j] = luaL_optnumber(L, arg++, 0);
    return pushmat(L, m, nr, nc, nr, nc);
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1f8, %rsp            # imm = 0x1F8
movq %rdx, %rbx
movq %rsi, %r13
movq %rdi, %r15
pushq $0x1
popq %rsi
callq 0x8cf0
testl %eax, %eax
jle 0x102ad
pushq $0x1
popq %rsi
leaq 0x40(%rsp), %r12
leaq 0x38(%rsp), %rcx
leaq 0x30(%rsp), %r8
movq %r15, %rdi
movq %r12, %rdx
callq 0x8a00
testl %eax, %eax
je 0x10312
movq 0x38(%rsp), %rdx
movq 0x30(%rsp), %rcx
leaq 0x40(%rsp), %rsi
movq %r15, %rdi
jmp 0x1047e
xorps %xmm0, %xmm0
movaps %xmm0, 0xb0(%rsp)
movaps %xmm0, 0xa0(%rsp)
movaps %xmm0, 0x90(%rsp)
movaps %xmm0, 0x80(%rsp)
movaps %xmm0, 0x70(%rsp)
movaps %xmm0, 0x60(%rsp)
movaps %xmm0, 0x50(%rsp)
movaps %xmm0, 0x40(%rsp)
cmpq %rbx, %r13
jne 0x10470
leaq 0x40(%rsp), %rax
movabsq $0x3ff0000000000000, %rcx # imm = 0x3FF0000000000000
movq %r13, %rdx
subq $0x1, %rdx
jb 0x10470
movq %rcx, (%rax)
addq $0x28, %rax
jmp 0x102ff
pushq $0x1
popq %rbp
leaq 0x24(%rsp), %r8
movq %r15, %rdi
movl %ebp, %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x8ad0
testl %eax, %eax
movq %r13, 0x10(%rsp)
je 0x10429
movl 0x24(%rsp), %eax
movl %eax, 0xc(%rsp)
xorl %eax, %eax
xorps %xmm0, %xmm0
cmpq $0x80, %rax
je 0x10360
movaps %xmm0, 0xe0(%rsp,%rax)
movaps %xmm0, 0xd0(%rsp,%rax)
addq $0x20, %rax
jmp 0x10342
cmpl $0x1, 0xc(%rsp)
movq %rbx, %rax
cmoveq %r13, %rax
movq %rax, 0x28(%rsp)
xorl %ebp, %ebp
leaq 0xc0(%rsp), %r13
leaq 0x150(%rsp), %rcx
leaq 0xd0(%rsp), %rdx
xorl %r12d, %r12d
cmpq %r12, 0x28(%rsp)
je 0x103db
leal 0x1(%r12), %esi
movq %r15, %rdi
movq %rdx, 0x18(%rsp)
movq %rcx, %r14
movq %r13, %r8
callq 0x8ad0
testl %eax, %eax
je 0x103bf
movl 0xc(%rsp), %eax
cmpl %eax, (%r13)
jne 0x1049b
addl $0x2, %ebp
addq $0x4, %r13
movq %r14, %rcx
addq $0x8, %rcx
movq 0x18(%rsp), %rdx
addq $0x20, %rdx
incq %r12
jmp 0x1038e
cmpl $0x0, 0xc(%rsp)
je 0x104ae
leaq 0x170(%rsp), %rax
leaq 0xd0(%rsp), %rcx
xorl %edx, %edx
movq 0x10(%rsp), %r8
cmpq %r8, %rdx
je 0x104f3
xorl %esi, %esi
cmpq %rsi, %rbx
je 0x1041c
movsd (%rcx,%rsi,8), %xmm0
movsd %xmm0, (%rax,%rsi,8)
incq %rsi
jmp 0x10408
incq %rdx
addq $0x20, %rax
addq $0x20, %rcx
jmp 0x103fd
xorl %r14d, %r14d
cmpq %r13, %r14
je 0x10470
movl %ebp, 0x18(%rsp)
movl %ebp, %ebp
xorl %r13d, %r13d
cmpq %r13, %rbx
je 0x1045b
movq %rbp, %rsi
addq %r13, %rsi
xorps %xmm0, %xmm0
movq %r15, %rdi
callq 0x8370
movsd %xmm0, (%r12,%r13,8)
incq %r13
jmp 0x1043a
incq %r14
addq $0x20, %r12
movl 0x18(%rsp), %ebp
addl %r13d, %ebp
movq 0x10(%rsp), %r13
jmp 0x1042c
leaq 0x40(%rsp), %rsi
movq %r15, %rdi
movq %r13, %rdx
movq %rbx, %rcx
movq %r13, %r8
movq %rbx, %r9
callq 0x8500
addq $0x1f8, %rsp            # imm = 0x1F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x61fe(%rip), %rdx      # 0x166a0
movq %r15, %rdi
movl %ebp, %esi
callq 0x81c0
jmp 0x10489
leaq 0x170(%rsp), %rax
leaq 0xd0(%rsp), %rcx
xorl %edx, %edx
movq 0x10(%rsp), %r8
cmpq %r8, %rdx
je 0x104f3
movq %rcx, %rsi
xorl %edi, %edi
cmpq %rdi, %rbx
je 0x104e6
movsd (%rsi), %xmm0
movsd %xmm0, (%rax,%rdi,8)
incq %rdi
addq $0x20, %rsi
jmp 0x104cf
incq %rdx
addq $0x20, %rax
addq $0x8, %rcx
jmp 0x104c5
leaq 0x170(%rsp), %rsi
movq %r15, %rdi
movq %r8, %rdx
movq %rbx, %rcx
jmp 0x10481