// File: /workspace/github_cpp_makefile_star2_O2/fjamour[P]icentral/src/_bc.cc
// Function: BBFS_RBFS_d1(std::vector<double, std::allocator<double>>&, iter_info_t&, component_t&, unsigned int, std::pair<unsigned int, unsigned int>)
void BBFS_RBFS_d1(
        vector<double>& dBC_vec,    // delta BC of vertices
        iter_info_t&    iter_info,  // iteration info to be computed
        component_t&    comp,       // component
        node_id_t       s,          // source of the iteration
        edge_t          e
        )
{
    subgraph_t& g = comp.subgraph;
    
    vector<vector<node_id_t> >&  P = iter_info.P; 
    vector<int>&                 sigma_vec = iter_info.sigma_vec;
    vector<int>&                 dist_vec = iter_info.dist_vec;
    vector<node_id_t>&           S = iter_info.S;
    vector<int>&                 new_sigma_vec = iter_info.new_sigma_vec;
    vector<double>&              delta_vec = iter_info.delta_vec;
    vector<double>&              Delta_vec = iter_info.Delta_vec;
    vector<double>&              new_delta_vec = iter_info.new_delta_vec;
    vector<double>&              new_Delta_vec = iter_info.new_Delta_vec;
    
    queue<node_id_t>             Q;
    
    // Assumes iter_info is initialized
    
    new_sigma_vec[s] = 1;//NEW
    sigma_vec[s] = 1;
    dist_vec[s] = 0;
    Q.push(s);
    while(!Q.empty()) {
        node_id_t v_i = Q.front(); Q.pop();
        S.push_back(v_i);
        if(v_i == e.second) {//NEW
            new_sigma_vec[v_i] += sigma_vec[e.first];
        }
        for(int i = 0; i < g.nodes_vec[v_i].size(); ++i) {
            node_id_t v_n = g.nodes_vec[v_i][i];
            if(dist_vec[v_n] < 0) {
                Q.push(v_n);
                dist_vec[v_n] = dist_vec[v_i] + 1;
            }
            if(dist_vec[v_n] == dist_vec[v_i] + 1) {
                sigma_vec[v_n] = sigma_vec[v_n] + sigma_vec[v_i];
                new_sigma_vec[v_n] += new_sigma_vec[v_i];//NEW
                P[v_n].push_back(v_i);
            }
        }
    }


    fill_vec<double>(delta_vec, comp.subgraph.size(), 0);
    fill_vec<double>(Delta_vec, comp.subgraph.size(), 0);
    
    fill_vec<double>(new_delta_vec, comp.subgraph.size(), 0);
    fill_vec<double>(new_Delta_vec, comp.subgraph.size(), 0);
    
    if(comp.comp_type == GRAPH) {
        for(int i = S.size()-1; i >= 0; --i) {
            node_id_t w = S[i];
            for (int idx = 0; idx < P[w].size(); ++idx) {
                node_id_t v = P[w][idx];
                delta_vec[v] += (((double) sigma_vec[v] / sigma_vec[w]) * (1 + delta_vec[w]));
                new_delta_vec[v] += (((double) new_sigma_vec[v] / new_sigma_vec[w]) * (1 + new_delta_vec[w]));
            }
            if(w == e.second) {
                node_id_t v_p = e.first;
                double new_sp_sn = ((double)new_delta_vec[v_p]/new_delta_vec[w]);
                new_delta_vec[v_p] = new_delta_vec[v_p] + new_sp_sn*(1+new_delta_vec[w]);
            }
            if (w != s) {
                dBC_vec[w] -= delta_vec[w]/2.0;
                dBC_vec[w] += new_delta_vec[w]/2.0;
            }
        }
    } else if(comp.comp_type == BCC) { //BCC or MUC case: involved case, with external pairs contribution
        component_t::art_pt_map_t& art_pt_map = comp.art_pt_map;
        for(int i = S.size()-1; i >= 0; --i) {
            node_id_t v_n = S[i];
            if(   art_pt_map.find(s) != art_pt_map.end()
               && art_pt_map.find(v_n) != art_pt_map.end()
               ){
                int VG_s, VG_n;
                VG_s = accumulate(art_pt_map[s].begin(), art_pt_map[s].end(), 0);
                VG_n = accumulate(art_pt_map[v_n].begin(), art_pt_map[v_n].end(), 0);
                int c_t = VG_s*VG_n;
                Delta_vec[v_n] =  Delta_vec[v_n] + c_t;
                new_Delta_vec[v_n] =  new_Delta_vec[v_n] + c_t;
            }
            for(int i = 0; i < P[v_n].size(); ++i) {
                node_id_t v_p = P[v_n][i];
                double sp_sn = ((double)sigma_vec[v_p]/sigma_vec[v_n]);
                delta_vec[v_p] = delta_vec[v_p] + sp_sn*(1+delta_vec[v_n]);
                if(art_pt_map.find(s) != art_pt_map.end()) {
                    Delta_vec[v_p] = Delta_vec[v_p] + Delta_vec[v_n]*sp_sn;
                }
                sp_sn = ((double)new_sigma_vec[v_p]/new_sigma_vec[v_n]);
                new_delta_vec[v_p] = new_delta_vec[v_p] + sp_sn*(1+new_delta_vec[v_n]);
                if(art_pt_map.find(s) != art_pt_map.end()) {
                    new_Delta_vec[v_p] = new_Delta_vec[v_p] + new_Delta_vec[v_n]*sp_sn;
                }
            }
            //IMP: this is the only change that happens to P, @src should be added as parent for dst
            if(v_n == e.second) {
                node_id_t v_p = e.first;
                double new_sp_sn = ((double)new_delta_vec[v_p]/new_delta_vec[v_n]);
                new_delta_vec[v_p] = new_delta_vec[v_p] + new_sp_sn*(1+new_delta_vec[v_n]);
                if(art_pt_map.find(s) != art_pt_map.end()) {
                    new_Delta_vec[v_p] = new_Delta_vec[v_p] + new_Delta_vec[v_n]*new_sp_sn;
                    dBC_vec[v_p] = dBC_vec[v_p] + new_Delta_vec[v_n]*new_sp_sn/2.0;
                }
            }
            if(s != v_n) {
                dBC_vec[v_n] -= delta_vec[v_n]/2.0;
                dBC_vec[v_n] += new_delta_vec[v_n]/2.0;
            }
            if(art_pt_map.find(s) != art_pt_map.end()) {
                int VG_s = accumulate(art_pt_map[s].begin(), art_pt_map[s].end(), 0);
                dBC_vec[v_n] -= delta_vec[v_n]*VG_s;
                dBC_vec[v_n] -= Delta_vec[v_n]/2.0;
                dBC_vec[v_n] += new_delta_vec[v_n]*VG_s;
                dBC_vec[v_n] += new_Delta_vec[v_n]/2.0;
            }
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movq %r8, %r12
movl %ecx, %ebp
movq %rdx, %r15
movq %rsi, %rbx
movq %rdi, 0x30(%rsp)
leaq 0x1c(%rsp), %r14
movl %ecx, (%r14)
leaq 0x68(%rsp), %r13
movq %r13, %rdi
callq 0x4a40
movl %ebp, %eax
movq 0x78(%rbx), %rcx
pushq $0x1
popq %rdx
movl %edx, (%rcx,%rax,4)
movq 0x18(%rbx), %rcx
movl %edx, (%rcx,%rax,4)
movq 0x30(%rbx), %rcx
andl $0x0, (%rcx,%rax,4)
movq %r13, %rdi
movq %r14, %rsi
callq 0x62da
movq %r12, %rax
shrq $0x20, %rax
movq %rax, 0x48(%rsp)
leaq 0x100(%rbx), %rax
movq %rax, 0x60(%rsp)
leaq 0x48(%rbx), %rax
movq %rax, 0x58(%rsp)
leaq 0x60(%rbx), %rax
movq %rax, 0x50(%rsp)
leaq 0x90(%rbx), %rax
movq %rax, 0x38(%rsp)
leaq 0xa8(%rbx), %rax
movq %rax, 0x20(%rsp)
movl %r12d, %eax
movq %rax, 0x40(%rsp)
leaq 0x68(%rsp), %r12
leaq 0x8(%rsp), %r13
leaq 0xc(%rsp), %rbp
movq 0x78(%rsp), %rax
cmpq %rax, 0x98(%rsp)
je 0x3f0a
movl (%rax), %eax
movl %eax, 0x8(%rsp)
movq %r12, %rdi
callq 0x650e
movq 0x60(%rsp), %rdi
movq %r13, %rsi
callq 0x478c
movq 0x48(%rsp), %rax
cmpl %eax, 0x8(%rsp)
jne 0x3e6a
movq 0x18(%rbx), %rax
movq 0x78(%rbx), %rcx
movq 0x40(%rsp), %rdx
movl (%rax,%rdx,4), %eax
movq 0x48(%rsp), %rdx
addl %eax, (%rcx,%rdx,4)
xorl %r14d, %r14d
movl 0x8(%rsp), %eax
movq (%r15), %rdx
imulq $0x18, %rax, %rsi
movq (%rdx,%rsi), %rcx
movq 0x8(%rdx,%rsi), %rdx
subq %rcx, %rdx
sarq $0x2, %rdx
cmpq %r14, %rdx
jbe 0x3e19
movl (%rcx,%r14,4), %ecx
movl %ecx, 0xc(%rsp)
movq 0x30(%rbx), %rdx
movl (%rdx,%rcx,4), %esi
testl %esi, %esi
jns 0x3eca
movq %r12, %rdi
movq %rbp, %rsi
callq 0x62da
movl 0x8(%rsp), %eax
movq 0x30(%rbx), %rdx
movl (%rdx,%rax,4), %eax
incl %eax
movl 0xc(%rsp), %ecx
movl %eax, (%rdx,%rcx,4)
movl 0xc(%rsp), %ecx
movl (%rdx,%rcx,4), %esi
movl 0x8(%rsp), %eax
movl (%rdx,%rax,4), %edx
incl %edx
cmpl %edx, %esi
jne 0x3f02
movq 0x18(%rbx), %rdx
movl (%rdx,%rax,4), %eax
addl %eax, (%rdx,%rcx,4)
movl 0x8(%rsp), %eax
movq 0x78(%rbx), %rcx
movl (%rcx,%rax,4), %eax
movl 0xc(%rsp), %edx
addl %eax, (%rcx,%rdx,4)
movl 0xc(%rsp), %eax
imulq $0x18, %rax, %rdi
addq (%rbx), %rdi
movq %r13, %rsi
callq 0x478c
incq %r14
jmp 0x3e6d
movq %r15, %rdi
callq 0x2622a
xorpd %xmm0, %xmm0
movq 0x58(%rsp), %rdi
movq %rax, %rsi
callq 0x4756
movq %r15, %rdi
callq 0x2622a
xorpd %xmm0, %xmm0
movq 0x50(%rsp), %rdi
movq %rax, %rsi
callq 0x4756
movq %r15, %rdi
callq 0x2622a
xorpd %xmm0, %xmm0
movq 0x38(%rsp), %rdi
movq %rax, %rsi
callq 0x4756
movq %r15, %rdi
callq 0x2622a
xorpd %xmm0, %xmm0
movq 0x20(%rsp), %rdi
movq %rax, %rsi
callq 0x4756
movl 0x228(%r15), %eax
testl %eax, %eax
je 0x40ef
cmpl $0x2, %eax
jne 0x4526
movq 0x108(%rbx), %rdx
movq 0x100(%rbx), %rax
movq %rax, 0x10(%rsp)
subq %rax, %rdx
shrq $0x2, %rdx
movq (%rbx), %rcx
movq 0x48(%rbx), %rax
movq %rax, 0x28(%rsp)
movq 0x90(%rbx), %rsi
movl 0x1c(%rsp), %edi
movq 0x30(%rsp), %rax
movq (%rax), %r8
movl %edx, %r9d
movsd 0x24076(%rip), %xmm0    # 0x28040
movsd 0x2405e(%rip), %xmm1    # 0x28030
decq %r9
testl %r9d, %r9d
js 0x4526
movl %r9d, %edx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
movq 0x10(%rsp), %rax
movl (%rax,%rdx,4), %r10d
imulq $0x18, %r10, %rdx
movq (%rcx,%rdx), %r11
movq 0x8(%rcx,%rdx), %r14
subq %r11, %r14
sarq $0x2, %r14
movq 0x18(%rbx), %r15
movq 0x48(%rbx), %r12
movq 0x78(%rbx), %r13
movq 0x90(%rbx), %rbp
xorl %edx, %edx
cmpq %rdx, %r14
je 0x407e
movl (%r11,%rdx,4), %eax
cvtsi2sdl (%r15,%rax,4), %xmm2
cvtsi2sdl (%r15,%r10,4), %xmm3
divsd %xmm3, %xmm2
movsd (%r12,%r10,8), %xmm3
addsd %xmm0, %xmm3
mulsd %xmm2, %xmm3
addsd (%r12,%rax,8), %xmm3
movsd %xmm3, (%r12,%rax,8)
cvtsi2sdl (%r13,%rax,4), %xmm2
cvtsi2sdl (%r13,%r10,4), %xmm3
divsd %xmm3, %xmm2
movsd (%rbp,%r10,8), %xmm3
addsd %xmm0, %xmm3
mulsd %xmm2, %xmm3
addsd (%rbp,%rax,8), %xmm3
movsd %xmm3, (%rbp,%rax,8)
incq %rdx
jmp 0x4019
cmpl 0x48(%rsp), %r10d
jne 0x40ae
movq 0x40(%rsp), %rax
movsd (%rsi,%rax,8), %xmm2
movsd (%rsi,%r10,8), %xmm3
movapd %xmm2, %xmm4
divsd %xmm3, %xmm4
addsd %xmm0, %xmm3
mulsd %xmm4, %xmm3
addsd %xmm2, %xmm3
movsd %xmm3, (%rsi,%rax,8)
cmpl %edi, %r10d
je 0x3fd2
movq 0x28(%rsp), %rax
movsd (%rax,%r10,8), %xmm2
mulsd %xmm1, %xmm2
movsd (%r8,%r10,8), %xmm3
subsd %xmm2, %xmm3
movsd %xmm3, (%r8,%r10,8)
movsd (%rsi,%r10,8), %xmm2
mulsd %xmm1, %xmm2
addsd %xmm3, %xmm2
movsd %xmm2, (%r8,%r10,8)
jmp 0x3fd2
leaq 0x1f8(%r15), %r13
movq 0x108(%rbx), %rax
subq 0x100(%rbx), %rax
shrq $0x2, %rax
movl %eax, %r14d
leaq 0x1c(%rsp), %rsi
decq %r14
testl %r14d, %r14d
js 0x4526
movl %r14d, %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movq 0x60(%rsp), %rcx
movq (%rcx), %rcx
movl (%rcx,%rax,4), %eax
movl %eax, 0x8(%rsp)
movq %r13, %rdi
movq %rsi, %r12
callq 0x4a5c
movq 0x200(%r15), %rcx
movq 0x208(%r15), %rdx
cmpq (%rcx,%rdx,8), %rax
movq %r14, 0x28(%rsp)
je 0x4216
movq %r13, %rdi
leaq 0x8(%rsp), %rsi
callq 0x4a5c
movq 0x200(%r15), %rcx
movq 0x208(%r15), %rdx
cmpq (%rcx,%rdx,8), %rax
je 0x4216
movq %r13, %rdi
movq %r12, %rsi
callq 0x4aaa
movq (%rax), %r14
movq %r13, %rdi
movq %r12, %rsi
callq 0x4aaa
movq 0x8(%rax), %rax
xorl %ebp, %ebp
cmpq %rax, %r14
je 0x41ad
addl (%r14), %ebp
addq $0x4, %r14
jmp 0x419f
movq %r13, %rdi
leaq 0x8(%rsp), %rsi
callq 0x4aaa
movq (%rax), %r14
movq %r13, %rdi
leaq 0x8(%rsp), %rsi
callq 0x4aaa
movq 0x8(%rax), %rcx
xorl %eax, %eax
cmpq %rcx, %r14
je 0x41de
addl (%r14), %eax
addq $0x4, %r14
jmp 0x41d0
imull %ebp, %eax
movl 0x8(%rsp), %ecx
cvtsi2sd %eax, %xmm0
movq 0x50(%rsp), %rax
movq (%rax), %rax
movsd (%rax,%rcx,8), %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, (%rax,%rcx,8)
movq 0x20(%rsp), %rax
movq (%rax), %rax
addsd (%rax,%rcx,8), %xmm0
movsd %xmm0, (%rax,%rcx,8)
movq 0x28(%rsp), %r14
xorl %ebp, %ebp
movl 0x8(%rsp), %ecx
movq (%rbx), %rdx
imulq $0x18, %rcx, %rsi
movq (%rdx,%rsi), %rax
movq 0x8(%rdx,%rsi), %rdx
subq %rax, %rdx
sarq $0x2, %rdx
cmpq %rbp, %rdx
jbe 0x4348
movl (%rax,%rbp,4), %r14d
movq 0x18(%rbx), %rax
cvtsi2sdl (%rax,%r14,4), %xmm1
cvtsi2sdl (%rax,%rcx,4), %xmm0
movq 0x48(%rbx), %rax
divsd %xmm0, %xmm1
movsd (%rax,%rcx,8), %xmm0
addsd 0x23ddc(%rip), %xmm0    # 0x28040
movsd %xmm1, 0x10(%rsp)
mulsd %xmm1, %xmm0
addsd (%rax,%r14,8), %xmm0
movsd %xmm0, (%rax,%r14,8)
movq %r13, %rdi
movq %r12, %rsi
callq 0x4a5c
movq 0x200(%r15), %rdx
movq 0x208(%r15), %rsi
movl 0x8(%rsp), %ecx
cmpq (%rdx,%rsi,8), %rax
je 0x42bc
movq 0x50(%rsp), %rax
movq (%rax), %rax
movsd 0x10(%rsp), %xmm0
mulsd (%rax,%rcx,8), %xmm0
addsd (%rax,%r14,8), %xmm0
movsd %xmm0, (%rax,%r14,8)
movq 0x78(%rbx), %rax
cvtsi2sdl (%rax,%r14,4), %xmm1
cvtsi2sdl (%rax,%rcx,4), %xmm0
movq 0x90(%rbx), %rax
divsd %xmm0, %xmm1
movsd (%rax,%rcx,8), %xmm0
addsd 0x23d5d(%rip), %xmm0    # 0x28040
movsd %xmm1, 0x10(%rsp)
mulsd %xmm1, %xmm0
addsd (%rax,%r14,8), %xmm0
movsd %xmm0, (%rax,%r14,8)
movq %r13, %rdi
movq %r12, %rsi
callq 0x4a5c
movq 0x200(%r15), %rcx
movq 0x208(%r15), %rdx
cmpq (%rcx,%rdx,8), %rax
je 0x433b
movq 0x20(%rsp), %rax
movq (%rax), %rax
movl 0x8(%rsp), %ecx
movsd 0x10(%rsp), %xmm0
mulsd (%rax,%rcx,8), %xmm0
addsd (%rax,%r14,8), %xmm0
movsd %xmm0, (%rax,%r14,8)
incq %rbp
movq 0x28(%rsp), %r14
jmp 0x4218
cmpl 0x48(%rsp), %ecx
jne 0x43f4
movq 0x38(%rsp), %rax
movq (%rax), %rax
movq 0x40(%rsp), %rdx
movsd (%rax,%rdx,8), %xmm0
movsd (%rax,%rcx,8), %xmm1
movapd %xmm0, %xmm2
divsd %xmm1, %xmm2
addsd 0x23cc7(%rip), %xmm1    # 0x28040
movsd %xmm2, 0x10(%rsp)
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, (%rax,%rdx,8)
movq %r13, %rdi
movq %r12, %rsi
callq 0x4a5c
movq 0x200(%r15), %rdx
movq 0x208(%r15), %rsi
movl 0x8(%rsp), %ecx
cmpq (%rdx,%rsi,8), %rax
je 0x43f4
movq 0x20(%rsp), %rax
movq (%rax), %rax
movsd (%rax,%rcx,8), %xmm0
movsd 0x10(%rsp), %xmm1
mulsd %xmm1, %xmm0
movq 0x40(%rsp), %rsi
addsd (%rax,%rsi,8), %xmm0
movsd %xmm0, (%rax,%rsi,8)
movq 0x30(%rsp), %rdx
movq (%rdx), %rdx
mulsd (%rax,%rcx,8), %xmm1
mulsd 0x23c46(%rip), %xmm1    # 0x28030
addsd (%rdx,%rsi,8), %xmm1
movsd %xmm1, (%rdx,%rsi,8)
cmpl %ecx, 0x1c(%rsp)
je 0x4445
movl %ecx, %eax
movq 0x58(%rsp), %rcx
movq (%rcx), %rcx
movsd (%rcx,%rax,8), %xmm0
movsd 0x23c1f(%rip), %xmm2    # 0x28030
mulsd %xmm2, %xmm0
movq 0x30(%rsp), %rcx
movq (%rcx), %rcx
movsd (%rcx,%rax,8), %xmm1
subsd %xmm0, %xmm1
movsd %xmm1, (%rcx,%rax,8)
movq 0x38(%rsp), %rdx
movq (%rdx), %rdx
movsd (%rdx,%rax,8), %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%rcx,%rax,8)
movq %r13, %rdi
movq %r12, %rsi
callq 0x4a5c
movq 0x200(%r15), %rcx
movq 0x208(%r15), %rdx
cmpq (%rcx,%rdx,8), %rax
je 0x451e
movq %r13, %rdi
movq %r12, %rbp
movq %r12, %rsi
callq 0x4aaa
movq (%rax), %r14
movq %r13, %rdi
movq %rbp, %rsi
callq 0x4aaa
movq 0x8(%rax), %rax
xorl %ecx, %ecx
cmpq %rax, %r14
je 0x4498
addl (%r14), %ecx
addq $0x4, %r14
jmp 0x448a
movl 0x8(%rsp), %eax
movq 0x58(%rsp), %rdx
movq (%rdx), %rdx
cvtsi2sd %ecx, %xmm0
movq 0x30(%rsp), %rcx
movq (%rcx), %rcx
movsd (%rcx,%rax,8), %xmm1
movsd (%rdx,%rax,8), %xmm2
mulsd %xmm0, %xmm2
subsd %xmm2, %xmm1
movsd %xmm1, (%rcx,%rax,8)
movq 0x50(%rsp), %rdx
movq (%rdx), %rdx
movsd (%rdx,%rax,8), %xmm2
movsd 0x23b54(%rip), %xmm3    # 0x28030
mulsd %xmm3, %xmm2
subsd %xmm2, %xmm1
movsd %xmm1, (%rcx,%rax,8)
movq 0x38(%rsp), %rdx
movq (%rdx), %rdx
mulsd (%rdx,%rax,8), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%rcx,%rax,8)
movq 0x20(%rsp), %rdx
movq (%rdx), %rdx
movsd (%rdx,%rax,8), %xmm1
mulsd %xmm3, %xmm1
addsd %xmm0, %xmm1
movsd %xmm1, (%rcx,%rax,8)
movq 0x28(%rsp), %r14
movq %r12, %rsi
jmp 0x4110
leaq 0x68(%rsp), %rdi
callq 0x5280
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x4556
jmp 0x4556
jmp 0x4556
jmp 0x4556
jmp 0x4556
jmp 0x4556
jmp 0x4556
jmp 0x4556
jmp 0x4556
jmp 0x4556
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
callq 0x5280
movq %rbx, %rdi
callq 0x23d0