// File: /workspace/github_cpp_makefile_star2_O3/fjamour[P]icentral/src/bcc_delta.cc
// Function: bcc_delta_t::compute_bc_exp(std::tr1::unordered_map<unsigned int, double, std::tr1::hash<unsigned int>, std::equal_to<unsigned int>, std::allocator<std::pair<unsigned int const, double>>>&, unsigned int, unsigned int, bcc_stat_t&, int, int)
void bcc_delta_t::compute_bc_exp(tr1_map_t(double)& bc_map,
                        node_id_t src,
                        node_id_t dst,
                        bcc_stat_t& bcc_stat,
                        int max_iter_d1,
                        int max_iter_d2)
{
    src = bcc_fast_subgraph.outin_label_map[src];
    dst = bcc_fast_subgraph.outin_label_map[dst];
    
    timer tm;
    //bc_map will have for each vertex in the muc it's betweenness centrality
    bcc_fast_subgraph.remove_edge(src, dst);
    vector<int> d_src_vec, d_dst_vec;
    tm.start();
    bcc_fast_subgraph.find_sssp(src, d_src_vec);
    bcc_fast_subgraph.find_sssp(dst, d_dst_vec);
    tm.stop();
    bcc_stat.sssp_tm = tm.interval();
    
    //this must be commented in general.. if it's there it makes bc_map contain deltas
    //bcc_subgraph.i_fill_map<double>(bc_map, 0);
    
    int    cnt_arr[] = {0,0,0};
    double tot_arr[] = {0,0,0};
    for(int i = 0; i < bcc_fast_subgraph.nodes_vec.size(); ++i) {
        node_id_t s = i;
        int diff = d_src_vec[s] - d_dst_vec[s];
        int abs_diff = abs(diff);
        tm.start();
        if(d_src_vec[s] != d_dst_vec[s]) {
            i_iteration(s, src, dst, d_src_vec[s], d_dst_vec[s], bc_map);
        }
        tm.stop();
        switch(abs_diff) {
            case 0:
                cnt_arr[0]++;
                tot_arr[0]+=tm.interval();
                break;
            case 1:
                cnt_arr[1]++;
                tot_arr[1]+=tm.interval();
                break;
            default:
                cnt_arr[2]++;
                tot_arr[2]+=tm.interval();
        }
        if(tot_arr[1] == max_iter_d1 && tot_arr[2] == max_iter_d2)
            break;
    }
    bcc_fast_subgraph.insert_edge(src, dst);
    
    bcc_stat.num_d0_iter = cnt_arr[0];
    bcc_stat.num_d1_iter = cnt_arr[1];
    bcc_stat.num_d2_iter = cnt_arr[2];
    bcc_stat.tot_d0_tm   = tot_arr[0];
    bcc_stat.tot_d1_tm   = tot_arr[1];
    bcc_stat.tot_d2_tm   = tot_arr[2];
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movl %r9d, 0x8(%rsp)
movq %r8, %rbx
movq %rsi, 0x88(%rsp)
movq %rdi, %r12
leaq 0x24(%rsp), %r14
movl %edx, (%r14)
leaq 0x14(%rsp), %r13
movl %ecx, (%r13)
leaq 0x2d8(%rdi), %r15
leaq 0x338(%rdi), %rbp
movq %rbp, %rdi
movq %r14, %rsi
callq 0x5d14
movl (%rax), %eax
movl %eax, (%r14)
movq %rbp, %rdi
movq %r13, %rsi
callq 0x5d14
movl (%rax), %edx
movl %edx, (%r13)
movl (%r14), %esi
movq %r15, %rdi
callq 0x2e916
xorl %eax, %eax
leaq 0x50(%rsp), %r13
movq %rax, 0x10(%r13)
xorpd %xmm0, %xmm0
movapd %xmm0, (%r13)
movq %rax, 0x40(%rsp)
movapd %xmm0, 0x30(%rsp)
leaq 0x98(%rsp), %rdi
xorl %esi, %esi
callq 0x2360
movl (%r14), %esi
movq %r15, %rdi
movq %r13, %rdx
callq 0x2ee54
movl 0x14(%rsp), %esi
leaq 0x30(%rsp), %rdx
movq %r15, %rdi
callq 0x2ee54
movq %r15, 0x78(%rsp)
leaq 0xa8(%rsp), %r14
xorl %r15d, %r15d
movq %r14, %rdi
xorl %esi, %esi
callq 0x2360
xorps %xmm0, %xmm0
cvtsi2sdq -0x10(%r14), %xmm0
cvtsi2sdq -0x8(%r14), %xmm1
movsd 0x208f4(%rip), %xmm4    # 0x301a0
divsd %xmm4, %xmm1
cvtsi2sdq (%r14), %xmm2
cvtsi2sdq 0x8(%r14), %xmm3
addsd %xmm0, %xmm1
divsd %xmm4, %xmm3
addsd %xmm2, %xmm3
subsd %xmm1, %xmm3
movq %rbx, 0x70(%rsp)
movsd %xmm3, 0x48(%rbx)
movq 0x2e0(%r12), %rax
cmpq 0x2d8(%r12), %rax
je 0xfa8c
xorps %xmm0, %xmm0
cvtsi2sdl 0x8(%rsp), %xmm0
movsd %xmm0, 0x90(%rsp)
xorps %xmm0, %xmm0
cvtsi2sdl 0xf0(%rsp), %xmm0
movsd %xmm0, 0x80(%rsp)
xorpd %xmm0, %xmm0
movsd %xmm0, 0x18(%rsp)
xorl %ebp, %ebp
xorl %r14d, %r14d
movsd %xmm0, 0x8(%rsp)
movsd %xmm0, 0x28(%rsp)
xorl %ebx, %ebx
xorl %r15d, %r15d
movq 0x50(%rsp), %rax
movl (%rax,%rbp,4), %eax
movq 0x30(%rsp), %rcx
subl (%rcx,%rbp,4), %eax
movl %eax, %r13d
negl %r13d
cmovsl %eax, %r13d
leaq 0x98(%rsp), %rdi
xorl %esi, %esi
callq 0x2360
movq 0x50(%rsp), %rax
movl (%rax,%rbp,4), %r8d
movq 0x30(%rsp), %rax
movl (%rax,%rbp,4), %r9d
cmpl %r9d, %r8d
je 0xf990
movl 0x24(%rsp), %edx
movl 0x14(%rsp), %ecx
movq 0x88(%rsp), %rax
movq %rax, (%rsp)
movq %r12, %rdi
movl %ebp, %esi
callq 0xf780
leaq 0xa8(%rsp), %rdi
xorl %esi, %esi
callq 0x2360
xorps %xmm0, %xmm0
cvtsi2sdq 0x98(%rsp), %xmm0
xorps %xmm1, %xmm1
cvtsi2sdq 0xa0(%rsp), %xmm1
movsd 0x207df(%rip), %xmm3    # 0x301a0
divsd %xmm3, %xmm1
addsd %xmm0, %xmm1
xorps %xmm2, %xmm2
cvtsi2sdq 0xa8(%rsp), %xmm2
xorps %xmm0, %xmm0
cvtsi2sdq 0xb0(%rsp), %xmm0
divsd %xmm3, %xmm0
addsd %xmm2, %xmm0
subsd %xmm1, %xmm0
cmpl $0x1, %r13d
je 0xfa0f
testl %r13d, %r13d
jne 0xfa24
incl %r14d
movsd 0x28(%rsp), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, 0x28(%rsp)
jmp 0xfa36
incl %r15d
movsd 0x8(%rsp), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, 0x8(%rsp)
jmp 0xfa36
incl %ebx
movsd 0x18(%rsp), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, 0x18(%rsp)
movsd 0x8(%rsp), %xmm0
ucomisd 0x90(%rsp), %xmm0
jne 0xfa5c
jp 0xfa5c
movsd 0x18(%rsp), %xmm0
ucomisd 0x80(%rsp), %xmm0
jne 0xfa5c
jnp 0xfaa7
movq 0x2e0(%r12), %rax
subq 0x2d8(%r12), %rax
incq %rbp
sarq $0x3, %rax
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rcx, %rax
cmpq %rbp, %rax
ja 0xf932
jmp 0xfaa7
xorpd %xmm0, %xmm0
movsd %xmm0, 0x28(%rsp)
xorl %ebx, %ebx
movsd %xmm0, 0x8(%rsp)
movsd %xmm0, 0x18(%rsp)
xorl %r14d, %r14d
movl 0x24(%rsp), %esi
movl 0x14(%rsp), %edx
movq 0x78(%rsp), %rdi
callq 0x2e844
movq 0x70(%rsp), %rax
movl %r14d, 0x10(%rax)
movl %r15d, 0x14(%rax)
movl %ebx, 0x18(%rax)
movsd 0x28(%rsp), %xmm0
movsd %xmm0, 0x20(%rax)
movsd 0x8(%rsp), %xmm0
movsd %xmm0, 0x28(%rax)
movsd 0x18(%rsp), %xmm0
movsd %xmm0, 0x30(%rax)
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0xfb01
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x2250
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0xfb18
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x2250
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xfb2e
jmp 0xfb2e
movq %rax, %rbx
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0xfb48
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x2250
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0xfb5f
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x2250
movq %rbx, %rdi
callq 0x23b0
nop