// File: /workspace/github_cpp_makefile_star2_O1/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 0x7b96
leaq 0x8(%r14), %rdi
movq 0x20(%r14), %r15
leaq 0x20(%r15), %r12
movq %rdi, 0x10(%rsp)
movq %r12, %rsi
callq 0x715a
movq (%rax), %rbx
leaq 0x18(%rsp), %rdi
movq %r12, %rsi
callq 0x715a
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 0x634f
movq 0x20(%r14), %r13
leaq 0x18(%rsp), %r12
leaq 0x20(%r13), %rsi
movq %r12, %rdi
callq 0x715a
movq (%rax), %r14
leaq 0x20(%r15), %rbp
movq 0x10(%rsp), %rdi
movq %rbp, %rsi
callq 0x715a
movq (%rax), %rbx
movq %r12, %rdi
movq %rbp, %rsi
callq 0x715a
addq %r14, %rbx
movq %rbx, (%rax)
movq %r12, %rdi
movq %rbp, %rsi
callq 0x715a
movq %rax, %rbp
movq %r15, %rdi
callq 0x31d0
movq %rax, %r15
movq %r13, %rdi
callq 0x31d0
movq %rax, %r13
cmpq 0x8(%rsp), %r15
jne 0x62e6
movslq (%rbp), %rbx
movq (%rsp), %r14
jmp 0x6351
xorl %ebx, %ebx
leaq 0x38(%r14), %rdi
leaq 0x18(%rsp), %rsi
callq 0x72d8
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 0x63f7
leaq 0x18(%rsp), %r15
leaq 0x48(%rsp), %r12
leaq 0x20(%r14), %r13
movq %r15, %rdi
movq %r13, %rsi
callq 0x715a
movq (%rax), %rbp
movq %r12, %rdi
movq %r13, %rsi
callq 0x71be
movq %rax, %rcx
movq %rbp, %rax
xorl %edx, %edx
divq %rbx
movq %rax, %xmm0
punpckldq 0x2d46(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x2d4e(%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 0x6395
movq (%rsp), %rdi
addq $0x68, %rdi
leaq 0x48(%rsp), %rsi
callq 0x7562
leaq 0x48(%rsp), %rdi
callq 0x7238
leaq 0x18(%rsp), %rdi
callq 0x7288
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x6432
jmp 0x6441
jmp 0x6441
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x7238
jmp 0x6444
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x7288
movq %rbx, %rdi
callq 0x3450