// File: big-data-lab-team[P]OrpailleCC/./src/mondrian_coarse.hpp
// Function: CoarseMondrianForest<double, funct, KappaMetrics<2, false>, 4, 2, 6000>::extend_block0(int, int, double const*, int)
void extend_block0(int const node_id, int const tree_id, feature_type const* features, int const label){
	//e_lower and e_upper are used to compute probabilities
	feature_type e_lower[feature_count], e_upper[feature_count];
	double probabilities[feature_count];
	Node& node = nodes()[node_id];
	int const parent_id = node.parent;
	double const parent_tau = node.parent >= 0 ? nodes()[node.parent].tau : 0; //The tau value of the parent of the root is 0
	//sum is used as a parameter to pick random numbers following exponential law
	feature_type sum = 0;
	//compute e_lower, e_upper and sum
	for(int i = 0; i < feature_count; ++i){
		e_lower[i] = node.bound_lower[i] - features[i] > 0 ? node.bound_lower[i] - features[i] : 0;
		e_upper[i] = features[i] - node.bound_upper[i] > 0 ? features[i] - node.bound_upper[i] : 0;
		probabilities[i] = e_lower[i] + e_upper[i];
		sum += e_lower[i] + e_upper[i];
	}
	//Pick a random number following an exponential law of parameter *sum* (except if sum is 0)
	double const E = sum == 0 ?  -1 : Utils::rand_exponential<func>(sum);
	bool update_box = false;

	bool pause_expension = false;
	if((tree_management == COBBLE_MANAGEMENT || tree_management == OPTIMISTIC_COBBLE_MANAGEMENT)){
		int const remaining_depth = node_depth(node_id, nullptr);
		int const distance_to_root = unravel(node_id);
		pause_expension = remaining_depth + distance_to_root + 1 > tree_bases()[tree_id].node_count_limit;
	}
	else{
		pause_expension = tree_bases()[tree_id].is_paused(tree_management);
		//PAUSE
		//pause_expension = ((total_count >= 20 && total_count <= 150));
	}

	if(E >= 0 && parent_tau + E < node.tau && node_available >= 2 && !pause_expension){//Introduce a new parent and a new sibling
		Utils::turn_array_into_probability(probabilities, feature_count, sum);
		//sample features with probability proportional to e_lower[i] + e_upper[i]
		int const dimension = Utils::pick_from_distribution<func>(probabilities, feature_count);

		//Select the bound to choose the split from
		double lower_value, upper_value;
		if(features[dimension] > node.bound_upper[dimension]){
			lower_value = node.bound_upper[dimension];
			upper_value = features[dimension];
		}
		else if(features[dimension] < node.bound_lower[dimension]){
			lower_value = features[dimension];
			upper_value = node.bound_lower[dimension];
		}

		//sample the split between [lower_value, upper_value]
		double const split_value = func::rand_uniform()*(upper_value - lower_value) + lower_value;
		int new_parent, new_sibling;
		//insert new node above the current one
		new_parent = available_node();
		nodes()[new_parent].split_dimension = dimension;
		nodes()[new_parent].split_value = split_value;
		nodes()[new_parent].tau = parent_tau + E;
		//insert new leaf, sibbling of the current one
		new_sibling = available_node();
		node_available -= 2;

		//Update the box of the new parent
		for(int i = 0; i < feature_count; ++i){
			nodes()[new_parent].bound_lower[i] = features[i] < node.bound_lower[i] ? features[i] : node.bound_lower[i];
			nodes()[new_parent].bound_upper[i] = features[i] > node.bound_upper[i] ? features[i] : node.bound_upper[i];
		}
		//NOTE Creates counters for the label of the new parent
		for(int i = 0; i < label_count; ++i)
			nodes()[new_parent].counters[i] = Utils::min(1, node.counters[i]);

		//Creates counters for the label of the new sibling
		for(int i = 0; i < label_count; ++i)
			nodes()[new_sibling].counters[i] = 0;
		//No need to increase the counter for the current label because we will call sample_block soon on new_sibling

		//Make the connections between the new nodes
		nodes()[new_parent].parent = node.parent;
		if(!node.has_parent() && node_id == tree_bases()[tree_id].root)//We introduce a parent to the root
			tree_bases()[tree_id].root = new_parent;
		else{
			Node& parent = nodes()[node.parent];
			if(parent.child_left == node_id)
				parent.child_left = new_parent;
			else
				parent.child_right = new_parent;
		}


		node.parent = new_parent;

		nodes()[new_sibling].parent = new_parent;
		if(features[dimension] == upper_value){ //right
			nodes()[new_parent].child_right = new_sibling;
			nodes()[new_parent].child_left = node_id;
		}
		else{ //left
			nodes()[new_parent].child_left = new_sibling;
			nodes()[new_parent].child_right = node_id;
		}
		//cout << "Split dimension " << dimension << " on " << split_value << "(total count: " << total_count << ")" << endl;

		sample_block(new_sibling, features, label);
	}
	else{ //Otherwise, just update the box
		//update lower bound and upper bound of this node
		for(int i = 0; i < feature_count; ++i){
			if(node.bound_lower[i] > features[i])
				node.bound_lower[i] = features[i];
			if(node.bound_upper[i] < features[i])
				node.bound_upper[i] = features[i];
		}
		//if not leaf, recurse on the node that contains the data point
		if(!node.is_leaf()){
			if(features[node.split_dimension] <= node.split_value)
				extend_block0(node.child_left, tree_id, features, label);
			else if(features[node.split_dimension] > node.split_value)
				extend_block0(node.child_right, tree_id, features, label);
			//NOTE: we don't update the counters of labels here because the counting will be done when prediction is required.
			//We can optimize that.
		}
		else{
			//Update the counter of label
			node.counters[label] += 1;
			node.fading_score += 1; //fading_score is decreased later on
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x190, %rsp            # imm = 0x190
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movq %rcx, -0x18(%rbp)
movl %r8d, -0x1c(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x108(%rbp)
callq 0x1b00
movslq -0xc(%rbp), %rcx
shlq $0x7, %rcx
addq %rcx, %rax
movq %rax, -0x88(%rbp)
movq -0x88(%rbp), %rax
movl 0x58(%rax), %eax
movl %eax, -0x8c(%rbp)
movq -0x88(%rbp), %rax
cmpl $0x0, 0x58(%rax)
jl 0x3b29
movq -0x108(%rbp), %rdi
callq 0x1b00
movq -0x88(%rbp), %rcx
movslq 0x58(%rcx), %rcx
shlq $0x7, %rcx
addq %rcx, %rax
movsd 0x60(%rax), %xmm0
movsd %xmm0, -0x110(%rbp)
jmp 0x3b36
xorps %xmm0, %xmm0
movsd %xmm0, -0x110(%rbp)
jmp 0x3b36
movsd -0x110(%rbp), %xmm0
movsd %xmm0, -0x98(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0xa0(%rbp)
movl $0x0, -0xa4(%rbp)
cmpl $0x4, -0xa4(%rbp)
jge 0x3cc7
movq -0x88(%rbp), %rax
movslq -0xa4(%rbp), %rcx
movsd 0x10(%rax,%rcx,8), %xmm0
movq -0x18(%rbp), %rax
movslq -0xa4(%rbp), %rcx
subsd (%rax,%rcx,8), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x3bc3
movq -0x88(%rbp), %rax
movslq -0xa4(%rbp), %rcx
movsd 0x10(%rax,%rcx,8), %xmm0
movq -0x18(%rbp), %rax
movslq -0xa4(%rbp), %rcx
subsd (%rax,%rcx,8), %xmm0
movsd %xmm0, -0x118(%rbp)
jmp 0x3bd0
xorps %xmm0, %xmm0
movsd %xmm0, -0x118(%rbp)
jmp 0x3bd0
movsd -0x118(%rbp), %xmm0
movslq -0xa4(%rbp), %rax
movsd %xmm0, -0x40(%rbp,%rax,8)
movq -0x18(%rbp), %rax
movslq -0xa4(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x88(%rbp), %rax
movslq -0xa4(%rbp), %rcx
subsd 0x30(%rax,%rcx,8), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x3c40
movq -0x18(%rbp), %rax
movslq -0xa4(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x88(%rbp), %rax
movslq -0xa4(%rbp), %rcx
subsd 0x30(%rax,%rcx,8), %xmm0
movsd %xmm0, -0x120(%rbp)
jmp 0x3c4d
xorps %xmm0, %xmm0
movsd %xmm0, -0x120(%rbp)
jmp 0x3c4d
movsd -0x120(%rbp), %xmm0
movslq -0xa4(%rbp), %rax
movsd %xmm0, -0x60(%rbp,%rax,8)
movslq -0xa4(%rbp), %rax
movsd -0x40(%rbp,%rax,8), %xmm0
movslq -0xa4(%rbp), %rax
addsd -0x60(%rbp,%rax,8), %xmm0
movslq -0xa4(%rbp), %rax
movsd %xmm0, -0x80(%rbp,%rax,8)
movslq -0xa4(%rbp), %rax
movsd -0x40(%rbp,%rax,8), %xmm0
movslq -0xa4(%rbp), %rax
addsd -0x60(%rbp,%rax,8), %xmm0
addsd -0xa0(%rbp), %xmm0
movsd %xmm0, -0xa0(%rbp)
movl -0xa4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xa4(%rbp)
jmp 0x3b5b
movsd -0xa0(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x3cec
jp 0x3cec
movsd 0x7346(%rip), %xmm0     # 0xb028
movsd %xmm0, -0x128(%rbp)
jmp 0x3d01
movsd -0xa0(%rbp), %xmm0
callq 0x70e0
movsd %xmm0, -0x128(%rbp)
movq -0x108(%rbp), %rax
movsd -0x128(%rbp), %xmm0
movsd %xmm0, -0xb0(%rbp)
movb $0x0, -0xb1(%rbp)
movb $0x0, -0xb2(%rbp)
cmpl $0x0, (%rax)
je 0x3d37
movq -0x108(%rbp), %rax
cmpl $0x1, (%rax)
jne 0x3da9
movq -0x108(%rbp), %rdi
movl -0xc(%rbp), %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x7130
movq -0x108(%rbp), %rdi
movl %eax, -0xb8(%rbp)
movl -0xc(%rbp), %esi
callq 0x7390
movq -0x108(%rbp), %rdi
movl %eax, -0xbc(%rbp)
movl -0xb8(%rbp), %eax
addl -0xbc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x12c(%rbp)
callq 0x1a50
movq %rax, %rcx
movl -0x12c(%rbp), %eax
movslq -0x10(%rbp), %rdx
imulq $0x38, %rdx, %rdx
addq %rdx, %rcx
cmpl (%rcx), %eax
setg %al
andb $0x1, %al
movb %al, -0xb2(%rbp)
jmp 0x3dd9
movq -0x108(%rbp), %rdi
callq 0x1a50
movq %rax, %rdi
movq -0x108(%rbp), %rax
movslq -0x10(%rbp), %rcx
imulq $0x38, %rcx, %rcx
addq %rcx, %rdi
movl (%rax), %esi
callq 0x7420
andb $0x1, %al
movb %al, -0xb2(%rbp)
movsd -0xb0(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x4473
movsd -0x98(%rbp), %xmm1
addsd -0xb0(%rbp), %xmm1
movq -0x88(%rbp), %rax
movsd 0x60(%rax), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x4473
movq -0x108(%rbp), %rax
cmpl $0x2, 0x17d8(%rax)
jl 0x4473
testb $0x1, -0xb2(%rbp)
jne 0x4473
leaq -0x80(%rbp), %rdi
movsd -0xa0(%rbp), %xmm0
movl $0x4, %esi
callq 0x7480
leaq -0x80(%rbp), %rdi
movl $0x4, %esi
callq 0x7540
movl %eax, -0xc0(%rbp)
movq -0x18(%rbp), %rax
movslq -0xc0(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x88(%rbp), %rax
movslq -0xc0(%rbp), %rcx
ucomisd 0x30(%rax,%rcx,8), %xmm0
jbe 0x3ebb
movq -0x88(%rbp), %rax
movslq -0xc0(%rbp), %rcx
movsd 0x30(%rax,%rcx,8), %xmm0
movsd %xmm0, -0xc8(%rbp)
movq -0x18(%rbp), %rax
movslq -0xc0(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, -0xd0(%rbp)
jmp 0x3f1b
movq -0x18(%rbp), %rax
movslq -0xc0(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm1
movq -0x88(%rbp), %rax
movslq -0xc0(%rbp), %rcx
movsd 0x10(%rax,%rcx,8), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x3f19
movq -0x18(%rbp), %rax
movslq -0xc0(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, -0xc8(%rbp)
movq -0x88(%rbp), %rax
movslq -0xc0(%rbp), %rcx
movsd 0x10(%rax,%rcx,8), %xmm0
movsd %xmm0, -0xd0(%rbp)
jmp 0x3f1b
callq 0x35a0
movq -0x108(%rbp), %rdi
movsd -0xd0(%rbp), %xmm2
subsd -0xc8(%rbp), %xmm2
movsd -0xc8(%rbp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0xd8(%rbp)
callq 0x3860
movq -0x108(%rbp), %rdi
movl %eax, -0xdc(%rbp)
movl -0xc0(%rbp), %eax
movl %eax, -0x144(%rbp)
callq 0x1b00
movl -0x144(%rbp), %ecx
movq -0x108(%rbp), %rdi
movslq -0xdc(%rbp), %rdx
shlq $0x7, %rdx
addq %rdx, %rax
movl %ecx, (%rax)
movsd -0xd8(%rbp), %xmm0
movsd %xmm0, -0x140(%rbp)
callq 0x1b00
movsd -0x140(%rbp), %xmm0
movq -0x108(%rbp), %rdi
movslq -0xdc(%rbp), %rcx
shlq $0x7, %rcx
addq %rcx, %rax
movsd %xmm0, 0x8(%rax)
movsd -0x98(%rbp), %xmm0
addsd -0xb0(%rbp), %xmm0
movsd %xmm0, -0x138(%rbp)
callq 0x1b00
movsd -0x138(%rbp), %xmm0
movq -0x108(%rbp), %rdi
movslq -0xdc(%rbp), %rcx
shlq $0x7, %rcx
addq %rcx, %rax
movsd %xmm0, 0x60(%rax)
callq 0x3860
movl %eax, %ecx
movq -0x108(%rbp), %rax
movl %ecx, -0xe0(%rbp)
movl 0x17d8(%rax), %ecx
subl $0x2, %ecx
movl %ecx, 0x17d8(%rax)
movl $0x0, -0xe4(%rbp)
cmpl $0x4, -0xe4(%rbp)
jge 0x418d
movq -0x18(%rbp), %rax
movslq -0xe4(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm1
movq -0x88(%rbp), %rax
movslq -0xe4(%rbp), %rcx
movsd 0x10(%rax,%rcx,8), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x4083
movq -0x18(%rbp), %rax
movslq -0xe4(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, -0x150(%rbp)
jmp 0x409f
movq -0x88(%rbp), %rax
movslq -0xe4(%rbp), %rcx
movsd 0x10(%rax,%rcx,8), %xmm0
movsd %xmm0, -0x150(%rbp)
movq -0x108(%rbp), %rdi
movsd -0x150(%rbp), %xmm0
movsd %xmm0, -0x158(%rbp)
callq 0x1b00
movsd -0x158(%rbp), %xmm0
movslq -0xdc(%rbp), %rcx
shlq $0x7, %rcx
addq %rcx, %rax
movslq -0xe4(%rbp), %rcx
movsd %xmm0, 0x10(%rax,%rcx,8)
movq -0x18(%rbp), %rax
movslq -0xe4(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x88(%rbp), %rax
movslq -0xe4(%rbp), %rcx
ucomisd 0x30(%rax,%rcx,8), %xmm0
jbe 0x411e
movq -0x18(%rbp), %rax
movslq -0xe4(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, -0x160(%rbp)
jmp 0x413a
movq -0x88(%rbp), %rax
movslq -0xe4(%rbp), %rcx
movsd 0x30(%rax,%rcx,8), %xmm0
movsd %xmm0, -0x160(%rbp)
movq -0x108(%rbp), %rdi
movsd -0x160(%rbp), %xmm0
movsd %xmm0, -0x168(%rbp)
callq 0x1b00
movsd -0x168(%rbp), %xmm0
movslq -0xdc(%rbp), %rcx
shlq $0x7, %rcx
addq %rcx, %rax
movslq -0xe4(%rbp), %rcx
movsd %xmm0, 0x30(%rax,%rcx,8)
movl -0xe4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xe4(%rbp)
jmp 0x4032
movl $0x0, -0xe8(%rbp)
cmpl $0x2, -0xe8(%rbp)
jge 0x41fe
movq -0x88(%rbp), %rax
movslq -0xe8(%rbp), %rcx
movl 0x68(%rax,%rcx,4), %esi
movl $0x1, %edi
callq 0x2a00
movq -0x108(%rbp), %rdi
movl %eax, -0x16c(%rbp)
callq 0x1b00
movl -0x16c(%rbp), %edx
movslq -0xdc(%rbp), %rcx
shlq $0x7, %rcx
addq %rcx, %rax
movslq -0xe8(%rbp), %rcx
movl %edx, 0x68(%rax,%rcx,4)
movl -0xe8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xe8(%rbp)
jmp 0x4197
movl $0x0, -0xec(%rbp)
cmpl $0x2, -0xec(%rbp)
jge 0x424b
movq -0x108(%rbp), %rdi
callq 0x1b00
movslq -0xe0(%rbp), %rcx
shlq $0x7, %rcx
addq %rcx, %rax
movslq -0xec(%rbp), %rcx
movl $0x0, 0x68(%rax,%rcx,4)
movl -0xec(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xec(%rbp)
jmp 0x4208
movq -0x108(%rbp), %rdi
movq -0x88(%rbp), %rax
movl 0x58(%rax), %eax
movl %eax, -0x170(%rbp)
callq 0x1b00
movl -0x170(%rbp), %ecx
movslq -0xdc(%rbp), %rdx
shlq $0x7, %rdx
addq %rdx, %rax
movl %ecx, 0x58(%rax)
movq -0x88(%rbp), %rdi
callq 0x75b0
testb $0x1, %al
jne 0x42ea
movq -0x108(%rbp), %rdi
movl -0xc(%rbp), %eax
movl %eax, -0x174(%rbp)
callq 0x1a50
movq %rax, %rcx
movl -0x174(%rbp), %eax
movslq -0x10(%rbp), %rdx
imulq $0x38, %rdx, %rdx
addq %rdx, %rcx
cmpl 0x8(%rcx), %eax
jne 0x42ea
movq -0x108(%rbp), %rdi
movl -0xdc(%rbp), %eax
movl %eax, -0x178(%rbp)
callq 0x1a50
movl -0x178(%rbp), %ecx
movslq -0x10(%rbp), %rdx
imulq $0x38, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x8(%rax)
jmp 0x4342
movq -0x108(%rbp), %rdi
callq 0x1b00
movq -0x88(%rbp), %rcx
movslq 0x58(%rcx), %rcx
shlq $0x7, %rcx
addq %rcx, %rax
movq %rax, -0xf8(%rbp)
movq -0xf8(%rbp), %rax
movl 0x50(%rax), %eax
cmpl -0xc(%rbp), %eax
jne 0x4330
movl -0xdc(%rbp), %ecx
movq -0xf8(%rbp), %rax
movl %ecx, 0x50(%rax)
jmp 0x4340
movl -0xdc(%rbp), %ecx
movq -0xf8(%rbp), %rax
movl %ecx, 0x54(%rax)
jmp 0x4342
movq -0x108(%rbp), %rdi
movl -0xdc(%rbp), %ecx
movq -0x88(%rbp), %rax
movl %ecx, 0x58(%rax)
movl -0xdc(%rbp), %eax
movl %eax, -0x17c(%rbp)
callq 0x1b00
movl -0x17c(%rbp), %ecx
movslq -0xe0(%rbp), %rdx
shlq $0x7, %rdx
addq %rdx, %rax
movl %ecx, 0x58(%rax)
movq -0x18(%rbp), %rax
movslq -0xc0(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
ucomisd -0xd0(%rbp), %xmm0
jne 0x43fa
jp 0x43fa
movq -0x108(%rbp), %rdi
movl -0xe0(%rbp), %eax
movl %eax, -0x184(%rbp)
callq 0x1b00
movl -0x184(%rbp), %ecx
movq -0x108(%rbp), %rdi
movslq -0xdc(%rbp), %rdx
shlq $0x7, %rdx
addq %rdx, %rax
movl %ecx, 0x54(%rax)
movl -0xc(%rbp), %eax
movl %eax, -0x180(%rbp)
callq 0x1b00
movl -0x180(%rbp), %ecx
movslq -0xdc(%rbp), %rdx
shlq $0x7, %rdx
addq %rdx, %rax
movl %ecx, 0x50(%rax)
jmp 0x4455
movq -0x108(%rbp), %rdi
movl -0xe0(%rbp), %eax
movl %eax, -0x18c(%rbp)
callq 0x1b00
movl -0x18c(%rbp), %ecx
movq -0x108(%rbp), %rdi
movslq -0xdc(%rbp), %rdx
shlq $0x7, %rdx
addq %rdx, %rax
movl %ecx, 0x50(%rax)
movl -0xc(%rbp), %eax
movl %eax, -0x188(%rbp)
callq 0x1b00
movl -0x188(%rbp), %ecx
movslq -0xdc(%rbp), %rdx
shlq $0x7, %rdx
addq %rdx, %rax
movl %ecx, 0x54(%rax)
movq -0x108(%rbp), %rdi
movl -0xe0(%rbp), %esi
movq -0x18(%rbp), %rdx
movl -0x1c(%rbp), %ecx
callq 0x3900
jmp 0x460b
movl $0x0, -0xfc(%rbp)
cmpl $0x4, -0xfc(%rbp)
jge 0x4538
movq -0x88(%rbp), %rax
movslq -0xfc(%rbp), %rcx
movsd 0x10(%rax,%rcx,8), %xmm0
movq -0x18(%rbp), %rax
movslq -0xfc(%rbp), %rcx
ucomisd (%rax,%rcx,8), %xmm0
jbe 0x44d4
movq -0x18(%rbp), %rax
movslq -0xfc(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x88(%rbp), %rax
movslq -0xfc(%rbp), %rcx
movsd %xmm0, 0x10(%rax,%rcx,8)
movq -0x88(%rbp), %rax
movslq -0xfc(%rbp), %rcx
movsd 0x30(%rax,%rcx,8), %xmm1
movq -0x18(%rbp), %rax
movslq -0xfc(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x4522
movq -0x18(%rbp), %rax
movslq -0xfc(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x88(%rbp), %rax
movslq -0xfc(%rbp), %rcx
movsd %xmm0, 0x30(%rax,%rcx,8)
jmp 0x4524
movl -0xfc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xfc(%rbp)
jmp 0x447d
movq -0x88(%rbp), %rdi
callq 0x29e0
testb $0x1, %al
jne 0x45da
movq -0x18(%rbp), %rax
movq -0x88(%rbp), %rcx
movslq (%rcx), %rcx
movsd (%rax,%rcx,8), %xmm1
movq -0x88(%rbp), %rax
movsd 0x8(%rax), %xmm0
ucomisd %xmm1, %xmm0
jb 0x4594
movq -0x108(%rbp), %rdi
movq -0x88(%rbp), %rax
movl 0x50(%rax), %esi
movl -0x10(%rbp), %edx
movq -0x18(%rbp), %rcx
movl -0x1c(%rbp), %r8d
callq 0x3aa0
jmp 0x45d8
movq -0x18(%rbp), %rax
movq -0x88(%rbp), %rcx
movslq (%rcx), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x88(%rbp), %rax
ucomisd 0x8(%rax), %xmm0
jbe 0x45d6
movq -0x108(%rbp), %rdi
movq -0x88(%rbp), %rax
movl 0x54(%rax), %esi
movl -0x10(%rbp), %edx
movq -0x18(%rbp), %rcx
movl -0x1c(%rbp), %r8d
callq 0x3aa0
jmp 0x45d8
jmp 0x4609
movq -0x88(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movl 0x68(%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, 0x68(%rax,%rcx,4)
movq -0x88(%rbp), %rax
movsd 0x6a19(%rip), %xmm0     # 0xb018
addsd 0x78(%rax), %xmm0
movsd %xmm0, 0x78(%rax)
jmp 0x460b
addq $0x190, %rsp            # imm = 0x190
popq %rbp
retq
nopw %cs:(%rax,%rax)
nop