LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O1/xbai0624[P]dnn/src/Matrix.cpp
// Function: Matrix::operator*(double)
Matrix Matrix::operator*(double v)
{
    // scalar multiply operation: A*v = C
    Matrix C(this->Dimension());
#ifdef MULTITHREAD_MATRIX
    auto jobs = DivideJobs(this->size(), (*this)[0].size(), NCORES);
    std::vector<std::thread> th;
    for(auto &i: jobs)
    {
        th.push_back( std::thread( [this, v, &C, &i](){
                    _scalar_ComputeSection(HadamardOps::multiply, v, C, i.first.first, i.first.second, i.second.first, i.second.second);
                    }
                    ) 
                );
    }
    for(auto &j: th){
        j.join();
    }
#else
    _scalar_ComputeSection(HadamardOps::multiply, v, C, 0, (*this).Dimension().first, 0, (*this).Dimension().second);
#endif
    return C;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movsd %xmm0, 0x8(%rsp)
movq %rsi, %r14
movq %rdi, %rbx
movq (%rsi), %rax
movq 0x8(%rsi), %rsi
subq %rax, %rsi
sarq $0x3, %rsi
movabsq $-0x5555555555555555, %r15 # imm = 0xAAAAAAAAAAAAAAAB
imulq %r15, %rsi
movq 0x8(%rax), %rdx
subq (%rax), %rdx
sarq $0x3, %rdx
callq 0x1a8c0
movsd 0x8(%rsp), %xmm1
movq (%r14), %rax
movq 0x8(%r14), %rcx
subq %rax, %rcx
je 0x1b87e
sarq $0x3, %rcx
imulq %r15, %rcx
movq (%rax), %rdx
movq 0x8(%rax), %rsi
movq %rsi, %rdi
subq %rdx, %rdi
sarq $0x3, %rdi
movq (%rbx), %r8
xorl %r9d, %r9d
cmpq %rdx, %rsi
je 0x1b876
leaq (,%r9,8), %r10
leaq (%r10,%r10,2), %r11
movq (%rax,%r11), %r10
movq (%r8,%r11), %r11
xorl %r14d, %r14d
movsd (%r10,%r14,8), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, (%r11,%r14,8)
incq %r14
cmpq %r14, %rdi
jne 0x1b85e
incq %r9
cmpq %rcx, %r9
jne 0x1b842
movq %rbx, %rax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/xbai0624[P]dnn/src/Matrix.cpp
// Function: Matrix::operator/(double)
Matrix Matrix::operator/(double v)
{
    // scalar division operation: A/v = C
    Matrix C(this->Dimension());
#ifdef MULTITHREAD_MATRIX
    auto jobs = DivideJobs(this->size(), (*this)[0].size(), NCORES);
    std::vector<std::thread> th;
    for(auto &i: jobs)
    {
        th.push_back( std::thread( [this, v, &C, &i](){
                    _scalar_ComputeSection(HadamardOps::divide, v, C, i.first.first, i.first.second, i.second.first, i.second.second);
                    }
                    ) 
                );
    }
    for(auto &j: th){
        j.join();
    }
#else
    _scalar_ComputeSection(HadamardOps::divide, v, C, 0, (*this).Dimension().first, 0, (*this).Dimension().second);
#endif
    return C;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movsd %xmm0, 0x8(%rsp)
movq %rsi, %r14
movq %rdi, %rbx
movq (%rsi), %rax
movq 0x8(%rsi), %rsi
subq %rax, %rsi
sarq $0x3, %rsi
movabsq $-0x5555555555555555, %r15 # imm = 0xAAAAAAAAAAAAAAAB
imulq %r15, %rsi
movq 0x8(%rax), %rdx
subq (%rax), %rdx
sarq $0x3, %rdx
callq 0x1a8c0
movq (%r14), %rax
movq 0x8(%r14), %r8
subq %rax, %r8
sarq $0x3, %r8
imulq %r15, %r8
movq 0x8(%rax), %rcx
subq (%rax), %rcx
sarq $0x3, %rcx
movq %rcx, (%rsp)
movq %r14, %rdi
movl $0x3, %esi
movsd 0x8(%rsp), %xmm0
movq %rbx, %rdx
xorl %ecx, %ecx
xorl %r9d, %r9d
callq 0x1b572
movq %rbx, %rax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %r14
movq %rbx, %rdi
callq 0x1e9ea
movq %rbx, %rdi
callq 0x146b8
movq %r14, %rdi
callq 0x43e0
nop
// File: /workspace/github_cpp_makefile_star2_O1/xbai0624[P]dnn/src/Matrix.cpp
// Function: Matrix::_mul_ComputeSection(Matrix&, Matrix&, unsigned long, unsigned long, unsigned long, unsigned long)
void Matrix::_mul_ComputeSection(Matrix &B, Matrix &C, size_t r1, size_t r2, size_t c1, size_t c2)
{
    // compute a section of C
    if(r1 >= r2 || c1 >= c2) {
        return;
    }
    if( (int)r1<0 || r2>this->size() || (int)c1<0 || c2>B[0].size()) {
        std::cout<<"Error: matrix out of range."<<std::endl;
        exit(0);
    }
    if(C.size() != this->size() || C[0].size() != B[0].size() ) {
        std::cout<<"Error: matrix not match."<<std::endl;
        exit(0);
    }

    for(size_t i=r1; i<r2;i++){
        for(size_t j=c1;j<c2;j++){
            C[i][j] = _mul_ComputeElement(B, i, j);
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq 0x50(%rsp), %rax
movq %r8, 0x8(%rsp)
cmpq %r8, %rcx
setae %r10b
cmpq %rax, %r9
setae %r11b
orb %r10b, %r11b
jne 0x1ba77
testl %ecx, %ecx
js 0x1ba86
testl %r9d, %r9d
js 0x1ba86
movq (%rdi), %r8
movq 0x8(%rdi), %r11
subq %r8, %r11
movq %r11, %rdi
sarq $0x3, %rdi
movabsq $-0x5555555555555555, %rbx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rdi, %rbx
cmpq 0x8(%rsp), %rbx
jb 0x1ba86
movq (%rsi), %rsi
movq 0x8(%rsi), %rdi
subq (%rsi), %rdi
movq %rdi, %rbx
sarq $0x3, %rbx
cmpq %rax, %rbx
jb 0x1ba86
movq (%rdx), %r10
movq 0x8(%rdx), %rdx
subq %r10, %rdx
cmpq %r11, %rdx
jne 0x1ba96
movq 0x8(%r10), %rdx
subq (%r10), %rdx
cmpq %rdi, %rdx
jne 0x1ba96
movq %r10, 0x10(%rsp)
cmpq 0x8(%rsp), %rcx
jae 0x1ba77
cmpq %rax, %r9
jae 0x1ba69
movq (%r8), %rdx
movq 0x8(%r8), %r11
movq %r11, %rbx
subq %rdx, %rbx
sarq $0x3, %rbx
leaq (,%rcx,8), %rdi
leaq (%rdi,%rdi,2), %rdi
leaq (%r8,%rdi), %r14
cmpq $0x1, %rbx
adcq $0x0, %rbx
movq 0x10(%rsp), %r10
movq (%r10,%rdi), %r15
movq %r9, %r12
cmpq %rdx, %r11
je 0x1ba57
movq (%r14), %r13
xorpd %xmm0, %xmm0
movq %rsi, %rbp
xorl %edi, %edi
movsd (%r13,%rdi,8), %xmm1
movq (%rbp), %r10
mulsd (%r10,%r12,8), %xmm1
addsd %xmm1, %xmm0
incq %rdi
addq $0x18, %rbp
cmpq %rdi, %rbx
jne 0x1ba34
jmp 0x1ba5b
xorpd %xmm0, %xmm0
movsd %xmm0, (%r15,%r12,8)
incq %r12
cmpq %rax, %r12
jne 0x1ba23
incq %rcx
cmpq 0x8(%rsp), %rcx
jne 0x1b9e9
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x1b54b(%rip), %rdi     # 0x36fd8
leaq 0xe72c(%rip), %rsi      # 0x2a1c0
jmp 0x1baa4
movq 0x1b53b(%rip), %rdi     # 0x36fd8
leaq 0xe738(%rip), %rsi      # 0x2a1dc
callq 0x4260
movq %rax, %rdi
callq 0x4100
xorl %edi, %edi
callq 0x4290
// File: /workspace/github_cpp_makefile_star2_O1/xbai0624[P]dnn/src/Matrix.cpp
// Function: Matrix::_mul_ComputeElement(Matrix&, unsigned long, unsigned long)
double Matrix::_mul_ComputeElement(Matrix &B, size_t r, size_t c)
{
    // compute an element in the result matrix, 
    // B is multiplied to this matrix: AxB = C
    double s = 0;
    for(size_t i=0;i<(*this)[0].size();i++){
        s += (*this)[r][i] * B[i][c];
    }
    return s;
}

// Assembly:
movq (%rdi), %rdi
movq 0x8(%rdi), %rax
subq (%rdi), %rax
je 0x1bb00
sarq $0x3, %rax
leaq (%rdx,%rdx,2), %rdx
movq (%rdi,%rdx,8), %rdx
movq (%rsi), %rsi
cmpq $0x1, %rax
adcq $0x0, %rax
xorpd %xmm0, %xmm0
xorl %edi, %edi
movsd (%rdx,%rdi,8), %xmm1
movq (%rsi), %r8
mulsd (%r8,%rcx,8), %xmm1
addsd %xmm1, %xmm0
incq %rdi
addq $0x18, %rsi
cmpq %rdi, %rax
jne 0x1bae1
retq
xorps %xmm0, %xmm0
retq
// File: /workspace/github_cpp_makefile_star2_O1/xbai0624[P]dnn/src/Matrix.cpp
// Function: operator<<(std::ostream&, Matrix&)
std::ostream& operator<<(std::ostream &os, Matrix& A)
{
    // overload cout for Matrix
    for(size_t i=0;i<A.size();i++){
        os<<A[i];
    }
    return os;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movq (%rsi), %rsi
cmpq %rsi, 0x8(%r14)
je 0x1bbaa
xorl %r15d, %r15d
movabsq $-0x5555555555555555, %r12 # imm = 0xAAAAAAAAAAAAAAAB
xorl %r13d, %r13d
addq %r15, %rsi
movq %rbx, %rdi
callq 0x1bbb7
incq %r13
movq (%r14), %rsi
movq 0x8(%r14), %rax
subq %rsi, %rax
sarq $0x3, %rax
imulq %r12, %rax
addq $0x18, %r15
cmpq %rax, %r13
jb 0x1bb81
movq %rbx, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/xbai0624[P]dnn/src/Matrix.cpp
// Function: operator<<(std::ostream&, std::vector<double, std::allocator<double>>&)
std::ostream& operator<<(std::ostream &os, std::vector<double>& A)
{
    // overload cout for vector
    for(size_t i=0;i<A.size();i++){
        os<<std::setfill(' ')<<std::setw(18)<<std::setprecision(6)<<A[i];
    }
    os<<std::endl;
    return os;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x8(%rsi), %rax
cmpq (%rsi), %rax
je 0x1bc4f
movq %rsi, %r14
xorl %r12d, %r12d
movq (%rbx), %rax
movq -0x18(%rax), %rax
leaq (%rbx,%rax), %r15
cmpb $0x0, 0xe1(%rbx,%rax)
jne 0x1bc06
movq %r15, %rdi
movl $0x20, %esi
callq 0x4250
movb %al, 0xe0(%r15)
movb $0x1, 0xe1(%r15)
movb $0x20, 0xe0(%r15)
movq (%rbx), %rax
movq -0x18(%rax), %rcx
movq $0x12, 0x10(%rbx,%rcx)
movq -0x18(%rax), %rax
movq $0x6, 0x8(%rbx,%rax)
movq (%r14), %rax
movsd (%rax,%r12,8), %xmm0
movq %rbx, %rdi
callq 0x4340
incq %r12
movq 0x8(%r14), %rax
subq (%r14), %rax
sarq $0x3, %rax
cmpq %rax, %r12
jb 0x1bbd5
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x4250
movsbl %al, %esi
movq %rbx, %rdi
callq 0x4030
movq %rax, %rdi
callq 0x4190
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/xbai0624[P]dnn/src/Matrix.cpp
// Function: Matrix::Random()
void Matrix::Random()
{
    // fill with random numbers
    // uniform (0,1) distribution
    //std::cout<<"Filling matrix using flat (0, 1) distribution"<<std::endl;
    std::random_device rd;
    std::mt19937 mt(rd());
    //unsigned int SEED = seed;
    //std::mt19937 mt(SEED);
    //seed = seed + 1;
    std::uniform_real_distribution<double> dist(0, 1.);

    for(size_t i=0;i<__M.size();i++){
        for(size_t j=0;j<__M[0].size();j++){
            __M[i][j] = dist(mt);
        }
    }
    //std::cout<<"Fill finished."<<std::endl;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2718, %rsp           # imm = 0x2718
movq %rdi, %rbx
leaq 0x1390(%rsp), %r14
movq %r14, %rdi
callq 0x1420e
movq %r14, %rdi
callq 0x42d0
movl %eax, %eax
movq %rax, 0x8(%rsp)
movl $0x1, %ecx
movq %rax, %rdx
shrq $0x1e, %rdx
xorl %eax, %edx
imull $0x6c078965, %edx, %eax # imm = 0x6C078965
addl %ecx, %eax
movq %rax, 0x8(%rsp,%rcx,8)
incq %rcx
cmpq $0x270, %rcx            # imm = 0x270
jne 0x1bcbe
movq $0x270, 0x1388(%rsp) # imm = 0x270
movq 0x8(%rbx), %rax
cmpq (%rbx), %rax
je 0x1bd5f
xorl %r15d, %r15d
movabsq $-0x5555555555555555, %r12 # imm = 0xAAAAAAAAAAAAAAAB
leaq 0x8(%rsp), %r14
movq (%rbx), %rax
movq 0x8(%rax), %rcx
cmpq (%rax), %rcx
je 0x1bd48
leaq (%r15,%r15,2), %r13
xorl %ebp, %ebp
movq %r14, %rdi
callq 0x1f117
addsd 0xb867(%rip), %xmm0     # 0x27590
movq (%rbx), %rax
movq (%rax,%r13,8), %rcx
movsd %xmm0, (%rcx,%rbp,8)
incq %rbp
movq 0x8(%rax), %rcx
subq (%rax), %rcx
sarq $0x3, %rcx
cmpq %rcx, %rbp
jb 0x1bd19
movq 0x8(%rbx), %rax
subq (%rbx), %rax
incq %r15
sarq $0x3, %rax
imulq %r12, %rax
cmpq %rax, %r15
jb 0x1bd07
leaq 0x1390(%rsp), %rdi
callq 0x4220
addq $0x2718, %rsp           # imm = 0x2718
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1bd9a
jmp 0x1bd82
movq %rax, %rbx
leaq 0x1390(%rsp), %rdi
callq 0x4220
movq %rbx, %rdi
callq 0x43e0
movq %rax, %rdi
callq 0x1473b
// File: /workspace/github_cpp_makefile_star2_O1/xbai0624[P]dnn/src/Matrix.cpp
// Function: Matrix::Random(double, double)
void Matrix::Random(double min, double max)
{
    // fill with random numbers
    // uniform (0,1) distribution
    //std::cout<<"Filling matrix using flat (0, 1) distribution"<<std::endl;
    std::random_device rd;
    std::mt19937 mt(rd());
    //unsigned int SEED = seed;
    //std::mt19937 mt(SEED);
    //seed = seed+1;
    std::uniform_real_distribution<double> dist(min, max);

    for(size_t i=0;i<__M.size();i++){
        for(size_t j=0;j<__M[0].size();j++){
            __M[i][j] = dist(mt);
        }
    }
    //std::cout<<"Fill finished."<<std::endl;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2728, %rsp           # imm = 0x2728
movsd %xmm1, 0x8(%rsp)
movsd %xmm0, 0x10(%rsp)
movq %rdi, %rbx
leaq 0x13a0(%rsp), %r14
movq %r14, %rdi
callq 0x1420e
movq %r14, %rdi
callq 0x42d0
movl %eax, %eax
movq %rax, 0x18(%rsp)
movl $0x1, %ecx
movq %rax, %rdx
shrq $0x1e, %rdx
xorl %eax, %edx
imull $0x6c078965, %edx, %eax # imm = 0x6C078965
addl %ecx, %eax
movq %rax, 0x18(%rsp,%rcx,8)
incq %rcx
cmpq $0x270, %rcx            # imm = 0x270
jne 0x1bde6
movq $0x270, 0x1398(%rsp) # imm = 0x270
movq 0x8(%rbx), %rax
cmpq (%rbx), %rax
je 0x1bea1
movsd 0x8(%rsp), %xmm0
subsd 0x10(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
xorl %r15d, %r15d
movabsq $-0x5555555555555555, %r12 # imm = 0xAAAAAAAAAAAAAAAB
leaq 0x18(%rsp), %r14
movq (%rbx), %rax
movq 0x8(%rax), %rcx
cmpq (%rax), %rcx
je 0x1be8a
leaq (%r15,%r15,2), %r13
xorl %ebp, %ebp
movq %r14, %rdi
callq 0x1f117
mulsd 0x8(%rsp), %xmm0
addsd 0x10(%rsp), %xmm0
movq (%rbx), %rax
movq (%rax,%r13,8), %rcx
movsd %xmm0, (%rcx,%rbp,8)
incq %rbp
movq 0x8(%rax), %rcx
subq (%rax), %rcx
sarq $0x3, %rcx
cmpq %rcx, %rbp
jb 0x1be57
movq 0x8(%rbx), %rax
subq (%rbx), %rax
incq %r15
sarq $0x3, %rax
imulq %r12, %rax
cmpq %rax, %r15
jb 0x1be45
leaq 0x13a0(%rsp), %rdi
callq 0x4220
addq $0x2728, %rsp           # imm = 0x2728
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1bedc
jmp 0x1bec4
movq %rax, %rbx
leaq 0x13a0(%rsp), %rdi
callq 0x4220
movq %rbx, %rdi
callq 0x43e0
movq %rax, %rdi
callq 0x1473b
// File: /workspace/github_cpp_makefile_star2_O1/xbai0624[P]dnn/src/Matrix.cpp
// Function: Matrix::RandomGaus(double, double)
void Matrix::RandomGaus(double mu, double sigma)
{
    // fill with random numbers
    // uniform (0,1) distribution
    //std::cout<<"Filling matrix using flat (0, 1) distribution"<<std::endl;
    //std::random_device rd;
    //std::mt19937 mt(rd());

    unsigned int SEED = seed;
    std::mt19937 mt(SEED);
    seed = seed + 1;

    std::normal_distribution<double> dist(mu, sigma);
    for(size_t i=0;i<__M.size();i++){
        for(size_t j=0;j<__M[0].size();j++){
            __M[i][j] = dist(mt);
        }
    }
    //std::cout<<"Fill finished."<<std::endl;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x13a8, %rsp           # imm = 0x13A8
movq %rdi, %rbx
movl 0x1b332(%rip), %eax     # 0x37230
movq %rax, 0x20(%rsp)
movl $0x1, %ecx
movq %rax, %rdx
shrq $0x1e, %rdx
xorl %eax, %edx
imull $0x6c078965, %edx, %eax # imm = 0x6C078965
addl %ecx, %eax
movq %rax, 0x20(%rsp,%rcx,8)
incq %rcx
cmpq $0x270, %rcx            # imm = 0x270
jne 0x1bf08
movq $0x270, 0x13a0(%rsp) # imm = 0x270
movl 0x1b2f4(%rip), %eax     # 0x37230
incl %eax
xchgl %eax, 0x1b2ec(%rip)     # 0x37230
movsd %xmm0, (%rsp)
movsd %xmm1, 0x8(%rsp)
movq $0x0, 0x10(%rsp)
movb $0x0, 0x18(%rsp)
movq 0x8(%rbx), %rax
cmpq (%rbx), %rax
je 0x1bfd3
xorl %r12d, %r12d
leaq 0x20(%rsp), %r14
movq %rsp, %r15
movq (%rbx), %rax
movq 0x8(%rax), %rcx
cmpq (%rax), %rcx
je 0x1bfb2
leaq (%r12,%r12,2), %rbp
xorl %r13d, %r13d
movq %r15, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x1f23c
movq (%rbx), %rax
movq (%rax,%rbp,8), %rcx
movsd %xmm0, (%rcx,%r13,8)
incq %r13
movq 0x8(%rax), %rcx
subq (%rax), %rcx
sarq $0x3, %rcx
cmpq %rcx, %r13
jb 0x1bf84
movq 0x8(%rbx), %rax
subq (%rbx), %rax
incq %r12
sarq $0x3, %rax
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rcx, %rax
cmpq %rax, %r12
jb 0x1bf71
addq $0x13a8, %rsp           # imm = 0x13A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/xbai0624[P]dnn/src/Matrix.cpp
// Function: Matrix::operator()(double (*)(double), unsigned long, unsigned long, unsigned long, unsigned long)
void Matrix::operator()(double(*functor)(double), size_t r1, size_t r2, size_t c1, size_t c2)
{
    // pass a functor, apply to a region of the matrix
    if( (int)r1<0 || r2>(*this).size() || r2 <= r1 || c2 <= c1
            || (int)c1<0 || c2 > (*this)[0].size()
      ) 
        return;

    for(size_t i=r1;i<r2;i++){
        for(size_t j=c1;j<c2;j++){
            (*this)[i][j] = (*functor)( (*this)[i][j] );
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r8, 0x8(%rsp)
movq %rdx, %r12
testl %r12d, %r12d
js 0x1c0f1
cmpq %r12, %rcx
jbe 0x1c0f1
movq %rsi, %r13
movq %rdi, %rbp
movq (%rdi), %rax
movq 0x8(%rdi), %rsi
subq %rax, %rsi
sarq $0x3, %rsi
movabsq $-0x5555555555555555, %rdx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rsi, %rdx
cmpq %rcx, %rdx
jb 0x1c0f1
movq %r9, %rbx
movq 0x8(%rsp), %rdx
cmpq %rdx, %r9
setbe %sil
testl %edx, %edx
sets %dl
orb %sil, %dl
jne 0x1c0f1
movq 0x8(%rax), %rdx
subq (%rax), %rdx
sarq $0x3, %rdx
cmpq %rbx, %rdx
setb %al
cmpq %rcx, %r12
setae %dl
orb %al, %dl
jne 0x1c0f1
movq %rcx, 0x10(%rsp)
movq 0x8(%rsp), %rax
movq %rax, %r14
cmpq %rbx, %rax
jae 0x1c0e4
movq (%rbp), %rax
leaq (,%r12,8), %rcx
leaq (%rcx,%rcx,2), %r15
movq (%rax,%r15), %rax
movsd (%rax,%r14,8), %xmm0
callq *%r13
movq (%rbp), %rax
movq (%rax,%r15), %rax
movsd %xmm0, (%rax,%r14,8)
incq %r14
cmpq %r14, %rbx
jne 0x1c0b1
incq %r12
movq 0x10(%rsp), %rcx
cmpq %rcx, %r12
jne 0x1c0a4
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/xbai0624[P]dnn/src/Matrix.cpp
// Function: Matrix::Reshape(unsigned long, unsigned long) const
Matrix Matrix::Reshape(size_t m, size_t n) const
{
    // reshape matrix from original (p, q) to (m, n)
    size_t p = this->size();
    size_t q = (*(const_cast<Matrix*>(this)))[0].size();
    size_t T = p*q; // total # of elements

    if(m==0 || n==0 || p==0 || q==0 || T != m*n) {
        std::cout<<"Error: Reshape matrix dimension not match"<<std::endl;
        exit(0);
    }

    Matrix res(m, n);
    for(size_t i=0;i<T;i++){
        size_t new_x = i/n, new_y = i%n;
        size_t old_x = i/q, old_y = i%q;

        res[new_x][new_y] = (*(const_cast<Matrix*>(this)))[old_x][old_y];
    }

    return res;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
testq %rdx, %rdx
je 0x1c291
movq %rcx, %rbx
testq %rcx, %rcx
je 0x1c291
movq %rsi, %r15
movq (%rsi), %rcx
movq 0x8(%rsi), %rax
cmpq %rcx, %rax
je 0x1c291
movq (%rcx), %rsi
movq 0x8(%rcx), %r12
cmpq %rsi, %r12
je 0x1c291
subq %rcx, %rax
sarq $0x3, %rax
subq %rsi, %r12
sarq $0x3, %r12
movabsq $-0x5555555555555555, %r13 # imm = 0xAAAAAAAAAAAAAAAB
imulq %rax, %r13
imulq %r12, %r13
movq %rbx, %rax
imulq %rdx, %rax
cmpq %rax, %r13
jne 0x1c291
movq %rdi, %r14
movq %rdx, %rsi
movq %rbx, %rdx
callq 0x1a82e
testq %r13, %r13
je 0x1c284
movq (%r15), %r8
movq (%r14), %r9
xorl %ecx, %ecx
movq %rcx, %rax
xorl %edx, %edx
divq %rbx
movq %rdx, %rsi
movq %rax, %rdi
movq %rcx, %rax
xorl %edx, %edx
divq %r12
leaq (%rax,%rax,2), %rax
movq (%r8,%rax,8), %rax
movsd (%rax,%rdx,8), %xmm0
leaq (%rdi,%rdi,2), %rax
movq (%r9,%rax,8), %rax
movsd %xmm0, (%rax,%rsi,8)
incq %rcx
cmpq %rcx, %r13
jne 0x1c24c
movq %r14, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq 0x1ad40(%rip), %rdi     # 0x36fd8
leaq 0xdf56(%rip), %rsi      # 0x2a1f5
callq 0x4260
movq %rax, %rdi
callq 0x4100
xorl %edi, %edi
callq 0x4290
nop
// File: /workspace/github_cpp_makefile_star2_O1/xbai0624[P]dnn/src/Matrix.cpp
// Function: Matrix::MinInSection(unsigned long, unsigned long, unsigned long, unsigned long)
double Matrix::MinInSection(size_t i_start, size_t i_end, size_t j_start, size_t j_end)
{
    // find max element in section [i_start, i_end), and [j_start, j_end)
    // in this code, we all follow the rule: close front and open end
    // and all counters start from 0
    auto dim = Dimension();
    if((int)i_start < 0 || (int)j_start < 0 || i_end <= i_start || j_end <= j_start || i_end > dim.first || j_end > dim.second){
        std::cout<<"Error: Min in matrix section: exceeded range."<<std::endl;
        exit(0);
    }
    double res = __M[i_start][j_start];
    for(size_t i=i_start;i<i_end;i++){
        for(size_t j=j_start;j<j_end;j++){
            if(res > __M[i][j])
                res = __M[i][j];
        }
    }
    return res;
}

// Assembly:
pushq %rax
cmpq %rcx, %r8
jbe 0x1c60d
cmpq %rsi, %rdx
jbe 0x1c60d
movl %ecx, %eax
orl %esi, %eax
andl $0x80000000, %eax       # imm = 0x80000000
jne 0x1c60d
movq (%rdi), %rax
movq 0x8(%rdi), %rdi
subq %rax, %rdi
sarq $0x3, %rdi
movabsq $-0x5555555555555555, %r9 # imm = 0xAAAAAAAAAAAAAAAB
imulq %rdi, %r9
cmpq %rdx, %r9
jb 0x1c60d
movq 0x8(%rax), %rdi
subq (%rax), %rdi
sarq $0x3, %rdi
cmpq %r8, %rdi
jb 0x1c60d
leaq (%rsi,%rsi,2), %rdi
movq (%rax,%rdi,8), %rdi
movsd (%rdi,%rcx,8), %xmm0
leaq (%rsi,%rsi,2), %rdi
movq (%rax,%rdi,8), %rdi
movq %rcx, %r9
movapd %xmm0, %xmm1
movsd (%rdi,%r9,8), %xmm0
minsd %xmm1, %xmm0
incq %r9
cmpq %r9, %r8
jne 0x1c5ed
incq %rsi
cmpq %rdx, %rsi
jne 0x1c5e2
popq %rax
retq
movq 0x1a9c4(%rip), %rdi     # 0x36fd8
leaq 0xdeec(%rip), %rsi      # 0x2a507
callq 0x4260
movq %rax, %rdi
callq 0x4100
xorl %edi, %edi
callq 0x4290
nop
// File: /workspace/github_cpp_makefile_star2_O1/xbai0624[P]dnn/src/Matrix.cpp
// Function: Matrix::MaxInSection(unsigned long, unsigned long, unsigned long, unsigned long)
double Matrix::MaxInSection(size_t i_start, size_t i_end, size_t j_start, size_t j_end)
{
    // find max element in section [i_start, i_end), and [j_start, j_end)
    // in this code, we all follow the rule: close front and open end
    // and all counters start from 0
    auto dim = Dimension();
    if((int)i_start < 0 || (int)j_start < 0 || i_end <= i_start || j_end <= j_start || i_end > dim.first || j_end > dim.second){
        std::cout<<"Error: Max in matrix section: exceeded range."<<std::endl;
        exit(0);
    }
    double res = __M[i_start][j_start];
    for(size_t i=i_start;i<i_end;i++){
        for(size_t j=j_start;j<j_end;j++){
            if(res < __M[i][j])
                res = __M[i][j];
        }
    }
    return res;
}

// Assembly:
pushq %rax
cmpq %rcx, %r8
jbe 0x1c6af
cmpq %rsi, %rdx
jbe 0x1c6af
movl %ecx, %eax
orl %esi, %eax
andl $0x80000000, %eax       # imm = 0x80000000
jne 0x1c6af
movq (%rdi), %rax
movq 0x8(%rdi), %rdi
subq %rax, %rdi
sarq $0x3, %rdi
movabsq $-0x5555555555555555, %r9 # imm = 0xAAAAAAAAAAAAAAAB
imulq %rdi, %r9
cmpq %rdx, %r9
jb 0x1c6af
movq 0x8(%rax), %rdi
subq (%rax), %rdi
sarq $0x3, %rdi
cmpq %r8, %rdi
jb 0x1c6af
leaq (%rsi,%rsi,2), %rdi
movq (%rax,%rdi,8), %rdi
movsd (%rdi,%rcx,8), %xmm0
leaq (%rsi,%rsi,2), %rdi
movq (%rax,%rdi,8), %rdi
movq %rcx, %r9
movapd %xmm0, %xmm1
movsd (%rdi,%r9,8), %xmm0
maxsd %xmm1, %xmm0
incq %r9
cmpq %r9, %r8
jne 0x1c68f
incq %rsi
cmpq %rdx, %rsi
jne 0x1c684
popq %rax
retq
movq 0x1a922(%rip), %rdi     # 0x36fd8
leaq 0xde78(%rip), %rsi      # 0x2a535
callq 0x4260
movq %rax, %rdi
callq 0x4100
xorl %edi, %edi
callq 0x4290
nop
// File: /workspace/github_cpp_makefile_star2_O1/xbai0624[P]dnn/src/Matrix.cpp
// Function: Matrix::FillElementByRow(unsigned long, double)
void Matrix::FillElementByRow(size_t index, double v)
{
    // fill an element to this matrix, row first
    auto dim = Dimension();
    size_t i = index/dim.second;
    size_t j = index%dim.second;
    if(i >= dim.first || j>= dim.second) {
        std::cout<<"Error: filling matrix exceeded range."<<std::endl;
        exit(0);
    }
    __M[i][j] = v;
}

// Assembly:
movq %rsi, %rax
movq (%rdi), %rcx
movq 0x8(%rcx), %rsi
subq (%rcx), %rsi
movq 0x8(%rdi), %rdi
sarq $0x3, %rsi
xorl %edx, %edx
divq %rsi
subq %rcx, %rdi
sarq $0x3, %rdi
movabsq $-0x5555555555555555, %rsi # imm = 0xAAAAAAAAAAAAAAAB
imulq %rdi, %rsi
cmpq %rsi, %rax
jae 0x1c858
leaq (%rax,%rax,2), %rax
movq (%rcx,%rax,8), %rax
movsd %xmm0, (%rax,%rdx,8)
retq
pushq %rax
movq 0x1a778(%rip), %rdi     # 0x36fd8
leaq 0xd9b8(%rip), %rsi      # 0x2a21f
callq 0x4260
movq %rax, %rdi
callq 0x4100
xorl %edi, %edi
callq 0x4290
nop
// File: /workspace/github_cpp_makefile_star2_O1/xbai0624[P]dnn/src/Matrix.cpp
// Function: Matrix::FillElementByCollum(unsigned long, double)
void Matrix::FillElementByCollum(size_t index, double v)
{
    // fill an element to this matrix, collum first
    auto dim = Dimension();
    size_t i = index%dim.first;
    size_t j = index/dim.first;
    if(i >= dim.first || j>= dim.second) {
        std::cout<<"Error: filling matrix exceeded range."<<std::endl;
        exit(0);
    }
    __M[i][j] = v;
}

// Assembly:
movq %rsi, %rax
movq (%rdi), %rcx
movq 0x8(%rdi), %rdx
subq %rcx, %rdx
sarq $0x3, %rdx
movabsq $-0x5555555555555555, %rsi # imm = 0xAAAAAAAAAAAAAAAB
movq 0x8(%rcx), %rdi
subq (%rcx), %rdi
imulq %rdx, %rsi
xorl %edx, %edx
divq %rsi
sarq $0x3, %rdi
cmpq %rdi, %rax
jae 0x1c8be
leaq (%rdx,%rdx,2), %rdx
movq (%rcx,%rdx,8), %rcx
movsd %xmm0, (%rcx,%rax,8)
retq
pushq %rax
movq 0x1a712(%rip), %rdi     # 0x36fd8
leaq 0xd952(%rip), %rsi      # 0x2a21f
callq 0x4260
movq %rax, %rdi
callq 0x4100
xorl %edi, %edi
callq 0x4290
nop
// File: /workspace/github_cpp_makefile_star2_O1/xbai0624[P]dnn/src/Matrix.cpp
// Function: Matrix::GetSection(unsigned long, unsigned long, unsigned long, unsigned long, bool, double)
Matrix Matrix::GetSection(size_t r_s, size_t r_e, size_t c_s, size_t c_e, 
        bool padding, double padding_value)
{
    // get a section of this matrix
    auto dim = Dimension();

    if( c_e <= c_s || r_e <= r_s || (int)c_s<0 || (int)r_s<0 || r_s>=dim.first || c_s>=dim.second ) 
    {
        std::cout<<"Error: wrong index provided in fetching matrix section."<<std::endl;
        std::cout<<"       front close, back open."<<std::endl;
        exit(0);
    }

    if(!padding) {
        if(r_e > dim.first || c_e > dim.second) {
            std::cout<<"Error: matrix fetching section exceeded range."<<std::endl;
            exit(0);
        }
    }

    Matrix _m(r_e - r_s, c_e - c_s);
    for(size_t i=0;i<(r_e-r_s);i++)
    {
        for(size_t j=0;j<(c_e-c_s);j++){
            if( (r_s + i) < dim.first && (c_s + j) < dim.second ){
                _m[i][j] = __M[r_s+i][c_s+j];
            } else {
                _m[i][j] = padding_value;
            }
        }
    }
    return _m;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r8, %r14
movq %rdx, %r12
movq %r9, %rdx
subq %r8, %rdx
jbe 0x1ca79
movq %rcx, %r15
movq %rsi, %r8
movq %rcx, %rsi
subq %r12, %rsi
jbe 0x1ca79
movl %r14d, %eax
orl %r12d, %eax
andl $0x80000000, %eax       # imm = 0x80000000
jne 0x1ca79
movq (%r8), %rax
movq 0x8(%r8), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
movabsq $-0x5555555555555555, %r13 # imm = 0xAAAAAAAAAAAAAAAB
imulq %rcx, %r13
cmpq %r12, %r13
jbe 0x1ca79
movq 0x8(%rax), %rbp
subq (%rax), %rbp
sarq $0x3, %rbp
cmpq %r14, %rbp
jbe 0x1ca79
movq %r9, %rbx
movq %r8, 0x8(%rsp)
movsd %xmm0, 0x10(%rsp)
cmpb $0x0, 0x50(%rsp)
jne 0x1c9f7
cmpq %r15, %r13
jb 0x1cab5
cmpq %rbx, %rbp
jb 0x1cab5
movq %rdi, (%rsp)
callq 0x1a82e
movq (%rsp), %rax
subq %r12, %r15
movsd 0x10(%rsp), %xmm1
movq 0x8(%rsp), %r10
je 0x1ca6a
xorl %r9d, %r9d
cmpq %r14, %rbx
je 0x1ca62
leaq (%r9,%r12), %rcx
leaq (%rcx,%rcx,2), %rdx
shlq $0x3, %rdx
addq (%r10), %rdx
movq (%rax), %rsi
leaq (%r9,%r9,2), %rdi
movq (%rsi,%rdi,8), %rsi
movq %r14, %rdi
movaps %xmm1, %xmm0
cmpq %r13, %rcx
jae 0x1ca52
movaps %xmm1, %xmm0
cmpq %rbp, %rdi
jae 0x1ca52
movq (%rdx), %r8
movsd (%r8,%rdi,8), %xmm0
movsd %xmm0, (%rsi)
addq $0x8, %rsi
incq %rdi
cmpq %rdi, %rbx
jne 0x1ca39
incq %r9
cmpq %r15, %r9
jne 0x1ca17
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x1a558(%rip), %rbx     # 0x36fd8
leaq 0xd7be(%rip), %rsi      # 0x2a245
movq %rbx, %rdi
callq 0x4260
movq %rax, %rdi
callq 0x4100
leaq 0xd7df(%rip), %rsi      # 0x2a27d
movq %rbx, %rdi
callq 0x4260
movq %rax, %rdi
callq 0x4100
xorl %edi, %edi
callq 0x4290
movq 0x1a51c(%rip), %rdi     # 0x36fd8
leaq 0xd7d9(%rip), %rsi      # 0x2a29c
jmp 0x1caa1
nop
// File: /workspace/github_cpp_makefile_star2_O1/xbai0624[P]dnn/src/Matrix.cpp
// Function: Matrix::Padding(unsigned long, unsigned long, bool, double)
Matrix Matrix::Padding(size_t ROW, size_t COL, bool pad_front, double padding_value)
{
    // matrix padding, only two modes supported: 1) only pad back, 2) pad back and front
    // only pad front not supported, b/c it's not useful reallistically
    auto dim = Dimension();
    if(ROW < dim.first || COL < dim.second) {
        std::cout<<"Error: trying pad matrix to a smaller size, no padding needed."<<std::endl;
        exit(0);
    }

    Matrix _m(ROW, COL, padding_value);
    if( ! pad_front){ // only pad back
        for(size_t i=0;i<dim.first;i++){
            for(size_t j=0;j<dim.second;j++){
                _m[i][j] = __M[i][j];
            }
        }
    } else { // pad back and front
        size_t extra_row = ROW - dim.first, extra_col = COL - dim.second;
        size_t extra_front_row = extra_row/2, extra_front_col = extra_col/2;
        for(size_t i=0;i<dim.first;i++){
            for(size_t j=0;j<dim.second;j++){
                _m[extra_front_row+i][extra_front_col+j] = __M[i][j];
            }
        }
    }

    return _m;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %r8d, 0x4(%rsp)
movq (%rsi), %r14
movq %rsi, 0x8(%rsp)
movq 0x8(%rsi), %rax
movq %rax, 0x18(%rsp)
subq %r14, %rax
sarq $0x3, %rax
movabsq $-0x5555555555555555, %r15 # imm = 0xAAAAAAAAAAAAAAAB
imulq %rax, %r15
movq %rdx, %rax
subq %r15, %rax
movq %rax, 0x20(%rsp)
jb 0x1cc39
movq (%r14), %r12
movq 0x8(%r14), %rbx
movq %rbx, %r13
subq %r12, %r13
sarq $0x3, %r13
movq %rcx, %rbp
subq %r13, %rbp
jb 0x1cc39
movq %rdi, 0x10(%rsp)
movq %rdx, %rsi
movq %rcx, %rdx
callq 0x1a952
cmpb $0x0, 0x4(%rsp)
je 0x1cbc9
cmpq %r14, 0x18(%rsp)
movq 0x10(%rsp), %rax
je 0x1cc2a
shrq %rbp
movq 0x20(%rsp), %rdx
shrq %rdx
movq 0x8(%rsp), %rcx
movq (%rcx), %r9
leaq (%rdx,%rdx,2), %rcx
shlq $0x3, %rcx
addq (%rax), %rcx
cmpq $0x1, %r13
adcq $0x0, %r13
cmpq $0x1, %r15
adcq $0x0, %r15
xorl %edx, %edx
shlq $0x3, %rbp
cmpq %r12, %rbx
je 0x1cbbf
leaq (,%rdx,8), %rsi
leaq (%rsi,%rsi,2), %rdi
movq (%r9,%rdi), %rsi
movq (%rcx,%rdi), %rdi
addq %rbp, %rdi
xorl %r8d, %r8d
movsd (%rsi,%r8,8), %xmm0
movsd %xmm0, (%rdi,%r8,8)
incq %r8
cmpq %r8, %r13
jne 0x1cbab
incq %rdx
cmpq %r15, %rdx
jne 0x1cb8c
jmp 0x1cc2a
cmpq %r14, 0x18(%rsp)
movq 0x10(%rsp), %rax
je 0x1cc2a
movq 0x8(%rsp), %rcx
movq (%rcx), %r9
movq (%rax), %rcx
cmpq $0x1, %r13
adcq $0x0, %r13
cmpq $0x1, %r15
adcq $0x0, %r15
xorl %edx, %edx
cmpq %r12, %rbx
je 0x1cc22
leaq (,%rdx,8), %rsi
leaq (%rsi,%rsi,2), %rdi
movq (%r9,%rdi), %rsi
movq (%rcx,%rdi), %rdi
xorl %r8d, %r8d
movsd (%rsi,%r8,8), %xmm0
movsd %xmm0, (%rdi,%r8,8)
incq %r8
cmpq %r8, %r13
jne 0x1cc0e
incq %rdx
cmpq %r15, %rdx
jne 0x1cbf2
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x1a398(%rip), %rdi     # 0x36fd8
leaq 0xd684(%rip), %rsi      # 0x2a2cb
callq 0x4260
movq %rax, %rdi
callq 0x4100
xorl %edi, %edi
callq 0x4290
nop
// File: /workspace/github_cpp_makefile_star2_O1/xbai0624[P]dnn/src/Matrix.cpp
// Function: Matrix::CombineMatrix(std::vector<Matrix, std::allocator<Matrix>>&, unsigned long, unsigned long)
Matrix Matrix::CombineMatrix(std::vector<Matrix> &vec, size_t R, size_t C)
{
    // combine a vector of matrix'es to one big matrix,
    // the big matrix dimension is R, C
    Matrix _m(R, C);
    size_t N = vec.size();
    auto dim = vec[0].Dimension();
    if(R*C != N * dim.first * dim.second ) {
        std::cout<<"Error: combining matrix dimension not match."<<std::endl;
        exit(0);
    }

    size_t index = 0;
    for(auto &m: vec){
        for(size_t i=0;i<dim.first;i++){
            for(size_t j=0;j<dim.second;j++){
                _m.FillElementByRow(index, m[i][j]);
                index++;
            }
        }
    }

    if(index != R*C) {
        std::cout<<"Error: combining matrix dimension not match."<<std::endl;
        exit(0);
    }

    return _m;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rcx, %rbx
movq %rdx, %r14
movq %rsi, %r12
movq %rdi, 0x8(%rsp)
movq %rdx, %rsi
movq %rcx, %rdx
callq 0x1a82e
movq (%r12), %r13
movq 0x8(%r12), %rdx
movq %rdx, %rax
subq %r13, %rax
sarq $0x3, %rax
movq (%r13), %rsi
movq 0x8(%r13), %rcx
movq %rcx, 0x20(%rsp)
movq %rcx, %rdi
subq %rsi, %rdi
sarq $0x3, %rdi
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rcx, %rdi
movq %rdi, %r8
imulq %rdi, %rax
movq (%rsi), %rdi
movq %rsi, 0x28(%rsp)
movq 0x8(%rsi), %r12
movq %r12, 0x38(%rsp)
movq %rdi, 0x40(%rsp)
subq %rdi, %r12
sarq $0x3, %r12
imulq %r14, %rbx
imulq %r12, %rcx
imulq %rax, %rcx
cmpq %rcx, %rbx
jne 0x1cd9a
movq %rbx, 0x10(%rsp)
cmpq %rdx, %r13
je 0x1cd7c
cmpq $0x1, %r12
adcq $0x0, %r12
cmpq $0x1, %r8
adcq $0x0, %r8
movq %r8, 0x30(%rsp)
xorl %r14d, %r14d
movq %rdx, 0x18(%rsp)
movq 0x20(%rsp), %rax
cmpq 0x28(%rsp), %rax
je 0x1cd6c
xorl %r15d, %r15d
movq 0x38(%rsp), %rax
cmpq 0x40(%rsp), %rax
je 0x1cd62
leaq (%r15,%r15,2), %rbx
xorl %ebp, %ebp
leaq (%r14,%rbp), %rsi
movq (%r13), %rax
movq (%rax,%rbx,8), %rax
movsd (%rax,%rbp,8), %xmm0
movq 0x8(%rsp), %rdi
callq 0x1c816
incq %rbp
cmpq %rbp, %r12
jne 0x1cd3c
addq %rbp, %r14
incq %r15
cmpq 0x30(%rsp), %r15
jne 0x1cd2a
addq $0x18, %r13
movq 0x18(%rsp), %rdx
cmpq %rdx, %r13
jne 0x1cd1b
jmp 0x1cd7f
xorl %r14d, %r14d
cmpq 0x10(%rsp), %r14
jne 0x1cdc0
movq 0x8(%rsp), %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x1a237(%rip), %rdi     # 0x36fd8
leaq 0xd562(%rip), %rsi      # 0x2a30a
movl $0x2c, %edx
callq 0x4280
movq 0x1a21f(%rip), %rdi     # 0x36fd8
callq 0x4100
jmp 0x1cde4
movq 0x1a211(%rip), %rdi     # 0x36fd8
leaq 0xd53c(%rip), %rsi      # 0x2a30a
movl $0x2c, %edx
callq 0x4280
movq 0x1a1f9(%rip), %rdi     # 0x36fd8
callq 0x4100
xorl %edi, %edi
callq 0x4290
jmp 0x1cdef
jmp 0x1cdef
movq %rax, %r14
movq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0x1e9ea
movq %rbx, %rdi
callq 0x146b8
movq %r14, %rdi
callq 0x43e0
nop
// File: /workspace/github_cpp_makefile_star2_O1/xbai0624[P]dnn/src/Matrix.cpp
// Function: Matrix::DispatchMatrix(Matrix&, unsigned long, unsigned long)
std::vector<Matrix> Matrix::DispatchMatrix(Matrix & M, size_t R, size_t C)
{
    // dispatch one big matrix to multiple small matrix'es, 
    // return in vector form
    // small matrix dimension R, C
    std::vector<Matrix> res;
    auto dim = M.Dimension();
    if( (dim.first*dim.second) % (R*C) != 0) {
        std::cout<<"Error: dispatch matrix dimension not match."<<std::endl;
        exit(0);
    }

    size_t index = 0;
    Matrix tmp(R, C);

    for(size_t i=0;i<dim.first;i++)
    {
        for(size_t j=0;j<dim.second;j++){
            tmp.FillElementByRow(index, M[i][j]);
            index++;
            if(index == R*C) {
                res.push_back(tmp);
                index = 0;
            }
        }
    }
    return res;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdx, %r8
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
movq %rdi, (%rsp)
movq $0x0, 0x10(%rdi)
movq (%rsi), %rbx
movq %rsi, 0x40(%rsp)
movq 0x8(%rsi), %r14
movq %r14, %rax
subq %rbx, %rax
sarq $0x3, %rax
movabsq $-0x5555555555555555, %rdx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rax, %rdx
movq (%rbx), %rax
movq 0x8(%rbx), %rbp
movq %rbp, 0x28(%rsp)
movq %rax, 0x30(%rsp)
subq %rax, %rbp
sarq $0x3, %rbp
movq %rbp, %rax
movq %rdx, %r15
imulq %rdx, %rax
movq %rcx, %r13
imulq %r8, %r13
xorl %edx, %edx
divq %r13
testq %rdx, %rdx
jne 0x1cf73
leaq 0x8(%rsp), %rdi
movq %r8, %rsi
movq %rcx, %rdx
callq 0x1a82e
cmpq %rbx, %r14
je 0x1cf29
cmpq $0x1, %rbp
adcq $0x0, %rbp
cmpq $0x1, %r15
adcq $0x0, %r15
movq %r15, 0x20(%rsp)
xorl %ecx, %ecx
leaq 0x8(%rsp), %r15
xorl %r12d, %r12d
movq 0x28(%rsp), %rax
cmpq 0x30(%rsp), %rax
movq %rcx, 0x38(%rsp)
je 0x1cf1a
leaq (%rcx,%rcx,2), %rbx
xorl %r14d, %r14d
movq 0x40(%rsp), %rax
movq (%rax), %rax
movq (%rax,%rbx,8), %rax
movsd (%rax,%r14,8), %xmm0
movq %r15, %rdi
movq %r12, %rsi
callq 0x1c816
incq %r12
cmpq %r13, %r12
jne 0x1cf12
movq (%rsp), %rdi
movq %r15, %rsi
callq 0x13a14
xorl %r12d, %r12d
incq %r14
cmpq %r14, %rbp
jne 0x1cede
movq 0x38(%rsp), %rcx
incq %rcx
cmpq 0x20(%rsp), %rcx
jne 0x1cec6
movq 0x8(%rsp), %rbx
movq 0x10(%rsp), %r14
cmpq %rbx, %r14
je 0x1cf56
movq %rbx, %r15
movq (%r15), %rdi
testq %rdi, %rdi
je 0x1cf48
callq 0x4230
addq $0x18, %r15
cmpq %r14, %r15
jne 0x1cf3b
movq %rbx, 0x10(%rsp)
leaq 0x8(%rsp), %rdi
callq 0x146b8
movq (%rsp), %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x1a05e(%rip), %rdi     # 0x36fd8
leaq 0xd3b6(%rip), %rsi      # 0x2a337
movl $0x2b, %edx
callq 0x4280
movq 0x1a046(%rip), %rdi     # 0x36fd8
callq 0x4100
xorl %edi, %edi
callq 0x4290
jmp 0x1cfa0
movq %rax, %r14
jmp 0x1cfe0
movq %rax, %r14
movq 0x8(%rsp), %rbx
movq 0x10(%rsp), %r15
cmpq %rbx, %r15
je 0x1cfd6
movq %rbx, %r12
movq (%r12), %rdi
testq %rdi, %rdi
je 0x1cfc8
callq 0x4230
addq $0x18, %r12
cmpq %r15, %r12
jne 0x1cfba
movq %rbx, 0x10(%rsp)
leaq 0x8(%rsp), %rdi
callq 0x146b8
movq (%rsp), %rdi
callq 0x136aa
movq %r14, %rdi
callq 0x43e0
nop
// File: /workspace/github_cpp_makefile_star2_O1/xbai0624[P]dnn/src/Matrix.cpp
// Function: Matrix::MaxInSection(unsigned long, unsigned long, unsigned long, unsigned long, std::pair<unsigned long, unsigned long>&)
double Matrix::MaxInSection(size_t i_start, size_t i_end, size_t j_start, size_t j_end, std::pair<size_t, size_t> &coord)
{
    // find max element in section [i_start, i_end), and [j_start, j_end)
    // in this code, we all follow the rule: close front and open end
    // and all counters start from 0
    auto dim = Dimension();
    if((int)i_start < 0 || (int)j_start < 0 || i_end <= i_start || j_end <= j_start || i_end > dim.first || j_end > dim.second){
        std::cout<<"Error: Max in matrix section: exceeded range."<<std::endl;
        exit(0);
    }
    double res = __M[i_start][j_start];
    for(size_t i=i_start;i<i_end;i++){
        for(size_t j=j_start;j<j_end;j++)
        {
            if(res < __M[i][j]){
                res = __M[i][j];
                coord.first = i;
                coord.second = j;
            }
        }
    }
    return res;
}

// Assembly:
pushq %rax
cmpq %rcx, %r8
jbe 0x1d6ec
cmpq %rsi, %rdx
jbe 0x1d6ec
movl %ecx, %eax
orl %esi, %eax
andl $0x80000000, %eax       # imm = 0x80000000
jne 0x1d6ec
movq (%rdi), %rax
movq 0x8(%rdi), %rdi
subq %rax, %rdi
sarq $0x3, %rdi
movabsq $-0x5555555555555555, %r10 # imm = 0xAAAAAAAAAAAAAAAB
imulq %rdi, %r10
cmpq %rdx, %r10
jb 0x1d6ec
movq 0x8(%rax), %rdi
subq (%rax), %rdi
sarq $0x3, %rdi
cmpq %r8, %rdi
jb 0x1d6ec
leaq (%rsi,%rsi,2), %rdi
movq (%rax,%rdi,8), %rdi
movsd (%rdi,%rcx,8), %xmm0
leaq (%rsi,%rsi,2), %rdi
movq (%rax,%rdi,8), %rdi
movq %rcx, %r10
movsd (%rdi,%r10,8), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x1d6da
movq %rsi, (%r9)
movq %r10, 0x8(%r9)
movapd %xmm1, %xmm0
incq %r10
cmpq %r10, %r8
jne 0x1d6c3
incq %rsi
cmpq %rdx, %rsi
jne 0x1d6b8
popq %rax
retq
movq 0x198e5(%rip), %rdi     # 0x36fd8
leaq 0xce3b(%rip), %rsi      # 0x2a535
callq 0x4260
movq %rax, %rdi
callq 0x4100
xorl %edi, %edi
callq 0x4290
// File: /workspace/github_cpp_makefile_star2_O1/xbai0624[P]dnn/src/Matrix.cpp
// Function: Matrix::SumInSection(unsigned long, unsigned long, unsigned long, unsigned long)
double Matrix::SumInSection(size_t i_start, size_t i_end, size_t j_start, size_t j_end)
{
    // find element sum in section [i_start, i_end), and [j_start, j_end)
    // in this code, we all follow the rule: close front and open end
    // and all counters start from 0
    auto dim = Dimension();
    if((int)i_start < 0 || (int)j_start < 0 || i_end <= i_start || j_end <= j_start || i_end > dim.first || j_end > dim.second){
        std::cout<<"Error: Sum in matrix section: exceeded range."<<std::endl;
        exit(0);
    }
    double res =  0;
    for(size_t i=i_start;i<i_end;i++){
        for(size_t j=j_start;j<j_end;j++){
            res += __M[i][j];
        }
    }

    return res;
}

// Assembly:
pushq %rax
cmpq %rcx, %r8
jbe 0x1d8ec
cmpq %rsi, %rdx
jbe 0x1d8ec
movl %ecx, %eax
orl %esi, %eax
andl $0x80000000, %eax       # imm = 0x80000000
jne 0x1d8ec
movq (%rdi), %rax
movq 0x8(%rdi), %rdi
subq %rax, %rdi
sarq $0x3, %rdi
movabsq $-0x5555555555555555, %r9 # imm = 0xAAAAAAAAAAAAAAAB
imulq %rdi, %r9
cmpq %rdx, %r9
jb 0x1d8ec
movq 0x8(%rax), %rdi
subq (%rax), %rdi
sarq $0x3, %rdi
cmpq %r8, %rdi
jb 0x1d8ec
xorpd %xmm0, %xmm0
leaq (%rsi,%rsi,2), %rdi
movq (%rax,%rdi,8), %rdi
movq %rcx, %r9
addsd (%rdi,%r9,8), %xmm0
incq %r9
cmpq %r9, %r8
jne 0x1d8d4
incq %rsi
cmpq %rdx, %rsi
jne 0x1d8c9
popq %rax
retq
movq 0x196e5(%rip), %rdi     # 0x36fd8
leaq 0xcd61(%rip), %rsi      # 0x2a65b
callq 0x4260
movq %rax, %rdi
callq 0x4100
xorl %edi, %edi
callq 0x4290
// File: /workspace/github_cpp_makefile_star2_O1/xbai0624[P]dnn/src/Matrix.cpp
// Function: Matrix::SumInSectionWithPadding(unsigned long, unsigned long, unsigned long, unsigned long)
double Matrix::SumInSectionWithPadding(size_t i_start, size_t i_end, size_t j_start, size_t j_end)
{
    // find element sum in section [i_start, i_end), and [j_start, j_end)
    // in this code, we all follow the rule: close front and open end
    // and all counters start from 0
    auto dim = Dimension();
    bool one_hit = false;

    assert((int)i_start >= 0 && i_end > i_start);
    assert((int)j_start >= 0 && j_end > j_start);

    auto in_range = [&](size_t ii, size_t jj) -> bool
    {
        if((int)ii>=0 && ii<dim.first && (int)jj>=0 && jj<dim.second)
            return true;
        return false;
    };

    double res =  0;
    for(size_t i=i_start;i<i_end;i++){
        for(size_t j=j_start;j<j_end;j++)
        {
            if(! in_range(i, j)) continue;
            one_hit = true;

            res += __M[i][j];
        }
    }

    if(!one_hit)
    {
        std::cout<<"Error: Sum in matrix section with padding: all elements exceeded range."<<std::endl;
        exit(0);
    }

    return res;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
testl %esi, %esi
js 0x1d9c0
cmpq %rsi, %rdx
jbe 0x1d9c0
testl %ecx, %ecx
js 0x1d9df
cmpq %rcx, %r8
jbe 0x1d9df
cmpq %rdx, %rsi
jae 0x1d9ac
movq (%rdi), %rax
movq 0x8(%rdi), %r9
subq %rax, %r9
sarq $0x3, %r9
movabsq $-0x5555555555555555, %rdi # imm = 0xAAAAAAAAAAAAAAAB
movq 0x8(%rax), %r10
subq (%rax), %r10
imulq %r9, %rdi
sarq $0x3, %r10
xorpd %xmm0, %xmm0
xorl %r9d, %r9d
cmpq %r8, %rcx
jae 0x1d9a2
leaq (%rsi,%rsi,2), %r11
leaq (%rax,%r11,8), %r11
movq %rcx, %rbx
testl %esi, %esi
js 0x1d99a
cmpq %rsi, %rdi
jbe 0x1d99a
movl %ebx, %ebp
andl $0x80000000, %ebp       # imm = 0x80000000
jne 0x1d99a
cmpq %rbx, %r10
jbe 0x1d99a
movq (%r11), %r9
addsd (%r9,%rbx,8), %xmm0
movb $0x1, %r9b
incq %rbx
cmpq %rbx, %r8
jne 0x1d976
incq %rsi
cmpq %rdx, %rsi
jne 0x1d966
jmp 0x1d9b3
xorpd %xmm0, %xmm0
xorl %r9d, %r9d
testb $0x1, %r9b
je 0x1d9fe
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
leaq 0xcc0b(%rip), %rdi      # 0x2a5d2
leaq 0xc669(%rip), %rsi      # 0x2a037
leaq 0xccb4(%rip), %rcx      # 0x2a689
movl $0x49a, %edx            # imm = 0x49A
callq 0x4160
leaq 0xcc11(%rip), %rdi      # 0x2a5f7
leaq 0xc64a(%rip), %rsi      # 0x2a037
leaq 0xcc95(%rip), %rcx      # 0x2a689
movl $0x49b, %edx            # imm = 0x49B
callq 0x4160
movq 0x195d3(%rip), %rdi     # 0x36fd8
leaq 0xccc4(%rip), %rsi      # 0x2a6d0
callq 0x4260
movq %rax, %rdi
callq 0x4100
xorl %edi, %edi
callq 0x4290
// File: /workspace/github_cpp_makefile_star2_O1/xbai0624[P]dnn/src/Matrix.cpp
// Function: Matrix::AverageInSection(unsigned long, unsigned long, unsigned long, unsigned long)
double Matrix::AverageInSection(size_t i_start, size_t i_end, size_t j_start, size_t j_end)
{
    // find element average in section [i_start, i_end), and [j_start, j_end)
    // in this code, we all follow the rule: close front and open end
    // and all counters start from 0
    auto dim = Dimension();
    if((int)i_start < 0 || (int)j_start < 0 || i_end <= i_start || j_end <= j_start || i_end > dim.first || j_end > dim.second){
        std::cout<<"Error: Max in matrix section: exceeded range."<<std::endl;
        exit(0);
    }
    double res =  0;
    for(size_t i=i_start;i<i_end;i++){
        for(size_t j=j_start;j<j_end;j++){
            res += __M[i][j];
        }
    }

    res = res /(int)(i_end-i_start)/(int)(j_end - j_start); 
    return res;
}

// Assembly:
pushq %rax
cmpq %rcx, %r8
jbe 0x1daae
cmpq %rsi, %rdx
jbe 0x1daae
movl %ecx, %eax
orl %esi, %eax
andl $0x80000000, %eax       # imm = 0x80000000
jne 0x1daae
movq (%rdi), %rax
movq 0x8(%rdi), %rdi
subq %rax, %rdi
sarq $0x3, %rdi
movabsq $-0x5555555555555555, %r9 # imm = 0xAAAAAAAAAAAAAAAB
imulq %rdi, %r9
cmpq %rdx, %r9
jb 0x1daae
movq 0x8(%rax), %rdi
subq (%rax), %rdi
sarq $0x3, %rdi
cmpq %r8, %rdi
jb 0x1daae
xorpd %xmm0, %xmm0
movq %rsi, %rdi
leaq (%rdi,%rdi,2), %r9
movq (%rax,%r9,8), %r9
movq %rcx, %r10
addsd (%r9,%r10,8), %xmm0
incq %r10
cmpq %r10, %r8
jne 0x1da7d
incq %rdi
cmpq %rdx, %rdi
jne 0x1da72
subl %esi, %edx
cvtsi2sd %edx, %xmm1
divsd %xmm1, %xmm0
subl %ecx, %r8d
xorps %xmm1, %xmm1
cvtsi2sd %r8d, %xmm1
divsd %xmm1, %xmm0
popq %rax
retq
movq 0x19523(%rip), %rdi     # 0x36fd8
leaq 0xca79(%rip), %rsi      # 0x2a535
callq 0x4260
movq %rax, %rdi
callq 0x4100
xorl %edi, %edi
callq 0x4290
// File: /workspace/github_cpp_makefile_star2_O1/xbai0624[P]dnn/src/Matrix.cpp
// Function: Matrix::AverageInSectionWithPadding(unsigned long, unsigned long, unsigned long, unsigned long)
double Matrix::AverageInSectionWithPadding(size_t i_start, size_t i_end, size_t j_start, size_t j_end)
{
    // find element average in section [i_start, i_end), and [j_start, j_end)
    // in this code, we all follow the rule: close front and open end
    // and all counters start from 0
    auto dim = Dimension();
    bool one_hit = false;

    assert((int)i_start >= 0 && i_end > i_start);
    assert((int)j_start >= 0 && j_end > j_start);

    auto in_range = [&](size_t ii, size_t jj) -> bool
    {
        if((int)ii>=0 && ii<dim.first && (int)jj>=0 && jj<dim.second)
            return true;
        return false;
    };

    size_t x_range = i_end < dim.first ? i_end : dim.first;
    size_t y_range = j_end < dim.second? j_end : dim.second;

    double res =  0;
    for(size_t i=i_start;i<x_range;i++){
        for(size_t j=j_start;j<y_range;j++)
        {
            if(!in_range(i, j)) continue;
            one_hit = true;

            res += __M[i][j];
        }
    }

    if(!one_hit)
    {
        std::cout<<"Error: Average in matrix section with padding: all elements exceeded range."<<std::endl;
        exit(0);
    }


    res = res / (int)(x_range-i_start)/(int)(y_range - j_start); 
    return res;
}

// Assembly:
pushq %rbx
testl %esi, %esi
js 0x1db87
cmpq %rsi, %rdx
jbe 0x1db87
testl %ecx, %ecx
js 0x1dba6
cmpq %rcx, %r8
jbe 0x1dba6
movq (%rdi), %r9
movq 0x8(%rdi), %rax
subq %r9, %rax
sarq $0x3, %rax
movabsq $-0x5555555555555555, %rdi # imm = 0xAAAAAAAAAAAAAAAB
imulq %rax, %rdi
movq 0x8(%r9), %rax
subq (%r9), %rax
sarq $0x3, %rax
cmpq %rdx, %rdi
cmovaeq %rdx, %rdi
cmpq %r8, %rax
cmovaeq %r8, %rax
xorpd %xmm0, %xmm0
xorl %edx, %edx
cmpq %rsi, %rdi
jbe 0x1db69
movq %rsi, %r8
cmpq %rcx, %rax
jbe 0x1db61
leaq (%r8,%r8,2), %r10
leaq (%r9,%r10,8), %r10
movq %rcx, %r11
movl %r8d, %ebx
orl %r11d, %ebx
js 0x1db59
movq (%r10), %rdx
addsd (%rdx,%r11,8), %xmm0
movb $0x1, %dl
incq %r11
cmpq %r11, %rax
jne 0x1db46
incq %r8
cmpq %rdi, %r8
jne 0x1db36
testb $0x1, %dl
je 0x1dbc5
subl %esi, %edi
cvtsi2sd %edi, %xmm1
divsd %xmm1, %xmm0
subl %ecx, %eax
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
divsd %xmm1, %xmm0
popq %rbx
retq
leaq 0xca44(%rip), %rdi      # 0x2a5d2
leaq 0xc4a2(%rip), %rsi      # 0x2a037
leaq 0xcb7c(%rip), %rcx      # 0x2a718
movl $0x4d7, %edx            # imm = 0x4D7
callq 0x4160
leaq 0xca4a(%rip), %rdi      # 0x2a5f7
leaq 0xc483(%rip), %rsi      # 0x2a037
leaq 0xcb5d(%rip), %rcx      # 0x2a718
movl $0x4d8, %edx            # imm = 0x4D8
callq 0x4160
movq 0x1940c(%rip), %rdi     # 0x36fd8
leaq 0xcb90(%rip), %rsi      # 0x2a763
callq 0x4260
movq %rax, %rdi
callq 0x4100
xorl %edi, %edi
callq 0x4290
nop