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

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

    for (int i = 0; i < firstMatrix.rows(); i++) {
        for (int j = 0; j < firstMatrix.columns(); j++) {
            sum.access(i, j) = firstMatrix.access(i, j) + secondMatrix.access(i, j);
        }
    }

    return sum;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x140, %rsp            # imm = 0x140
movq %rdx, -0x110(%rbp)
movq %rsi, %rax
movq -0x110(%rbp), %rsi
movq %rax, -0x108(%rbp)
movq %rdi, %rax
movq -0x108(%rbp), %rdi
movq %rax, -0x100(%rbp)
movq %rax, %rcx
movq %rcx, -0xf8(%rbp)
movq %rax, -0x8(%rbp)
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
callq 0x12600
testb $0x1, %al
jne 0x30658
jmp 0x30718
movb $0x1, -0x6d(%rbp)
movl $0x10, %edi
callq 0x61c0
movq -0x108(%rbp), %rcx
movq %rax, %rdx
movq -0x110(%rbp), %rax
movq %rdx, -0x118(%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 0x2fa10
jmp 0x306a7
movq -0x118(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x2fbd0
jmp 0x306b9
movq -0x118(%rbp), %rdi
movb $0x0, -0x6d(%rbp)
leaq 0x561b5(%rip), %rsi     # 0x86880
leaq -0xac2(%rip), %rdx      # 0x2fc10
callq 0x6760
jmp 0x30917
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x306ff
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 0x30707
jmp 0x30713
movq -0x118(%rbp), %rdi
callq 0x62c0
jmp 0x3090e
movq -0x108(%rbp), %rdi
movb $0x0, -0x6e(%rbp)
callq 0x14450
movq -0x108(%rbp), %rdi
movq %rax, -0x120(%rbp)
callq 0x14470
movq -0x100(%rbp), %rdi
movq -0x120(%rbp), %rsi
movq %rax, %rdx
callq 0x14030
movl $0x0, -0x74(%rbp)
movq -0x108(%rbp), %rdi
movslq -0x74(%rbp), %rax
movq %rax, -0x128(%rbp)
callq 0x14450
movq %rax, %rcx
movq -0x128(%rbp), %rax
cmpq %rcx, %rax
jge 0x308dc
movl $0x0, -0x78(%rbp)
movq -0x108(%rbp), %rdi
movslq -0x78(%rbp), %rax
movq %rax, -0x130(%rbp)
callq 0x14470
movq %rax, %rcx
movq -0x130(%rbp), %rax
cmpq %rcx, %rax
jge 0x308cc
movq -0x108(%rbp), %rsi
movslq -0x74(%rbp), %rdx
movslq -0x78(%rbp), %rcx
leaq -0xc8(%rbp), %rdi
callq 0x18a20
jmp 0x307d0
movq -0x110(%rbp), %rsi
movslq -0x74(%rbp), %rdx
movslq -0x78(%rbp), %rcx
leaq -0xf0(%rbp), %rdi
callq 0x18a20
jmp 0x307ed
leaq -0xa0(%rbp), %rdi
leaq -0xc8(%rbp), %rsi
leaq -0xf0(%rbp), %rdx
callq 0x2f530
jmp 0x30809
movq -0x100(%rbp), %rdi
movslq -0x74(%rbp), %rsi
movslq -0x78(%rbp), %rdx
callq 0x14dc0
movq %rax, -0x138(%rbp)
jmp 0x30826
movq -0x138(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x11f00
jmp 0x3083b
leaq -0xa0(%rbp), %rdi
callq 0x105f0
leaq -0xf0(%rbp), %rdi
callq 0x105f0
leaq -0xc8(%rbp), %rdi
callq 0x105f0
movl -0x78(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x78(%rbp)
jmp 0x30789
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x30902
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x308be
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x308b2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x105f0
leaq -0xf0(%rbp), %rdi
callq 0x105f0
leaq -0xc8(%rbp), %rdi
callq 0x105f0
jmp 0x30902
jmp 0x308ce
movl -0x74(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x74(%rbp)
jmp 0x30758
movb $0x1, -0x6e(%rbp)
testb $0x1, -0x6e(%rbp)
jne 0x308f2
movq -0x100(%rbp), %rdi
callq 0x14170
movq -0xf8(%rbp), %rax
addq $0x140, %rsp            # imm = 0x140
popq %rbp
retq
movq -0x100(%rbp), %rdi
callq 0x14170
movq -0x68(%rbp), %rdi
callq 0x67c0
nopw (%rax,%rax)