// File: /workspace/github_c_makefile_star2_O1/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, 0x8(%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 0xc0d4
movq %r13, (%rsp)
leaq 0x100(%r12), %r15
movl $0x18, %edi
callq 0x32e0
movq (%rsp), %rcx
movq %rcx, 0x10(%rax)
movq %rax, %rdi
movq %r15, %rsi
callq 0x3060
incq 0x110(%r12)
movq 0x10(%r14), %rsi
leaq 0x10(%rsp), %rdi
leaq 0x60(%rsp), %rdx
callq 0xaa0c
movq 0x10(%rbx), %rsi
leaq 0x30(%rsp), %rdi
leaq 0x60(%rsp), %rdx
callq 0xaa0c
leaq 0x50(%r12), %r13
leaq 0x10(%rsp), %rsi
movq %r13, %rdi
callq 0xb464
testq %rax, %rax
jne 0xaba9
xorps %xmm0, %xmm0
leaq 0x90(%rsp), %rax
movaps %xmm0, -0x30(%rax)
movaps %xmm0, -0x10(%rax)
movaps %xmm0, -0x20(%rax)
movq $0x0, (%rax)
movq %rax, -0x30(%rax)
movq $0x1, -0x28(%rax)
movl $0x3f800000, -0x10(%rax) # imm = 0x3F800000
movups %xmm0, -0x8(%rax)
leaq 0x10(%rsp), %rsi
movq %r13, %rdi
callq 0xb57c
leaq 0x60(%rsp), %rsi
movq %rax, %rdi
callq 0x3686
leaq 0x60(%rsp), %rdi
callq 0xb9d6
leaq 0x10(%rsp), %rsi
movq %r13, %rdi
callq 0xb57c
leaq 0x30(%rsp), %rsi
movq %rax, %rdi
callq 0xba4a
movq %rax, %rbp
leaq 0x10(%rsp), %rsi
movq %r13, %rdi
callq 0xb57c
testq %rbp, %rbp
je 0xac72
movq 0x163ed(%rip), %rdi     # 0x20fd0
leaq 0xd546(%rip), %rsi      # 0x18130
movl $0x1c, %edx
callq 0x3340
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
movq 0x163cb(%rip), %rdi     # 0x20fd0
callq 0x3340
movq %rax, %rbp
leaq 0xd539(%rip), %rsi      # 0x1814d
movl $0x4, %edx
movq %rax, %rdi
callq 0x3340
movq 0x30(%rsp), %rsi
movq 0x38(%rsp), %rdx
movq %rbp, %rdi
callq 0x3340
movq %rax, %rbp
leaq 0xd515(%rip), %rsi      # 0x18152
movl $0x9, %edx
movq %rax, %rdi
callq 0x3340
movq (%rbp), %rax
movq -0x18(%rax), %rdi
addq %rbp, %rdi
movl $0xa, %esi
callq 0x32b0
movsbl %al, %esi
movq %rbp, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x31e0
movq (%rsp), %r15
leaq 0x10(%rsp), %rsi
movq %r13, %rdi
callq 0xb57c
leaq 0x30(%rsp), %rsi
movq %rax, %rdi
callq 0xbb46
movq %r15, (%rax)
movq (%rsp), %rdi
callq 0xc268
testb %al, %al
jne 0xacad
movq (%rsp), %rdi
callq 0xc29a
testb %al, %al
je 0xacf0
movq (%rsp), %rdi
callq 0xc268
testb %al, %al
je 0xacd5
movq 0x138(%r12), %rsi
cmpq 0x140(%r12), %rsi
je 0xad17
addq $0x138, %r12            # imm = 0x138
jmp 0xad09
movq 0x150(%r12), %rsi
cmpq 0x158(%r12), %rsi
je 0xad1e
addq $0x150, %r12            # imm = 0x150
jmp 0xad09
movq 0x120(%r12), %rsi
cmpq 0x128(%r12), %rsi
je 0xad25
addq $0x120, %r12            # imm = 0x120
movq (%rsp), %rax
movq %rax, (%rsi)
addq $0x8, (%r12)
jmp 0xad38
movl $0x130, %eax            # imm = 0x130
jmp 0xad2a
movl $0x148, %eax            # imm = 0x148
jmp 0xad2a
movl $0x118, %eax            # imm = 0x118
addq %rax, %r12
movq %rsp, %rdx
movq %r12, %rdi
callq 0xb014
cmpq $0x0, 0x8(%rsp)
je 0xad4e
movq (%rsp), %rsi
movq 0x8(%rsp), %rdi
callq 0x9160
movq (%rsp), %rsi
movq %r14, %rdi
callq 0x6fa2
movq (%rsp), %rsi
movq %rbx, %rdi
callq 0x6fcc
leaq 0x40(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xad81
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x32f0
leaq 0x20(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xad9c
movq 0x20(%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 0x64a3
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0xb9d6
jmp 0xade5
jmp 0xade2
jmp 0xade2
movq %rax, %rbx
jmp 0xae00
movq %rax, %rbx
jmp 0xae1b
movq %rax, %rbx
movl $0xc0, %esi
movq %r13, %rdi
jmp 0xae16
jmp 0xade2
movq %rax, %rbx
leaq 0x40(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xae00
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x32f0
leaq 0x20(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xae1b
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x32f0
movq %rbx, %rdi
callq 0x3570
nop