LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/stonezwr[P]SpiKL-IP/network.C
// Function: Network::LSMAddSynapse(NeuronGroup*, NeuronGroup*, int, int, int, int, bool)
void Network::LSMAddSynapse(NeuronGroup * pre, NeuronGroup * post, int npre, int npost, int value, int random, bool fixed){
    assert((npre == 1)||(npre == -1));
    for(Neuron * neuron = pre->First(); neuron != NULL; neuron = pre->Next()){
        LSMAddSynapse(neuron,post,npost,value, random, fixed);
    }
    if(pre->GetBiasNeuron() != NULL){
        BiasNeuron * b_neuron = pre->GetBiasNeuron();
        LSMAddSynapse(b_neuron, post, npost, value, 0, fixed);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %r9d, %ebx
movl %r8d, %ebp
movq %rdx, %r14
movq %rsi, %r12
movq %rdi, %r15
cmpl $-0x1, %ecx
je 0xdd8a
cmpl $0x1, %ecx
jne 0xddfa
movq %r12, %rdi
callq 0x91dc
testq %rax, %rax
je 0xddc6
movzbl 0x48(%rsp), %r13d
movl %r13d, (%rsp)
movq %r15, %rdi
movq %rax, %rsi
movq %r14, %rdx
movl %ebp, %ecx
movl %ebx, %r8d
movl 0x40(%rsp), %r9d
callq 0xda62
movq %r12, %rdi
callq 0x9222
testq %rax, %rax
jne 0xdd9d
movq 0x48(%r12), %rsi
testq %rsi, %rsi
je 0xddeb
movzbl 0x48(%rsp), %eax
movl %eax, (%rsp)
movq %r15, %rdi
movq %r14, %rdx
movl %ebp, %ecx
movl %ebx, %r8d
xorl %r9d, %r9d
callq 0xda62
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xa741(%rip), %rdi      # 0x18542
leaq 0xa52a(%rip), %rsi      # 0x18332
leaq 0xa74d(%rip), %rcx      # 0x1855c
movl $0xd8, %edx
callq 0x31b0
nop
// File: /workspace/github_c_makefile_star2_O1/stonezwr[P]SpiKL-IP/network.C
// Function: Network::LSMAddSynapse(char*, char*, int, int, int, int, bool)
void Network::LSMAddSynapse(char * pre, char * post, int npre, int npost, int value, int random, bool fixed){
    NeuronGroup * preNeuronGroup = SearchForNeuronGroup(pre);
    NeuronGroup * postNeuronGroup = SearchForNeuronGroup(post);
    assert((preNeuronGroup != NULL)&&(postNeuronGroup != NULL));
    
    // add synapses
    if(strcmp(pre, post) != 0) // between layer connections
        LSMAddSynapse(preNeuronGroup, postNeuronGroup, npre, npost, value, random, fixed);
    else{ // laterial inhibition
        assert(preNeuronGroup == postNeuronGroup);
        LSMAddSynapse(preNeuronGroup, npre, npost, value, random, fixed);
    } 
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %r9d, 0x14(%rsp)
movl %r8d, 0x10(%rsp)
movl %ecx, %r14d
movq %rdx, %r13
movq %rsi, %rbx
movq %rdi, %r15
movb 0x58(%rsp), %al
movb %al, 0xf(%rsp)
callq 0xdf10
movq %rax, %r12
movq %r15, %rdi
movq %r13, %rsi
callq 0xdf10
testq %r12, %r12
je 0xded1
movq %rax, %rbp
testq %rax, %rax
je 0xded1
movq %rbx, %rdi
movq %r13, %rsi
callq 0x33f0
testl %eax, %eax
je 0xde9e
movq %r15, %rdi
movq %r12, %rsi
movq %rbp, %rdx
movl %r14d, %ecx
movl 0x10(%rsp), %r8d
movl 0x14(%rsp), %r9d
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xdd66
cmpq %rbp, %r12
jne 0xdef0
movzbl 0xf(%rsp), %eax
movl %eax, (%rsp)
movq %r15, %rdi
movq %r12, %rsi
movl %r14d, %edx
movl 0x10(%rsp), %ecx
movl 0x14(%rsp), %r8d
callq 0xdc2c
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xa6d8(%rip), %rdi      # 0x185b0
leaq 0xa453(%rip), %rsi      # 0x18332
leaq 0xa6fe(%rip), %rcx      # 0x185e4
movl $0xe5, %edx
callq 0x31b0
leaq 0xa733(%rip), %rdi      # 0x1862a
leaq 0xa434(%rip), %rsi      # 0x18332
leaq 0xa6df(%rip), %rcx      # 0x185e4
movl $0xeb, %edx
callq 0x31b0
nop
// File: /workspace/github_c_makefile_star2_O1/stonezwr[P]SpiKL-IP/network.C
// Function: Network::PrintSize()
void Network::PrintSize(){
    cout<<"Total Number of neurons: "<<_allNeurons.size()<<endl;
    cout<<"Total Number of synapses: "<<_synapses.size()<<endl;
    int numExitatory = 0;
    int numLearning = 0;
    for(list<Synapse*>::iterator iter = _synapses.begin(); iter != _synapses.end(); iter++){
        if((*iter)->Excitatory()==true) numExitatory++;
        if((*iter)->Fixed()==false) numLearning++;
    }
    cout<<"\tNumber of excitatory synapses: "<<numExitatory<<endl;
    cout<<"\tNumber of learning synapses: "<<numLearning<<endl;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x12fb1(%rip), %r14     # 0x20fd0
leaq 0xa626(%rip), %rsi      # 0x1864c
movl $0x19, %edx
movq %r14, %rdi
callq 0x3340
movq 0x98(%rbx), %rsi
movq %r14, %rdi
callq 0x31d0
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x32b0
movsbl %al, %esi
movq %r15, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x31e0
leaq 0xa5f3(%rip), %rsi      # 0x18666
movl $0x1a, %edx
movq %r14, %rdi
callq 0x3340
leaq 0x100(%rbx), %r15
movq 0x110(%rbx), %rsi
movq %r14, %rdi
callq 0x31d0
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x32b0
movsbl %al, %esi
movq %r14, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x31e0
movq 0x100(%rbx), %r14
cmpq %r15, %r14
je 0xe0f8
xorl %ebp, %ebp
xorl %ebx, %ebx
movq 0x10(%r14), %rdi
callq 0xc3e8
movzbl %al, %eax
addl %eax, %ebp
movq 0x10(%r14), %rdi
callq 0xc3ec
xorb $0x1, %al
movzbl %al, %eax
addl %eax, %ebx
movq (%r14), %r14
cmpq %r15, %r14
jne 0xe0d0
jmp 0xe0fc
xorl %ebx, %ebx
xorl %ebp, %ebp
movq 0x12ecd(%rip), %r14     # 0x20fd0
leaq 0xa577(%rip), %rsi      # 0x18681
movl $0x20, %edx
movq %r14, %rdi
callq 0x3340
movq %r14, %rdi
movl %ebp, %esi
callq 0x3560
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x32b0
movsbl %al, %esi
movq %r15, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x31e0
leaq 0xa550(%rip), %rsi      # 0x186a2
movl $0x1e, %edx
movq %r14, %rdi
callq 0x3340
movq %r14, %rdi
movl %ebx, %esi
callq 0x3560
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x32b0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3040
movq %rax, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x31e0
nop
// File: /workspace/github_c_makefile_star2_O1/stonezwr[P]SpiKL-IP/network.C
// Function: Network::LSMClearSignals()
void Network::LSMClearSignals(){
    for(list<Neuron*>::iterator iter = _allNeurons.begin(); iter != _allNeurons.end(); iter++) (*iter)->LSMClear();
    for(list<Synapse*>::iterator iter = _synapses.begin(); iter != _synapses.end(); iter++) (*iter)->LSMClear();
    // Remember to clear the list to store the synapses:      
    _lsmActiveLearnSyns.clear();                              
    _lsmActiveSyns.clear();
    _sp = NULL;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
leaq 0x88(%rdi), %r14
movq 0x88(%rdi), %r15
cmpq %r14, %r15
je 0xe471
movq 0x10(%r15), %rdi
callq 0x7114
movq (%r15), %r15
jmp 0xe45e
leaq 0x100(%rbx), %r14
movq 0x100(%rbx), %r15
cmpq %r14, %r15
je 0xe492
movq 0x10(%r15), %rdi
callq 0xc42c
movq (%r15), %r15
jmp 0xe47f
leaq 0x160(%rbx), %rdi
callq 0x1170c
leaq 0x178(%rbx), %rdi
callq 0x1170c
movq $0x0, 0x260(%rbx)
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_c_makefile_star2_O1/stonezwr[P]SpiKL-IP/network.C
// Function: Network::LoadFirstSpeech(bool, networkmode_t, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
int Network::LoadFirstSpeech(bool train, networkmode_t networkmode, const string sample_type){
    LSMLoadLayers();

    neuronmode_t neuronmode_input = NORMAL, neuronmode_reservoir = NORMAL, neuronmode_readout = NORMAL;
    // determine the neuron mode by the network mode:
    DetermineNetworkNeuronMode(networkmode, neuronmode_input, neuronmode_reservoir, neuronmode_readout); 
    auto sp_end_ptr = _speeches.end();
    _sp_iter = _speeches.begin();

    if(_sp_iter != sp_end_ptr){
        LoadSpeeches(*_sp_iter, neuronmode_input, neuronmode_reservoir, neuronmode_readout, train);
        return (*_sp_iter)->Index();
    }else{
        _sp = NULL;
        return -1;
    }
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movl %esi, %ebp
movq %rdi, %rbx
leaq 0xc(%rsp), %r14
movl %edx, (%r14)
callq 0xfb4a
movl $0x3, %eax
leaq 0x8(%rsp), %rdx
movl %eax, (%rdx)
leaq 0x4(%rsp), %rcx
movl %eax, (%rcx)
movq %rsp, %r8
movl %eax, (%r8)
movq %r14, %rsi
callq 0xfc4e
movq 0x208(%rbx), %rax
movq %rax, 0x220(%rbx)
cmpq 0x210(%rbx), %rax
je 0xe53b
movq (%rax), %rsi
movl 0x8(%rsp), %edx
movl 0x4(%rsp), %ecx
movl (%rsp), %r8d
movzbl %bpl, %r9d
movq %rbx, %rdi
callq 0xf964
movq 0x220(%rbx), %rax
movq (%rax), %rax
movl 0x84(%rax), %eax
jmp 0xe54b
movq $0x0, 0x260(%rbx)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/stonezwr[P]SpiKL-IP/network.C
// Function: Network::SpeechEndTime()
int Network::SpeechEndTime(){
    if(_sp == NULL){
        cout<<"In Network::EndSpeechTime(), find out the attached _sp in network"
            <<" is valid!!"<< endl;
        assert(_sp != NULL);
    }
    return _sp->EndTime();
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpq $0x0, 0x260(%rdi)
jne 0xe5c5
movq 0x12a64(%rip), %r14     # 0x20fd0
leaq 0xa1ba(%rip), %rsi      # 0x1872d
movl $0x41, %edx
movq %r14, %rdi
callq 0x3340
leaq 0xa1e8(%rip), %rsi      # 0x1876f
movl $0xb, %edx
movq %r14, %rdi
callq 0x3340
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x32b0
movsbl %al, %esi
movq %r14, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x31e0
cmpq $0x0, 0x260(%rbx)
je 0xe5d8
movq 0x260(%rbx), %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x60ce
leaq 0xa19c(%rip), %rdi      # 0x1877b
leaq 0x9d4c(%rip), %rsi      # 0x18332
leaq 0xa19a(%rip), %rcx      # 0x18787
movl $0x1a7, %edx            # imm = 0x1A7
callq 0x31b0
nop
// File: /workspace/github_c_makefile_star2_O1/stonezwr[P]SpiKL-IP/network.C
// Function: Network::LSMNextTimeStep(int, bool, int, int, _IO_FILE*)
void Network::LSMNextTimeStep(int t, bool train,int iteration,int end_time, FILE * Foutp){
    _lsm_t = t;
	vector<int> state; 

    _lsmActiveSyns.clear();

    // Please remember that the neuron firing activity will change the list: 
    // _lsmActiveSyns, _lsmActiveSTDPLearnSyns, and _lsmActiveLearnSyns:
    for(Neuron * neuron : _allNeurons){
		neuron->LSMNextTimeStep(t, Foutp, train, end_time);
	}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r9, %r12
movl %r8d, %r13d
movl %ecx, 0xc(%rsp)
movl %edx, 0x8(%rsp)
movl %esi, %ebp
movq %rdi, %r14
movl %esi, 0x2bc(%rdi)
addq $0x178, %rdi            # imm = 0x178
callq 0x1170c
leaq 0x88(%r14), %rbx
movq %r14, 0x10(%rsp)
movq 0x88(%r14), %r14
cmpq %rbx, %r14
je 0xe697
movzbl 0x8(%rsp), %r15d
movq 0x10(%r14), %rdi
movq (%rdi), %rax
movl %ebp, %esi
movq %r12, %rdx
movl %r15d, %ecx
movl %r13d, %r8d
callq *(%rax)
movq (%r14), %r14
cmpq %rbx, %r14
jne 0xe67b
movq (%rbx), %r14
cmpq %rbx, %r14
je 0xe6ad
movq 0x10(%r14), %rdi
callq 0x72dc
movq (%r14), %r14
jmp 0xe69a
cmpb $0x0, 0x8(%rsp)
movq 0x10(%rsp), %r15
je 0xe707
cmpl $0x1, 0x2c0(%r15)
jne 0xe707
movq 0x160(%r15), %rbx
addq $0x160, %r15            # imm = 0x160
cmpq %r15, %rbx
movl 0xc(%rsp), %r14d
je 0xe6f1
movq 0x10(%rbx), %rdi
movl %ebp, %esi
movl %r14d, %edx
callq 0xc2fe
movq (%rbx), %rbx
cmpq %r15, %rbx
jne 0xe6db
movq %r15, %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1170c
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/stonezwr[P]SpiKL-IP/network.C
// Function: Network::LSMClearSignalsIP()
void Network::LSMClearSignalsIP(){
    for(list<Neuron*>::iterator iter = _allNeurons.begin(); iter != _allNeurons.end(); iter++) (*iter)->LSMClearIP();
    for(list<Synapse*>::iterator iter = _synapses.begin(); iter != _synapses.end(); iter++) (*iter)->LSMClear();
    // Remember to clear the list to store the synapses:      
    _lsmActiveLearnSyns.clear();                              
    _lsmActiveSyns.clear();
    _sp = NULL;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
leaq 0x88(%rdi), %r14
movq 0x88(%rdi), %r15
cmpq %r14, %r15
je 0xec1f
movq 0x10(%r15), %rdi
callq 0x7204
movq (%r15), %r15
jmp 0xec0c
leaq 0x100(%rbx), %r14
movq 0x100(%rbx), %r15
cmpq %r14, %r15
je 0xec40
movq 0x10(%r15), %rdi
callq 0xc42c
movq (%r15), %r15
jmp 0xec2d
leaq 0x160(%rbx), %rdi
callq 0x1170c
leaq 0x178(%rbx), %rdi
callq 0x1170c
movq $0x0, 0x260(%rbx)
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_c_makefile_star2_O1/stonezwr[P]SpiKL-IP/network.C
// Function: Network::LoadSpeechAgain(bool, networkmode_t, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
int Network::LoadSpeechAgain(bool train, networkmode_t networkmode, const string sample_type){
    assert(_lsm_input_layer != NULL);
    assert(_lsm_reservoir_layer != NULL);
    assert(_lsm_output_layer != NULL);

    neuronmode_t neuronmode_input = NORMAL, neuronmode_reservoir = NORMAL, neuronmode_readout = NORMAL;
    // determine the neuron mode by the network mode:
    DetermineNetworkNeuronMode(networkmode, neuronmode_input, neuronmode_reservoir, neuronmode_readout);

    if(train == true) _lsm_output_layer->LSMRemoveTeacherSignal((*_sp_iter)->Class());

    LoadSpeeches(*_sp_iter, neuronmode_input, neuronmode_reservoir, neuronmode_readout, train);
    return (*_sp_iter)->Index();
}

// Assembly:
pushq %rbp
pushq %rbx
subq $0x18, %rsp
movl %edx, 0x14(%rsp)
cmpq $0x0, 0x268(%rdi)
je 0xed23
movq %rdi, %rbx
cmpq $0x0, 0x270(%rdi)
je 0xed42
cmpq $0x0, 0x2a8(%rbx)
je 0xed61
movl %esi, %ebp
movl $0x3, %eax
leaq 0x10(%rsp), %rdx
movl %eax, (%rdx)
leaq 0xc(%rsp), %rcx
movl %eax, (%rcx)
leaq 0x8(%rsp), %r8
movl %eax, (%r8)
leaq 0x14(%rsp), %rsi
callq 0xfc4e
testb %bpl, %bpl
je 0xece9
movq 0x220(%rbx), %rax
movq 0x2a8(%rbx), %rdi
movq (%rax), %rax
movl 0x80(%rax), %esi
callq 0xa31a
movq 0x220(%rbx), %rax
movq (%rax), %rsi
movl 0x10(%rsp), %edx
movl 0xc(%rsp), %ecx
movl 0x8(%rsp), %r8d
movzbl %bpl, %r9d
movq %rbx, %rdi
callq 0xf964
movq 0x220(%rbx), %rax
movq (%rax), %rax
movl 0x84(%rax), %eax
addq $0x18, %rsp
popq %rbx
popq %rbp
retq
leaq 0x9b79(%rip), %rdi      # 0x188a3
leaq 0x9601(%rip), %rsi      # 0x18332
leaq 0x9c32(%rip), %rcx      # 0x1896a
movl $0x233, %edx            # imm = 0x233
callq 0x31b0
leaq 0x9b90(%rip), %rdi      # 0x188d9
leaq 0x95e2(%rip), %rsi      # 0x18332
leaq 0x9c13(%rip), %rcx      # 0x1896a
movl $0x234, %edx            # imm = 0x234
callq 0x31b0
leaq 0x9b8e(%rip), %rdi      # 0x188f6
leaq 0x95c3(%rip), %rsi      # 0x18332
leaq 0x9bf4(%rip), %rcx      # 0x1896a
movl $0x235, %edx            # imm = 0x235
callq 0x31b0
// File: /workspace/github_c_makefile_star2_O1/stonezwr[P]SpiKL-IP/network.C
// Function: Network::LoadNextSpeech(bool, networkmode_t, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
int Network::LoadNextSpeech(bool train, networkmode_t networkmode, const string sample_type){
    assert(_lsm_input_layer != NULL);
    assert(_lsm_reservoir_layer != NULL);
    assert(_lsm_output_layer != NULL);

    neuronmode_t neuronmode_input = NORMAL, neuronmode_reservoir = NORMAL, neuronmode_readout = NORMAL;
    // determine the neuron mode by the network mode:
    DetermineNetworkNeuronMode(networkmode, neuronmode_input, neuronmode_reservoir, neuronmode_readout);

    if(train == true) _lsm_output_layer->LSMRemoveTeacherSignal((*_sp_iter)->Class());
    _sp_iter++;

    auto sp_end_ptr = _speeches.end();
    
    if(_sp_iter != sp_end_ptr){
        LoadSpeeches(*_sp_iter, neuronmode_input, neuronmode_reservoir, neuronmode_readout, train);
        return (*_sp_iter)->Index();
    }else{
        LSMNetworkRemoveSpeech();
        return -1;
    }
}

// Assembly:
pushq %rbp
pushq %rbx
subq $0x18, %rsp
movl %edx, 0x14(%rsp)
cmpq $0x0, 0x268(%rdi)
je 0xee5c
movq %rdi, %rbx
cmpq $0x0, 0x270(%rdi)
je 0xee7b
cmpq $0x0, 0x2a8(%rbx)
je 0xee9a
movl %esi, %ebp
movl $0x3, %eax
leaq 0x10(%rsp), %rdx
movl %eax, (%rdx)
leaq 0xc(%rsp), %rcx
movl %eax, (%rcx)
leaq 0x8(%rsp), %r8
movl %eax, (%r8)
leaq 0x14(%rsp), %rsi
callq 0xfc4e
testb %bpl, %bpl
je 0xedff
movq 0x220(%rbx), %rax
movq 0x2a8(%rbx), %rdi
movq (%rax), %rax
movl 0x80(%rax), %esi
callq 0xa31a
movq 0x220(%rbx), %rax
addq $0x8, %rax
movq %rax, 0x220(%rbx)
cmpq 0x210(%rbx), %rax
je 0xee48
movq (%rax), %rsi
movl 0x10(%rsp), %edx
movl 0xc(%rsp), %ecx
movl 0x8(%rsp), %r8d
movzbl %bpl, %r9d
movq %rbx, %rdi
callq 0xf964
movq 0x220(%rbx), %rax
movq (%rax), %rax
movl 0x84(%rax), %eax
jmp 0xee55
movq %rbx, %rdi
callq 0xfaba
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x18, %rsp
popq %rbx
popq %rbp
retq
leaq 0x9a40(%rip), %rdi      # 0x188a3
leaq 0x94c8(%rip), %rsi      # 0x18332
leaq 0x9aba(%rip), %rcx      # 0x1892b
movl $0x21c, %edx            # imm = 0x21C
callq 0x31b0
leaq 0x9a57(%rip), %rdi      # 0x188d9
leaq 0x94a9(%rip), %rsi      # 0x18332
leaq 0x9a9b(%rip), %rcx      # 0x1892b
movl $0x21d, %edx            # imm = 0x21D
callq 0x31b0
leaq 0x9a55(%rip), %rdi      # 0x188f6
leaq 0x948a(%rip), %rsi      # 0x18332
leaq 0x9a7c(%rip), %rcx      # 0x1892b
movl $0x21e, %edx            # imm = 0x21E
callq 0x31b0
nop
// File: /workspace/github_c_makefile_star2_O1/stonezwr[P]SpiKL-IP/network.C
// Function: Network::LoadFirstSpeechTrainCV(networkmode_t)
int Network::LoadFirstSpeechTrainCV(networkmode_t networkmode){
    assert((_fold_ind>=0)&&(_fold_ind<_fold));

    LSMLoadLayers();
    neuronmode_t neuronmode_input = NORMAL, neuronmode_reservoir = NORMAL, neuronmode_readout = NORMAL;
    // determine the neuron mode by the network mode:
    DetermineNetworkNeuronMode(networkmode, neuronmode_input, neuronmode_reservoir, neuronmode_readout);


    if(_fold_ind == 0) _train_fold_ind = 1;
    else _train_fold_ind = 0;
    assert(!_CVspeeches.empty());
    _cv_train_sp_iter = _CVspeeches[_train_fold_ind].begin();
    if(_cv_train_sp_iter != _CVspeeches[_train_fold_ind].end()){
        LoadSpeeches(*_cv_train_sp_iter, neuronmode_input, neuronmode_reservoir, neuronmode_readout,true); 
        return (*_cv_train_sp_iter)->Index();
    }else{
        cout<<"Warning, no training speech is specified!!"<<endl;
        _sp = NULL;
        return -1;
    }
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movl %esi, 0x14(%rsp)
movl 0x22c(%rdi), %eax
testl %eax, %eax
js 0xf202
movq %rdi, %rbx
cmpl 0x228(%rdi), %eax
jge 0xf202
movq %rbx, %rdi
callq 0xfb4a
movl $0x3, %eax
leaq 0x10(%rsp), %rdx
movl %eax, (%rdx)
leaq 0xc(%rsp), %rcx
movl %eax, (%rcx)
leaq 0x8(%rsp), %r8
movl %eax, (%r8)
leaq 0x14(%rsp), %rsi
callq 0xfc4e
xorl %eax, %eax
cmpl $0x0, 0x22c(%rbx)
sete %al
movl %eax, 0x230(%rbx)
movq 0x238(%rbx), %rax
cmpq 0x240(%rbx), %rax
je 0xf221
movslq 0x230(%rbx), %rcx
leaq (%rcx,%rcx,2), %rdx
movq (%rax,%rdx,8), %rcx
movq %rcx, 0x250(%rbx)
cmpq 0x8(%rax,%rdx,8), %rcx
je 0xf1a8
movq (%rcx), %rsi
movl 0x10(%rsp), %edx
movl 0xc(%rsp), %ecx
movl 0x8(%rsp), %r8d
movq %rbx, %rdi
movl $0x1, %r9d
callq 0xf964
movq 0x250(%rbx), %rax
movq (%rax), %rax
movl 0x84(%rax), %eax
jmp 0xf1fa
movq 0x11e21(%rip), %r14     # 0x20fd0
leaq 0x985e(%rip), %rsi      # 0x18a14
movl $0x2a, %edx
movq %r14, %rdi
callq 0x3340
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x32b0
movsbl %al, %esi
movq %r14, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x31e0
movq $0x0, 0x260(%rbx)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x18, %rsp
popq %rbx
popq %r14
retq
leaq 0x97a1(%rip), %rdi      # 0x189aa
leaq 0x9122(%rip), %rsi      # 0x18332
leaq 0x97b5(%rip), %rcx      # 0x189cc
movl $0x243, %edx            # imm = 0x243
callq 0x31b0
leaq 0x97d7(%rip), %rdi      # 0x189ff
leaq 0x9103(%rip), %rsi      # 0x18332
leaq 0x9796(%rip), %rcx      # 0x189cc
movl $0x24d, %edx            # imm = 0x24D
callq 0x31b0
// File: /workspace/github_c_makefile_star2_O1/stonezwr[P]SpiKL-IP/network.C
// Function: Network::LoadFirstSpeechTestCV(networkmode_t)
int Network::LoadFirstSpeechTestCV(networkmode_t networkmode){
    assert((_fold_ind>=0)&&(_fold_ind<_fold));

    LSMLoadLayers();
    neuronmode_t neuronmode_input = NORMAL, neuronmode_reservoir = NORMAL, neuronmode_readout = NORMAL;
    // determine the neuron mode by the network mode:
    DetermineNetworkNeuronMode(networkmode, neuronmode_input, neuronmode_reservoir, neuronmode_readout); 


    assert(!_CVspeeches.empty());
    _cv_test_sp_iter = _CVspeeches[_fold_ind].begin();
    if(_cv_test_sp_iter != _CVspeeches[_fold_ind].end()){
        LoadSpeeches(*_cv_test_sp_iter, neuronmode_input, neuronmode_reservoir, neuronmode_readout, false);
        return (*_cv_test_sp_iter)->Index();
    }else{
        _sp = NULL;
        return -1;
    }
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movl %esi, 0xc(%rsp)
movl 0x22c(%rdi), %eax
testl %eax, %eax
js 0xf4d2
movq %rdi, %rbx
cmpl 0x228(%rdi), %eax
jge 0xf4d2
movq %rbx, %rdi
callq 0xfb4a
movl $0x3, %eax
leaq 0x8(%rsp), %rdx
movl %eax, (%rdx)
leaq 0x4(%rsp), %rcx
movl %eax, (%rcx)
movq %rsp, %r8
movl %eax, (%r8)
leaq 0xc(%rsp), %rsi
callq 0xfc4e
movq 0x238(%rbx), %rax
cmpq 0x240(%rbx), %rax
je 0xf4f1
movslq 0x22c(%rbx), %rcx
leaq (%rcx,%rcx,2), %rdx
movq (%rax,%rdx,8), %rcx
movq %rcx, 0x258(%rbx)
cmpq 0x8(%rax,%rdx,8), %rcx
je 0xf4bc
movq (%rcx), %rsi
movl 0x8(%rsp), %edx
movl 0x4(%rsp), %ecx
movl (%rsp), %r8d
movq %rbx, %rdi
xorl %r9d, %r9d
callq 0xf964
movq 0x258(%rbx), %rax
movq (%rax), %rax
movl 0x84(%rax), %eax
jmp 0xf4cc
movq $0x0, 0x260(%rbx)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x10, %rsp
popq %rbx
retq
leaq 0x94d1(%rip), %rdi      # 0x189aa
leaq 0x8e52(%rip), %rsi      # 0x18332
leaq 0x958a(%rip), %rcx      # 0x18a71
movl $0x27d, %edx            # imm = 0x27D
callq 0x31b0
leaq 0x9507(%rip), %rdi      # 0x189ff
leaq 0x8e33(%rip), %rsi      # 0x18332
leaq 0x956b(%rip), %rcx      # 0x18a71
movl $0x285, %edx            # imm = 0x285
callq 0x31b0
// File: /workspace/github_c_makefile_star2_O1/stonezwr[P]SpiKL-IP/network.C
// Function: Network::ReadoutJudge(std::vector<std::pair<int, int>, std::allocator<std::pair<int, int>>>&, std::vector<std::pair<int, int>, std::allocator<std::pair<int, int>>>&, std::vector<std::pair<int, int>, std::allocator<std::pair<int, int>>>&)
void Network::ReadoutJudge(vector<pair<int, int> >& correct, vector<pair<int, int> >& wrong, vector<pair<int, int> >& even){
    pair<int, int> res = this->LSMJudge(); // +/- 1, true cls

    if(res.first == 1) correct.push_back(res);
    else if(res.first == -1) wrong.push_back(res);
    else if(res.first == 0) even.push_back(res);
    else{
        cout<<"In Network::ReadoutJudge(vector<pair<int, int> >&, vector<pair<int, int> >&, vector<pair<int, int> >&)\n"
            <<"Undefined return type: "<<res.first<<" returned by Network::LSMJudge()"
            <<endl;
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rcx, %r14
movq %rdx, %r15
movq %rsi, %rbx
callq 0xfedc
movq %rax, 0x8(%rsp)
cmpl $-0x1, %eax
je 0xf57a
testl %eax, %eax
je 0xf55a
cmpl $0x1, %eax
jne 0xf59a
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0xf630
movq 0x8(%rsp), %rax
movq %rax, (%rsi)
addq $0x8, 0x8(%rbx)
jmp 0xf63d
movq 0x8(%r14), %rsi
cmpq 0x10(%r14), %rsi
je 0xf61c
movq 0x8(%rsp), %rax
movq %rax, (%rsi)
addq $0x8, 0x8(%r14)
jmp 0xf63d
movq 0x8(%r15), %rsi
cmpq 0x10(%r15), %rsi
je 0xf626
movq 0x8(%rsp), %rax
movq %rax, (%rsi)
addq $0x8, 0x8(%r15)
jmp 0xf63d
movq 0x11a2f(%rip), %rbx     # 0x20fd0
leaq 0x95b8(%rip), %rsi      # 0x18b60
movl $0x67, %edx
movq %rbx, %rdi
callq 0x3340
leaq 0x960c(%rip), %rsi      # 0x18bc8
movl $0x17, %edx
movq %rbx, %rdi
callq 0x3340
movl 0x8(%rsp), %esi
movq %rbx, %rdi
callq 0x3560
movq %rax, %rbx
leaq 0x9601(%rip), %rsi      # 0x18be0
movl $0x20, %edx
movq %rax, %rdi
callq 0x3340
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x32b0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3040
movq %rax, %rdi
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
jmp 0x31e0
leaq 0x8(%rsp), %rdx
movq %r14, %rdi
jmp 0xf638
leaq 0x8(%rsp), %rdx
movq %r15, %rdi
jmp 0xf638
leaq 0x8(%rsp), %rdx
movq %rbx, %rdi
callq 0x1242e
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_c_makefile_star2_O1/stonezwr[P]SpiKL-IP/network.C
// Function: Network::LoadNextSpeechTestCV(networkmode_t)
int Network::LoadNextSpeechTestCV(networkmode_t networkmode){
    assert(_lsm_input_layer != NULL);
    assert(_lsm_reservoir_layer != NULL);
    assert(_lsm_output_layer != NULL);

    neuronmode_t neuronmode_input = NORMAL, neuronmode_reservoir = NORMAL, neuronmode_readout = NORMAL;
    // determine the neuron mode by the network mode:
    DetermineNetworkNeuronMode(networkmode, neuronmode_input, neuronmode_reservoir, neuronmode_readout);

    _cv_test_sp_iter++;
    assert(!_CVspeeches.empty());
    if(_cv_test_sp_iter != _CVspeeches[_fold_ind].end()){
        LoadSpeeches(*_cv_test_sp_iter, neuronmode_input, neuronmode_reservoir, neuronmode_readout, false);
        return (*_cv_test_sp_iter)->Index();
    }else{
        LSMNetworkRemoveSpeech();
        return -1;
    }
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movl %esi, 0xc(%rsp)
cmpq $0x0, 0x268(%rdi)
je 0xf718
movq %rdi, %rbx
cmpq $0x0, 0x270(%rdi)
je 0xf737
cmpq $0x0, 0x2a8(%rbx)
je 0xf756
movl $0x3, %eax
leaq 0x8(%rsp), %rdx
movl %eax, (%rdx)
leaq 0x4(%rsp), %rcx
movl %eax, (%rcx)
movq %rsp, %r8
movl %eax, (%r8)
leaq 0xc(%rsp), %rsi
callq 0xfc4e
movq 0x238(%rbx), %rcx
movq 0x258(%rbx), %rax
addq $0x8, %rax
movq %rax, 0x258(%rbx)
cmpq 0x240(%rbx), %rcx
je 0xf775
movslq 0x22c(%rbx), %rdx
leaq (%rdx,%rdx,2), %rdx
cmpq 0x8(%rcx,%rdx,8), %rax
je 0xf705
movq (%rax), %rsi
movl 0x8(%rsp), %edx
movl 0x4(%rsp), %ecx
movl (%rsp), %r8d
movq %rbx, %rdi
xorl %r9d, %r9d
callq 0xf964
movq 0x258(%rbx), %rax
movq (%rax), %rax
movl 0x84(%rax), %eax
jmp 0xf712
movq %rbx, %rdi
callq 0xfaba
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x10, %rsp
popq %rbx
retq
leaq 0x9184(%rip), %rdi      # 0x188a3
leaq 0x8c0c(%rip), %rsi      # 0x18332
leaq 0x9376(%rip), %rcx      # 0x18aa3
movl $0x291, %edx            # imm = 0x291
callq 0x31b0
leaq 0x919b(%rip), %rdi      # 0x188d9
leaq 0x8bed(%rip), %rsi      # 0x18332
leaq 0x9357(%rip), %rcx      # 0x18aa3
movl $0x292, %edx            # imm = 0x292
callq 0x31b0
leaq 0x9199(%rip), %rdi      # 0x188f6
leaq 0x8bce(%rip), %rsi      # 0x18332
leaq 0x9338(%rip), %rcx      # 0x18aa3
movl $0x293, %edx            # imm = 0x293
callq 0x31b0
leaq 0x9283(%rip), %rdi      # 0x189ff
leaq 0x8baf(%rip), %rsi      # 0x18332
leaq 0x9319(%rip), %rcx      # 0x18aa3
movl $0x29a, %edx            # imm = 0x29A
callq 0x31b0
// File: /workspace/github_c_makefile_star2_O1/stonezwr[P]SpiKL-IP/network.C
// Function: Network::LSMPushResults(std::vector<std::pair<int, int>, std::allocator<std::pair<int, int>>> const&, std::vector<std::pair<int, int>, std::allocator<std::pair<int, int>>> const&, std::vector<std::pair<int, int>, std::allocator<std::pair<int, int>>> const&, int)
void Network::LSMPushResults(const vector<pair<int, int> >& correct, const vector<pair<int, int> >& wrong, const vector<pair<int, int> >& even, int iter_n){
    assert(iter_n < _readout_correct.size());
    _readout_correct[iter_n] += correct.size();
    _readout_wrong[iter_n] += wrong.size();
    _readout_even[iter_n] += even.size();

    for(auto & p : correct){
        assert(p.second < _readout_correct_breakdown[iter_n].size());
        _readout_correct_breakdown[iter_n][p.second]++;
    }
}

//* log the test error into the corresponding vector:
//* test error defined: \sum_j 1/2*(o_j - y_j)^2, where o_j = spike_j /max_k(spike_k)
void Network::LogTestError(const vector<double>& each_sample_errors, int iter_n){
    assert(iter_n < _readout_test_error.size());
    double error_sum = 0;
    for(double e : each_sample_errors)  error_sum += e;
    _readout_test_error[iter_n] = error_sum;
}

//* merge the readout results from the network
void Network::MergeReadoutResults(vector<int>& r_correct, vector<int>& r_wrong, vector<int>& r_even, vector<vector<int> >& r_correct_bd){
    assert(!r_correct.empty() &&
            r_correct.size() == _readout_correct.size() &&
            r_wrong.size() == _readout_wrong.size() &&
            r_even.size() == _readout_even.size() &&
            _readout_correct.size() == _readout_wrong.size() &&
            _readout_correct.size() == _readout_correct_breakdown.size());

    for(size_t i = 0; i < r_correct.size(); ++i){
        r_correct[i] += _readout_correct[i];
        r_wrong[i] += _readout_wrong[i];
        r_even[i] += _readout_even[i];
        r_correct_bd[i] = r_correct_bd[i] + _readout_correct_breakdown[i];  
    }

}

// Assembly:
pushq %rax
movslq %r8d, %r8
movq 0x190(%rdi), %r9
movq 0x198(%rdi), %rax
subq %r9, %rax
sarq $0x2, %rax
cmpq %r8, %rax
jbe 0xf84d
movq (%rsi), %rax
movq 0x8(%rsi), %rsi
movq %rsi, %r10
subq %rax, %r10
shrq $0x3, %r10
addl %r10d, (%r9,%r8,4)
movq 0x8(%rdx), %r9
subq (%rdx), %r9
shrq $0x3, %r9
movq 0x1a8(%rdi), %rdx
addl %r9d, (%rdx,%r8,4)
movq 0x8(%rcx), %rdx
subq (%rcx), %rdx
shrq $0x3, %rdx
movq 0x1c0(%rdi), %rcx
addl %edx, (%rcx,%r8,4)
cmpq %rax, %rsi
je 0xf82c
movq 0x1d8(%rdi), %rdx
leaq (%r8,%r8,2), %rdi
movq (%rdx,%rdi,8), %rcx
movq 0x8(%rdx,%rdi,8), %rdx
subq %rcx, %rdx
sarq $0x2, %rdx
movslq 0x4(%rax), %rdi
cmpq %rdi, %rdx
jbe 0xf82e
incl (%rcx,%rdi,4)
addq $0x8, %rax
cmpq %rsi, %rax
jne 0xf817
popq %rax
retq
leaq 0x94db(%rip), %rdi      # 0x18d10
leaq 0x8af6(%rip), %rsi      # 0x18332
leaq 0x944b(%rip), %rcx      # 0x18c8e
movl $0x350, %edx            # imm = 0x350
callq 0x31b0
leaq 0x9419(%rip), %rdi      # 0x18c6d
leaq 0x8ad7(%rip), %rsi      # 0x18332
leaq 0x942c(%rip), %rcx      # 0x18c8e
movl $0x34a, %edx            # imm = 0x34A
callq 0x31b0
// File: /workspace/github_c_makefile_star2_O1/stonezwr[P]SpiKL-IP/network.C
// Function: Network::LoadSpeeches(Speech*, neuronmode_t, neuronmode_t, neuronmode_t, bool)
void Network::LoadSpeeches(Speech      * sp,
        neuronmode_t neuronmode_input,
        neuronmode_t neuronmode_reservoir,
        neuronmode_t neuronmode_readout,
        bool train
        )
{
    // assign the speech ptr here!
    assert(sp);
    _sp = sp;

    assert(_lsm_input_layer);
    _lsm_input_layer->LSMLoadSpeech(sp,&_lsm_input,neuronmode_input,INPUTCHANNEL);

    assert(_lsm_reservoir_layer);
    _lsm_reservoir_layer->LSMLoadSpeech(sp,&_lsm_reservoir,neuronmode_reservoir,RESERVOIRCHANNEL);
    
    // just set the neuron mode of the output neurons
    assert(_lsm_output_layer);
    _lsm_output_layer->LSMSetNeurons(neuronmode_readout);

    // if train the readout
    if(train == true){
        if(neuronmode_readout == NORMAL){ // original Yong's rule
            _lsm_output_layer->LSMSetTeacherSignal(sp->Class());
        }     
        else	  
			assert(0);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
testq %rsi, %rsi
je 0xfa1f
movq %rsi, %rbx
movq %rdi, %r14
movq %rsi, 0x260(%rdi)
movq 0x268(%rdi), %rdi
testq %rdi, %rdi
je 0xfa3e
movl %r9d, %r15d
movl %r8d, %ebp
movl %ecx, %r12d
movl %edx, %ecx
leaq 0x2b0(%r14), %rdx
movq %rbx, %rsi
xorl %r8d, %r8d
callq 0x9408
movq 0x270(%r14), %rdi
testq %rdi, %rdi
je 0xfa5d
leaq 0x2b4(%r14), %rdx
movq %rbx, %rsi
movl %r12d, %ecx
movl $0x1, %r8d
callq 0x9408
movq 0x2a8(%r14), %rdi
testq %rdi, %rdi
je 0xfa7c
movl %ebp, %esi
callq 0x9664
testb %r15b, %r15b
je 0xfa16
cmpl $0x3, %ebp
jne 0xfa9b
movq 0x2a8(%r14), %rdi
movl 0x80(%rbx), %esi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0xa2b8
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x91ff(%rip), %rdi      # 0x18c25
leaq 0x8905(%rip), %rsi      # 0x18332
leaq 0x8d70(%rip), %rcx      # 0x187a4
movl $0x1bc, %edx            # imm = 0x1BC
callq 0x31b0
leaq 0x8db4(%rip), %rdi      # 0x187f9
leaq 0x88e6(%rip), %rsi      # 0x18332
leaq 0x8d51(%rip), %rcx      # 0x187a4
movl $0x1bf, %edx            # imm = 0x1BF
callq 0x31b0
leaq 0x8da6(%rip), %rdi      # 0x1880a
leaq 0x88c7(%rip), %rsi      # 0x18332
leaq 0x8d32(%rip), %rcx      # 0x187a4
movl $0x1c2, %edx            # imm = 0x1C2
callq 0x31b0
leaq 0x8db0(%rip), %rdi      # 0x18833
leaq 0x88a8(%rip), %rsi      # 0x18332
leaq 0x8d13(%rip), %rcx      # 0x187a4
movl $0x1c6, %edx            # imm = 0x1C6
callq 0x31b0
leaq 0x888e(%rip), %rdi      # 0x18330
leaq 0x8889(%rip), %rsi      # 0x18332
leaq 0x8cf4(%rip), %rcx      # 0x187a4
movl $0x1cf, %edx            # imm = 0x1CF
callq 0x31b0
// File: /workspace/github_c_makefile_star2_O1/stonezwr[P]SpiKL-IP/network.C
// Function: Network::LSMNetworkRemoveSpeech()
void Network::LSMNetworkRemoveSpeech(){
    _sp = NULL;
    assert(_lsm_input_layer || _lsm_output_layer);

    if(_lsm_input_layer)
        _lsm_input_layer->LSMRemoveSpeech();
    _lsm_input_layer = NULL;

    if(_lsm_output_layer)
        _lsm_output_layer->LSMRemoveSpeech();
    _lsm_output_layer = NULL;

    if(_lsm_reservoir_layer == NULL)
        _lsm_reservoir_layer->LSMRemoveSpeech();

    _lsm_reservoir_layer = NULL;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq $0x0, 0x260(%rdi)
movq 0x268(%rdi), %rdi
movq 0x2a8(%rbx), %rax
orq %rdi, %rax
je 0xfb2b
testq %rdi, %rdi
je 0xfae6
callq 0xa21e
movq $0x0, 0x268(%rbx)
movq 0x2a8(%rbx), %rdi
testq %rdi, %rdi
je 0xfb02
callq 0xa21e
movq $0x0, 0x2a8(%rbx)
cmpq $0x0, 0x270(%rbx)
jne 0xfb1e
xorl %edi, %edi
callq 0xa21e
movq $0x0, 0x270(%rbx)
popq %rbx
retq
leaq 0x8ced(%rip), %rdi      # 0x1881f
leaq 0x87f9(%rip), %rsi      # 0x18332
leaq 0x8d05(%rip), %rcx      # 0x18845
movl $0x1d7, %edx            # imm = 0x1D7
callq 0x31b0
// File: /workspace/github_c_makefile_star2_O1/stonezwr[P]SpiKL-IP/network.C
// Function: Network::LSMLoadLayers()
void Network::LSMLoadLayers(){
    assert(_lsm_input_layer == NULL);
    _lsm_input_layer = SearchForNeuronGroup("input");
    assert(_lsm_input_layer != NULL);

    assert(_lsm_reservoir_layer == NULL);
    _lsm_reservoir_layer = SearchForNeuronGroup("reservoir");
    assert(_lsm_reservoir_layer != NULL);

    _lsm_output_layer = SearchForNeuronGroup("output");
    assert(_lsm_output_layer != NULL);
}

// Assembly:
pushq %rbx
cmpq $0x0, 0x268(%rdi)
jne 0xfbb2
movq %rdi, %rbx
leaq 0x7765(%rip), %rsi      # 0x172c4
callq 0xdf10
movq %rax, 0x268(%rbx)
testq %rax, %rax
je 0xfbd1
cmpq $0x0, 0x270(%rbx)
jne 0xfbf0
leaq 0x7778(%rip), %rsi      # 0x172f9
movq %rbx, %rdi
callq 0xdf10
movq %rax, 0x270(%rbx)
testq %rax, %rax
je 0xfc0f
leaq 0x884e(%rip), %rsi      # 0x183ea
movq %rbx, %rdi
callq 0xdf10
movq %rax, 0x2a8(%rbx)
testq %rax, %rax
je 0xfc2e
popq %rbx
retq
leaq 0x8cb3(%rip), %rdi      # 0x1886c
leaq 0x8772(%rip), %rsi      # 0x18332
leaq 0x8cbe(%rip), %rcx      # 0x18885
movl $0x1e9, %edx            # imm = 0x1E9
callq 0x31b0
leaq 0x8ccb(%rip), %rdi      # 0x188a3
leaq 0x8753(%rip), %rsi      # 0x18332
leaq 0x8c9f(%rip), %rcx      # 0x18885
movl $0x1eb, %edx            # imm = 0x1EB
callq 0x31b0
leaq 0x8cc5(%rip), %rdi      # 0x188bc
leaq 0x8734(%rip), %rsi      # 0x18332
leaq 0x8c80(%rip), %rcx      # 0x18885
movl $0x1ed, %edx            # imm = 0x1ED
callq 0x31b0
leaq 0x8cc3(%rip), %rdi      # 0x188d9
leaq 0x8715(%rip), %rsi      # 0x18332
leaq 0x8c61(%rip), %rcx      # 0x18885
movl $0x1ef, %edx            # imm = 0x1EF
callq 0x31b0
leaq 0x8cc1(%rip), %rdi      # 0x188f6
leaq 0x86f6(%rip), %rsi      # 0x18332
leaq 0x8c42(%rip), %rcx      # 0x18885
movl $0x1f2, %edx            # imm = 0x1F2
callq 0x31b0
nop
// File: /workspace/github_c_makefile_star2_O1/stonezwr[P]SpiKL-IP/network.C
// Function: Network::DetermineNetworkNeuronMode(networkmode_t const&, neuronmode_t&, neuronmode_t&, neuronmode_t&)
void Network::DetermineNetworkNeuronMode(const networkmode_t & networkmode, neuronmode_t & neuronmode_input, neuronmode_t & neuronmode_reservoir, neuronmode_t & neuronmode_readout){
    if(networkmode == TRANSIENTSTATE){
        neuronmode_input = READCHANNEL;
        neuronmode_reservoir = WRITECHANNEL;
        neuronmode_readout = DEACTIVATED;
    }else if(networkmode == READOUT){
        neuronmode_input = DEACTIVATED;
        neuronmode_reservoir = READCHANNEL;
        neuronmode_readout = NORMAL;
    }else{
        cout<<"Unrecognized network mode!"<<endl;
        exit(EXIT_FAILURE);
    }

}

// Assembly:
movl (%rsi), %eax
testl %eax, %eax
je 0xfc67
cmpl $0x1, %eax
jne 0xfc79
movl $0x3, %eax
movl $0x1, %esi
xorl %edi, %edi
jmp 0xfc71
movl $0x2, %esi
movl $0x1, %edi
movl %edi, (%rdx)
movl %esi, (%rcx)
movl %eax, (%r8)
retq
pushq %rax
movq 0x1134f(%rip), %rdi     # 0x20fd0
leaq 0x8c88(%rip), %rsi      # 0x18910
callq 0x32c0
movq %rax, %rdi
callq 0x3160
movl $0x1, %edi
callq 0x3370
nop
// File: /workspace/github_c_makefile_star2_O1/stonezwr[P]SpiKL-IP/network.C
// Function: Network::PrintSpikeCount(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void Network::PrintSpikeCount(string layer){
    NeuronGroup * ng = SearchForNeuronGroup(layer.c_str());
    assert(ng);
#ifdef CV
    assert(*_cv_test_sp_iter);
    ng->PrintSpikeCount((*_cv_test_sp_iter)->Class());
#else
    assert(*_sp_iter);
    ng->PrintSpikeCount((*_sp_iter)->Class());
#endif

}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq (%rsi), %rsi
callq 0xdf10
testq %rax, %rax
je 0xfe9d
movq 0x220(%rbx), %rcx
movq (%rcx), %rcx
testq %rcx, %rcx
je 0xfebc
movl 0x80(%rcx), %esi
movq %rax, %rdi
popq %rbx
jmp 0xa104
leaq 0x985d(%rip), %rdi      # 0x19701
leaq 0x8487(%rip), %rsi      # 0x18332
leaq 0x8c7e(%rip), %rcx      # 0x18b30
movl $0x2f7, %edx            # imm = 0x2F7
callq 0x31b0
leaq 0x8c93(%rip), %rdi      # 0x18b56
leaq 0x8468(%rip), %rsi      # 0x18332
leaq 0x8c5f(%rip), %rcx      # 0x18b30
movl $0x2fc, %edx            # imm = 0x2FC
callq 0x31b0
nop
// File: /workspace/github_c_makefile_star2_O1/stonezwr[P]SpiKL-IP/network.C
// Function: Network::DetermineSynType(char const*, synapsetype_t&, char const*)
void Network::DetermineSynType(const char * syn_type, synapsetype_t & ret_syn_type, const char * func_name){
    if(strcmp(syn_type, "reservoir") == 0){
        // Write reservoir syns into the file
        ret_syn_type = RESERVOIR_SYN;
    }else if(strcmp(syn_type, "readout") == 0){
        ret_syn_type = READOUT_SYN;
    }else if(strcmp(syn_type, "input") == 0){
        ret_syn_type = INPUT_SYN;
    }else{
        cout<<"In Network::"<<func_name<<", undefined synapse type: "<<syn_type<<endl;
        exit(EXIT_FAILURE);
    } 
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rcx, %r14
movq %rdx, %r15
movq %rsi, %rbx
leaq 0x6bba(%rip), %rsi      # 0x172f9
movq %rbx, %rdi
callq 0x33f0
testl %eax, %eax
je 0x107c0
leaq 0x917a(%rip), %rsi      # 0x198cc
movq %rbx, %rdi
callq 0x33f0
testl %eax, %eax
je 0x107c4
leaq 0x6b5f(%rip), %rsi      # 0x172c4
movq %rbx, %rdi
callq 0x33f0
movl $0x1, %ecx
testl %eax, %eax
je 0x107c9
movq 0x10853(%rip), %rdi     # 0x20fd0
leaq 0x8806(%rip), %rsi      # 0x18f8a
callq 0x32c0
movq %rax, %rdi
movq %r14, %rsi
callq 0x32c0
leaq 0x87fc(%rip), %rsi      # 0x18f97
movq %rax, %rdi
callq 0x32c0
movq %rax, %rdi
movq %rbx, %rsi
callq 0x32c0
movq %rax, %rdi
callq 0x3160
movl $0x1, %edi
callq 0x3370
xorl %ecx, %ecx
jmp 0x107c9
movl $0x2, %ecx
movl %ecx, (%r15)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/stonezwr[P]SpiKL-IP/network.C
// Function: Network::NormalizeContinuousWeights(char const*)
void Network::NormalizeContinuousWeights(const char * syn_type){
    synapsetype_t  tar_syn_type = INVALID;
    DetermineSynType(syn_type, tar_syn_type, "NormalizeContinuousWeights()");
    assert(tar_syn_type != INVALID);
    vector<Synapse*> tmp;

    vector<Synapse*> & synapses = tar_syn_type == RESERVOIR_SYN ? _rsynapses : 
        (tar_syn_type == READOUT_SYN ? _rosynapses : tmp);
    assert(!synapses.empty()); 

    // right now the function should be run for reservoir synapses!
    double g_sum = 0.0;
    for(size_t i = 0; i < synapses.size(); ++i){
        assert(synapses[i]);
        double w = synapses[i]->Weight();
        g_sum += w*w;
    }

    // normalize the weight:
    assert(g_sum > 0);
    g_sum = sqrt(g_sum);
    for(size_t i = 0; i < synapses.size(); ++i){
        // compute the normalized weight:
        double new_w = synapses[i]->Weight()/g_sum;
        // set the new weight:
        synapses[i]->Weight(new_w);
    }
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
leaq 0xc(%rsp), %r14
movl $0x3, (%r14)
leaq 0x87c3(%rip), %rcx      # 0x18fb2
movq %r14, %rdx
callq 0x1072a
movl (%r14), %eax
cmpl $0x3, %eax
je 0x1091a
xorl %ecx, %ecx
movq %rsp, %rdx
movq %rcx, (%rdx)
leaq 0x10(%rsp), %rsi
movq %rcx, (%rsi)
leaq 0x118(%rbx), %rcx
leaq 0x130(%rbx), %r14
leaq 0x120(%rbx), %rdi
addq $0x138, %rbx            # imm = 0x138
cmpl $0x2, %eax
cmovneq %rdx, %r14
cmovneq %rsi, %rbx
testl %eax, %eax
cmoveq %rcx, %r14
movq (%r14), %rax
cmoveq %rdi, %rbx
movq (%rbx), %rcx
cmpq %rcx, %rax
je 0x10939
subq %rax, %rcx
sarq $0x3, %rcx
cmpq $0x1, %rcx
adcq $0x0, %rcx
xorpd %xmm0, %xmm0
xorl %edx, %edx
movq (%rax,%rdx,8), %rsi
testq %rsi, %rsi
je 0x108fb
movsd 0x38(%rsi), %xmm1
mulsd %xmm1, %xmm1
addsd %xmm1, %xmm0
incq %rdx
cmpq %rdx, %rcx
jne 0x10868
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x10958
jb 0x108a0
sqrtsd %xmm0, %xmm0
jmp 0x108a5
callq 0x3220
movq (%rbx), %rax
movq (%r14), %rcx
subq %rcx, %rax
je 0x108d8
sarq $0x3, %rax
cmpq $0x1, %rax
adcq $0x0, %rax
xorl %edx, %edx
movq (%rcx,%rdx,8), %rsi
movsd 0x38(%rsi), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, 0x38(%rsi)
incq %rdx
cmpq %rdx, %rax
jne 0x108be
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x108f3
movq %rdi, %rsi
negq %rsi
addq $0x18, %rsp
popq %rbx
popq %r14
jmp 0x32f0
addq $0x18, %rsp
popq %rbx
popq %r14
retq
leaq 0x872e(%rip), %rdi      # 0x19030
leaq 0x7a29(%rip), %rsi      # 0x18332
leaq 0x86d7(%rip), %rcx      # 0x18fe7
movl $0x3aa, %edx            # imm = 0x3AA
callq 0x31b0
leaq 0x86ae(%rip), %rdi      # 0x18fcf
leaq 0x7a0a(%rip), %rsi      # 0x18332
leaq 0x86b8(%rip), %rcx      # 0x18fe7
movl $0x3a0, %edx            # imm = 0x3A0
callq 0x31b0
leaq 0x86de(%rip), %rdi      # 0x1901e
leaq 0x79eb(%rip), %rsi      # 0x18332
leaq 0x8699(%rip), %rcx      # 0x18fe7
movl $0x3a5, %edx            # imm = 0x3A5
callq 0x31b0
leaq 0x86dd(%rip), %rdi      # 0x1903c
leaq 0x79cc(%rip), %rsi      # 0x18332
leaq 0x867a(%rip), %rcx      # 0x18fe7
movl $0x3b0, %edx            # imm = 0x3B0
callq 0x31b0
nop
// File: /workspace/github_c_makefile_star2_O1/stonezwr[P]SpiKL-IP/network.C
// Function: Network::RemoveZeroWeights(char const*)
void Network::RemoveZeroWeights(const char * type){
    synapsetype_t  syn_type = INVALID;
    DetermineSynType(type, syn_type, "RemoveZeroWeights()");
    assert(syn_type != INVALID);

    if(syn_type == RESERVOIR_SYN){
        NeuronGroup * reservoir = SearchForNeuronGroup("reservoir");
        reservoir->RemoveZeroSyns(syn_type);
    }
    else if(syn_type == READOUT_SYN){
        NeuronGroup * output = SearchForNeuronGroup("output");
        if(!output){
            cout<<"In Network::RemoveZeroWeights(), no 'output' layer is found!!"<<endl;
            assert(output);
        }
        output->RemoveZeroSyns(syn_type);
    }
    else{
        assert(0); // your code shoule never go here.
    }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
leaq 0x4(%rsp), %rbx
movl $0x3, (%rbx)
leaq 0x86b5(%rip), %rcx      # 0x19046
movq %rbx, %rdx
callq 0x1072a
movl (%rbx), %ebx
testl %ebx, %ebx
je 0x109f2
cmpl $0x2, %ebx
jne 0x10a12
leaq 0x7a3f(%rip), %rsi      # 0x183ea
movq %r14, %rdi
callq 0xdf10
testq %rax, %rax
jne 0x10a01
movq 0x10611(%rip), %rdi     # 0x20fd0
leaq 0x86c2(%rip), %rsi      # 0x19088
callq 0x32c0
movq %rax, %rdi
callq 0x3160
leaq 0x7a10(%rip), %rdi      # 0x183ea
leaq 0x7951(%rip), %rsi      # 0x18332
leaq 0x8672(%rip), %rcx      # 0x1905a
movl $0x3c8, %edx            # imm = 0x3C8
callq 0x31b0
leaq 0x6900(%rip), %rsi      # 0x172f9
movq %r14, %rdi
callq 0xdf10
movq %rax, %rdi
movl %ebx, %esi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0xa4c4
cmpl $0x3, %ebx
jne 0x10a36
leaq 0x88fc(%rip), %rdi      # 0x1931a
leaq 0x790d(%rip), %rsi      # 0x18332
leaq 0x862e(%rip), %rcx      # 0x1905a
movl $0x3be, %edx            # imm = 0x3BE
callq 0x31b0
leaq 0x78f3(%rip), %rdi      # 0x18330
leaq 0x78ee(%rip), %rsi      # 0x18332
leaq 0x860f(%rip), %rcx      # 0x1905a
movl $0x3cd, %edx            # imm = 0x3CD
callq 0x31b0
nop
// File: /workspace/github_c_makefile_star2_O1/stonezwr[P]SpiKL-IP/network.C
// Function: Network::WriteSynWeightsToFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, char*)
void Network::WriteSynWeightsToFile(const string& pre_g, const string& post_g, char * filename){
    NeuronGroup * pre = SearchForNeuronGroup(pre_g.c_str());
    NeuronGroup * post = SearchForNeuronGroup(post_g.c_str());
    if(pre == NULL){
        cout<<"Warning::Cannot find neuron group named: "<<pre_g
            <<" for writing the weights"<<endl;
        return;
    }
    if(post == NULL){
        cout<<"Warning::Cannot find neuron group named: "<<post_g
            <<" for writing the weights"<<endl;
        return;
    }
    ofstream f_out(filename);
    if(!f_out.is_open()){
        cout<<"WriteSynWeightsToFile(), cannot open the file : "<<filename<<endl;
        exit(EXIT_FAILURE);
    }

    int index = 0;
    pre->WriteSynWeightsToFile(f_out, index, post_g);
    f_out.close();
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x210, %rsp            # imm = 0x210
movq %rcx, %r14
movq %rdx, %rbx
movq %rsi, %r12
movq %rdi, %r13
movq (%rsi), %rsi
callq 0xdf10
movq %rax, %r15
movq (%rbx), %rsi
movq %r13, %rdi
callq 0xdf10
testq %r15, %r15
je 0x10e0d
testq %rax, %rax
je 0x10e36
leaq 0x10(%rsp), %rdi
movq %r14, %rsi
movl $0x10, %edx
callq 0x3320
leaq 0x80(%rsp), %rdi
callq 0x30b0
testb %al, %al
je 0x10eae
leaq 0xc(%rsp), %rdx
movl $0x0, (%rdx)
leaq 0x10(%rsp), %rsi
movq %r15, %rdi
movq %rbx, %rcx
callq 0x9ba4
leaq 0x10(%rsp), %rdi
callq 0x3410
movq 0x101f7(%rip), %rax     # 0x20fc8
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq 0x18(%rsp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, 0x10(%rsp,%rcx)
callq 0x3240
leaq 0x108(%rsp), %rdi
callq 0x3120
addq $0x210, %rsp            # imm = 0x210
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq 0x101bc(%rip), %rbx     # 0x20fd0
leaq 0x8357(%rip), %rsi      # 0x19172
movl $0x29, %edx
movq %rbx, %rdi
callq 0x3340
movq (%r12), %rsi
movq 0x8(%r12), %rdx
movq %rbx, %rdi
jmp 0x10e5b
movq 0x10193(%rip), %r14     # 0x20fd0
leaq 0x832e(%rip), %rsi      # 0x19172
movl $0x29, %edx
movq %r14, %rdi
callq 0x3340
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq %r14, %rdi
callq 0x3340
movq %rax, %rbx
leaq 0x8332(%rip), %rsi      # 0x1919c
movl $0x18, %edx
movq %rax, %rdi
callq 0x3340
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x32b0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3040
movq %rax, %rdi
addq $0x210, %rsp            # imm = 0x210
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x31e0
movq 0x1011b(%rip), %rdi     # 0x20fd0
leaq 0x82f9(%rip), %rsi      # 0x191b5
movl $0x30, %edx
callq 0x3340
movq 0x10103(%rip), %rdi     # 0x20fd0
movq %r14, %rsi
callq 0x32c0
movq %rax, %rdi
callq 0x3160
movl $0x1, %edi
callq 0x3370
jmp 0x10ee9
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x3450
movq %rbx, %rdi
callq 0x3570
// File: /workspace/github_c_makefile_star2_O1/stonezwr[P]SpiKL-IP/./util.h
// Function: std::vector<int, std::allocator<int>> operator+<int>(std::vector<int, std::allocator<int>> const&, std::vector<int, std::allocator<int>> const&)
std::vector<T> operator+(const std::vector<T>& a, const std::vector<T>& b)
{
    if(a.empty())   return b;
    if(b.empty())   return a;
    assert(a.size() == b.size());
    std::vector<T> res;
    res.reserve(a.size());
    std::transform(a.begin(), a.end(), b.begin(), std::back_inserter(res), std::plus<T>());
    return res;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
movq (%rsi), %rax
movq 0x8(%rsi), %rsi
cmpq %rsi, %rax
je 0x11841
movq (%r14), %rcx
movq 0x8(%r14), %rdx
cmpq %rdx, %rcx
je 0x1183e
subq %rax, %rsi
subq %rcx, %rdx
cmpq %rdx, %rsi
jne 0x11855
sarq $0x2, %rsi
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
movq $0x0, 0x10(%rbx)
movq %rbx, %rdi
callq 0x1262c
movq (%r15), %rdi
movq 0x8(%r15), %rsi
movq (%r14), %rdx
movq %rbx, %rcx
callq 0x126c1
jmp 0x1184c
movq %r15, %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x11a9c
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq
leaq 0x7c37(%rip), %rdi      # 0x19493
leaq 0x7c45(%rip), %rsi      # 0x194a8
leaq 0x7c47(%rip), %rcx      # 0x194b1
movl $0x45, %edx
callq 0x31b0
movq %rax, %r14
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x1188b
movq 0x10(%rbx), %rsi
subq %rdi, %rsi
callq 0x32f0
movq %r14, %rdi
callq 0x3570
nop