// File: /workspace/github_c_makefile_star2_O3/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 0x10215
movq %rbx, %rdi
movl $0x1, %esi
movl $0x2, %edx
jmp 0x10233
movq %rbx, %rdi
movl $0x2, %esi
callq 0x8560
testl %eax, %eax
je 0x10248
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 0x107d2
movq %rbx, %rdi
movl $0x2, %esi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x8a50
testl %eax, %eax
je 0x1032e
leaq 0x120(%rsp), %r14
movq %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
leaq 0x8(%rsp), %r15
movq %rbx, %rdi
movl $0x2, %esi
movq %r15, %r8
callq 0x8670
cmpl $0x0, (%r15)
jne 0x10313
movq 0x10(%rsp), %rcx
cmpq 0x18(%rsp), %rcx
jne 0x10313
movq (%rsp), %rax
testq %rax, %rax
je 0x102fb
xorl %edx, %edx
xorpd %xmm0, %xmm0
testq %rcx, %rcx
je 0x102e9
xorl %esi, %esi
movsd (%r14,%rsi,8), %xmm1
mulsd 0xa0(%rsp,%rsi,8), %xmm1
addsd %xmm1, %xmm0
incq %rsi
cmpq %rsi, %rcx
jne 0x102ce
movsd %xmm0, 0x20(%rsp,%rdx,8)
incq %rdx
addq $0x20, %r14
cmpq %rax, %rdx
jne 0x102c3
leaq 0x20(%rsp), %rsi
movq %rbx, %rdi
movq %rcx, %rdx
xorl %r8d, %r8d
callq 0x82e0
jmp 0x1042f
leaq 0x7323(%rip), %rsi      # 0x1763d
leaq 0x7336(%rip), %rdx      # 0x17657
movq %rbx, %rdi
movl $0x270, %ecx            # imm = 0x270
jmp 0x10428
leaq 0xa0(%rsp), %r14
movq %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
leaq 0x8(%rsp), %r8
movq %rbx, %rdi
movl $0x2, %esi
movq %r15, %rdx
movq %r13, %rcx
callq 0x8520
movq (%r12), %rax
cmpq (%r13), %rax
jne 0x10412
movq (%rsp), %rdx
movq 0x8(%rsp), %rcx
testq %rdx, %rdx
je 0x103f5
xorl %esi, %esi
testq %rcx, %rcx
je 0x103e9
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 0x103d7
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 0x103bc
movsd %xmm0, (%rdi,%r9,8)
incq %r9
addq $0x8, %r8
cmpq %rcx, %r9
jne 0x103ad
incq %rsi
addq $0x20, %r14
cmpq %rdx, %rsi
jne 0x10391
leaq 0x120(%rsp), %rsi
movq %rbx, %rdi
movq %rdx, %r8
movq %rcx, %r9
callq 0x84d0
movl $0x1, %eax
jmp 0x1042f
leaq 0x7224(%rip), %rsi      # 0x1763d
leaq 0x7237(%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