// File: /workspace/github_cpp_makefile_star2_O1/adamiaonr[P]rid-analytics/src/prob.cpp
// Function: local_tree_ratios(Prob::fp_data*, std::map<int, std::vector<unsigned char, std::allocator<unsigned char>>, std::less<int>, std::allocator<std::pair<int const, std::vector<unsigned char, std::allocator<unsigned char>>>>>*, std::vector<long double, std::allocator<long double>>&)
void local_tree_ratios(
    Prob::fp_data * iface_fp_data,
    std::map<int, std::vector<uint8_t> > * tree_bitmasks,
    std::vector<__float080> & lt_ratios) {

    std::map<int, std::vector<uint8_t> >::iterator itr;
    for (itr = (*tree_bitmasks).begin(); itr != (*tree_bitmasks).end(); itr++) {

        // isolate the tree size
        int t = itr->first;
        // skip 'union' of tree bitmasks
        if (t == 0) continue;
        // count trees & shared trees which pass through iface
        int trees = 0, shared_trees = 0;
        for (unsigned int k = 0; k < (*tree_bitmasks)[t].size(); k++) {
            trees += count_set_bits((int) iface_fp_data->tree_bitmasks[t][k]);
            shared_trees += count_set_bits((int) (((*tree_bitmasks)[t][k]) & (iface_fp_data->tree_bitmasks[t][k])));
        }

        if (trees > 0)
            lt_ratios[t - 1] = (__float080) (trees - shared_trees) / (__float080) (trees);
        // std::cout << "\t [# trees] : " << trees
        //     << "\n\t [# shared trees] : " << shared_trees
        //     << "\n\t [lt ratios[" << (t) << "]] : " << lt_ratios[t - 1] << std::endl;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdx, 0x18(%rsp)
movq %rdi, 0x8(%rsp)
movq 0x18(%rsi), %rdi
leaq 0x8(%rsi), %rax
movq %rax, 0x20(%rsp)
cmpq %rax, %rdi
je 0x2a252
movq %rsi, %r14
addq $0x60, 0x8(%rsp)
leaq 0x4(%rsp), %r15
movq %rsi, 0x30(%rsp)
movl 0x20(%rdi), %eax
movl %eax, 0x4(%rsp)
testl %eax, %eax
je 0x2a23f
movq %rdi, 0x28(%rsp)
movq %r14, %rdi
movq %r15, %rsi
callq 0x1e016
movq 0x8(%rax), %rcx
cmpq (%rax), %rcx
je 0x2a209
xorl %r12d, %r12d
xorl %ebp, %ebp
xorl %ebx, %ebx
movq 0x8(%rsp), %rdi
movq %r15, %rsi
callq 0x1e016
movq (%rax), %rax
movzbl (%rax,%r12), %eax
movl $0x0, %r15d
testl %eax, %eax
je 0x2a196
xorl %r15d, %r15d
leal 0x7fffffff(%rax), %ecx
andl %eax, %ecx
incl %r15d
movl %ecx, %eax
testl %ecx, %ecx
jg 0x2a185
movq %r14, %rdi
leaq 0x4(%rsp), %r13
movq %r13, %rsi
callq 0x1e016
movq (%rax), %rax
movzbl (%rax,%r12), %r14d
movq 0x8(%rsp), %rdi
movq %r13, %rsi
callq 0x1e016
movq (%rax), %rax
movzbl (%rax,%r12), %ecx
xorl %eax, %eax
andl %r14d, %ecx
je 0x2a1da
leal 0x7fffffff(%rcx), %edx
andl %ecx, %edx
incl %eax
movl %edx, %ecx
testl %edx, %edx
jg 0x2a1ca
addl %eax, %ebp
addl %r15d, %ebx
incl %r12d
movq 0x30(%rsp), %r14
movq %r14, %rdi
leaq 0x4(%rsp), %r15
movq %r15, %rsi
callq 0x1e016
movq 0x8(%rax), %rcx
subq (%rax), %rcx
cmpq %r12, %rcx
ja 0x2a163
jmp 0x2a20d
xorl %ebx, %ebx
xorl %ebp, %ebp
testl %ebx, %ebx
movq 0x28(%rsp), %rdi
jle 0x2a23f
movl %ebx, %eax
subl %ebp, %eax
movl %eax, 0x14(%rsp)
fildl 0x14(%rsp)
movl %ebx, 0x10(%rsp)
fidivl 0x10(%rsp)
movslq 0x4(%rsp), %rax
movq 0x18(%rsp), %rcx
movq (%rcx), %rcx
shlq $0x4, %rax
fstpt -0x10(%rcx,%rax)
callq 0x42b0
movq %rax, %rdi
cmpq 0x20(%rsp), %rax
jne 0x2a130
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq