// File: /workspace/github_cpp_makefile_star2_O3/cegme[P]vose/VoseTree.cc
// Function: VoseTree::histogram[abi:cxx11](VoseTree, long)
std::map<std::string, double> 
    VoseTree::histogram(VoseTree tree, long samples) {

    std::map<std::string,double> histogram;
    long hist_sum = 0L;
    for (int i = 0; i != samples; ++i) {
      auto idx = tree.rand_marble();

      if (histogram.find(idx.label) != histogram.end()) {
        histogram[idx.label] += 1.0;
        hist_sum += 1L;
      }
      else {
        histogram.insert(std::make_pair(idx.label, 1.0));
        hist_sum += 1L;
      }
    }
    
    std::map<std::string,double> new_hist;
    std::for_each(histogram.cbegin(), histogram.cend(),
      [&new_hist,hist_sum] (std::pair<const std::string, double> a) {
        //std::cerr << a.first << ", " << (double)a.second/hist_sum << "\n";
        new_hist.insert( std::make_pair(a.first,(double)a.second/hist_sum));
    });

    return new_hist;

  }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
leaq -0xc0(%rbp), %rcx
movl $0x0, (%rcx)
xorl %eax, %eax
movq %rax, 0x8(%rcx)
movq %rcx, 0x10(%rcx)
movq %rcx, 0x18(%rcx)
movq %rax, 0x20(%rcx)
testq %rdx, %rdx
movq %rdi, -0x30(%rbp)
je 0x3e34
movq %rsi, %r15
leaq -0x90(%rbp), %r12
leaq -0x98(%rbp), %r13
leaq -0xc8(%rbp), %r14
movq %rdx, -0x38(%rbp)
movq %rdx, %rbx
movq %rsi, -0x40(%rbp)
movq %r13, %rdi
movq %r15, %rsi
callq 0x31ea
movq %r14, %rdi
movq %r12, %rsi
callq 0x659c
leaq -0xc0(%rbp), %rcx
cmpq %rcx, %rax
je 0x3cc2
movq %r14, %rdi
movq %r12, %rsi
callq 0x4392
movsd (%rax), %xmm0
addsd 0x7384(%rip), %xmm0     # 0xb040
movsd %xmm0, (%rax)
jmp 0x3d22
movq %r12, %r15
movq %r13, %r12
leaq -0x58(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x90(%rbp), %rsi
movq -0x88(%rbp), %rdx
addq %rsi, %rdx
leaq -0x68(%rbp), %r13
movq %r13, %rdi
callq 0x4420
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, -0x48(%rbp)
movq %r14, %rdi
movq %r13, %rsi
callq 0x6254
movq -0x68(%rbp), %rdi
leaq -0x58(%rbp), %rax
cmpq %rax, %rdi
movq %r12, %r13
je 0x3d1b
callq 0x21c0
movq %r15, %r12
movq -0x40(%rbp), %r15
movq -0x90(%rbp), %rdi
leaq -0x80(%rbp), %rax
cmpq %rax, %rdi
je 0x3d37
callq 0x21c0
decq %rbx
jne 0x3c83
movq -0xb0(%rbp), %r14
movq -0x30(%rbp), %rdx
leaq 0x8(%rdx), %rax
movl $0x0, 0x8(%rdx)
xorl %ecx, %ecx
movq %rcx, 0x10(%rdx)
movq %rax, 0x18(%rdx)
movq %rax, 0x20(%rdx)
movq %rcx, 0x28(%rdx)
leaq -0xc0(%rbp), %rax
cmpq %rax, %r14
leaq -0x58(%rbp), %r13
je 0x3e51
xorps %xmm0, %xmm0
cvtsi2sdq -0x38(%rbp), %xmm0
movsd %xmm0, -0x38(%rbp)
leaq -0x88(%rbp), %rbx
leaq -0x68(%rbp), %r15
leaq -0x98(%rbp), %r12
movq %r13, -0x68(%rbp)
movq 0x20(%r14), %rsi
movq 0x28(%r14), %rdx
addq %rsi, %rdx
movq %r15, %rdi
callq 0x4420
movsd 0x40(%r14), %xmm0
movsd %xmm0, -0x40(%rbp)
movsd %xmm0, -0x48(%rbp)
movq %rbx, -0x98(%rbp)
movq -0x68(%rbp), %rsi
movq -0x60(%rbp), %rdx
addq %rsi, %rdx
movq %r12, %rdi
callq 0x4420
movsd -0x40(%rbp), %xmm0
divsd -0x38(%rbp), %xmm0
movsd %xmm0, -0x78(%rbp)
movq -0x30(%rbp), %rdi
movq %r12, %rsi
callq 0x6254
movq -0x98(%rbp), %rdi
cmpq %rbx, %rdi
je 0x3e09
callq 0x21c0
movq -0x68(%rbp), %rdi
cmpq %r13, %rdi
je 0x3e17
callq 0x21c0
movq %r14, %rdi
callq 0x2210
movq %rax, %r14
leaq -0xc0(%rbp), %rax
cmpq %rax, %r14
jne 0x3d9c
jmp 0x3e51
leaq 0x8(%rdi), %rax
movl $0x0, 0x8(%rdi)
xorl %ecx, %ecx
movq %rcx, 0x10(%rdi)
movq %rax, 0x18(%rdi)
movq %rax, 0x20(%rdi)
movq %rcx, 0x28(%rdi)
leaq -0xc8(%rbp), %rdi
callq 0x4ee0
movq -0x30(%rbp), %rax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movq -0x68(%rbp), %rdi
leaq -0x58(%rbp), %rax
cmpq %rax, %rdi
je 0x3ed1
callq 0x21c0
jmp 0x3ed1
jmp 0x3ece
movq %rax, %r14
jmp 0x3ebc
movq %rax, %r14
jmp 0x3eaa
movq %rax, %r14
movq -0x98(%rbp), %rdi
cmpq %rbx, %rdi
je 0x3eaa
callq 0x21c0
movq -0x68(%rbp), %rdi
leaq -0x58(%rbp), %rax
cmpq %rax, %rdi
je 0x3ebc
callq 0x21c0
movq -0x30(%rbp), %rdi
callq 0x4ee0
jmp 0x3ee6
jmp 0x3ece
movq %rax, %r14
jmp 0x3ee6
movq %rax, %r14
movq -0x90(%rbp), %rdi
leaq -0x80(%rbp), %rax
cmpq %rax, %rdi
je 0x3ee6
callq 0x21c0
leaq -0xc8(%rbp), %rdi
callq 0x4ee0
movq %r14, %rdi
callq 0x22b0