// File: fjamour[P]icentral/src/bc.cc
// Function: brandes_iter(graph_t&, unsigned int, std::vector<double, std::allocator<double>>&)
void brandes_iter(graph_t& graph_in,
        node_id_t s,
        vector<double>& bc_vec)
{
    stack<node_id_t> S;
    vector<vector<node_id_t> > P;
    vector<int> path_cnt_vec;
    vector<int> dist_vec;
    queue<node_id_t> Q;
    vector<double> pair_dep_vec;

    P.resize(graph_in.size());
    path_cnt_vec.resize(graph_in.size());
    fill(path_cnt_vec.begin(), path_cnt_vec.end(), 0);
    path_cnt_vec[s] = 1;
    dist_vec.resize(graph_in.size());
    fill(dist_vec.begin(), dist_vec.end(), -1);
    dist_vec[s] = 0;
    pair_dep_vec.resize(graph_in.size());
    fill(pair_dep_vec.begin(), pair_dep_vec.end(), 0.0);

    Q.push(s);

    while (!Q.empty()) {
        node_id_t v = Q.front();
        Q.pop();
        S.push(v);
        vector<node_id_t> nbr_vec = graph_in.get_nbrs(v);
        for (int nbr_idx = 0; nbr_idx < nbr_vec.size(); ++nbr_idx) {
            node_id_t w = nbr_vec[nbr_idx];
            if (dist_vec[w] < 0) {
                Q.push(w);
                dist_vec[w] = dist_vec[v] + 1;
            }
            if (dist_vec[w] == dist_vec[v] + 1) {
                path_cnt_vec[w] += path_cnt_vec[v];
                P[w].push_back(v);
            }
        }
    }

    while (!S.empty()) {
        node_id_t w = S.top();
        S.pop();
        for (int idx = 0; idx < P[w].size(); ++idx) {
            node_id_t v = P[w][idx];
            pair_dep_vec[v] += (((double) path_cnt_vec[v] / path_cnt_vec[w]) * (1 + pair_dep_vec[w]));
        }
        if (w != s) {
            bc_vec[w] += pair_dep_vec[w];
        }
    }
}

// Assembly:
subq $0x258, %rsp            # imm = 0x258
movq %rdi, 0x250(%rsp)
movl %esi, 0x24c(%rsp)
movq %rdx, 0x240(%rsp)
leaq 0x1f0(%rsp), %rdi
callq 0x21da0
leaq 0x1d8(%rsp), %rdi
callq 0x10030
leaq 0x1c0(%rsp), %rdi
callq 0xfc40
leaq 0x1a8(%rsp), %rdi
callq 0xfc40
leaq 0x158(%rsp), %rdi
callq 0x10580
jmp 0x289d1
leaq 0x130(%rsp), %rdi
callq 0xfa00
movq 0x250(%rsp), %rdi
callq 0x56b40
movq %rax, 0xa8(%rsp)
jmp 0x289f5
movq 0xa8(%rsp), %rsi
leaq 0x1d8(%rsp), %rdi
callq 0x10040
jmp 0x28a0c
movq 0x250(%rsp), %rdi
callq 0x56b40
movq %rax, 0xa0(%rsp)
jmp 0x28a23
movq 0xa0(%rsp), %rsi
leaq 0x1c0(%rsp), %rdi
callq 0x2cfc0
jmp 0x28a3a
leaq 0x1c0(%rsp), %rdi
movq %rdi, 0x98(%rsp)
callq 0x109f0
movq 0x98(%rsp), %rdi
movq %rax, 0x128(%rsp)
callq 0x10a20
movq %rax, 0x120(%rsp)
movl $0x0, 0x11c(%rsp)
movq 0x128(%rsp), %rdi
movq 0x120(%rsp), %rsi
leaq 0x11c(%rsp), %rdx
callq 0x21f20
jmp 0x28a96
movl 0x24c(%rsp), %eax
movl %eax, %esi
leaq 0x1c0(%rsp), %rdi
callq 0xfc50
movl $0x1, (%rax)
movq 0x250(%rsp), %rdi
callq 0x56b40
movq %rax, 0x90(%rsp)
jmp 0x28ac9
movq 0x90(%rsp), %rsi
leaq 0x1a8(%rsp), %rdi
callq 0x2cfc0
jmp 0x28ae0
leaq 0x1a8(%rsp), %rdi
movq %rdi, 0x88(%rsp)
callq 0x109f0
movq 0x88(%rsp), %rdi
movq %rax, 0x110(%rsp)
callq 0x10a20
movq %rax, 0x108(%rsp)
movl $0xffffffff, 0x104(%rsp) # imm = 0xFFFFFFFF
movq 0x110(%rsp), %rdi
movq 0x108(%rsp), %rsi
leaq 0x104(%rsp), %rdx
callq 0x21f20
jmp 0x28b3c
movl 0x24c(%rsp), %eax
movl %eax, %esi
leaq 0x1a8(%rsp), %rdi
callq 0xfc50
movl $0x0, (%rax)
movq 0x250(%rsp), %rdi
callq 0x56b40
movq %rax, 0x80(%rsp)
jmp 0x28b6f
movq 0x80(%rsp), %rsi
leaq 0x130(%rsp), %rdi
callq 0xf680
jmp 0x28b86
leaq 0x130(%rsp), %rdi
movq %rdi, 0x78(%rsp)
callq 0xf760
movq 0x78(%rsp), %rdi
movq %rax, 0xf8(%rsp)
callq 0xf790
movq %rax, 0xf0(%rsp)
movq $0x0, 0xe8(%rsp)
movq 0xf8(%rsp), %rdi
movq 0xf0(%rsp), %rsi
leaq 0xe8(%rsp), %rdx
callq 0xf720
jmp 0x28bdd
leaq 0x158(%rsp), %rdi
leaq 0x24c(%rsp), %rsi
callq 0x105b0
jmp 0x28bf4
jmp 0x28bf6
leaq 0x158(%rsp), %rdi
callq 0x105e0
movb %al, 0x77(%rsp)
jmp 0x28c09
movb 0x77(%rsp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x28c18
jmp 0x28e82
leaq 0x158(%rsp), %rdi
callq 0x10600
movq %rax, 0x68(%rsp)
jmp 0x28c2c
movq 0x68(%rsp), %rax
movl (%rax), %eax
movl %eax, 0xe4(%rsp)
leaq 0x158(%rsp), %rdi
callq 0x10610
jmp 0x28c49
leaq 0x1f0(%rsp), %rdi
leaq 0xe4(%rsp), %rsi
callq 0x21d50
jmp 0x28c60
movq 0x250(%rsp), %rdi
movl 0xe4(%rsp), %esi
callq 0x566f0
movq %rax, 0x60(%rsp)
jmp 0x28c7b
movq 0x60(%rsp), %rsi
leaq 0xc8(%rsp), %rdi
callq 0x10b20
jmp 0x28c8f
movl $0x0, 0xc4(%rsp)
movslq 0xc4(%rsp), %rax
movq %rax, 0x58(%rsp)
leaq 0xc8(%rsp), %rdi
callq 0xfd50
movq %rax, %rcx
movq 0x58(%rsp), %rax
cmpq %rcx, %rax
jae 0x28e70
movslq 0xc4(%rsp), %rsi
leaq 0xc8(%rsp), %rdi
callq 0xfbc0
movl (%rax), %eax
movl %eax, 0xc0(%rsp)
movl 0xc0(%rsp), %eax
movl %eax, %esi
leaq 0x1a8(%rsp), %rdi
callq 0xfc50
cmpl $0x0, (%rax)
jge 0x28dae
leaq 0x158(%rsp), %rdi
leaq 0xc0(%rsp), %rsi
callq 0x105b0
jmp 0x28d19
movl 0xe4(%rsp), %eax
movl %eax, %esi
leaq 0x1a8(%rsp), %rdi
callq 0xfc50
movl (%rax), %eax
addl $0x1, %eax
movl %eax, 0x54(%rsp)
movl 0xc0(%rsp), %eax
movl %eax, %esi
leaq 0x1a8(%rsp), %rdi
callq 0xfc50
movl 0x54(%rsp), %ecx
movl %ecx, (%rax)
jmp 0x28dae
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x150(%rsp)
movl %eax, 0x14c(%rsp)
jmp 0x290d0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x150(%rsp)
movl %eax, 0x14c(%rsp)
jmp 0x290b6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x150(%rsp)
movl %eax, 0x14c(%rsp)
leaq 0xc8(%rsp), %rdi
callq 0x10520
jmp 0x290b6
movl 0xc0(%rsp), %eax
movl %eax, %esi
leaq 0x1a8(%rsp), %rdi
callq 0xfc50
movl (%rax), %eax
movl %eax, 0x50(%rsp)
movl 0xe4(%rsp), %eax
movl %eax, %esi
leaq 0x1a8(%rsp), %rdi
callq 0xfc50
movq %rax, %rcx
movl 0x50(%rsp), %eax
movl (%rcx), %ecx
addl $0x1, %ecx
cmpl %ecx, %eax
jne 0x28e58
movl 0xe4(%rsp), %eax
movl %eax, %esi
leaq 0x1c0(%rsp), %rdi
movq %rdi, 0x40(%rsp)
callq 0xfc50
movq 0x40(%rsp), %rdi
movl (%rax), %eax
movl %eax, 0x4c(%rsp)
movl 0xc0(%rsp), %eax
movl %eax, %esi
callq 0xfc50
movl 0x4c(%rsp), %edx
movl (%rax), %ecx
addl %edx, %ecx
movl %ecx, (%rax)
movl 0xc0(%rsp), %eax
movl %eax, %esi
leaq 0x1d8(%rsp), %rdi
callq 0x100e0
movq %rax, %rdi
leaq 0xe4(%rsp), %rsi
callq 0xfce0
jmp 0x28e56
jmp 0x28e58
jmp 0x28e5a
movl 0xc4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xc4(%rsp)
jmp 0x28c9a
leaq 0xc8(%rsp), %rdi
callq 0x10520
jmp 0x28bf6
jmp 0x28e84
leaq 0x1f0(%rsp), %rdi
callq 0x21ee0
movb %al, 0x3f(%rsp)
jmp 0x28e97
movb 0x3f(%rsp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x28ea6
jmp 0x29060
leaq 0x1f0(%rsp), %rdi
callq 0x21f00
movq %rax, 0x30(%rsp)
jmp 0x28eba
movq 0x30(%rsp), %rax
movl (%rax), %eax
movl %eax, 0xbc(%rsp)
leaq 0x1f0(%rsp), %rdi
callq 0x21f10
jmp 0x28ed7
movl $0x0, 0xb8(%rsp)
movslq 0xb8(%rsp), %rax
movq %rax, 0x28(%rsp)
movl 0xbc(%rsp), %eax
movl %eax, %esi
leaq 0x1d8(%rsp), %rdi
callq 0x100e0
movq %rax, %rdi
callq 0xfd50
movq %rax, %rcx
movq 0x28(%rsp), %rax
cmpq %rcx, %rax
jae 0x29007
movl 0xbc(%rsp), %eax
movl %eax, %esi
leaq 0x1d8(%rsp), %rdi
callq 0x100e0
movq %rax, %rdi
movslq 0xb8(%rsp), %rsi
callq 0xfbc0
movl (%rax), %eax
movl %eax, 0xb4(%rsp)
movl 0xb4(%rsp), %eax
movl %eax, %esi
leaq 0x1c0(%rsp), %rdi
callq 0xfc50
cvtsi2sdl (%rax), %xmm0
movsd %xmm0, 0x10(%rsp)
movl 0xbc(%rsp), %eax
movl %eax, %esi
leaq 0x1c0(%rsp), %rdi
callq 0xfc50
movsd 0x10(%rsp), %xmm0
cvtsi2sdl (%rax), %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, 0x18(%rsp)
movl 0xbc(%rsp), %eax
movl %eax, %esi
leaq 0x130(%rsp), %rdi
callq 0xfa30
movsd 0x5205b(%rip), %xmm0    # 0x7b010
addsd (%rax), %xmm0
movsd %xmm0, 0x20(%rsp)
movl 0xb4(%rsp), %eax
movl %eax, %esi
leaq 0x130(%rsp), %rdi
callq 0xfa30
movsd 0x18(%rsp), %xmm0
movsd 0x20(%rsp), %xmm2
movsd (%rax), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%rax)
movl 0xb8(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xb8(%rsp)
jmp 0x28ee2
movl 0xbc(%rsp), %eax
cmpl 0x24c(%rsp), %eax
je 0x2905b
movl 0xbc(%rsp), %eax
movl %eax, %esi
leaq 0x130(%rsp), %rdi
callq 0xfa30
movsd (%rax), %xmm0
movsd %xmm0, 0x8(%rsp)
movq 0x240(%rsp), %rdi
movl 0xbc(%rsp), %eax
movl %eax, %esi
callq 0xfa30
movsd 0x8(%rsp), %xmm0
addsd (%rax), %xmm0
movsd %xmm0, (%rax)
jmp 0x28e84
leaq 0x130(%rsp), %rdi
callq 0xfa50
leaq 0x158(%rsp), %rdi
callq 0x10620
leaq 0x1a8(%rsp), %rdi
callq 0xfc70
leaq 0x1c0(%rsp), %rdi
callq 0xfc70
leaq 0x1d8(%rsp), %rdi
callq 0x104c0
leaq 0x1f0(%rsp), %rdi
callq 0x21e40
addq $0x258, %rsp            # imm = 0x258
retq
leaq 0x130(%rsp), %rdi
callq 0xfa50
leaq 0x158(%rsp), %rdi
callq 0x10620
leaq 0x1a8(%rsp), %rdi
callq 0xfc70
leaq 0x1c0(%rsp), %rdi
callq 0xfc70
leaq 0x1d8(%rsp), %rdi
callq 0x104c0
leaq 0x1f0(%rsp), %rdi
callq 0x21e40
movq 0x150(%rsp), %rdi
callq 0x9cf0
nopw %cs:(%rax,%rax)