// File: /workspace/github_cpp_makefile_star2_O1/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, 0x18(%rsp)
movq %r8, 0xb8(%rsp)
movq %rsi, %r15
movq %rdi, %r12
leaq 0x14(%rsp), %r14
movl %edx, (%r14)
leaq 0x10(%rsp), %r13
movl %ecx, (%r13)
leaq 0x2d8(%rdi), %rbp
leaq 0x338(%rdi), %rbx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x5d84
movl (%rax), %eax
movl %eax, (%r14)
movq %rbx, %rdi
movq %r13, %rsi
callq 0x5d84
movl (%rax), %edx
movl %edx, (%r13)
movl (%r14), %esi
movq %rbp, %rdi
callq 0x2ec4c
xorl %eax, %eax
leaq 0xc0(%rsp), %rbx
movq %rax, 0x10(%rbx)
xorpd %xmm0, %xmm0
movapd %xmm0, (%rbx)
movq %rax, 0xb0(%rsp)
movapd %xmm0, 0xa0(%rsp)
leaq 0x80(%rsp), %rdi
xorl %esi, %esi
callq 0x2360
movl (%r14), %esi
movq %rbp, %rdi
movq %rbx, %rdx
callq 0x2f1e0
movl 0x10(%rsp), %esi
leaq 0xa0(%rsp), %rdx
movq %rbp, %rdi
callq 0x2f1e0
movq %rbp, 0xe0(%rsp)
leaq 0x90(%rsp), %rbx
xorl %r13d, %r13d
movq %rbx, %rdi
xorl %esi, %esi
callq 0x2360
xorps %xmm0, %xmm0
cvtsi2sdq -0x10(%rbx), %xmm0
cvtsi2sdq -0x8(%rbx), %xmm1
movsd 0x2158b(%rip), %xmm3    # 0x311a0
divsd %xmm3, %xmm1
cvtsi2sdq (%rbx), %xmm2
addsd %xmm0, %xmm1
xorps %xmm0, %xmm0
cvtsi2sdq 0x8(%rbx), %xmm0
divsd %xmm3, %xmm0
addsd %xmm2, %xmm0
subsd %xmm1, %xmm0
movq 0xb8(%rsp), %rax
movsd %xmm0, 0x48(%rax)
movq %r13, 0x60(%rsp)
xorpd %xmm0, %xmm0
movapd %xmm0, 0x50(%rsp)
movq %r13, 0x40(%rsp)
movapd %xmm0, 0x30(%rsp)
movq 0x2e0(%r12), %rax
movl $0x0, %ebp
cmpq 0x2d8(%r12), %rax
je 0xfd21
xorl %ebx, %ebx
movabsq $-0x5555555555555555, %r14 # imm = 0xAAAAAAAAAAAAAAAB
xorl %ebp, %ebp
movl %ebx, 0x7c(%rsp)
movq 0xc0(%rsp), %rax
movl (%rax,%rbx,4), %ecx
movq 0xa0(%rsp), %rax
subl (%rax,%rbx,4), %ecx
movl %ecx, %eax
negl %eax
cmovsl %ecx, %eax
cmpl $0x1, %eax
je 0xfcb5
testl %eax, %eax
jne 0xfcce
incl %ebp
jmp 0xfcfd
movq 0x58(%rsp), %rsi
cmpq 0x60(%rsp), %rsi
je 0xfce7
movl %ebx, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x58(%rsp)
jmp 0xfcfd
movq 0x38(%rsp), %rsi
cmpq 0x40(%rsp), %rsi
je 0xfcee
movl %ebx, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x38(%rsp)
jmp 0xfcfd
leaq 0x50(%rsp), %rdi
jmp 0xfcf3
leaq 0x30(%rsp), %rdi
leaq 0x7c(%rsp), %rdx
callq 0x6f98
movq 0x2e0(%r12), %rax
subq 0x2d8(%r12), %rax
incq %rbx
sarq $0x3, %rax
imulq %r14, %rax
cmpq %rbx, %rax
ja 0xfc87
movq 0x58(%rsp), %rax
subq 0x50(%rsp), %rax
shrq $0x2, %rax
movl 0x18(%rsp), %ecx
cmpl %ecx, %eax
cmovll %eax, %ecx
movl 0x120(%rsp), %edx
movq 0x38(%rsp), %rax
subq 0x30(%rsp), %rax
shrq $0x2, %rax
cmpl %edx, %eax
cmovll %eax, %edx
xorpd %xmm0, %xmm0
movsd %xmm0, 0x28(%rsp)
testl %ecx, %ecx
movl %ebp, 0x24(%rsp)
movl %edx, 0x20(%rsp)
jle 0xfe4c
movl %ecx, 0x18(%rsp)
movl %ecx, %ebp
xorl %r13d, %r13d
leaq 0x80(%rsp), %r14
movsd %xmm0, 0x70(%rsp)
movq 0x50(%rsp), %rax
movl (%rax,%r13,4), %ebx
movq %r14, %rdi
xorl %esi, %esi
callq 0x2360
movl 0x14(%rsp), %edx
movl 0x10(%rsp), %ecx
movq 0xc0(%rsp), %rax
movl (%rax,%rbx,4), %r8d
movq 0xa0(%rsp), %rax
movl (%rax,%rbx,4), %r9d
movq %r15, (%rsp)
movq %r12, %rdi
movl %ebx, %esi
callq 0xf732
leaq 0x90(%rsp), %rdi
xorl %esi, %esi
callq 0x2360
xorps %xmm0, %xmm0
cvtsi2sdq 0x80(%rsp), %xmm0
xorps %xmm1, %xmm1
cvtsi2sdq 0x88(%rsp), %xmm1
incq %r13
movsd 0x213a8(%rip), %xmm3    # 0x311a0
divsd %xmm3, %xmm1
xorps %xmm2, %xmm2
cvtsi2sdq 0x90(%rsp), %xmm2
addsd %xmm0, %xmm1
xorps %xmm0, %xmm0
cvtsi2sdq 0x98(%rsp), %xmm0
divsd %xmm3, %xmm0
addsd %xmm2, %xmm0
subsd %xmm1, %xmm0
movsd 0x70(%rsp), %xmm1
addsd %xmm0, %xmm1
movapd %xmm1, %xmm0
cmpq %r13, %rbp
jne 0xfd7d
movl 0x18(%rsp), %eax
movl %eax, %r13d
movl 0x24(%rsp), %ebp
movl 0x20(%rsp), %edx
movsd %xmm0, 0x70(%rsp)
testl %edx, %edx
jle 0xff41
movq %r13, 0x18(%rsp)
movl %edx, %ebp
xorpd %xmm0, %xmm0
movsd %xmm0, 0x28(%rsp)
xorl %r13d, %r13d
leaq 0x80(%rsp), %r14
movq 0x30(%rsp), %rax
movl (%rax,%r13,4), %ebx
movq %r14, %rdi
xorl %esi, %esi
callq 0x2360
movl 0x14(%rsp), %edx
movl 0x10(%rsp), %ecx
movq 0xc0(%rsp), %rax
movl (%rax,%rbx,4), %r8d
movq 0xa0(%rsp), %rax
movl (%rax,%rbx,4), %r9d
movq %r15, (%rsp)
movq %r12, %rdi
movl %ebx, %esi
callq 0xf732
leaq 0x90(%rsp), %rdi
xorl %esi, %esi
callq 0x2360
xorps %xmm0, %xmm0
cvtsi2sdq 0x80(%rsp), %xmm0
xorps %xmm1, %xmm1
cvtsi2sdq 0x88(%rsp), %xmm1
incq %r13
movsd 0x212b5(%rip), %xmm3    # 0x311a0
divsd %xmm3, %xmm1
xorps %xmm2, %xmm2
cvtsi2sdq 0x90(%rsp), %xmm2
addsd %xmm0, %xmm1
xorps %xmm0, %xmm0
cvtsi2sdq 0x98(%rsp), %xmm0
divsd %xmm3, %xmm0
addsd %xmm2, %xmm0
subsd %xmm1, %xmm0
movsd 0x28(%rsp), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, 0x28(%rsp)
cmpq %r13, %rbp
jne 0xfe76
movl 0x24(%rsp), %ebp
movq 0x18(%rsp), %r13
movl 0x20(%rsp), %ebx
jmp 0xff43
xorl %ebx, %ebx
movl 0x14(%rsp), %esi
movl 0x10(%rsp), %edx
movq 0xe0(%rsp), %rdi
callq 0x2eb74
movq 0xb8(%rsp), %rax
movl %ebp, 0x10(%rax)
movl %r13d, 0x14(%rax)
movl %ebx, 0x18(%rax)
movq $0x0, 0x20(%rax)
movsd 0x70(%rsp), %xmm0
movsd %xmm0, 0x28(%rax)
movsd 0x28(%rsp), %xmm0
movsd %xmm0, 0x30(%rax)
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0xff9f
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x2250
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0xffb6
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x2250
movq 0xa0(%rsp), %rdi
testq %rdi, %rdi
je 0xffd3
movq 0xb0(%rsp), %rsi
subq %rdi, %rsi
callq 0x2250
movq 0xc0(%rsp), %rdi
testq %rdi, %rdi
je 0xfff0
movq 0xd0(%rsp), %rsi
subq %rdi, %rsi
callq 0x2250
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1000d
movq %rax, %rbx
jmp 0x1003e
jmp 0x1000d
jmp 0x1000d
movq %rax, %rbx
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x10027
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x2250
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x1003e
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x2250
movq 0xa0(%rsp), %rdi
testq %rdi, %rdi
je 0x1005b
movq 0xb0(%rsp), %rsi
subq %rdi, %rsi
callq 0x2250
movq 0xc0(%rsp), %rdi
testq %rdi, %rdi
je 0x10078
movq 0xd0(%rsp), %rsi
subq %rdi, %rsi
callq 0x2250
movq %rbx, %rdi
callq 0x23b0