// File: /workspace/github_cpp_makefile_star2_O1/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 $0x48, %rsp
movl %edx, %r14d
movl %esi, %ebp
movq %rdi, %r15
movq %fs:0x28, %rax
movq %rax, 0x40(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
movq $0x0, 0x30(%rsp)
movq 0x148(%rdi), %r12
movq 0x150(%rdi), %rbx
cmpq %rbx, %r12
je 0x70c5
leaq 0x20(%rsp), %r13
movq (%r12), %rax
cmpl $0x0, 0xa8(%rax)
jne 0x70bc
movq 0x28(%rsp), %rsi
cmpq 0x30(%rsp), %rsi
je 0x70b1
movq %rax, (%rsi)
addq $0x8, 0x28(%rsp)
jmp 0x70bc
movq %r13, %rdi
movq %r12, %rdx
callq 0xa18a
addq $0x8, %r12
cmpq %rbx, %r12
jne 0x708d
movl %ebp, 0xc(%rsp)
testl %ebp, %ebp
jle 0x7165
leal -0x1(%r14), %eax
cmpl $0x1, %eax
ja 0x7229
leaq 0x38(%r15), %rax
movq %rax, 0x18(%rsp)
leaq 0x30(%r15), %rax
movq %rax, 0x10(%rsp)
leaq 0x18(%r15), %rbp
leaq 0x10(%r15), %rbx
movl 0xc(%rsp), %r12d
shlq $0x3, %r12
xorl %r13d, %r13d
movq 0x20(%rsp), %rdx
movq (%rdx,%r13), %rax
cmpl $0x1, %r14d
jne 0x7136
movl $0x1, 0xa8(%rax)
movq 0x18(%r15), %rsi
movq %rbx, %rdi
movq %rbp, %rcx
cmpq 0x20(%r15), %rsi
je 0x7154
movq %rax, (%rsi)
addq $0x8, (%rcx)
jmp 0x715c
movl $0x2, 0xa8(%rax)
movq 0x38(%r15), %rsi
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rcx
cmpq 0x40(%r15), %rsi
jne 0x712d
addq %r13, %rdx
callq 0xa18a
addq $0x8, %r13
cmpq %r13, %r12
jne 0x7104
cmpl $0x1, %r14d
je 0x71b3
cmpl $0x2, %r14d
movl 0xc(%rsp), %esi
jne 0x7271
movq 0x8e20(%rip), %rdi      # 0xffa0
callq 0x6400
movq %rax, %rbx
leaq 0x507a(%rip), %rsi      # 0xc209
movl $0x1e, %edx
movq %rax, %rdi
callq 0x62d0
leaq 0x3f(%rsp), %rsi
movb $0xa, (%rsi)
movl $0x1, %edx
movq %rbx, %rdi
callq 0x62d0
jmp 0x71ef
movq 0x8de6(%rip), %rdi      # 0xffa0
movl 0xc(%rsp), %esi
callq 0x6400
movq %rax, %rbx
leaq 0x501b(%rip), %rsi      # 0xc1e8
movl $0x20, %edx
movq %rax, %rdi
callq 0x62d0
leaq 0x3f(%rsp), %rsi
movb $0xa, (%rsi)
movl $0x1, %edx
movq %rbx, %rdi
callq 0x62d0
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x7206
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x6280
movq %fs:0x28, %rax
cmpq 0x40(%rsp), %rax
jne 0x72fa
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x10, %edi
callq 0x6100
movq %rax, %r14
leaq 0x4f1d(%rip), %rsi      # 0xc15a
movq %rax, %rdi
callq 0x6480
movq %fs:0x28, %rax
cmpq 0x40(%rsp), %rax
jne 0x72fa
movq 0x8d80(%rip), %rsi      # 0xffe0
movq 0x8d59(%rip), %rdx      # 0xffc0
movq %r14, %rdi
callq 0x63f0
jmp 0x72b3
movl $0x10, %edi
callq 0x6100
movq %rax, %r14
leaq 0x4ed5(%rip), %rsi      # 0xc15a
movq %rax, %rdi
callq 0x6480
movq %fs:0x28, %rax
cmpq 0x40(%rsp), %rax
jne 0x72fa
movq 0x8d3c(%rip), %rsi      # 0xffe0
movq 0x8d15(%rip), %rdx      # 0xffc0
movq %r14, %rdi
callq 0x63f0
jmp 0x72b7
jmp 0x72c8
movq %rax, %rbx
movq %r14, %rdi
callq 0x61a0
jmp 0x72cb
jmp 0x72c8
jmp 0x72c8
movq %rax, %rbx
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x72e2
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x6280
movq %fs:0x28, %rax
cmpq 0x40(%rsp), %rax
jne 0x72fa
movq %rbx, %rdi
callq 0x6440
callq 0x62a0
nop