// File: /workspace/github_c_makefile_star2_O3/stonezwr[P]SpiKL-IP/./network.h
// Function: void Network::LSMAddSynapse<double>(Neuron*, Neuron*, double, bool, double, bool, NeuronGroup*)
void LSMAddSynapse(Neuron * pre, Neuron * post, T weight, bool fixed, T weight_limit,bool liquid, NeuronGroup * group = NULL){
        Synapse * synapse = new Synapse(pre, post, weight, fixed, weight_limit, pre->IsExcitatory(),liquid);
        _synapses.push_back(synapse);
        std::string pre_name = std::string(pre->Name());
        std::string post_name = std::string(post->Name());
        if(_synapses_map.find(pre_name) == _synapses_map.end()){
            _synapses_map[pre_name] = std::unordered_map<std::string, Synapse*>();
        }
        if(_synapses_map[pre_name].find(post_name) != _synapses_map[pre_name].end()){
            std::cout<<"Warning:: duplicate synapse "<<pre_name<<" to "<<post_name<<" detected"<<std::endl;
        }
        _synapses_map[pre_name][post_name] = synapse; 
    
        // push back the reservoir, readout and input synapses into the vector:
        if(!synapse->IsReadoutSyn() && !synapse->IsInputSyn())
            _rsynapses.push_back(synapse);
        else if(synapse->IsReadoutSyn())
            _rosynapses.push_back(synapse);
        else
            _isynapses.push_back(synapse);

        if(group)  group->AddSynapse(synapse);
        pre->AddPostSyn(synapse);
        post->AddPreSyn(synapse);	
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %r9, 0x48(%rsp)
movl %r8d, %ebp
movsd %xmm1, 0x58(%rsp)
movl %ecx, %r15d
movsd %xmm0, 0x50(%rsp)
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r12
movl $0xc0, %edi
callq 0x32e0
movq %rax, %r13
movzbl 0x110(%r14), %r8d
movq %rax, %rdi
movq %r14, %rsi
movq %rbx, %rdx
movsd 0x50(%rsp), %xmm0
movl %r15d, %ecx
movsd 0x58(%rsp), %xmm1
movl %ebp, %r9d
callq 0xbe64
movq %r13, (%rsp)
leaq 0x100(%r12), %r15
movl $0x18, %edi
callq 0x32e0
movq %r13, 0x10(%rax)
movq %rax, %rdi
movq %r15, %rsi
callq 0x3060
incq 0x110(%r12)
movq 0x10(%r14), %rsi
leaq 0x8(%rsp), %rdi
leaq 0x60(%rsp), %rdx
callq 0xa7e4
movq 0x10(%rbx), %rsi
leaq 0x28(%rsp), %rdi
leaq 0x60(%rsp), %rdx
callq 0xa7e4
leaq 0x50(%r12), %rbp
leaq 0x8(%rsp), %rsi
movq %rbp, %rdi
callq 0xb1f6
testq %rax, %rax
jne 0xa976
leaq 0x90(%rsp), %rax
movq $0x0, -0x10(%rax)
movq %rax, -0x30(%rax)
movq $0x1, -0x28(%rax)
xorps %xmm0, %xmm0
movups %xmm0, -0x20(%rax)
movl $0x3f800000, -0x10(%rax) # imm = 0x3F800000
movups %xmm0, -0x8(%rax)
leaq 0x8(%rsp), %rsi
movq %rbp, %rdi
callq 0xb30e
leaq 0x60(%rsp), %rsi
movq %rax, %rdi
callq 0x3686
leaq 0x60(%rsp), %rdi
callq 0xb75c
leaq 0x8(%rsp), %rsi
movq %rbp, %rdi
callq 0xb30e
leaq 0x28(%rsp), %rsi
movq %rax, %rdi
callq 0xb7d0
movq %rax, %r15
leaq 0x8(%rsp), %rsi
movq %rbp, %rdi
callq 0xb30e
testq %r15, %r15
je 0xaa3e
movq 0x16620(%rip), %rdi     # 0x20fd0
leaq 0xd819(%rip), %rsi      # 0x181d0
movl $0x1c, %edx
callq 0x3340
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq 0x165fe(%rip), %rdi     # 0x20fd0
callq 0x3340
movq %rax, %r15
leaq 0xd80c(%rip), %rsi      # 0x181ed
movl $0x4, %edx
movq %rax, %rdi
callq 0x3340
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %rdx
movq %r15, %rdi
callq 0x3340
movq %rax, %r15
leaq 0xd7e8(%rip), %rsi      # 0x181f2
movl $0x9, %edx
movq %rax, %rdi
callq 0x3340
movq (%r15), %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 0x8(%rsp), %rsi
movq %rbp, %rdi
callq 0xb30e
leaq 0x28(%rsp), %rsi
movq %rax, %rdi
callq 0xb8cc
movq %r13, (%rax)
movq %r13, %rdi
callq 0xbff8
testb %al, %al
jne 0xaa77
movq %r13, %rdi
callq 0xc01e
testb %al, %al
je 0xaab9
movq (%rsp), %r13
movq %r13, %rdi
callq 0xbff8
testb %al, %al
je 0xaa9e
movq 0x138(%r12), %rsi
cmpq 0x140(%r12), %rsi
je 0xaae0
addq $0x138, %r12            # imm = 0x138
jmp 0xaad2
movq 0x150(%r12), %rsi
cmpq 0x158(%r12), %rsi
je 0xaae7
addq $0x150, %r12            # imm = 0x150
jmp 0xaad2
movq 0x120(%r12), %rsi
cmpq 0x128(%r12), %rsi
je 0xaaee
addq $0x120, %r12            # imm = 0x120
movq (%rsp), %rax
movq %rax, (%rsi)
addq $0x8, (%r12)
jmp 0xab01
movl $0x130, %eax            # imm = 0x130
jmp 0xaaf3
movl $0x148, %eax            # imm = 0x148
jmp 0xaaf3
movl $0x118, %eax            # imm = 0x118
addq %rax, %r12
movq %rsp, %rdx
movq %r12, %rdi
callq 0xadda
movq (%rsp), %rsi
movq 0x48(%rsp), %rdi
testq %rdi, %rdi
je 0xab18
callq 0x8f6e
movq (%rsp), %rsi
movq %r14, %rdi
callq 0x6ece
movq (%rsp), %rsi
movq %rbx, %rdi
callq 0x6ef8
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xab47
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x32f0
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xab62
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x32f0
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rdi
callq 0x64b7
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0xb75c
jmp 0xabab
jmp 0xaba8
jmp 0xaba8
movq %rax, %rbx
jmp 0xabc6
movq %rax, %rbx
jmp 0xabe1
movq %rax, %rbx
movl $0xc0, %esi
movq %r13, %rdi
jmp 0xabdc
jmp 0xaba8
movq %rax, %rbx
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xabc6
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x32f0
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xabe1
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x32f0
movq %rbx, %rdi
callq 0x3570
nop