// File: /workspace/github_c_makefile_star2_O1/stetre[P]moonglmath/src/mat.c
// Function: Mul
static int Mul(lua_State *L)
    {
    size_t i, j, k, nr1, nc1, nr2, nc2;
    mat_t m, m1, m2;
    double s;
    if(lua_isnumber(L, 1))
        return Mxs(L, 1, 2);
    if(lua_isnumber(L, 2))
        return Mxs(L, 2, 1);
    if(testvec(L, 2, NULL, NULL, NULL))
        return Mxv(L);
    /* matrix product  NxK * KxM -> NxM  (with N,K,M  != 1) */
    checkmat(L, 1, m1, &nr1, &nc1);
    checkmat(L, 2, m2, &nr2, &nc2);
    if((nc1 != nr2))
        return luaL_error(L, OPERANDS_ERROR);
    for(i=0; i < nr1; i++)
        for(j=0; j < nc2; j++)
            {
            s = 0;
            for(k=0; k < nc1; k++)
                s += m1[i][k] * m2[k][j];
            m[i][j] = s;
            }
    pushmat(L, m, nr1, nc2, nr1, nc2);
    return 1;
    }

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1a0, %rsp            # imm = 0x1A0
movq %rdi, %rbx
movl $0x1, %esi
callq 0x8560
testl %eax, %eax
je 0x101cb
movq %rbx, %rdi
movl $0x1, %esi
movl $0x2, %edx
jmp 0x101e9
movq %rbx, %rdi
movl $0x2, %esi
callq 0x8560
testl %eax, %eax
je 0x101fe
movq %rbx, %rdi
movl $0x2, %esi
movl $0x1, %edx
addq $0x1a0, %rsp            # imm = 0x1A0
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x10787
movq %rbx, %rdi
movl $0x2, %esi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x8a50
testl %eax, %eax
je 0x102e5
leaq 0x120(%rsp), %r14
leaq 0x8(%rsp), %rcx
leaq 0x18(%rsp), %r8
movq %rbx, %rdi
movl $0x1, %esi
movq %r14, %rdx
callq 0x8520
leaq 0xa0(%rsp), %rdx
leaq 0x10(%rsp), %rcx
movq %rsp, %r15
movq %rbx, %rdi
movl $0x2, %esi
movq %r15, %r8
callq 0x8670
cmpl $0x0, (%r15)
jne 0x102ca
movq 0x10(%rsp), %rcx
cmpq 0x18(%rsp), %rcx
jne 0x102ca
movq 0x8(%rsp), %rax
testq %rax, %rax
je 0x102b2
xorl %edx, %edx
xorpd %xmm0, %xmm0
testq %rcx, %rcx
je 0x102a0
xorl %esi, %esi
movsd (%r14,%rsi,8), %xmm1
mulsd 0xa0(%rsp,%rsi,8), %xmm1
addsd %xmm1, %xmm0
incq %rsi
cmpq %rsi, %rcx
jne 0x10285
movsd %xmm0, 0x20(%rsp,%rdx,8)
incq %rdx
addq $0x20, %r14
cmpq %rax, %rdx
jne 0x1027a
leaq 0x20(%rsp), %rsi
movq %rbx, %rdi
movq %rcx, %rdx
xorl %r8d, %r8d
callq 0x82e0
jmp 0x103ea
leaq 0x736c(%rip), %rsi      # 0x1763d
leaq 0x737f(%rip), %rdx      # 0x17657
movq %rbx, %rdi
movl $0x270, %ecx            # imm = 0x270
jmp 0x103e3
leaq 0xa0(%rsp), %r14
leaq 0x8(%rsp), %rcx
leaq 0x18(%rsp), %r12
movq %rbx, %rdi
movl $0x1, %esi
movq %r14, %rdx
movq %r12, %r8
callq 0x8520
leaq 0x20(%rsp), %r15
leaq 0x10(%rsp), %r13
movq %rsp, %r8
movq %rbx, %rdi
movl $0x2, %esi
movq %r15, %rdx
movq %r13, %rcx
callq 0x8520
movq (%r12), %rax
cmpq (%r13), %rax
jne 0x103cd
movq 0x8(%rsp), %rdx
testq %rdx, %rdx
je 0x103ac
movq (%rsp), %rcx
xorl %esi, %esi
testq %rcx, %rcx
je 0x103a0
movq %rsi, %rdi
shlq $0x5, %rdi
addq %rsp, %rdi
addq $0x120, %rdi            # imm = 0x120
movq %r15, %r8
xorl %r9d, %r9d
xorpd %xmm0, %xmm0
testq %rax, %rax
je 0x1038e
movq %r8, %r10
xorl %r11d, %r11d
movsd (%r14,%r11,8), %xmm1
mulsd (%r10), %xmm1
addsd %xmm1, %xmm0
incq %r11
addq $0x20, %r10
cmpq %r11, %rax
jne 0x10373
movsd %xmm0, (%rdi,%r9,8)
incq %r9
addq $0x8, %r8
cmpq %rcx, %r9
jne 0x10364
incq %rsi
addq $0x20, %r14
cmpq %rdx, %rsi
jne 0x10348
movq (%rsp), %rcx
leaq 0x120(%rsp), %rsi
movq %rbx, %rdi
movq %rdx, %r8
movq %rcx, %r9
callq 0x84d0
movl $0x1, %eax
jmp 0x103ea
leaq 0x7269(%rip), %rsi      # 0x1763d
leaq 0x727c(%rip), %rdx      # 0x17657
movq %rbx, %rdi
movl $0x28c, %ecx            # imm = 0x28C
xorl %eax, %eax
callq 0x8a80
addq $0x1a0, %rsp            # imm = 0x1A0
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq