// File: /workspace/github_cpp_makefile_star2_O3/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 0x70a5
leaq 0x20(%rsp), %r13
movq (%r12), %rax
cmpl $0x0, 0xa8(%rax)
jne 0x709c
movq 0x28(%rsp), %rsi
cmpq 0x30(%rsp), %rsi
je 0x7091
movq %rax, (%rsi)
addq $0x8, 0x28(%rsp)
jmp 0x709c
movq %r13, %rdi
movq %r12, %rdx
callq 0xa188
addq $0x8, %r12
cmpq %rbx, %r12
jne 0x706d
movl %ebp, 0xc(%rsp)
testl %ebp, %ebp
jle 0x7145
leal -0x1(%r14), %eax
cmpl $0x1, %eax
ja 0x7209
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 0x7116
movl $0x1, 0xa8(%rax)
movq 0x18(%r15), %rsi
movq %rbx, %rdi
movq %rbp, %rcx
cmpq 0x20(%r15), %rsi
je 0x7134
movq %rax, (%rsi)
addq $0x8, (%rcx)
jmp 0x713c
movl $0x2, 0xa8(%rax)
movq 0x38(%r15), %rsi
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rcx
cmpq 0x40(%r15), %rsi
jne 0x710d
addq %r13, %rdx
callq 0xa188
addq $0x8, %r13
cmpq %r13, %r12
jne 0x70e4
cmpl $0x1, %r14d
je 0x7193
cmpl $0x2, %r14d
movl 0xc(%rsp), %esi
jne 0x7251
movq 0x8e40(%rip), %rdi      # 0xffa0
callq 0x6400
movq %rax, %rbx
leaq 0x50da(%rip), %rsi      # 0xc249
movl $0x1e, %edx
movq %rax, %rdi
callq 0x62d0
leaq 0x3f(%rsp), %rsi
movb $0xa, (%rsi)
movl $0x1, %edx
movq %rbx, %rdi
callq 0x62d0
jmp 0x71cf
movq 0x8e06(%rip), %rdi      # 0xffa0
movl 0xc(%rsp), %esi
callq 0x6400
movq %rax, %rbx
leaq 0x507b(%rip), %rsi      # 0xc228
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 0x71e6
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x6280
movq %fs:0x28, %rax
cmpq 0x40(%rsp), %rax
jne 0x72da
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 0x4f7d(%rip), %rsi      # 0xc19a
movq %rax, %rdi
callq 0x6480
movq %fs:0x28, %rax
cmpq 0x40(%rsp), %rax
jne 0x72da
movq 0x8da0(%rip), %rsi      # 0xffe0
movq 0x8d79(%rip), %rdx      # 0xffc0
movq %r14, %rdi
callq 0x63f0
jmp 0x7293
movl $0x10, %edi
callq 0x6100
movq %rax, %r14
leaq 0x4f35(%rip), %rsi      # 0xc19a
movq %rax, %rdi
callq 0x6480
movq %fs:0x28, %rax
cmpq 0x40(%rsp), %rax
jne 0x72da
movq 0x8d5c(%rip), %rsi      # 0xffe0
movq 0x8d35(%rip), %rdx      # 0xffc0
movq %r14, %rdi
callq 0x63f0
jmp 0x7297
jmp 0x72a8
movq %rax, %rbx
movq %r14, %rdi
callq 0x61a0
jmp 0x72ab
jmp 0x72a8
jmp 0x72a8
movq %rax, %rbx
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x72c2
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x6280
movq %fs:0x28, %rax
cmpq 0x40(%rsp), %rax
jne 0x72da
movq %rbx, %rdi
callq 0x6440
callq 0x62a0
nop