// File: /workspace/github_c_makefile_star2_O0/stonezwr[P]SpiKL-IP/network.C
// Function: Network::NormalizeContinuousWeights(char const*)
void Network::NormalizeContinuousWeights(const char * syn_type){
    synapsetype_t  tar_syn_type = INVALID;
    DetermineSynType(syn_type, tar_syn_type, "NormalizeContinuousWeights()");
    assert(tar_syn_type != INVALID);
    vector<Synapse*> tmp;

    vector<Synapse*> & synapses = tar_syn_type == RESERVOIR_SYN ? _rsynapses : 
        (tar_syn_type == READOUT_SYN ? _rosynapses : tmp);
    assert(!synapses.empty()); 

    // right now the function should be run for reservoir synapses!
    double g_sum = 0.0;
    for(size_t i = 0; i < synapses.size(); ++i){
        assert(synapses[i]);
        double w = synapses[i]->Weight();
        g_sum += w*w;
    }

    // normalize the weight:
    assert(g_sum > 0);
    g_sum = sqrt(g_sum);
    for(size_t i = 0; i < synapses.size(); ++i){
        // compute the normalized weight:
        double new_w = synapses[i]->Weight()/g_sum;
        // set the new weight:
        synapses[i]->Weight(new_w);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x78(%rbp)
movl $0x3, -0x14(%rbp)
movq -0x10(%rbp), %rsi
leaq -0x14(%rbp), %rdx
leaq 0x13c79(%rip), %rcx     # 0x35f9a
callq 0x22210
cmpl $0x3, -0x14(%rbp)
je 0x2232e
jmp 0x2234d
leaq 0x13c82(%rip), %rdi     # 0x35fb7
leaq 0x12fde(%rip), %rsi     # 0x3531a
movl $0x3a0, %edx            # imm = 0x3A0
leaq 0x13c87(%rip), %rcx     # 0x35fcf
callq 0x4210
leaq -0x30(%rbp), %rdi
callq 0x11f50
cmpl $0x0, -0x14(%rbp)
jne 0x2236c
movq -0x78(%rbp), %rax
addq $0x118, %rax            # imm = 0x118
movq %rax, -0x80(%rbp)
jmp 0x2239d
cmpl $0x2, -0x14(%rbp)
jne 0x22385
movq -0x78(%rbp), %rax
addq $0x130, %rax            # imm = 0x130
movq %rax, -0x88(%rbp)
jmp 0x22392
leaq -0x30(%rbp), %rax
movq %rax, -0x88(%rbp)
jmp 0x22392
movq -0x88(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0x80(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rdi
callq 0x12ae0
xorb $-0x1, %al
testb $0x1, %al
jne 0x223b6
jmp 0x223b8
jmp 0x223d7
leaq 0x13c47(%rip), %rdi     # 0x36006
leaq 0x12f54(%rip), %rsi     # 0x3531a
movl $0x3a5, %edx            # imm = 0x3A5
leaq 0x13bfd(%rip), %rcx     # 0x35fcf
callq 0x4210
xorps %xmm0, %xmm0
movsd %xmm0, -0x40(%rbp)
movq $0x0, -0x48(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0x38(%rbp), %rdi
callq 0x12b20
movq %rax, %rcx
movq -0x90(%rbp), %rax
cmpq %rcx, %rax
jae 0x224b5
movq -0x38(%rbp), %rdi
movq -0x48(%rbp), %rsi
callq 0x24aa0
cmpq $0x0, (%rax)
je 0x22423
jmp 0x22442
leaq 0x13bee(%rip), %rdi     # 0x36018
leaq 0x12ee9(%rip), %rsi     # 0x3531a
movl $0x3aa, %edx            # imm = 0x3AA
leaq 0x13b92(%rip), %rcx     # 0x35fcf
callq 0x4210
movq -0x38(%rbp), %rdi
movq -0x48(%rbp), %rsi
callq 0x24aa0
movq (%rax), %rdi
callq 0x12140
movsd %xmm0, -0x98(%rbp)
jmp 0x22461
movsd -0x98(%rbp), %xmm0
movsd %xmm0, -0x50(%rbp)
movsd -0x50(%rbp), %xmm0
movsd -0x50(%rbp), %xmm2
movsd -0x40(%rbp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x40(%rbp)
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0x223e7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x11fb0
jmp 0x22594
movsd -0x40(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x224c5
jmp 0x224e4
leaq 0x13b58(%rip), %rdi     # 0x36024
leaq 0x12e47(%rip), %rsi     # 0x3531a
movl $0x3b0, %edx            # imm = 0x3B0
leaq 0x13af0(%rip), %rcx     # 0x35fcf
callq 0x4210
movsd -0x40(%rbp), %xmm0
callq 0x4290
movsd %xmm0, -0x40(%rbp)
movq $0x0, -0x68(%rbp)
movq -0x68(%rbp), %rax
movq %rax, -0xa0(%rbp)
movq -0x38(%rbp), %rdi
callq 0x12b20
movq %rax, %rcx
movq -0xa0(%rbp), %rax
cmpq %rcx, %rax
jae 0x22582
movq -0x38(%rbp), %rdi
movq -0x68(%rbp), %rsi
callq 0x24aa0
movq (%rax), %rdi
callq 0x12140
movsd %xmm0, -0xa8(%rbp)
jmp 0x2253d
movsd -0xa8(%rbp), %xmm0
movsd -0x40(%rbp), %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0x70(%rbp)
movq -0x38(%rbp), %rdi
movq -0x68(%rbp), %rsi
callq 0x24aa0
movq (%rax), %rdi
movsd -0x70(%rbp), %xmm0
callq 0x24ac0
jmp 0x2256f
jmp 0x22571
movq -0x68(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x68(%rbp)
jmp 0x224fb
leaq -0x30(%rbp), %rdi
callq 0x11fb0
addq $0xb0, %rsp
popq %rbp
retq
movq -0x58(%rbp), %rdi
callq 0x46d0
nopl (%rax)