LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: xbai0624[P]dnn/src/ConstructLayer.cpp
// Function: cross_entropy(Matrix&, Matrix&)
static double cross_entropy(Matrix &A, Matrix &Y)
{
    auto dim = A.Dimension();
    assert(dim == Y.Dimension());
    assert(dim.second == 1);

    double res = 0.;
    for(size_t i=0;i<dim.first;i++)
    {
        if((double)A[i][0] <= 1e-10 || (double)A[i][0] >= 1-1e-10) res += 0;
        else
            //res += Y[i][0] * log(A[i][0]) + (1. - Y[i][0]) * log(1. - A[i][0]);
            res += (double)Y[i][0] * log((double)A[i][0]); 
    }

    return res; // no minus symbol here, 
    // need to add a - sign when computing the cost for this batch
}

// Assembly:
subq $0x58, %rsp
movq %rdi, 0x50(%rsp)
movq %rsi, 0x48(%rsp)
movq 0x50(%rsp), %rdi
callq 0x3bae0
movq %rax, 0x38(%rsp)
movq %rdx, 0x40(%rsp)
movq 0x38(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0x40(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0x48(%rsp), %rdi
callq 0x3bae0
movq %rax, 0x18(%rsp)
movq %rdx, 0x20(%rsp)
movq 0x28(%rsp), %rdi
movq 0x30(%rsp), %rsi
movq 0x18(%rsp), %rdx
movq 0x20(%rsp), %rcx
callq 0x3b180
testb $0x1, %al
jne 0x10379
jmp 0x1037b
jmp 0x1039a
leaq 0x43cbc(%rip), %rdi     # 0x5403e
leaq 0x41e49(%rip), %rsi     # 0x521d2
movl $0x55a, %edx            # imm = 0x55A
leaq 0x43cbe(%rip), %rcx     # 0x54053
callq 0x4170
cmpq $0x1, 0x40(%rsp)
jne 0x103a4
jmp 0x103c3
leaq 0x42797(%rip), %rdi     # 0x52b42
leaq 0x41e20(%rip), %rsi     # 0x521d2
movl $0x55b, %edx            # imm = 0x55B
leaq 0x43c95(%rip), %rcx     # 0x54053
callq 0x4170
xorps %xmm0, %xmm0
movsd %xmm0, 0x10(%rsp)
movq $0x0, 0x8(%rsp)
movq 0x8(%rsp), %rax
cmpq 0x38(%rsp), %rax
jae 0x104c5
movq 0x50(%rsp), %rdi
movq 0x8(%rsp), %rsi
callq 0x3be50
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x1fd60
movsd 0x41c38(%rip), %xmm0    # 0x52040
ucomisd (%rax), %xmm0
jae 0x1043b
movq 0x50(%rsp), %rdi
movq 0x8(%rsp), %rsi
callq 0x3be50
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x1fd60
movsd (%rax), %xmm0
movsd 0x41c13(%rip), %xmm1    # 0x52048
ucomisd %xmm1, %xmm0
jb 0x1044c
xorps %xmm0, %xmm0
addsd 0x10(%rsp), %xmm0
movsd %xmm0, 0x10(%rsp)
jmp 0x104b0
movq 0x48(%rsp), %rdi
movq 0x8(%rsp), %rsi
callq 0x3be50
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x1fd60
movsd (%rax), %xmm0
movsd %xmm0, (%rsp)
movq 0x50(%rsp), %rdi
movq 0x8(%rsp), %rsi
callq 0x3be50
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x1fd60
movsd (%rax), %xmm0
callq 0x41b0
movaps %xmm0, %xmm2
movsd (%rsp), %xmm0
movsd 0x10(%rsp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x10(%rsp)
jmp 0x104b2
movq 0x8(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x8(%rsp)
jmp 0x103d5
movsd 0x10(%rsp), %xmm0
addq $0x58, %rsp
retq
// File: xbai0624[P]dnn/src/ConstructLayer.cpp
// Function: quadratic_sum(Matrix&, Matrix&)
static double quadratic_sum(Matrix &A, Matrix &Y)
{
    // this one is only for research test, not used in reality
    auto dim = A.Dimension();
    assert(dim == Y.Dimension());
    assert(dim.second == 1);

    double res = 0.;
    for(size_t i=0;i<dim.first;i++)
    {
        res += (A[i][0] - Y[i][0]) *  (A[i][0] - Y[i][0]);
    }

    return res; // no minus symbol here, 
    // need to add a - sign when computing the cost for this batch
}

// Assembly:
subq $0x68, %rsp
movq %rdi, 0x60(%rsp)
movq %rsi, 0x58(%rsp)
movq 0x60(%rsp), %rdi
callq 0x3bae0
movq %rax, 0x48(%rsp)
movq %rdx, 0x50(%rsp)
movq 0x48(%rsp), %rax
movq %rax, 0x38(%rsp)
movq 0x50(%rsp), %rax
movq %rax, 0x40(%rsp)
movq 0x58(%rsp), %rdi
callq 0x3bae0
movq %rax, 0x28(%rsp)
movq %rdx, 0x30(%rsp)
movq 0x38(%rsp), %rdi
movq 0x40(%rsp), %rsi
movq 0x28(%rsp), %rdx
movq 0x30(%rsp), %rcx
callq 0x3b180
testb $0x1, %al
jne 0x10549
jmp 0x1054b
jmp 0x1056a
leaq 0x43aec(%rip), %rdi     # 0x5403e
leaq 0x41c79(%rip), %rsi     # 0x521d2
movl $0x579, %edx            # imm = 0x579
leaq 0x43b17(%rip), %rcx     # 0x5407c
callq 0x4170
cmpq $0x1, 0x50(%rsp)
jne 0x10574
jmp 0x10593
leaq 0x425c7(%rip), %rdi     # 0x52b42
leaq 0x41c50(%rip), %rsi     # 0x521d2
movl $0x57a, %edx            # imm = 0x57A
leaq 0x43aee(%rip), %rcx     # 0x5407c
callq 0x4170
xorps %xmm0, %xmm0
movsd %xmm0, 0x20(%rsp)
movq $0x0, 0x18(%rsp)
movq 0x18(%rsp), %rax
cmpq 0x48(%rsp), %rax
jae 0x1067a
movq 0x60(%rsp), %rdi
movq 0x18(%rsp), %rsi
callq 0x3be50
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x1fd60
movsd (%rax), %xmm0
movsd %xmm0, (%rsp)
movq 0x58(%rsp), %rdi
movq 0x18(%rsp), %rsi
callq 0x3be50
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x1fd60
movsd (%rsp), %xmm0
subsd (%rax), %xmm0
movsd %xmm0, 0x10(%rsp)
movq 0x60(%rsp), %rdi
movq 0x18(%rsp), %rsi
callq 0x3be50
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x1fd60
movsd (%rax), %xmm0
movsd %xmm0, 0x8(%rsp)
movq 0x58(%rsp), %rdi
movq 0x18(%rsp), %rsi
callq 0x3be50
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x1fd60
movsd 0x8(%rsp), %xmm2
movsd 0x10(%rsp), %xmm0
subsd (%rax), %xmm2
movsd 0x20(%rsp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x20(%rsp)
movq 0x18(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x18(%rsp)
jmp 0x105a5
movsd 0x20(%rsp), %xmm0
addq $0x68, %rsp
retq
nopw %cs:(%rax,%rax)
// File: xbai0624[P]dnn/src/ConstructLayer.cpp
// Function: ConstructLayer::FillBatchDataToInputLayerA()
void ConstructLayer::FillBatchDataToInputLayerA()
{
    // if this layer is input layer, then fill the 'a' matrix directly with input image data
    std::vector<Matrix> & input_data = __p_data_interface->GetCurrentBatchData();
    //cout<<">>>: "<<input_data.size()<<" samples in current batch from data interface"<<endl;

    // input data whitening
    if(__input_data_batch_whitening)
        Matrix::BatchNormalization(input_data);

    // first clear the previous batch
    __imageA.clear(); // input layer dropout is not used
    __imageAFull.clear();

    // load all batch data to memory, this should be faster
    for(auto &i: input_data)
    {
        Images image_a; // one image

        // input layer only has one kernel
        image_a.OutputImageFromKernel.push_back(i);

        // push this image to images of this batch
        __imageA.push_back(image_a);
        __imageAFull.push_back(image_a);
    }

    std::cout<<">>>: "<<__imageA.size()<<" samples in current batch."<<std::endl;
}

// Assembly:
subq $0x78, %rsp
movq %rdi, 0x70(%rsp)
movq 0x70(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x400(%rax), %rdi
callq 0x1fdf0
movq %rax, %rcx
movq 0x18(%rsp), %rax
movq %rcx, 0x68(%rsp)
testb $0x1, 0x488(%rax)
je 0x1074f
movq 0x68(%rsp), %rdi
callq 0x41a40
movq 0x18(%rsp), %rdi
addq $0x138, %rdi            # imm = 0x138
callq 0x1f460
movq 0x18(%rsp), %rdi
addq $0x198, %rdi            # imm = 0x198
callq 0x1f460
movq 0x68(%rsp), %rax
movq %rax, 0x60(%rsp)
movq 0x60(%rsp), %rdi
callq 0x1fe00
movq %rax, 0x58(%rsp)
movq 0x60(%rsp), %rdi
callq 0x1fe30
movq %rax, 0x50(%rsp)
leaq 0x58(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0x1fe60
testb $0x1, %al
jne 0x107b1
jmp 0x10843
leaq 0x58(%rsp), %rdi
callq 0x1fea0
movq %rax, 0x48(%rsp)
leaq 0x30(%rsp), %rdi
movq %rdi, 0x10(%rsp)
callq 0x1fda0
movq 0x10(%rsp), %rdi
movq 0x48(%rsp), %rsi
callq 0x1fa50
jmp 0x107e0
movq 0x18(%rsp), %rdi
addq $0x138, %rdi            # imm = 0x138
leaq 0x30(%rsp), %rsi
callq 0x1feb0
jmp 0x107f8
movq 0x18(%rsp), %rdi
addq $0x198, %rdi            # imm = 0x198
leaq 0x30(%rsp), %rsi
callq 0x1feb0
jmp 0x10810
leaq 0x30(%rsp), %rdi
callq 0x1fde0
leaq 0x58(%rsp), %rdi
callq 0x1ff20
jmp 0x10799
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x28(%rsp)
movl %eax, 0x24(%rsp)
leaq 0x30(%rsp), %rdi
callq 0x1fde0
jmp 0x1089c
movq 0x5a78e(%rip), %rdi     # 0x6afd8
leaq 0x41f06(%rip), %rsi     # 0x52757
callq 0x4230
movq 0x18(%rsp), %rdi
movq %rax, 0x8(%rsp)
addq $0x138, %rdi            # imm = 0x138
callq 0x1ff40
movq 0x8(%rsp), %rdi
movq %rax, %rsi
callq 0x4080
movq %rax, %rdi
leaq 0x41eda(%rip), %rsi     # 0x5275d
callq 0x4230
movq %rax, %rdi
movq 0x5a71e(%rip), %rsi     # 0x6afb0
callq 0x4260
addq $0x78, %rsp
retq
movq 0x28(%rsp), %rdi
callq 0x43f0
nopw %cs:(%rax,%rax)
// File: xbai0624[P]dnn/src/ConstructLayer.cpp
// Function: ConstructLayer::ClearUsedSampleForInputLayer_obsolete()
void ConstructLayer::ClearUsedSampleForInputLayer_obsolete()
{
    // this function not needed anymore
    if(__type != LayerType::input)
    {
        std::cout<<"Error: Clear used sample for input layer only works for input layer..."<<std::endl;
        exit(0);
    }
    if(__imageA.size() <= 0)
    {
        std::cout<<"Error: ClearUsedSampleForInputLayer(): __imageA already empty."<<std::endl;
        exit(0);
    }

    __imageA.pop_back();
}

// Assembly:
subq $0x18, %rsp
movq %rdi, 0x10(%rsp)
movq 0x10(%rsp), %rax
movq %rax, 0x8(%rsp)
cmpl $0x3, 0xc(%rax)
je 0x108f2
movq 0x5a708(%rip), %rdi     # 0x6afd8
leaq 0x41ea1(%rip), %rsi     # 0x52778
callq 0x4230
movq %rax, %rdi
movq 0x5a6ca(%rip), %rsi     # 0x6afb0
callq 0x4260
xorl %edi, %edi
callq 0x4290
movq 0x8(%rsp), %rdi
addq $0x138, %rdi            # imm = 0x138
callq 0x1ff40
cmpq $0x0, %rax
ja 0x10932
movq 0x5a6c8(%rip), %rdi     # 0x6afd8
leaq 0x41ea8(%rip), %rsi     # 0x527bf
callq 0x4230
movq %rax, %rdi
movq 0x5a68a(%rip), %rsi     # 0x6afb0
callq 0x4260
xorl %edi, %edi
callq 0x4290
movq 0x8(%rsp), %rdi
addq $0x138, %rdi            # imm = 0x138
callq 0x1ff60
addq $0x18, %rsp
retq
nopl (%rax,%rax)
// File: xbai0624[P]dnn/src/ConstructLayer.cpp
// Function: ConstructLayer::BatchNormalization_UpdateZ()
void ConstructLayer::BatchNormalization_UpdateZ()
{
    // Refer to : https://arxiv.org/pdf/1502.03167v3.pdf
    // for detailed algorithm

    // only apply for cnn, fc and output layer, no need for pooling and input layers
    if( (GetType() != LayerType::cnn) &&
            ( GetType() != LayerType::fullyConnected) &&
            (GetType() != LayerType::output))
    {
        return; 
    }

    // 1D layers
    if(GetLayerDimension() == LayerDimension::_1D)
        BatchNormalization_UpdateZ_1DLayer();

    // 2D layers
    else if(GetLayerDimension() == LayerDimension::_2D)
        BatchNormalization_UpdateZ_2DLayer();

    // unsupported layers
    else
    {
        std::cout<<"Error in batch normalization: Unsupported layer dimension."<<std::endl;
        std::cout<<"         only 1D and 2D layers are supported."<<std::endl;
        exit(0);
    }
}

// Assembly:
subq $0x18, %rsp
movq %rdi, 0x10(%rsp)
movq 0x10(%rsp), %rdi
movq %rdi, 0x8(%rsp)
movq (%rdi), %rax
callq *0x250(%rax)
cmpl $0x1, %eax
je 0x1307c
movq 0x8(%rsp), %rdi
movq (%rdi), %rax
callq *0x250(%rax)
cmpl $0x0, %eax
je 0x1307c
movq 0x8(%rsp), %rdi
movq (%rdi), %rax
callq *0x250(%rax)
cmpl $0x4, %eax
je 0x1307c
jmp 0x1310f
movq 0x8(%rsp), %rdi
movq (%rdi), %rax
callq *0x258(%rax)
cmpl $0x0, %eax
jne 0x1309f
movq 0x8(%rsp), %rdi
movq (%rdi), %rax
callq *0x198(%rax)
jmp 0x1310f
movq 0x8(%rsp), %rdi
movq (%rdi), %rax
callq *0x258(%rax)
cmpl $0x1, %eax
jne 0x130c2
movq 0x8(%rsp), %rdi
movq (%rdi), %rax
callq *0x1a0(%rax)
jmp 0x1310d
movq 0x57f0f(%rip), %rdi     # 0x6afd8
leaq 0x3fb9a(%rip), %rsi     # 0x52c6a
callq 0x4230
movq %rax, %rdi
movq 0x57ed1(%rip), %rsi     # 0x6afb0
callq 0x4260
movq 0x57eed(%rip), %rdi     # 0x6afd8
leaq 0x3fbb3(%rip), %rsi     # 0x52ca5
callq 0x4230
movq %rax, %rdi
movq 0x57eaf(%rip), %rsi     # 0x6afb0
callq 0x4260
xorl %edi, %edi
callq 0x4290
jmp 0x1310f
addq $0x18, %rsp
retq
nopw %cs:(%rax,%rax)
// File: xbai0624[P]dnn/src/ConstructLayer.cpp
// Function: ConstructLayer::GetImagesActiveDelta()
std::vector<Images>& ConstructLayer::GetImagesActiveDelta()
{
    if(__type == LayerType::cnn || __type == LayerType::fullyConnected || __type == LayerType::output) 
    {
        // batch normalization is only applied for cnn, fc, output layers
        if(__use_batch_normalization)
            return __imageDelta_BN;
        else
            return __imageDelta;
    }
    else
        return __imageDelta;
}

// Assembly:
movq %rdi, -0x10(%rsp)
movq -0x10(%rsp), %rax
movq %rax, -0x18(%rsp)
cmpl $0x1, 0xc(%rax)
je 0x1349b
movq -0x18(%rsp), %rax
cmpl $0x0, 0xc(%rax)
je 0x1349b
movq -0x18(%rsp), %rax
cmpl $0x4, 0xc(%rax)
jne 0x134cd
movq -0x18(%rsp), %rax
testb $0x1, 0x210(%rax)
je 0x134bb
movq -0x18(%rsp), %rax
addq $0x2d8, %rax            # imm = 0x2D8
movq %rax, -0x8(%rsp)
jmp 0x134dd
movq -0x18(%rsp), %rax
addq $0x180, %rax            # imm = 0x180
movq %rax, -0x8(%rsp)
jmp 0x134dd
movq -0x18(%rsp), %rax
addq $0x180, %rax            # imm = 0x180
movq %rax, -0x8(%rsp)
movq -0x8(%rsp), %rax
retq
nopw %cs:(%rax,%rax)
// File: xbai0624[P]dnn/src/ConstructLayer.cpp
// Function: ConstructLayer::DropOut()
void ConstructLayer::DropOut()
{
    if(__type == LayerType::fullyConnected)
        __UpdateActiveFlagFC();
    else if(__type == LayerType::cnn || __type == LayerType::pooling)
        __UpdateActiveFlagCNN();
    else 
    {
        std::cout<<"Error: drop out, un-recongnized layer type."<<std::endl;
        exit(0);
    }
}

// Assembly:
subq $0x18, %rsp
movq %rdi, 0x10(%rsp)
movq 0x10(%rsp), %rax
movq %rax, 0x8(%rsp)
cmpl $0x0, 0xc(%rax)
jne 0x13bb5
movq 0x8(%rsp), %rdi
callq 0x13c10
jmp 0x13c02
movq 0x8(%rsp), %rax
cmpl $0x1, 0xc(%rax)
je 0x13bcb
movq 0x8(%rsp), %rax
cmpl $0x2, 0xc(%rax)
jne 0x13bd7
movq 0x8(%rsp), %rdi
callq 0x13ca0
jmp 0x13c00
movq 0x573fa(%rip), %rdi     # 0x6afd8
leaq 0x3f2b0(%rip), %rsi     # 0x52e95
callq 0x4230
movq %rax, %rdi
movq 0x573bc(%rip), %rsi     # 0x6afb0
callq 0x4260
xorl %edi, %edi
callq 0x4290
jmp 0x13c02
addq $0x18, %rsp
retq
nopw (%rax,%rax)
// File: xbai0624[P]dnn/src/ConstructLayer.cpp
// Function: ConstructLayer::ClearImage()
void ConstructLayer::ClearImage()
{
    // members in this routine needs to be cleared for each batch
    // because contents are different for each batch
    // and to avoid memory leak

    __imageA.clear();
    __imageZ.clear();
    __imageSigmaPrime.clear();
    __imageDelta.clear();

    __imageAFull.clear();
    __imageZFull.clear();
    __imageSigmaPrimeFull.clear();
    __imageDeltaFull.clear();

    __outputLayerCost.clear();

    __wGradient.clear();
    __bGradient.clear();

    // batch normalization
    __imageZ_BN.clear();
    __imageZFull_BN.clear();
    __imageY_BN.clear();
    __imageYFull_BN.clear();
    __imageAverage_BN.clear();
    __imageAverageFull_BN.clear();
    __imageVariance_BN.clear();
    __imageVarianceFull_BN.clear();
    __imageDelta_BN.clear();
    __imageDeltaFull_BN.clear();
}

// Assembly:
subq $0x18, %rsp
movq %rdi, 0x10(%rsp)
movq 0x10(%rsp), %rdi
movq %rdi, 0x8(%rsp)
addq $0x138, %rdi            # imm = 0x138
callq 0x1f460
movq 0x8(%rsp), %rdi
addq $0x150, %rdi            # imm = 0x150
callq 0x1f460
movq 0x8(%rsp), %rdi
addq $0x168, %rdi            # imm = 0x168
callq 0x1f460
movq 0x8(%rsp), %rdi
addq $0x180, %rdi            # imm = 0x180
callq 0x1f460
movq 0x8(%rsp), %rdi
addq $0x198, %rdi            # imm = 0x198
callq 0x1f460
movq 0x8(%rsp), %rdi
addq $0x1b0, %rdi            # imm = 0x1B0
callq 0x1f460
movq 0x8(%rsp), %rdi
addq $0x1c8, %rdi            # imm = 0x1C8
callq 0x1f460
movq 0x8(%rsp), %rdi
addq $0x1e0, %rdi            # imm = 0x1E0
callq 0x1f460
movq 0x8(%rsp), %rdi
addq $0x1f8, %rdi            # imm = 0x1F8
callq 0x21770
movq 0x8(%rsp), %rdi
addq $0x90, %rdi
callq 0x1f460
movq 0x8(%rsp), %rdi
addq $0xa8, %rdi
callq 0x1f460
movq 0x8(%rsp), %rdi
addq $0x218, %rdi            # imm = 0x218
callq 0x1f460
movq 0x8(%rsp), %rdi
addq $0x230, %rdi            # imm = 0x230
callq 0x1f460
movq 0x8(%rsp), %rdi
addq $0x248, %rdi            # imm = 0x248
callq 0x1f460
movq 0x8(%rsp), %rdi
addq $0x260, %rdi            # imm = 0x260
callq 0x1f460
movq 0x8(%rsp), %rdi
addq $0x278, %rdi            # imm = 0x278
callq 0x1f460
movq 0x8(%rsp), %rdi
addq $0x290, %rdi            # imm = 0x290
callq 0x1f460
movq 0x8(%rsp), %rdi
addq $0x2a8, %rdi            # imm = 0x2A8
callq 0x1f460
movq 0x8(%rsp), %rdi
addq $0x2c0, %rdi            # imm = 0x2C0
callq 0x1f460
movq 0x8(%rsp), %rdi
addq $0x2d8, %rdi            # imm = 0x2D8
callq 0x1f460
movq 0x8(%rsp), %rdi
addq $0x2f0, %rdi            # imm = 0x2F0
callq 0x1f460
addq $0x18, %rsp
retq
nopl (%rax,%rax)
// File: xbai0624[P]dnn/src/ConstructLayer.cpp
// Function: ConstructLayer::GetBatchSize()
int ConstructLayer::GetBatchSize()
{
    if( __p_data_interface == nullptr)
    {
        std::cout<<"Error: ConstructLayer::GetBatchSize() data interface is nullptr."
            <<std::endl;
        exit(0);
    }

    int batch_size = __p_data_interface -> GetBatchSize();
    if(batch_size <= 0)
    {
        std::cout<<"Error: ConstructLayer::GetBatchSize() batch size is 0, seems data interface is not implemented."
            <<std::endl;
        exit(0);
    }
    return batch_size;
}

// Assembly:
subq $0x18, %rsp
movq %rdi, 0x10(%rsp)
movq 0x10(%rsp), %rax
movq %rax, (%rsp)
cmpq $0x0, 0x400(%rax)
jne 0x15e25
movq 0x551d5(%rip), %rdi     # 0x6afd8
leaq 0x3d3ab(%rip), %rsi     # 0x531b5
callq 0x4230
movq %rax, %rdi
movq 0x55197(%rip), %rsi     # 0x6afb0
callq 0x4260
xorl %edi, %edi
callq 0x4290
movq (%rsp), %rax
movq 0x400(%rax), %rdi
callq 0x1f310
movl %eax, 0xc(%rsp)
cmpl $0x0, 0xc(%rsp)
jg 0x15e69
movq 0x55191(%rip), %rdi     # 0x6afd8
leaq 0x3d3a8(%rip), %rsi     # 0x531f6
callq 0x4230
movq %rax, %rdi
movq 0x55153(%rip), %rsi     # 0x6afb0
callq 0x4260
xorl %edi, %edi
callq 0x4290
movl 0xc(%rsp), %eax
addq $0x18, %rsp
retq
nopw %cs:(%rax,%rax)
// File: xbai0624[P]dnn/src/ConstructLayer.cpp
// Function: ConstructLayer::GetCostFuncType()
CostFuncType ConstructLayer::GetCostFuncType()
{
    if(__type != LayerType::output)
    {
        std::cout<<"Error: ConstructLayer::GetCostFuncType() only works for output layer"
            <<std::endl;
        exit(0);
    }
    return __cost_func_type;
}

// Assembly:
subq $0x18, %rsp
movq %rdi, 0x10(%rsp)
movq 0x10(%rsp), %rax
movq %rax, 0x8(%rsp)
cmpl $0x4, 0xc(%rax)
je 0x15ec2
movq 0x55138(%rip), %rdi     # 0x6afd8
leaq 0x3d3af(%rip), %rsi     # 0x53256
callq 0x4230
movq %rax, %rdi
movq 0x550fa(%rip), %rsi     # 0x6afb0
callq 0x4260
xorl %edi, %edi
callq 0x4290
movq 0x8(%rsp), %rax
movl 0x3e8(%rax), %eax
addq $0x18, %rsp
retq
nopw %cs:(%rax,%rax)
// File: xbai0624[P]dnn/src/ConstructLayer.cpp
// Function: ConstructLayer::GetDataInterface()
DataInterface * ConstructLayer::GetDataInterface()
{
    if(__p_data_interface == nullptr)
    {
        std::cout<<"Error: ConstructLayer::GetDataInterface() data interface is nullptr."
            <<std::endl;
        exit(0);
    }
    return __p_data_interface;
}

// Assembly:
subq $0x18, %rsp
movq %rdi, 0x10(%rsp)
movq 0x10(%rsp), %rax
movq %rax, 0x8(%rsp)
cmpq $0x0, 0x400(%rax)
jne 0x15f36
movq 0x550c4(%rip), %rdi     # 0x6afd8
leaq 0x3d380(%rip), %rsi     # 0x5329b
callq 0x4230
movq %rax, %rdi
movq 0x55086(%rip), %rsi     # 0x6afb0
callq 0x4260
xorl %edi, %edi
callq 0x4290
movq 0x8(%rsp), %rax
movq 0x400(%rax), %rax
addq $0x18, %rsp
retq
nopw (%rax,%rax)
// File: xbai0624[P]dnn/src/ConstructLayer.cpp
// Function: ConstructLayer::GetNextLayer()
Layer* ConstructLayer::GetNextLayer()
{
    if(__nextLayer == nullptr)
    {
        std::cout<<"Error: ConstructLayer::GetNextLayer(): __nextLayer is not setup"
            <<std::endl;
        exit(0);
    }
    return __nextLayer;
}

// Assembly:
subq $0x18, %rsp
movq %rdi, 0x10(%rsp)
movq 0x10(%rsp), %rax
movq %rax, 0x8(%rsp)
cmpq $0x0, 0x3f8(%rax)
jne 0x15f96
movq 0x55064(%rip), %rdi     # 0x6afd8
leaq 0x3d365(%rip), %rsi     # 0x532e0
callq 0x4230
movq %rax, %rdi
movq 0x55026(%rip), %rsi     # 0x6afb0
callq 0x4260
xorl %edi, %edi
callq 0x4290
movq 0x8(%rsp), %rax
movq 0x3f8(%rax), %rax
addq $0x18, %rsp
retq
nopw (%rax,%rax)
// File: xbai0624[P]dnn/src/ConstructLayer.cpp
// Function: ConstructLayer::GetPrevLayer()
Layer* ConstructLayer::GetPrevLayer()
{
    if(__prevLayer == nullptr)
    {
        std::cout<<"Error: ConstructLayer::GetNextLayer(): __prevLayer is not setup"
            <<std::endl;
        exit(0);
    }

    return __prevLayer;
}

// Assembly:
subq $0x18, %rsp
movq %rdi, 0x10(%rsp)
movq 0x10(%rsp), %rax
movq %rax, 0x8(%rsp)
cmpq $0x0, 0x3f0(%rax)
jne 0x15ff6
movq 0x55004(%rip), %rdi     # 0x6afd8
leaq 0x3d345(%rip), %rsi     # 0x53320
callq 0x4230
movq %rax, %rdi
movq 0x54fc6(%rip), %rsi     # 0x6afb0
callq 0x4260
xorl %edi, %edi
callq 0x4290
movq 0x8(%rsp), %rax
movq 0x3f0(%rax), %rax
addq $0x18, %rsp
retq
nopw (%rax,%rax)
// File: xbai0624[P]dnn/src/ConstructLayer.cpp
// Function: ConstructLayer::UpdateWeightsAndBias()
void ConstructLayer::UpdateWeightsAndBias()
{
    // after finishing one training batch, update weights and bias

    // 1) first update w&b graidents
    UpdateWeightsAndBiasGradients();

    // 2) then update weights and bias
    auto layerType = this->GetType();

    if(layerType == LayerType::fullyConnected || layerType == LayerType::output)  // output is also a fc layer
    {
        UpdateWeightsAndBiasFC();
    }
    else if(layerType == LayerType::cnn) 
    {
        UpdateWeightsAndBiasCNN();
    }
    else if(layerType == LayerType::pooling) 
    {
        UpdateWeightsAndBiasPooling();
    }
    else 
    {
        std::cout<<__func__<<" Error: update weights and bias, unsupported layer type."<<std::endl;
        exit(0);
    }

    // 3) if use batch normalization, update \gamma and \beta
    if(__use_batch_normalization)
        BatchNormalization_UpdateGammaBeta();
}

// Assembly:
subq $0x18, %rsp
movq %rdi, 0x10(%rsp)
movq 0x10(%rsp), %rdi
movq %rdi, (%rsp)
callq 0x160d0
movq (%rsp), %rdi
movq (%rdi), %rax
callq *0x250(%rax)
movl %eax, 0xc(%rsp)
cmpl $0x0, 0xc(%rsp)
je 0x16046
cmpl $0x4, 0xc(%rsp)
jne 0x16051
movq (%rsp), %rdi
callq 0x16170
jmp 0x160b1
cmpl $0x1, 0xc(%rsp)
jne 0x16063
movq (%rsp), %rdi
callq 0x173f0
jmp 0x160af
cmpl $0x2, 0xc(%rsp)
jne 0x16075
movq (%rsp), %rdi
callq 0x18150
jmp 0x160ad
movq 0x54f5c(%rip), %rdi     # 0x6afd8
leaq 0x3d2dd(%rip), %rsi     # 0x53360
callq 0x4230
movq %rax, %rdi
leaq 0x3d2e3(%rip), %rsi     # 0x53375
callq 0x4230
movq %rax, %rdi
movq 0x54f0f(%rip), %rsi     # 0x6afb0
callq 0x4260
xorl %edi, %edi
callq 0x4290
jmp 0x160af
jmp 0x160b1
movq (%rsp), %rax
testb $0x1, 0x210(%rax)
je 0x160c7
movq (%rsp), %rdi
callq 0x18160
addq $0x18, %rsp
retq
nopl (%rax)
// File: xbai0624[P]dnn/src/ConstructLayer.cpp
// Function: ConstructLayer::UpdateWeightsAndBiasGradients()
void ConstructLayer::UpdateWeightsAndBiasGradients()
{
    // after finishing one training batch, update weights and bias gradients
    auto layerType = this->GetType();

    if(layerType == LayerType::fullyConnected || layerType == LayerType::output)  // output is also a fully connected layer
    {
        UpdateWeightsAndBiasGradientsFC();
    }
    else if(layerType == LayerType::cnn) 
    {
        UpdateWeightsAndBiasGradientsCNN();
    }
    else if(layerType == LayerType::pooling) 
    {
        UpdateWeightsAndBiasGradientsPooling();
    }
    else 
    {
        std::cout<<__func__<<" Error: update weights and bias gradients, unsupported layer type."<<std::endl;
        exit(0);
    }
}

// Assembly:
subq $0x18, %rsp
movq %rdi, 0x10(%rsp)
movq 0x10(%rsp), %rdi
movq %rdi, (%rsp)
movq (%rdi), %rax
callq *0x250(%rax)
movl %eax, 0xc(%rsp)
cmpl $0x0, 0xc(%rsp)
je 0x160fd
cmpl $0x4, 0xc(%rsp)
jne 0x16108
movq (%rsp), %rdi
callq 0x18550
jmp 0x16168
cmpl $0x1, 0xc(%rsp)
jne 0x1611a
movq (%rsp), %rdi
callq 0x18d70
jmp 0x16166
cmpl $0x2, 0xc(%rsp)
jne 0x1612c
movq (%rsp), %rdi
callq 0x19330
jmp 0x16164
movq 0x54ea5(%rip), %rdi     # 0x6afd8
leaq 0x3d274(%rip), %rsi     # 0x533ae
callq 0x4230
movq %rax, %rdi
leaq 0x3d283(%rip), %rsi     # 0x533cc
callq 0x4230
movq %rax, %rdi
movq 0x54e58(%rip), %rsi     # 0x6afb0
callq 0x4260
xorl %edi, %edi
callq 0x4290
jmp 0x16166
jmp 0x16168
addq $0x18, %rsp
retq
nopl (%rax)
// File: xbai0624[P]dnn/src/ConstructLayer.cpp
// Function: ConstructLayer::GetOutputImageSize()
std::pair<size_t, size_t> ConstructLayer::GetOutputImageSize()
{
    if(__type == LayerType::fullyConnected)
        return GetOutputImageSizeFC();
    else if(__type == LayerType::cnn)
        return GetOutputImageSizeCNN();
    else if(__type == LayerType::input)
        return GetOutputImageSizeInputLayer();
    else if(__type == LayerType::output) // for now, output layer is fully connected
        return GetOutputImageSizeFC();
    else
        return GetOutputImageSizeCNN();
}

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x10(%rsp)
movq 0x10(%rsp), %rax
movq %rax, 0x8(%rsp)
cmpl $0x0, 0xc(%rax)
jne 0x1a2b6
movq 0x8(%rsp), %rdi
movq (%rdi), %rax
callq *0x2f0(%rax)
movq %rax, 0x18(%rsp)
movq %rdx, 0x20(%rsp)
jmp 0x1a33d
movq 0x8(%rsp), %rax
cmpl $0x1, 0xc(%rax)
jne 0x1a2db
movq 0x8(%rsp), %rdi
movq (%rdi), %rax
callq *0x2e8(%rax)
movq %rax, 0x18(%rsp)
movq %rdx, 0x20(%rsp)
jmp 0x1a33d
movq 0x8(%rsp), %rax
cmpl $0x3, 0xc(%rax)
jne 0x1a300
movq 0x8(%rsp), %rdi
movq (%rdi), %rax
callq *0x2f8(%rax)
movq %rax, 0x18(%rsp)
movq %rdx, 0x20(%rsp)
jmp 0x1a33d
movq 0x8(%rsp), %rax
cmpl $0x4, 0xc(%rax)
jne 0x1a325
movq 0x8(%rsp), %rdi
movq (%rdi), %rax
callq *0x2f0(%rax)
movq %rax, 0x18(%rsp)
movq %rdx, 0x20(%rsp)
jmp 0x1a33d
movq 0x8(%rsp), %rdi
movq (%rdi), %rax
callq *0x2e8(%rax)
movq %rax, 0x18(%rsp)
movq %rdx, 0x20(%rsp)
movq 0x18(%rsp), %rax
movq 0x20(%rsp), %rdx
addq $0x28, %rsp
retq
nopl (%rax)
// File: xbai0624[P]dnn/src/ConstructLayer.cpp
// Function: ConstructLayer::GetNumberOfNeurons()
int ConstructLayer::GetNumberOfNeurons()
{
    if(__type == LayerType::fullyConnected || __type == LayerType::output ) // output layer is also a fully connected layer
    {
        // used for setup fc layer
        return __n_neurons_fc;
    }
    else if(__type == LayerType::input)
    {
        auto dim = __neurons[0].Dimension();
        return static_cast<int>((dim.first * dim.second));
    }
    else if(__type == LayerType::cnn || __type == LayerType::pooling)
    {
        auto dim = GetOutputImageSize();
        return static_cast<int>((dim.first * dim.second * __n_kernels_cnn));
    }
    else
    {
        std::cout<<"Warning: GetNumberOfNeurons only work for fc and input layer."<<std::endl;
        return 0;
    }
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x28(%rsp)
movq 0x28(%rsp), %rax
movq %rax, (%rsp)
cmpl $0x0, 0xc(%rax)
je 0x1a412
movq (%rsp), %rax
cmpl $0x4, 0xc(%rax)
jne 0x1a423
movq (%rsp), %rax
movq 0x10(%rax), %rax
movl %eax, 0x34(%rsp)
jmp 0x1a4d0
movq (%rsp), %rax
cmpl $0x3, 0xc(%rax)
jne 0x1a461
movq (%rsp), %rdi
addq $0x40, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x1f650
movq %rax, %rdi
callq 0x1f530
movq %rax, 0x18(%rsp)
movq %rdx, 0x20(%rsp)
movq 0x18(%rsp), %rax
imulq 0x20(%rsp), %rax
movl %eax, 0x34(%rsp)
jmp 0x1a4d0
movq (%rsp), %rax
cmpl $0x1, 0xc(%rax)
je 0x1a475
movq (%rsp), %rax
cmpl $0x2, 0xc(%rax)
jne 0x1a4a6
movq (%rsp), %rdi
movq (%rdi), %rax
callq *0x270(%rax)
movq (%rsp), %rcx
movq %rax, 0x8(%rsp)
movq %rdx, 0x10(%rsp)
movq 0x8(%rsp), %rax
imulq 0x10(%rsp), %rax
imulq 0x18(%rcx), %rax
movl %eax, 0x34(%rsp)
jmp 0x1a4d0
movq 0x50b2b(%rip), %rdi     # 0x6afd8
leaq 0x395ee(%rip), %rsi     # 0x53aa2
callq 0x4230
movq %rax, %rdi
movq 0x50aed(%rip), %rsi     # 0x6afb0
callq 0x4260
movl $0x0, 0x34(%rsp)
movl 0x34(%rsp), %eax
addq $0x38, %rsp
retq
nopl (%rax)
// File: xbai0624[P]dnn/./include/Layer.h
// Function: Images::Vectorization() const
Images Vectorization() const
    {
        // combine outputs from all kernels into a one-collum matrix
        // this is for feedforward from 2D layer to 1D layer 
        //     (2D layer can have multiple kernels, 1D layer should only have 1 "kernel");
        assert(OutputImageFromKernel.size() > 0);
        auto dim = OutputImageFromKernel[0].Dimension();

        Images tmp = ReshapeKernels(dim.first*dim.second, 1);
        Matrix large_vector = Matrix::ConcatenateMatrixByI(tmp.OutputImageFromKernel);

        tmp.OutputImageFromKernel.clear();
        tmp.OutputImageFromKernel.push_back(large_vector);
        return tmp;
    }

// Assembly:
subq $0x68, %rsp
movq %rdi, (%rsp)
movq %rdi, %rax
movq %rax, 0x8(%rsp)
movq %rdi, 0x60(%rsp)
movq %rsi, 0x58(%rsp)
movq 0x58(%rsp), %rdi
movq %rdi, 0x10(%rsp)
callq 0x1f9c0
cmpq $0x0, %rax
jbe 0x217f1
jmp 0x21810
leaq 0x32cc0(%rip), %rdi     # 0x544b8
leaq 0x3291d(%rip), %rsi     # 0x5411c
movl $0x159, %edx            # imm = 0x159
leaq 0x32cce(%rip), %rcx     # 0x544d9
callq 0x4170
movq 0x10(%rsp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x29840
movq %rax, %rdi
callq 0x3bae0
movq 0x10(%rsp), %rsi
movq (%rsp), %rdi
movq %rax, 0x48(%rsp)
movq %rdx, 0x50(%rsp)
movb $0x0, 0x47(%rsp)
movq 0x48(%rsp), %rdx
movq 0x50(%rsp), %rax
imulq %rax, %rdx
movl $0x1, %ecx
callq 0x29860
movq (%rsp), %rsi
leaq 0x28(%rsp), %rdi
callq 0x3fac0
jmp 0x21866
movq (%rsp), %rdi
callq 0x1fa00
movq (%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0x1fa50
jmp 0x2187f
movb $0x1, 0x47(%rsp)
leaq 0x28(%rsp), %rdi
callq 0x3bb80
testb $0x1, 0x47(%rsp)
jne 0x218ca
jmp 0x218c1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x20(%rsp)
movl %eax, 0x1c(%rsp)
jmp 0x218d4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x20(%rsp)
movl %eax, 0x1c(%rsp)
leaq 0x28(%rsp), %rdi
callq 0x3bb80
jmp 0x218d4
movq (%rsp), %rdi
callq 0x1fde0
movq 0x8(%rsp), %rax
addq $0x68, %rsp
retq
movq (%rsp), %rdi
callq 0x1fde0
movq 0x20(%rsp), %rdi
callq 0x43f0
nopw (%rax,%rax)
// File: xbai0624[P]dnn/./include/Layer.h
// Function: Filter2D::GetNumberOfTrueElements()
int GetNumberOfTrueElements()
    {
        int count = 0;
        auto dim = Dimension();
        for(size_t i=0;i<dim.first;i++)
            for(size_t j=0;j<dim.second;j++)
                if(__filter[i][j]) count++;
        return count;
    }

// Assembly:
subq $0x48, %rsp
movq %rdi, 0x40(%rsp)
movq 0x40(%rsp), %rdi
movq %rdi, (%rsp)
movl $0x0, 0x3c(%rsp)
callq 0x200b0
movq %rax, 0x28(%rsp)
movq %rdx, 0x30(%rsp)
movq $0x0, 0x20(%rsp)
movq 0x20(%rsp), %rax
cmpq 0x28(%rsp), %rax
jae 0x2975a
movq $0x0, 0x18(%rsp)
movq 0x18(%rsp), %rax
cmpq 0x30(%rsp), %rax
jae 0x29745
movq (%rsp), %rdi
movq 0x20(%rsp), %rsi
callq 0x279b0
movq %rax, %rdi
movq 0x18(%rsp), %rsi
callq 0x20020
movq %rax, 0x8(%rsp)
movq %rdx, 0x10(%rsp)
leaq 0x8(%rsp), %rdi
callq 0x20080
testb $0x1, %al
jne 0x29728
jmp 0x29733
movl 0x3c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x3c(%rsp)
jmp 0x29735
movq 0x18(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x18(%rsp)
jmp 0x296e7
jmp 0x29747
movq 0x20(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x20(%rsp)
jmp 0x296d2
movl 0x3c(%rsp), %eax
addq $0x48, %rsp
retq
nopw %cs:(%rax,%rax)
nopl (%rax)
// File: xbai0624[P]dnn/./include/Layer.h
// Function: Images::ReshapeKernels(unsigned long, unsigned long) const
Images ReshapeKernels(size_t I, size_t J) const
    {
        // reshape matrix from different kernels
        assert(OutputImageFromKernel.size() > 0);
        Images res;
        for(auto &i: OutputImageFromKernel)	
        {
            auto dim = i.Dimension();
            assert(dim.first * dim.second == I * J);
            Matrix tmp = i.Reshape(I, J);
            res.OutputImageFromKernel.push_back(tmp);
        }
        return res;
    }

// Assembly:
subq $0xa8, %rsp
movq %rdi, 0x10(%rsp)
movq %rdi, %rax
movq %rax, 0x18(%rsp)
movq %rdi, 0xa0(%rsp)
movq %rsi, 0x98(%rsp)
movq %rdx, 0x90(%rsp)
movq %rcx, 0x88(%rsp)
movq 0x98(%rsp), %rdi
movq %rdi, 0x20(%rsp)
callq 0x1f9c0
cmpq $0x0, %rax
jbe 0x298ae
jmp 0x298cd
leaq 0x2ac03(%rip), %rdi     # 0x544b8
leaq 0x2a860(%rip), %rsi     # 0x5411c
movl $0x148, %edx            # imm = 0x148
leaq 0x2ac36(%rip), %rcx     # 0x544fe
callq 0x4170
movq 0x10(%rsp), %rdi
movb $0x0, 0x87(%rsp)
callq 0x1fda0
movq 0x20(%rsp), %rax
movq %rax, 0x78(%rsp)
movq 0x78(%rsp), %rdi
callq 0x29a50
movq %rax, 0x70(%rsp)
movq 0x78(%rsp), %rdi
callq 0x29a80
movq %rax, 0x68(%rsp)
leaq 0x70(%rsp), %rdi
leaq 0x68(%rsp), %rsi
callq 0x29ab0
testb $0x1, %al
jne 0x2991f
jmp 0x29a10
leaq 0x70(%rsp), %rdi
callq 0x29af0
movq %rax, 0x60(%rsp)
movq 0x60(%rsp), %rdi
callq 0x3bae0
movq %rdx, (%rsp)
movq %rax, 0x8(%rsp)
jmp 0x29943
movq (%rsp), %rax
movq 0x8(%rsp), %rcx
movq %rcx, 0x50(%rsp)
movq %rax, 0x58(%rsp)
movq 0x50(%rsp), %rax
imulq 0x58(%rsp), %rax
movq 0x90(%rsp), %rcx
imulq 0x88(%rsp), %rcx
cmpq %rcx, %rax
jne 0x29979
jmp 0x299ab
leaq 0x2abb2(%rip), %rdi     # 0x54532
leaq 0x2a795(%rip), %rsi     # 0x5411c
movl $0x14d, %edx            # imm = 0x14D
leaq 0x2ab6b(%rip), %rcx     # 0x544fe
callq 0x4170
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x48(%rsp)
movl %eax, 0x44(%rsp)
jmp 0x29a39
movq 0x60(%rsp), %rsi
movq 0x90(%rsp), %rdx
movq 0x88(%rsp), %rcx
leaq 0x28(%rsp), %rdi
callq 0x3df60
jmp 0x299cc
movq 0x10(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0x1fa50
jmp 0x299dd
leaq 0x28(%rsp), %rdi
callq 0x3bb80
leaq 0x70(%rsp), %rdi
callq 0x29b00
jmp 0x29907
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x48(%rsp)
movl %eax, 0x44(%rsp)
leaq 0x28(%rsp), %rdi
callq 0x3bb80
jmp 0x29a39
movb $0x1, 0x87(%rsp)
testb $0x1, 0x87(%rsp)
jne 0x29a2c
movq 0x10(%rsp), %rdi
callq 0x1fde0
movq 0x18(%rsp), %rax
addq $0xa8, %rsp
retq
movq 0x10(%rsp), %rdi
callq 0x1fde0
movq 0x48(%rsp), %rdi
callq 0x43f0
nopl (%rax)
// File: xbai0624[P]dnn/src/DataInterface.cpp
// Function: DataInterface::DataInterface(LayerDimension)
DataInterface::DataInterface(LayerDimension ld)
{
    // 1)
    __gLayerDimension = ld;
    // place holder
    // currently only accepts 2D image format
    test();
}

// Assembly:
subq $0x58, %rsp
movq %rdi, 0x50(%rsp)
movl %esi, 0x4c(%rsp)
movq 0x50(%rsp), %rdi
movq %rdi, 0x30(%rsp)
movl $0x64, (%rdi)
movl $0x0, 0x4(%rdi)
movl $0x0, 0x8(%rdi)
addq $0x10, %rdi
movq %rdi, 0x10(%rsp)
callq 0x1f050
movq 0x30(%rsp), %rdi
addq $0x28, %rdi
movq %rdi, 0x18(%rsp)
callq 0x1f050
movq 0x30(%rsp), %rdi
addq $0x40, %rdi
movq %rdi, 0x20(%rsp)
callq 0x1f060
movq 0x30(%rsp), %rdi
addq $0x58, %rdi
movq %rdi, 0x28(%rsp)
callq 0x1f060
movq 0x30(%rsp), %rdi
addq $0x70, %rdi
callq 0x1f020
jmp 0x38d42
movq 0x30(%rsp), %rdi
subq $-0x80, %rdi
callq 0x1f020
jmp 0x38d52
movq 0x30(%rsp), %rdi
addq $0x90, %rdi
movq %rdi, (%rsp)
callq 0x1f050
movq 0x30(%rsp), %rdi
addq $0xa8, %rdi
movq %rdi, 0x8(%rsp)
callq 0x1f050
movq 0x30(%rsp), %rdi
movl $0x2, 0xc0(%rdi)
movl 0x4c(%rsp), %eax
movl %eax, 0xc0(%rdi)
callq 0x38e10
jmp 0x38d9d
addq $0x58, %rsp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x40(%rsp)
movl %eax, 0x3c(%rsp)
jmp 0x38dd3
movq 0x8(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x40(%rsp)
movl %eax, 0x3c(%rsp)
callq 0x1f0d0
movq (%rsp), %rdi
callq 0x1f0d0
movq 0x28(%rsp), %rdi
callq 0x1f130
movq 0x20(%rsp), %rdi
callq 0x1f130
movq 0x18(%rsp), %rdi
callq 0x1f0d0
movq 0x10(%rsp), %rdi
callq 0x1f0d0
movq 0x40(%rsp), %rdi
callq 0x43f0
nopw %cs:(%rax,%rax)
// File: xbai0624[P]dnn/src/DataInterface.cpp
// Function: DataInterface::test()
void DataInterface::test()
{
    // only one image
    Matrix image(std::pair<int, int>(10, 10), 1);
    //std::cout<<"input image: "<<std::endl<<image<<std::endl;

    Matrix image2 = image.Reshape(100, 1);
    //std::cout<<"input image: "<<std::endl<<image2<<std::endl;


    __data.push_back(image2);

    // label for this image
    Matrix label1(std::pair<int, int>(10, 1), 0);
    label1[0][0] = 1.;
    __label.push_back(label1);
}

// Assembly:
subq $0xc8, %rsp
movq %rdi, 0xc0(%rsp)
movq 0xc0(%rsp), %rax
movq %rax, 0x10(%rsp)
movl $0xa, 0x8c(%rsp)
movl $0xa, 0x88(%rsp)
leaq 0x90(%rsp), %rdi
movq %rdi, 0x18(%rsp)
leaq 0x8c(%rsp), %rsi
leaq 0x88(%rsp), %rdx
callq 0x27b90
movq 0x18(%rsp), %rsi
leaq 0x98(%rsp), %rdi
callq 0x3a300
movq 0x98(%rsp), %rsi
movq 0xa0(%rsp), %rdx
leaq 0xa8(%rsp), %rdi
movq %rdi, 0x20(%rsp)
movsd 0x1916d(%rip), %xmm0    # 0x52008
callq 0x3b680
movq 0x20(%rsp), %rsi
leaq 0x70(%rsp), %rdi
movl $0x64, %edx
movl $0x1, %ecx
callq 0x3df60
jmp 0x38ebb
movq 0x10(%rsp), %rdi
addq $0x10, %rdi
leaq 0x70(%rsp), %rsi
callq 0x1fa50
jmp 0x38ed0
movl $0xa, 0x2c(%rsp)
movl $0x1, 0x28(%rsp)
leaq 0x30(%rsp), %rdi
leaq 0x2c(%rsp), %rsi
leaq 0x28(%rsp), %rdx
callq 0x27b90
jmp 0x38ef6
leaq 0x38(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x3a300
jmp 0x38f07
movq 0x38(%rsp), %rsi
movq 0x40(%rsp), %rdx
leaq 0x48(%rsp), %rdi
xorps %xmm0, %xmm0
callq 0x3b680
jmp 0x38f20
xorl %eax, %eax
movl %eax, %esi
leaq 0x48(%rsp), %rdi
callq 0x3be50
movq %rax, 0x8(%rsp)
jmp 0x38f35
movq 0x8(%rsp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x1fd60
movq 0x10(%rsp), %rdi
movabsq $0x3ff0000000000000, %rcx # imm = 0x3FF0000000000000
movq %rcx, (%rax)
addq $0x28, %rdi
leaq 0x48(%rsp), %rsi
callq 0x1fa50
jmp 0x38f65
leaq 0x48(%rsp), %rdi
callq 0x3bb80
leaq 0x70(%rsp), %rdi
callq 0x3bb80
leaq 0xa8(%rsp), %rdi
callq 0x3bb80
addq $0xc8, %rsp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x68(%rsp)
movl %eax, 0x64(%rsp)
jmp 0x38fd0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x68(%rsp)
movl %eax, 0x64(%rsp)
jmp 0x38fc6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x68(%rsp)
movl %eax, 0x64(%rsp)
leaq 0x48(%rsp), %rdi
callq 0x3bb80
leaq 0x70(%rsp), %rdi
callq 0x3bb80
leaq 0xa8(%rsp), %rdi
callq 0x3bb80
movq 0x68(%rsp), %rdi
callq 0x43f0
nopw (%rax,%rax)
// File: xbai0624[P]dnn/src/DataInterface.cpp
// Function: DataInterface::DataInterface(char const*, char const*, LayerDimension)
DataInterface::DataInterface(const char* p_signal, const char* p_cosmic, LayerDimension ld)
{
    // 1) first need to set layer dimension
    __gLayerDimension = ld;

    // 2) then load data to memory
    // for code development
    loadFile(p_signal, test_training_signal);
    loadFile(p_cosmic, test_training_cosmic);
}

// Assembly:
subq $0x68, %rsp
movq %rdi, 0x60(%rsp)
movq %rsi, 0x58(%rsp)
movq %rdx, 0x50(%rsp)
movl %ecx, 0x4c(%rsp)
movq 0x60(%rsp), %rdi
movq %rdi, 0x30(%rsp)
movl $0x64, (%rdi)
movl $0x0, 0x4(%rdi)
movl $0x0, 0x8(%rdi)
addq $0x10, %rdi
movq %rdi, 0x10(%rsp)
callq 0x1f050
movq 0x30(%rsp), %rdi
addq $0x28, %rdi
movq %rdi, 0x18(%rsp)
callq 0x1f050
movq 0x30(%rsp), %rdi
addq $0x40, %rdi
movq %rdi, 0x20(%rsp)
callq 0x1f060
movq 0x30(%rsp), %rdi
addq $0x58, %rdi
movq %rdi, 0x28(%rsp)
callq 0x1f060
movq 0x30(%rsp), %rdi
addq $0x70, %rdi
callq 0x1f020
jmp 0x3907c
movq 0x30(%rsp), %rdi
subq $-0x80, %rdi
callq 0x1f020
jmp 0x3908c
movq 0x30(%rsp), %rdi
addq $0x90, %rdi
movq %rdi, 0x8(%rsp)
callq 0x1f050
movq 0x30(%rsp), %rdi
addq $0xa8, %rdi
movq %rdi, (%rsp)
callq 0x1f050
movq 0x30(%rsp), %rdi
movq 0x8(%rsp), %rdx
movl $0x2, 0xc0(%rdi)
movl 0x4c(%rsp), %eax
movl %eax, 0xc0(%rdi)
movq 0x58(%rsp), %rsi
callq 0x39170
jmp 0x390e1
movq 0x30(%rsp), %rdi
movq 0x50(%rsp), %rsi
movq %rdi, %rdx
addq $0xa8, %rdx
callq 0x39170
jmp 0x390fc
addq $0x68, %rsp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x40(%rsp)
movl %eax, 0x3c(%rsp)
jmp 0x39132
movq (%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x40(%rsp)
movl %eax, 0x3c(%rsp)
callq 0x1f0d0
movq 0x8(%rsp), %rdi
callq 0x1f0d0
movq 0x28(%rsp), %rdi
callq 0x1f130
movq 0x20(%rsp), %rdi
callq 0x1f130
movq 0x18(%rsp), %rdi
callq 0x1f0d0
movq 0x10(%rsp), %rdi
callq 0x1f0d0
movq 0x40(%rsp), %rdi
callq 0x43f0
nopw %cs:(%rax,%rax)
// File: xbai0624[P]dnn/src/DataInterface.cpp
// Function: DataInterface::DataInterface(char const*, char const*, LayerDimension, std::pair<int, int>, int)
DataInterface::DataInterface(const char* p_signal, const char* p_cosmic, LayerDimension ld, std::pair<int, int> dim, int batch_size)
{
    // 1) first need to set layer dimension
    __gLayerDimension = ld;

    // set data dimension
    gBatchSize = batch_size;
    __dataDimensionFromParameter.first = dim.first;
    __dataDimensionFromParameter.second = dim.second;

    // 2) then load data to memory
    // for code development
    loadFile(p_signal, test_training_signal);
    loadFile(p_cosmic, test_training_cosmic);

    //cout<<"data dimension from parameter: "<<__dataDimensionFromParameter<<endl;
}

// Assembly:
subq $0x78, %rsp
movq %r8, 0x70(%rsp)
movq %rdi, 0x68(%rsp)
movq %rsi, 0x60(%rsp)
movq %rdx, 0x58(%rsp)
movl %ecx, 0x54(%rsp)
movl %r9d, 0x50(%rsp)
movq 0x68(%rsp), %rdi
movq %rdi, 0x38(%rsp)
movl $0x64, (%rdi)
movl $0x0, 0x4(%rdi)
movl $0x0, 0x8(%rdi)
addq $0x10, %rdi
movq %rdi, 0x18(%rsp)
callq 0x1f050
movq 0x38(%rsp), %rdi
addq $0x28, %rdi
movq %rdi, 0x20(%rsp)
callq 0x1f050
movq 0x38(%rsp), %rdi
addq $0x40, %rdi
movq %rdi, 0x28(%rsp)
callq 0x1f060
movq 0x38(%rsp), %rdi
addq $0x58, %rdi
movq %rdi, 0x30(%rsp)
callq 0x1f060
movq 0x38(%rsp), %rdi
addq $0x70, %rdi
callq 0x1f020
jmp 0x398f6
movq 0x38(%rsp), %rdi
subq $-0x80, %rdi
callq 0x1f020
jmp 0x39906
movq 0x38(%rsp), %rdi
addq $0x90, %rdi
movq %rdi, 0x10(%rsp)
callq 0x1f050
movq 0x38(%rsp), %rdi
addq $0xa8, %rdi
movq %rdi, 0x8(%rsp)
callq 0x1f050
movq 0x38(%rsp), %rdi
movq 0x10(%rsp), %rdx
movl $0x2, 0xc0(%rdi)
movl 0x54(%rsp), %eax
movl %eax, 0xc0(%rdi)
movl 0x50(%rsp), %eax
movl %eax, (%rdi)
movslq 0x70(%rsp), %rax
movq %rax, 0x80(%rdi)
movslq 0x74(%rsp), %rax
movq %rax, 0x88(%rdi)
movq 0x60(%rsp), %rsi
callq 0x39170
jmp 0x3997a
movq 0x38(%rsp), %rdi
movq 0x58(%rsp), %rsi
movq %rdi, %rdx
addq $0xa8, %rdx
callq 0x39170
jmp 0x39995
addq $0x78, %rsp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x48(%rsp)
movl %eax, 0x44(%rsp)
jmp 0x399cc
movq 0x8(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x48(%rsp)
movl %eax, 0x44(%rsp)
callq 0x1f0d0
movq 0x10(%rsp), %rdi
callq 0x1f0d0
movq 0x30(%rsp), %rdi
callq 0x1f130
movq 0x28(%rsp), %rdi
callq 0x1f130
movq 0x20(%rsp), %rdi
callq 0x1f0d0
movq 0x18(%rsp), %rdi
callq 0x1f0d0
movq 0x48(%rsp), %rdi
callq 0x43f0
nop
// File: xbai0624[P]dnn/src/DataInterface.cpp
// Function: DataInterface::GetNumberOfBatches()
int DataInterface::GetNumberOfBatches()
{
    // this line is to maliciously cause troulbe, what a ...
    assert(test_training_signal.size() == test_training_cosmic.size());
    int total_entries = test_training_signal.size();

    int res = total_entries/gBatchSize;
    if(total_entries%gBatchSize == 0) return res;
    else return res+1;
}

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x18(%rsp)
movq 0x18(%rsp), %rdi
movq %rdi, (%rsp)
addq $0x90, %rdi
callq 0x1f9c0
movq (%rsp), %rdi
movq %rax, 0x8(%rsp)
addq $0xa8, %rdi
callq 0x1f9c0
movq %rax, %rcx
movq 0x8(%rsp), %rax
cmpq %rcx, %rax
jne 0x39ab2
jmp 0x39ad1
leaq 0x1afa8(%rip), %rdi     # 0x54a61
leaq 0x1afdc(%rip), %rsi     # 0x54a9c
movl $0x41, %edx
leaq 0x1afe6(%rip), %rcx     # 0x54ab2
callq 0x4170
movq (%rsp), %rdi
addq $0x90, %rdi
callq 0x1f9c0
movq (%rsp), %rcx
movl %eax, 0x14(%rsp)
movl 0x14(%rsp), %eax
cltd
idivl (%rcx)
movl %eax, 0x10(%rsp)
movl 0x14(%rsp), %eax
cltd
idivl (%rcx)
cmpl $0x0, %edx
jne 0x39b0a
movl 0x10(%rsp), %eax
movl %eax, 0x24(%rsp)
jmp 0x39b15
movl 0x10(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x24(%rsp)
movl 0x24(%rsp), %eax
addq $0x28, %rsp
retq
nop
// File: xbai0624[P]dnn/src/DataInterface.cpp
// Function: DataInterface::GetNewBatchLabel()
std::vector<Matrix>& DataInterface::GetNewBatchLabel()
{
    if(gLabelIndex + 1 != gDataIndex) // this is to make sure one access data first, then label
    {
        cout<<"Error: DataInterface data & label are not aligned."<<endl;
        exit(0);
    }
    gLabelIndex++;

    return __label;
}

// Assembly:
subq $0x18, %rsp
movq %rdi, 0x10(%rsp)
movq 0x10(%rsp), %rcx
movq %rcx, 0x8(%rsp)
movl 0x8(%rcx), %eax
addl $0x1, %eax
cmpl 0x4(%rcx), %eax
je 0x3a077
movq 0x30f83(%rip), %rdi     # 0x6afd8
leaq 0x1aa7e(%rip), %rsi     # 0x54ada
callq 0x4230
movq %rax, %rdi
movq 0x30f45(%rip), %rsi     # 0x6afb0
callq 0x4260
xorl %edi, %edi
callq 0x4290
movq 0x8(%rsp), %rax
movl 0x8(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x8(%rax)
addq $0x28, %rax
addq $0x18, %rsp
retq
nop
// File: xbai0624[P]dnn/src/DataInterface.cpp
// Function: DataInterface::GetNewBatchDataImage()
std::vector<Images>& DataInterface::GetNewBatchDataImage()
{
    // return data in Images form

    // 1) update batch
    UpdateBatch(__data, __label);
    assert(__data.size() == __label.size());

    // 2) reform
    for(size_t i=0;i<__data.size();i++)
    {
        // reform it in Images format
        Images _image;
        _image.OutputImageFromKernel.push_back(__data[i]);
        __data_image.push_back(_image);

        Images _image_label;
        _image_label.OutputImageFromKernel.push_back(__label[i]);
        __label_image.push_back(_image_label);
    }

    return __data_image;
}

// Assembly:
subq $0x78, %rsp
movq %rdi, 0x70(%rsp)
movq 0x70(%rsp), %rdi
movq %rdi, 0x18(%rsp)
movq %rdi, %rsi
addq $0x10, %rsi
movq %rdi, %rdx
addq $0x28, %rdx
callq 0x39b60
movq 0x18(%rsp), %rdi
addq $0x10, %rdi
callq 0x1f9c0
movq 0x18(%rsp), %rdi
movq %rax, 0x20(%rsp)
addq $0x28, %rdi
callq 0x1f9c0
movq %rax, %rcx
movq 0x20(%rsp), %rax
cmpq %rcx, %rax
jne 0x3a0e6
jmp 0x3a105
leaq 0x1aa20(%rip), %rdi     # 0x54b0d
leaq 0x1a9a8(%rip), %rsi     # 0x54a9c
movl $0x76, %edx
leaq 0x1aa2d(%rip), %rcx     # 0x54b2d
callq 0x4170
movq $0x0, 0x68(%rsp)
movq 0x18(%rsp), %rdi
movq 0x68(%rsp), %rax
movq %rax, 0x10(%rsp)
addq $0x10, %rdi
callq 0x1f9c0
movq %rax, %rcx
movq 0x10(%rsp), %rax
cmpq %rcx, %rax
jae 0x3a21b
leaq 0x50(%rsp), %rdi
movq %rdi, 0x8(%rsp)
callq 0x1fda0
movq 0x18(%rsp), %rdi
addq $0x10, %rdi
movq 0x68(%rsp), %rsi
callq 0x1f9e0
movq 0x8(%rsp), %rdi
movq %rax, %rsi
callq 0x1fa50
jmp 0x3a168
movq 0x18(%rsp), %rdi
addq $0x40, %rdi
leaq 0x50(%rsp), %rsi
callq 0x1feb0
jmp 0x3a17d
leaq 0x28(%rsp), %rdi
callq 0x1fda0
jmp 0x3a189
movq 0x18(%rsp), %rdi
addq $0x28, %rdi
movq 0x68(%rsp), %rsi
callq 0x1f9e0
movq %rax, %rsi
leaq 0x28(%rsp), %rdi
callq 0x1fa50
jmp 0x3a1ab
movq 0x18(%rsp), %rdi
addq $0x58, %rdi
leaq 0x28(%rsp), %rsi
callq 0x1feb0
jmp 0x3a1c0
leaq 0x28(%rsp), %rdi
callq 0x1fde0
leaq 0x50(%rsp), %rdi
callq 0x1fde0
movq 0x68(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x68(%rsp)
jmp 0x3a10e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x48(%rsp)
movl %eax, 0x44(%rsp)
jmp 0x3a20f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x48(%rsp)
movl %eax, 0x44(%rsp)
leaq 0x28(%rsp), %rdi
callq 0x1fde0
leaq 0x50(%rsp), %rdi
callq 0x1fde0
jmp 0x3a229
movq 0x18(%rsp), %rax
addq $0x40, %rax
addq $0x78, %rsp
retq
movq 0x48(%rsp), %rdi
callq 0x43f0
nopw %cs:(%rax,%rax)
// File: xbai0624[P]dnn/src/DataInterface.cpp
// Function: DataInterface::GetNewBatchLabelImage()
std::vector<Images>& DataInterface::GetNewBatchLabelImage()
{
    if(gLabelIndex + 1 != gDataIndex) // this is to make sure one access data first, then label
    {
        cout<<"Error: DataInterface data & label are not aligned."<<endl;
        exit(0);
    }
    gLabelIndex++;

    return __label_image;
}

// Assembly:
subq $0x18, %rsp
movq %rdi, 0x10(%rsp)
movq 0x10(%rsp), %rcx
movq %rcx, 0x8(%rsp)
movl 0x8(%rcx), %eax
addl $0x1, %eax
cmpl 0x4(%rcx), %eax
je 0x3a287
movq 0x30d73(%rip), %rdi     # 0x6afd8
leaq 0x1a86e(%rip), %rsi     # 0x54ada
callq 0x4230
movq %rax, %rdi
movq 0x30d35(%rip), %rsi     # 0x6afb0
callq 0x4260
xorl %edi, %edi
callq 0x4290
movq 0x8(%rsp), %rax
movl 0x8(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x8(%rax)
addq $0x58, %rax
addq $0x18, %rsp
retq
nop
// File: xbai0624[P]dnn/src/Layer.cpp
// Function: operator<<(std::ostream&, LayerType const&)
std::ostream & operator<<(std::ostream &os, const LayerType &t)
{
    if(t == LayerType::fullyConnected)
        os<<"____layer_type=fully_connected____";
    else if(t == LayerType::cnn)
        os<<"____layer_type=cnn____";
    else if(t == LayerType::pooling)
        os<<"____layer_type=pooling____";
    else if(t == LayerType::input)
        os<<"____layer_type=input____";
    else if(t == LayerType::output)
        os<<"____layer_type=output____";
    else if(t == LayerType::Undefined)
        os<<"____layer_type=undefined____";
    return os;
}

// Assembly:
subq $0x18, %rsp
movq %rdi, 0x10(%rsp)
movq %rsi, 0x8(%rsp)
movq 0x8(%rsp), %rax
cmpl $0x0, (%rax)
jne 0x3aa3e
movq 0x10(%rsp), %rdi
leaq 0x1a292(%rip), %rsi     # 0x54cc6
callq 0x4230
jmp 0x3aad7
movq 0x8(%rsp), %rax
cmpl $0x1, (%rax)
jne 0x3aa5b
movq 0x10(%rsp), %rdi
leaq 0x1a295(%rip), %rsi     # 0x54ce9
callq 0x4230
jmp 0x3aad5
movq 0x8(%rsp), %rax
cmpl $0x2, (%rax)
jne 0x3aa78
movq 0x10(%rsp), %rdi
leaq 0x1a28f(%rip), %rsi     # 0x54d00
callq 0x4230
jmp 0x3aad3
movq 0x8(%rsp), %rax
cmpl $0x3, (%rax)
jne 0x3aa95
movq 0x10(%rsp), %rdi
leaq 0x1a28d(%rip), %rsi     # 0x54d1b
callq 0x4230
jmp 0x3aad1
movq 0x8(%rsp), %rax
cmpl $0x4, (%rax)
jne 0x3aab2
movq 0x10(%rsp), %rdi
leaq 0x1a289(%rip), %rsi     # 0x54d34
callq 0x4230
jmp 0x3aacf
movq 0x8(%rsp), %rax
cmpl $0x5, (%rax)
jne 0x3aacd
movq 0x10(%rsp), %rdi
leaq 0x1a286(%rip), %rsi     # 0x54d4e
callq 0x4230
jmp 0x3aacf
jmp 0x3aad1
jmp 0x3aad3
jmp 0x3aad5
jmp 0x3aad7
movq 0x10(%rsp), %rax
addq $0x18, %rsp
retq
nopw %cs:(%rax,%rax)