// 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&) const
Matrix<T> Matrix<T>::operator - (const Matrix<T>& mat) const{
    CHECK(equal_shape(mat) 
          || (_cols == mat.cols() && mat.rows() == 1)
          || (_rows == mat.rows() && mat.cols() == 1));
    
    auto new_mat = clone();
    if(equal_shape(mat) || (_cols == mat.cols() && mat.rows() == 1)){
        auto lambda = [](T* a, const T& b){*a -= b;};
        _po.parallel_mul2mul_repeat(new_mat.data(), new_mat.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++){
                new_mat.set_data(get_data(i, j) - value, i, j);
            }
        }
    }
    return new_mat;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x198, %rsp            # imm = 0x198
movq %rdx, %r13
movq %rsi, %r14
movq %rdi, %rbx
movq (%rdx), %rax
movq 0x8(%rdx), %rcx
cmpq %rax, (%rsi)
sete %dl
cmpq %rcx, 0x8(%rsi)
sete %sil
cmpq $0x1, %rax
sete %al
orb %dl, %al
andb %sil, %al
cmpq $0x1, %rcx
sete %cl
andb %dl, %cl
orb %al, %cl
jne 0x1faee
leaq 0x1d037(%rip), %rsi     # 0x3caf0
leaq 0x10(%rsp), %r12
movq %r12, %rdi
movl $0x8e, %edx
movl $0x3, %ecx
callq 0x3894e
leaq 0x1d038(%rip), %rsi     # 0x3cb0f
movl $0x76, %edx
movq %r12, %rdi
callq 0x93b0
leaq 0x10(%rsp), %rdi
callq 0x38b76
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1957e
movq (%r13), %rax
cmpq %rax, (%r14)
setne %cl
cmpq $0x1, %rax
setne %dl
testb %dl, %cl
movq %rbx, (%rsp)
jne 0x1fb80
movq 0x8(%r13), %r8
cmpq %r8, 0x8(%r14)
jne 0x1fb80
addq $0x18, %r14
movq 0x8(%rbx), %rdx
movq 0x10(%rbx), %rsi
imulq (%rbx), %rdx
movq 0x10(%r13), %rcx
imulq %rax, %r8
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %r9
movaps %xmm0, (%r9)
leaq 0x8ccf(%rip), %rax      # 0x28816
movq %rax, 0x18(%r9)
leaq 0x8ccc(%rip), %rax      # 0x2881e
movq %rax, 0x10(%r9)
movq %r14, %rdi
callq 0xada2
movq 0x20(%rsp), %rax
testq %rax, %rax
je 0x1fcfb
leaq 0x10(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
jmp 0x1fcfb
cmpq $0x0, (%r14)
je 0x1fcfb
xorl %ebx, %ebx
leaq 0x1c8ba(%rip), %rsi     # 0x3c44d
leaq 0x10(%rsp), %rdx
movq %r13, 0x8(%rsp)
movq 0x8(%r13), %rax
movq %rax, %r15
imulq %rbx, %r15
imulq (%r13), %rax
cmpq %rax, %r15
jae 0x1fcbc
movq 0x8(%r14), %rax
testq %rax, %rax
je 0x1fca9
movq 0x8(%rsp), %rcx
movq 0x10(%rcx), %rcx
movl (%rcx,%r15,4), %ebp
xorl %r13d, %r13d
movq %rbx, %r15
imulq %rax, %r15
addq %r13, %r15
imulq (%r14), %rax
cmpq %rax, %r15
jae 0x1fc25
movq 0x10(%r14), %rax
movl (%rax,%r15,4), %r15d
movq (%rsp), %rcx
movq 0x8(%rcx), %rax
movq %rbx, %r12
imulq %rax, %r12
addq %r13, %r12
imulq (%rcx), %rax
cmpq %rax, %r12
jae 0x1fc62
subl %ebp, %r15d
movq 0x10(%rcx), %rax
movl %r15d, (%rax,%r12,4)
incq %r13
movq 0x8(%r14), %rax
cmpq %rax, %r13
jb 0x1fbd3
jmp 0x1fca9
movq %rdx, %r12
movq %rdx, %rdi
movl $0x44, %edx
movl $0x3, %ecx
callq 0x3894e
movl $0x1f, %edx
movq %r12, %rdi
leaq 0x1c8d7(%rip), %rsi     # 0x3c520
callq 0x93b0
movq %r12, %rdi
callq 0x38b76
leaq 0x1c7f0(%rip), %rsi     # 0x3c44d
movq %r12, %rdx
jmp 0x1fbe6
movq %rdx, %rdi
movl $0x50, %edx
movl $0x3, %ecx
callq 0x3894e
movl $0x1f, %edx
leaq 0x10(%rsp), %rdi
leaq 0x1c89b(%rip), %rsi     # 0x3c520
callq 0x93b0
leaq 0x10(%rsp), %rdi
callq 0x38b76
movq (%rsp), %rcx
leaq 0x1c7ae(%rip), %rsi     # 0x3c44d
leaq 0x10(%rsp), %rdx
jmp 0x1fc09
incq %rbx
cmpq (%r14), %rbx
movq 0x8(%rsp), %r13
jb 0x1fb9d
jmp 0x1fcfb
movq %rdx, %rbp
movq %rdx, %rdi
movq %rsi, %r12
movl $0x44, %edx
movl $0x3, %ecx
callq 0x3894e
movl $0x1f, %edx
movq %rbp, %rdi
leaq 0x1c83d(%rip), %rsi     # 0x3c520
callq 0x93b0
movq %rbp, %rdi
callq 0x38b76
movq %r12, %rsi
movq %rbp, %rdx
jmp 0x1fbb6
movq (%rsp), %rax
addq $0x198, %rsp            # imm = 0x198
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1fd17
jmp 0x1fd26
jmp 0x1fd17
movq %rax, %r14
leaq 0x10(%rsp), %rdi
callq 0x38b76
jmp 0x1fd58
movq %rax, %r14
jmp 0x1fd58
movq %rax, %r14
leaq 0x10(%rsp), %rdi
callq 0x38b76
jmp 0x1fd61
jmp 0x1fd69
movq %rax, %r14
movq 0x20(%rsp), %rax
testq %rax, %rax
je 0x1fd58
leaq 0x10(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq (%rsp), %rdi
callq 0x186ec
movq %r14, %rdi
callq 0x95d0
movq %rax, %rdi
callq 0x112c8
nop