// File: mertyildiran[P]Plexus/plexus/plexus.cpp
// Function: Neuron::partially_subscribe()
void Neuron::partially_subscribe()
{
    if (this->subscriptions.size() == 0) {
        unsigned seed = std::chrono::system_clock::now()
            .time_since_epoch().count();
        std::default_random_engine generator (seed);
        std::normal_distribution<double> distribution(
            this->network->connectivity,
            this->network->connectivity_sqrt
        );
        unsigned int sample_length = distribution(generator);
        if (sample_length > this->network->nonmotor_neurons.size())
            sample_length = this->network->nonmotor_neurons.size();
        if (sample_length <= 0)
            sample_length = 0;
        std::vector<Neuron*> elected = random_sample(
            this->network->nonmotor_neurons,
            sample_length
        );
        for (auto const& target_neuron: elected) {
            if (target_neuron != this) {
                this->subscriptions.insert(
                    std::pair<Neuron*, double>(
                        target_neuron,
                        Random::get(-1.0, 1.0)
                    )
                );
                target_neuron->publications.insert(
                    std::pair<Neuron*, double>(this, 0.0)
                );
            }
        }
        this->network->increase_initiated_neurons();
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x180, %rsp            # imm = 0x180
movq %fs:0x28, %rax
movq %rax, -0x8(%rbp)
movq %rdi, -0xe0(%rbp)
movq -0xe0(%rbp), %rdi
movq %rdi, -0x110(%rbp)
addq $0x30, %rdi
callq 0x18c90
cmpq $0x0, %rax
jne 0x16b61
callq 0x16030
movq %rax, -0x58(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x18cb0
movq %rax, -0x50(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x18d00
movl %eax, -0xe4(%rbp)
movl -0xe4(%rbp), %eax
movl %eax, %esi
leaq -0x60(%rbp), %rdi
movq %rdi, -0x120(%rbp)
callq 0x18d20
movq -0x110(%rbp), %rax
movq 0x28(%rax), %rax
cvtsi2sdl 0x4(%rax), %xmm0
cvtsi2sdl 0x8(%rax), %xmm1
leaq -0x28(%rbp), %rdi
movq %rdi, -0x128(%rbp)
callq 0x18d50
movq -0x128(%rbp), %rdi
movq -0x120(%rbp), %rsi
callq 0x18da0
movq -0x110(%rbp), %rax
cvttsd2si %xmm0, %rcx
movl %ecx, -0xe8(%rbp)
movl -0xe8(%rbp), %ecx
movq %rcx, -0x118(%rbp)
movq 0x28(%rax), %rdi
addq $0x160, %rdi            # imm = 0x160
callq 0x18dd0
movq %rax, %rcx
movq -0x118(%rbp), %rax
cmpq %rcx, %rax
jbe 0x16900
movq -0x110(%rbp), %rax
movq 0x28(%rax), %rdi
addq $0x160, %rdi            # imm = 0x160
callq 0x18dd0
movl %eax, -0xe8(%rbp)
cmpl $0x0, -0xe8(%rbp)
ja 0x16913
movl $0x0, -0xe8(%rbp)
movq -0x110(%rbp), %rax
movq 0x28(%rax), %rsi
addq $0x160, %rsi            # imm = 0x160
leaq -0x90(%rbp), %rdi
movq %rdi, -0x130(%rbp)
callq 0x18fd0
movq -0x130(%rbp), %rsi
movl -0xe8(%rbp), %edx
leaq -0x78(%rbp), %rdi
callq 0x18df0
jmp 0x16950
leaq -0x90(%rbp), %rdi
callq 0x19100
leaq -0x78(%rbp), %rax
movq %rax, -0x100(%rbp)
movq -0x100(%rbp), %rdi
callq 0x19160
movq %rax, -0x98(%rbp)
movq -0x100(%rbp), %rdi
callq 0x191b0
movq %rax, -0xa0(%rbp)
leaq -0x98(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x19210
testb $0x1, %al
jne 0x169a9
jmp 0x16b46
leaq -0x98(%rbp), %rdi
callq 0x19250
movq -0x110(%rbp), %rcx
movq %rax, -0x108(%rbp)
movq -0x108(%rbp), %rax
cmpq %rcx, (%rax)
je 0x16b33
movq -0x110(%rbp), %rax
addq $0x30, %rax
movq %rax, -0x148(%rbp)
movq -0x108(%rbp), %rax
movq %rax, -0x140(%rbp)
movsd 0x1060d(%rip), %xmm0    # 0x27008
movsd 0x105fd(%rip), %xmm1    # 0x27000
callq 0x18b90
movsd %xmm0, -0x138(%rbp)
jmp 0x16a12
movq -0x140(%rbp), %rsi
movsd -0x138(%rbp), %xmm0
movsd %xmm0, -0xb8(%rbp)
leaq -0xb0(%rbp), %rdi
leaq -0xb8(%rbp), %rdx
callq 0x192f0
jmp 0x16a3e
movq -0x148(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0x19270
movb %dl, -0x151(%rbp)
movq %rax, -0x150(%rbp)
jmp 0x16a60
movq -0x110(%rbp), %rax
movb -0x151(%rbp), %cl
movq -0x150(%rbp), %rdx
movq %rdx, -0x38(%rbp)
movb %cl, -0x30(%rbp)
movq -0x108(%rbp), %rcx
movq (%rcx), %rcx
addq $0x68, %rcx
movq %rcx, -0x160(%rbp)
movq %rax, -0xd0(%rbp)
movq $0x0, -0xd8(%rbp)
leaq -0xc8(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
leaq -0xd8(%rbp), %rdx
callq 0x19320
jmp 0x16abe
movq -0x160(%rbp), %rdi
leaq -0xc8(%rbp), %rsi
callq 0x19270
movb %dl, -0x169(%rbp)
movq %rax, -0x168(%rbp)
jmp 0x16ae0
movb -0x169(%rbp), %al
movq -0x168(%rbp), %rcx
movq %rcx, -0x48(%rbp)
movb %al, -0x40(%rbp)
jmp 0x16b33
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xf0(%rbp)
movl %eax, -0xf4(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x19100
jmp 0x16b7c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xf0(%rbp)
movl %eax, -0xf4(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x19100
jmp 0x16b7c
jmp 0x16b35
leaq -0x98(%rbp), %rdi
callq 0x19350
jmp 0x1698d
movq -0x110(%rbp), %rax
movq 0x28(%rax), %rdi
callq 0x16bb0
jmp 0x16b58
leaq -0x78(%rbp), %rdi
callq 0x19100
movq %fs:0x28, %rax
movq -0x8(%rbp), %rcx
cmpq %rcx, %rax
jne 0x16ba8
addq $0x180, %rsp            # imm = 0x180
popq %rbp
retq
movq -0xf0(%rbp), %rax
movq %rax, -0x178(%rbp)
movq %fs:0x28, %rax
movq -0x8(%rbp), %rcx
cmpq %rcx, %rax
jne 0x16ba8
movq -0x178(%rbp), %rdi
callq 0x164e0
callq 0x16340
nopl (%rax)