// File: /workspace/github_cpp_makefile_star2_O3/fjamour[P]icentral/src/bcc_delta.cc
// Function: bcc_delta_t::compute_bc_maxiter_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_maxiter_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);
    vector<node_id_t> d1_s_vec, d2_s_vec;
    
    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);        
        switch(abs_diff) {
            case 0:  cnt_arr[0]++; break;
            case 1:  d1_s_vec.push_back(s); break;
            default: d2_s_vec.push_back(s);
        }
    }
    
    int d1_num_iter = min(max_iter_d1, (int)d1_s_vec.size());
    int d2_num_iter = min(max_iter_d2, (int)d2_s_vec.size());
    for(int i = 0; i < d1_num_iter; ++i) {
        node_id_t s = d1_s_vec[i];
        tm.start();
        i_iteration(s, src, dst, d_src_vec[s], d_dst_vec[s], bc_map);
        tm.stop();
        cnt_arr[1]++;
        tot_arr[1]+=tm.interval();
    }
    for(int i = 0; i < d2_num_iter; ++i) {
        node_id_t s = d2_s_vec[i];
        tm.start();
        i_iteration(s, src, dst, d_src_vec[s], d_dst_vec[s], bc_map);
        tm.stop();
        cnt_arr[2]++;
        tot_arr[2]+=tm.interval();
    }
    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 $0xe8, %rsp
movl %r9d, 0x20(%rsp)
movq %r8, 0x30(%rsp)
movq %rsi, %r15
movq %rdi, %r12
leaq 0x1c(%rsp), %r14
movl %edx, (%r14)
leaq 0x14(%rsp), %rbp
movl %ecx, (%rbp)
leaq 0x2d8(%rdi), %r13
leaq 0x338(%rdi), %rbx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x5d14
movl (%rax), %eax
movl %eax, (%r14)
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x5d14
movl (%rax), %edx
movl %edx, (%rbp)
movl (%r14), %esi
movq %r13, %rdi
callq 0x2e916
xorl %eax, %eax
leaq 0xd0(%rsp), %rbx
movq %rax, 0x10(%rbx)
xorpd %xmm0, %xmm0
movapd %xmm0, (%rbx)
movq %rax, 0xc0(%rsp)
movapd %xmm0, 0xb0(%rsp)
leaq 0x90(%rsp), %rdi
xorl %esi, %esi
callq 0x2360
movl (%r14), %esi
movq %r13, %rdi
movq %rbx, %rdx
callq 0x2ee54
movl 0x14(%rsp), %esi
leaq 0xb0(%rsp), %rdx
movq %r13, %rdi
callq 0x2ee54
leaq 0xa0(%rsp), %rbx
xorl %r14d, %r14d
movq %rbx, %rdi
xorl %esi, %esi
callq 0x2360
xorps %xmm0, %xmm0
cvtsi2sdq -0x10(%rbx), %xmm0
cvtsi2sdq -0x8(%rbx), %xmm1
movsd 0x2054a(%rip), %xmm4    # 0x301a0
divsd %xmm4, %xmm1
cvtsi2sdq (%rbx), %xmm2
cvtsi2sdq 0x8(%rbx), %xmm3
addsd %xmm0, %xmm1
divsd %xmm4, %xmm3
addsd %xmm2, %xmm3
subsd %xmm1, %xmm3
movq 0x30(%rsp), %rbx
movsd %xmm3, 0x48(%rbx)
movq %r14, 0x70(%rsp)
xorpd %xmm0, %xmm0
movapd %xmm0, 0x60(%rsp)
movq %r14, 0x50(%rsp)
movapd %xmm0, 0x40(%rsp)
movq 0x2e0(%r12), %rdx
movl $0x0, %ebp
movl $0x0, %ecx
movl $0x0, %eax
cmpq 0x2d8(%r12), %rdx
je 0xfd90
xorl %ebx, %ebx
movabsq $-0x5555555555555555, %r14 # imm = 0xAAAAAAAAAAAAAAAB
xorl %ebp, %ebp
movl %ebx, 0x8c(%rsp)
movq 0xd0(%rsp), %rax
movl (%rax,%rbx,4), %ecx
movq 0xb0(%rsp), %rax
subl (%rax,%rbx,4), %ecx
movl %ecx, %eax
negl %eax
cmovsl %ecx, %eax
cmpl $0x1, %eax
je 0xfcfd
testl %eax, %eax
jne 0xfd16
incl %ebp
jmp 0xfd48
movq 0x68(%rsp), %rsi
cmpq 0x70(%rsp), %rsi
je 0xfd2f
movl %ebx, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x68(%rsp)
jmp 0xfd48
movq 0x48(%rsp), %rsi
cmpq 0x50(%rsp), %rsi
je 0xfd36
movl %ebx, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x48(%rsp)
jmp 0xfd48
leaq 0x60(%rsp), %rdi
jmp 0xfd3b
leaq 0x40(%rsp), %rdi
leaq 0x8c(%rsp), %rdx
callq 0x6f14
movq 0x2e0(%r12), %rax
subq 0x2d8(%r12), %rax
incq %rbx
sarq $0x3, %rax
imulq %r14, %rax
cmpq %rbx, %rax
ja 0xfccc
movq 0x68(%rsp), %rcx
movq 0x48(%rsp), %rax
subq 0x60(%rsp), %rcx
shrq $0x2, %rcx
subq 0x40(%rsp), %rax
shrq $0x2, %rax
movq 0x30(%rsp), %rbx
xorl %r14d, %r14d
movl 0x20(%rsp), %edx
cmpl %edx, %ecx
cmovll %ecx, %edx
movl 0x120(%rsp), %ecx
cmpl %ecx, %eax
cmovll %eax, %ecx
xorpd %xmm0, %xmm0
movsd %xmm0, 0x38(%rsp)
testl %edx, %edx
movq %r13, 0xc8(%rsp)
movl %ebp, 0x2c(%rsp)
movl %ecx, 0x18(%rsp)
jle 0xfeba
movl %edx, 0x20(%rsp)
movl %edx, %ebp
xorl %r13d, %r13d
leaq 0x90(%rsp), %r14
movsd %xmm0, 0x80(%rsp)
movq 0x60(%rsp), %rax
movl (%rax,%r13,4), %ebx
movq %r14, %rdi
xorl %esi, %esi
callq 0x2360
movl 0x1c(%rsp), %edx
movl 0x14(%rsp), %ecx
movq 0xd0(%rsp), %rax
movl (%rax,%rbx,4), %r8d
movq 0xb0(%rsp), %rax
movl (%rax,%rbx,4), %r9d
movq %r15, (%rsp)
movq %r12, %rdi
movl %ebx, %esi
callq 0xf780
leaq 0xa0(%rsp), %rdi
xorl %esi, %esi
callq 0x2360
xorps %xmm0, %xmm0
cvtsi2sdq 0x90(%rsp), %xmm0
xorps %xmm1, %xmm1
cvtsi2sdq 0x98(%rsp), %xmm1
incq %r13
movsd 0x2034a(%rip), %xmm3    # 0x301a0
divsd %xmm3, %xmm1
xorps %xmm2, %xmm2
cvtsi2sdq 0xa0(%rsp), %xmm2
addsd %xmm0, %xmm1
xorps %xmm0, %xmm0
cvtsi2sdq 0xa8(%rsp), %xmm0
divsd %xmm3, %xmm0
addsd %xmm2, %xmm0
subsd %xmm1, %xmm0
movsd 0x80(%rsp), %xmm1
addsd %xmm0, %xmm1
movapd %xmm1, %xmm0
cmpq %r13, %rbp
jne 0xfdd8
movl 0x20(%rsp), %eax
movl %eax, %r14d
movq 0x30(%rsp), %rbx
movq 0xc8(%rsp), %r13
movl 0x2c(%rsp), %ebp
movl 0x18(%rsp), %ecx
movsd %xmm0, 0x80(%rsp)
testl %ecx, %ecx
jle 0xffbb
movq %r14, 0x20(%rsp)
movl %ecx, %ebp
xorpd %xmm0, %xmm0
movsd %xmm0, 0x38(%rsp)
xorl %r13d, %r13d
leaq 0x90(%rsp), %r14
movq 0x40(%rsp), %rax
movl (%rax,%r13,4), %ebx
movq %r14, %rdi
xorl %esi, %esi
callq 0x2360
movl 0x1c(%rsp), %edx
movl 0x14(%rsp), %ecx
movq 0xd0(%rsp), %rax
movl (%rax,%rbx,4), %r8d
movq 0xb0(%rsp), %rax
movl (%rax,%rbx,4), %r9d
movq %r15, (%rsp)
movq %r12, %rdi
movl %ebx, %esi
callq 0xf780
leaq 0xa0(%rsp), %rdi
xorl %esi, %esi
callq 0x2360
xorps %xmm0, %xmm0
cvtsi2sdq 0x90(%rsp), %xmm0
xorps %xmm1, %xmm1
cvtsi2sdq 0x98(%rsp), %xmm1
incq %r13
movsd 0x20244(%rip), %xmm3    # 0x301a0
divsd %xmm3, %xmm1
xorps %xmm2, %xmm2
cvtsi2sdq 0xa0(%rsp), %xmm2
addsd %xmm0, %xmm1
xorps %xmm0, %xmm0
cvtsi2sdq 0xa8(%rsp), %xmm0
divsd %xmm3, %xmm0
addsd %xmm2, %xmm0
subsd %xmm1, %xmm0
movsd 0x38(%rsp), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, 0x38(%rsp)
cmpq %r13, %rbp
jne 0xfee7
movq 0x30(%rsp), %rbx
movq 0xc8(%rsp), %r13
movl 0x2c(%rsp), %ebp
movq 0x20(%rsp), %r14
jmp 0xffc3
movl $0x0, 0x18(%rsp)
movl 0x1c(%rsp), %esi
movl 0x14(%rsp), %edx
movq %r13, %rdi
callq 0x2e844
movl %ebp, 0x10(%rbx)
movl %r14d, 0x14(%rbx)
movl 0x18(%rsp), %eax
movl %eax, 0x18(%rbx)
movq $0x0, 0x20(%rbx)
movsd 0x80(%rsp), %xmm0
movsd %xmm0, 0x28(%rbx)
movsd 0x38(%rsp), %xmm0
movsd %xmm0, 0x30(%rbx)
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x10019
movq 0x50(%rsp), %rsi
subq %rdi, %rsi
callq 0x2250
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x10030
movq 0x70(%rsp), %rsi
subq %rdi, %rsi
callq 0x2250
movq 0xb0(%rsp), %rdi
testq %rdi, %rdi
je 0x1004d
movq 0xc0(%rsp), %rsi
subq %rdi, %rsi
callq 0x2250
movq 0xd0(%rsp), %rdi
testq %rdi, %rdi
je 0x1006a
movq 0xe0(%rsp), %rsi
subq %rdi, %rsi
callq 0x2250
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x10087
movq %rax, %rbx
jmp 0x100b8
jmp 0x10087
jmp 0x10087
movq %rax, %rbx
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x100a1
movq 0x50(%rsp), %rsi
subq %rdi, %rsi
callq 0x2250
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x100b8
movq 0x70(%rsp), %rsi
subq %rdi, %rsi
callq 0x2250
movq 0xb0(%rsp), %rdi
testq %rdi, %rdi
je 0x100d5
movq 0xc0(%rsp), %rsi
subq %rdi, %rsi
callq 0x2250
movq 0xd0(%rsp), %rdi
testq %rdi, %rdi
je 0x100f2
movq 0xe0(%rsp), %rsi
subq %rdi, %rsi
callq 0x2250
movq %rbx, %rdi
callq 0x23b0