// File: samuel500[P]NEAT/species.cpp
// Function: Species::is_compatible(Individual*)
bool Species::is_compatible(Individual *candidate){


	double delta = 0.;

	double N;
	// cout << "comp0" << endl;

	vector<Node*> rep_nodes = rep->nodes;
	// cout << "comp1" << endl;

	vector<Node*> cand_nodes = candidate->nodes;

	vector<Connection*> rep_cons = rep->connections;
	vector<Connection*> cand_cons = candidate->connections;

	N = max(rep_nodes.size()+rep_cons.size(), cand_nodes.size()+cand_nodes.size());

	// if(N<20) N = 1;

	sort(rep_nodes.begin(), rep_nodes.end(), nodePtr_compare);
	sort(cand_nodes.begin(), cand_nodes.end(), nodePtr_compare);

	sort(rep_cons.begin(), rep_cons.end(), consPtr_compare);
	sort(cand_cons.begin(), cand_cons.end(), consPtr_compare);

	int end_mark = max(rep_nodes[rep_nodes.size()-1]->hist_marking, max(cand_nodes[cand_nodes.size()-1]->hist_marking, max(rep_cons[rep_cons.size()-1]->hist_marking, cand_cons[cand_cons.size()-1]->hist_marking)));

	double E, D, W, nW;
	E=D=W=nW=0.;

	int rep_n_cursor, cand_n_cursor, rep_c_cursor, cand_c_cursor;
	rep_n_cursor=cand_n_cursor = rep->inputs.size()+rep->outputs.size(); // exclude input and output nodes, otherwise = 0;
	rep_c_cursor=cand_c_cursor = 0;

	int marking_cursor = rep_n_cursor; 

	int offset_n = 0; // 
	do{

		// todo: deal with case of no node (also no connection?)
		if((rep_n_cursor==rep_nodes.size() || cand_n_cursor==cand_nodes.size()) && (rep_c_cursor==rep_cons.size() || cand_c_cursor==cand_cons.size())) break; 
		else if(rep_n_cursor==rep_nodes.size() || cand_n_cursor==cand_nodes.size()) marking_cursor = min(rep_cons[rep_c_cursor]->hist_marking, cand_cons[cand_c_cursor]->hist_marking); 
		else if(rep_c_cursor==rep_cons.size() || cand_c_cursor==cand_cons.size()) marking_cursor = min(rep_nodes[rep_n_cursor]->hist_marking, cand_nodes[cand_n_cursor]->hist_marking);
		else marking_cursor = min(rep_nodes[rep_n_cursor]->hist_marking, min(cand_nodes[cand_n_cursor]->hist_marking, min(rep_cons[rep_c_cursor]->hist_marking, cand_cons[cand_c_cursor]->hist_marking)));

		if(rep_nodes[rep_n_cursor - offset_n]->hist_marking==marking_cursor || cand_nodes[cand_n_cursor - offset_n]->hist_marking==marking_cursor){

			if(rep_nodes[rep_n_cursor]->hist_marking != cand_nodes[cand_n_cursor]->hist_marking){
				D += 1.;
				if(rep_nodes[rep_n_cursor]->hist_marking <= cand_nodes[cand_n_cursor]->hist_marking) rep_n_cursor++;
				else cand_n_cursor++;
			}
			else{
				rep_n_cursor++;
				cand_n_cursor++;
			}
			if(rep_n_cursor==rep_nodes.size()){
				E += cand_nodes.size()-(double)cand_n_cursor;
				offset_n = 1;
			}
			else if(cand_n_cursor==cand_nodes.size()){
				E += rep_nodes.size()-(double)rep_n_cursor;
				offset_n = 1;
			}
		}
		else{

			if(rep_cons[rep_c_cursor]->hist_marking != cand_cons[cand_c_cursor]->hist_marking){
				D++;
				if(rep_cons[rep_c_cursor]->hist_marking <= cand_cons[cand_c_cursor]->hist_marking) rep_c_cursor++;
				else cand_c_cursor++;
			}
			else{

				W += abs((rep_cons[rep_c_cursor]->weight - cand_cons[cand_c_cursor]->weight));
				nW += 1;


				rep_c_cursor++;
				cand_c_cursor++;

			}
			if(rep_c_cursor==rep_cons.size()) E += cand_cons.size()-(double)cand_c_cursor;
			else if(cand_c_cursor==cand_cons.size()) E += rep_cons.size()-(double)rep_c_cursor;

		}
	}while(marking_cursor<end_mark);

	W = W/nW;

	delta = c1*E/N + c2*D/N +c3*W;

	if(delta>max_d)return false;
	else return true;

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x2a0, %rsp            # imm = 0x2A0
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x138(%rbp)
movq $0x0, -0x20(%rbp)
movq 0x18(%rax), %rsi
addq $0x18, %rsi
leaq -0x40(%rbp), %rdi
callq 0xdd20
movq -0x18(%rbp), %rsi
addq $0x18, %rsi
leaq -0x58(%rbp), %rdi
callq 0xdd20
jmp 0xc8ca
movq -0x138(%rbp), %rax
movq 0x18(%rax), %rsi
addq $0x60, %rsi
leaq -0x80(%rbp), %rdi
callq 0xde10
jmp 0xc8e4
movq -0x18(%rbp), %rsi
addq $0x60, %rsi
leaq -0x98(%rbp), %rdi
callq 0xde10
jmp 0xc8fa
leaq -0x40(%rbp), %rdi
callq 0x4070
movq %rax, -0x158(%rbp)
leaq -0x80(%rbp), %rdi
callq 0x4050
movq %rax, %rcx
movq -0x158(%rbp), %rax
addq %rcx, %rax
movq %rax, -0xa0(%rbp)
leaq -0x58(%rbp), %rdi
movq %rdi, -0x150(%rbp)
callq 0x4070
movq -0x150(%rbp), %rdi
movq %rax, -0x148(%rbp)
callq 0x4070
movq %rax, %rcx
movq -0x148(%rbp), %rax
addq %rcx, %rax
movq %rax, -0xa8(%rbp)
leaq -0xa0(%rbp), %rdi
leaq -0xa8(%rbp), %rsi
callq 0x5930
movq %rax, -0x140(%rbp)
jmp 0xc97a
movq -0x140(%rbp), %rax
movq (%rax), %xmm0
movaps 0x86f4(%rip), %xmm1     # 0x15080
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0x86f8(%rip), %xmm1     # 0x15090
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
movsd %xmm0, -0x28(%rbp)
leaq -0x40(%rbp), %rdi
movq %rdi, -0x160(%rbp)
callq 0x3a40
movq -0x160(%rbp), %rdi
movq %rax, -0xb0(%rbp)
callq 0x3ab0
movq %rax, -0xb8(%rbp)
movq -0xb0(%rbp), %rdi
movq -0xb8(%rbp), %rsi
leaq -0x29b(%rip), %rdx      # 0xc750
callq 0xdf00
jmp 0xc9f2
leaq -0x58(%rbp), %rdi
movq %rdi, -0x168(%rbp)
callq 0x3a40
movq -0x168(%rbp), %rdi
movq %rax, -0xc0(%rbp)
callq 0x3ab0
movq %rax, -0xc8(%rbp)
movq -0xc0(%rbp), %rdi
movq -0xc8(%rbp), %rsi
leaq -0x2e1(%rip), %rdx      # 0xc750
callq 0xdf00
jmp 0xca38
leaq -0x80(%rbp), %rdi
movq %rdi, -0x170(%rbp)
callq 0x1820
movq -0x170(%rbp), %rdi
movq %rax, -0xd0(%rbp)
callq 0x1890
movq %rax, -0xd8(%rbp)
movq -0xd0(%rbp), %rdi
movq -0xd8(%rbp), %rsi
leaq -0x2f7(%rip), %rdx      # 0xc780
callq 0xdf50
jmp 0xca7e
leaq -0x98(%rbp), %rdi
movq %rdi, -0x178(%rbp)
callq 0x1820
movq -0x178(%rbp), %rdi
movq %rax, -0xe0(%rbp)
callq 0x1890
movq %rax, -0xe8(%rbp)
movq -0xe0(%rbp), %rdi
movq -0xe8(%rbp), %rsi
leaq -0x340(%rip), %rdx      # 0xc780
callq 0xdf50
jmp 0xcac7
leaq -0x40(%rbp), %rdi
movq %rdi, -0x1b8(%rbp)
callq 0x4070
movq -0x1b8(%rbp), %rdi
movq %rax, %rsi
decq %rsi
callq 0xdfe0
movq (%rax), %rax
addq $0x4, %rax
movq %rax, -0x1b0(%rbp)
leaq -0x58(%rbp), %rdi
movq %rdi, -0x1a8(%rbp)
callq 0x4070
movq -0x1a8(%rbp), %rdi
movq %rax, %rsi
decq %rsi
callq 0xdfe0
movq (%rax), %rax
addq $0x4, %rax
movq %rax, -0x1a0(%rbp)
leaq -0x80(%rbp), %rdi
movq %rdi, -0x198(%rbp)
callq 0x4050
movq -0x198(%rbp), %rdi
movq %rax, %rsi
decq %rsi
callq 0xe000
movq (%rax), %rax
addq $0x1c, %rax
movq %rax, -0x188(%rbp)
leaq -0x98(%rbp), %rdi
movq %rdi, -0x190(%rbp)
callq 0x4050
movq -0x190(%rbp), %rdi
movq %rax, %rsi
decq %rsi
callq 0xe000
movq -0x188(%rbp), %rdi
movq (%rax), %rsi
addq $0x1c, %rsi
callq 0xdfa0
movq %rax, -0x180(%rbp)
jmp 0xcb98
movq -0x180(%rbp), %rsi
movq -0x1a0(%rbp), %rdi
callq 0xdfa0
movq %rax, -0x1c0(%rbp)
jmp 0xcbb4
movq -0x1c0(%rbp), %rsi
movq -0x1b0(%rbp), %rdi
callq 0xdfa0
movq %rax, -0x1c8(%rbp)
jmp 0xcbd0
movq -0x138(%rbp), %rax
movq -0x1c8(%rbp), %rcx
movl (%rcx), %ecx
movl %ecx, -0xec(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x110(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x108(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x100(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0xf8(%rbp)
movq 0x18(%rax), %rdi
addq $0x30, %rdi
callq 0x4070
movq %rax, %rcx
movq -0x138(%rbp), %rax
movq %rcx, -0x1d0(%rbp)
movq 0x18(%rax), %rdi
addq $0x48, %rdi
callq 0x4070
movq %rax, %rcx
movq -0x1d0(%rbp), %rax
addq %rcx, %rax
movl %eax, -0x118(%rbp)
movl %eax, -0x114(%rbp)
movl $0x0, -0x120(%rbp)
movl $0x0, -0x11c(%rbp)
movl -0x114(%rbp), %eax
movl %eax, -0x124(%rbp)
movl $0x0, -0x128(%rbp)
movslq -0x114(%rbp), %rax
movq %rax, -0x1d8(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x4070
movq %rax, %rcx
movq -0x1d8(%rbp), %rax
cmpq %rcx, %rax
je 0xccd0
movslq -0x118(%rbp), %rax
movq %rax, -0x1e0(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x4070
movq %rax, %rcx
movq -0x1e0(%rbp), %rax
cmpq %rcx, %rax
jne 0xcd74
movslq -0x11c(%rbp), %rax
movq %rax, -0x1e8(%rbp)
leaq -0x80(%rbp), %rdi
callq 0x4050
movq %rax, %rcx
movq -0x1e8(%rbp), %rax
cmpq %rcx, %rax
je 0xcd1f
movslq -0x120(%rbp), %rax
movq %rax, -0x1f0(%rbp)
leaq -0x98(%rbp), %rdi
callq 0x4050
movq %rax, %rcx
movq -0x1f0(%rbp), %rax
cmpq %rcx, %rax
jne 0xcd74
jmp 0xd42a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0xd4fc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0xd4f3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0xd4ea
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x98(%rbp), %rdi
callq 0x3e70
jmp 0xd4ea
movslq -0x114(%rbp), %rax
movq %rax, -0x1f8(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x4070
movq %rax, %rcx
movq -0x1f8(%rbp), %rax
cmpq %rcx, %rax
je 0xcdc0
movslq -0x118(%rbp), %rax
movq %rax, -0x200(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x4070
movq %rax, %rcx
movq -0x200(%rbp), %rax
cmpq %rcx, %rax
jne 0xce21
movslq -0x11c(%rbp), %rsi
leaq -0x80(%rbp), %rdi
callq 0xe000
movq (%rax), %rax
addq $0x1c, %rax
movq %rax, -0x210(%rbp)
movslq -0x120(%rbp), %rsi
leaq -0x98(%rbp), %rdi
callq 0xe000
movq -0x210(%rbp), %rdi
movq (%rax), %rsi
addq $0x1c, %rsi
callq 0xe020
movq %rax, -0x208(%rbp)
jmp 0xce0d
movq -0x208(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x124(%rbp)
jmp 0xcfa0
movslq -0x11c(%rbp), %rax
movq %rax, -0x218(%rbp)
leaq -0x80(%rbp), %rdi
callq 0x4050
movq %rax, %rcx
movq -0x218(%rbp), %rax
cmpq %rcx, %rax
je 0xce70
movslq -0x120(%rbp), %rax
movq %rax, -0x220(%rbp)
leaq -0x98(%rbp), %rdi
callq 0x4050
movq %rax, %rcx
movq -0x220(%rbp), %rax
cmpq %rcx, %rax
jne 0xcece
movslq -0x114(%rbp), %rsi
leaq -0x40(%rbp), %rdi
callq 0xdfe0
movq (%rax), %rax
addq $0x4, %rax
movq %rax, -0x230(%rbp)
movslq -0x118(%rbp), %rsi
leaq -0x58(%rbp), %rdi
callq 0xdfe0
movq -0x230(%rbp), %rdi
movq (%rax), %rsi
addq $0x4, %rsi
callq 0xe020
movq %rax, -0x228(%rbp)
jmp 0xceba
movq -0x228(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x124(%rbp)
jmp 0xcf9e
movslq -0x114(%rbp), %rsi
leaq -0x40(%rbp), %rdi
callq 0xdfe0
movq (%rax), %rax
addq $0x4, %rax
movq %rax, -0x250(%rbp)
movslq -0x118(%rbp), %rsi
leaq -0x58(%rbp), %rdi
callq 0xdfe0
movq (%rax), %rax
addq $0x4, %rax
movq %rax, -0x248(%rbp)
movslq -0x11c(%rbp), %rsi
leaq -0x80(%rbp), %rdi
callq 0xe000
movq (%rax), %rax
addq $0x1c, %rax
movq %rax, -0x240(%rbp)
movslq -0x120(%rbp), %rsi
leaq -0x98(%rbp), %rdi
callq 0xe000
movq -0x240(%rbp), %rdi
movq (%rax), %rsi
addq $0x1c, %rsi
callq 0xe020
movq %rax, -0x238(%rbp)
jmp 0xcf57
movq -0x238(%rbp), %rsi
movq -0x248(%rbp), %rdi
callq 0xe020
movq %rax, -0x258(%rbp)
jmp 0xcf73
movq -0x258(%rbp), %rsi
movq -0x250(%rbp), %rdi
callq 0xe020
movq %rax, -0x260(%rbp)
jmp 0xcf8f
movq -0x260(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x124(%rbp)
jmp 0xcfa0
jmp 0xcfa2
movl -0x114(%rbp), %eax
subl -0x128(%rbp), %eax
movslq %eax, %rsi
leaq -0x40(%rbp), %rdi
callq 0xdfe0
movq (%rax), %rax
movl 0x4(%rax), %eax
cmpl -0x124(%rbp), %eax
je 0xcff2
movl -0x118(%rbp), %eax
subl -0x128(%rbp), %eax
movslq %eax, %rsi
leaq -0x58(%rbp), %rdi
callq 0xdfe0
movq (%rax), %rax
movl 0x4(%rax), %eax
cmpl -0x124(%rbp), %eax
jne 0xd1c5
movslq -0x114(%rbp), %rsi
leaq -0x40(%rbp), %rdi
callq 0xdfe0
movq (%rax), %rax
movl 0x4(%rax), %eax
movl %eax, -0x264(%rbp)
movslq -0x118(%rbp), %rsi
leaq -0x58(%rbp), %rdi
callq 0xdfe0
movq %rax, %rcx
movl -0x264(%rbp), %eax
movq (%rcx), %rcx
cmpl 0x4(%rcx), %eax
je 0xd0a6
movsd 0x8021(%rip), %xmm0     # 0x15058
addsd -0x100(%rbp), %xmm0
movsd %xmm0, -0x100(%rbp)
movslq -0x114(%rbp), %rsi
leaq -0x40(%rbp), %rdi
callq 0xdfe0
movq (%rax), %rax
movl 0x4(%rax), %eax
movl %eax, -0x268(%rbp)
movslq -0x118(%rbp), %rsi
leaq -0x58(%rbp), %rdi
callq 0xdfe0
movq %rax, %rcx
movl -0x268(%rbp), %eax
movq (%rcx), %rcx
cmpl 0x4(%rcx), %eax
jg 0xd095
movl -0x114(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x114(%rbp)
jmp 0xd0a4
movl -0x118(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x118(%rbp)
jmp 0xd0c4
movl -0x114(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x114(%rbp)
movl -0x118(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x118(%rbp)
movslq -0x114(%rbp), %rax
movq %rax, -0x270(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x4070
movq %rax, %rcx
movq -0x270(%rbp), %rax
cmpq %rcx, %rax
jne 0xd142
leaq -0x58(%rbp), %rdi
callq 0x4070
movq %rax, %xmm0
movaps 0x7f81(%rip), %xmm1     # 0x15080
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0x7f85(%rip), %xmm1     # 0x15090
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
cvtsi2sdl -0x118(%rbp), %xmm1
subsd %xmm1, %xmm0
addsd -0xf8(%rbp), %xmm0
movsd %xmm0, -0xf8(%rbp)
movl $0x1, -0x128(%rbp)
jmp 0xd1c0
movslq -0x118(%rbp), %rax
movq %rax, -0x278(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x4070
movq %rax, %rcx
movq -0x278(%rbp), %rax
cmpq %rcx, %rax
jne 0xd1be
leaq -0x40(%rbp), %rdi
callq 0x4070
movq %rax, %xmm0
movaps 0x7f03(%rip), %xmm1     # 0x15080
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0x7f07(%rip), %xmm1     # 0x15090
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
cvtsi2sdl -0x114(%rbp), %xmm1
subsd %xmm1, %xmm0
addsd -0xf8(%rbp), %xmm0
movsd %xmm0, -0xf8(%rbp)
movl $0x1, -0x128(%rbp)
jmp 0xd1c0
jmp 0xd416
movslq -0x11c(%rbp), %rsi
leaq -0x80(%rbp), %rdi
callq 0xe000
movq (%rax), %rax
movl 0x1c(%rax), %eax
movl %eax, -0x27c(%rbp)
movslq -0x120(%rbp), %rsi
leaq -0x98(%rbp), %rdi
callq 0xe000
movq %rax, %rcx
movl -0x27c(%rbp), %eax
movq (%rcx), %rcx
cmpl 0x1c(%rcx), %eax
je 0xd282
movsd 0x7e4b(%rip), %xmm0     # 0x15058
addsd -0x100(%rbp), %xmm0
movsd %xmm0, -0x100(%rbp)
movslq -0x11c(%rbp), %rsi
leaq -0x80(%rbp), %rdi
callq 0xe000
movq (%rax), %rax
movl 0x1c(%rax), %eax
movl %eax, -0x280(%rbp)
movslq -0x120(%rbp), %rsi
leaq -0x98(%rbp), %rdi
callq 0xe000
movq %rax, %rcx
movl -0x280(%rbp), %eax
movq (%rcx), %rcx
cmpl 0x1c(%rcx), %eax
jg 0xd26e
movl -0x11c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x11c(%rbp)
jmp 0xd27d
movl -0x120(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x120(%rbp)
jmp 0xd326
movslq -0x11c(%rbp), %rsi
leaq -0x80(%rbp), %rdi
callq 0xe000
movq (%rax), %rax
movsd 0x10(%rax), %xmm0
movsd %xmm0, -0x290(%rbp)
movslq -0x120(%rbp), %rsi
leaq -0x98(%rbp), %rdi
callq 0xe000
movsd -0x290(%rbp), %xmm0
movq (%rax), %rax
movsd 0x10(%rax), %xmm1
subsd %xmm1, %xmm0
callq 0x40e0
movsd %xmm0, -0x288(%rbp)
jmp 0xd2d8
movsd -0x288(%rbp), %xmm0
addsd -0x108(%rbp), %xmm0
movsd %xmm0, -0x108(%rbp)
movsd 0x7d60(%rip), %xmm0     # 0x15058
addsd -0x110(%rbp), %xmm0
movsd %xmm0, -0x110(%rbp)
movl -0x11c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x11c(%rbp)
movl -0x120(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x120(%rbp)
movslq -0x11c(%rbp), %rax
movq %rax, -0x298(%rbp)
leaq -0x80(%rbp), %rdi
callq 0x4050
movq %rax, %rcx
movq -0x298(%rbp), %rax
cmpq %rcx, %rax
jne 0xd39d
leaq -0x98(%rbp), %rdi
callq 0x4050
movq %rax, %xmm0
movaps 0x7d1c(%rip), %xmm1     # 0x15080
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0x7d20(%rip), %xmm1     # 0x15090
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
cvtsi2sdl -0x120(%rbp), %xmm1
subsd %xmm1, %xmm0
addsd -0xf8(%rbp), %xmm0
movsd %xmm0, -0xf8(%rbp)
jmp 0xd414
movslq -0x120(%rbp), %rax
movq %rax, -0x2a0(%rbp)
leaq -0x98(%rbp), %rdi
callq 0x4050
movq %rax, %rcx
movq -0x2a0(%rbp), %rax
cmpq %rcx, %rax
jne 0xd412
leaq -0x80(%rbp), %rdi
callq 0x4050
movq %rax, %xmm0
movaps 0x7ca5(%rip), %xmm1     # 0x15080
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0x7ca9(%rip), %xmm1     # 0x15090
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
cvtsi2sdl -0x11c(%rbp), %xmm1
subsd %xmm1, %xmm0
addsd -0xf8(%rbp), %xmm0
movsd %xmm0, -0xf8(%rbp)
jmp 0xd414
jmp 0xd416
jmp 0xd418
movl -0x124(%rbp), %eax
cmpl -0xec(%rbp), %eax
jl 0xcc80
movq -0x138(%rbp), %rax
movsd -0x108(%rbp), %xmm0
divsd -0x110(%rbp), %xmm0
movsd %xmm0, -0x108(%rbp)
movsd 0x20(%rax), %xmm1
mulsd -0xf8(%rbp), %xmm1
divsd -0x28(%rbp), %xmm1
movsd 0x28(%rax), %xmm0
mulsd -0x100(%rbp), %xmm0
divsd -0x28(%rbp), %xmm0
addsd %xmm0, %xmm1
movsd 0x30(%rax), %xmm0
movsd -0x108(%rbp), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x20(%rbp)
movsd -0x20(%rbp), %xmm0
ucomisd 0x38(%rax), %xmm0
jbe 0xd4a7
movb $0x0, -0x1(%rbp)
movl $0x1, -0x12c(%rbp)
jmp 0xd4b5
movb $0x1, -0x1(%rbp)
movl $0x1, -0x12c(%rbp)
leaq -0x98(%rbp), %rdi
callq 0x3e70
leaq -0x80(%rbp), %rdi
callq 0x3e70
leaq -0x58(%rbp), %rdi
callq 0x3ed0
leaq -0x40(%rbp), %rdi
callq 0x3ed0
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x2a0, %rsp            # imm = 0x2A0
popq %rbp
retq
leaq -0x80(%rbp), %rdi
callq 0x3e70
leaq -0x58(%rbp), %rdi
callq 0x3ed0
leaq -0x40(%rbp), %rdi
callq 0x3ed0
movq -0x60(%rbp), %rdi
callq 0x1180
nop