// File: /workspace/github_cpp_makefile_star2_O1/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 0x1f780
movq (%r10), %rcx
movq 0x8(%r10), %rsi
cmpq %rcx, %rdx
sete %dl
cmpq %rsi, %rax
sete %al
cmpq $0x1, %rcx
sete %cl
orb %dl, %cl
andb %al, %cl
cmpq $0x1, %rsi
sete %al
andb %dl, %al
orb %cl, %al
jne 0x1f6f3
movq %r10, %r14
leaq 0x1d435(%rip), %rsi     # 0x3caf0
leaq 0x10(%rsp), %r15
movq %r15, %rdi
movl $0x72, %edx
movl $0x3, %ecx
callq 0x3894e
leaq 0x1d436(%rip), %rsi     # 0x3cb0f
movl $0x76, %edx
movq %r15, %rdi
callq 0x93b0
leaq 0x10(%rsp), %rdi
callq 0x38b76
movq %r14, %r10
movq (%rbx), %rcx
movq 0x8(%rbx), %rdx
movq (%r10), %rax
movq 0x8(%r10), %r8
cmpq %rax, %rcx
sete %sil
cmpq %r8, %rdx
sete %dil
cmpq $0x1, %rax
sete %r9b
orb %sil, %r9b
testb %dil, %r9b
je 0x1f7e7
leaq 0x18(%rbx), %rdi
movq 0x10(%rbx), %rsi
imulq %rcx, %rdx
movq 0x10(%r10), %rcx
imulq %rax, %r8
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %r9
movaps %xmm0, (%r9)
leaq 0x908c(%rip), %rax      # 0x287d6
movq %rax, 0x18(%r9)
leaq 0x9089(%rip), %rax      # 0x287de
movq %rax, 0x10(%r9)
callq 0xada2
movq 0x20(%rsp), %rax
testq %rax, %rax
je 0x1f968
leaq 0x10(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
jmp 0x1f968
movq 0x10(%r10), %r15
movq (%r10), %r12
movq 0x8(%r10), %r13
movq %r13, %r14
imulq %r12, %r14
cmpq %r14, %rcx
je 0x1f7c8
movq 0x10(%rbx), %rdi
testq %rdi, %rdi
je 0x1f7a5
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, 0x10(%rbx)
movq %r12, (%rbx)
movq %r13, 0x8(%rbx)
movq 0x10(%rbx), %rdi
shlq $0x2, %r14
movq %r15, %rsi
movq %r14, %rdx
callq 0x92b0
jmp 0x1f968
cmpq $0x0, (%rbx)
je 0x1f968
xorl %r14d, %r14d
leaq 0x1cc52(%rip), %rsi     # 0x3c44d
leaq 0x10(%rsp), %rdx
movq 0x8(%r10), %rax
movq %rax, %r15
imulq %r14, %r15
imulq (%r10), %rax
cmpq %rax, %r15
jae 0x1f923
movq 0x8(%rbx), %rax
testq %rax, %rax
je 0x1f915
movq 0x10(%r10), %rcx
movl (%rcx,%r15,4), %r15d
xorl %r13d, %r13d
movq %r14, %r12
imulq %rax, %r12
addq %r13, %r12
imulq (%rbx), %rax
cmpq %rax, %r12
jae 0x1f87e
movq 0x8(%rbx), %rax
movq 0x10(%rbx), %rcx
movl (%rcx,%r12,4), %r12d
addl %r15d, %r12d
movq %r14, %rbp
imulq %rax, %rbp
addq %r13, %rbp
imulq (%rbx), %rax
cmpq %rax, %rbp
jae 0x1f8c8
movq 0x10(%rbx), %rax
movl %r12d, (%rax,%rbp,4)
incq %r13
movq 0x8(%rbx), %rax
cmpq %rax, %r13
jb 0x1f830
jmp 0x1f915
movq %r10, 0x8(%rsp)
movq %rdx, %rbp
movq %rdx, %rdi
movl $0x44, %edx
movl $0x3, %ecx
callq 0x3894e
movl $0x1f, %edx
movq %rbp, %rdi
leaq 0x1cc79(%rip), %rsi     # 0x3c520
callq 0x93b0
movq %rbp, %rdi
callq 0x38b76
movq 0x8(%rsp), %r10
leaq 0x1cb8d(%rip), %rsi     # 0x3c44d
movq %rbp, %rdx
jmp 0x1f843
movq %r10, 0x8(%rsp)
movq %rdx, %rdi
movl $0x50, %edx
movl $0x3, %ecx
callq 0x3894e
movl $0x1f, %edx
leaq 0x10(%rsp), %rdi
leaq 0x1cc30(%rip), %rsi     # 0x3c520
callq 0x93b0
leaq 0x10(%rsp), %rdi
callq 0x38b76
movq 0x8(%rsp), %r10
leaq 0x1cb42(%rip), %rsi     # 0x3c44d
leaq 0x10(%rsp), %rdx
jmp 0x1f865
incq %r14
cmpq (%rbx), %r14
jb 0x1f800
jmp 0x1f968
movq %r10, %r12
movq %rdx, %rbp
movq %rdx, %rdi
movq %rsi, %r13
movl $0x44, %edx
movl $0x3, %ecx
callq 0x3894e
movl $0x1f, %edx
movq %rbp, %rdi
leaq 0x1cbd3(%rip), %rsi     # 0x3c520
callq 0x93b0
movq %rbp, %rdi
callq 0x38b76
movq %r12, %r10
movq %r13, %rsi
movq %rbp, %rdx
jmp 0x1f818
movq %rbx, %rax
addq $0x198, %rsp            # imm = 0x198
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1f983
jmp 0x1f983
jmp 0x1f983
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x38b76
jmp 0x1f9b0
jmp 0x1f9b8
movq %rax, %rbx
movq 0x20(%rsp), %rax
testq %rax, %rax
je 0x1f9b0
leaq 0x10(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq %rbx, %rdi
callq 0x95d0
movq %rax, %rdi
callq 0x112c8