// File: /workspace/github_c_makefile_star2_O0/stonezwr[P]SpiKL-IP/network.C
// Function: Network::LoadSynWeightsFromFile(char const*, char*)
void Network::LoadSynWeightsFromFile(const char * syn_type, char * filename){
    ifstream f_in(filename);
    if(!f_in.is_open()){
        cout<<"In Network::LoadSynWeightsFromFile(), cannot open the file: "<<filename<<endl;
        assert(0);
    }

    synapsetype_t read_syn_type = INVALID;
    DetermineSynType(syn_type, read_syn_type, "LoadSynWeightsFromFile()");
    assert(read_syn_type != INVALID);
    vector<Synapse*> tmp;

    const vector<Synapse*> & synapses = 
        read_syn_type == RESERVOIR_SYN ? _rsynapses : 
        read_syn_type == READOUT_SYN ? _rosynapses :
        read_syn_type == INPUT_SYN ? _isynapses : tmp;

    assert(!synapses.empty());  
    // load the synaptic weights from file:
    // the synaptic weight is stored in the file in the same order as the corresponding synapses store in the vector
    int index;
    string pre;
    string post;
    
    double weight;
    while(f_in>>index>>pre>>post>>weight){//>>pre_ext>>post_ext){
        if(index < 0 || index >= synapses.size()){
            cout<<"In Network::LoadSynWeightsFromFile(), the index of the synapse you read : "<<index<<" is out of bound of the container stores the synapses!!"<<endl;
            exit(EXIT_FAILURE);
        }

        assert(strcmp(pre.c_str(), synapses[index]->PreNeuron()->Name()) == 0);
        assert(strcmp(post.c_str(), synapses[index]->PostNeuron()->Name()) == 0);
        synapses[index]->Weight(weight);
    }

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x360, %rsp            # imm = 0x360
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x2b8(%rbp)
movq -0x18(%rbp), %rsi
leaq -0x220(%rbp), %rdi
movq %rdi, -0x2b0(%rbp)
movl $0x8, %edx
callq 0x4750
movq -0x2b0(%rbp), %rdi
callq 0x4620
movb %al, -0x2a1(%rbp)
jmp 0x230c2
movb -0x2a1(%rbp), %al
testb $0x1, %al
jne 0x23152
jmp 0x230d2
movq 0x29eef(%rip), %rdi     # 0x4cfc8
leaq 0x130ee(%rip), %rsi     # 0x361ce
callq 0x4360
movq %rax, -0x2c0(%rbp)
jmp 0x230ee
movq -0x2c0(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x4360
movq %rax, -0x2c8(%rbp)
jmp 0x23107
movq -0x2c8(%rbp), %rdi
movq 0x29ea3(%rip), %rsi     # 0x4cfb8
callq 0x43b0
jmp 0x2311c
leaq 0x121f5(%rip), %rdi     # 0x35318
leaq 0x121f0(%rip), %rsi     # 0x3531a
movl $0x41e, %edx            # imm = 0x41E
leaq 0x13173(%rip), %rcx     # 0x362a9
callq 0x4210
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x228(%rbp)
movl %eax, -0x22c(%rbp)
jmp 0x23583
movq -0x2b8(%rbp), %rdi
movl $0x3, -0x230(%rbp)
movq -0x10(%rbp), %rsi
leaq 0x13176(%rip), %rcx     # 0x362e4
leaq -0x230(%rbp), %rdx
callq 0x22210
jmp 0x2317c
cmpl $0x3, -0x230(%rbp)
je 0x23187
jmp 0x231a6
leaq 0x1316f(%rip), %rdi     # 0x362fd
leaq 0x12185(%rip), %rsi     # 0x3531a
movl $0x423, %edx            # imm = 0x423
leaq 0x13108(%rip), %rcx     # 0x362a9
callq 0x4210
leaq -0x248(%rbp), %rdi
callq 0x11f50
cmpl $0x0, -0x230(%rbp)
jne 0x231d1
movq -0x2b8(%rbp), %rax
addq $0x118, %rax            # imm = 0x118
movq %rax, -0x2d0(%rbp)
jmp 0x2323b
cmpl $0x2, -0x230(%rbp)
jne 0x231f0
movq -0x2b8(%rbp), %rax
addq $0x130, %rax            # imm = 0x130
movq %rax, -0x2d8(%rbp)
jmp 0x2322d
cmpl $0x1, -0x230(%rbp)
jne 0x2320f
movq -0x2b8(%rbp), %rax
addq $0x148, %rax            # imm = 0x148
movq %rax, -0x2e0(%rbp)
jmp 0x2321f
leaq -0x248(%rbp), %rax
movq %rax, -0x2e0(%rbp)
jmp 0x2321f
movq -0x2e0(%rbp), %rax
movq %rax, -0x2d8(%rbp)
movq -0x2d8(%rbp), %rax
movq %rax, -0x2d0(%rbp)
movq -0x2d0(%rbp), %rax
movq %rax, -0x250(%rbp)
movq -0x250(%rbp), %rdi
callq 0x12ae0
xorb $-0x1, %al
testb $0x1, %al
jne 0x2325d
jmp 0x2325f
jmp 0x2327e
leaq 0x12da0(%rip), %rdi     # 0x36006
leaq 0x120ad(%rip), %rsi     # 0x3531a
movl $0x42b, %edx            # imm = 0x42B
leaq 0x13030(%rip), %rcx     # 0x362a9
callq 0x4210
leaq -0x278(%rbp), %rdi
callq 0x4510
leaq -0x298(%rbp), %rdi
callq 0x4510
leaq -0x220(%rbp), %rdi
leaq -0x254(%rbp), %rsi
callq 0x41f0
movq %rax, -0x2e8(%rbp)
jmp 0x232b2
movq -0x2e8(%rbp), %rdi
leaq -0x278(%rbp), %rsi
callq 0x44c0
movq %rax, -0x2f0(%rbp)
jmp 0x232ce
movq -0x2f0(%rbp), %rdi
leaq -0x298(%rbp), %rsi
callq 0x44c0
movq %rax, -0x2f8(%rbp)
jmp 0x232ea
movq -0x2f8(%rbp), %rdi
leaq -0x2a0(%rbp), %rsi
callq 0x42b0
movq %rax, -0x300(%rbp)
jmp 0x23306
movq -0x300(%rbp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x44a0
movb %al, -0x301(%rbp)
jmp 0x23324
movb -0x301(%rbp), %al
testb $0x1, %al
jne 0x23333
jmp 0x2354a
cmpl $0x0, -0x254(%rbp)
jl 0x23369
movslq -0x254(%rbp), %rax
movq %rax, -0x310(%rbp)
movq -0x250(%rbp), %rdi
callq 0x12b20
movq %rax, %rcx
movq -0x310(%rbp), %rax
cmpq %rcx, %rax
jb 0x23416
movq 0x29c58(%rip), %rdi     # 0x4cfc8
leaq 0x12f9f(%rip), %rsi     # 0x36316
callq 0x4360
movq %rax, -0x318(%rbp)
jmp 0x23385
movq -0x318(%rbp), %rdi
movl -0x254(%rbp), %esi
callq 0x46c0
movq %rax, -0x320(%rbp)
jmp 0x233a0
movq -0x320(%rbp), %rdi
leaq 0x12fb3(%rip), %rsi     # 0x36361
callq 0x4360
movq %rax, -0x328(%rbp)
jmp 0x233bc
movq -0x328(%rbp), %rdi
movq 0x29bee(%rip), %rsi     # 0x4cfb8
callq 0x43b0
jmp 0x233d1
movl $0x1, %edi
callq 0x4440
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x228(%rbp)
movl %eax, -0x22c(%rbp)
leaq -0x298(%rbp), %rdi
callq 0x4200
leaq -0x278(%rbp), %rdi
callq 0x4200
leaq -0x248(%rbp), %rdi
callq 0x11fb0
jmp 0x23583
leaq -0x278(%rbp), %rdi
callq 0x4160
movq %rax, -0x338(%rbp)
movq -0x250(%rbp), %rdi
movslq -0x254(%rbp), %rsi
callq 0x24ae0
movq (%rax), %rdi
callq 0x1c140
movq %rax, -0x330(%rbp)
jmp 0x2344d
movq -0x330(%rbp), %rdi
callq 0xbea0
movq %rax, -0x340(%rbp)
jmp 0x23462
movq -0x340(%rbp), %rsi
movq -0x338(%rbp), %rdi
callq 0x4520
cmpl $0x0, %eax
jne 0x2347c
jmp 0x2349b
leaq 0x12f16(%rip), %rdi     # 0x36399
leaq 0x11e90(%rip), %rsi     # 0x3531a
movl $0x439, %edx            # imm = 0x439
leaq 0x12e13(%rip), %rcx     # 0x362a9
callq 0x4210
leaq -0x298(%rbp), %rdi
callq 0x4160
movq %rax, -0x350(%rbp)
movq -0x250(%rbp), %rdi
movslq -0x254(%rbp), %rsi
callq 0x24ae0
movq (%rax), %rdi
callq 0x1c160
movq %rax, -0x348(%rbp)
jmp 0x234d2
movq -0x348(%rbp), %rdi
callq 0xbea0
movq %rax, -0x358(%rbp)
jmp 0x234e7
movq -0x358(%rbp), %rsi
movq -0x350(%rbp), %rdi
callq 0x4520
cmpl $0x0, %eax
jne 0x23501
jmp 0x23520
leaq 0x12ed0(%rip), %rdi     # 0x363d8
leaq 0x11e0b(%rip), %rsi     # 0x3531a
movl $0x43a, %edx            # imm = 0x43A
leaq 0x12d8e(%rip), %rcx     # 0x362a9
callq 0x4210
movq -0x250(%rbp), %rdi
movslq -0x254(%rbp), %rsi
callq 0x24ae0
movq (%rax), %rdi
movsd -0x2a0(%rbp), %xmm0
callq 0x24ac0
jmp 0x23545
jmp 0x23296
leaq -0x298(%rbp), %rdi
callq 0x4200
leaq -0x278(%rbp), %rdi
callq 0x4200
leaq -0x248(%rbp), %rdi
callq 0x11fb0
leaq -0x220(%rbp), %rdi
callq 0x40f0
addq $0x360, %rsp            # imm = 0x360
popq %rbp
retq
leaq -0x220(%rbp), %rdi
callq 0x40f0
movq -0x228(%rbp), %rdi
callq 0x46d0
nopl (%rax,%rax)