// File: /workspace/github_cpp_makefile_star2_O2/samuel500[P]NEAT/individual.cpp
// Function: Individual::Individual(Individual const&)
Individual::Individual(const Individual& indiv){


	innov_num = new int;
	innov_num = indiv.innov_num;
	
	in_size = new int;
	in_size = indiv.in_size;
	out_size = new int;
	out_size = indiv.out_size;

		
	generation = new int;
	generation = indiv.generation;

	Node *new_node;


	vector<Node*>::const_iterator nodePtr;
	for(nodePtr=indiv.nodes.begin(); nodePtr != indiv.nodes.end(); ++nodePtr){

		new_node = new Node((*nodePtr)->node_type, (*nodePtr)->hist_marking, *generation);
		if((*nodePtr)->node_type == OUTPUT){
			outputs.push_back(new_node);
		}
		else if((*nodePtr)->node_type == INPUT){
			inputs.push_back(new_node);
		}
		nodes.push_back(new_node);

	}

	vector<Connection*>::const_iterator conPtr;
	for(conPtr=indiv.connections.begin(); conPtr != indiv.connections.end(); ++conPtr){

		int in_node_hist_marking = (*conPtr)->in_node->hist_marking;
		int out_node_hist_marking = (*conPtr)->out_node->hist_marking;

		Node *con_in_node = new Node;
		Node *con_out_node = new Node;

		bool found_in = false;
		bool found_out = false;

		for(nodePtr=nodes.begin(); nodePtr != nodes.end(); ++nodePtr){

			if((*nodePtr)->hist_marking == in_node_hist_marking){
				con_in_node = (*nodePtr);
				found_in = true;
			}
			else if((*nodePtr)->hist_marking == out_node_hist_marking){
				con_out_node = *nodePtr;
				found_out = true;
			}
			if(found_in && found_out) break;

		}

		Connection *new_connection = new Connection(con_in_node, con_out_node, (*conPtr)->hist_marking, *generation);
		new_connection->weight = (*conPtr)->weight;
		connections.push_back(new_connection);


	}

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x18(%rdi), %r13
leaq 0x30(%rdi), %rax
movq %rax, -0x58(%rbp)
leaq 0x48(%rdi), %rax
movq %rax, -0x48(%rbp)
leaq 0x60(%rdi), %rax
movq %rax, -0x50(%rbp)
xorps %xmm0, %xmm0
movups %xmm0, 0x68(%rdi)
movups %xmm0, 0x58(%rdi)
movups %xmm0, 0x48(%rdi)
movups %xmm0, 0x38(%rdi)
movups %xmm0, 0x28(%rdi)
movups %xmm0, 0x18(%rdi)
pushq $0x4
popq %rdi
callq 0x10f0
movq %rax, 0x78(%r14)
movq 0x78(%rbx), %rax
movq %rax, 0x78(%r14)
pushq $0x4
popq %rdi
callq 0x10f0
movq %rax, 0x80(%r14)
movq 0x80(%rbx), %rax
movq %rax, 0x80(%r14)
pushq $0x4
popq %rdi
callq 0x10f0
movq %rax, 0x88(%r14)
movq 0x88(%rbx), %rax
movq %rax, 0x88(%r14)
pushq $0x4
popq %rdi
callq 0x10f0
movq %rax, 0x90(%r14)
movq 0x90(%rbx), %rax
movq %r14, -0x40(%rbp)
movq %rax, 0x90(%r14)
movq %rbx, -0x38(%rbp)
movq 0x18(%rbx), %r15
pushq $0x48
popq %rbx
leaq -0x68(%rbp), %r14
movq -0x38(%rbp), %rax
cmpq 0x20(%rax), %r15
je 0x560d
movq %rbx, %rdi
callq 0x10f0
movq %rax, %r12
movq (%r15), %rax
movl (%rax), %esi
movl 0x4(%rax), %edx
movq -0x40(%rbp), %rax
movq 0x90(%rax), %rax
movl (%rax), %ecx
movq %r12, %rdi
callq 0x610a
movq %r12, -0x68(%rbp)
movq (%r15), %rax
movl (%rax), %eax
movq -0x58(%rbp), %rdi
testl %eax, %eax
je 0x55f4
movq -0x48(%rbp), %rdi
cmpl $0x1, %eax
jne 0x55fc
movq %r14, %rsi
callq 0x226c
movq %r13, %rdi
movq %r14, %rsi
callq 0x226c
addq $0x8, %r15
jmp 0x55a8
movq %r13, -0x30(%rbp)
movq -0x38(%rbp), %r15
movq 0x60(%r15), %r13
cmpq 0x68(%r15), %r13
je 0x5705
movq (%r13), %rax
movq (%rax), %rcx
movq 0x8(%rax), %rax
movl 0x4(%rcx), %ebx
movl 0x4(%rax), %r15d
pushq $0x48
popq %rdi
callq 0x10f0
movq %rax, %r14
movq %rax, %rdi
callq 0x60f4
pushq $0x48
popq %rdi
callq 0x10f0
movq %rax, %r12
movq %rax, %rdi
callq 0x60f4
movq -0x40(%rbp), %rcx
movq 0x18(%rcx), %rax
movq 0x20(%rcx), %rcx
xorl %edx, %edx
xorl %esi, %esi
cmpq %rcx, %rax
je 0x56ab
movq (%rax), %r8
movl 0x4(%r8), %edi
cmpl %ebx, %edi
jne 0x5680
movq %r8, %r14
jmp 0x5695
cmpl %r15d, %edi
sete %dil
cmoveq %r8, %r12
orb %sil, %dil
testb $0x1, %dl
je 0x56a1
movl %edi, %esi
testb $0x1, %sil
jne 0x56ab
movb $0x1, %dl
xorl %edi, %edi
jmp 0x56a3
xorl %edx, %edx
addq $0x8, %rax
movl %edi, %esi
jmp 0x566b
pushq $0x28
popq %rdi
callq 0x10f0
movq -0x38(%rbp), %r15
movq %rax, %rbx
movq (%r13), %rax
movl 0x1c(%rax), %ecx
movq -0x40(%rbp), %rax
movq 0x90(%rax), %rax
movl (%rax), %r8d
movq %rbx, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x6216
movq %rbx, -0x60(%rbp)
movq (%r13), %rax
movsd 0x10(%rax), %xmm0
movsd %xmm0, 0x10(%rbx)
movq -0x50(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x2248
addq $0x8, %r13
jmp 0x5619
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x5759
movq %rax, %r15
pushq $0x48
popq %rsi
movq %r12, %rdi
jmp 0x5737
movq %rax, %r15
pushq $0x28
popq %rsi
movq %rbx, %rdi
jmp 0x5737
jmp 0x5750
movq %rax, %r15
pushq $0x48
popq %rsi
movq %r14, %rdi
callq 0x1100
jmp 0x5753
jmp 0x5750
movq %rax, %r15
pushq $0x48
popq %rsi
movq %r12, %rdi
callq 0x1100
jmp 0x575c
movq %rax, %r15
movq -0x30(%rbp), %r13
jmp 0x575c
movq %rax, %r15
movq -0x50(%rbp), %rdi
callq 0x2584
movq -0x48(%rbp), %rdi
callq 0x2546
movq -0x58(%rbp), %rdi
callq 0x2546
movq %r13, %rdi
callq 0x2546
movq %r15, %rdi
callq 0x1180
nop