// File: 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
movq %rsp, %rbp
subq $0xd0, %rsp
movq %fs:0x28, %rax
movq %rax, -0x8(%rbp)
movq %rdi, -0x38(%rbp)
movl %esi, -0x3c(%rbp)
movl %edx, -0x40(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x68(%rbp)
leaq -0x20(%rbp), %rdi
callq 0x195f0
movq -0x68(%rbp), %rax
addq $0x148, %rax            # imm = 0x148
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rdi
callq 0x19160
movq %rax, -0x28(%rbp)
movq -0x48(%rbp), %rdi
callq 0x191b0
movq %rax, -0x30(%rbp)
leaq -0x28(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x19210
testb $0x1, %al
jne 0x1755e
jmp 0x175aa
leaq -0x28(%rbp), %rdi
callq 0x19250
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
movq (%rax), %rax
cmpl $0x0, 0xa8(%rax)
jne 0x1759d
movq -0x50(%rbp), %rsi
leaq -0x20(%rbp), %rdi
callq 0x19c30
jmp 0x1758a
jmp 0x1759d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x1784b
jmp 0x1759f
leaq -0x28(%rbp), %rdi
callq 0x19350
jmp 0x1754b
movl $0x0, -0x60(%rbp)
movl -0x60(%rbp), %eax
cmpl -0x3c(%rbp), %eax
jge 0x17701
movl -0x40(%rbp), %eax
movl %eax, -0x6c(%rbp)
subl $0x1, %eax
je 0x175d7
jmp 0x175ca
movl -0x6c(%rbp), %eax
subl $0x2, %eax
je 0x17624
jmp 0x1767a
movslq -0x60(%rbp), %rsi
leaq -0x20(%rbp), %rdi
movq %rdi, -0x80(%rbp)
callq 0x19970
movq -0x80(%rbp), %rdi
movq %rax, %rcx
movq -0x68(%rbp), %rax
movq (%rcx), %rcx
movl $0x1, 0xa8(%rcx)
addq $0x10, %rax
movq %rax, -0x78(%rbp)
movslq -0x60(%rbp), %rsi
callq 0x19970
movq -0x78(%rbp), %rdi
movq %rax, %rsi
callq 0x19c30
jmp 0x1761f
jmp 0x176f1
movslq -0x60(%rbp), %rsi
leaq -0x20(%rbp), %rdi
movq %rdi, -0x90(%rbp)
callq 0x19970
movq -0x90(%rbp), %rdi
movq %rax, %rcx
movq -0x68(%rbp), %rax
movq (%rcx), %rcx
movl $0x2, 0xa8(%rcx)
addq $0x30, %rax
movq %rax, -0x88(%rbp)
movslq -0x60(%rbp), %rsi
callq 0x19970
movq -0x88(%rbp), %rdi
movq %rax, %rsi
callq 0x19c30
jmp 0x17678
jmp 0x176f1
movl $0x10, %edi
callq 0x16130
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x98(%rbp)
leaq 0xfaa2(%rip), %rsi      # 0x2713a
callq 0x16530
jmp 0x1769f
movq %fs:0x28, %rax
movq -0x8(%rbp), %rcx
cmpq %rcx, %rax
jne 0x1787d
movq -0x98(%rbp), %rdi
movq 0x1991d(%rip), %rsi     # 0x30fe0
movq 0x198f6(%rip), %rdx     # 0x30fc0
callq 0x16490
jmp 0x1787d
movq -0x98(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
callq 0x161d0
jmp 0x1784b
jmp 0x176f3
movl -0x60(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x60(%rbp)
jmp 0x175b1
movl -0x40(%rbp), %eax
movl %eax, -0x9c(%rbp)
subl $0x1, %eax
je 0x17721
jmp 0x17711
movl -0x9c(%rbp), %eax
subl $0x2, %eax
je 0x1776d
jmp 0x177b6
movl -0x3c(%rbp), %esi
movq 0x1986d(%rip), %rdi     # 0x30f98
callq 0x164a0
movq %rax, -0xa8(%rbp)
jmp 0x17739
movq -0xa8(%rbp), %rdi
leaq 0xfa81(%rip), %rsi      # 0x271c8
callq 0x162b0
movq %rax, -0xb0(%rbp)
jmp 0x17755
movq -0xb0(%rbp), %rdi
movl $0xa, %esi
callq 0x16380
jmp 0x17768
jmp 0x17827
movl -0x3c(%rbp), %esi
movq 0x19821(%rip), %rdi     # 0x30f98
callq 0x164a0
movq %rax, -0xb8(%rbp)
jmp 0x17785
movq -0xb8(%rbp), %rdi
leaq 0xfa56(%rip), %rsi      # 0x271e9
callq 0x162b0
movq %rax, -0xc0(%rbp)
jmp 0x177a1
movq -0xc0(%rbp), %rdi
movl $0xa, %esi
callq 0x16380
jmp 0x177b4
jmp 0x17827
movl $0x10, %edi
callq 0x16130
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0xc8(%rbp)
leaq 0xf966(%rip), %rsi      # 0x2713a
callq 0x16530
jmp 0x177db
movq %fs:0x28, %rax
movq -0x8(%rbp), %rcx
cmpq %rcx, %rax
jne 0x1787d
movq -0xc8(%rbp), %rdi
movq 0x197e1(%rip), %rsi     # 0x30fe0
movq 0x197ba(%rip), %rdx     # 0x30fc0
callq 0x16490
jmp 0x1787d
movq -0xc8(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
callq 0x161d0
jmp 0x1784b
leaq -0x20(%rbp), %rdi
callq 0x19100
movq %fs:0x28, %rax
movq -0x8(%rbp), %rcx
cmpq %rcx, %rax
jne 0x1787d
addq $0xd0, %rsp
popq %rbp
retq
leaq -0x20(%rbp), %rdi
callq 0x19100
movq -0x58(%rbp), %rax
movq %rax, -0xd0(%rbp)
movq %fs:0x28, %rax
movq -0x8(%rbp), %rcx
cmpq %rcx, %rax
jne 0x1787d
movq -0xd0(%rbp), %rdi
callq 0x164e0
callq 0x16340
nopw %cs:(%rax,%rax)