// File: leonn[P]neuralNet/source/net.cpp
// Function: Net::Net(std::vector<unsigned int, std::allocator<unsigned int>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
Net::Net(const vector<unsigned> &topology,const string &transferFunction){
	// size
 	unsigned numberOfLayers = topology.size();

 	//create a new  Layer on each interation
 	for (unsigned layerNumber = 0; layerNumber < numberOfLayers; layerNumber++){
 		layers.push_back(Layer());

 		//number of outputs to a neuron
		unsigned numberOutputs= (layerNumber==topology.size()-1) ? 0: topology[layerNumber+1] ;

 		// fill layer wiith neurons and  add bias neuron to the layer;
 		for (unsigned neuronNumber = 0; neuronNumber <= topology[layerNumber] ; neuronNumber++){
			layers.back().push_back(Neuron(numberOutputs,neuronNumber,transferFunction));
 		}
 	}

 	// Force the bias node's output to 1.0 (it was the last neuron pushed in this layer):
    layers.back().back().setOutputValue(1.0);

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x110, %rsp            # imm = 0x110
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0xd0(%rbp)
addq $0x20, %rdi
movq %rdi, -0xc8(%rbp)
callq 0x2da0
movq -0x10(%rbp), %rdi
callq 0x2dc0
movl %eax, -0x1c(%rbp)
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jae 0x2810
movq -0xd0(%rbp), %rax
addq $0x20, %rax
movq %rax, -0xe0(%rbp)
xorps %xmm0, %xmm0
movaps %xmm0, -0x40(%rbp)
movq $0x0, -0x30(%rbp)
leaq -0x40(%rbp), %rdi
movq %rdi, -0xd8(%rbp)
callq 0x2e10
movq -0xe0(%rbp), %rdi
movq -0xd8(%rbp), %rsi
callq 0x2de0
jmp 0x26d7
leaq -0x40(%rbp), %rdi
callq 0x2e30
movl -0x20(%rbp), %eax
movq %rax, -0xe8(%rbp)
movq -0x10(%rbp), %rdi
callq 0x2dc0
movq %rax, %rcx
movq -0xe8(%rbp), %rax
subq $0x1, %rcx
cmpq %rcx, %rax
jne 0x2710
xorl %eax, %eax
movl %eax, -0xec(%rbp)
jmp 0x272b
movq -0x10(%rbp), %rdi
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, %eax
movl %eax, %esi
callq 0x2e90
movl (%rax), %eax
movl %eax, -0xec(%rbp)
movl -0xec(%rbp), %eax
movl %eax, -0x50(%rbp)
movl $0x0, -0x54(%rbp)
movl -0x54(%rbp), %eax
movl %eax, -0xf0(%rbp)
movq -0x10(%rbp), %rdi
movl -0x20(%rbp), %eax
movl %eax, %esi
callq 0x2e90
movq %rax, %rcx
movl -0xf0(%rbp), %eax
cmpl (%rcx), %eax
ja 0x2800
movq -0xd0(%rbp), %rdi
addq $0x20, %rdi
callq 0x2eb0
movq %rax, -0xf8(%rbp)
movl -0x50(%rbp), %esi
movl -0x54(%rbp), %edx
movq -0x18(%rbp), %rcx
leaq -0xc0(%rbp), %rdi
callq 0x81e0
jmp 0x2792
movq -0xf8(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
callq 0x2ef0
jmp 0x27a7
leaq -0xc0(%rbp), %rdi
callq 0x2f20
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
jmp 0x273b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x2e30
jmp 0x2842
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x2842
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0xc0(%rbp), %rdi
callq 0x2f20
jmp 0x2842
jmp 0x2802
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x2685
movq -0xd0(%rbp), %rdi
addq $0x20, %rdi
callq 0x2eb0
movq %rax, %rdi
callq 0x2f50
movq %rax, %rdi
movq %rsp, %rax
fld1
fstpt (%rax)
callq 0x82b0
jmp 0x2839
addq $0x110, %rsp            # imm = 0x110
popq %rbp
retq
movq -0xc8(%rbp), %rdi
callq 0x2f90
movq -0x48(%rbp), %rdi
callq 0x2360
nopw (%rax,%rax)