// File: /workspace/github_cpp_makefile_star2_O2/fjamour[P]icentral/src/bcc_scratch.cc
// Function: bcc_scratch_t::bc_iter(unsigned int, 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>>>&)
void bcc_scratch_t::bc_iter(node_id_t s, tr1::unordered_map<node_id_t,double>& bc_map) {
    vector<vector<node_id_t> >&  P = bcc_fast_subgraph.P;
    vector<int>&                 path_cnt_map = bcc_fast_subgraph.path_cnt_vec;
    vector<int>&                 dist_map = bcc_fast_subgraph.dist_vec;
    vector<double>&              pair_dep_map = bcc_fast_subgraph.pair_dep_vec;
    vector<double>&              sigma_t_map = bcc_fast_subgraph.sigma_t_map;
    queue<node_id_t>&            Q = bcc_fast_subgraph.Q;
    stack<node_id_t>             S;

    bcc_fast_subgraph.init_maps();
    path_cnt_map[s] = 1;
    dist_map[s] = 0;

    Q.push(s);
    while (!Q.empty()) {
        node_id_t v_i = Q.front();
        Q.pop();
        S.push(v_i);
        for(int i = 0; i < bcc_fast_subgraph.nodes_vec[v_i].size(); ++i) {
            node_id_t v_n = bcc_fast_subgraph.nodes_vec[v_i][i];
            if (dist_map[v_n] < 0) {
                Q.push(v_n);
                dist_map[v_n] = dist_map[v_i] + 1;
            }
            if (dist_map[v_n] == dist_map[v_i] + 1) {
                path_cnt_map[v_n] = path_cnt_map[v_n] + path_cnt_map[v_i];
                P[v_n].push_back(v_i);
            }
        }
    }
    while (!S.empty()) {
        node_id_t v_n = S.top();
        S.pop();
        if (art_pt_map.find(s) != art_pt_map.end()
                && art_pt_map.find(v_n) != art_pt_map.end()
                && s != v_n) {
            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;
            sigma_t_map[v_n] = sigma_t_map[v_n] + c_t;
            
            node_id_t new_v_n = bcc_fast_subgraph.inout_label_map[v_n];
            bc_map[new_v_n] = bc_map[new_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) path_cnt_map[v_p] / path_cnt_map[v_n]);
            pair_dep_map[v_p] = pair_dep_map[v_p] + sp_sn * (1 + pair_dep_map[v_n]);
            if (art_pt_map.find(s) != art_pt_map.end()) {
                sigma_t_map[v_p] = sigma_t_map[v_p] + sigma_t_map[v_n] * sp_sn;
                
                node_id_t new_v_p = bcc_fast_subgraph.inout_label_map[v_p];
                bc_map[new_v_p] = bc_map[new_v_p] + sigma_t_map[v_n] * sp_sn;
            }
        }
        if (s != v_n) {
            node_id_t new_v_n = bcc_fast_subgraph.inout_label_map[v_n];
            bc_map[new_v_n] = bc_map[new_v_n] + pair_dep_map[v_n];
        }
        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);
            
            node_id_t new_v_n = bcc_fast_subgraph.inout_label_map[v_n];
            bc_map[new_v_n] = bc_map[new_v_n] + pair_dep_map[v_n] * VG_s * 2;
        }
    }    
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rdx, %rbx
movl %esi, %ebp
movq %rdi, %r14
movl %esi, 0xc(%rsp)
leaq 0x2d8(%rdi), %r15
leaq 0x28(%rsp), %rdi
callq 0x766a
movq %r15, %rdi
callq 0x25fea
leaq 0x480(%r14), %r12
movl %ebp, %eax
movq 0x380(%r14), %rcx
movl $0x1, (%rcx,%rax,4)
leaq 0xc(%rsp), %rsi
movl (%rsi), %eax
movq 0x3b0(%r14), %rcx
andl $0x0, (%rcx,%rax,4)
movq %r12, %rdi
callq 0x62da
leaq 0x4(%rsp), %rbp
movq 0x490(%r14), %rax
cmpq %rax, 0x4b0(%r14)
je 0x1042b
movl (%rax), %eax
movl %eax, 0x4(%rsp)
movq %r12, %rdi
callq 0x650e
leaq 0x28(%rsp), %rdi
movq %rbp, %rsi
callq 0x62da
xorl %r13d, %r13d
movl 0x4(%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 %r13, %rdx
jbe 0x1035f
movl (%rcx,%r13,4), %ecx
movl %ecx, 0x8(%rsp)
movq 0x3b0(%r14), %rdx
movl (%rdx,%rcx,4), %esi
testl %esi, %esi
jns 0x103f6
movq %r12, %rdi
leaq 0x8(%rsp), %rsi
callq 0x62da
movl 0x4(%rsp), %eax
movq 0x3b0(%r14), %rdx
movl (%rdx,%rax,4), %eax
incl %eax
movl 0x8(%rsp), %ecx
movl %eax, (%rdx,%rcx,4)
movl 0x8(%rsp), %ecx
movl (%rdx,%rcx,4), %esi
movl 0x4(%rsp), %eax
movl (%rdx,%rax,4), %edx
incl %edx
cmpl %edx, %esi
jne 0x10423
movq 0x380(%r14), %rdx
movl (%rdx,%rax,4), %eax
addl %eax, (%rdx,%rcx,4)
movl 0x8(%rsp), %eax
imulq $0x18, %rax, %rdi
addq 0x368(%r14), %rdi
movq %rbp, %rsi
callq 0x478c
incq %r13
jmp 0x10391
leaq 0xc(%rsp), %r12
leaq 0x8(%rsp), %r13
movq 0x58(%rsp), %rax
cmpq 0x38(%rsp), %rax
je 0x10794
cmpq 0x60(%rsp), %rax
jne 0x1045d
movq 0x70(%rsp), %rax
movq -0x8(%rax), %rax
movl $0x200, %ecx            # imm = 0x200
addq %rcx, %rax
movl -0x4(%rax), %eax
movl %eax, 0x4(%rsp)
leaq 0x28(%rsp), %rdi
callq 0x85f6
movq %r14, %rdi
movq %r12, %rsi
callq 0x4a5c
movq 0x8(%r14), %rcx
movq 0x10(%r14), %rdx
cmpq (%rcx,%rdx,8), %rax
je 0x1057d
movq %r14, %rdi
leaq 0x4(%rsp), %rsi
callq 0x4a5c
movq 0x8(%r14), %rcx
movq 0x10(%r14), %rdx
cmpq (%rcx,%rdx,8), %rax
je 0x1057d
movl 0xc(%rsp), %eax
cmpl 0x4(%rsp), %eax
je 0x1057d
movq %r14, %rdi
movq %r12, %rsi
callq 0x4aaa
movq (%rax), %rbp
movq %r14, %rdi
movq %r12, %rsi
callq 0x4aaa
movq 0x8(%rax), %rax
xorl %r15d, %r15d
cmpq %rax, %rbp
je 0x104e7
addl (%rbp), %r15d
addq $0x4, %rbp
jmp 0x104d8
movq %r14, %rdi
leaq 0x4(%rsp), %rsi
callq 0x4aaa
movq (%rax), %rbp
movq %r14, %rdi
leaq 0x4(%rsp), %rsi
callq 0x4aaa
movq 0x8(%rax), %rcx
xorl %eax, %eax
cmpq %rcx, %rbp
je 0x10518
addl (%rbp), %eax
addq $0x4, %rbp
jmp 0x1050a
imull %r15d, %eax
movl 0x4(%rsp), %ecx
movq 0x410(%r14), %rdx
cvtsi2sd %eax, %xmm1
movsd (%rdx,%rcx,8), %xmm0
movsd %xmm1, 0x10(%rsp)
addsd %xmm1, %xmm0
movsd %xmm0, (%rdx,%rcx,8)
movq 0x320(%r14), %rax
movl (%rax,%rcx,4), %eax
movl %eax, 0x8(%rsp)
movq %rbx, %rdi
movq %r13, %rsi
callq 0xb00c
movsd (%rax), %xmm0
movsd %xmm0, 0x18(%rsp)
movq %rbx, %rdi
movq %r13, %rsi
callq 0xb00c
movsd 0x18(%rsp), %xmm0
addsd 0x10(%rsp), %xmm0
movsd %xmm0, (%rax)
xorl %r15d, %r15d
movl 0x4(%rsp), %eax
movq 0x368(%r14), %rdx
imulq $0x18, %rax, %rsi
movq (%rdx,%rsi), %rcx
movq 0x8(%rdx,%rsi), %rdx
subq %rcx, %rdx
sarq $0x2, %rdx
cmpq %r15, %rdx
jbe 0x10684
movl (%rcx,%r15,4), %ebp
movq 0x380(%r14), %rcx
cvtsi2sdl (%rcx,%rbp,4), %xmm1
cvtsi2sdl (%rcx,%rax,4), %xmm0
movq 0x3c8(%r14), %rcx
divsd %xmm0, %xmm1
movsd (%rcx,%rax,8), %xmm0
addsd 0x17a6b(%rip), %xmm0    # 0x28040
movsd %xmm1, 0x10(%rsp)
mulsd %xmm1, %xmm0
addsd (%rcx,%rbp,8), %xmm0
movsd %xmm0, (%rcx,%rbp,8)
movq %r14, %rdi
movq %r12, %rsi
callq 0x4a5c
movq 0x8(%r14), %rcx
movq 0x10(%r14), %rdx
cmpq (%rcx,%rdx,8), %rax
je 0x1067c
movq 0x410(%r14), %rax
movl 0x4(%rsp), %ecx
movsd (%rax,%rcx,8), %xmm0
mulsd 0x10(%rsp), %xmm0
addsd (%rax,%rbp,8), %xmm0
movsd %xmm0, (%rax,%rbp,8)
movq 0x320(%r14), %rax
movl (%rax,%rbp,4), %eax
movl %eax, 0x8(%rsp)
movq %rbx, %rdi
movq %r13, %rsi
callq 0xb00c
movsd (%rax), %xmm0
movsd %xmm0, 0x18(%rsp)
movl 0x4(%rsp), %eax
movq 0x410(%r14), %rcx
movsd (%rcx,%rax,8), %xmm0
movsd %xmm0, 0x20(%rsp)
movq %rbx, %rdi
movq %r13, %rsi
callq 0xb00c
movsd 0x20(%rsp), %xmm0
mulsd 0x10(%rsp), %xmm0
addsd 0x18(%rsp), %xmm0
movsd %xmm0, (%rax)
incq %r15
jmp 0x10580
cmpl %eax, 0xc(%rsp)
je 0x106de
movq 0x320(%r14), %rcx
movl (%rcx,%rax,4), %eax
movl %eax, 0x8(%rsp)
movq %rbx, %rdi
movq %r13, %rsi
callq 0xb00c
movsd (%rax), %xmm0
movsd %xmm0, 0x10(%rsp)
movl 0x4(%rsp), %eax
movq 0x3c8(%r14), %rcx
movsd (%rcx,%rax,8), %xmm0
movsd %xmm0, 0x18(%rsp)
movq %rbx, %rdi
movq %r13, %rsi
callq 0xb00c
movsd 0x10(%rsp), %xmm0
addsd 0x18(%rsp), %xmm0
movsd %xmm0, (%rax)
movq %r14, %rdi
movq %r12, %rsi
callq 0x4a5c
movq 0x8(%r14), %rcx
movq 0x10(%r14), %rdx
cmpq (%rcx,%rdx,8), %rax
je 0x10435
movq %r14, %rdi
movq %r12, %rsi
callq 0x4aaa
movq (%rax), %rbp
movq %r14, %rdi
movq %r12, %rsi
callq 0x4aaa
movq 0x8(%rax), %rax
xorl %r15d, %r15d
cmpq %rax, %rbp
je 0x1072a
addl (%rbp), %r15d
addq $0x4, %rbp
jmp 0x1071b
movl 0x4(%rsp), %eax
movq 0x320(%r14), %rcx
movl (%rcx,%rax,4), %eax
movl %eax, 0x8(%rsp)
movq %rbx, %rdi
movq %r13, %rsi
callq 0xb00c
movsd (%rax), %xmm0
movsd %xmm0, 0x10(%rsp)
movl 0x4(%rsp), %eax
movq 0x3c8(%r14), %rcx
movsd (%rcx,%rax,8), %xmm0
movsd %xmm0, 0x18(%rsp)
movq %rbx, %rdi
movq %r13, %rsi
callq 0xb00c
cvtsi2sd %r15d, %xmm0
movsd 0x18(%rsp), %xmm1
mulsd %xmm0, %xmm1
addsd %xmm1, %xmm1
addsd 0x10(%rsp), %xmm1
movsd %xmm1, (%rax)
jmp 0x10435
leaq 0x28(%rsp), %rdi
callq 0x5280
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x107c5
jmp 0x107c5
jmp 0x107c5
jmp 0x107c5
jmp 0x107c5
jmp 0x107c5
jmp 0x107c5
jmp 0x107c5
jmp 0x107c5
jmp 0x107c5
jmp 0x107c5
jmp 0x107c5
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x5280
movq %rbx, %rdi
callq 0x23d0
nop