// File: /workspace/github_cpp_makefile_star2_O3/btbujiangjun[P]abcdl/src/algebra/MatrixOperator.cpp
// Function: abcdl::algebra::Matrix<int>::operator+=(abcdl::algebra::Matrix<int> const&)
Matrix<T>& Matrix<T>::operator += (const Matrix<T>& mat){
    if(get_size() == 0){
        set_data(mat);
        return *this;
    }

    CHECK(equal_shape(mat) 
          || (_cols == mat.cols() && mat.rows() == 1)
          || (_rows == mat.rows() && mat.cols() == 1));
    
    if(equal_shape(mat) || (_cols == mat.cols() && mat.rows() == 1)){
        auto lambda = [](T* a, const T& b){*a += b;};
        _po.parallel_mul2mul_repeat(_data, get_size(), mat.data(), mat.get_size(), lambda);
    }else{
        for(size_t i = 0; i < _rows; i++){
            T value = mat.get_data(i, 0);
            for(size_t j = 0; j < _cols; j++){
                set_data(get_data(i, j) + value, i, j);
            }
        }
    }
    return *this;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x198, %rsp            # imm = 0x198
movq %rsi, %r10
movq %rdi, %rbx
movq (%rdi), %rdx
movq 0x8(%rdi), %rax
movq %rax, %rcx
imulq %rdx, %rcx
testq %rcx, %rcx
je 0x1f493
movq (%r10), %r8
movq 0x8(%r10), %r9
cmpq %r8, %rdx
sete %cl
cmpq %r9, %rax
sete %sil
cmpq $0x1, %r8
sete %dil
orb %cl, %dil
andb %sil, %dil
cmpq $0x1, %r9
sete %sil
andb %cl, %sil
orb %dil, %sil
jne 0x1f416
movq %r10, %r14
leaq 0x1d720(%rip), %rsi     # 0x3caf0
leaq 0x10(%rsp), %r15
movq %r15, %rdi
movl $0x72, %edx
movl $0x3, %ecx
callq 0x387b6
leaq 0x1d721(%rip), %rsi     # 0x3cb0f
movl $0x76, %edx
movq %r15, %rdi
callq 0x93b0
leaq 0x10(%rsp), %rdi
callq 0x389de
movq (%rbx), %rdx
movq 0x8(%rbx), %rax
movq %r14, %r10
movq (%r14), %r8
movq 0x8(%r14), %r9
cmpq %r8, %rdx
setne %cl
cmpq $0x1, %r8
setne %sil
testb %sil, %cl
jne 0x1f4f9
cmpq %r9, %rax
jne 0x1f4f9
leaq 0x18(%rbx), %rdi
movq 0x10(%rbx), %rsi
imulq %r9, %rdx
movq 0x10(%r10), %rcx
imulq %r9, %r8
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %r9
movaps %xmm0, (%r9)
leaq 0x9211(%rip), %rax      # 0x2866e
movq %rax, 0x18(%r9)
leaq 0x920e(%rip), %rax      # 0x28676
movq %rax, 0x10(%r9)
callq 0xad06
movq 0x20(%rsp), %rax
testq %rax, %rax
je 0x1f67d
leaq 0x10(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
jmp 0x1f67d
movq 0x10(%r10), %r15
movq (%r10), %r12
movq 0x8(%r10), %r13
movq %r13, %r14
imulq %r12, %r14
movq 0x10(%rbx), %rdi
testq %r14, %r14
je 0x1f4de
testq %rdi, %rdi
je 0x1f4b8
callq 0x9420
movq %r14, %rax
shrq $0x3e, %rax
leaq (,%r14,4), %rcx
xorl %edi, %edi
negq %rax
sbbq %rdi, %rdi
orq %rcx, %rdi
callq 0x9030
movq %rax, %rdi
movq %rax, 0x10(%rbx)
movq %r12, (%rbx)
movq %r13, 0x8(%rbx)
shlq $0x2, %r14
movq %r15, %rsi
movq %r14, %rdx
callq 0x92b0
jmp 0x1f67d
testq %rdx, %rdx
je 0x1f67d
xorl %r14d, %r14d
leaq 0x1cf41(%rip), %rsi     # 0x3c44d
leaq 0x10(%rsp), %rdi
movq %rax, %rcx
movq 0x8(%r10), %rdx
movq %rdx, %r15
imulq %r14, %r15
imulq (%r10), %rdx
cmpq %rdx, %r15
jae 0x1f634
testq %rcx, %rcx
je 0x1f624
movq 0x10(%r10), %rdx
movl (%rdx,%r15,4), %r15d
xorl %r13d, %r13d
movq %r14, %rbp
imulq %rcx, %rbp
addq %r13, %rbp
movq (%rbx), %rdx
imulq %rdx, %rcx
cmpq %rcx, %rbp
jae 0x1f587
movq 0x10(%rbx), %rcx
movl (%rcx,%rbp,4), %ebp
addl %r15d, %ebp
movq %r14, %r12
imulq %rax, %r12
addq %r13, %r12
imulq %rax, %rdx
cmpq %rdx, %r12
jae 0x1f5d2
movl %ebp, (%rcx,%r12,4)
incq %r13
movq %rax, %rcx
cmpq %rax, %r13
jb 0x1f540
jmp 0x1f626
movq %r10, 0x8(%rsp)
movq %rdi, %r12
movl $0x44, %edx
movl $0x3, %ecx
callq 0x387b6
movl $0x1f, %edx
movq %r12, %rdi
leaq 0x1cf73(%rip), %rsi     # 0x3c520
callq 0x93b0
movq %r12, %rdi
callq 0x389de
movq (%rbx), %rdx
movq 0x8(%rbx), %rax
movq 0x8(%rsp), %r10
leaq 0x1ce80(%rip), %rsi     # 0x3c44d
movq %r12, %rdi
jmp 0x1f556
movq %r10, 0x8(%rsp)
movl $0x50, %edx
movl $0x3, %ecx
callq 0x387b6
movl $0x1f, %edx
leaq 0x10(%rsp), %rdi
leaq 0x1cf29(%rip), %rsi     # 0x3c520
callq 0x93b0
leaq 0x10(%rsp), %rdi
callq 0x389de
movq 0x8(%rbx), %rax
movq 0x10(%rbx), %rcx
movq 0x8(%rsp), %r10
leaq 0x1ce33(%rip), %rsi     # 0x3c44d
leaq 0x10(%rsp), %rdi
jmp 0x1f573
xorl %ecx, %ecx
incq %r14
cmpq (%rbx), %r14
jb 0x1f514
jmp 0x1f67d
movq %r10, %r12
movq %rdi, %rbp
movq %rsi, %r13
movl $0x44, %edx
movl $0x3, %ecx
callq 0x387b6
movl $0x1f, %edx
movq %rbp, %rdi
leaq 0x1cec5(%rip), %rsi     # 0x3c520
callq 0x93b0
movq %rbp, %rdi
callq 0x389de
movq 0x8(%rbx), %rax
movq %rax, %rcx
movq %r12, %r10
movq %r13, %rsi
movq %rbp, %rdi
jmp 0x1f52c
movq %rbx, %rax
addq $0x198, %rsp            # imm = 0x198
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1f698
jmp 0x1f698
jmp 0x1f698
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x389de
jmp 0x1f6c5
jmp 0x1f6cd
movq %rax, %rbx
movq 0x20(%rsp), %rax
testq %rax, %rax
je 0x1f6c5
leaq 0x10(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq %rbx, %rdi
callq 0x95d0
movq %rax, %rdi
callq 0x10f91
nop