// File: /workspace/github_c_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x278, %rsp            # imm = 0x278
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x70(%rsp), %rdi
movq %rdx, %rsi
movl $0x8, %edx
callq 0x35d0
leaq 0xe8(%rsp), %rdi
callq 0x30b0
testb %al, %al
je 0x1140d
leaq 0xc(%rsp), %rdx
movl $0x3, (%rdx)
leaq 0x8159(%rip), %rcx      # 0x192fc
movq %r15, %rsi
callq 0x1072a
movl 0xc(%rsp), %eax
cmpl $0x3, %eax
je 0x1145b
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
cmpl $0x2, %eax
je 0x111db
testl %eax, %eax
jne 0x111e4
addq $0x118, %rbx            # imm = 0x118
jmp 0x111f7
addq $0x130, %rbx            # imm = 0x130
jmp 0x111f7
addq $0x148, %rbx            # imm = 0x148
cmpl $0x1, %eax
leaq 0x10(%rsp), %rax
cmovneq %rax, %rbx
movq (%rbx), %rax
cmpq 0x8(%rbx), %rax
je 0x1147a
leaq 0x58(%rsp), %rcx
movq %rcx, -0x10(%rcx)
xorl %eax, %eax
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq 0x38(%rsp), %rcx
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movb %al, (%rcx)
leaq 0x8(%rsp), %r15
leaq 0x48(%rsp), %r12
leaq 0x28(%rsp), %r13
leaq 0x68(%rsp), %rbp
leaq 0x70(%rsp), %rdi
movq %r15, %rsi
callq 0x31a0
movq %rax, %rdi
movq %r12, %rsi
callq 0x33c0
movq %rax, %rdi
movq %r13, %rsi
callq 0x33c0
movq %rax, %rdi
movq %rbp, %rsi
callq 0x31c0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x11313
movslq 0x8(%rsp), %rax
testq %rax, %rax
js 0x1137e
movq (%rbx), %rcx
movq 0x8(%rbx), %rdx
subq %rcx, %rdx
sarq $0x3, %rdx
cmpq %rax, %rdx
jbe 0x1137e
movq 0x48(%rsp), %r14
movq (%rcx,%rax,8), %rdi
callq 0xc3de
movq %rax, %rdi
callq 0x6f9c
movq %r14, %rdi
movq %rax, %rsi
callq 0x33f0
testl %eax, %eax
jne 0x113ee
movq 0x28(%rsp), %r14
movslq 0x8(%rsp), %rax
movq (%rbx), %rcx
movq (%rcx,%rax,8), %rdi
callq 0xc3e2
movq %rax, %rdi
callq 0x6f9c
movq %r14, %rdi
movq %rax, %rsi
callq 0x33f0
testl %eax, %eax
jne 0x113cf
movslq 0x8(%rsp), %rax
movq (%rbx), %rcx
movq (%rcx,%rax,8), %rax
movsd 0x68(%rsp), %xmm0
movsd %xmm0, 0x38(%rax)
jmp 0x11238
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x1132f
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x32f0
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x1134b
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x32f0
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x11362
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x32f0
leaq 0x70(%rsp), %rdi
callq 0x30d0
addq $0x278, %rsp            # imm = 0x278
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0xfc4b(%rip), %rdi      # 0x20fd0
leaq 0x7fa2(%rip), %rsi      # 0x1932e
movl $0x4a, %edx
callq 0x3340
movl 0x8(%rsp), %esi
movq 0xfc2f(%rip), %rdi      # 0x20fd0
callq 0x3560
movq %rax, %rbx
leaq 0x7fc9(%rip), %rsi      # 0x19379
movl $0x37, %edx
movq %rax, %rdi
callq 0x3340
movq %rbx, %rdi
callq 0x3160
movl $0x1, %edi
callq 0x3370
leaq 0x801a(%rip), %rdi      # 0x193f0
leaq 0x6f55(%rip), %rsi      # 0x18332
leaq 0x7edd(%rip), %rcx      # 0x192c1
movl $0x43a, %edx            # imm = 0x43A
callq 0x31b0
leaq 0x7fbc(%rip), %rdi      # 0x193b1
leaq 0x6f36(%rip), %rsi      # 0x18332
leaq 0x7ebe(%rip), %rcx      # 0x192c1
movl $0x439, %edx            # imm = 0x439
callq 0x31b0
movq 0xfbbc(%rip), %rdi      # 0x20fd0
leaq 0x7dcb(%rip), %rsi      # 0x191e6
movl $0x3c, %edx
callq 0x3340
movq 0xfba4(%rip), %rdi      # 0x20fd0
movq %r14, %rsi
callq 0x32c0
movq %rax, %rdi
callq 0x3160
leaq 0x6eed(%rip), %rdi      # 0x18330
leaq 0x6ee8(%rip), %rsi      # 0x18332
leaq 0x7e70(%rip), %rcx      # 0x192c1
movl $0x41e, %edx            # imm = 0x41E
callq 0x31b0
leaq 0x7eb3(%rip), %rdi      # 0x19315
leaq 0x6ec9(%rip), %rsi      # 0x18332
leaq 0x7e51(%rip), %rcx      # 0x192c1
movl $0x423, %edx            # imm = 0x423
callq 0x31b0
leaq 0x7b9d(%rip), %rdi      # 0x1901e
leaq 0x6eaa(%rip), %rsi      # 0x18332
leaq 0x7e32(%rip), %rcx      # 0x192c1
movl $0x42b, %edx            # imm = 0x42B
callq 0x31b0
jmp 0x1149b
movq %rax, %rbx
jmp 0x114f4
jmp 0x114a2
movq %rax, %rbx
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x114c1
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x32f0
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x114dd
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x32f0
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x114f4
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x32f0
leaq 0x70(%rsp), %rdi
callq 0x30d0
movq %rbx, %rdi
callq 0x3570