// File: /workspace/github_c_makefile_star2_O1/stonezwr[P]SpiKL-IP/network.C
// Function: Network::WriteSelectedSynToFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, char*)
void Network::WriteSelectedSynToFile(const string& syn_type, char * filename){

    ofstream f_out(filename);
    if(!f_out.is_open()){
        cout<<"In Network::WriteSelectedSynToFile(), cannot open the file : "<<filename<<endl;
        exit(EXIT_FAILURE);
    }

    synapsetype_t  wrt_syn_type = INVALID;
    DetermineSynType(syn_type.c_str(), wrt_syn_type, "WriteSelectedSynToFile()");
    assert(wrt_syn_type != INVALID);
    vector<Synapse*> tmp;

    const vector<Synapse*> & synapses = 
        wrt_syn_type == RESERVOIR_SYN ? _rsynapses : 
        wrt_syn_type == READOUT_SYN ? _rosynapses : 
        wrt_syn_type == INPUT_SYN ? _isynapses : tmp;
    for(size_t i = 0; i < synapses.size(); ++i)
        f_out<<i<<"\t"<<synapses[i]->PreNeuron()->Name()
            <<"\t"<<synapses[i]->PostNeuron()->Name()
            <<"\t"<<synapses[i]->Weight()<<endl;
    f_out.close();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x228, %rsp            # imm = 0x228
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x28(%rsp), %rdi
movq %rdx, %rsi
movl $0x10, %edx
callq 0x3320
leaq 0x98(%rsp), %rdi
callq 0x30b0
testb %al, %al
je 0x10cad
leaq 0xc(%rsp), %rdx
movl $0x3, (%rdx)
movq (%r15), %rsi
leaq 0x8658(%rip), %rcx      # 0x19104
callq 0x1072a
movl 0xc(%rsp), %eax
cmpl $0x3, %eax
je 0x10ce6
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
cmpl $0x2, %eax
je 0x10ae1
testl %eax, %eax
jne 0x10aea
addq $0x118, %rbx            # imm = 0x118
jmp 0x10afd
addq $0x130, %rbx            # imm = 0x130
jmp 0x10afd
addq $0x148, %rbx            # imm = 0x148
cmpl $0x1, %eax
leaq 0x10(%rsp), %rax
cmovneq %rax, %rbx
movq 0x8(%rbx), %rax
cmpq (%rbx), %rax
je 0x10c48
xorl %r14d, %r14d
leaq 0x28(%rsp), %r15
leaq 0x6517(%rip), %r12      # 0x17030
movq %r15, %rdi
movq %r14, %rsi
callq 0x31d0
movq %rax, %r13
movl $0x1, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x3340
movq (%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0xc3de
movq %rax, %rdi
callq 0x6f9c
movq %rax, %rbp
testq %rax, %rax
je 0x10b6b
movq %rbp, %rdi
callq 0x3150
movq %r13, %rdi
movq %rbp, %rsi
movq %rax, %rdx
callq 0x3340
jmp 0x10b84
movq (%r13), %rax
movq -0x18(%rax), %rax
leaq (%rax,%r13), %rdi
movl 0x20(%r13,%rax), %esi
orl $0x1, %esi
callq 0x3550
movl $0x1, %edx
movq %r13, %rdi
movq %r12, %rsi
callq 0x3340
movq (%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0xc3e2
movq %rax, %rdi
callq 0x6f9c
movq %rax, %rbp
testq %rax, %rax
je 0x10bc8
movq %rbp, %rdi
callq 0x3150
movq %r13, %rdi
movq %rbp, %rsi
movq %rax, %rdx
callq 0x3340
jmp 0x10be3
movq (%r13), %rax
movq -0x18(%rax), %rax
movq %r13, %rdi
addq %rax, %rdi
movl 0x20(%r13,%rax), %esi
orl $0x1, %esi
callq 0x3550
movl $0x1, %edx
movq %r13, %rdi
movq %r12, %rsi
callq 0x3340
movq (%rbx), %rax
movq (%rax,%r14,8), %rax
movsd 0x38(%rax), %xmm0
movq %r13, %rdi
callq 0x34f0
movq %rax, %r13
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x32b0
movsbl %al, %esi
movq %r13, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x31e0
incq %r14
movq 0x8(%rbx), %rax
subq (%rbx), %rax
sarq $0x3, %rax
cmpq %rax, %r14
jb 0x10b19
leaq 0x28(%rsp), %rdi
callq 0x3410
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x10c69
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x32f0
movq 0x10358(%rip), %rax     # 0x20fc8
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq 0x30(%rsp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, 0x28(%rsp,%rcx)
callq 0x3240
leaq 0x120(%rsp), %rdi
callq 0x3120
addq $0x228, %rsp            # imm = 0x228
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x1031c(%rip), %rdi     # 0x20fd0
leaq 0x840b(%rip), %rsi      # 0x190c6
movl $0x3d, %edx
callq 0x3340
movq 0x10304(%rip), %rdi     # 0x20fd0
movq %r14, %rsi
callq 0x32c0
movq %rax, %rdi
callq 0x3160
movl $0x1, %edi
callq 0x3370
leaq 0x8430(%rip), %rdi      # 0x1911d
leaq 0x763e(%rip), %rsi      # 0x18332
leaq 0x843a(%rip), %rcx      # 0x19135
movl $0x3dc, %edx            # imm = 0x3DC
callq 0x31b0
jmp 0x10d09
jmp 0x10d0e
movq %rax, %rbx
jmp 0x10d28
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x10d28
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x32f0
leaq 0x28(%rsp), %rdi
callq 0x3450
movq %rbx, %rdi
callq 0x3570