// File: godofecht[P]Slow-Feature-Analysis/./Network.cpp
// Function: Network::Network(std::vector<unsigned int, std::allocator<unsigned int>> const&)
Network::Network(const vector <unsigned> &topology)
{
	srand((unsigned int)time(NULL));

	unsigned numLayers = topology.size();
	for (unsigned layerNum = 0; layerNum < numLayers; layerNum++) {
		m_layers.push_back(Layer());
		unsigned numOutputs = layerNum == topology.size() - 1 ? 0 : topology[layerNum + 1];



		// We have a new layer, now fill it with neurons, and a bias neuron in each layer.
		for (unsigned neuronNum = 0; neuronNum < topology[layerNum]; neuronNum++) {
			m_layers.back().push_back(Neuron(numOutputs, neuronNum)); 
		}
	}


	//for stone and bray sfa
	for(int i=0;i<topology.back();i++)
	{
		NormalizeWeights(i);
	}
}

// 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)
callq 0x3ff0
xorl %eax, %eax
movl %eax, %edi
callq 0x21b0
movl %eax, %edi
callq 0x21d0
movq -0x10(%rbp), %rdi
callq 0x4010
movl %eax, -0x14(%rbp)
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
cmpl -0x14(%rbp), %eax
jae 0x29da
xorps %xmm0, %xmm0
movaps %xmm0, -0x30(%rbp)
movq $0x0, -0x20(%rbp)
leaq -0x30(%rbp), %rdi
movq %rdi, -0xa0(%rbp)
callq 0x4060
movq -0x98(%rbp), %rdi
movq -0xa0(%rbp), %rsi
callq 0x4030
jmp 0x28a6
leaq -0x30(%rbp), %rdi
callq 0x4080
movl -0x18(%rbp), %eax
movq %rax, -0xa8(%rbp)
movq -0x10(%rbp), %rdi
callq 0x4010
movq %rax, %rcx
movq -0xa8(%rbp), %rax
subq $0x1, %rcx
cmpq %rcx, %rax
jne 0x28df
xorl %eax, %eax
movl %eax, -0xac(%rbp)
jmp 0x28fa
movq -0x10(%rbp), %rdi
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, %eax
movl %eax, %esi
callq 0x40e0
movl (%rax), %eax
movl %eax, -0xac(%rbp)
movl -0xac(%rbp), %eax
movl %eax, -0x40(%rbp)
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %eax
movl %eax, -0xb0(%rbp)
movq -0x10(%rbp), %rdi
movl -0x18(%rbp), %eax
movl %eax, %esi
callq 0x40e0
movq %rax, %rcx
movl -0xb0(%rbp), %eax
cmpl (%rcx), %eax
jae 0x29ca
movq -0x98(%rbp), %rdi
callq 0x4100
movq %rax, -0xb8(%rbp)
movl -0x40(%rbp), %esi
movl -0x44(%rbp), %edx
leaq -0x88(%rbp), %rdi
callq 0x2570
jmp 0x2959
movq -0xb8(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0x4140
jmp 0x296e
leaq -0x88(%rbp), %rdi
callq 0x4170
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x290a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x4080
jmp 0x2a36
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x2a36
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x88(%rbp), %rdi
callq 0x4170
jmp 0x2a36
jmp 0x29cc
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x2866
movl $0x0, -0x8c(%rbp)
movl -0x8c(%rbp), %eax
movl %eax, -0xbc(%rbp)
movq -0x10(%rbp), %rdi
callq 0x4190
movq %rax, %rcx
movl -0xbc(%rbp), %eax
cmpl (%rcx), %eax
jae 0x2a2d
movq -0x98(%rbp), %rdi
movl -0x8c(%rbp), %esi
callq 0x2a50
jmp 0x2a1a
jmp 0x2a1c
movl -0x8c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8c(%rbp)
jmp 0x29e4
addq $0xc0, %rsp
popq %rbp
retq
movq -0x98(%rbp), %rdi
callq 0x41d0
movq -0x38(%rbp), %rdi
callq 0x22f0
nopl (%rax,%rax)