// File: /workspace/github_cpp_makefile_star2_O3/CMU-SAFARI[P]optimal-seed-solver/HashTree.cc
// Function: HashTree::calculatePrefixSumFreqMap()
void HashTree::calculatePrefixSumFreqMap()
{
	map <unsigned int, unsigned long long> prefixSumFreqMap;
	prefixSumFreqMap.clear();
	int total = 0;
	if(&freqMap != NULL)
	{
		/* Add first element */
		map<unsigned int, unsigned long long>::iterator i = freqMap.begin();
		prefixSumFreqMap[i->first] = freqMap[i->first];
		i++;
		map<unsigned int, unsigned long long>::iterator prev = freqMap.begin();
		/* Loop for prefix sum */
		for (; i!=freqMap.end(); i++, prev++)
		{
			prefixSumFreqMap[i->first] = prefixSumFreqMap[prev->first] +
				freqMap[i->first];
			total = prefixSumFreqMap[i->first];
		}

		this->prefixSumFreqMap = prefixSumFreqMap;

		/* Calculate cumulative distribution of frequencies */
		map <unsigned int, double> cdfFreqMap;

		map<unsigned int, unsigned long long>::iterator iter = prefixSumFreqMap.begin();
		while(iter != prefixSumFreqMap.end())
		{
			cdfFreqMap[iter->first] = prefixSumFreqMap[iter->first]/total;
			iter++;
		}
		this->cdfFreqMap = cdfFreqMap;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rdi, %r14
leaq 0x20(%rsp), %rcx
movl $0x0, (%rcx)
xorl %eax, %eax
movq %rax, 0x8(%rcx)
movq %rcx, 0x10(%rcx)
movq %rcx, 0x18(%rcx)
movq %rax, 0x20(%rcx)
leaq 0x18(%rsp), %rdi
callq 0x7b46
leaq 0x8(%r14), %rdi
movq 0x20(%r14), %r15
leaq 0x20(%r15), %r12
movq %rdi, 0x10(%rsp)
movq %r12, %rsi
callq 0x7124
movq (%rax), %rbx
leaq 0x18(%rsp), %rdi
movq %r12, %rsi
callq 0x7124
movq %rbx, (%rax)
movq %r15, %rdi
callq 0x31d0
movq %rax, %r15
leaq 0x10(%r14), %rax
movq %rax, 0x8(%rsp)
cmpq %rax, %r15
movq %r14, (%rsp)
je 0x6305
movq 0x20(%r14), %r13
leaq 0x18(%rsp), %r12
leaq 0x20(%r13), %rsi
movq %r12, %rdi
callq 0x7124
movq (%rax), %r14
leaq 0x20(%r15), %rbp
movq 0x10(%rsp), %rdi
movq %rbp, %rsi
callq 0x7124
movq (%rax), %rbx
movq %r12, %rdi
movq %rbp, %rsi
callq 0x7124
addq %r14, %rbx
movq %rbx, (%rax)
movq %r12, %rdi
movq %rbp, %rsi
callq 0x7124
movq %rax, %rbp
movq %r15, %rdi
callq 0x31d0
movq %rax, %r15
movq %r13, %rdi
callq 0x31d0
movq %rax, %r13
cmpq 0x8(%rsp), %r15
jne 0x629c
movslq (%rbp), %rbx
movq (%rsp), %r14
jmp 0x6307
xorl %ebx, %ebx
leaq 0x38(%r14), %rdi
leaq 0x18(%rsp), %rsi
callq 0x72a6
leaq 0x50(%rsp), %rax
movl $0x0, (%rax)
xorl %ecx, %ecx
movq %rcx, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
movq %rcx, 0x20(%rax)
movq 0x30(%rsp), %r14
leaq 0x20(%rsp), %rax
cmpq %rax, %r14
je 0x63ad
leaq 0x18(%rsp), %r15
leaq 0x48(%rsp), %r12
leaq 0x20(%r14), %r13
movq %r15, %rdi
movq %r13, %rsi
callq 0x7124
movq (%rax), %rbp
movq %r12, %rdi
movq %r13, %rsi
callq 0x718a
movq %rax, %rcx
movq %rbp, %rax
xorl %edx, %edx
divq %rbx
movq %rax, %xmm0
punpckldq 0x2d90(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x2d98(%rip), %xmm0     # 0x9120
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
movsd %xmm1, (%rcx)
movq %r14, %rdi
callq 0x31d0
movq %rax, %r14
leaq 0x20(%rsp), %rax
cmpq %rax, %r14
jne 0x634b
movq (%rsp), %rdi
addq $0x68, %rdi
leaq 0x48(%rsp), %rsi
callq 0x751a
leaq 0x48(%rsp), %rdi
callq 0x7206
leaq 0x18(%rsp), %rdi
callq 0x7256
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x63e8
jmp 0x63f7
jmp 0x63f7
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x7206
jmp 0x63fa
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x7256
movq %rbx, %rdi
callq 0x3450