// File: wkohlenberg[P]simple_NN/src/main.cpp
// Function: Net::Net(std::vector<unsigned int, std::allocator<unsigned int>> const&)
Net::Net(const vector<unsigned> &topology)
{
  // Get the number of layers
  unsigned numLayers = topology.size();
  for (unsigned layerNum = 0; layerNum < numLayers; layerNum++)
  {
    m_layers.push_back(Layer());
    // Get the number of outputs per neuron
    unsigned numOutputs = layerNum == topology.size() ? 0 : topology[layerNum+1];

    // Create Neuron with neuron outputs and index
    for (unsigned neuronNum = 0; neuronNum <= topology[layerNum]; neuronNum++)    // = is adding a bias node
    {
      m_layers.back().push_back(Neuron(numOutputs, neuronNum));
    }

    // Set output of the bias node to 1.0
    m_layers.back().back().setOutputVal(1.0);
  }

  // Init variables
  m_avgError = 0.0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x98(%rbp)
addq $0x10, %rdi
movq %rdi, -0x90(%rbp)
callq 0x5630
movq -0x10(%rbp), %rdi
callq 0x5650
movl %eax, -0x14(%rbp)
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
cmpl -0x14(%rbp), %eax
jae 0x483b
movq -0x98(%rbp), %rax
addq $0x10, %rax
movq %rax, -0xa8(%rbp)
xorps %xmm0, %xmm0
movaps %xmm0, -0x30(%rbp)
movq $0x0, -0x20(%rbp)
leaq -0x30(%rbp), %rdi
movq %rdi, -0xa0(%rbp)
callq 0x56a0
movq -0xa8(%rbp), %rdi
movq -0xa0(%rbp), %rsi
callq 0x5670
jmp 0x46e3
leaq -0x30(%rbp), %rdi
callq 0x56c0
movl -0x18(%rbp), %eax
movq %rax, -0xb0(%rbp)
movq -0x10(%rbp), %rdi
callq 0x5650
movq %rax, %rcx
movq -0xb0(%rbp), %rax
cmpq %rcx, %rax
jne 0x4718
xorl %eax, %eax
movl %eax, -0xb4(%rbp)
jmp 0x4733
movq -0x10(%rbp), %rdi
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, %eax
movl %eax, %esi
callq 0x5720
movl (%rax), %eax
movl %eax, -0xb4(%rbp)
movl -0xb4(%rbp), %eax
movl %eax, -0x40(%rbp)
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %eax
movl %eax, -0xb8(%rbp)
movq -0x10(%rbp), %rdi
movl -0x18(%rbp), %eax
movl %eax, %esi
callq 0x5720
movq %rax, %rcx
movl -0xb8(%rbp), %eax
cmpl (%rcx), %eax
ja 0x4801
movq -0x98(%rbp), %rdi
addq $0x10, %rdi
callq 0x54e0
movq %rax, -0xc0(%rbp)
movl -0x40(%rbp), %esi
movl -0x44(%rbp), %edx
leaq -0x88(%rbp), %rdi
callq 0x3f30
jmp 0x4796
movq -0xc0(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0x5740
jmp 0x47ab
leaq -0x88(%rbp), %rdi
callq 0x5770
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x4743
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x56c0
jmp 0x4852
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x4852
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x88(%rbp), %rdi
callq 0x5770
jmp 0x4852
movq -0x98(%rbp), %rdi
addq $0x10, %rdi
callq 0x54e0
movq %rax, %rdi
callq 0x5790
movq %rax, %rdi
movsd 0x97e4(%rip), %xmm0     # 0xe008
callq 0x5570
jmp 0x482b
jmp 0x482d
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x4691
movq -0x98(%rbp), %rax
xorps %xmm0, %xmm0
movsd %xmm0, (%rax)
addq $0xc0, %rsp
popq %rbp
retq
movq -0x90(%rbp), %rdi
callq 0x57d0
movq -0x38(%rbp), %rdi
callq 0x33a0
nopw (%rax,%rax)