// File: /workspace/github_cpp_makefile_star2_O2/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 $0xa8, %rsp
movl %r9d, 0x10(%rsp)
movq %r8, %r15
movq %rsi, 0x58(%rsp)
movq %rdi, %r12
leaq 0x1c(%rsp), %r13
movl %edx, (%r13)
leaq 0xc(%rsp), %r14
movl %ecx, (%r14)
leaq 0x2d8(%rdi), %rbx
leaq 0x338(%rdi), %rbp
movq %rbp, %rdi
movq %r13, %rsi
callq 0x46f8
movl (%rax), %eax
movl %eax, (%r13)
movq %rbp, %rdi
movq %r14, %rsi
callq 0x46f8
movl (%rax), %edx
movl %edx, (%r14)
movl (%r13), %esi
movq %rbx, %rdi
callq 0x2615e
xorpd %xmm0, %xmm0
leaq 0x70(%rsp), %r14
movapd %xmm0, (%r14)
andq $0x0, 0x10(%r14)
movapd %xmm0, 0x30(%rsp)
andq $0x0, 0x40(%rsp)
leaq 0x88(%rsp), %rdi
callq 0xb094
movl (%r13), %esi
movq %rbx, %rdi
movq %r14, %rdx
callq 0x26540
movl 0xc(%rsp), %esi
leaq 0x30(%rsp), %rdx
movq %rbx, %rdi
callq 0x26540
movq %rbx, 0x50(%rsp)
movl 0xe0(%rsp), %ebx
leaq 0x88(%rsp), %r13
movq %r13, %rdi
callq 0xb09c
movq %r13, %rdi
callq 0xb0a8
movq %r15, 0x48(%rsp)
movsd %xmm0, 0x48(%r15)
cvtsi2sdl 0x10(%rsp), %xmm0
movsd %xmm0, 0x68(%rsp)
cvtsi2sd %ebx, %xmm0
movsd %xmm0, 0x60(%rsp)
xorpd %xmm0, %xmm0
movsd %xmm0, 0x28(%rsp)
xorl %ebp, %ebp
xorl %r14d, %r14d
movl $0x0, 0x18(%rsp)
movsd %xmm0, 0x10(%rsp)
movsd %xmm0, 0x20(%rsp)
xorl %r15d, %r15d
movq 0x2e0(%r12), %rax
subq 0x2d8(%r12), %rax
cqto
pushq $0x18
popq %rcx
idivq %rcx
cmpq %rbp, %rax
jbe 0xce06
movq 0x70(%rsp), %rax
movl (%rax,%rbp,4), %eax
movq 0x30(%rsp), %rcx
subl (%rcx,%rbp,4), %eax
movl %eax, %ebx
negl %ebx
cmovsl %eax, %ebx
movq %r13, %rdi
callq 0xb094
movq 0x70(%rsp), %rax
movl (%rax,%rbp,4), %r8d
movq 0x30(%rsp), %rax
movl (%rax,%rbp,4), %r9d
cmpl %r9d, %r8d
je 0xcd7c
movl 0x1c(%rsp), %edx
movl 0xc(%rsp), %ecx
movq 0x58(%rsp), %rax
movq %rax, (%rsp)
movq %r12, %rdi
movl %ebp, %esi
callq 0xcba8
movq %r13, %rdi
callq 0xb09c
movq %r13, %rdi
callq 0xb0a8
cmpl $0x1, %ebx
je 0xcdaa
testl %ebx, %ebx
jne 0xcdbf
incl %r15d
movsd 0x28(%rsp), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, 0x28(%rsp)
jmp 0xcdd3
incl %r14d
movsd 0x10(%rsp), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, 0x10(%rsp)
jmp 0xcdd3
incl 0x18(%rsp)
movsd 0x20(%rsp), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, 0x20(%rsp)
incq %rbp
movsd 0x10(%rsp), %xmm0
ucomisd 0x68(%rsp), %xmm0
jne 0xcd0a
jp 0xcd0a
movsd 0x20(%rsp), %xmm0
ucomisd 0x60(%rsp), %xmm0
jne 0xcd0a
jp 0xcd0a
movl 0x1c(%rsp), %esi
movl 0xc(%rsp), %edx
movq 0x50(%rsp), %rdi
callq 0x260cc
movq 0x48(%rsp), %rax
movl %r15d, 0x10(%rax)
movl %r14d, 0x14(%rax)
movl 0x18(%rsp), %ecx
movl %ecx, 0x18(%rax)
movsd 0x28(%rsp), %xmm0
movsd %xmm0, 0x20(%rax)
movsd 0x10(%rsp), %xmm0
movsd %xmm0, 0x28(%rax)
movsd 0x20(%rsp), %xmm0
movsd %xmm0, 0x30(%rax)
leaq 0x30(%rsp), %rdi
callq 0x5720
leaq 0x70(%rsp), %rdi
callq 0x5720
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xce77
jmp 0xce77
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x5720
leaq 0x70(%rsp), %rdi
callq 0x5720
movq %rbx, %rdi
callq 0x23d0