// File: 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
subq $0x130, %rsp            # imm = 0x130
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0xb0(%rbp)
addq $0x18, %rdi
movq %rdi, -0xc8(%rbp)
callq 0x3950
movq -0xb0(%rbp), %rdi
addq $0x30, %rdi
movq %rdi, -0xc0(%rbp)
callq 0x3950
movq -0xb0(%rbp), %rdi
addq $0x48, %rdi
movq %rdi, -0xb8(%rbp)
callq 0x3950
movq -0xb0(%rbp), %rdi
addq $0x60, %rdi
movq %rdi, -0xa8(%rbp)
callq 0x3970
movl $0x4, %edi
callq 0x10e0
movq %rax, -0xa0(%rbp)
jmp 0x11696
movq -0xb0(%rbp), %rax
movq -0xa0(%rbp), %rcx
movq %rcx, 0x78(%rax)
movq -0x10(%rbp), %rcx
movq 0x78(%rcx), %rcx
movq %rcx, 0x78(%rax)
movl $0x4, %edi
callq 0x10e0
movq %rax, -0xd0(%rbp)
jmp 0x116c7
movq -0xb0(%rbp), %rax
movq -0xd0(%rbp), %rcx
movq %rcx, 0x80(%rax)
movq -0x10(%rbp), %rcx
movq 0x80(%rcx), %rcx
movq %rcx, 0x80(%rax)
movl $0x4, %edi
callq 0x10e0
movq %rax, -0xd8(%rbp)
jmp 0x11701
movq -0xb0(%rbp), %rax
movq -0xd8(%rbp), %rcx
movq %rcx, 0x88(%rax)
movq -0x10(%rbp), %rcx
movq 0x88(%rcx), %rcx
movq %rcx, 0x88(%rax)
movl $0x4, %edi
callq 0x10e0
movq %rax, -0xe0(%rbp)
jmp 0x1173b
movq -0xb0(%rbp), %rax
movq -0xe0(%rbp), %rcx
movq %rcx, 0x90(%rax)
movq -0x10(%rbp), %rcx
movq 0x90(%rcx), %rcx
movq %rcx, 0x90(%rax)
leaq -0x30(%rbp), %rdi
callq 0x12a70
movq -0x10(%rbp), %rdi
addq $0x18, %rdi
callq 0xe260
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rdi
addq $0x18, %rdi
callq 0xe290
movq %rax, -0x40(%rbp)
leaq -0x30(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x12a90
testb $0x1, %al
jne 0x117ab
jmp 0x118ca
movl $0x48, %edi
callq 0x10e0
movq %rax, -0xe8(%rbp)
jmp 0x117be
leaq -0x30(%rbp), %rdi
movq %rdi, -0xf8(%rbp)
callq 0x12ad0
movq -0xf8(%rbp), %rdi
movq (%rax), %rax
movl (%rax), %eax
movl %eax, -0xec(%rbp)
callq 0x12ad0
movq -0xe8(%rbp), %rdi
movl -0xec(%rbp), %esi
movq %rax, %rcx
movq -0xb0(%rbp), %rax
movq (%rcx), %rcx
movl 0x4(%rcx), %edx
movq 0x90(%rax), %rax
movl (%rax), %ecx
callq 0x13870
jmp 0x11812
movq -0xe8(%rbp), %rax
movq %rax, -0x28(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x12ad0
movq (%rax), %rax
cmpl $0x1, (%rax)
jne 0x11879
movq -0xb0(%rbp), %rdi
addq $0x48, %rdi
leaq -0x28(%rbp), %rsi
callq 0x3ae0
jmp 0x11844
jmp 0x118a4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x11ba1
movq -0xe8(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
movl $0x48, %esi
callq 0x10f0
jmp 0x11ba1
leaq -0x30(%rbp), %rdi
callq 0x12ad0
movq (%rax), %rax
cmpl $0x0, (%rax)
jne 0x118a2
movq -0xb0(%rbp), %rdi
addq $0x30, %rdi
leaq -0x28(%rbp), %rsi
callq 0x3ae0
jmp 0x118a0
jmp 0x118a2
jmp 0x118a4
movq -0xb0(%rbp), %rdi
addq $0x18, %rdi
leaq -0x28(%rbp), %rsi
callq 0x3ae0
jmp 0x118ba
jmp 0x118bc
leaq -0x30(%rbp), %rdi
callq 0x12af0
jmp 0x11784
leaq -0x48(%rbp), %rdi
callq 0x12b10
movq -0x10(%rbp), %rdi
addq $0x60, %rdi
callq 0xe720
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rdi
addq $0x60, %rdi
callq 0xe750
movq %rax, -0x58(%rbp)
leaq -0x48(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x12b30
testb $0x1, %al
jne 0x11913
jmp 0x11b98
leaq -0x48(%rbp), %rdi
movq %rdi, -0x108(%rbp)
callq 0x12b70
movq -0x108(%rbp), %rdi
movq (%rax), %rax
movq (%rax), %rax
movl 0x4(%rax), %eax
movl %eax, -0x5c(%rbp)
callq 0x12b70
movq (%rax), %rax
movq 0x8(%rax), %rax
movl 0x4(%rax), %eax
movl %eax, -0x60(%rbp)
movl $0x48, %edi
callq 0x10e0
movq %rax, -0x100(%rbp)
jmp 0x1195b
movq -0x100(%rbp), %rdi
callq 0x13840
jmp 0x11969
movq -0x100(%rbp), %rax
movq %rax, -0x68(%rbp)
movl $0x48, %edi
callq 0x10e0
movq %rax, -0x110(%rbp)
jmp 0x11987
movq -0x110(%rbp), %rdi
callq 0x13840
jmp 0x11995
movq -0xb0(%rbp), %rdi
movq -0x110(%rbp), %rax
movq %rax, -0x70(%rbp)
movb $0x0, -0x71(%rbp)
movb $0x0, -0x72(%rbp)
addq $0x18, %rdi
callq 0x3a40
movq %rax, -0x88(%rbp)
leaq -0x80(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0x12b90
movq -0x80(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0xb0(%rbp), %rdi
addq $0x18, %rdi
callq 0x3ab0
movq %rax, -0x90(%rbp)
leaq -0x30(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x12bd0
testb $0x1, %al
jne 0x11a07
jmp 0x11abd
leaq -0x30(%rbp), %rdi
callq 0x12ad0
movq (%rax), %rax
movl 0x4(%rax), %eax
cmpl -0x5c(%rbp), %eax
jne 0x11a75
leaq -0x30(%rbp), %rdi
callq 0x12ad0
movq (%rax), %rax
movq %rax, -0x68(%rbp)
movb $0x1, -0x71(%rbp)
jmp 0x11a9f
movq -0x100(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
movl $0x48, %esi
callq 0x10f0
jmp 0x11ba1
movq -0x110(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
movl $0x48, %esi
callq 0x10f0
jmp 0x11ba1
leaq -0x30(%rbp), %rdi
callq 0x12ad0
movq (%rax), %rax
movl 0x4(%rax), %eax
cmpl -0x60(%rbp), %eax
jne 0x11a9d
leaq -0x30(%rbp), %rdi
callq 0x12ad0
movq (%rax), %rax
movq %rax, -0x70(%rbp)
movb $0x1, -0x72(%rbp)
jmp 0x11a9f
testb $0x1, -0x71(%rbp)
je 0x11aad
testb $0x1, -0x72(%rbp)
je 0x11aad
jmp 0x11abd
jmp 0x11aaf
leaq -0x30(%rbp), %rdi
callq 0x12af0
jmp 0x119d7
movl $0x28, %edi
callq 0x10e0
movq %rax, -0x118(%rbp)
jmp 0x11ad0
movq -0x68(%rbp), %rax
movq %rax, -0x128(%rbp)
movq -0x70(%rbp), %rax
movq %rax, -0x120(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x12b70
movq -0x118(%rbp), %rdi
movq -0x128(%rbp), %rsi
movq -0x120(%rbp), %rdx
movq %rax, %rcx
movq -0xb0(%rbp), %rax
movq (%rcx), %rcx
movl 0x1c(%rcx), %ecx
movq 0x90(%rax), %rax
movl (%rax), %r8d
callq 0x13b20
jmp 0x11b25
movq -0x118(%rbp), %rax
movq %rax, -0x98(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x12b70
movq -0xb0(%rbp), %rdi
movq (%rax), %rax
movsd 0x10(%rax), %xmm0
movq -0x98(%rbp), %rax
movsd %xmm0, 0x10(%rax)
addq $0x60, %rdi
leaq -0x98(%rbp), %rsi
callq 0x39d0
jmp 0x11b69
jmp 0x11b6b
leaq -0x48(%rbp), %rdi
callq 0x12c10
jmp 0x118ec
movq -0x118(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
movl $0x28, %esi
callq 0x10f0
jmp 0x11ba1
addq $0x130, %rsp            # imm = 0x130
popq %rbp
retq
movq -0xa8(%rbp), %rdi
callq 0x3e70
movq -0xb8(%rbp), %rdi
callq 0x3ed0
movq -0xc0(%rbp), %rdi
callq 0x3ed0
movq -0xc8(%rbp), %rdi
callq 0x3ed0
movq -0x18(%rbp), %rdi
callq 0x1180
nopw (%rax,%rax)