// File: xbai0624[P]dnn/src/Matrix.cpp
// Function: Matrix::_hadamard_ComputeSection(HadamardOps, Matrix&, Matrix&, unsigned long, unsigned long, unsigned long, unsigned long)
void Matrix::_hadamard_ComputeSection(HadamardOps op, Matrix &B, Matrix &C, size_t r1, size_t r2, size_t c1, size_t c2)
{
    // compute a region inside C for hadamard operation
    for(size_t i=r1; i<r2; i++)
    {
        for(size_t j=c1; j<c2; j++){
            if(op == HadamardOps::plus)
                C[i][j] = (*this)[i][j] + B[i][j];
            else if (op == HadamardOps::subtract)
                C[i][j] = (*this)[i][j] - B[i][j];
            else if (op == HadamardOps::multiply)
                C[i][j] = (*this)[i][j] * B[i][j];
            else if (op == HadamardOps::divide)
                C[i][j] = (*this)[i][j] / B[i][j];
            else
                std::cout<<"Error: not supported hadamard operation."<<std::endl;
        }
    }
}

// Assembly:
subq $0x88, %rsp
movq 0x98(%rsp), %rax
movq 0x90(%rsp), %rax
movq %rdi, 0x80(%rsp)
movl %esi, 0x7c(%rsp)
movq %rdx, 0x70(%rsp)
movq %rcx, 0x68(%rsp)
movq %r8, 0x60(%rsp)
movq %r9, 0x58(%rsp)
movq 0x80(%rsp), %rax
movq %rax, 0x40(%rsp)
movq 0x60(%rsp), %rax
movq %rax, 0x50(%rsp)
movq 0x50(%rsp), %rax
cmpq 0x58(%rsp), %rax
jae 0x3c46b
movq 0x90(%rsp), %rax
movq %rax, 0x48(%rsp)
movq 0x48(%rsp), %rax
cmpq 0x98(%rsp), %rax
jae 0x3c456
cmpl $0x0, 0x7c(%rsp)
jne 0x3c292
movq 0x40(%rsp), %rdi
movq 0x50(%rsp), %rsi
callq 0x3be50
movq %rax, %rdi
movq 0x48(%rsp), %rsi
callq 0x1fd60
movsd (%rax), %xmm0
movsd %xmm0, 0x30(%rsp)
movq 0x70(%rsp), %rdi
movq 0x50(%rsp), %rsi
callq 0x3be50
movq %rax, %rdi
movq 0x48(%rsp), %rsi
callq 0x1fd60
movsd 0x30(%rsp), %xmm0
addsd (%rax), %xmm0
movsd %xmm0, 0x38(%rsp)
movq 0x68(%rsp), %rdi
movq 0x50(%rsp), %rsi
callq 0x3be50
movq %rax, %rdi
movq 0x48(%rsp), %rsi
callq 0x1fd60
movsd 0x38(%rsp), %xmm0
movsd %xmm0, (%rax)
jmp 0x3c441
cmpl $0x1, 0x7c(%rsp)
jne 0x3c316
movq 0x40(%rsp), %rdi
movq 0x50(%rsp), %rsi
callq 0x3be50
movq %rax, %rdi
movq 0x48(%rsp), %rsi
callq 0x1fd60
movsd (%rax), %xmm0
movsd %xmm0, 0x20(%rsp)
movq 0x70(%rsp), %rdi
movq 0x50(%rsp), %rsi
callq 0x3be50
movq %rax, %rdi
movq 0x48(%rsp), %rsi
callq 0x1fd60
movsd 0x20(%rsp), %xmm0
subsd (%rax), %xmm0
movsd %xmm0, 0x28(%rsp)
movq 0x68(%rsp), %rdi
movq 0x50(%rsp), %rsi
callq 0x3be50
movq %rax, %rdi
movq 0x48(%rsp), %rsi
callq 0x1fd60
movsd 0x28(%rsp), %xmm0
movsd %xmm0, (%rax)
jmp 0x3c43f
cmpl $0x2, 0x7c(%rsp)
jne 0x3c39a
movq 0x40(%rsp), %rdi
movq 0x50(%rsp), %rsi
callq 0x3be50
movq %rax, %rdi
movq 0x48(%rsp), %rsi
callq 0x1fd60
movsd (%rax), %xmm0
movsd %xmm0, 0x10(%rsp)
movq 0x70(%rsp), %rdi
movq 0x50(%rsp), %rsi
callq 0x3be50
movq %rax, %rdi
movq 0x48(%rsp), %rsi
callq 0x1fd60
movsd 0x10(%rsp), %xmm0
mulsd (%rax), %xmm0
movsd %xmm0, 0x18(%rsp)
movq 0x68(%rsp), %rdi
movq 0x50(%rsp), %rsi
callq 0x3be50
movq %rax, %rdi
movq 0x48(%rsp), %rsi
callq 0x1fd60
movsd 0x18(%rsp), %xmm0
movsd %xmm0, (%rax)
jmp 0x3c43d
cmpl $0x3, 0x7c(%rsp)
jne 0x3c419
movq 0x40(%rsp), %rdi
movq 0x50(%rsp), %rsi
callq 0x3be50
movq %rax, %rdi
movq 0x48(%rsp), %rsi
callq 0x1fd60
movsd (%rax), %xmm0
movsd %xmm0, (%rsp)
movq 0x70(%rsp), %rdi
movq 0x50(%rsp), %rsi
callq 0x3be50
movq %rax, %rdi
movq 0x48(%rsp), %rsi
callq 0x1fd60
movsd (%rsp), %xmm0
divsd (%rax), %xmm0
movsd %xmm0, 0x8(%rsp)
movq 0x68(%rsp), %rdi
movq 0x50(%rsp), %rsi
callq 0x3be50
movq %rax, %rdi
movq 0x48(%rsp), %rsi
callq 0x1fd60
movsd 0x8(%rsp), %xmm0
movsd %xmm0, (%rax)
jmp 0x3c43b
movq 0x2ebb8(%rip), %rdi     # 0x6afd8
leaq 0x18ba6(%rip), %rsi     # 0x54fcd
callq 0x4230
movq %rax, %rdi
movq 0x2eb7a(%rip), %rsi     # 0x6afb0
callq 0x4260
jmp 0x3c43d
jmp 0x3c43f
jmp 0x3c441
jmp 0x3c443
movq 0x48(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x48(%rsp)
jmp 0x3c1fb
jmp 0x3c458
movq 0x50(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x50(%rsp)
jmp 0x3c1de
addq $0x88, %rsp
retq
nopw %cs:(%rax,%rax)