// File: /workspace/github_cpp_makefile_star2_O1/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)
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)
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
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 0x59b0
movq -0x30(%rbp), %rax
leaq 0x38(%rax), %r12
leaq 0x50(%rax), %r13
leaq -0x60(%rbp), %r14
movl $0x48, %edi
callq 0x1100
movq %rax, %r15
movq (%rbx), %rax
movl (%rax), %esi
movl 0x4(%rax), %edx
movq -0x30(%rbp), %rax
movq 0x90(%rax), %rax
movl (%rax), %ecx
movq %r15, %rdi
callq 0x664e
movq %r15, -0x60(%rbp)
movq (%rbx), %rax
movl (%rax), %eax
testl %eax, %eax
je 0x5959
cmpl $0x1, %eax
jne 0x5976
movq -0x30(%rbp), %rcx
movq 0x50(%rcx), %rsi
movq -0x40(%rbp), %rdi
movq %r13, %rax
cmpq 0x58(%rcx), %rsi
je 0x596e
movq %r15, (%rsi)
addq $0x8, (%rax)
jmp 0x5976
movq -0x30(%rbp), %rcx
movq 0x38(%rcx), %rsi
movq -0x48(%rbp), %rdi
movq %r12, %rax
cmpq 0x40(%rcx), %rsi
jne 0x5950
movq %r14, %rdx
callq 0x2d18
movq -0x30(%rbp), %rcx
movq 0x20(%rcx), %rsi
cmpq 0x28(%rcx), %rsi
je 0x5992
movq -0x60(%rbp), %rax
movq %rax, (%rsi)
addq $0x8, 0x20(%rcx)
jmp 0x599e
movq -0x58(%rbp), %rdi
movq %r14, %rdx
callq 0x2d18
addq $0x8, %rbx
movq -0x38(%rbp), %rax
cmpq 0x20(%rax), %rbx
jne 0x58ff
movq -0x38(%rbp), %rax
movq 0x60(%rax), %r12
cmpq 0x68(%rax), %r12
je 0x5abe
movq (%r12), %rax
movq (%rax), %rcx
movq 0x8(%rax), %rax
movl 0x4(%rcx), %r13d
movl 0x4(%rax), %ebx
movl $0x48, %edi
callq 0x1100
movq %rax, %r14
movq %rax, %rdi
callq 0x6638
movl $0x48, %edi
callq 0x1100
movq %rax, %r15
movq %rax, %rdi
callq 0x6638
movq -0x30(%rbp), %rcx
movq 0x18(%rcx), %rax
movq 0x20(%rcx), %rcx
cmpq %rcx, %rax
je 0x5a4d
xorl %edx, %edx
xorl %esi, %esi
movq (%rax), %rdi
movl 0x4(%rdi), %r8d
cmpl %r13d, %r8d
jne 0x5a27
movq %rdi, %r14
movb $0x1, %sil
jmp 0x5a39
cmpl %ebx, %r8d
cmoveq %rdi, %r15
movzbl %dl, %edx
movl $0x1, %edi
cmovel %edi, %edx
testb $0x1, %sil
je 0x5a44
testb $0x1, %dl
jne 0x5a4d
addq $0x8, %rax
cmpq %rcx, %rax
jne 0x5a13
movl $0x28, %edi
callq 0x1100
movq %rax, %r13
movq (%r12), %rax
movl 0x1c(%rax), %ecx
movq -0x30(%rbp), %rbx
movq 0x90(%rbx), %rax
movl (%rax), %r8d
movq %r13, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x67b6
movq %r13, -0x68(%rbp)
movq (%r12), %rax
movsd 0x10(%rax), %xmm0
movsd %xmm0, 0x10(%r13)
movq 0x68(%rbx), %rsi
cmpq 0x70(%rbx), %rsi
je 0x5aa4
movq %r13, (%rsi)
addq $0x8, 0x68(%rbx)
jmp 0x5ab1
movq -0x50(%rbp), %rdi
leaq -0x68(%rbp), %rdx
callq 0x2bd8
addq $0x8, %r12
movq -0x38(%rbp), %rax
jmp 0x59b8
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r12
jmp 0x5b0d
movq %rax, %r12
movl $0x48, %esi
movq %r14, %rdi
jmp 0x5afd
jmp 0x5b06
jmp 0x5af2
movq %rax, %r12
movl $0x28, %esi
movq %r13, %rdi
jmp 0x5afd
jmp 0x5b06
movq %rax, %r12
movl $0x48, %esi
movq %r15, %rdi
callq 0x1110
jmp 0x5b09
jmp 0x5b06
movq %rax, %r12
movq -0x30(%rbp), %rbx
movq -0x50(%rbp), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0x5b25
movq 0x70(%rbx), %rsi
subq %rdi, %rsi
callq 0x1110
movq -0x40(%rbp), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0x5b3d
movq 0x58(%rbx), %rsi
subq %rdi, %rsi
callq 0x1110
movq -0x48(%rbp), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0x5b55
movq 0x40(%rbx), %rsi
subq %rdi, %rsi
callq 0x1110
movq -0x58(%rbp), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0x5b6d
movq 0x28(%rbx), %rsi
subq %rdi, %rsi
callq 0x1110
movq %r12, %rdi
callq 0x11a0
nop