LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O3/rthoelen[P]NXCore_Icom/main.cc
// Function: timing_thread(void*)
void *timing_thread(void *t_id)
{
	int i;
	unsigned int seconds = 0;
	char h_buf[20];
	
	
        memset((char *)&h_buf[0], 0, sizeof(h_buf));
	h_buf[0] = 'N';
	h_buf[1] = 'X';
	h_buf[2] = 'D';
	h_buf[3] = 'N';
	h_buf[4] = 0x00;
	h_buf[5] = 0x99;
	h_buf[6] = 0x00;
	h_buf[7] = 'N';
	h_buf[8] = '1';
	h_buf[9] = 'X';
	h_buf[10] = 'D';
	h_buf[11] = 'N';

	for(;;)
	{
		for( i = 0; i < repeater_count; i++)
		{
			repeater[i].time_since_rx++;
			repeater[i].time_since_tx++;

			if(repeater[i].time_since_rx > repeater[i].hold_time)
			{
				repeater[i].time_since_rx = repeater[i].hold_time;
				repeater[i].rx_activity = 0;
			}

			while(tx_busy_sem == 1)
				usleep(1);
			if(repeater[i].time_since_tx > repeater[i].tx_hold_time)
			{
				repeater[i].time_since_tx = repeater[i].tx_hold_time;
				repeater[i].tx_busy = 0;
			}


		}	
		if((++seconds % 30) == 0)
		{
			for( i = 0; i < repeater_count; i++)
				{
					if(repeater[i].stealth)
						sendto(socket_00, h_buf, sizeof(h_buf), 0, (struct sockaddr *)&repeater[i].rpt_addr_00,
							sizeof(repeater[i].rpt_addr_00));
				}
		}


		sleep(1);
	}

	
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
xorps %xmm0, %xmm0
leaq -0x40(%rbp), %rbx
movaps %xmm0, (%rbx)
movl $0x0, 0x10(%rbx)
movl $0x4e44584e, (%rbx)     # imm = 0x4E44584E
movb $-0x67, 0x5(%rbx)
movl $0x4458314e, 0x7(%rbx)  # imm = 0x4458314E
movb $0x4e, 0xb(%rbx)
xorl %r14d, %r14d
cmpl $0x0, 0xf65d(%rip)      # 0x15378
jle 0x5e17
movq 0xf630(%rip), %rcx      # 0x15358
xorl %r15d, %r15d
imulq $0x70, %r15, %r12
movl 0x18(%rcx,%r12), %edx
movl 0x20(%rcx,%r12), %eax
leal 0x1(%rdx), %esi
movl %esi, 0x18(%rcx,%r12)
incl 0x1c(%rcx,%r12)
cmpl %eax, %edx
jl 0x5d5a
leaq (%rcx,%r12), %rdx
movl %eax, 0x18(%rdx)
movl $0x0, 0x28(%rcx,%r12)
cmpl $0x1, 0xf623(%rip)      # 0x15384
jne 0x5d7d
movl $0x1, %edi
callq 0x4400
cmpl $0x1, 0xf610(%rip)      # 0x15384
je 0x5d63
movq 0xf5db(%rip), %rcx      # 0x15358
movl 0x24(%rcx,%r12), %eax
cmpl %eax, 0x1c(%rcx,%r12)
jle 0x5d99
leaq (%rcx,%r12), %rdx
movl %eax, 0x1c(%rdx)
movl $0x0, 0x2c(%rcx,%r12)
incq %r15
movslq 0xf5d5(%rip), %rax      # 0x15378
cmpq %rax, %r15
jl 0x5d2b
incl %r14d
imull $0xeeeeeeef, %r14d, %ecx # imm = 0xEEEEEEEF
rorl %ecx
cmpl $0x8888889, %ecx        # imm = 0x8888889
setae %cl
testl %eax, %eax
setle %dl
orb %cl, %dl
jne 0x5e1a
movq 0xf58b(%rip), %r8       # 0x15358
xorl %r15d, %r15d
xorl %r12d, %r12d
cmpl $0x0, 0x58(%r8,%r15)
je 0x5e06
addq %r15, %r8
movl 0xf59c(%rip), %edi      # 0x15380
movl $0x14, %edx
movq %rbx, %rsi
xorl %ecx, %ecx
movl $0x10, %r9d
callq 0x4060
movq 0xf558(%rip), %r8       # 0x15358
movl 0xf572(%rip), %eax      # 0x15378
incq %r12
movslq %eax, %rcx
addq $0x70, %r15
cmpq %rcx, %r12
jl 0x5dd3
jmp 0x5e1a
incl %r14d
movl $0x1, %edi
callq 0x4240
jmp 0x5d14
// File: /workspace/github_cpp_makefile_star2_O3/gty980218[P]ee450/scheduler.cpp
// Function: tcp_conn(int, int)
void tcp_conn(int sock_tcp,int sock_udp){
    struct sockaddr_in peeraddr;
    socklen_t peerlen=sizeof(peeraddr);
    int conn;
    pid_t pid;

    while(1){
        if((conn=accept(sock_tcp,(struct sockaddr*)&peeraddr,&peerlen))<0){
            fprintf(stderr,"Connetc failed!");
            exit(1);
        }
        reinit();
        pid=fork();                                                     //fork() will copy everything from its parents' process
        if(pid==-1){
            fprintf(stderr,"Child process error!");
        }else if(pid==0){
            close(sock_tcp);
            serve(conn,sock_udp);
            exit(1);
        }else{
            close(conn);
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %esi, -0x2c(%rbp)
movl %edi, %r14d
leaq -0x30(%rbp), %rdx
movl $0x10, (%rdx)
leaq -0x40(%rbp), %rsi
callq 0x20a0
testl %eax, %eax
jns 0x298a
movq 0x3669(%rip), %rax      # 0x5fd8
movq (%rax), %rcx
leaq 0x1765(%rip), %rdi      # 0x40de
movl $0xf, %esi
movl $0x1, %edx
callq 0x22c0
jmp 0x29fb
movl %eax, %ebx
leaq 0x175b(%rip), %r15      # 0x40ee
leaq -0x40(%rbp), %r12
leaq -0x30(%rbp), %r13
callq 0x2a05
callq 0x2090
cmpl $-0x1, %eax
je 0x29cb
testl %eax, %eax
je 0x29e9
movl %ebx, %edi
callq 0x22d0
movl %r14d, %edi
movq %r12, %rsi
movq %r13, %rdx
callq 0x20a0
movl %eax, %ebx
testl %eax, %eax
jns 0x299b
jmp 0x2968
movq 0x3606(%rip), %rax      # 0x5fd8
movq (%rax), %rcx
movl $0x14, %esi
movl $0x1, %edx
movq %r15, %rdi
callq 0x22c0
jmp 0x29b5
movl %r14d, %edi
callq 0x22d0
movl %ebx, %edi
movl -0x2c(%rbp), %esi
callq 0x2b31
movl $0x1, %edi
callq 0x21d0
// File: /workspace/github_cpp_makefile_star2_O3/gty980218[P]ee450/scheduler.cpp
// Function: reinit()
void reinit(){
    ifstream infile; 
    infile.open("info.txt");  //"info.txt" used for storing changed occupancy info
    assert(infile.is_open());

    string str;
    int i=0;
    while(getline(infile,str)){
        int ocpt=atoi(str.c_str());
        scheduler.hspt_info[i].ocpt=ocpt;
        i++;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x230, %rsp            # imm = 0x230
leaq -0x248(%rbp), %rbx
movq %rbx, %rdi
callq 0x21b0
leaq 0x16d6(%rip), %rsi      # 0x4103
movq %rbx, %rdi
movl $0x8, %edx
callq 0x20e0
leaq -0x1d0(%rbp), %rdi
callq 0x2060
testb %al, %al
je 0x2ae1
leaq -0x30(%rbp), %r15
movq %r15, -0x10(%r15)
movq $0x0, -0x8(%r15)
movb $0x0, (%r15)
leaq 0x3743(%rip), %r12      # 0x61ac
leaq -0x40(%rbp), %r14
movq -0x248(%rbp), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2170
movsbl %al, %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x22b0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
movq -0x40(%rbp), %rdi
jne 0x2ab4
callq 0x2250
movl %eax, (%r12)
addq $0x28, %r12
jmp 0x2a6d
cmpq %r15, %rdi
je 0x2ac5
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x2180
leaq -0x248(%rbp), %rdi
callq 0x2080
addq $0x230, %rsp            # imm = 0x230
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1624(%rip), %rdi      # 0x410c
leaq 0x162e(%rip), %rsi      # 0x411d
leaq 0x1635(%rip), %rcx      # 0x412b
movl $0x5c, %edx
callq 0x20f0
movq %rax, %rbx
jmp 0x2b1d
movq %rax, %rbx
movq -0x40(%rbp), %rdi
cmpq %r15, %rdi
je 0x2b1d
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x2180
leaq -0x248(%rbp), %rdi
callq 0x2080
movq %rbx, %rdi
callq 0x2290
// File: /workspace/github_cpp_makefile_star2_O3/xbai0624[P]dnn/src/ConstructLayer.cpp
// Function: ConstructLayer::Init()
void ConstructLayer::Init()
{
    if(__type == LayerType::input) 
    {
        InitNeurons();
        InitFilters(); // input layer need to init filters, make all neurons active
    }
    else if(__type == LayerType::output) // output layer, reserved
    {
        InitNeurons();
        InitWeightsAndBias();
    }
    else  // other layer
    {
        InitNeurons();
        InitWeightsAndBias();
    }

    // setup drop out pool
    InitFilters();
    if(__use_drop_out)
    {
        SetupDropOutFilterPool();
    }

    // init batch normalization
    if(__use_batch_normalization)
    {
        InitBatchNormalizationParameters();
    }
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl 0xc(%rdi), %ebp
movq (%rdi), %rax
callq *0xb8(%rax)
movq (%rbx), %rax
cmpl $0x3, %ebp
movl $0x90, %ecx
movl $0xc0, %edx
cmoveq %rcx, %rdx
movq %rbx, %rdi
callq *(%rax,%rdx)
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x90(%rax)
cmpb $0x1, 0x3c8(%rbx)
jne 0x5c57
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x208(%rax)
cmpb $0x1, 0x210(%rbx)
jne 0x5c6e
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x5c76
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/xbai0624[P]dnn/src/ConstructLayer.cpp
// Function: ConstructLayer::SetNumberOfNeuronsFC(unsigned long)
void  ConstructLayer::SetNumberOfNeuronsFC(size_t n)
{
    if(__type == LayerType::fullyConnected || __type == LayerType::output) {
        __n_neurons_fc = n;
    }
    else {
        std::cout<<"Error: needs to set layer type before setting number of neurons."
            <<std::endl;
        exit(0);
    }
}

// Assembly:
testl $0xfffffffb, 0xc(%rdi)  # imm = 0xFFFFFFFB
jne 0x61e8
movq %rsi, 0x10(%rdi)
retq
pushq %rax
movq 0x30de8(%rip), %rdi     # 0x36fd8
leaq 0x2143f(%rip), %rsi     # 0x27636
callq 0x4260
movq %rax, %rdi
callq 0x4100
xorl %edi, %edi
callq 0x4290
nop
// File: /workspace/github_cpp_makefile_star2_O3/xbai0624[P]dnn/src/ConstructLayer.cpp
// Function: ConstructLayer::SetNumberOfKernelsCNN(unsigned long)
void  ConstructLayer::SetNumberOfKernelsCNN(size_t n)
{
    if(__type != LayerType::cnn && __type != LayerType::pooling)
    {
        std::cout<<"Error: needs to set layer type before setting number of kernels."
            <<std::endl;
        exit(0);
    }
    __n_kernels_cnn = n;
}

// Assembly:
movl 0xc(%rdi), %eax
decl %eax
cmpl $0x2, %eax
jae 0x621b
movq %rsi, 0x18(%rdi)
retq
pushq %rax
movq 0x30db5(%rip), %rdi     # 0x36fd8
leaq 0x2144d(%rip), %rsi     # 0x27677
callq 0x4260
movq %rax, %rdi
callq 0x4100
xorl %edi, %edi
callq 0x4290
// File: /workspace/github_cpp_makefile_star2_O3/xbai0624[P]dnn/src/ConstructLayer.cpp
// Function: ConstructLayer::SetKernelSizeCNN(std::pair<unsigned long, unsigned long>)
void  ConstructLayer::SetKernelSizeCNN(std::pair<size_t, size_t> s)
{
    // pooling layer also borrowed this function
    if(__type != LayerType::cnn && __type != LayerType::pooling)
    {
        std::cout<<__func__<<" Error: needs to set layer type before setting kernel size."
            <<std::endl;
        exit(0);
    }

    __kernelDim.first = s.first;
    __kernelDim.second = s.second;
}

// Assembly:
movl 0xc(%rdi), %eax
decl %eax
cmpl $0x2, %eax
jae 0x6251
movq %rsi, 0x20(%rdi)
movq %rdx, 0x28(%rdi)
retq
pushq %rax
movq 0x30d7f(%rip), %rdi     # 0x36fd8
leaq 0x21458(%rip), %rsi     # 0x276b8
callq 0x4260
leaq 0x2145d(%rip), %rsi     # 0x276c9
movq %rax, %rdi
callq 0x4260
movq %rax, %rdi
callq 0x4100
xorl %edi, %edi
callq 0x4290
nop
// File: /workspace/github_cpp_makefile_star2_O3/xbai0624[P]dnn/src/ConstructLayer.cpp
// Function: ConstructLayer::InitNeurons()
void ConstructLayer::InitNeurons()
{
    if(__type == LayerType::cnn)
        InitNeuronsCNN();
    else if(__type == LayerType::pooling)
        InitNeuronsPooling();
    else if(__type == LayerType::input)
        InitNeuronsInputLayer();
    else if(__type == LayerType::fullyConnected)
        InitNeuronsFC();
    else if(__type == LayerType::output)
        InitNeuronsFC();
    else
    {
        std::cout<<"Error: Init neurons, unrecognized layer type."<<std::endl;
        exit(0);
    }
    //std::cout<<"Debug: Layer:"<<GetID()<<" init neruons done."<<std::endl;

    // after initializing all neurons, setup neuron dimension information
    // setup total neuron dimension
    size_t k = __neurons.size();
    size_t i = 0;
    size_t j = 0;
    if(k > 0)
    {
        i = __neurons[0].Dimension().first;
        j = __neurons[0].Dimension().second;

        __neuronDim.k = k;
        __neuronDim.i = i;
        __neuronDim.j = j;
    }

    // setup neuron layer information
    for(size_t kk=0;kk<k;kk++)
    {
        for(size_t ii=0;ii<i;ii++)
            for(size_t jj=0;jj<j;jj++)
            {
                __neurons[kk][ii][jj]->SetLayer(dynamic_cast<Layer*>(this));
                //__neurons[kk][ii][jj]->SetPreviousLayer(__prevLayer); // obsolete
                //__neurons[kk][ii][jj]->SetNextLayer(__nextLayer);     // obsolete
            }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl 0xc(%rdi), %eax
cmpq $0x4, %rax
ja 0x63cd
movq %rdi, %rbx
leaq 0x20e4b(%rip), %rcx     # 0x27104
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %rbx, %rdi
callq 0x6998
jmp 0x62e8
movq %rbx, %rdi
callq 0x67b4
jmp 0x62e8
movq %rbx, %rdi
callq 0x63f0
jmp 0x62e8
movq %rbx, %rdi
callq 0x65ca
movq 0x40(%rbx), %rcx
movq 0x48(%rbx), %rax
subq %rcx, %rax
je 0x63be
movq %rax, %rsi
sarq $0x3, %rsi
movabsq $-0x5555555555555555, %rax # imm = 0xAAAAAAAAAAAAAAAB
imulq %rax, %rsi
movq (%rcx), %rdx
movq 0x8(%rcx), %rcx
subq %rdx, %rcx
je 0x632f
movq 0x8(%rdx), %r12
subq (%rdx), %r12
sarq $0x3, %r12
sarq $0x3, %rcx
imulq %rax, %rcx
jmp 0x6334
xorl %ecx, %ecx
xorl %r12d, %r12d
movq %rsi, 0x3a8(%rbx)
movq %rcx, 0x398(%rbx)
movq %r12, 0x3a0(%rbx)
cmpq $0x1, %rsi
adcq $0x0, %rsi
movq %rsi, 0x8(%rsp)
movq $0x0, (%rsp)
movq %rcx, 0x10(%rsp)
testq %rcx, %rcx
je 0x63ac
movq (%rsp), %rax
leaq (%rax,%rax,2), %rbp
xorl %r14d, %r14d
testq %r12, %r12
je 0x639f
leaq (%r14,%r14,2), %r13
xorl %r15d, %r15d
movq 0x40(%rbx), %rax
movq (%rax,%rbp,8), %rax
movq (%rax,%r13,8), %rax
movq (%rax,%r15,8), %rdi
movq %rbx, %rsi
callq 0x20950
incq %r15
cmpq %r15, %r12
jne 0x637f
incq %r14
movq 0x10(%rsp), %rcx
cmpq %rcx, %r14
jne 0x6373
movq (%rsp), %rdx
incq %rdx
movq %rdx, (%rsp)
cmpq 0x8(%rsp), %rdx
jne 0x6363
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x30c04(%rip), %rdi     # 0x36fd8
leaq 0x2132a(%rip), %rsi     # 0x27705
callq 0x4260
movq %rax, %rdi
callq 0x4100
xorl %edi, %edi
callq 0x4290
nop
// File: /workspace/github_cpp_makefile_star2_O3/xbai0624[P]dnn/src/ConstructLayer.cpp
// Function: ConstructLayer::InitNeuronsFC()
void ConstructLayer::InitNeuronsFC()
{
    __neurons.clear();
    assert(__n_neurons_fc >= 1);
    Pixel2D<Neuron*> image(__n_neurons_fc, 1);
    for(size_t i=0;i<__n_neurons_fc;i++)
    {
        Neuron *n = new Neuron();
        n->SetCoord(i, 0, 0);
        n->SetActuationFuncType(__neuron_actuation_func_type);
        image[i][0] = n;
    }
    __neurons.push_back(image);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movq 0x40(%rdi), %r15
movq 0x48(%rdi), %r12
cmpq %r15, %r12
je 0x69cb
movq %r15, %r14
movq %r14, %rdi
callq 0x145c2
addq $0x18, %r14
cmpq %r12, %r14
jne 0x69b6
movq %r15, 0x48(%rbx)
movq 0x10(%rbx), %rsi
testq %rsi, %rsi
je 0x6a5c
movq %rsp, %rdi
movl $0x1, %edx
callq 0x13728
cmpq $0x0, 0x10(%rbx)
je 0x6a39
xorl %r12d, %r12d
xorl %r14d, %r14d
movl $0xa0, %edi
callq 0x4270
movq %rax, %r15
movq %rax, %rdi
callq 0x20124
movq %r15, %rdi
movq %r14, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x21d6e
movl 0x58(%rbx), %esi
movq %r15, %rdi
callq 0x20956
movq (%rsp), %rax
movq (%rax,%r12), %rax
movq %r15, (%rax)
incq %r14
addq $0x18, %r12
cmpq 0x10(%rbx), %r14
jb 0x69f2
addq $0x40, %rbx
movq %rsp, %rsi
movq %rbx, %rdi
callq 0x137ba
movq %rsp, %rdi
callq 0x145c2
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0x20d97(%rip), %rdi     # 0x277fa
leaq 0x20ce0(%rip), %rsi     # 0x2774a
leaq 0x20d9d(%rip), %rcx     # 0x2780e
movl $0x1b6, %edx            # imm = 0x1B6
callq 0x4160
jmp 0x6a8a
movq %rax, %rbx
movq %r15, %rdi
callq 0x4230
jmp 0x6a8d
movq %rax, %rbx
movq %rsp, %rdi
callq 0x145c2
movq %rbx, %rdi
callq 0x43e0
nop
// File: /workspace/github_cpp_makefile_star2_O3/xbai0624[P]dnn/src/ConstructLayer.cpp
// Function: ConstructLayer::ForwardPropagate_Z_ForSample(int)
void ConstructLayer::ForwardPropagate_Z_ForSample(int sample_index)
{
    // forward propagation: 
    //     ---) compute Z, A, A'(Z) for this layer
    //          these works are done neuron by neuron (neuron level)

    // layers needs to finish all z's first 
    // this special treatment is for softmax actuation functions in output layer
    // b/c in softmax, one need all Z's already calculated before updating A and sigma^\prime
    // step 1) finish z
    for(size_t k=0;k<__neurons.size();k++)
    {
        auto dim = __neurons[k].Dimension();
        for(size_t i=0;i<dim.first;i++)
        {
            for(size_t j=0;j<dim.second;j++)
            {
                //cout<<"coord (i, j, k): ("<<i<<", "<<j<<", "<<k<<")"<<endl;
                if(!__neurons[k][i][j]->IsActive()) continue;
                __neurons[k][i][j] -> UpdateZ(sample_index);
            }
        }
    }
    UpdateImagesZ(sample_index);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %esi, 0x4(%rsp)
movq %rdi, %r14
movq 0x40(%rdi), %rax
movq 0x48(%rdi), %rcx
cmpq %rax, %rcx
je 0x74a5
xorl %esi, %esi
movabsq $-0x5555555555555555, %rdi # imm = 0xAAAAAAAAAAAAAAAB
leaq (%rsi,%rsi,2), %r13
movq (%rax,%r13,8), %rdx
movq 0x8(%rax,%r13,8), %r8
subq %rdx, %r8
je 0x748b
movq %rsi, 0x8(%rsp)
movq (%rdx), %rax
movq 0x8(%rdx), %r15
movq %r15, 0x10(%rsp)
movq %rax, 0x18(%rsp)
subq %rax, %r15
sarq $0x3, %r15
sarq $0x3, %r8
imulq %rdi, %r8
cmpq $0x1, %r8
adcq $0x0, %r8
xorl %r12d, %r12d
movq %r8, 0x20(%rsp)
movq 0x10(%rsp), %rax
cmpq 0x18(%rsp), %rax
je 0x7467
leaq (%r12,%r12,2), %rbp
xorl %ebx, %ebx
movq 0x40(%r14), %rax
movq (%rax,%r13,8), %rax
movq (%rax,%rbp,8), %rax
movq (%rax,%rbx,8), %rdi
callq 0x2089a
testb %al, %al
je 0x745f
movq 0x40(%r14), %rax
movq (%rax,%r13,8), %rax
movq (%rax,%rbp,8), %rax
movq (%rax,%rbx,8), %rdi
movl 0x4(%rsp), %esi
callq 0x201e8
incq %rbx
cmpq %rbx, %r15
jne 0x742d
incq %r12
movq 0x20(%rsp), %r8
cmpq %r8, %r12
jne 0x741b
movq 0x40(%r14), %rax
movq 0x48(%r14), %rcx
movq 0x8(%rsp), %rsi
movabsq $-0x5555555555555555, %rdi # imm = 0xAAAAAAAAAAAAAAAB
incq %rsi
movq %rcx, %rdx
subq %rax, %rdx
sarq $0x3, %rdx
imulq %rdi, %rdx
cmpq %rdx, %rsi
jb 0x73d0
movq %r14, %rdi
movl 0x4(%rsp), %esi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x74c0
nop
// File: /workspace/github_cpp_makefile_star2_O3/xbai0624[P]dnn/src/ConstructLayer.cpp
// Function: ConstructLayer::BatchNormalization_GetGradientOnParameters()
void ConstructLayer::BatchNormalization_GetGradientOnParameters()
{
    // 
    // gradients of \partial{C}/\partial{\sigma_B^2}, \partial{C}/\partial{\mu_B}, \partial{C}/\partial{\gamma}, \partial{C}/\partial{\beta}
    // Eq. (16), (17), (19), (20) in notes by Xinzhan Bai
    // This one needs to be done before updating batch normalization deltas

    // clear previous batch
    __v_partial_C_over_partial_sigma_square.clear();
    __v_partial_C_over_partial_mu.clear();
    __v_partial_C_over_partial_gamma.clear();
    __v_partial_C_over_partial_beta.clear();

    if(GetLayerDimension() == LayerDimension::_1D)
        BatchNormalization_GetGradientOnParameters_1DLayer();
    else if(GetLayerDimension() == LayerDimension::_2D)
        BatchNormalization_GetGradientOnParameters_2DLayer();
    else
    {
        std::cout<<"Error: "<<__func__<<" unsupported layer dimension."
            <<std::endl;
        exit(0);
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x338(%rdi), %r15
movq 0x340(%rdi), %r12
cmpq %r15, %r12
je 0x91b9
movq %r15, %r14
movq %r14, %rdi
callq 0x1abf2
addq $0x18, %r14
cmpq %r12, %r14
jne 0x91a1
movq %r15, 0x340(%rbx)
movq 0x350(%rbx), %r15
movq 0x358(%rbx), %r12
cmpq %r15, %r12
je 0x91e7
movq %r15, %r14
movq %r14, %rdi
callq 0x1abf2
addq $0x18, %r14
cmpq %r12, %r14
jne 0x91cf
movq %r15, 0x358(%rbx)
movq 0x368(%rbx), %r15
movq 0x370(%rbx), %r12
cmpq %r15, %r12
je 0x9215
movq %r15, %r14
movq %r14, %rdi
callq 0x1abf2
addq $0x18, %r14
cmpq %r12, %r14
jne 0x91fd
movq %r15, 0x370(%rbx)
movq 0x380(%rbx), %r15
movq 0x388(%rbx), %r12
cmpq %r15, %r12
je 0x9243
movq %r15, %r14
movq %r14, %rdi
callq 0x1abf2
addq $0x18, %r14
cmpq %r12, %r14
jne 0x922b
movq %r15, 0x388(%rbx)
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x258(%rax)
testl %eax, %eax
je 0x9277
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x258(%rax)
cmpl $0x1, %eax
jne 0x928a
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x999c
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x92ca
movq 0x2dd47(%rip), %rdi     # 0x36fd8
leaq 0x1e81d(%rip), %rsi     # 0x27ab5
callq 0x4260
leaq 0x1e819(%rip), %rsi     # 0x27abd
movq %rax, %rdi
callq 0x4260
leaq 0x1ebff(%rip), %rsi     # 0x27eb2
movq %rax, %rdi
callq 0x4260
movq %rax, %rdi
callq 0x4100
xorl %edi, %edi
callq 0x4290
// File: /workspace/github_cpp_makefile_star2_O3/xbai0624[P]dnn/src/ConstructLayer.cpp
// Function: inverse_half_cubic(double)
static double inverse_half_cubic(double x)
{
    // a helper: get x^{-3/2}
    assert(x > 0);
    double square_root = sqrt(x);
    return  1./(square_root * square_root * square_root);
}

// Assembly:
pushq %rax
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0xa2bc
jb 0xa29d
sqrtsd %xmm0, %xmm0
jmp 0xa2a2
callq 0x4438
movapd %xmm0, %xmm1
mulsd %xmm0, %xmm1
mulsd %xmm0, %xmm1
movsd 0x1d2ca(%rip), %xmm0    # 0x27580
divsd %xmm1, %xmm0
popq %rax
retq
leaq 0x1f269(%rip), %rdi     # 0x2952c
leaq 0x1d480(%rip), %rsi     # 0x2774a
leaq 0x1f261(%rip), %rcx     # 0x29532
movl $0x428, %edx            # imm = 0x428
callq 0x4160
// File: /workspace/github_cpp_makefile_star2_O3/xbai0624[P]dnn/src/ConstructLayer.cpp
// Function: inverse_square_root(double)
static double inverse_square_root(double x)
{
    // a helper: get x^{-1/2}
    assert(x > 0);
    double square_root = sqrt(x);
    return 1./square_root;
}

// Assembly:
pushq %rax
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0xa305
jb 0xa2ee
sqrtsd %xmm0, %xmm0
jmp 0xa2f3
callq 0x4438
movsd 0x1d285(%rip), %xmm1    # 0x27580
divsd %xmm0, %xmm1
movapd %xmm1, %xmm0
popq %rax
retq
leaq 0x1f220(%rip), %rdi     # 0x2952c
leaq 0x1d437(%rip), %rsi     # 0x2774a
leaq 0x1f23a(%rip), %rcx     # 0x29554
movl $0x430, %edx            # imm = 0x430
callq 0x4160
// File: /workspace/github_cpp_makefile_star2_O3/xbai0624[P]dnn/src/ConstructLayer.cpp
// Function: ConstructLayer::BatchNormalization_RestoreDelta_ForSample(int)
void ConstructLayer::BatchNormalization_RestoreDelta_ForSample(int sample_id)
{
    if(__layerDimension == LayerDimension::_1D)
    {
        BatchNormalization_RestoreDelta_ForSample_1DLayer(sample_id);
    }
    else if(__layerDimension == LayerDimension::_2D)
    {
        BatchNormalization_RestoreDelta_ForSample_2DLayer(sample_id);
    }
    else
    {
        std::cout<<"Error: "<<__func__<<" undefined layer dimension."
            <<std::endl;
        exit(0);
    }
}

// Assembly:
movl 0x408(%rdi), %eax
cmpl $0x1, %eax
je 0xa5f6
testl %eax, %eax
jne 0xa33c
jmp 0xa37e
pushq %rax
movq 0x2cc94(%rip), %rdi     # 0x36fd8
leaq 0x1d76a(%rip), %rsi     # 0x27ab5
callq 0x4260
leaq 0x1d791(%rip), %rsi     # 0x27ae8
movq %rax, %rdi
callq 0x4260
leaq 0x1d7ac(%rip), %rsi     # 0x27b12
movq %rax, %rdi
callq 0x4260
movq %rax, %rdi
callq 0x4100
xorl %edi, %edi
callq 0x4290
nop
// File: /workspace/github_cpp_makefile_star2_O3/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movq 0x400(%rdi), %r15
cmpb $0x1, 0x488(%rdi)
jne 0xaf38
leaq 0x10(%r15), %rdi
callq 0x1e36a
movq 0x138(%rbx), %r12
movq 0x140(%rbx), %r13
cmpq %r12, %r13
je 0xaf66
movq %r12, %r14
movq %r14, %rdi
callq 0x1353a
addq $0x18, %r14
cmpq %r13, %r14
jne 0xaf4e
movq %r12, 0x140(%rbx)
movq 0x198(%rbx), %r12
movq 0x1a0(%rbx), %r13
cmpq %r12, %r13
je 0xaf94
movq %r12, %r14
movq %r14, %rdi
callq 0x1353a
addq $0x18, %r14
cmpq %r13, %r14
jne 0xaf7c
movq %r12, 0x1a0(%rbx)
movq 0x10(%r15), %r14
movq 0x18(%r15), %rbp
cmpq %rbp, %r14
je 0xaff4
leaq 0x138(%rbx), %r15
leaq 0x198(%rbx), %r12
movq %rsp, %r13
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
movq $0x0, 0x10(%rsp)
movq %r13, %rdi
movq %r14, %rsi
callq 0x138a4
movq %r15, %rdi
movq %r13, %rsi
callq 0x13904
movq %r12, %rdi
movq %r13, %rsi
callq 0x13904
movq %r13, %rdi
callq 0x1353a
addq $0x18, %r14
cmpq %rbp, %r14
jne 0xafb2
movq 0x2bfdd(%rip), %r14     # 0x36fd8
leaq 0x1cc8e(%rip), %rsi     # 0x27c90
movl $0x5, %edx
movq %r14, %rdi
callq 0x4280
movq 0x140(%rbx), %rax
subq 0x138(%rbx), %rax
sarq $0x3, %rax
movabsq $-0x5555555555555555, %rsi # imm = 0xAAAAAAAAAAAAAAAB
imulq %rax, %rsi
movq %r14, %rdi
callq 0x4180
movq %rax, %rbx
leaq 0x1cc55(%rip), %rsi     # 0x27c96
movl $0x1a, %edx
movq %rax, %rdi
callq 0x4280
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
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq %rsp, %rdi
callq 0x1353a
movq %rbx, %rdi
callq 0x43e0
nop
// File: /workspace/github_cpp_makefile_star2_O3/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:
pushq %rax
cmpl $0x3, 0xc(%rdi)
jne 0xb0c3
movq 0x140(%rdi), %rax
cmpq 0x138(%rdi), %rax
je 0xb0d3
addq $-0x18, %rax
movq %rax, 0x140(%rdi)
movq %rax, %rdi
popq %rax
jmp 0x1353a
movq 0x2bf0e(%rip), %rdi     # 0x36fd8
leaq 0x1cbe0(%rip), %rsi     # 0x27cb1
jmp 0xb0e1
movq 0x2befe(%rip), %rdi     # 0x36fd8
leaq 0x1cc17(%rip), %rsi     # 0x27cf8
callq 0x4260
movq %rax, %rdi
callq 0x4100
xorl %edi, %edi
callq 0x4290
// File: /workspace/github_cpp_makefile_star2_O3/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:
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %rax
callq *0x250(%rax)
cmpl $0x1, %eax
je 0xc941
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x250(%rax)
testl %eax, %eax
je 0xc941
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x250(%rax)
cmpl $0x4, %eax
jne 0xc979
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x258(%rax)
movq (%rbx), %rcx
testl %eax, %eax
je 0xc96c
movq %rbx, %rdi
callq *0x258(%rcx)
cmpl $0x1, %eax
jne 0xc97b
movl $0x1a0, %ecx            # imm = 0x1A0
addq (%rbx), %rcx
jmp 0xc973
addq $0x198, %rcx            # imm = 0x198
movq %rbx, %rdi
popq %rbx
jmpq *(%rcx)
popq %rbx
retq
movq 0x2a656(%rip), %rbx     # 0x36fd8
leaq 0x1b81a(%rip), %rsi     # 0x281a3
movq %rbx, %rdi
callq 0x4260
movq %rax, %rdi
callq 0x4100
leaq 0x1b83e(%rip), %rsi     # 0x281de
movq %rbx, %rdi
callq 0x4260
movq %rax, %rdi
callq 0x4100
xorl %edi, %edi
callq 0x4290
nop
// File: /workspace/github_cpp_makefile_star2_O3/xbai0624[P]dnn/src/ConstructLayer.cpp
// Function: ConstructLayer::UpdateActiveWeightsAndBias()
void ConstructLayer::UpdateActiveWeightsAndBias()
{
    // clear active weights and bias from previous batch
    __weightMatrixActive.clear();
    __biasVectorActive.clear();

    // update active weights and bias for this batch
    TransferValueFromOriginalToActive_WB();
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0xd8(%rdi), %r15
movq 0xe0(%rdi), %r12
cmpq %r15, %r12
je 0xcdcf
movq %r15, %r14
movq %r14, %rdi
callq 0x1abf2
addq $0x18, %r14
cmpq %r12, %r14
jne 0xcdb7
movq %r15, 0xe0(%rbx)
movq 0xf0(%rbx), %r15
movq 0xf8(%rbx), %r12
cmpq %r15, %r12
je 0xcdfd
movq %r15, %r14
movq %r14, %rdi
callq 0x1abf2
addq $0x18, %r14
cmpq %r12, %r14
jne 0xcde5
movq %r15, 0xf8(%rbx)
movq (%rbx), %rax
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmpq *0x150(%rax)
// File: /workspace/github_cpp_makefile_star2_O3/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:
movl 0xc(%rdi), %eax
leal -0x1(%rax), %ecx
cmpl $0x2, %ecx
jb 0xd15c
testl %eax, %eax
jne 0xd0da
jmp 0xd0fe
pushq %rax
movq 0x29ef6(%rip), %rdi     # 0x36fd8
leaq 0x1b2e5(%rip), %rsi     # 0x283ce
callq 0x4260
movq %rax, %rdi
callq 0x4100
xorl %edi, %edi
callq 0x4290
nop
// File: /workspace/github_cpp_makefile_star2_O3/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:
pushq %rax
movq 0x400(%rdi), %rax
testq %rax, %rax
je 0xe999
movl (%rax), %eax
testl %eax, %eax
jle 0xe9a9
popq %rcx
retq
movq 0x28638(%rip), %rdi     # 0x36fd8
leaq 0x19d47(%rip), %rsi     # 0x286ee
jmp 0xe9b7
movq 0x28628(%rip), %rdi     # 0x36fd8
leaq 0x19d78(%rip), %rsi     # 0x2872f
callq 0x4260
movq %rax, %rdi
callq 0x4100
xorl %edi, %edi
callq 0x4290
nop
// File: /workspace/github_cpp_makefile_star2_O3/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:
cmpl $0x4, 0xc(%rdi)
jne 0xe9d9
movl 0x3e8(%rdi), %eax
retq
pushq %rax
movq 0x285f7(%rip), %rdi     # 0x36fd8
leaq 0x19da7(%rip), %rsi     # 0x2878f
callq 0x4260
movq %rax, %rdi
callq 0x4100
xorl %edi, %edi
callq 0x4290
// File: /workspace/github_cpp_makefile_star2_O3/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:
movq 0x400(%rdi), %rax
testq %rax, %rax
je 0xea0d
retq
pushq %rax
movq 0x285c3(%rip), %rdi     # 0x36fd8
leaq 0x19db8(%rip), %rsi     # 0x287d4
callq 0x4260
movq %rax, %rdi
callq 0x4100
xorl %edi, %edi
callq 0x4290
// File: /workspace/github_cpp_makefile_star2_O3/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:
movq 0x3f8(%rdi), %rax
testq %rax, %rax
je 0xea3d
retq
pushq %rax
movq 0x28593(%rip), %rdi     # 0x36fd8
leaq 0x19dcd(%rip), %rsi     # 0x28819
callq 0x4260
movq %rax, %rdi
callq 0x4100
xorl %edi, %edi
callq 0x4290
// File: /workspace/github_cpp_makefile_star2_O3/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:
movq 0x3f0(%rdi), %rax
testq %rax, %rax
je 0xea6d
retq
pushq %rax
movq 0x28563(%rip), %rdi     # 0x36fd8
leaq 0x19ddd(%rip), %rsi     # 0x28859
callq 0x4260
movq %rax, %rdi
callq 0x4100
xorl %edi, %edi
callq 0x4290
// File: /workspace/github_cpp_makefile_star2_O3/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:
pushq %rbx
movq %rdi, %rbx
callq 0xeb0e
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x250(%rax)
testl $0xfffffffb, %eax       # imm = 0xFFFFFFFB
je 0xeac0
cmpl $0x2, %eax
je 0xeac8
cmpl $0x1, %eax
jne 0xeadc
movq %rbx, %rdi
callq 0xf4ea
jmp 0xeac8
movq %rbx, %rdi
callq 0xeb72
cmpb $0x1, 0x210(%rbx)
jne 0xeada
movq %rbx, %rdi
popq %rbx
jmp 0xfcca
popq %rbx
retq
movq 0x284f5(%rip), %rdi     # 0x36fd8
leaq 0x19daf(%rip), %rsi     # 0x28899
callq 0x4260
leaq 0x19db8(%rip), %rsi     # 0x288ae
movq %rax, %rdi
callq 0x4260
movq %rax, %rdi
callq 0x4100
xorl %edi, %edi
callq 0x4290
nop
// File: /workspace/github_cpp_makefile_star2_O3/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:
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %rax
callq *0x250(%rax)
testl $0xfffffffb, %eax       # imm = 0xFFFFFFFB
je 0xeb35
cmpl $0x2, %eax
je 0xeb3e
cmpl $0x1, %eax
jne 0xeb40
movq %rbx, %rdi
popq %rbx
jmp 0x10436
movq %rbx, %rdi
popq %rbx
jmp 0xff2c
popq %rbx
retq
movq 0x28491(%rip), %rdi     # 0x36fd8
leaq 0x19d99(%rip), %rsi     # 0x288e7
callq 0x4260
leaq 0x19dab(%rip), %rsi     # 0x28905
movq %rax, %rdi
callq 0x4260
movq %rax, %rdi
callq 0x4100
xorl %edi, %edi
callq 0x4290
nop
// File: /workspace/github_cpp_makefile_star2_O3/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:
pushq %rbx
movl 0xc(%rdi), %eax
cmpq $0x4, %rax
ja 0x10f73
movq %rdi, %rbx
leaq 0x16210(%rip), %rcx     # 0x27140
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl 0x10(%rbx), %eax
jmp 0x10fc8
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x270(%rax)
imull %edx, %eax
imull 0x18(%rbx), %eax
jmp 0x10fc8
movq 0x40(%rbx), %rax
movq (%rax), %rdx
movq 0x8(%rax), %rax
subq %rdx, %rax
je 0x10fb9
movq 0x8(%rdx), %rcx
subq (%rdx), %rcx
sarq $0x3, %rcx
jmp 0x10fbb
movq 0x2605e(%rip), %rbx     # 0x36fd8
leaq 0x1805a(%rip), %rsi     # 0x28fdb
movl $0x3d, %edx
movq %rbx, %rdi
callq 0x4280
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
xorl %eax, %eax
jmp 0x10fc8
xorl %ecx, %ecx
shrq $0x3, %rax
imull %eax, %ecx
imull $0xaaaaaaab, %ecx, %eax # imm = 0xAAAAAAAB
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O3/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:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movq (%rsi), %rdi
cmpq %rdi, 0x8(%rsi)
je 0x14312
movq %rsi, %r14
callq 0x1abb8
imulq %rax, %rdx
movl $0x1, %ecx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x15a76
movq %rsp, %rdi
movq %rbx, %rsi
callq 0x1d08e
movq (%rbx), %r15
movq 0x8(%rbx), %r12
cmpq %r15, %r12
je 0x142f0
movq %r15, %r14
movq %r14, %rdi
callq 0x1abf2
addq $0x18, %r14
cmpq %r12, %r14
jne 0x142db
movq %r15, 0x8(%rbx)
movq %rsp, %rsi
movq %rbx, %rdi
callq 0x138a4
movq %rsp, %rdi
callq 0x1abf2
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0x156d0(%rip), %rdi     # 0x299e9
leaq 0x15303(%rip), %rsi     # 0x29623
leaq 0x156e3(%rip), %rcx     # 0x29a0a
movl $0x159, %edx            # imm = 0x159
callq 0x4160
movq %rax, %r14
movq %rsp, %rdi
callq 0x1abf2
jmp 0x14341
movq %rax, %r14
movq %rbx, %rdi
callq 0x1353a
movq %r14, %rdi
callq 0x43e0
nop
// File: /workspace/github_cpp_makefile_star2_O3/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %ebp
movq %rdi, %r14
movq $0x64, (%rdi)
movl $0x0, 0x8(%rdi)
leaq 0x10(%rdi), %rbx
movl $0xb0, %edx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x4140
movl %ebp, 0xc0(%r14)
movq %r14, %rdi
callq 0x19060
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r15
leaq 0xa8(%r14), %rdi
leaq 0x90(%r14), %r12
leaq 0x58(%r14), %r13
leaq 0x40(%r14), %rbp
addq $0x28, %r14
callq 0x1353a
movq %r12, %rdi
callq 0x1353a
movq %r13, %rdi
callq 0x1357a
movq %rbp, %rdi
callq 0x1357a
movq %r14, %rdi
callq 0x1353a
movq %rbx, %rdi
callq 0x1353a
movq %r15, %rdi
callq 0x43e0
nop
// File: /workspace/github_cpp_makefile_star2_O3/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:
pushq %r14
pushq %rbx
subq $0x48, %rsp
movq %rdi, %rbx
leaq 0x30(%rsp), %r14
movsd 0xe509(%rip), %xmm0     # 0x27580
movl $0xa, %esi
movl $0xa, %edx
movq %r14, %rdi
callq 0x1a92c
leaq 0x18(%rsp), %rdi
movl $0x64, %edx
movl $0x1, %ecx
movq %r14, %rsi
callq 0x1c0d2
leaq 0x10(%rbx), %rdi
leaq 0x18(%rsp), %rsi
callq 0x138a4
movq %rsp, %rdi
movl $0xa, %esi
movl $0x1, %edx
xorps %xmm0, %xmm0
callq 0x1a92c
movq %rsp, %rdi
xorl %esi, %esi
callq 0x1adb2
movq (%rax), %rax
movabsq $0x3ff0000000000000, %rcx # imm = 0x3FF0000000000000
movq %rcx, (%rax)
addq $0x28, %rbx
movq %rsp, %rsi
movq %rbx, %rdi
callq 0x138a4
movq %rsp, %rdi
callq 0x1abf2
leaq 0x18(%rsp), %rdi
callq 0x1abf2
leaq 0x30(%rsp), %rdi
callq 0x1abf2
addq $0x48, %rsp
popq %rbx
popq %r14
retq
jmp 0x19112
movq %rax, %rbx
jmp 0x19127
movq %rax, %rbx
jmp 0x19131
movq %rax, %rbx
movq %rsp, %rdi
callq 0x1abf2
leaq 0x18(%rsp), %rdi
callq 0x1abf2
leaq 0x30(%rsp), %rdi
callq 0x1abf2
movq %rbx, %rdi
callq 0x43e0
nop
// File: /workspace/github_cpp_makefile_star2_O3/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, %ebp
movq %rdx, %r13
movq %rsi, %rbx
movq %rdi, %r14
movq $0x64, (%rdi)
movl $0x0, 0x8(%rdi)
addq $0x10, %rdi
leaq 0x90(%r14), %r15
leaq 0xa8(%r14), %r12
movl $0xb0, %edx
movq %rdi, (%rsp)
xorl %esi, %esi
callq 0x4140
movl %ebp, 0xc0(%r14)
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x19204
movq %r14, %rdi
movq %r13, %rsi
movq %r12, %rdx
callq 0x19204
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x58(%r14), %r13
leaq 0x40(%r14), %rbp
addq $0x28, %r14
movq %r12, %rdi
callq 0x1353a
movq %r15, %rdi
callq 0x1353a
movq %r13, %rdi
callq 0x1357a
movq %rbp, %rdi
callq 0x1357a
movq %r14, %rdi
callq 0x1353a
movq (%rsp), %rdi
callq 0x1353a
movq %rbx, %rdi
callq 0x43e0
// File: /workspace/github_cpp_makefile_star2_O3/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %r9d, %r12d
movq %r8, %rbx
movl %ecx, %r15d
movq %rdx, 0x8(%rsp)
movq %rsi, 0x10(%rsp)
movq %rdi, %r14
movq $0x0, 0x4(%rdi)
addq $0x10, %rdi
leaq 0x90(%r14), %rbp
leaq 0xa8(%r14), %r13
movl $0xb0, %edx
movq %rdi, (%rsp)
xorl %esi, %esi
callq 0x4140
movl %r15d, 0xc0(%r14)
movl %r12d, (%r14)
movslq %ebx, %rax
movq %rax, 0x80(%r14)
sarq $0x20, %rbx
movq %rbx, 0x88(%r14)
movq %r14, %rdi
movq 0x10(%rsp), %rsi
movq %rbp, %rdx
callq 0x19204
movq %r14, %rdi
movq 0x8(%rsp), %rsi
movq %r13, %rdx
callq 0x19204
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x58(%r14), %r15
leaq 0x40(%r14), %r12
addq $0x28, %r14
movq %r13, %rdi
callq 0x1353a
movq %rbp, %rdi
callq 0x1353a
movq %r15, %rdi
callq 0x1357a
movq %r12, %rdi
callq 0x1357a
movq %r14, %rdi
callq 0x1353a
movq (%rsp), %rdi
callq 0x1353a
movq %rbx, %rdi
callq 0x43e0
// File: /workspace/github_cpp_makefile_star2_O3/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:
movl 0x8(%rdi), %eax
incl %eax
cmpl 0x4(%rdi), %eax
jne 0x19be9
movl %eax, 0x8(%rdi)
addq $0x28, %rdi
movq %rdi, %rax
retq
pushq %rax
movq 0x1d3e7(%rip), %rdi     # 0x36fd8
leaq 0x1000f(%rip), %rsi     # 0x29c07
callq 0x4260
movq %rax, %rdi
callq 0x4100
xorl %edi, %edi
callq 0x4290
// File: /workspace/github_cpp_makefile_star2_O3/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdi, %rbx
leaq 0x10(%rdi), %rsi
leaq 0x28(%rdi), %rdx
movq %rdx, 0x8(%rsp)
callq 0x198ba
movq 0x10(%rbx), %rsi
movq 0x18(%rbx), %rax
movq %rax, %rcx
subq %rsi, %rcx
movq 0x30(%rbx), %rdx
subq 0x28(%rbx), %rdx
cmpq %rdx, %rcx
jne 0x19d1d
cmpq %rsi, %rax
je 0x19d07
leaq 0x40(%rbx), %rax
movq %rax, (%rsp)
leaq 0x58(%rbx), %r12
xorl %r14d, %r14d
leaq 0x30(%rsp), %r13
leaq 0x10(%rsp), %rbp
xorl %r15d, %r15d
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
movq $0x0, 0x40(%rsp)
addq %r14, %rsi
movq %r13, %rdi
callq 0x138a4
movq (%rsp), %rdi
movq %r13, %rsi
callq 0x13904
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
movq 0x8(%rsp), %rax
movq (%rax), %rsi
addq %r14, %rsi
movq %rbp, %rdi
callq 0x138a4
movq %r12, %rdi
movq %rbp, %rsi
callq 0x13904
movq %rbp, %rdi
callq 0x1353a
movq %r13, %rdi
callq 0x1353a
incq %r15
movq 0x10(%rbx), %rsi
movq 0x18(%rbx), %rax
subq %rsi, %rax
sarq $0x3, %rax
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rcx, %rax
addq $0x18, %r14
cmpq %rax, %r15
jb 0x19c73
addq $0x40, %rbx
movq %rbx, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xff16(%rip), %rdi      # 0x29c3a
leaq 0xfe9e(%rip), %rsi      # 0x29bc9
leaq 0xff28(%rip), %rcx      # 0x29c5a
movl $0x76, %edx
callq 0x4160
movq %rax, %rbx
jmp 0x19d4e
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x1353a
leaq 0x30(%rsp), %rdi
callq 0x1353a
movq %rbx, %rdi
callq 0x43e0