// File: /workspace/github_cpp_makefile_star2_O3/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, %r14
movq %rdi, %rbx
leaq 0x18(%rdi), %rax
movq %rax, -0x58(%rbp)
leaq 0x30(%rdi), %rax
movq %rax, -0x48(%rbp)
leaq 0x48(%rdi), %rax
movq %rax, -0x40(%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)
movl $0x4, %edi
callq 0x1100
movq %rax, 0x78(%rbx)
movq 0x78(%r14), %rax
movq %rax, 0x78(%rbx)
movl $0x4, %edi
callq 0x1100
movq %rax, 0x80(%rbx)
movq 0x80(%r14), %rax
movq %rax, 0x80(%rbx)
movl $0x4, %edi
callq 0x1100
movq %rax, 0x88(%rbx)
movq 0x88(%r14), %rax
movq %rax, 0x88(%rbx)
movl $0x4, %edi
callq 0x1100
leaq 0x60(%rbx), %rcx
movq %rcx, -0x50(%rbp)
movq %rax, 0x90(%rbx)
movq 0x90(%r14), %rax
movq %rbx, -0x30(%rbp)
movq %rax, 0x90(%rbx)
movq 0x18(%r14), %rbx
movq %r14, -0x38(%rbp)
cmpq 0x20(%r14), %rbx
je 0x58b4
movq -0x30(%rbp), %rax
leaq 0x38(%rax), %r15
leaq 0x50(%rax), %r12
leaq -0x60(%rbp), %r14
movl $0x48, %edi
callq 0x1100
movq %rax, %r13
movq (%rbx), %rax
movl (%rax), %esi
movl 0x4(%rax), %edx
movq -0x30(%rbp), %rax
movq 0x90(%rax), %rax
movl (%rax), %ecx
movq %r13, %rdi
callq 0x6512
movq %r13, -0x60(%rbp)
movq (%rbx), %rax
movl (%rax), %eax
testl %eax, %eax
je 0x585d
cmpl $0x1, %eax
jne 0x587a
movq -0x30(%rbp), %rcx
movq 0x50(%rcx), %rsi
movq -0x40(%rbp), %rdi
movq %r12, %rax
cmpq 0x58(%rcx), %rsi
je 0x5872
movq %r13, (%rsi)
addq $0x8, (%rax)
jmp 0x587a
movq -0x30(%rbp), %rcx
movq 0x38(%rcx), %rsi
movq -0x48(%rbp), %rdi
movq %r15, %rax
cmpq 0x40(%rcx), %rsi
jne 0x5854
movq %r14, %rdx
callq 0x2cfe
movq -0x30(%rbp), %rcx
movq 0x20(%rcx), %rsi
cmpq 0x28(%rcx), %rsi
je 0x5896
movq -0x60(%rbp), %rax
movq %rax, (%rsi)
addq $0x8, 0x20(%rcx)
jmp 0x58a2
movq -0x58(%rbp), %rdi
movq %r14, %rdx
callq 0x2cfe
addq $0x8, %rbx
movq -0x38(%rbp), %rax
cmpq 0x20(%rax), %rbx
jne 0x5803
movq -0x38(%rbp), %rax
movq 0x60(%rax), %r12
cmpq 0x68(%rax), %r12
je 0x59c6
movq (%r12), %rax
movq (%rax), %rcx
movq 0x8(%rax), %rax
movl 0x4(%rcx), %r15d
movl 0x4(%rax), %ebx
movl $0x48, %edi
callq 0x1100
movq %rax, %r14
movq %rax, %rdi
callq 0x64fc
movl $0x48, %edi
callq 0x1100
movq %rax, %r13
movq %rax, %rdi
callq 0x64fc
movq -0x30(%rbp), %rcx
movq 0x18(%rcx), %rax
movq 0x20(%rcx), %rcx
cmpq %rcx, %rax
je 0x5955
xorl %esi, %esi
xorl %edx, %edx
movq (%rax), %r8
movl 0x4(%r8), %edi
cmpl %r15d, %edi
jne 0x5928
movq %r8, %r14
jmp 0x593c
cmpl %ebx, %edi
sete %dil
cmoveq %r8, %r13
orb %sil, %dil
testb $0x1, %dl
je 0x5948
movl %edi, %esi
testb $0x1, %sil
jne 0x5955
movb $0x1, %dl
xorl %edi, %edi
jmp 0x594a
xorl %edx, %edx
addq $0x8, %rax
movl %edi, %esi
cmpq %rcx, %rax
jne 0x5917
movl $0x28, %edi
callq 0x1100
movq %rax, %r15
movq (%r12), %rax
movl 0x1c(%rax), %ecx
movq -0x30(%rbp), %rbx
movq 0x90(%rbx), %rax
movl (%rax), %r8d
movq %r15, %rdi
movq %r14, %rsi
movq %r13, %rdx
callq 0x666a
movq %r15, -0x68(%rbp)
movq (%r12), %rax
movsd 0x10(%rax), %xmm0
movsd %xmm0, 0x10(%r15)
movq 0x68(%rbx), %rsi
cmpq 0x70(%rbx), %rsi
je 0x59ac
movq %r15, (%rsi)
addq $0x8, 0x68(%rbx)
jmp 0x59b9
movq -0x50(%rbp), %rdi
leaq -0x68(%rbp), %rdx
callq 0x2bbe
addq $0x8, %r12
movq -0x38(%rbp), %rax
jmp 0x58bc
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r12
jmp 0x5a2d
movq %rax, %r12
movl $0x48, %esi
movq %r14, %rdi
jmp 0x5a05
jmp 0x5a0e
jmp 0x59fa
movq %rax, %r12
movl $0x28, %esi
movq %r15, %rdi
jmp 0x5a05
jmp 0x5a0e
movq %rax, %r12
movl $0x48, %esi
movq %r13, %rdi
callq 0x1110
jmp 0x5a11
jmp 0x5a0e
movq %rax, %r12
movq -0x50(%rbp), %rax
movq (%rax), %rdi
testq %rdi, %rdi
movq -0x30(%rbp), %rbx
je 0x5a2d
movq 0x70(%rbx), %rsi
subq %rdi, %rsi
callq 0x1110
movq -0x40(%rbp), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0x5a45
movq 0x58(%rbx), %rsi
subq %rdi, %rsi
callq 0x1110
movq -0x48(%rbp), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0x5a5d
movq 0x40(%rbx), %rsi
subq %rdi, %rsi
callq 0x1110
movq -0x58(%rbp), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0x5a75
movq 0x28(%rbx), %rsi
subq %rdi, %rsi
callq 0x1110
movq %r12, %rdi
callq 0x11a0
nop