// File: /workspace/github_cpp_makefile_star2_O3/fjamour[P]icentral/src/_bc.cc
// Function: RBFS(std::vector<double, std::allocator<double>>&, component_t&, unsigned int, iter_info_t&, bool, bool)
void RBFS(
        vector<double>& dBC_vec,    // delta BC of vertices
        component_t&    comp,       // component could be BCC, MUC, or just a graph
        node_id_t       s,          // source of the iteration
        iter_info_t&    iter_info,  //
        bool            add,
        bool            sub
        )
{
    vector<vector<node_id_t> >&  P = iter_info.P; 
    vector<int>&                 sigma_vec = iter_info.sigma_vec;
    vector<double>&              delta_vec = iter_info.delta_vec;
    vector<double>&              Delta_vec = iter_info.Delta_vec;
    vector<node_id_t>&           S = iter_info.S;
    
    fill_vec<double>(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]));
            }
            if (w != s) {
                if(add) dBC_vec[w] += delta_vec[w]/2.0;
                if(sub) dBC_vec[w] -= delta_vec[w]/2.0;
            }
        }
    } else if(comp.comp_type == BCC) { //BCC or MUC case: involved case, with external pairs contribution
        fill_vec<double>(Delta_vec, comp.subgraph.size(), 0);
        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;
            }
            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;
                }
            }
            if(s != v_n) {
                if(add) dBC_vec[v_n] += delta_vec[v_n]/2.0;
                if(sub) dBC_vec[v_n] -= 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);
                if(add) {
                    dBC_vec[v_n] += delta_vec[v_n]*VG_s;
                    dBC_vec[v_n] += Delta_vec[v_n]/2.0;
                }
                if(sub) {
                    dBC_vec[v_n] -= delta_vec[v_n]*VG_s;
                    dBC_vec[v_n] -= Delta_vec[v_n]/2.0;
                }
            }
        }
    }
    
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %r9d, 0x14(%rsp)
movl %r8d, 0x10(%rsp)
movq %rcx, %rbx
movl %edx, %r15d
movq %rsi, %r12
movq %rdi, 0x18(%rsp)
movl %edx, 0x4(%rsp)
leaq 0x48(%rcx), %r14
movq %rsi, %rdi
callq 0x2e9da
movq %r14, 0x20(%rsp)
movq %r14, %rdi
movq %rax, %rsi
callq 0x5be8
movq 0x48(%rbx), %r13
movq %rbx, 0x8(%rsp)
movq 0x50(%rbx), %rdx
cmpq %rdx, %r13
je 0x4490
subq %r13, %rdx
addq $-0x8, %rdx
andq $-0x8, %rdx
addq $0x8, %rdx
movq %r13, %rdi
xorl %esi, %esi
callq 0x2110
movl 0x228(%r12), %eax
testl %eax, %eax
je 0x45b2
cmpl $0x2, %eax
jne 0x49a2
movq 0x8(%rsp), %rcx
movq 0x100(%rcx), %rax
movq 0x108(%rcx), %rdi
subq %rax, %rdi
shrq $0x2, %rdi
decl %edi
js 0x49a2
movq 0x8(%rsp), %rdx
movq (%rdx), %rcx
movq 0x18(%rdx), %rdx
movq 0x18(%rsp), %rsi
movq (%rsi), %rsi
movl %edi, %edi
movsd 0x2bb4f(%rip), %xmm0    # 0x30038
movsd 0x2bb4f(%rip), %xmm1    # 0x30040
movsd 0x2bb37(%rip), %xmm2    # 0x30030
movl (%rax,%rdi,4), %r8d
leaq (%r8,%r8,2), %r10
movq (%rcx,%r10,8), %r9
movq 0x8(%rcx,%r10,8), %r10
subq %r9, %r10
je 0x455c
sarq $0x2, %r10
xorps %xmm3, %xmm3
cvtsi2sdl (%rdx,%r8,4), %xmm3
cmpq $0x1, %r10
adcq $0x0, %r10
xorl %r11d, %r11d
movl (%r9,%r11,4), %ebx
xorps %xmm4, %xmm4
cvtsi2sdl (%rdx,%rbx,4), %xmm4
divsd %xmm3, %xmm4
movsd (%r13,%r8,8), %xmm5
addsd %xmm2, %xmm5
mulsd %xmm4, %xmm5
addsd (%r13,%rbx,8), %xmm5
movsd %xmm5, (%r13,%rbx,8)
incq %r11
cmpq %r11, %r10
jne 0x4527
cmpl %r15d, %r8d
je 0x459d
cmpb $0x0, 0x10(%rsp)
je 0x457f
movsd (%r13,%r8,8), %xmm3
mulsd %xmm0, %xmm3
addsd (%rsi,%r8,8), %xmm3
movsd %xmm3, (%rsi,%r8,8)
cmpb $0x0, 0x14(%rsp)
je 0x459d
movsd (%r13,%r8,8), %xmm3
mulsd %xmm1, %xmm3
addsd (%rsi,%r8,8), %xmm3
movsd %xmm3, (%rsi,%r8,8)
leaq -0x1(%rdi), %r8
testq %rdi, %rdi
movq %r8, %rdi
jg 0x44f9
jmp 0x49a2
movq 0x8(%rsp), %rbx
leaq 0x60(%rbx), %r14
movq %r12, %rdi
callq 0x2e9da
movq %r14, 0x28(%rsp)
movq %r14, %rdi
movq %rax, %rsi
callq 0x5be8
movq 0x60(%rbx), %rdi
movq 0x68(%rbx), %rdx
cmpq %rdx, %rdi
je 0x45f6
subq %rdi, %rdx
addq $-0x8, %rdx
andq $-0x8, %rdx
addq $0x8, %rdx
xorl %esi, %esi
callq 0x2110
movq 0x8(%rsp), %rcx
movq 0x108(%rcx), %rax
subq 0x100(%rcx), %rax
shrq $0x2, %rax
decl %eax
js 0x49a2
leaq 0x1f8(%r12), %rcx
movq %rcx, 0x30(%rsp)
movl %eax, %r15d
movsd 0x2ba03(%rip), %xmm3    # 0x30030
movq 0x8(%rsp), %rax
movq 0x100(%rax), %rax
movl (%rax,%r15,4), %esi
movl %esi, (%rsp)
movl 0x4(%rsp), %ecx
movq 0x200(%r12), %rdi
movq 0x208(%r12), %r8
movq %rcx, %rax
xorl %edx, %edx
divq %r8
movq (%rdi,%rdx,8), %rax
testq %rax, %rax
je 0x474e
cmpl (%rax), %ecx
je 0x4673
movq 0x20(%rax), %rax
jmp 0x4660
movq (%rdi,%r8,8), %r9
cmpq %r9, %rax
je 0x474e
movq %rsi, %rax
xorl %edx, %edx
divq %r8
movq (%rdi,%rdx,8), %rax
testq %rax, %rax
je 0x474e
cmpl (%rax), %esi
je 0x469f
movq 0x20(%rax), %rax
jmp 0x468c
cmpq %r9, %rax
je 0x474e
movq 0x30(%rsp), %rbx
movq %rbx, %rdi
leaq 0x4(%rsp), %r14
movq %r14, %rsi
callq 0x6088
movq (%rax), %rbp
movq %rbx, %rdi
movq %r14, %rsi
callq 0x6088
movq 0x8(%rax), %rax
xorl %r13d, %r13d
movl $0x0, %ebx
cmpq %rax, %rbp
je 0x46ea
xorl %ebx, %ebx
addl (%rbp), %ebx
addq $0x4, %rbp
cmpq %rax, %rbp
jne 0x46de
movq 0x30(%rsp), %r14
movq %r14, %rdi
movq %rsp, %rsi
callq 0x6088
movq (%rax), %rbp
movq %r14, %rdi
movq %rsp, %rsi
callq 0x6088
movq 0x8(%rax), %rax
cmpq %rax, %rbp
je 0x4721
xorl %r13d, %r13d
addl (%rbp), %r13d
addq $0x4, %rbp
cmpq %rax, %rbp
jne 0x4714
imull %ebx, %r13d
movl (%rsp), %esi
movq 0x28(%rsp), %rax
movq (%rax), %rax
xorps %xmm0, %xmm0
cvtsi2sd %r13d, %xmm0
addsd (%rax,%rsi,8), %xmm0
movsd %xmm0, (%rax,%rsi,8)
movl 0x4(%rsp), %ecx
movsd 0x2b8e2(%rip), %xmm3    # 0x30030
movq 0x8(%rsp), %rax
movq (%rax), %rax
leaq (%rsi,%rsi,2), %rdx
movq (%rax,%rdx,8), %r8
movq 0x8(%rax,%rdx,8), %r9
movl %ecx, %edi
subq %r8, %r9
je 0x4815
sarq $0x2, %r9
movq 0x8(%rsp), %rbp
movq 0x18(%rbp), %r10
movq 0x48(%rbp), %r11
xorps %xmm0, %xmm0
cvtsi2sdl (%r10,%rsi,4), %xmm0
movq 0x200(%r12), %rbx
movq 0x208(%r12), %r13
movq %rdi, %rax
xorl %edx, %edx
divq %r13
movq (%rbx,%rdx,8), %r14
movq (%rbx,%r13,8), %rdx
movq 0x60(%rbp), %rbx
cmpq $0x1, %r9
adcq $0x0, %r9
xorl %r13d, %r13d
movl (%r8,%r13,4), %ebp
xorps %xmm1, %xmm1
cvtsi2sdl (%r10,%rbp,4), %xmm1
divsd %xmm0, %xmm1
movsd (%r11,%rsi,8), %xmm2
addsd %xmm3, %xmm2
mulsd %xmm1, %xmm2
addsd (%r11,%rbp,8), %xmm2
movsd %xmm2, (%r11,%rbp,8)
testq %r14, %r14
je 0x480d
movq %r14, %rax
cmpl (%rax), %ecx
je 0x47f9
movq 0x20(%rax), %rax
testq %rax, %rax
jne 0x47ea
jmp 0x480d
cmpq %rdx, %rax
je 0x480d
mulsd (%rbx,%rsi,8), %xmm1
addsd (%rbx,%rbp,8), %xmm1
movsd %xmm1, (%rbx,%rbp,8)
incq %r13
cmpq %r9, %r13
jne 0x47b7
cmpl %esi, %ecx
je 0x4875
cmpb $0x0, 0x10(%rsp)
je 0x4847
movq 0x20(%rsp), %rax
movq (%rax), %rax
movsd (%rax,%rsi,8), %xmm0
mulsd 0x2b803(%rip), %xmm0    # 0x30038
movq 0x18(%rsp), %rax
movq (%rax), %rax
addsd (%rax,%rsi,8), %xmm0
movsd %xmm0, (%rax,%rsi,8)
cmpb $0x0, 0x14(%rsp)
je 0x4875
movq 0x20(%rsp), %rax
movq (%rax), %rax
movsd (%rax,%rsi,8), %xmm0
mulsd 0x2b7dd(%rip), %xmm0    # 0x30040
movq 0x18(%rsp), %rax
movq (%rax), %rax
addsd (%rax,%rsi,8), %xmm0
movsd %xmm0, (%rax,%rsi,8)
movq 0x200(%r12), %rsi
movq 0x208(%r12), %r8
movq %rdi, %rax
xorl %edx, %edx
divq %r8
movq (%rsi,%rdx,8), %rax
testq %rax, %rax
je 0x4992
cmpl (%rax), %ecx
je 0x48a4
movq 0x20(%rax), %rax
jmp 0x4891
cmpq (%rsi,%r8,8), %rax
je 0x4992
movq 0x30(%rsp), %r14
movq %r14, %rdi
leaq 0x4(%rsp), %r13
movq %r13, %rsi
callq 0x6088
movq (%rax), %rbx
movq %r14, %rdi
movq %r13, %rsi
callq 0x6088
movq 0x8(%rax), %rax
cmpq %rax, %rbx
je 0x48f0
xorl %ecx, %ecx
addl (%rbx), %ecx
addq $0x4, %rbx
cmpq %rax, %rbx
jne 0x48dc
xorps %xmm0, %xmm0
cvtsi2sd %ecx, %xmm0
jmp 0x48f4
xorpd %xmm0, %xmm0
movsd 0x2b734(%rip), %xmm3    # 0x30030
cmpb $0x0, 0x10(%rsp)
je 0x4947
movl (%rsp), %eax
movq 0x20(%rsp), %rcx
movq (%rcx), %rcx
movq 0x18(%rsp), %rdx
movq (%rdx), %rdx
movsd (%rcx,%rax,8), %xmm1
mulsd %xmm0, %xmm1
addsd (%rdx,%rax,8), %xmm1
movsd %xmm1, (%rdx,%rax,8)
movq 0x28(%rsp), %rcx
movq (%rcx), %rcx
movsd (%rcx,%rax,8), %xmm2
mulsd 0x2b6fa(%rip), %xmm2    # 0x30038
addsd %xmm1, %xmm2
movsd %xmm2, (%rdx,%rax,8)
cmpb $0x0, 0x14(%rsp)
je 0x4992
movl (%rsp), %eax
movq 0x20(%rsp), %rcx
movq (%rcx), %rcx
movq 0x18(%rsp), %rdx
movq (%rdx), %rdx
mulsd (%rcx,%rax,8), %xmm0
movsd (%rdx,%rax,8), %xmm1
subsd %xmm0, %xmm1
movsd %xmm1, (%rdx,%rax,8)
movq 0x28(%rsp), %rcx
movq (%rcx), %rcx
movsd (%rcx,%rax,8), %xmm0
mulsd 0x2b6b7(%rip), %xmm0    # 0x30040
addsd %xmm1, %xmm0
movsd %xmm0, (%rdx,%rax,8)
leaq -0x1(%r15), %rax
testq %r15, %r15
movq %rax, %r15
jg 0x462d
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq