LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O3/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
leaq -0x18(%rsp), %r8
movb $0x1, %al
xorl %r9d, %r9d
movl $0x1, %ecx
leaq -0x8(%rsp), %rdi
xorpd %xmm1, %xmm1
movl 0x68(%rsi,%r9,4), %r9d
xorps %xmm2, %xmm2
cvtsi2sd %r9d, %xmm2
addsd %xmm2, %xmm0
testl %r9d, %r9d
cmovgl %ecx, %r9d
xorps %xmm2, %xmm2
cvtsi2sd %r9d, %xmm2
movsd %xmm2, (%r8)
addsd %xmm2, %xmm1
movl $0x1, %r9d
movq %rdi, %r8
testb $0x1, %al
movl $0x0, %eax
jne 0x205c
xorpd %xmm2, %xmm2
mulsd %xmm2, %xmm1
unpcklpd %xmm0, %xmm0            # xmm0 = xmm0[0,0]
leaq -0x18(%rsp), %r8
movb $0x1, %al
xorl %ecx, %ecx
movsd 0x3f74(%rip), %xmm2     # 0x6028
leaq -0x8(%rsp), %rdi
movl 0x68(%rsi,%rcx,4), %r9d
testl %r9d, %r9d
jle 0x20fa
xorps %xmm3, %xmm3
cvtsi2sd %r9d, %xmm3
movsd (%r8), %xmm4
mulsd %xmm2, %xmm4
addsd %xmm3, %xmm4
movsd (%rdx,%rcx,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,%rcx,8)
movl $0x1, %ecx
movq %rdi, %r8
testb $0x1, %al
movl $0x0, %eax
jne 0x20b9
retq
// File: /workspace/github_cpp_makefile_star2_O3/big-data-lab-team[P]OrpailleCC/./src/mondrian_coarse.hpp
// Function: int CoarseMondrianForest<double, funct, KappaMetrics<2, false>, 4, 2, 6000>::tree_fade_counts<100>(int)
int tree_fade_counts(int const tree_id){
	TreeBase const& base = tree_bases()[tree_id];
	int const root_id = base.root;

	//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;
	double smallest_count = -1;
	int smallest_id = 0;
	//a for loop instead of a while to avoid infinite loops. Since we don't expect to do more turn than node_count
	int i = 0;
	double leaf_count = 0;
	double sum_count_leaves = 0;
	while(i < node_count && node_id >= 0){
		Node& node = nodes()[node_id];
		if(!node.is_leaf()){  //Internal node
			if (stack[depth] == -1){ //Go 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
				stack[depth] = -1; //Reset to -1
				depth -= 1;
				i += 1;
				node_id = node.parent;
			}
		}
		else{ //Leaf
			stack[depth] = -1; //Reset to -1
			depth -= 1;
			i += 1;
			node.fading_score = node.fading_score * nodes_fading_f;
			node_id = node.parent;
		}
		if(depth >= max_stack_size)
			return -1;
	}
	return 0;
}

// Assembly:
pushq %rbp
pushq %rbx
subq $0x198, %rsp            # imm = 0x198
movq %rdi, %rbx
movslq 0x17dc(%rdi), %rax
imulq $-0x38, %rax, %rax
addq %rdi, %rax
movslq %esi, %rcx
imulq $0x38, %rcx, %rcx
movl 0x17bc(%rcx,%rax), %ebp
movq %rsp, %rdi
movl $0x190, %edx            # imm = 0x190
movl $0xff, %esi
callq 0x1040
movl 0x17d4(%rbx), %ecx
movsd 0x1830(%rbx), %xmm0
addq $0x44, %rbx
xorl %eax, %eax
xorl %edi, %edi
xorl %edx, %edx
cmpl %ecx, %edx
jge 0x2203
testl %ebp, %ebp
js 0x2203
movl %ebp, %r8d
shlq $0x7, %r8
leaq (%rbx,%r8), %rsi
cmpl $-0x1, (%rbx,%r8)
movslq %edi, %r8
je 0x21ab
movl (%rsp,%r8,4), %r9d
cmpl $0x1, %r9d
je 0x21db
testl %r9d, %r9d
je 0x21c8
cmpl $-0x1, %r9d
jne 0x21f5
movl $0x0, (%rsp,%r8,4)
incl %r8d
movl $0x54, %r9d
jmp 0x21ee
movl $0xffffffff, (%rsp,%r8,4) # imm = 0xFFFFFFFF
decl %r8d
incl %edx
movsd 0x78(%rsi), %xmm1
mulsd %xmm0, %xmm1
movsd %xmm1, 0x78(%rsi)
jmp 0x21e8
movl $0x1, (%rsp,%r8,4)
incl %r8d
movl $0x50, %r9d
jmp 0x21ee
movl $0xffffffff, (%rsp,%r8,4) # imm = 0xFFFFFFFF
decl %r8d
incl %edx
movl $0x58, %r9d
movl %r8d, %edi
movl (%rsi,%r9), %ebp
cmpl $0x64, %edi
jl 0x215e
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x198, %rsp            # imm = 0x198
popq %rbx
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/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, %ebp
movq %rdi, %rbx
leaq 0x44(%rdi), %rcx
movslq %esi, %rdi
movq %rdi, %rax
shlq $0x7, %rax
movslq 0x9c(%rbx,%rax), %rdx
movq %rdx, %rax
shlq $0x7, %rax
addq %rbx, %rax
addq $0x44, %rax
movl 0x54(%rax), %r14d
cmpl %edi, %r14d
jne 0x23ea
movl 0x50(%rax), %r14d
movslq %r14d, %r15
shlq $0x7, %r15
addq %rcx, %r15
movslq 0x58(%rax), %rdi
cmpq $-0x1, %rdi
je 0x247c
movq %rdi, %r8
shlq $0x7, %r8
leaq (%rcx,%r8), %r9
xorl %r10d, %r10d
cmpl %edx, 0x54(%rcx,%r8)
sete %r10b
movl %r14d, 0x50(%r9,%r10,4)
movl %edi, 0x58(%r15)
incl 0x17d8(%rbx)
xorl %ecx, %ecx
movq %rcx, 0x68(%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rax)
movups %xmm0, 0x20(%rax)
movups %xmm0, 0x30(%rax)
movups %xmm0, 0x40(%rax)
movq $-0x1, 0x50(%rax)
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movl %edx, (%rax)
movq %rcx, 0x8(%rax)
movabsq $-0x4010000000000000, %rdi # imm = 0xBFF0000000000000
movq %rdi, 0x60(%rax)
movl %edx, 0x58(%rax)
movl $0x0, 0x70(%rax)
movq %rcx, 0x78(%rax)
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x24fc
xorl %ecx, %ecx
movq %rcx, 0x68(%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rax)
movups %xmm0, 0x20(%rax)
movups %xmm0, 0x30(%rax)
movups %xmm0, 0x40(%rax)
movq $-0x1, 0x50(%rax)
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
movl %r12d, (%rax)
movq %rcx, 0x8(%rax)
movabsq $-0x4010000000000000, %rdx # imm = 0xBFF0000000000000
movq %rdx, 0x60(%rax)
movl $0x0, 0x70(%rax)
movq %rcx, 0x78(%rax)
incl 0x17d8(%rbx)
movq %rbx, %rdi
callq 0x24fc
movslq 0x17dc(%rbx), %rax
imulq $-0x38, %rax, %rax
addq %rbx, %rax
movslq %ebp, %rcx
imulq $0x38, %rcx, %rcx
movl %r14d, 0x17bc(%rcx,%rax)
movl %r12d, 0x58(%r15)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/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:
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
cmpl $0x0, 0x17d8(%rdi)
je 0x2736
movl 0x17d4(%rdi), %esi
testl %esi, %esi
jle 0x2736
movl 0x5b81(%rip), %r8d      # 0x8284
addq $0x44, %rdi
xorl %r9d, %r9d
xorpd %xmm0, %xmm0
leal (%r8,%r9), %eax
cltd
idivl %esi
movslq %edx, %rax
shlq $0x7, %rax
ucomisd 0x60(%rdi,%rax), %xmm0
ja 0x272e
incl %r9d
cmpl %r9d, %esi
jne 0x270e
jmp 0x2736
movl %edx, 0x5b50(%rip)      # 0x8284
movl %edx, %ecx
movl %ecx, %eax
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/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:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x190, %rsp            # imm = 0x190
movq %rdx, %rbx
movl %esi, %ebp
movq %rdi, %r14
movq %rsp, %rdi
movl $0x190, %edx            # imm = 0x190
movl $0xff, %esi
callq 0x1040
movl 0x17d4(%r14), %edx
testl %edx, %edx
jle 0x3e79
addq $0x44, %r14
xorl %ecx, %ecx
xorl %eax, %eax
xorl %esi, %esi
movslq %ebp, %r8
shlq $0x7, %r8
leaq (%r14,%r8), %rdi
cmpl $-0x1, (%r14,%r8)
je 0x3e41
movl %esi, %r8d
movl (%rsp,%r8,4), %r9d
cmpl $0x1, %r9d
je 0x3e5e
testl %r9d, %r9d
je 0x3e4f
cmpl $-0x1, %r9d
jne 0x3e6d
movl $0x0, (%rsp,%r8,4)
incl %esi
movl 0x54(%rdi), %ebp
jmp 0x3e6d
incl %ecx
cmpl %eax, %esi
cmovgl %esi, %eax
movl 0x58(%rdi), %ebp
decl %esi
jmp 0x3e6d
movl $0x1, (%rsp,%r8,4)
incl %esi
movl 0x50(%rdi), %ebp
jmp 0x3e6d
incl %ecx
movl $0xffffffff, (%rsp,%r8,4) # imm = 0xFFFFFFFF
decl %esi
movl 0x58(%rdi), %ebp
cmpl %edx, %ecx
jge 0x3e75
testl %esi, %esi
jns 0x3e08
incl %eax
jmp 0x3e80
xorl %ecx, %ecx
movl $0x1, %eax
testq %rbx, %rbx
je 0x3e87
movl %ecx, (%rbx)
addq $0x190, %rsp            # imm = 0x190
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/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
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
cmpq $0x4, %r8
jne 0x535d
movslq (%rsi), %r8
cmpq $-0x1, %r8
je 0x53af
movsd (%rdx,%r8,8), %xmm0
xorl %eax, %eax
ucomisd 0x8(%rsi), %xmm0
seta %al
movl 0x50(%rsi,%rax,4), %eax
jmp 0x5350
movslq %ecx, %rcx
incl 0x68(%rsi,%rcx,4)
movsd 0x78(%rsi), %xmm0
addsd 0xc55(%rip), %xmm0      # 0x6018
movsd %xmm0, 0x78(%rsi)
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
movsd (%rsi), %xmm0
movsd %xmm0, (%rdi)
movsd %xmm0, 0x8(%rdi)
movsd %xmm0, 0x10(%rdi)
movb $0x1, %bpl
xorl %r15d, %r15d
xorl %r12d, %r12d
movsd 0x8(%r14,%r12,8), %xmm0
callq 0x4430
mulsd (%rbx,%r12,8), %xmm0
movsd %xmm0, (%rbx,%r12,8)
movq %r15, %r13
movsd 0x8(%r14,%r12,8), %xmm0
callq 0x4060
mulsd 0x8(%rbx,%r13,8), %xmm0
movsd %xmm0, 0x8(%rbx,%r13,8)
incq %r13
cmpq $0x2, %r13
jne 0x54a9
incq %r15
movl $0x1, %r12d
testb $0x1, %bpl
movl $0x0, %ebp
jne 0x548e
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/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 %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
xorpd %xmm0, %xmm0
movupd %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
movq (%rdx), %rax
movq %rax, 0x18(%rdi)
xorpd %xmm0, %xmm0
xorl %eax, %eax
movsd (%r14,%rax,8), %xmm1
mulsd %xmm1, %xmm1
addsd %xmm1, %xmm0
incq %rax
cmpq $0x3, %rax
jne 0x55b4
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x55db
sqrtsd %xmm0, %xmm0
jmp 0x55e0
callq 0x41f0
movsd %xmm0, (%rbx)
movb $0x1, %bpl
xorl %r15d, %r15d
xorl %eax, %eax
xorpd %xmm0, %xmm0
movq %rax, %rcx
movsd (%r14,%rcx,8), %xmm1
mulsd %xmm1, %xmm1
addsd %xmm1, %xmm0
incq %rcx
cmpq $0x3, %rcx
jne 0x55f3
movsd (%r14,%rax,8), %xmm1
ucomisd 0xe9f8(%rip), %xmm0     # 0x14010
jb 0x5620
sqrtsd %xmm0, %xmm0
jmp 0x562f
movsd %xmm1, (%rsp)
callq 0x41f0
movsd (%rsp), %xmm1
divsd %xmm0, %xmm1
movapd %xmm1, %xmm0
callq 0x4240
testb $0x1, %r15b
jne 0x565c
movsd %xmm0, 0x8(%rbx)
movl $0x1, %eax
movb $0x1, %r15b
testb $0x1, %bpl
movl $0x0, %ebp
jne 0x55ec
jmp 0x567e
movsd %xmm0, 0x10(%rbx)
xorpd %xmm1, %xmm1
ucomisd 0x10(%r14), %xmm1
jbe 0x567e
movsd 0xe993(%rip), %xmm1     # 0x14008
subsd %xmm0, %xmm1
movsd %xmm1, 0x10(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 0x621c(%rip), %rdi      # 0x8fe0
callq 0x2270
leaq 0x20(%rbx), %r14
movq %rax, %rdi
movq %r14, %rsi
callq 0x2140
leaq 0x24(%rbx), %r15
movq %rax, %rdi
movq %r15, %rsi
callq 0x2140
leaq 0x28(%rbx), %rsi
movq %rax, %rdi
callq 0x2140
movl 0x24(%rbx), %eax
imull 0x20(%rbx), %eax
testl %eax, %eax
jle 0x2e39
addq $0x58, %rbx
xorl %r13d, %r13d
leaq -0x29(%rbp), %r12
movq 0x61d0(%rip), %rdi      # 0x8fe0
leaq -0x30(%rbp), %rsi
callq 0x2140
movb -0x30(%rbp), %al
movb %al, -0x29(%rbp)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x4496
incl %r13d
movl (%r15), %eax
imull (%r14), %eax
cmpl %eax, %r13d
jl 0x2e09
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/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
movq %r12, %rax
subq %r13, %rax
movq %rax, -0x50(%rbp)
je 0x2ea2
leaq 0x70(%rbx), %r14
leaq -0x29(%rbp), %r15
movb (%r13), %al
movb %al, -0x29(%rbp)
movq %r14, %rdi
movq %r15, %rsi
callq 0x41d6
movss (%rax), %xmm0
addss 0x31b2(%rip), %xmm0     # 0x6048
movss %xmm0, (%rax)
incq %r13
cmpq %r12, %r13
jne 0x2e78
movq 0x88(%rbx), %r14
addq $0x78, %rbx
cmpq %rbx, %r14
je 0x2ec2
movq -0x50(%rbp), %rcx
testq %rcx, %rcx
js 0x2ecb
cvtsi2ss %rcx, %xmm2
jmp 0x2ee0
xorps %xmm0, %xmm0
movaps %xmm0, -0x50(%rbp)
jmp 0x2f2c
movq %rcx, %rax
shrq %rax
andl $0x1, %ecx
orq %rax, %rcx
cvtsi2ss %rcx, %xmm2
addss %xmm2, %xmm2
xorps %xmm1, %xmm1
movaps %xmm1, -0x50(%rbp)
movss %xmm2, -0x30(%rbp)
movss 0x24(%r14), %xmm0
divss %xmm2, %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 0x2180
movss -0x30(%rbp), %xmm2
movq %rax, %r14
cmpq %rbx, %rax
jne 0x2eec
movaps -0x50(%rbp), %xmm0
xorps 0x3119(%rip), %xmm0     # 0x6050
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/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
movaps %xmm0, -0x60(%rbp)
movq $0x0, -0x50(%rbp)
movq 0x88(%rdi), %r14
movq %rdi, -0x68(%rbp)
leaq 0x78(%rdi), %r13
cmpq %r13, %r14
je 0x2fdd
leaq -0x60(%rbp), %r15
leaq -0x170(%rbp), %r12
movb 0x20(%r14), %bl
movss 0x24(%r14), %xmm0
movss %xmm0, -0x2c(%rbp)
movl $0x18, %edi
callq 0x2200
xorps %xmm0, %xmm0
movaps %xmm0, (%rax)
movq $0x0, 0x10(%rax)
movb %bl, (%rax)
movss -0x2c(%rbp), %xmm0
movss %xmm0, 0x4(%rax)
movq %rax, -0x170(%rbp)
movq %r15, %rdi
movq %r12, %rsi
callq 0x30b2
movq %r14, %rdi
callq 0x2180
movq %rax, %r14
cmpq %r13, %rax
jne 0x2f88
leaq -0x60(%rbp), %r14
leaq -0x38(%rbp), %r15
movq -0x60(%rbp), %rax
movq -0x58(%rbp), %rcx
subq %rax, %rcx
cmpq $0x8, %rcx
je 0x304c
movq (%rax), %r12
movq %r14, %rdi
callq 0x3142
movq -0x60(%rbp), %rax
movq (%rax), %r13
movq %r14, %rdi
callq 0x3142
movl $0x18, %edi
callq 0x2200
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rax)
movq %rax, -0x38(%rbp)
movss 0x4(%r12), %xmm0
addss 0x4(%r13), %xmm0
movss %xmm0, 0x4(%rax)
movq %r12, 0x8(%rax)
movq %r13, 0x10(%rax)
movq %r14, %rdi
movq %r15, %rsi
callq 0x30b2
jmp 0x2fe5
movq -0x38(%rbp), %rsi
movq -0x68(%rbp), %rdi
movq %rsi, 0x50(%rdi)
leaq -0x170(%rbp), %rdx
xorl %ecx, %ecx
callq 0x3246
movq -0x60(%rbp), %rdi
testq %rdi, %rdi
je 0x307b
movq -0x50(%rbp), %rsi
subq %rdi, %rsi
callq 0x2210
addq $0x148, %rsp            # imm = 0x148
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3091
jmp 0x3091
movq %rax, %rbx
movq -0x60(%rbp), %rdi
testq %rdi, %rdi
je 0x30a9
movq -0x50(%rbp), %rsi
subq %rdi, %rsi
callq 0x2210
movq %rbx, %rdi
callq 0x2360
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, %r15
movq %rsi, %rbx
movq %rdi, %r14
cmpq $0x0, 0x8(%rsi)
movslq %ecx, %r12
je 0x3283
movb $0x30, (%r15,%r12)
movq 0x8(%rbx), %rsi
leal 0x1(%r12), %ecx
movq %r14, %rdi
movq %r15, %rdx
callq 0x3246
cmpq $0x0, 0x10(%rbx)
je 0x32aa
movb $0x31, (%r15,%r12)
movq 0x10(%rbx), %rsi
leal 0x1(%r12), %ecx
movq %r14, %rdi
movq %r15, %rdx
callq 0x3246
cmpq $0x0, 0x10(%rbx)
jne 0x32fe
cmpq $0x0, 0x8(%rbx)
jne 0x32fe
addq %r15, %r12
leaq -0x38(%rbp), %r13
movq %r13, -0x10(%r13)
leaq -0x48(%rbp), %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x2d0a
addq $0xa0, %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x423e
leaq -0x48(%rbp), %rsi
movq %rax, %rdi
callq 0x2120
movq -0x48(%rbp), %rdi
cmpq %r13, %rdi
je 0x32fe
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2210
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq -0x48(%rbp), %rdi
cmpq %r13, %rdi
je 0x3325
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2210
movq %rbx, %rdi
callq 0x2360
nop
// File: /workspace/github_cpp_makefile_star2_O3/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, -0x58(%rbp)
movq %rdi, %rbx
callq 0x2da8
movq %rbx, %rdi
callq 0x2e48
movq %rbx, %rdi
callq 0x2f46
movq $0x0, 0xf0(%rbx)
movq 0x58(%rbx), %r13
movq 0x60(%rbx), %r14
cmpq %r14, %r13
je 0x3425
leaq 0xa0(%rbx), %rax
movq %rax, -0x68(%rbp)
leaq 0xa8(%rbx), %r15
leaq -0x40(%rbp), %r12
leaq 0xd0(%rbx), %rax
movq %rax, -0x60(%rbp)
movb (%r13), %al
movb %al, -0x29(%rbp)
movq 0xb0(%rbx), %rcx
testq %rcx, %rcx
je 0x3419
movq %r15, %rdx
xorl %esi, %esi
cmpb %al, 0x20(%rcx)
setb %sil
cmovaeq %rcx, %rdx
movq 0x10(%rcx,%rsi,8), %rcx
testq %rcx, %rcx
jne 0x33ae
cmpq %r15, %rdx
je 0x3419
cmpb 0x20(%rdx), %al
jb 0x3419
movq -0x68(%rbp), %rdi
leaq -0x29(%rbp), %rsi
callq 0x423e
movq %r12, -0x50(%rbp)
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq -0x50(%rbp), %rdi
callq 0x2d0a
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rdx
movq -0x60(%rbp), %rdi
callq 0x20b0
movq -0x50(%rbp), %rdi
cmpq %r12, %rdi
je 0x3419
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x2210
incq %r13
cmpq %r14, %r13
jne 0x3398
movq 0xd0(%rbx), %rdi
movq 0xd8(%rbx), %rsi
addq %rdi, %rsi
xorl %r14d, %r14d
leaq -0x50(%rbp), %rdx
movb %r14b, (%rdx)
callq 0x4b2c
movq %rax, %rcx
subq 0xd0(%rbx), %rcx
movq %rcx, 0xd8(%rbx)
movb %r14b, (%rax)
movq 0xd8(%rbx), %rax
movq %rax, 0xf0(%rbx)
leaq -0x78(%rbp), %r15
movq %r15, -0x10(%r15)
movq -0x58(%rbp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq -0x88(%rbp), %r14
movq %r14, %rdi
callq 0x2d0a
movq %rbx, %rdi
movq %r14, %rsi
callq 0x34f4
movq -0x88(%rbp), %rdi
cmpq %r15, %rdi
je 0x34af
movq -0x78(%rbp), %rsi
incq %rsi
callq 0x2210
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq -0x88(%rbp), %rdi
cmpq %r15, %rdi
je 0x34eb
movq -0x78(%rbp), %rsi
jmp 0x34e3
movq %rax, %rbx
movq -0x50(%rbp), %rdi
cmpq %r12, %rdi
je 0x34eb
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x2210
movq %rbx, %rdi
callq 0x2360
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 0x38e5
movq %rax, 0x118(%rbx)
leaq -0x40(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0x278c(%rip), %rdx      # 0x6081
leaq -0x50(%rbp), %rdi
movq %rdx, %rsi
callq 0x2c6c
movq 0xd8(%rbx), %r14
testq %r14, %r14
je 0x3a0a
leaq 0x110(%rbx), %rax
movq %rax, -0x58(%rbp)
movq 0xd0(%rbx), %r13
xorl %r12d, %r12d
leaq -0x50(%rbp), %r15
movsbl (%r13,%r12), %esi
movq %r15, %rdi
callq 0x21d0
cmpq $0x8, -0x48(%rbp)
jne 0x3993
leaq -0x30(%rbp), %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x43b8
movb -0x30(%rbp), %al
movb %al, -0x30(%rbp)
movq 0x118(%rbx), %rsi
cmpq 0x120(%rbx), %rsi
je 0x396e
movb %al, (%rsi)
incq 0x118(%rbx)
jmp 0x397b
movq -0x58(%rbp), %rdi
leaq -0x30(%rbp), %rdx
callq 0x507e
movq -0x48(%rbp), %rdx
movq %r15, %rdi
xorl %esi, %esi
leaq 0x26f6(%rip), %rcx      # 0x6081
xorl %r8d, %r8d
callq 0x2300
incq %r12
cmpq %r12, %r14
jne 0x392a
movl 0xd8(%rbx), %r14d
andl $0x7, %r14d
leaq -0x40(%rbp), %r12
je 0x3a0a
orl $-0x8, %r14d
leaq -0x50(%rbp), %r15
movq %r15, %rdi
movl $0x30, %esi
callq 0x21d0
incl %r14d
jne 0x39b4
cmpq $0x8, -0x48(%rbp)
jne 0x3a0a
leaq -0x30(%rbp), %rdi
leaq -0x50(%rbp), %rsi
xorl %edx, %edx
callq 0x43b8
movb -0x30(%rbp), %al
movb %al, -0x30(%rbp)
movq 0x118(%rbx), %rsi
cmpq 0x120(%rbx), %rsi
je 0x39fd
movb %al, (%rsi)
incq 0x118(%rbx)
jmp 0x3a0a
leaq -0x30(%rbp), %rdx
movq -0x58(%rbp), %rdi
callq 0x507e
movq -0x50(%rbp), %rdi
cmpq %r12, %rdi
je 0x3a1f
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x2210
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3a38
jmp 0x3a38
jmp 0x3a38
jmp 0x3a38
jmp 0x3a38
movq %rax, %rbx
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x3a54
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x2210
movq %rbx, %rdi
callq 0x2360
// File: /workspace/github_cpp_makefile_star2_O3/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 %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
leaq -0x58(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0xd90(%rip), %rsi       # 0x2030
leaq 0xd96(%rip), %rdx       # 0x203d
leaq -0x68(%rbp), %rdi
callq 0x161c
leaq 0x2a29(%rip), %r15      # 0x3ce0
leaq -0xb0(%rbp), %rdi
movq %r15, -0x8(%rdi)
leaq -0xa0(%rbp), %r14
movq %r14, -0x10(%r14)
movq -0x68(%rbp), %rsi
movq -0x60(%rbp), %rdx
addq %rsi, %rdx
callq 0x157e
movabsq $0x4049000000000000, %rbx # imm = 0x4049000000000000
movq %rbx, -0x90(%rbp)
movq -0x68(%rbp), %rdi
cmpq %r12, %rdi
je 0x1303
movq -0x58(%rbp), %rsi
incq %rsi
callq 0x10b0
movq 0x2cce(%rip), %rdi      # 0x3fd8
leaq -0xb8(%rbp), %rsi
movl $0xa, %edx
callq 0x16bc
leaq -0x78(%rbp), %r13
movq %r13, -0x10(%r13)
leaq 0xd06(%rip), %rsi       # 0x2030
leaq 0xd0c(%rip), %rdx       # 0x203d
leaq -0x88(%rbp), %rdi
callq 0x161c
leaq -0x60(%rbp), %rdi
movq %r15, -0x8(%rdi)
leaq -0x50(%rbp), %r12
movq %r12, -0x10(%r12)
movq -0x88(%rbp), %rsi
movq -0x80(%rbp), %rdx
addq %rsi, %rdx
callq 0x157e
movq %rbx, -0x40(%rbp)
movq $0x5, -0x38(%rbp)
movabsq $0x3fc851eb851eb852, %rax # imm = 0x3FC851EB851EB852
movq %rax, -0x30(%rbp)
leaq 0x298e(%rip), %rax      # 0x3d10
addq $0x10, %rax
movq %rax, -0x68(%rbp)
movq -0x88(%rbp), %rdi
cmpq %r13, %rdi
je 0x13a2
movq -0x78(%rbp), %rsi
incq %rsi
callq 0x10b0
movq 0x2c2f(%rip), %rdi      # 0x3fd8
leaq -0x68(%rbp), %rsi
movl $0xa, %edx
callq 0x16bc
movq %r15, -0x68(%rbp)
movq -0x60(%rbp), %rdi
cmpq %r12, %rdi
je 0x13d0
movq -0x50(%rbp), %rsi
incq %rsi
callq 0x10b0
movq %r15, -0xb8(%rbp)
movq -0xb0(%rbp), %rdi
cmpq %r14, %rdi
je 0x13f2
movq -0xa0(%rbp), %rsi
incq %rsi
callq 0x10b0
xorl %eax, %eax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq %r15, -0x68(%rbp)
movq -0x60(%rbp), %rdi
cmpq %r12, %rdi
je 0x143e
movq -0x50(%rbp), %rsi
jmp 0x142f
movq %rax, %rbx
movq -0x88(%rbp), %rdi
cmpq %r13, %rdi
je 0x143e
movq -0x78(%rbp), %rsi
incq %rsi
callq 0x10b0
jmp 0x143e
jmp 0x143b
movq %rax, %rbx
movq %r15, -0xb8(%rbp)
movq -0xb0(%rbp), %rdi
cmpq %r14, %rdi
je 0x1477
movq -0xa0(%rbp), %rsi
jmp 0x146a
movq %rax, %rbx
movq -0x68(%rbp), %rdi
cmpq %r12, %rdi
je 0x1477
movq -0x58(%rbp), %rsi
incq %rsi
callq 0x10b0
jmp 0x1477
movq %rax, %rbx
movq %rbx, %rdi
callq 0x10f0
nop
// File: /workspace/github_cpp_makefile_star2_O3/Kobzol[P]sigmod-2016/src/graph.cpp
// Function: Graph::add_edge(unsigned int, unsigned int)
void Graph::add_edge(sigint from, sigint to)
{
    if (from == to) return;
    if (!this->has_vertex(from)) this->add_vertex(from);
    if (!this->has_vertex(to)) this->add_vertex(to);

    Vertex& dest = this->nodes.at(to);

#ifdef CHECK_UNIQUE_EDGES
    for (Vertex* edge : this->nodes.at(from).edges_out)
    {
        if (edge == &dest)
        {
            this->non_unique++;
            return;
        }
    }
#endif

    Vertex& src = this->nodes.at(from);

    src.edges_out.push_back(&dest);
#ifdef USE_UNION_FIND
    src.join(*this, dest);
#endif
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movl %esi, 0x14(%rsp)
movl %edx, 0x10(%rsp)
cmpl %edx, %esi
je 0x26fe
movl %esi, %r14d
leaq 0x8(%rsp), %rsi
movl %edx, %ebp
movq %rdi, %rbx
movl %r14d, (%rsi)
callq 0x2882
testq %rax, %rax
jne 0x2671
leaq 0x8(%rsp), %rdx
movq %rbx, %rdi
movq %rdx, %rsi
movl %r14d, (%rdx)
callq 0x2bfc
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
movl %ebp, (%rsi)
callq 0x2882
testq %rax, %rax
jne 0x2697
leaq 0x8(%rsp), %rdx
movq %rbx, %rdi
movq %rdx, %rsi
movl %ebp, (%rdx)
callq 0x2bfc
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x2a72
testq %rax, %rax
je 0x2709
leaq 0x14(%rsp), %rsi
movq %rbx, %rdi
movq %rax, %r14
callq 0x2a72
testq %rax, %rax
je 0x2709
addq $0x10, %r14
leaq 0x10(%rax), %r15
movq %r14, 0x8(%rsp)
movq 0x20(%rax), %rsi
cmpq 0x28(%rax), %rsi
je 0x26df
movq %r14, (%rsi)
addq $0x8, 0x20(%rax)
jmp 0x26f0
addq $0x18, %rax
leaq 0x8(%rsp), %rdx
movq %rax, %rdi
callq 0x2ace
movq %r15, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x44c0
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x28f4(%rip), %rdi      # 0x5004
callq 0x2260
nop
// File: /workspace/github_cpp_makefile_star2_O3/Kobzol[P]sigmod-2016/src/graph.cpp
// Function: Graph::remove_edge(unsigned int, unsigned int)
void Graph::remove_edge(sigint from, sigint to)
{
    if (!this->has_vertex(from)) return;

    std::vector<Vertex*>& edges = this->nodes.at(from).edges_out;
    Vertex* address = &this->nodes.at(to);

#ifdef CHECK_UNIQUE_EDGES   // je kontrola uz pri vkladani, neni potreba prochazet vsechny
    size_t size = edges.size();

    for (size_t i = 0; i < size; i++)
    {
        if (edges[i] == address)
        {
            edges.erase(edges.begin() + i);
            return;
        }
    }
#else
    for (size_t i = 0; i < edges.size(); i++)
    {
        if (edges[i] == address)
        {
            edges.erase(edges.begin() + i);
            i--;
        }
    }
#endif
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
leaq 0xc(%rsp), %rax
movq %rdi, %r14
movl %esi, 0x8(%rsp)
movl %edx, 0x4(%rsp)
movl %esi, (%rax)
movq %rax, %rsi
callq 0x2882
testq %rax, %rax
je 0x27ce
leaq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x2a72
testq %rax, %rax
je 0x27d8
leaq 0x4(%rsp), %rsi
movq %r14, %rdi
movq %rax, %rbx
callq 0x2a72
testq %rax, %rax
je 0x27d8
movq %rax, %r14
movq 0x18(%rbx), %rax
movq 0x20(%rbx), %rdx
cmpq %rax, %rdx
je 0x27ce
addq $0x10, %r14
xorl %r15d, %r15d
cmpq %r14, (%rax,%r15,8)
jne 0x27bc
leaq (%rax,%r15,8), %rdi
leaq 0x8(%rdi), %rsi
cmpq %rdx, %rsi
je 0x27b1
subq %rsi, %rdx
callq 0x22c0
movq 0x18(%rbx), %rax
movq 0x20(%rbx), %rdx
addq $-0x8, %rdx
decq %r15
movq %rdx, 0x20(%rbx)
movq %rdx, %rcx
subq %rax, %rcx
incq %r15
sarq $0x3, %rcx
cmpq %rcx, %r15
jb 0x278e
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
leaq 0x2825(%rip), %rdi      # 0x5004
callq 0x2260
// File: /workspace/github_cpp_makefile_star2_O3/Kobzol[P]sigmod-2016/src/thread_pool.h
// Function: Thread::thread_fn()
void thread_fn()
    {
        while (!this->terminated)
        {
            //std::cerr << "Thread " << this->id << " waiting for job" << std::endl;
            Job job = jobQueue.pop_job();
            //std::cerr << "Thread " << this->id << " got job" << std::endl;

#ifndef THREAD_USE_JOB_SYNC
            if (job.type == JobType::Invalid)
            {
                std::this_thread::sleep_for(std::chrono::milliseconds(1));
                continue;
            }
#endif

            int64_t result = 0;
            if (job.type == JobType::AddEdge)
            {
                graph.add_edge(job.from, job.to);
            }
            else if (job.type == JobType::RemoveEdge)
            {
                graph.remove_edge(job.from, job.to);
            }
            else
            {
                result = GraphEvaluator::query(job.from, job.to, job.id, this->id);
            }

            //std::cerr << "Thread " << this->id << " giving job" << std::endl;
            jobQueue.add_result(job, result);
            //std::cerr << "Thread " << this->id << " gave job" << std::endl;
        }
    }

// Assembly:
cmpb $0x0, 0x8(%rdi)
jne 0x370b
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x38, %rsp
leaq 0x3121b6(%rip), %r14    # 0x315848
leaq 0x8(%rsp), %r15
leaq 0x311f42(%rip), %r12    # 0x3155e0
movq %rdi, %rbx
movq %r15, %rdi
movq %r14, %rsi
callq 0x3792
movl 0x10(%rsp), %eax
movl 0x14(%rsp), %esi
movl 0x18(%rsp), %edx
cmpl $0x2, %eax
je 0x36cc
cmpl $0x1, %eax
jne 0x36d8
movq %r12, %rdi
callq 0x262a
jmp 0x36d4
movq %r12, %rdi
callq 0x2728
xorl %edx, %edx
jmp 0x36ef
movq 0x8(%rsp), %rax
movq (%rbx), %rcx
movl %esi, %edi
movl %edx, %esi
movq %rax, %rdx
callq 0x386a
movq %rax, %rdx
movq %r14, %rdi
movq %r15, %rsi
callq 0x3ac8
cmpb $0x1, 0x8(%rbx)
jne 0x36a1
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/Kobzol[P]sigmod-2016/src/job.h
// Function: JobQueue::pop_job()
Job pop_job()
    {
        std::unique_lock<std::mutex> guard(this->lock);

#ifdef THREAD_USE_JOB_SYNC
        this->bufferEmpty.wait(guard, [this] { return this->is_job_available(); });
#else
        if (!this->is_job_available())
        {
            return Job(JobType::Invalid);
        }
#endif

        Job job = this->jobs[this->start];

        this->start = (this->start + 1) % this->jobs.size;
        this->size--;
        this->jobs_in_work++;

#ifdef THREAD_USE_JOB_SYNC
        if (this->size == this->jobs.capacity - 1)
        {
            this->bufferFull.notify_one();
        }
#endif

        return job;
    }

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
leaq 0xb0(%rsi), %rax
movq %rsp, %r15
movq %rdi, %rbx
movq %r15, %rdi
movq %rsi, %r14
movq %rax, (%r15)
movb $0x0, 0x8(%r15)
callq 0x4420
movb $0x1, 0x8(%r15)
leaq 0x68(%r14), %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x3bd0
movq 0xa0(%r14), %rax
movq 0xe8(%r14), %rdx
movslq %eax, %rcx
incq %rax
leaq (%rcx,%rcx,2), %rcx
shlq $0x4, %rcx
vmovups (%rdx,%rcx), %ymm0
vmovups 0x10(%rdx,%rcx), %ymm1
xorl %edx, %edx
vmovups %ymm1, 0x10(%rbx)
vmovups %ymm0, (%rbx)
divq 0xd8(%r14)
movq %rdx, 0xa0(%r14)
movq 0x98(%r14), %rax
leaq -0x1(%rax), %rcx
movq %rcx, 0x98(%r14)
incq (%r14)
cmpq 0xe0(%r14), %rax
jne 0x383f
addq $0x130, %r14            # imm = 0x130
movq %r14, %rdi
vzeroupper
callq 0x20d0
movq %rsp, %rdi
vzeroupper
callq 0x3452
movq %rbx, %rax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq %rsp, %rdi
movq %rax, %rbx
callq 0x3452
movq %rbx, %rdi
callq 0x2300
// File: /workspace/github_cpp_makefile_star2_O3/Kobzol[P]sigmod-2016/src/job.h
// Function: JobQueue::add_result(Job&, long)
void add_result(Job& job, int64_t result)
    {
        std::lock_guard<std::mutex> guard(this->lock);

        if (job.type == JobType::Query)
        {
            this->results.insert({job.id, result});
        }

        job.modifyBarrier->pop();

        this->jobs_in_work--;

#ifdef THREAD_USE_JOB_SYNC
        this->bufferEmpty.notify_one();
#endif

        if (this->batchEnded && this->size == 0 && this->jobs_in_work == 0)
        {
            std::unique_lock<std::mutex> lock(this->jobMutex);
            this->batchEndCV.notify_one();
            this->reset();
        }
    }

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x18, %rsp
leaq 0xb0(%rdi), %rbx
movq %rdi, %r14
movq %rdx, %r12
movq %rsi, %r15
movq %rbx, %rdi
callq 0x2280
testl %eax, %eax
jne 0x3bb4
cmpl $0x0, 0x8(%r15)
jne 0x3b15
movq (%r15), %rax
leaq 0x8(%rsp), %rsi
leaq 0x100(%r14), %rdi
movq %rax, (%rsi)
movq %r12, 0x8(%rsi)
callq 0x40a0
movq 0x20(%r15), %rax
leaq 0x68(%r14), %rdi
decq 0x8(%rax)
decq (%r14)
callq 0x20d0
cmpb $0x1, 0x60(%r14)
jne 0x3ba0
cmpq $0x0, 0x98(%r14)
jne 0x3ba0
cmpq $0x0, (%r14)
jne 0x3ba0
leaq 0x8(%r14), %rax
leaq 0x8(%rsp), %rdi
movq %rax, (%rdi)
movb $0x0, 0x8(%rdi)
callq 0x4420
leaq 0x8(%rsp), %r15
leaq 0x30(%r14), %rdi
movb $0x1, 0x8(%r15)
callq 0x20d0
leaq 0x4661(%rip), %rcx      # 0x81d0
xorl %eax, %eax
movb %al, 0x60(%r14)
movb %al, 0x4655(%rip)       # 0x81d0
movq %r15, %rdi
movq $0x0, 0x464f(%rip) # 0x81d8
movq $0x1, 0x311a3c(%rip) # 0x3155d0
movq %rcx, 0xf0(%r14)
callq 0x3452
movq %rbx, %rdi
callq 0x2170
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movl %eax, %edi
callq 0x2110
jmp 0x3bbd
movq %rbx, %rdi
movq %rax, %r14
callq 0x2170
movq %r14, %rdi
callq 0x2300
// File: /workspace/github_cpp_makefile_star2_O3/Kobzol[P]sigmod-2016/src/vector.h
// Function: Vector<Job>::reallocate(unsigned long)
void reallocate(size_t capacity)
	{
		if (this->data != nullptr)
		{
			T* new_data = new T[capacity];
			memcpy(new_data, this->data, this->size * sizeof(T));

			delete[] this->data;

			this->data = new_data;
		}
		else this->data = new T[capacity];

		this->capacity = capacity;

	}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movl $0x30, %ecx
movq %rsi, %rax
movq 0x10(%rdi), %r12
movq %rdi, %r14
movq $-0x1, %rdi
movq %rsi, %rbx
mulq %rcx
cmovnoq %rax, %rdi
callq 0x2030
movq %rax, %r15
testq %r12, %r12
je 0x42eb
testq %rbx, %rbx
je 0x42c5
leaq (%rbx,%rbx,2), %rdx
vpmovsxbq 0xf6a(%rip), %zmm1 # 0x51a0
vpmovsxbq 0xf58(%rip), %zmm2 # 0x5198
vpbroadcastd 0xf6e(%rip), %zmm3 # 0x51b8
vpmovsxwd 0xf68(%rip), %zmm4 # 0x51bc
movabsq $-0x5555555555555555, %rax # imm = 0xAAAAAAAAAAAAAAAB
xorl %ecx, %ecx
shlq $0x4, %rdx
addq $-0x30, %rdx
mulxq %rax, %rax, %rax
movq %r15, %rdx
vpbroadcastq %rax, %zmm0
shrq $0x5, %rax
addq $0x10, %rax
vpsrlq $0x5, %zmm0, %zmm0
andq $-0x10, %rax
vpbroadcastq %rcx, %zmm5
addq $0x10, %rcx
vporq %zmm1, %zmm5, %zmm6
vporq %zmm2, %zmm5, %zmm5
vpcmpleuq %zmm0, %zmm5, %k0
vpcmpleuq %zmm0, %zmm6, %k1
kunpckbw %k0, %k1, %k1
vpscatterdd %zmm3, 0x8(%rdx,%zmm4) {%k1}
addq $0x300, %rdx            # imm = 0x300
cmpq %rcx, %rax
jne 0x4289
movq (%r14), %rax
movq %r15, %rdi
movq %r12, %rsi
shlq $0x4, %rax
leaq (%rax,%rax,2), %rdx
vzeroupper
callq 0x2190
movq %r12, %rdi
callq 0x2220
jmp 0x4391
testq %rbx, %rbx
je 0x4391
leaq (%rbx,%rbx,2), %rdx
vpmovsxbq 0xe9e(%rip), %zmm1 # 0x51a0
vpmovsxbq 0xe8c(%rip), %zmm2 # 0x5198
vpbroadcastd 0xea2(%rip), %zmm3 # 0x51b8
vpmovsxwd 0xe9c(%rip), %zmm4 # 0x51bc
movabsq $-0x5555555555555555, %rax # imm = 0xAAAAAAAAAAAAAAAB
xorl %ecx, %ecx
shlq $0x4, %rdx
addq $-0x30, %rdx
mulxq %rax, %rax, %rax
movq %r15, %rdx
vpbroadcastq %rax, %zmm0
shrq $0x5, %rax
addq $0x10, %rax
vpsrlq $0x5, %zmm0, %zmm0
andq $-0x10, %rax
vpbroadcastq %rcx, %zmm5
addq $0x10, %rcx
vporq %zmm1, %zmm5, %zmm6
vporq %zmm2, %zmm5, %zmm5
vpcmpleuq %zmm0, %zmm5, %k0
vpcmpleuq %zmm0, %zmm6, %k1
kunpckbw %k0, %k1, %k1
vpscatterdd %zmm3, 0x8(%rdx,%zmm4) {%k1}
addq $0x300, %rdx            # imm = 0x300
cmpq %rcx, %rax
jne 0x4355
movq %r15, 0x10(%r14)
movq %rbx, 0x8(%r14)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
vzeroupper
retq
// File: /workspace/github_cpp_makefile_star2_O3/Kobzol[P]sigmod-2016/src/vertex.cpp
// Function: Vertex::join(Graph&, Vertex&)
void Vertex::join(Graph& graph, Vertex& vertex)
{
    sigint thisParentId = this->get_parent(graph);
    sigint otherParentId = vertex.get_parent(graph);

    if (thisParentId == otherParentId) return;

    Vertex& thisParent = graph.nodes[thisParentId];
    Vertex& otherParent = graph.nodes[otherParentId];

    if (thisParent.rank < otherParent.rank)
    {
        thisParent.parent = otherParentId;
    }
    else if (thisParent.rank > otherParent.rank)
    {
        otherParent.parent = thisParentId;
    }
    else
    {
        otherParent.parent = thisParentId;
        thisParent.rank++;
    }
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdx, %r14
movq %rsi, %rbx
callq 0x4484
movl %eax, %ebp
movl %eax, 0xc(%rsp)
movq %r14, %rdi
movq %rbx, %rsi
callq 0x4484
movl %eax, 0x8(%rsp)
cmpl %eax, %ebp
je 0x453c
leaq 0xc(%rsp), %rsi
movq %rbx, %rdi
callq 0x3c2a
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
movq %rax, %r14
callq 0x3c2a
movq 0xe8(%r14), %rcx
cmpq 0xe8(%rax), %rcx
jae 0x4526
movl 0x8(%rsp), %eax
movl %eax, 0xe0(%r14)
jmp 0x453c
movl 0xc(%rsp), %edx
movl %edx, 0xe0(%rax)
ja 0x453c
incq %rcx
movq %rcx, 0xe8(%r14)
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/Ahhgust[P]STRaitRazor/str8.cpp
// Function: initQvalLUT(char)
void
initQvalLUT(char qtype) {
  unsigned i;


  if (qtype == EDGAR_QUALITY) {
    // standard quality to probability (of error) computation
    // see https://en.wikipedia.org/wiki/Phred_quality_score
    // we do this A LOT
    // so let's make a LUT
    for(i = 0; i < MAXQVAL; ++i) {
      QUALITY_TO_ERRORPROB[i] = pow(10, i/-10.0);
    }

  } else if (qtype == EXPECT_QUALITY) {

    // we want exp( sum(log( prob correct )) ==
    // prod(prob correct) ==
    // prod(1.0 - prob incorrect)
    for(i = 0; i < MAXQVAL; ++i) {
      QUALITY_TO_ERRORPROB[i] = log(1.0 - pow(10, i/-10.0));
    }

  } else {
    fprintf(stderr, "Illegal quality flag: %u", (int)qtype);
    exit(EXIT_FAILURE);
  }

}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
cmpl $0x1, %edi
je 0x3a00
cmpl $0x2, %edi
jne 0x3a43
leaq 0x6261bb(%rip), %rbx    # 0x629b70
xorl %r14d, %r14d
xorps %xmm1, %xmm1
cvtsi2sd %r14d, %xmm1
divsd 0x7640(%rip), %xmm1     # 0xb008
movsd 0x7640(%rip), %xmm0     # 0xb010
callq 0x3470
movsd 0x763b(%rip), %xmm1     # 0xb018
subsd %xmm0, %xmm1
movapd %xmm1, %xmm0
callq 0x3230
movsd %xmm0, (%rbx)
incq %r14
addq $0x8, %rbx
cmpq $0x100, %r14            # imm = 0x100
jne 0x39b8
jmp 0x3a3b
leaq 0x626169(%rip), %rbx    # 0x629b70
xorl %r14d, %r14d
xorps %xmm1, %xmm1
cvtsi2sd %r14d, %xmm1
divsd 0x75ee(%rip), %xmm1     # 0xb008
movsd 0x75ee(%rip), %xmm0     # 0xb010
callq 0x3470
movsd %xmm0, (%rbx)
incq %r14
addq $0x8, %rbx
cmpq $0x100, %r14            # imm = 0x100
jne 0x3a0a
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movzbl %dil, %edi
callq 0x3520
// File: /workspace/github_cpp_makefile_star2_O3/Ahhgust[P]STRaitRazor/str8.cpp
// Function: getProbCorrect(char const*, unsigned int)
double
getProbCorrect(const char *qseq, unsigned stop) {

  unsigned i = 0;
  unsigned qval;

  double logsum=0.;

  for(i=0; i < stop && *qseq; ++i, ++qseq) {
    qval = *qseq - PHREDMINUS;
    if (qval < 0)
      qval = 0;
    else if (qval >= MAXQVAL)
      qval = MAXQVAL-1;
    // equivalent to: += log(1-error prob)
    // note that QUALITY_TO_ERRORPROB is constructed differently in this case
    logsum += QUALITY_TO_ERRORPROB[ qval ];
  }
  
  return exp(logsum);
}

// Assembly:
testl %esi, %esi
je 0x3abe
movl %esi, %eax
xorpd %xmm0, %xmm0
xorl %ecx, %ecx
movl $0xff, %edx
leaq 0x6260dd(%rip), %rsi    # 0x629b70
movsbl (%rdi,%rcx), %r8d
testl %r8d, %r8d
je 0x3490
addl $-0x21, %r8d
cmpl %edx, %r8d
cmovael %edx, %r8d
addsd (%rsi,%r8,8), %xmm0
incq %rcx
cmpl %ecx, %eax
jne 0x3a93
jmp 0x3490
xorps %xmm0, %xmm0
jmp 0x3490