// File: chiku[P]cmatrix/src/impl/matrix/numerical.cpp
// Function: cmatrix::Matrix<double> cmatrix::operator*<double>(cmatrix::Matrix<double>, cmatrix::Matrix<double>)
Matrix<Type> operator * (const Matrix<Type> firstMatrix, const Matrix<Type> secondMatrix)
{
    if (firstMatrix.columns() != secondMatrix.rows()) {
        throw Exception::IncompatibleMultiplication(ExceptionBody::IncompatibleMultiplication(firstMatrix.size, secondMatrix.size));
    }

    Matrix<Type> product(firstMatrix.rows(), secondMatrix.columns());

    for (int i = 0; i < firstMatrix.rows(); i++) {
        for (int j = 0; j < secondMatrix.columns(); j++) {
            product(i, j) = 0;
            for (int k = 0; k < firstMatrix.columns(); k++) {
                product(i, j) += firstMatrix(i, k) * secondMatrix(k, j);
            }
        }
    }

    return product;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xf0, %rsp
movq %rdx, -0x90(%rbp)
movq %rsi, -0xa8(%rbp)
movq %rdi, %rax
movq -0xa8(%rbp), %rdi
movq %rax, -0xa0(%rbp)
movq %rax, %rcx
movq %rcx, -0x98(%rbp)
movq %rax, -0x8(%rbp)
movq %rdi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
callq 0x10330
movq -0x90(%rbp), %rdi
movq %rax, -0x88(%rbp)
callq 0x10160
movq %rax, %rcx
movq -0x88(%rbp), %rax
cmpq %rcx, %rax
je 0x2069b
movb $0x1, -0x6d(%rbp)
movl $0x10, %edi
callq 0x61c0
movq -0xa8(%rbp), %rcx
movq %rax, %rdx
movq -0x90(%rbp), %rax
movq %rdx, -0xb0(%rbp)
movups (%rcx), %xmm0
movaps %xmm0, -0x50(%rbp)
movups (%rax), %xmm0
movaps %xmm0, -0x60(%rbp)
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rdx
movq -0x60(%rbp), %rcx
movq -0x58(%rbp), %r8
leaq -0x38(%rbp), %rdi
callq 0x21ca0
jmp 0x2062a
movq -0xb0(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x21e60
jmp 0x2063c
movq -0xb0(%rbp), %rdi
movb $0x0, -0x6d(%rbp)
leaq 0x661f2(%rip), %rsi     # 0x86840
leaq 0x184b(%rip), %rdx      # 0x21ea0
callq 0x6760
jmp 0x20889
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x20682
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x6230
testb $0x1, -0x6d(%rbp)
jne 0x2068a
jmp 0x20696
movq -0xb0(%rbp), %rdi
callq 0x62c0
jmp 0x20880
movq -0xa8(%rbp), %rdi
movb $0x0, -0x6e(%rbp)
callq 0x10160
movq -0x90(%rbp), %rdi
movq %rax, -0xb8(%rbp)
callq 0x10330
movq -0xa0(%rbp), %rdi
movq -0xb8(%rbp), %rsi
movq %rax, %rdx
callq 0x100e0
movl $0x0, -0x74(%rbp)
movq -0xa8(%rbp), %rdi
movslq -0x74(%rbp), %rax
movq %rax, -0xc0(%rbp)
callq 0x10160
movq %rax, %rcx
movq -0xc0(%rbp), %rax
cmpq %rcx, %rax
jge 0x2085a
movl $0x0, -0x78(%rbp)
movq -0x90(%rbp), %rdi
movslq -0x78(%rbp), %rax
movq %rax, -0xc8(%rbp)
callq 0x10330
movq %rax, %rcx
movq -0xc8(%rbp), %rax
cmpq %rcx, %rax
jge 0x2084a
movq -0xa0(%rbp), %rdi
movslq -0x74(%rbp), %rsi
movslq -0x78(%rbp), %rdx
callq 0x10370
movq %rax, -0xd0(%rbp)
jmp 0x20753
movq -0xd0(%rbp), %rax
xorps %xmm0, %xmm0
movsd %xmm0, (%rax)
movl $0x0, -0x7c(%rbp)
movq -0xa8(%rbp), %rdi
movslq -0x7c(%rbp), %rax
movq %rax, -0xd8(%rbp)
callq 0x10330
movq %rax, %rcx
movq -0xd8(%rbp), %rax
cmpq %rcx, %rax
jge 0x2083a
movq -0xa8(%rbp), %rdi
movslq -0x74(%rbp), %rsi
movslq -0x7c(%rbp), %rdx
callq 0x21ec0
movsd %xmm0, -0xe0(%rbp)
jmp 0x207b0
movq -0x90(%rbp), %rdi
movslq -0x7c(%rbp), %rsi
movslq -0x78(%rbp), %rdx
callq 0x21ec0
movsd %xmm0, -0xe8(%rbp)
jmp 0x207ce
movq -0xa0(%rbp), %rdi
movslq -0x74(%rbp), %rsi
movslq -0x78(%rbp), %rdx
callq 0x10370
movq %rax, -0xf0(%rbp)
jmp 0x207eb
movq -0xf0(%rbp), %rax
movsd -0xe8(%rbp), %xmm2
movsd -0xe0(%rbp), %xmm0
movsd (%rax), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%rax)
movl -0x7c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7c(%rbp)
jmp 0x20768
movq -0xa0(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
callq 0x105f0
jmp 0x20880
jmp 0x2083c
movl -0x78(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x78(%rbp)
jmp 0x2070c
jmp 0x2084c
movl -0x74(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x74(%rbp)
jmp 0x206db
movb $0x1, -0x6e(%rbp)
testb $0x1, -0x6e(%rbp)
jne 0x20870
movq -0xa0(%rbp), %rdi
callq 0x105f0
movq -0x98(%rbp), %rax
addq $0xf0, %rsp
popq %rbp
retq
movq -0x68(%rbp), %rdi
callq 0x67c0
nopl (%rax)