// 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&) 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, %r15
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 0x1f804
leaq 0x1d321(%rip), %rsi     # 0x3caf0
leaq 0x10(%rsp), %r12
movq %r12, %rdi
movl $0x8e, %edx
movl $0x3, %ecx
callq 0x387b6
leaq 0x1d322(%rip), %rsi     # 0x3cb0f
movl $0x76, %edx
movq %r12, %rdi
callq 0x93b0
leaq 0x10(%rsp), %rdi
callq 0x389de
movq %rbx, %rdi
movq %r14, %rsi
callq 0x19326
movq (%r14), %rcx
movq 0x8(%r14), %r8
movq (%r15), %rax
cmpq %rax, %rcx
setne %dl
cmpq $0x1, %rax
setne %sil
testb %sil, %dl
movq %rbx, (%rsp)
jne 0x1f89a
cmpq 0x8(%r15), %r8
jne 0x1f89a
addq $0x18, %r14
movq 0x8(%rbx), %rdx
movq 0x10(%rbx), %rsi
imulq (%rbx), %rdx
movq 0x10(%r15), %rcx
imulq %rax, %r8
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %r9
movaps %xmm0, (%r9)
leaq 0x8e4d(%rip), %rax      # 0x286ae
movq %rax, 0x18(%r9)
leaq 0x8e4a(%rip), %rax      # 0x286b6
movq %rax, 0x10(%r9)
movq %r14, %rdi
callq 0xad06
movq 0x20(%rsp), %rax
testq %rax, %rax
je 0x1fa11
leaq 0x10(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
jmp 0x1fa11
testq %rcx, %rcx
je 0x1fa11
xorl %ebx, %ebx
leaq 0x1cba1(%rip), %rsi     # 0x3c44d
leaq 0x10(%rsp), %rdx
movq %r15, 0x8(%rsp)
movq 0x8(%r15), %rax
movq %rax, %r13
imulq %rbx, %r13
imulq (%r15), %rax
cmpq %rax, %r13
jae 0x1f9ce
testq %r8, %r8
je 0x1f9b8
movq 0x10(%r15), %rax
movl (%rax,%r13,4), %ebp
xorl %r13d, %r13d
movq %rbx, %r15
imulq %r8, %r15
addq %r13, %r15
imulq (%r14), %r8
cmpq %r8, %r15
jae 0x1f934
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 0x1f971
subl %ebp, %r15d
movq 0x10(%rcx), %rax
movl %r15d, (%rax,%r12,4)
incq %r13
movq 0x8(%r14), %r8
cmpq %r8, %r13
jb 0x1f8e2
jmp 0x1f9bb
movq %rdx, %r12
movq %rdx, %rdi
movl $0x44, %edx
movl $0x3, %ecx
callq 0x387b6
movl $0x1f, %edx
movq %r12, %rdi
leaq 0x1cbc8(%rip), %rsi     # 0x3c520
callq 0x93b0
movq %r12, %rdi
callq 0x389de
leaq 0x1cae1(%rip), %rsi     # 0x3c44d
movq %r12, %rdx
jmp 0x1f8f5
movq %rdx, %rdi
movl $0x50, %edx
movl $0x3, %ecx
callq 0x387b6
movl $0x1f, %edx
leaq 0x10(%rsp), %rdi
leaq 0x1cb8c(%rip), %rsi     # 0x3c520
callq 0x93b0
leaq 0x10(%rsp), %rdi
callq 0x389de
movq (%rsp), %rcx
leaq 0x1ca9f(%rip), %rsi     # 0x3c44d
leaq 0x10(%rsp), %rdx
jmp 0x1f918
xorl %r8d, %r8d
incq %rbx
cmpq (%r14), %rbx
movq 0x8(%rsp), %r15
jb 0x1f8b6
jmp 0x1fa11
movq %rdx, %rbp
movq %rdx, %rdi
movq %rsi, %r12
movl $0x44, %edx
movl $0x3, %ecx
callq 0x387b6
movl $0x1f, %edx
movq %rbp, %rdi
leaq 0x1cb2b(%rip), %rsi     # 0x3c520
callq 0x93b0
movq %rbp, %rdi
callq 0x389de
movq 0x8(%r14), %r8
movq %r12, %rsi
movq %rbp, %rdx
jmp 0x1f8ce
movq (%rsp), %rax
addq $0x198, %rsp            # imm = 0x198
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1fa2d
jmp 0x1fa3c
jmp 0x1fa2d
movq %rax, %r14
leaq 0x10(%rsp), %rdi
callq 0x389de
jmp 0x1fa6e
movq %rax, %r14
jmp 0x1fa6e
movq %rax, %r14
leaq 0x10(%rsp), %rdi
callq 0x389de
jmp 0x1fa77
jmp 0x1fa7f
movq %rax, %r14
movq 0x20(%rsp), %rax
testq %rax, %rax
je 0x1fa6e
leaq 0x10(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq (%rsp), %rdi
callq 0x18494
movq %r14, %rdi
callq 0x95d0
movq %rax, %rdi
callq 0x10f91
nop