LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/big-data-lab-team[P]OrpailleCC/./src/mondrian_coarse.hpp
// Function: CoarseMondrianForest<double, funct, KappaMetrics<2, false>, 4, 2, 6000>::predict(double const*, double*, int)
int predict(feature_type const* features, double* scores = nullptr, int tree_to_use = -1){
	if(tree_to_use < 0)
		tree_to_use = tree_count;
	//Update internal count
	//NOTE uncomment for bound and trim, just to be safer
	#ifndef UNBOUND_OPTIMIZE
	if(extend_type != EXTEND_GHOST)
		update_posterior_count();
	#endif
	//The posterior mean of the forest will be the average posterior means over all trees
	//We start by computing the sum
	double tree_used = 0;
	double sum_posterior_mean[label_count] = {0};
	for(int i = 0; i < tree_to_use; ++i){
		double posterior_mean[label_count];
		//Get the  posterior means of the leaf of the data point in tree *i*
		predict_tree(features, i, posterior_mean);
		tree_used += 1;
		//Update the sum of posterior means
		for(int k = 0; k < label_count; ++k)
			sum_posterior_mean[k] += posterior_mean[k];
	}
	//Then we divide by the number trees.
	for(int k = 0; k < label_count; ++k)
		sum_posterior_mean[k] /= tree_used;

	//Finally, we look for the best label
	return Utils::index_max(sum_posterior_mean, label_count);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %ecx, %ebp
movq %rsi, %rbx
movq %rdi, %r14
testl %ecx, %ecx
jns 0x15d9
movl 0x17dc(%r14), %ebp
cmpl $0x2, 0x3c(%r14)
je 0x15e8
movq %r14, %rdi
callq 0x1b4a
xorpd %xmm0, %xmm0
movapd %xmm0, (%rsp)
xorl %r15d, %r15d
testl %ebp, %ebp
cmovlel %r15d, %ebp
xorpd %xmm1, %xmm1
leaq 0x20(%rsp), %r12
pushq $-0x1
popq %r13
cmpl %ebp, %r15d
je 0x1656
movq %r14, %rdi
movq %rbx, %rsi
movl %r15d, %edx
movq %r12, %rcx
movl %r13d, %r8d
movsd %xmm1, 0x18(%rsp)
callq 0x1b9c
movsd 0x18(%rsp), %xmm1
xorl %eax, %eax
cmpq $0x2, %rax
je 0x1649
movsd 0x20(%rsp,%rax,8), %xmm0
addsd (%rsp,%rax,8), %xmm0
movsd %xmm0, (%rsp,%rax,8)
incq %rax
jmp 0x162e
addsd 0x49c7(%rip), %xmm1     # 0x6018
incl %r15d
jmp 0x1607
xorl %eax, %eax
cmpq $0x2, %rax
je 0x1671
movsd (%rsp,%rax,8), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, (%rsp,%rax,8)
incq %rax
jmp 0x1658
movq %rsp, %rdi
pushq $0x2
popq %rsi
callq 0x1da0
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/big-data-lab-team[P]OrpailleCC/./src/mondrian_coarse.hpp
// Function: CoarseMondrianForest<double, funct, KappaMetrics<2, false>, 4, 2, 6000>::TreeBase::reset(int)
void reset(int const node_limit=1){
		root = EMPTY_ROOT;
		node_count_limit = node_limit;
		statistics.reset();
		sum_contribution = 0;
		count_contribution = 0;
	}

// Assembly:
pushq %rbx
movq %rdi, %rbx
orl $-0x1, 0x8(%rdi)
movl %esi, (%rdi)
addq $0x20, %rdi
callq 0x16f0
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rbx)
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/big-data-lab-team[P]OrpailleCC/./src/mondrian_coarse.hpp
// Function: MondrianNode<4, 2>::reset()
void reset(void){
		for(int i = 0; i < label_count; ++i)
			counters[i] = 0;
		for(int i = 0; i < feature_count; ++i)
			bound_lower[i] = bound_upper[i] = 0;
		child_left = child_right = EMPTY_NODE;
		split_dimension = EMPTY_NODE;
		split_value = 0;
		tau = EMPTY_NODE;
		parent = EMPTY_NODE;
		forced_extend = 0;
		fading_score = 0;
	}

// Assembly:
andq $0x0, 0x68(%rdi)
pushq $0x2
popq %rax
cmpq $0x6, %rax
je 0x16c6
andq $0x0, 0x20(%rdi,%rax,8)
andq $0x0, (%rdi,%rax,8)
incq %rax
jmp 0x16b0
orq $-0x1, 0x54(%rdi)
orl $-0x1, 0x50(%rdi)
orl $-0x1, (%rdi)
andq $0x0, 0x8(%rdi)
movabsq $-0x4010000000000000, %rax # imm = 0xBFF0000000000000
movq %rax, 0x60(%rdi)
andl $0x0, 0x70(%rdi)
andq $0x0, 0x78(%rdi)
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/big-data-lab-team[P]OrpailleCC/./src/metrics.hpp
// Function: KappaMetrics<2, false>::reset()
void reset(){
		for(int i = 0; i < label_count; ++i)
			for(int j = 0; j < label_count; ++j)
				confusion[i][j] = 0;
		total = 0;
	}

// Assembly:
xorl %eax, %eax
cmpq $0x2, %rax
je 0x1702
andq $0x0, (%rdi,%rax,8)
incq %rax
jmp 0x16f2
andl $0x0, 0x10(%rdi)
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/big-data-lab-team[P]OrpailleCC/./src/mondrian_coarse.hpp
// Function: CoarseMondrianForest<double, funct, KappaMetrics<2, false>, 4, 2, 6000>::scory(double const*, int)
void scory(feature_type const* features, int const label){
	double scores[label_count];
	double sum_scores[label_count];

	update_posterior_count();
	for(int i = 0; i < tree_count; ++i){
		for(int j = 0; j < label_count; ++j)
			scores[j] = 0;
		predict_tree(features, i, scores);
		int const prediction = Utils::index_max(scores, label_count);
		cout << "Loutre:" << total_count << "," << i << "," << label << "," << prediction;
		for(int j = 0; j < label_count; ++j)
			cout << "," << scores[j];
		cout << endl;
		for(int j = 0; j < label_count; ++j)
			sum_scores[j] = scores[j];
	}
	int const prediction = Utils::index_max(sum_scores, label_count);
	cout << "Loutre:" << total_count << "," << -1 << "," << label << "," << prediction;
	for(int j = 0; j < label_count; ++j)
		cout << "," << sum_scores[j];
	cout << endl;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %edx, 0xc(%rsp)
movq %rsi, 0x28(%rsp)
movq %rdi, %r14
callq 0x1b4a
xorl %r12d, %r12d
leaq 0x10(%rsp), %r13
movq 0x78a2(%rip), %rbp      # 0x8fd8
leaq 0x4983(%rip), %rbx      # 0x60c0
cmpl 0x17dc(%r14), %r12d
jge 0x1826
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq %r14, %rdi
movq 0x28(%rsp), %rsi
movl %r12d, %edx
movq %r13, %rcx
pushq $-0x1
popq %r8
callq 0x1b9c
movq %r13, %rdi
pushq $0x2
popq %rsi
callq 0x1da0
movl %eax, %r15d
movq %rbp, %rdi
leaq 0x4937(%rip), %rsi      # 0x60b8
callq 0x1060
movl 0x17b4(%r14), %esi
movq %rax, %rdi
callq 0x1040
movq %rax, %rdi
movq %rbx, %rsi
callq 0x1060
movq %rax, %rdi
movl %r12d, %esi
callq 0x1090
movq %rax, %rdi
movq %rbx, %rsi
callq 0x1060
movq %rax, %rdi
movl 0xc(%rsp), %esi
callq 0x1090
movq %rax, %rdi
movq %rbx, %rsi
callq 0x1060
movq %rax, %rdi
movl %r15d, %esi
callq 0x1090
xorl %r15d, %r15d
movq %rbp, %rdi
cmpq $0x2, %r15
je 0x1800
movq %rbx, %rsi
callq 0x1060
movsd 0x10(%rsp,%r15,8), %xmm0
movq %rax, %rdi
callq 0x1080
incq %r15
jmp 0x17db
callq 0x1030
xorl %eax, %eax
cmpq $0x2, %rax
je 0x181e
movsd 0x10(%rsp,%rax,8), %xmm0
movsd %xmm0, 0x30(%rsp,%rax,8)
incq %rax
jmp 0x1807
incl %r12d
jmp 0x173d
leaq 0x30(%rsp), %rdi
pushq $0x2
popq %rsi
callq 0x1da0
movl %eax, %ebp
movq 0x779c(%rip), %rbx      # 0x8fd8
leaq 0x4875(%rip), %rsi      # 0x60b8
movq %rbx, %rdi
callq 0x1060
movl 0x17b4(%r14), %esi
movq %rax, %rdi
callq 0x1040
leaq 0x485f(%rip), %r14      # 0x60c0
movq %rax, %rdi
movq %r14, %rsi
callq 0x1060
pushq $-0x1
popq %rsi
movq %rax, %rdi
callq 0x1090
movq %rax, %rdi
movq %r14, %rsi
callq 0x1060
movq %rax, %rdi
movl 0xc(%rsp), %esi
callq 0x1090
movq %rax, %rdi
movq %r14, %rsi
callq 0x1060
movq %rax, %rdi
movl %ebp, %esi
callq 0x1090
xorl %r15d, %r15d
cmpq $0x2, %r15
je 0x18cb
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1060
movsd 0x30(%rsp,%r15,8), %xmm0
movq %rax, %rdi
callq 0x1080
incq %r15
jmp 0x18a6
movq 0x7706(%rip), %rdi      # 0x8fd8
callq 0x1030
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/big-data-lab-team[P]OrpailleCC/./src/mondrian_coarse.hpp
// Function: CoarseMondrianForest<double, funct, KappaMetrics<2, false>, 4, 2, 6000>::tree_trim()
void tree_trim(){
	if(trim_type == TRIM_NONE)
		return;
	for(int i = 0; i < tree_count; ++i){
		int id = tree_trim(i);
		if(tree_bases()[i].root != id && id >= 0 && id < node_count) //Can't cut the root
			cut_block(id, i);
	}
}

// Assembly:
cmpl $0x0, 0x40(%rdi)
je 0x1973
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
leaq 0x17bc(%rdi), %r15
xorl %r14d, %r14d
movslq 0x17dc(%rbx), %rax
cmpq %rax, %r14
jge 0x196e
movq %rbx, %rdi
movl %r14d, %esi
callq 0x1ffc
testl %eax, %eax
js 0x1965
movslq 0x17dc(%rbx), %rcx
imulq $-0x38, %rcx, %rcx
cmpl %eax, (%r15,%rcx)
je 0x1965
cmpl 0x17d4(%rbx), %eax
jge 0x1965
movq %rbx, %rdi
movl %eax, %esi
movl %r14d, %edx
callq 0x21c4
incq %r14
addq $0x38, %r15
jmp 0x1924
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/big-data-lab-team[P]OrpailleCC/./src/mondrian_coarse.hpp
// Function: CoarseMondrianForest<double, funct, KappaMetrics<2, false>, 4, 2, 6000>::update_posterior_count()
void update_posterior_count(void){
	//For each tree, run the recursive *update_posterior_count* on the root
	TreeBase* bases = tree_bases();
	for(int i = 0; i < tree_count; ++i)
		if(!bases[i].is_empty())
			update_posterior_count(bases[i].root);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movslq 0x17dc(%rdi), %rax
imulq $0x38, %rax, %rcx
negq %rcx
leaq (%rdi,%rcx), %r14
addq $0x17bc, %r14           # imm = 0x17BC
xorl %r15d, %r15d
movslq %eax, %rcx
cmpq %rcx, %r15
jge 0x1b95
movl (%r14), %esi
cmpl $-0x1, %esi
je 0x1b8c
movq %rbx, %rdi
callq 0x1dc8
movl 0x17dc(%rbx), %eax
incq %r15
addq $0x38, %r14
jmp 0x1b6e
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/big-data-lab-team[P]OrpailleCC/./src/utils.hpp
// Function: int Utils::index_max<double>(double*, int)
static int index_max(T* array, int const size) {
		int best = 0;
		for(int i = 1; i < size; ++i)
			if(array[i] > array[best])
				best = i;
		return best;
	}

// Assembly:
movslq %esi, %rcx
xorl %eax, %eax
pushq $0x1
popq %rdx
cmpq %rcx, %rdx
jge 0x1dc7
movsd (%rdi,%rdx,8), %xmm0
movslq %eax, %rsi
ucomisd (%rdi,%rsi,8), %xmm0
movl %edx, %esi
ja 0x1dc0
movl %eax, %esi
incq %rdx
movl %esi, %eax
jmp 0x1da8
retq
// File: /workspace/github_cpp_makefile_star2_O2/big-data-lab-team[P]OrpailleCC/./src/mondrian_coarse.hpp
// Function: CoarseMondrianForest<double, funct, KappaMetrics<2, false>, 4, 2, 6000>::update_posterior_count(int)
void update_posterior_count(int const node_id){
	Node& node = nodes()[node_id];
	if(node.is_leaf()){
		//A leaf should already has its count right
		return;
	}
	else{ //This is an internal node
		//Compute the posterior count for the two children
		update_posterior_count(node.child_left);
		update_posterior_count(node.child_right);
	}
	//Update each count
	for(int i = 0; i < label_count; ++i){
		int const c_left = Utils::min(1, nodes()[node.child_left].counters[i]);
		int const c_right = Utils::min(1, nodes()[node.child_right].counters[i]);
		node.counters[i] = c_left + c_right;
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movslq %esi, %r14
shlq $0x7, %r14
cmpl $-0x1, 0x44(%rdi,%r14)
je 0x1e3b
movq %rdi, %rbx
leaq (%rdi,%r14), %r15
addq $0x44, %r15
movl 0x50(%r15), %esi
callq 0x1dc8
movl 0x54(%r15), %esi
movq %rbx, %rdi
callq 0x1dc8
addq $0xac, %rbx
pushq $0x2
popq %rax
pushq $0x1
popq %rcx
subq $0x1, %rax
jb 0x1e3b
movslq 0x50(%r15), %rdx
shlq $0x7, %rdx
movl (%rbx,%rdx), %edx
testl %edx, %edx
cmovgl %ecx, %edx
movslq 0x54(%r15), %rsi
shlq $0x7, %rsi
movl (%rbx,%rsi), %esi
testl %esi, %esi
cmovgl %ecx, %esi
addl %edx, %esi
movl %esi, (%rbx,%r14)
addq $0x4, %rbx
jmp 0x1e09
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/big-data-lab-team[P]OrpailleCC/./src/mondrian_coarse.hpp
// Function: CoarseMondrianForest<double, funct, KappaMetrics<2, false>, 4, 2, 6000>::compute_posterior_mean(MondrianNode<4, 2> const&, double*) const
void compute_posterior_mean(Node const& node, double *posterior_mean) const{
	//posterior_mean start with the parent posterior_mean and the function updates to the current node
	double const parent_tau = node.parent >= 0 ? nodes()[node.parent].tau : 0; //The tau value of the parent of the root is 0
	double const node_discount = func::exp(discount_factor * (node.tau - parent_tau));
	double sum_counters = 0;
	double sum_tab = 0;
	double tab[label_count];
	//Compute sum_counters and sum_tab, and set tab
	for(int i = 0; i < label_count; ++i){
		sum_counters += node.counters[i];
		tab[i] = Utils::min(node.counters[i], 1);
		sum_tab += tab[i];
	}
	//For each label with a counter higher than zero, compute the posterior mean. Otherwise it is simply the posterior mean of the parent
	for(int i = 0; i < label_count; ++i){
		if(node.counters[i] > 0){
			double const a = node.counters[i] - node_discount * tab[i];
			double const b = node_discount * sum_tab * posterior_mean[i];
			posterior_mean[i] = (a / sum_counters) + (b /sum_counters);
		}
	}
}

// Assembly:
xorpd %xmm0, %xmm0
xorl %eax, %eax
movl $0x1, %ecx
cmpq $0x2, %rax
je 0x1e80
movl 0x68(%rsi,%rax,4), %edi
testl %edi, %edi
movl %ecx, %r8d
cmovlel %edi, %r8d
movd %r8d, %xmm1
movd %edi, %xmm2
punpckldq %xmm2, %xmm1    # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
cvtdq2pd %xmm1, %xmm1
movlpd %xmm1, -0x18(%rsp,%rax,8)
addpd %xmm1, %xmm0
incq %rax
jmp 0x1e4d
xorpd %xmm1, %xmm1
mulsd %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
xorl %eax, %eax
movsd 0x4192(%rip), %xmm2     # 0x6028
cmpq $0x2, %rax
je 0x1edd
movl 0x68(%rsi,%rax,4), %ecx
testl %ecx, %ecx
jle 0x1ed8
cvtsi2sd %ecx, %xmm3
movsd -0x18(%rsp,%rax,8), %xmm4
mulsd %xmm2, %xmm4
addsd %xmm3, %xmm4
movsd (%rdx,%rax,8), %xmm3
mulsd %xmm1, %xmm3
unpcklpd %xmm3, %xmm4            # xmm4 = xmm4[0],xmm3[0]
divpd %xmm0, %xmm4
movapd %xmm4, %xmm3
unpckhpd %xmm4, %xmm3            # xmm3 = xmm3[1],xmm4[1]
addsd %xmm4, %xmm3
movsd %xmm3, (%rdx,%rax,8)
incq %rax
jmp 0x1e96
retq
// File: /workspace/github_cpp_makefile_star2_O2/big-data-lab-team[P]OrpailleCC/./src/mondrian_coarse.hpp
// Function: CoarseMondrianForest<double, funct, KappaMetrics<2, false>, 4, 2, 6000>::cut_block(int, int)
void cut_block(int const node_id, int const tree_id){
	Node& node = nodes()[node_id];
	Node& parent = nodes()[node.parent];
	int sibling_id;
	if(parent.child_right == node_id)
		sibling_id = parent.child_left;
	else
		sibling_id = parent.child_right;
	Node& sibling = nodes()[sibling_id];

	if(parent.parent == -1){ //Place the other sibling as root (behead)
		parent.reset();
		node_available += 1;
		node_reset(node_id);
		//Cut off node and everything below
		tree_bases()[tree_id].root = sibling_id;
		sibling.parent = Node::EMPTY_NODE;
		return;
	}
	Node& grandparent = nodes()[parent.parent];
	int rem_count_id = parent.parent;
	if(grandparent.child_right == node.parent)
		grandparent.child_right = sibling_id;
	else
		grandparent.child_left = sibling_id;
	sibling.parent = parent.parent;
	node_available += 1;
	parent.reset();
	//TODO remove the counters?
	node_reset(node_id);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %edx, %r14d
movl %esi, %ebp
movq %rdi, %rbx
leaq 0x44(%rdi), %rax
movslq %esi, %rdx
movq %rdx, %rcx
shlq $0x7, %rcx
movslq 0x9c(%rdi,%rcx), %rcx
movq %rcx, %rsi
shlq $0x7, %rsi
addq %rsi, %rdi
addq $0x44, %rdi
movl 0x54(%rdi), %r15d
cmpl %edx, %r15d
jne 0x2205
movl 0x50(%rdi), %r15d
movslq %r15d, %r12
shlq $0x7, %r12
addq %rax, %r12
movslq 0x58(%rdi), %rdx
cmpq $-0x1, %rdx
je 0x2256
movq %rdx, %rsi
shlq $0x7, %rsi
leaq (%rax,%rsi), %r8
xorl %r9d, %r9d
cmpl %ecx, 0x54(%rax,%rsi)
sete %r9b
movl %r15d, 0x50(%r8,%r9,4)
movl %edx, 0x58(%r12)
incl 0x17d8(%rbx)
callq 0x16a8
movq %rbx, %rdi
movl %ebp, %esi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x2298
callq 0x16a8
incl 0x17d8(%rbx)
movq %rbx, %rdi
movl %ebp, %esi
callq 0x2298
movslq 0x17dc(%rbx), %rax
imulq $-0x38, %rax, %rax
addq %rbx, %rax
movslq %r14d, %rcx
imulq $0x38, %rcx, %rcx
movl %r15d, 0x17bc(%rcx,%rax)
orl $-0x1, 0x58(%r12)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/big-data-lab-team[P]OrpailleCC/./src/mondrian_coarse.hpp
// Function: bool CoarseMondrianForest<double, funct, KappaMetrics<2, false>, 4, 2, 6000>::node_reset<100>(int)
bool node_reset(int const start_id) {
	int const root_id = start_id;
	//Initialize an array to keep track of where we have to go at each tree level.
	//The max depth expected is MAX_DEPTH.
	int stack[max_stack_size];
	for(int i = 0; i < max_stack_size; ++i)
		stack[i] = -1;

	//Start at the root, then dive inside the tree
	int node_id = root_id;
	int depth = 0;
	//a for loop instead of a while to avoid infinite loops. Since we don't expect to do more turn than node_count
	//*i* count the number of node deleted.
	int i = 0;
	while(i < node_count && node_id >= 0){
		Node& node = nodes()[node_id];
		if (node.is_leaf()){
			node_available += 1;
			i += 1;

			if(node_id == root_id){
				node.reset();
				break;
			}

			//Get the parent before reset (root parent will be a negative number)
			//Since the loop stops if node_id is below 0, it's fine
			node_id = node.parent;
			node.reset();

			depth -= 1;
		}
		else{  //Internal node
			if (stack[depth] == -1){ //going right
				stack[depth] = 0;
				depth += 1;
				node_id = node.child_right;
			}
			else if (stack[depth] == 0){ //Go left
				stack[depth] = 1;
				depth += 1;
				node_id = node.child_left;
			}
			else if (stack[depth] == 1){ //Go up
				node_available += 1;

				if(node_id == root_id){
					node.reset();
					break;
				}

				stack[depth] = -1; //Reset to -1
				depth -= 1;
				i += 1;

				//Get the parent before reset (root parent will be a negative number)
				//Since the loop stops if node_id is below 0, it's fine
				node_id = node.parent;
				node.reset();

			}
		}
		if(depth >= max_stack_size)
			return false;
	}

	if(depth != -1)
		return false;
	return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x198, %rsp            # imm = 0x198
movl %esi, %r13d
movq %rdi, %r14
xorl %eax, %eax
cmpq $0x64, %rax
je 0x22c0
orl $-0x1, (%rsp,%rax,4)
incq %rax
jmp 0x22b1
leaq 0x44(%r14), %r12
xorl %r15d, %r15d
movl %r13d, %ebx
xorl %ebp, %ebp
movl 0x17d4(%r14), %eax
cmpl %eax, %ebp
setl %cl
testl %ebx, %ebx
setns %dl
andb %cl, %dl
movl %ebx, %edi
shlq $0x7, %rdi
addq %r12, %rdi
movslq %r15d, %rcx
testb %dl, %dl
je 0x235b
cmpl $-0x1, (%rdi)
je 0x2326
movl (%rsp,%rcx,4), %esi
cmpl $-0x1, %esi
je 0x230c
cmpl $0x1, %esi
je 0x2334
testl %esi, %esi
jne 0x22eb
pushq $0x1
popq %rdx
pushq $0x50
jmp 0x2310
xorl %edx, %edx
pushq $0x54
popq %rsi
movl %edx, (%rsp,%rcx,4)
leal 0x1(%r15), %ecx
movl (%rdi,%rsi), %ebx
cmpl $0x62, %r15d
movl %ecx, %r15d
jle 0x22d3
jmp 0x2374
incl 0x17d8(%r14)
cmpl %r13d, %ebx
jne 0x2344
jmp 0x2356
incl 0x17d8(%r14)
cmpl %r13d, %ebx
je 0x2356
orl $-0x1, (%rsp,%rcx,4)
movl 0x58(%rdi), %ebx
callq 0x16a8
incl %ebp
decl %r15d
jmp 0x22cc
callq 0x16a8
cmpl $-0x1, %r15d
sete %al
addq $0x198, %rsp            # imm = 0x198
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %eax, %eax
jmp 0x2362
// File: /workspace/github_cpp_makefile_star2_O2/big-data-lab-team[P]OrpailleCC/./src/mondrian_coarse.hpp
// Function: CoarseMondrianForest<double, funct, KappaMetrics<2, false>, 4, 2, 6000>::available_node() const
int available_node(void) const{
	if(node_available == 0)
		return -1;
	static int last_returned_node = 0;
	for(int i = 0; i < node_count; ++i){
		int const node_id = (i + last_returned_node) % node_count;
		if(nodes()[node_id].available()){
			last_returned_node = node_id;
			return node_id;
		}
	}
	return -1;
}

// Assembly:
pushq $-0x1
popq %rcx
cmpl $0x0, 0x17d8(%rdi)
je 0x23c8
movl 0x17d4(%rdi), %r8d
movl 0x6ed3(%rip), %esi      # 0x9264
addq $0x44, %rdi
xorl %r9d, %r9d
testl %r8d, %r8d
cmovgl %r8d, %r9d
xorpd %xmm0, %xmm0
subl $0x1, %r9d
jb 0x23c8
movl %esi, %eax
cltd
idivl %r8d
movslq %edx, %rax
shlq $0x7, %rax
incl %esi
ucomisd 0x60(%rdi,%rax), %xmm0
jbe 0x23a3
movl %edx, 0x6e9e(%rip)      # 0x9264
movl %edx, %ecx
movl %ecx, %eax
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/big-data-lab-team[P]OrpailleCC/./src/mondrian_coarse.hpp
// Function: CoarseMondrianForest<double, funct, KappaMetrics<2, false>, 4, 2, 6000>::sample_block(int, double const*, int)
void sample_block(int const node_id, feature_type const* features, int const label){
	Node& node = nodes()[node_id];
	//Set the box of the node node_id
	for(int i = 0; i < feature_count; ++i){
		node.bound_lower[i] = features[i];
		node.bound_upper[i] = features[i];
	}
	//Update the counter for labels
	node.counters[label] += 1;
	//NOTE we don't need to check for lifetime because we only have one element
	//see the original source code (https://github.com/balajiln/mondrianforest)
	node.tau = lifetime;
}

// Assembly:
movslq %esi, %rax
shlq $0x7, %rax
addq %rdi, %rax
addq $0x44, %rax
xorl %esi, %esi
cmpq $0x4, %rsi
je 0x23f8
movsd (%rdx,%rsi,8), %xmm0
movsd %xmm0, 0x10(%rax,%rsi,8)
movsd %xmm0, 0x30(%rax,%rsi,8)
incq %rsi
jmp 0x23dc
movslq %ecx, %rcx
incl 0x68(%rax,%rcx,4)
movsd 0x17e8(%rdi), %xmm0
movsd %xmm0, 0x60(%rax)
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/big-data-lab-team[P]OrpailleCC/./src/mondrian_coarse.hpp
// Function: int CoarseMondrianForest<double, funct, KappaMetrics<2, false>, 4, 2, 6000>::node_depth<100>(int, int*) const
int node_depth(int const start_id, int* tree_node_count) const{
	//Initialize an array to keep track of where we have to go at each tree level.
	//The max depth expected is MAX_DEPTH.
	int stack[max_stack_size];
	for(int i = 0; i < max_stack_size; ++i)
		stack[i] = -1;

	int node_id = start_id;
	int depth = 0, max_depth = 0;

	//a for loop instead of a while to avoid infinite loops. Since we don't expect to do more turn than node_count
	//*i* count the number of node deleted.
	int i = 0;
	int depth_id = start_id;
	while(i < node_count && depth >= 0){
		Node const& node = nodes()[node_id];
		if (node.is_leaf()){
			i += 1;
			//acknowledge the depth
			if(depth > max_depth){
				max_depth = depth;
				depth_id = node_id;
			}

			node_id = node.parent;
			depth -= 1;
		}
		else{ //Internal Node
			if (stack[depth] == -1){ //going right
				stack[depth] = 0;
				depth += 1;
				node_id = node.child_right;
			}
			else if (stack[depth] == 0){ //Go left
				stack[depth] = 1;
				depth += 1;
				node_id = node.child_left;
			}
			else if (stack[depth] == 1){ //Go up
				i += 1;
				stack[depth] = -1; //Reset to -1
				depth -= 1;
				node_id = node.parent;
			}
			#ifdef DEBUG
			else{
				cout << __FILE__ << ":" << __LINE__ << " CoarseMondrianForest::node_depth: stack[" << depth << "] == " << stack[depth] << " (should be -1, 0, or 1)" << endl;
			}
			#endif
		}
	}
	if(tree_node_count != nullptr)
		*tree_node_count = i;
	return max_depth+1;
}

// Assembly:
subq $0x118, %rsp            # imm = 0x118
xorl %eax, %eax
cmpq $0x64, %rax
je 0x38c5
orl $-0x1, -0x80(%rsp,%rax,4)
incq %rax
jmp 0x38b5
movl 0x17d4(%rdi), %ecx
addq $0x44, %rdi
xorl %r9d, %r9d
xorl %eax, %eax
xorl %r8d, %r8d
cmpl %ecx, %r8d
setl %r11b
testl %r9d, %r9d
setns %r10b
andb %r11b, %r10b
movslq %esi, %rsi
shlq $0x7, %rsi
addq %rdi, %rsi
movl %r9d, %r9d
testb %r10b, %r10b
je 0x395b
cmpl $-0x1, (%rsi)
je 0x3921
movl -0x80(%rsp,%r9,4), %r11d
cmpl $0x1, %r11d
je 0x3933
testl %r11d, %r11d
je 0x3944
cmpl $-0x1, %r11d
jne 0x38f5
andl $0x0, -0x80(%rsp,%r9,4)
addq $0x54, %rsi
jmp 0x3951
incl %r8d
cmpl %eax, %r9d
cmovgl %r9d, %eax
movl 0x58(%rsi), %esi
decl %r9d
jmp 0x38d7
orl $-0x1, -0x80(%rsp,%r9,4)
incl %r8d
decl %r9d
movl 0x58(%rsi), %esi
jmp 0x38d7
movl $0x1, -0x80(%rsp,%r9,4)
addq $0x50, %rsi
incl %r9d
movl (%rsi), %esi
jmp 0x38d7
testq %rdx, %rdx
je 0x3963
movl %r8d, (%rdx)
incl %eax
addq $0x118, %rsp            # imm = 0x118
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/big-data-lab-team[P]OrpailleCC/./src/utils.hpp
// Function: Utils::turn_array_into_probability(double*, int, double)
static void turn_array_into_probability(double* values, int const size, double sum = -1) {
		//Compute the sum unless sum is already computed
		if(sum < 0){
			sum = 0;
			for(int i = 0; i < size; ++i)
				sum += values[i];
		}
		//Set the first element of the array to its probability
		values[0] = (values[0]/sum);

		//Itirate to create the sum of probabilities
		for(int i = 1; i < size; ++i)
			values[i] = values[i-1] + (values[i]/sum);
	}

// Assembly:
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
jbe 0x39bd
xorl %eax, %eax
testl %esi, %esi
movl $0x0, %ecx
cmovgl %esi, %ecx
cmpq %rax, %rcx
je 0x39b9
addsd (%rdi,%rax,8), %xmm1
incq %rax
jmp 0x39aa
movapd %xmm1, %xmm0
movsd (%rdi), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, (%rdi)
movslq %esi, %rax
pushq $0x1
popq %rcx
cmpq %rax, %rcx
jge 0x39ed
movsd (%rdi,%rcx,8), %xmm1
divsd %xmm0, %xmm1
addsd -0x8(%rdi,%rcx,8), %xmm1
movsd %xmm1, (%rdi,%rcx,8)
incq %rcx
jmp 0x39cf
retq
// File: /workspace/github_cpp_makefile_star2_O2/big-data-lab-team[P]OrpailleCC/./src/utils.hpp
// Function: int Utils::pick_from_distribution<funct>(double const*, int)
static int pick_from_distribution(double const*const probabilities, const int size){
		double const u = func::rand_uniform(); //Sample a random number between [0,1[
		//NOTE improve with a log search :]
		for(int i = 0; i < size; ++i){
			if(u <= probabilities[i])
				return i;
		}
		return size;//NOTE: this should never happen unless the last element of *probabilities* is less than 1
	}

// Assembly:
movl %esi, %eax
xorl %edx, %edx
testl %esi, %esi
movl $0x0, %ecx
cmovgl %esi, %ecx
xorpd %xmm0, %xmm0
cmpq %rdx, %rcx
je 0x3a17
movsd (%rdi,%rdx,8), %xmm1
ucomisd %xmm0, %xmm1
jae 0x3a15
incq %rdx
jmp 0x3a00
movl %edx, %ecx
cmpl %eax, %ecx
cmovll %ecx, %eax
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/big-data-lab-team[P]OrpailleCC/./src/mondrian_coarse.hpp
// Function: CoarseMondrianForest<double, funct, KappaMetrics<2, false>, 4, 2, 6000>::pass_data_point_down(int, double const*, int)
int pass_data_point_down(int const start_id, feature_type const* features, int const label){
	int node_id = start_id;

	//Loop to find the leaf
	while(true){
		Node& node = nodes()[node_id];
		//Update box size
		for(int i = 0; i < feature_count; ++i){
			double const lower = Utils::min(node.bound_lower[i], features[i]);
			double const upper = Utils::max(node.bound_upper[i], features[i]);
			node.bound_lower[i] = lower;
			node.bound_upper[i] = upper;
		}
		if(node.is_leaf())
			break;
		//Choose a direction
		if(features[node.split_dimension] > node.split_value)
			node_id = node.child_right;
		else
			node_id = node.child_left;
	}
	Node& node = nodes()[node_id];
	node.counters[label] += 1;
	node.fading_score += 1; //fading_score is decreased later
	return node_id;
}

// Assembly:
movl %esi, %eax
addq $0x44, %rdi
movslq %eax, %rsi
shlq $0x7, %rsi
addq %rdi, %rsi
xorl %r8d, %r8d
cmpq $0x4, %r8
je 0x4c7e
movsd (%rdx,%r8,8), %xmm0
movsd 0x10(%rsi,%r8,8), %xmm1
movsd 0x30(%rsi,%r8,8), %xmm2
minsd %xmm0, %xmm1
maxsd %xmm0, %xmm2
movsd %xmm1, 0x10(%rsi,%r8,8)
movsd %xmm2, 0x30(%rsi,%r8,8)
incq %r8
jmp 0x4c49
movslq (%rsi), %r8
cmpq $-0x1, %r8
je 0x4c9d
movsd (%rdx,%r8,8), %xmm0
xorl %eax, %eax
ucomisd 0x8(%rsi), %xmm0
seta %al
movl 0x50(%rsi,%rax,4), %eax
jmp 0x4c3c
movslq %ecx, %rcx
incl 0x68(%rsi,%rcx,4)
movsd 0x78(%rsi), %xmm0
addsd 0x1367(%rip), %xmm0     # 0x6018
movsd %xmm0, 0x78(%rsi)
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/big-data-lab-team[P]OrpailleCC/./src/mondrian_coarse.hpp
// Function: CoarseMondrianForest<double, funct, KappaMetrics<2, false>, 4, 2, 6000>::node_csv(int, int, int, int, MondrianNode<4, 2> const&) const
void node_csv(int const tree_id, int const node_id, int const depth, int const leaf, Node const& node) const{
	cout << "Narval:" << total_count << "," << tree_id << "," << node_id << "," << depth << ","
		<< node.parent << "," << node.child_right << "," << node.child_left << ","
		<< node.tau << "," << node.split_dimension << "," << node.split_value << "," << leaf << "," << node.forced_extend << ",";
	for(int i = 0; i < feature_count; ++i){
		cout << node.bound_lower[i] << "," << node.bound_upper[i] << ",";
	}
	for(int i = 0; i < label_count; ++i){
		cout << node.counters[i] << ",";
	}
	cout << endl;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r9, %rbx
movl %r8d, 0x4(%rsp)
movl %ecx, %r12d
movl %edx, %r13d
movl %esi, %ebp
movq %rdi, %r15
movq 0x4075(%rip), %r14      # 0x8fd8
leaq 0x1167(%rip), %rsi      # 0x60d1
movq %r14, %rdi
callq 0x1060
movl 0x17b4(%r15), %esi
movq %rax, %rdi
callq 0x1040
leaq 0x1138(%rip), %r15      # 0x60c0
movq %rax, %rdi
movq %r15, %rsi
callq 0x1060
movq %rax, %rdi
movl %ebp, %esi
callq 0x1090
movq %rax, %rdi
movq %r15, %rsi
callq 0x1060
movq %rax, %rdi
movl %r13d, %esi
callq 0x1090
movq %rax, %rdi
movq %r15, %rsi
callq 0x1060
movq %rax, %rdi
movl %r12d, %esi
callq 0x1090
movq %rax, %rdi
movq %r15, %rsi
callq 0x1060
movl 0x58(%rbx), %esi
movq %rax, %rdi
callq 0x1090
movq %rax, %rdi
movq %r15, %rsi
callq 0x1060
movl 0x54(%rbx), %esi
movq %rax, %rdi
callq 0x1090
movq %rax, %rdi
movq %r15, %rsi
callq 0x1060
movl 0x50(%rbx), %esi
movq %rax, %rdi
callq 0x1090
movq %rax, %rdi
movq %r15, %rsi
callq 0x1060
movsd 0x60(%rbx), %xmm0
movq %rax, %rdi
callq 0x1080
movq %rax, %rdi
movq %r15, %rsi
callq 0x1060
movl (%rbx), %esi
movq %rax, %rdi
callq 0x1090
movq %rax, %rdi
movq %r15, %rsi
callq 0x1060
movsd 0x8(%rbx), %xmm0
movq %rax, %rdi
callq 0x1080
movq %rax, %rdi
movq %r15, %rsi
callq 0x1060
movq %rax, %rdi
movl 0x4(%rsp), %esi
callq 0x1090
movq %rax, %rdi
movq %r15, %rsi
callq 0x1060
movl 0x70(%rbx), %esi
movq %rax, %rdi
callq 0x1090
movq %rax, %rdi
movq %r15, %rsi
callq 0x1060
pushq $-0x20
popq %r12
testq %r12, %r12
je 0x50cb
movsd 0x30(%rbx,%r12), %xmm0
movq %r14, %rdi
callq 0x1080
movq %rax, %rdi
movq %r15, %rsi
callq 0x1060
movsd 0x50(%rbx,%r12), %xmm0
movq %rax, %rdi
callq 0x1080
movq %rax, %rdi
movq %r15, %rsi
callq 0x1060
addq $0x8, %r12
jmp 0x508c
xorl %r12d, %r12d
movq 0x3f03(%rip), %r14      # 0x8fd8
leaq 0xfe4(%rip), %r15       # 0x60c0
cmpq $0x2, %r12
je 0x50ff
movl 0x68(%rbx,%r12,4), %esi
movq %r14, %rdi
callq 0x1090
movq %rax, %rdi
movq %r15, %rsi
callq 0x1060
incq %r12
jmp 0x50dc
movq 0x3ed2(%rip), %rdi      # 0x8fd8
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1030
// File: /workspace/github_cpp_makefile_star2_O2/ef-gy[P]libefgy/include/ef.gy/polar.h
// Function: efgy::math::vector<double, 3u, efgy::math::format::polar>::operator efgy::math::vector<double, 3u, efgy::math::format::cartesian>() const
operator vector<F, n, format::cartesian>() const {
    vector<F, n, format::cartesian> v;

    for (unsigned int i = 0; i < n; i++) {
      v[i] = (*this)[0];
    }

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wtautological-compare"
    for (unsigned int i = 0; i < (n - 1); i++)
#pragma clang diagnostic pop
    {
      const unsigned int p = i + 1;

      v[i] *= math::cosine((*this)[p], spaceTag.precision);

      for (unsigned int j = p; j < n; j++) {
        v[j] *= math::sine((*this)[p], spaceTag.precision);
      }
    }

    return v;
  }

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
andq $0x0, 0x10(%rdi)
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
movsd (%rsi), %xmm0
xorl %eax, %eax
cmpq $0x3, %rax
je 0x50e1
movsd %xmm0, (%rbx,%rax,8)
incq %rax
jmp 0x50d1
xorl %r15d, %r15d
cmpq $0x2, %r15
je 0x512f
leaq 0x1(%r15), %r12
movsd 0x8(%r14,%r15,8), %xmm0
callq 0x4470
mulsd (%rbx,%r15,8), %xmm0
movsd %xmm0, (%rbx,%r15,8)
cmpq $0x2, %r15
je 0x512a
movsd (%r14,%r12,8), %xmm0
callq 0x4060
mulsd 0x8(%rbx,%r15,8), %xmm0
movsd %xmm0, 0x8(%rbx,%r15,8)
incq %r15
jmp 0x5106
movq %r12, %r15
jmp 0x50e4
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/ef-gy[P]libefgy/include/ef.gy/polar.h
// Function: efgy::math::vector<double, 3u, efgy::math::format::polar>::vector(efgy::math::vector<double, 3u, efgy::math::format::cartesian> const&, efgy::math::format::polar const&)
vector(const vector<F, n, format::cartesian> &v,
         const format::polar &s = format::polar())
      : std::array<F, n>(), spaceTag(s) {
    (*this)[0] = length(v);
    for (unsigned int k = 0; k < (n - 1); k++) {
      F s = F(0);
      for (unsigned int i = k; i < n; i++) {
        s += v[i] * v[i];
      }
      s = v[k] / sqrt(s);
      if (k == (n - 2)) {
        (*this)[(n - 1)] = arccosine(s);
        if (v[(n - 1)] < F(0)) {
          (*this)[(n - 1)] = M_PI * F(2) - (*this)[(n - 1)];
        }
      } else {
        (*this)[(k + 1)] = arccosine(s);
      }
    }
  }

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rsi, %rbx
movq %rdi, %r14
andq $0x0, 0x10(%rdi)
xorpd %xmm0, %xmm0
movupd %xmm0, (%rdi)
movq (%rdx), %rax
movq %rax, 0x18(%rdi)
movq %rsi, %rdi
callq 0x11aec
movsd %xmm0, (%r14)
xorl %r15d, %r15d
cmpq $0x2, %r15
je 0x5285
xorpd %xmm0, %xmm0
movq %r15, %rax
cmpq $0x3, %rax
je 0x5218
movsd (%rbx,%rax,8), %xmm1
mulsd %xmm1, %xmm1
addsd %xmm1, %xmm0
incq %rax
jmp 0x5200
movsd (%rbx,%r15,8), %xmm1
ucomisd 0xcdea(%rip), %xmm0     # 0x12010
jb 0x522e
sqrtsd %xmm0, %xmm0
jmp 0x523f
movsd %xmm1, 0x8(%rsp)
callq 0x4220
movsd 0x8(%rsp), %xmm1
divsd %xmm0, %xmm1
movapd %xmm1, %xmm0
callq 0x4280
cmpq $0x1, %r15
jne 0x5277
movsd %xmm0, 0x10(%r14)
xorpd %xmm1, %xmm1
ucomisd 0x10(%rbx), %xmm1
jbe 0x527d
movsd 0xcd9d(%rip), %xmm1     # 0x12008
subsd %xmm0, %xmm1
movsd %xmm1, 0x10(%r14)
jmp 0x527d
movsd %xmm0, 0x8(%r14)
incq %r15
jmp 0x51ef
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/ef-gy[P]libefgy/include/ef.gy/vector.h
// Function: double efgy::math::operator*<double, 3u, efgy::math::format::cartesian>(efgy::math::vector<double, 3u, efgy::math::format::cartesian> const&, efgy::math::vector<double, 3u, efgy::math::format::cartesian> const&)
F operator*(const vector<F, n, format> &a, const vector<F, n, format> &b) {
  F s = F(0);
  for (unsigned int i = 0; i < n; i++) {
    s += a[i] * b[i];
  }
  return s;
}

// Assembly:
xorpd %xmm0, %xmm0
xorl %eax, %eax
cmpq $0x3, %rax
je 0x11b2f
movsd (%rdi,%rax,8), %xmm1
mulsd (%rsi,%rax,8), %xmm1
addsd %xmm1, %xmm0
incq %rax
jmp 0x11b16
retq
// File: /workspace/github_cpp_makefile_star2_O2/sbme-tutorials[P]huffman-encoding/huffman.cpp
// Function: Huffman::readInput()
void Huffman::readInput()
{
    std::cin >> intensity >> width >> height >> maxIntensity;
    for (int i = 0; i < width * height; i++)
    {
        int temp;
        std::cin >> temp;
        input.push_back(temp);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x30(%rdi), %rsi
movq 0x5424(%rip), %rdi      # 0x7fe0
callq 0x2260
leaq 0x20(%rbx), %r15
movq %rax, %rdi
movq %r15, %rsi
callq 0x2140
leaq 0x24(%rbx), %r12
movq %rax, %rdi
movq %r12, %rsi
callq 0x2140
leaq 0x28(%rbx), %rsi
movq %rax, %rdi
callq 0x2140
addq $0x58, %rbx
xorl %r13d, %r13d
leaq -0x29(%rbp), %r14
movl (%r12), %eax
imull (%r15), %eax
cmpl %eax, %r13d
jge 0x2c29
movq 0x53d6(%rip), %rdi      # 0x7fe0
leaq -0x30(%rbp), %rsi
callq 0x2140
movb -0x30(%rbp), %al
movb %al, -0x29(%rbp)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3d44
incl %r13d
jmp 0x2bf6
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/sbme-tutorials[P]huffman-encoding/huffman.cpp
// Function: Huffman::computeProb()
float Huffman::computeProb() // computes entropy and probability of each greyscale value
{
    unsigned long long pixels = input.size(); // total number of pixels in the pic
    float entropy = 0;
    for (auto value : input) // for loop to calculate frequency of each greyscale value
    {
        probability[value]++;
    }
    // divide the frequency over total
    // number of pixels to get probability
    for (auto &value : probability)
    {
        value.second = value.second / (float)pixels;
        entropy += value.second * log2(value.second); //entropy formula
    }
    return -1 * entropy;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
movq 0x58(%rdi), %r13
movq 0x60(%rdi), %r12
leaq 0x70(%rdi), %r14
leaq -0x29(%rbp), %r15
movq %r13, -0x50(%rbp)
cmpq %r12, %r13
je 0x2c8c
movb (%r13), %al
movb %al, -0x29(%rbp)
movq %r14, %rdi
movq %r15, %rsi
callq 0x39c8
movss (%rax), %xmm0
addss 0x23c5(%rip), %xmm0     # 0x5048
movss %xmm0, (%rax)
incq %r13
jmp 0x2c60
subq -0x50(%rbp), %r12
js 0x2c99
cvtsi2ss %r12, %xmm0
jmp 0x2caf
movq %r12, %rax
shrq %rax
andl $0x1, %r12d
orq %rax, %r12
cvtsi2ss %r12, %xmm0
addss %xmm0, %xmm0
movss %xmm0, -0x30(%rbp)
movq 0x88(%rbx), %r14
addq $0x78, %rbx
xorps %xmm0, %xmm0
movaps %xmm0, -0x50(%rbp)
cmpq %rbx, %r14
je 0x2d04
movss 0x24(%r14), %xmm0
divss -0x30(%rbp), %xmm0
movss %xmm0, -0x34(%rbp)
movss %xmm0, 0x24(%r14)
callq 0x2280
mulss -0x34(%rbp), %xmm0
movaps -0x50(%rbp), %xmm1
addss %xmm0, %xmm1
movaps %xmm1, -0x50(%rbp)
movq %r14, %rdi
callq 0x2170
movq %rax, %r14
jmp 0x2cc6
movaps -0x50(%rbp), %xmm0
xorps 0x2341(%rip), %xmm0     # 0x5050
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/sbme-tutorials[P]huffman-encoding/huffman.cpp
// Function: Huffman::buildTree()
void Huffman::buildTree()
{
    struct Compare
    {
        bool operator()(Node *a, Node *b)
        {
            return (a->p > b->p);
        }
    };
    // Create a min heap & inserts all characters of input data[]
    std::priority_queue<Node *, std::vector<Node *>, Compare> minHeap;
    //build heap
    for (auto pixel : probability)
    {
        Node *n = new Node{pixel.first, pixel.second, nullptr, nullptr};
        minHeap.push(n);
    }
    Node *parent;
    while (minHeap.size() != 1)
    {
        Node *left = minHeap.top();
        minHeap.pop();
        Node *right = minHeap.top();
        minHeap.pop();
        parent = new Node;
        parent->p = left->p + right->p;
        parent->left = left;
        parent->right = right;
        minHeap.push(parent);
    }
    tree = parent;

    char arr[255];
    getCodeTable(tree, arr, 0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x148, %rsp            # imm = 0x148
xorps %xmm0, %xmm0
leaq -0x60(%rbp), %rax
movaps %xmm0, (%rax)
andq $0x0, 0x10(%rax)
movq 0x88(%rdi), %r13
movq %rdi, -0x68(%rbp)
leaq 0x78(%rdi), %rbx
pushq $0x18
popq %r15
leaq -0x170(%rbp), %r12
cmpq %rbx, %r13
je 0x2daf
movb 0x20(%r13), %r14b
movss 0x24(%r13), %xmm0
movss %xmm0, -0x2c(%rbp)
movq %r15, %rdi
callq 0x21f0
andq $0x0, 0x10(%rax)
xorps %xmm0, %xmm0
movaps %xmm0, (%rax)
movb %r14b, (%rax)
movss -0x2c(%rbp), %xmm0
movss %xmm0, 0x4(%rax)
movq %rax, -0x170(%rbp)
leaq -0x60(%rbp), %rdi
movq %r12, %rsi
callq 0x2e6c
movq %r13, %rdi
callq 0x2170
movq %rax, %r13
jmp 0x2d5b
leaq -0x60(%rbp), %r14
pushq $0x18
popq %r15
leaq -0x38(%rbp), %r12
movq -0x60(%rbp), %rax
movq -0x58(%rbp), %rcx
subq %rax, %rcx
cmpq $0x8, %rcx
je 0x2e1e
movq (%rax), %rbx
movq %r14, %rdi
callq 0x2e9a
movq -0x60(%rbp), %rax
movq (%rax), %r13
movq %r14, %rdi
callq 0x2e9a
movq %r15, %rdi
callq 0x21f0
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rax)
movq %rax, -0x38(%rbp)
movss 0x4(%rbx), %xmm0
addss 0x4(%r13), %xmm0
movss %xmm0, 0x4(%rax)
movq %rbx, 0x8(%rax)
movq %r13, 0x10(%rax)
movq %r14, %rdi
movq %r12, %rsi
callq 0x2e6c
jmp 0x2dbb
movq -0x38(%rbp), %rsi
movq -0x68(%rbp), %rdi
movq %rsi, 0x50(%rdi)
leaq -0x170(%rbp), %rdx
xorl %ecx, %ecx
callq 0x2f62
leaq -0x60(%rbp), %rdi
callq 0x3bec
addq $0x148, %rsp            # imm = 0x148
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2e57
jmp 0x2e57
movq %rax, %rbx
leaq -0x60(%rbp), %rdi
callq 0x3bec
movq %rbx, %rdi
callq 0x2370
nop
// File: /workspace/github_cpp_makefile_star2_O2/sbme-tutorials[P]huffman-encoding/huffman.cpp
// Function: Huffman::getCodeTable(Node*, char*, int)
void Huffman::getCodeTable(Node *parent, char *arr, int index)
{
    if (parent->left)
    {
        arr[index] = '0';
        getCodeTable(parent->left, arr, index + 1);
    }

    if (parent->right)
    {
        arr[index] = '1';
        getCodeTable(parent->right, arr, index + 1);
    }

    if (!(parent->right || parent->left))
    {
        std::string binaryCode(arr, arr + index);
        codeTable[parent->val] = binaryCode;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %rdx, %r15
movq %rsi, %rbx
movq %rdi, %r14
cmpq $0x0, 0x8(%rsi)
movslq %ecx, %r12
je 0x2f9d
movb $0x30, (%r15,%r12)
movq 0x8(%rbx), %rsi
leal 0x1(%r12), %ecx
movq %r14, %rdi
movq %r15, %rdx
callq 0x2f62
cmpq $0x0, 0x10(%rbx)
je 0x2fc4
movb $0x31, (%r15,%r12)
movq 0x10(%rbx), %rsi
leal 0x1(%r12), %ecx
movq %r14, %rdi
movq %r15, %rdx
callq 0x2f62
cmpq $0x0, 0x10(%rbx)
jne 0x300c
cmpq $0x0, 0x8(%rbx)
jne 0x300c
addq %r15, %r12
leaq -0x30(%rbp), %rax
movq %rax, -0x10(%rax)
leaq -0x40(%rbp), %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x3ca6
addq $0xa0, %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x3a1a
leaq -0x40(%rbp), %rsi
movq %rax, %rdi
callq 0x2120
leaq -0x40(%rbp), %rdi
callq 0x20e0
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x40(%rbp), %rdi
callq 0x20e0
movq %rbx, %rdi
callq 0x2370
nop
// File: /workspace/github_cpp_makefile_star2_O2/sbme-tutorials[P]huffman-encoding/huffman.cpp
// Function: Huffman::encode(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void Huffman::encode(std::string outputFile)
{
    readInput();
    computeProb();
    buildTree();
    sizeOfEncoded = 0;
    for (auto element : input)
    {
        if (codeTable.find(element) != codeTable.end())
        {
            std::string binaryCode = codeTable[element];
            encoded += binaryCode;
        }
    }
    encoded.erase(std::remove(encoded.begin(), encoded.end(), '\0'), encoded.end());
    sizeOfEncoded = encoded.length();
    outputEncoded(outputFile);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rsi, -0x40(%rbp)
movq %rdi, %r14
callq 0x2ba0
movq %r14, %rdi
callq 0x2c38
movq %r14, %rdi
callq 0x2d1e
andq $0x0, 0xf0(%r14)
movq 0x58(%r14), %rbx
movq 0x60(%r14), %r15
leaq 0xa0(%r14), %r12
leaq 0xa8(%r14), %r13
movq %r14, -0x48(%rbp)
leaq 0xd0(%r14), %rax
movq %rax, -0x38(%rbp)
leaq -0x88(%rbp), %r14
cmpq %r15, %rbx
je 0x30da
movb (%rbx), %al
movb %al, -0x29(%rbp)
movq %r12, %rdi
leaq -0x29(%rbp), %rsi
callq 0x45a0
cmpq %r13, %rax
je 0x30d5
movq %r12, %rdi
leaq -0x29(%rbp), %rsi
callq 0x3a1a
movq %r14, %rdi
movq %rax, %rsi
callq 0x22a0
movq -0x38(%rbp), %rdi
movq %r14, %rsi
callq 0x23b0
movq %r14, %rdi
callq 0x20e0
incq %rbx
jmp 0x308f
movq -0x48(%rbp), %rbx
movq 0xd0(%rbx), %rdi
movq 0xd8(%rbx), %rsi
addq %rdi, %rsi
leaq -0x88(%rbp), %rdx
movb $0x0, (%rdx)
callq 0x45d4
movq 0xd0(%rbx), %rdx
addq 0xd8(%rbx), %rdx
movq -0x38(%rbp), %rdi
movq %rax, %rsi
callq 0x2070
movq 0xd8(%rbx), %rax
movq %rax, 0xf0(%rbx)
leaq -0x68(%rbp), %r14
movq %r14, %rdi
movq -0x40(%rbp), %rsi
callq 0x22a0
movq %rbx, %rdi
movq %r14, %rsi
callq 0x317a
leaq -0x68(%rbp), %rdi
callq 0x20e0
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x68(%rbp), %rdi
jmp 0x316c
movq %rax, %rbx
leaq -0x88(%rbp), %rdi
callq 0x20e0
movq %rbx, %rdi
callq 0x2370
nop
// File: /workspace/github_cpp_makefile_star2_O2/sbme-tutorials[P]huffman-encoding/huffman.cpp
// Function: Huffman::bitPacking()
void Huffman::bitPacking()
{
    packed.clear();
    std::string str = "";
    for (auto e : encoded)
    {
        str.push_back(e);
        if (str.size() == 8)
        {
            int dec = std::bitset<8>(str).to_ulong();
            unsigned char temp = (unsigned char)dec;
            packed.push_back(temp);
            str = "";
        }
    }
    int numOfZeros = (8 - (encoded.length() % 8)); // to complete the last byte of the code
    if (numOfZeros != 8)
    {
        for (int i = 0; i < numOfZeros; ++i)
        {
            str.push_back('0');
        }
        if (str.size() == 8)
        {
            int dec = std::bitset<8>(str).to_ulong();
            unsigned char temp = (unsigned char)dec;
            packed.push_back(temp);
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdi, %rbx
movq 0x110(%rdi), %rax
cmpq %rax, 0x118(%rdi)
je 0x33f5
movq %rax, 0x118(%rbx)
leaq 0x110(%rbx), %rax
movq %rax, -0x38(%rbp)
leaq 0x1c7a(%rip), %rsi      # 0x5081
leaq -0x60(%rbp), %r12
leaq -0x30(%rbp), %r13
movq %r12, %rdi
movq %r13, %rdx
callq 0x2946
movq 0xd0(%rbx), %r14
movq %rbx, -0x40(%rbp)
movq 0xd8(%rbx), %r15
xorl %ebx, %ebx
cmpq %rbx, %r15
je 0x347a
movsbl (%r14,%rbx), %esi
movq %r12, %rdi
callq 0x21b0
cmpq $0x8, -0x58(%rbp)
jne 0x3475
movq %r13, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x3bac
movb -0x30(%rbp), %al
movb %al, -0x30(%rbp)
movq -0x38(%rbp), %rdi
movq %r13, %rsi
callq 0x3b8a
movq %r12, %rdi
leaq 0x1c11(%rip), %rsi      # 0x5081
callq 0x23a0
incq %rbx
jmp 0x342e
movq -0x40(%rbp), %rax
movl 0xd8(%rax), %ebx
andl $0x7, %ebx
je 0x34ce
orl $-0x8, %ebx
leaq -0x60(%rbp), %r14
pushq $0x30
popq %r15
testl %ebx, %ebx
je 0x34a7
movq %r14, %rdi
movl %r15d, %esi
callq 0x21b0
incl %ebx
jmp 0x3494
cmpq $0x8, -0x58(%rbp)
jne 0x34ce
leaq -0x30(%rbp), %rdi
leaq -0x60(%rbp), %rsi
xorl %edx, %edx
callq 0x3bac
leaq -0x30(%rbp), %rsi
movb (%rsi), %al
movb %al, (%rsi)
movq -0x38(%rbp), %rdi
callq 0x3b8a
leaq -0x60(%rbp), %rdi
callq 0x20e0
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x34f0
jmp 0x34f0
jmp 0x34f0
jmp 0x34f0
jmp 0x34f0
movq %rax, %rbx
leaq -0x60(%rbp), %rdi
callq 0x20e0
movq %rbx, %rdi
callq 0x2370
// File: /workspace/github_cpp_makefile_star2_O2/iZhangHui[P]CppPrimer/CH15_ObjectOrientedProgramming/examples/useQuote.cc
// Function: main
int main()
{
	Quote base("0-201-82470-1", 50);
	print_total(cout, base, 10);    // calls Quote::net_price
	
	Bulk_quote derived("0-201-82470-1", 50, 5, .19);
	print_total(cout, derived, 10); // calls Bulk_quote::net_price
	
	Quote *baseP = &derived;
	
	// calls the version from the base class 
	// regardless of the dynamic type of baseP
	double undiscounted = baseP->Quote::net_price(42);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x98, %rsp
leaq 0xdc1(%rip), %rsi       # 0x2040
leaq -0x70(%rbp), %rdi
leaq -0x30(%rbp), %rdx
callq 0x1030
leaq -0xa0(%rbp), %rdi
leaq -0x70(%rbp), %rsi
movsd 0xd69(%rip), %xmm0      # 0x2008
callq 0x137c
leaq -0x70(%rbp), %rdi
callq 0x1040
movq 0x2d24(%rip), %rdi      # 0x3fd8
leaq -0xa0(%rbp), %rsi
pushq $0xa
popq %rdx
callq 0x14ec
leaq 0xd76(%rip), %rsi       # 0x2040
leaq -0x30(%rbp), %rdi
leaq -0x9(%rbp), %rdx
callq 0x1030
leaq -0x70(%rbp), %rdi
leaq -0x30(%rbp), %rsi
movsd 0xd21(%rip), %xmm0      # 0x2008
pushq $0x5
popq %rdx
movsd 0xd1e(%rip), %xmm1      # 0x2010
callq 0x13ae
leaq -0x30(%rbp), %rdi
callq 0x1040
movq 0x2cd1(%rip), %rdi      # 0x3fd8
leaq -0x70(%rbp), %rsi
pushq $0xa
popq %rdx
callq 0x14ec
leaq -0x70(%rbp), %rdi
callq 0x13fe
leaq -0xa0(%rbp), %rdi
callq 0x13fe
xorl %eax, %eax
addq $0x98, %rsp
popq %rbx
popq %rbp
retq
movq %rax, %rbx
leaq -0x70(%rbp), %rdi
callq 0x13fe
jmp 0x1355
movq %rax, %rbx
leaq -0x30(%rbp), %rdi
callq 0x1040
jmp 0x1355
jmp 0x1352
movq %rax, %rbx
leaq -0xa0(%rbp), %rdi
callq 0x13fe
jmp 0x1374
movq %rax, %rbx
leaq -0x70(%rbp), %rdi
callq 0x1040
jmp 0x1374
movq %rax, %rbx
movq %rbx, %rdi
callq 0x10f0
// File: /workspace/github_cpp_makefile_star2_O2/iZhangHui[P]CppPrimer/CH01_GettingStarted/examples/mysum.cc
// Function: main
int main() 
{
	int sum = 0, value = 0;

	// read until end-of-file, calculating a running total of all values read
	while (std::cin >> value) 
		sum += value; // equivalent to sum = sum + value

	std::cout << "Sum is: " << sum << std::endl;
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
leaq -0x1c(%rbp), %r14
andl $0x0, (%r14)
xorl %ebx, %ebx
movq 0x2df9(%rip), %r15      # 0x3fe0
movq %r15, %rdi
movq %r14, %rsi
callq 0x1040
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x1205
addl -0x1c(%rbp), %ebx
jmp 0x11e7
movq 0x2dc4(%rip), %rdi      # 0x3fd0
leaq 0xdf1(%rip), %rsi       # 0x2004
callq 0x1060
movq %rax, %rdi
movl %ebx, %esi
callq 0x1080
movq %rax, %rdi
callq 0x1030
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq