// File: /workspace/github_cpp_makefile_star2_O2/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), %rax
andl $0x0, (%rax)
andq $0x0, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
andq $0x0, 0x20(%rax)
leaq 0x18(%rsp), %rdi
callq 0x71e2
leaq 0x8(%r14), %rdi
movq 0x20(%r14), %r15
leaq 0x20(%r15), %r12
movq %rdi, 0x8(%rsp)
movq %r12, %rsi
callq 0x6554
movq (%rax), %rbx
leaq 0x18(%rsp), %rdi
movq %r12, %rsi
callq 0x6554
movq %rbx, (%rax)
movq %r15, %rdi
callq 0x31a0
movq %rax, %r15
movq 0x20(%r14), %r12
movq %r14, (%rsp)
leaq 0x10(%r14), %rax
movq %rax, 0x10(%rsp)
xorl %ebp, %ebp
leaq 0x18(%rsp), %r13
cmpq 0x10(%rsp), %r15
je 0x5a82
leaq 0x20(%r12), %rsi
movq %r13, %rdi
callq 0x6554
movq (%rax), %r14
leaq 0x20(%r15), %rbp
movq 0x8(%rsp), %rdi
movq %rbp, %rsi
callq 0x6554
movq (%rax), %rbx
movq %r13, %rdi
movq %rbp, %rsi
callq 0x6554
addq %r14, %rbx
movq %rbx, (%rax)
movq %r13, %rdi
movq %rbp, %rsi
callq 0x6554
movq (%rax), %rbp
movq %r15, %rdi
callq 0x31a0
movq %rax, %r15
movq %r12, %rdi
callq 0x31a0
movq %rax, %r12
jmp 0x5a20
movq (%rsp), %rax
leaq 0x38(%rax), %rdi
leaq 0x18(%rsp), %rsi
callq 0x66b2
leaq 0x50(%rsp), %rax
andl $0x0, (%rax)
andq $0x0, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
andq $0x0, 0x20(%rax)
leaq 0x18(%rsp), %r14
movq 0x18(%r14), %r12
movslq %ebp, %rbx
leaq 0x48(%rsp), %r15
leaq 0x20(%rsp), %rax
cmpq %rax, %r12
je 0x5b24
leaq 0x20(%r12), %r13
movq %r14, %rdi
movq %r13, %rsi
callq 0x6554
movq (%rax), %rbp
movq %r15, %rdi
movq %r13, %rsi
callq 0x65a2
movq %rax, %rcx
movq %rbp, %rax
xorl %edx, %edx
divq %rbx
movq %rax, %xmm0
punpckldq 0x3611(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x3619(%rip), %xmm0     # 0x9120
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
movsd %xmm1, (%rcx)
movq %r12, %rdi
callq 0x31a0
movq %rax, %r12
jmp 0x5abf
movq (%rsp), %rdi
addq $0x68, %rdi
leaq 0x48(%rsp), %rsi
callq 0x697c
leaq 0x48(%rsp), %rdi
callq 0x6602
leaq 0x18(%rsp), %rdi
callq 0x665a
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x5b5f
jmp 0x5b6e
jmp 0x5b6e
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x6602
jmp 0x5b71
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x665a
movq %rbx, %rdi
callq 0x3430
nop