// File: /workspace/github_cpp_makefile_star2_O2/mertyildiran[P]Plexus/plexus/plexus.cpp
// Function: Network::pick_neurons_by_type(int, NeuronType)
void Network::pick_neurons_by_type(int input_dim, NeuronType neuron_type)
{
    std::vector<Neuron*> available_neurons;
    for (auto const& neuron: this->neurons) {
        if (neuron->type == INTER_NEURON) {
            available_neurons.push_back(neuron);
        }
    }
    for (int j = 0; j < input_dim; j++) {
        switch (neuron_type) {
            case SENSORY_NEURON:
                available_neurons[j]->type = SENSORY_NEURON;
                this->sensory_neurons.push_back(available_neurons[j]);
                break;
            case MOTOR_NEURON:
                available_neurons[j]->type = MOTOR_NEURON;
                this->motor_neurons.push_back(available_neurons[j]);
                break;
            default:
                throw std::invalid_argument(
                    "Network::pick_neurons_by_type(int input_dim, "
                    "NeuronType neuron_type) function only accepts "
                    "SENSORY_NEURON or MOTOR_NEURON as the neuron type!"
                );
                break;
        }
    }
    switch (neuron_type) {
        case SENSORY_NEURON:
            std::cout << input_dim
                << " neuron picked as sensory neuron" << '\n';
            break;
        case MOTOR_NEURON:
            std::cout << input_dim
                << " neuron picked as motor neuron" << '\n';
            break;
        default:
            throw std::invalid_argument(
                "Network::pick_neurons_by_type(int input_dim, "
                "NeuronType neuron_type) function only accepts "
                "SENSORY_NEURON or MOTOR_NEURON as the neuron type!"
            );
            break;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %edx, %ebp
movl %esi, %ebx
movq %rdi, %r14
movq %fs:0x28, %rax
movq %rax, 0x20(%rsp)
movq %rsp, %r15
andq $0x0, 0x10(%r15)
xorps %xmm0, %xmm0
movaps %xmm0, (%r15)
movq 0x148(%rdi), %r12
movq 0x150(%rdi), %r13
cmpq %r13, %r12
je 0x9e7f
movq (%r12), %rax
cmpl $0x0, 0xa8(%rax)
jne 0x9e79
movq %r15, %rdi
movq %r12, %rsi
callq 0xad14
addq $0x8, %r12
jmp 0x9e5c
leaq 0x30(%r14), %r15
addq $0x10, %r14
xorl %r12d, %r12d
testl %ebx, %ebx
movl $0x0, %r13d
cmovgl %ebx, %r13d
shlq $0x3, %r13
cmpq %r12, %r13
je 0x9ecf
movq %r15, %rdi
cmpl $0x2, %ebp
je 0x9eb3
movq %r14, %rdi
cmpl $0x1, %ebp
jne 0x9f47
movq (%rsp), %rsi
movq (%rsi,%r12), %rax
addq %r12, %rsi
movl %ebp, 0xa8(%rax)
callq 0xad14
addq $0x8, %r12
jmp 0x9e9a
cmpl $0x1, %ebp
je 0x9ef4
cmpl $0x2, %ebp
jne 0x9f8d
movq 0xa0bc(%rip), %rdi      # 0x13fa0
movl %ebx, %esi
callq 0x9430
leaq 0x5317(%rip), %rsi      # 0xf209
jmp 0x9f09
movq 0xa0a5(%rip), %rdi      # 0x13fa0
movl %ebx, %esi
callq 0x9430
leaq 0x52df(%rip), %rsi      # 0xf1e8
movq %rax, %rdi
callq 0x9290
pushq $0xa
popq %rsi
movq %rax, %rdi
callq 0x9310
movq %rsp, %rdi
callq 0xc5aa
movq %fs:0x28, %rax
cmpq 0x20(%rsp), %rax
jne 0xa005
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x10
popq %rdi
callq 0x9120
movq %rax, %r14
leaq 0x5201(%rip), %rsi      # 0xf15a
movq %rax, %rdi
callq 0x94b0
movq %fs:0x28, %rax
cmpq 0x20(%rsp), %rax
jne 0xa005
movq 0xa064(%rip), %rsi      # 0x13fe0
movq 0xa03d(%rip), %rdx      # 0x13fc0
movq %r14, %rdi
callq 0x9420
jmp 0x9fcd
pushq $0x10
popq %rdi
callq 0x9120
movq %rax, %r14
leaq 0x51bb(%rip), %rsi      # 0xf15a
movq %rax, %rdi
callq 0x94b0
movq %fs:0x28, %rax
cmpq 0x20(%rsp), %rax
jne 0xa005
movq 0xa022(%rip), %rsi      # 0x13fe0
movq 0x9ffb(%rip), %rdx      # 0x13fc0
movq %r14, %rdi
callq 0x9420
jmp 0x9fd3
jmp 0x9fe2
jmp 0x9fe2
movq %rax, %rbx
movq %r14, %rdi
callq 0x91c0
jmp 0x9fe5
jmp 0x9fe2
movq %rax, %rbx
movq %rsp, %rdi
callq 0xc5aa
movq %fs:0x28, %rax
cmpq 0x20(%rsp), %rax
jne 0xa005
movq %rbx, %rdi
callq 0x9470
callq 0x92d0