// File: /workspace/github_cpp_makefile_star2_O3/fjamour[P]icentral/src/bc.cc
// Function: naive_betweenness_centrality(graph_t&)
vector<double> naive_betweenness_centrality(graph_t& graph_in)
{
    vector<double> bc_vec;
    bc_vec.resize(graph_in.size());
    
    /*1. find all-pair shortest paths and store in a n^2 array*/
    /*2. find all-pair shortest paths count and store in a x^2 array*/
    /*3. do the three nested loops to find BC of each node*/
    
    vector<vector<int> > dst_2vec;      //all-pair distance array
    vector<vector<int> > cnt_2vec;      //all-pair shortest path count array
    dst_2vec.resize(graph_in.size());
    cnt_2vec.resize(graph_in.size());
    
    vector<int> tmp_vec;
    tmp_vec.resize(graph_in.size());
    
 
    /*Floyd-Warshall to compute all-pair shortest paths*/
    /*init distance with (infinity)*/
    fill(tmp_vec.begin(), tmp_vec.end(), INF);
    fill(dst_2vec.begin(), dst_2vec.end(), tmp_vec);
    /*update distance for immediate neighbors*/
    for(node_id_t i = 0; i < graph_in.size(); i++) {
        dst_2vec[i][i] = 0;
        for(int j = 0; j < graph_in.get_nbrs(i).size(); j++) {
            node_id_t nbr_id = graph_in.get_nbrs(i)[j];
            dst_2vec[i][nbr_id] = 1;
        }
    }
    for(int k = 0; k < graph_in.size(); ++k) {
        for(int i = 0; i < dst_2vec.size(); ++i) {
            for(int j = 0; j < dst_2vec.size(); ++j) {
                if(dst_2vec[i][j] > dst_2vec[i][k] + dst_2vec[k][j]) {
                    dst_2vec[i][j] = dst_2vec[i][k] + dst_2vec[k][j];
                }
            }
        }
    }
    
    /*Floyd-Warshall like algorithm to compute all-pair shortest paths counts*/
    /*init counts with 0*/
    fill(tmp_vec.begin(), tmp_vec.end(), 0);
    fill(cnt_2vec.begin(), cnt_2vec.end(), tmp_vec);
    /*update counts for immediate neighbors*/
    for(node_id_t i = 0; i < graph_in.size(); i++) {
        cnt_2vec[i][i] = 0;
        for(int j = 0; j < graph_in.get_nbrs(i).size(); j++) {
            node_id_t nbr_id = graph_in.get_nbrs(i)[j];
            cnt_2vec[i][nbr_id] = 1;
        }
    }
    for(int k = 0; k < graph_in.size(); ++k) {
        for(int i = 0; i < cnt_2vec.size(); ++i) {
            for(int j = 0; j < cnt_2vec.size(); ++j) {
                if(dst_2vec[i][j] == dst_2vec[i][k] + dst_2vec[k][j]) {
                    cnt_2vec[i][j] += cnt_2vec[i][k] * cnt_2vec[k][j];
                }
            }
        }
    }
    /*betweenness centrality computation*/
    for(node_id_t s = 0; s < graph_in.size(); ++s) {
        for(node_id_t t = 0; t < graph_in.size(); ++t) {
            for(node_id_t v = 0; v < bc_vec.size(); ++v) {
                if(s != v && v != t && s != t) {
                    if(dst_2vec[s][t] == dst_2vec[s][v] + dst_2vec[v][t]) {
                        bc_vec[v] += (cnt_2vec[s][v]*cnt_2vec[v][t]/(double)cnt_2vec[s][t]);
                    }
                }
            }
        }
    }
    
    for(node_id_t i = 0; i < bc_vec.size(); ++i) {
        bc_vec[i] = bc_vec[i]/2;
    }     
    return bc_vec;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rsi, %r14
movq %rdi, %rbx
pxor %xmm0, %xmm0
movdqu %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
movq %rsi, %rdi
callq 0x1dfcc
movq %rbx, %rdi
movq %rax, %rsi
callq 0x5be8
pxor %xmm0, %xmm0
movdqa %xmm0, 0x20(%rsp)
xorl %eax, %eax
movq %rax, 0x30(%rsp)
movq %rax, 0x50(%rsp)
movdqa %xmm0, 0x40(%rsp)
movq %r14, %rdi
callq 0x1dfcc
leaq 0x20(%rsp), %rdi
movq %rax, %rsi
callq 0xd80c
movq %r14, %rdi
callq 0x1dfcc
leaq 0x40(%rsp), %rdi
movq %rax, %rsi
callq 0xd80c
pxor %xmm0, %xmm0
movdqa %xmm0, (%rsp)
movq $0x0, 0x10(%rsp)
movq %r14, %rdi
callq 0x1dfcc
movq %rsp, %rdi
movq %rax, %rsi
callq 0xd848
movq (%rsp), %rax
movq 0x8(%rsp), %rcx
cmpq %rcx, %rax
je 0x9f1a
subq %rax, %rcx
addq $-0x4, %rcx
movq %rcx, %xmm0
shrq $0x2, %rcx
addq $0x4, %rcx
andq $-0x4, %rcx
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
psrlq $0x2, %xmm0
xorl %edx, %edx
movdqa 0x2632c(%rip), %xmm1    # 0x30170
movdqa 0x26334(%rip), %xmm2    # 0x30180
movdqa 0x2633c(%rip), %xmm3    # 0x30190
pxor %xmm3, %xmm0
pcmpeqd %xmm4, %xmm4
movq %rdx, %xmm5
pshufd $0x44, %xmm5, %xmm5     # xmm5 = xmm5[0,1,0,1]
movdqa %xmm5, %xmm6
por %xmm2, %xmm6
pxor %xmm3, %xmm6
movdqa %xmm6, %xmm7
pcmpgtd %xmm0, %xmm7
pcmpeqd %xmm0, %xmm6
pshufd $0xf5, %xmm6, %xmm8     # xmm8 = xmm6[1,1,3,3]
pand %xmm7, %xmm8
pshufd $0xf5, %xmm7, %xmm6     # xmm6 = xmm7[1,1,3,3]
por %xmm8, %xmm6
movd %xmm6, %esi
notl %esi
testb $0x1, %sil
je 0x9ea6
movl $0x5f5e100, (%rax,%rdx,4) # imm = 0x5F5E100
pxor %xmm4, %xmm6
pextrw $0x4, %xmm6, %esi
testb $0x1, %sil
je 0x9ebd
movl $0x5f5e100, 0x4(%rax,%rdx,4) # imm = 0x5F5E100
por %xmm1, %xmm5
pxor %xmm3, %xmm5
movdqa %xmm5, %xmm6
pcmpgtd %xmm0, %xmm6
pcmpeqd %xmm0, %xmm5
pshufd $0xf5, %xmm5, %xmm7     # xmm7 = xmm5[1,1,3,3]
pand %xmm6, %xmm7
pshufd $0xf5, %xmm6, %xmm5     # xmm5 = xmm6[1,1,3,3]
por %xmm7, %xmm5
pxor %xmm4, %xmm5
pextrw $0x0, %xmm5, %esi
testb $0x1, %sil
je 0x9efa
movl $0x5f5e100, 0x8(%rax,%rdx,4) # imm = 0x5F5E100
pextrw $0x4, %xmm5, %esi
testb $0x1, %sil
je 0x9f0d
movl $0x5f5e100, 0xc(%rax,%rdx,4) # imm = 0x5F5E100
addq $0x4, %rdx
cmpq %rdx, %rcx
jne 0x9e5c
movq 0x20(%rsp), %r15
movq 0x28(%rsp), %r13
cmpq %r13, %r15
je 0x9f40
movq %rsp, %r12
movq %r15, %rdi
movq %r12, %rsi
callq 0x8c34
addq $0x18, %r15
cmpq %r13, %r15
jne 0x9f2c
xorl %r15d, %r15d
movq %r14, %rdi
callq 0x1dfcc
movl %r15d, %r15d
cmpq %r15, %rax
jbe 0x9fb2
movq 0x20(%rsp), %rax
leaq (%r15,%r15,2), %r12
movq (%rax,%r12,8), %rax
movl $0x0, (%rax,%r15,4)
xorl %r13d, %r13d
movq %r14, %rdi
movl %r15d, %esi
callq 0x1dc78
movq 0x8(%rax), %rcx
subq (%rax), %rcx
sarq $0x2, %rcx
cmpq %r13, %rcx
jbe 0x9fad
movq %r14, %rdi
movl %r15d, %esi
callq 0x1dc78
movq (%rax), %rax
movl (%rax,%r13,4), %eax
movq 0x20(%rsp), %rcx
movq (%rcx,%r12,8), %rcx
movl $0x1, (%rcx,%rax,4)
incq %r13
jmp 0x9f6b
incl %r15d
jmp 0x9f43
xorl %r15d, %r15d
movabsq $-0x5555555555555555, %r13 # imm = 0xAAAAAAAAAAAAAAAB
movq %r14, %rdi
callq 0x1dfcc
cmpq %r15, %rax
jbe 0xa027
movq 0x20(%rsp), %rax
movq 0x28(%rsp), %rcx
subq %rax, %rcx
je 0xa022
sarq $0x3, %rcx
imulq %r13, %rcx
leaq (%r15,%r15,2), %rdx
movq (%rax,%rdx,8), %rdx
cmpq $0x1, %rcx
adcq $0x0, %rcx
xorl %esi, %esi
leaq (%rsi,%rsi,2), %rdi
movq (%rax,%rdi,8), %rdi
xorl %r8d, %r8d
movl (%rdx,%r8,4), %r9d
addl (%rdi,%r15,4), %r9d
cmpl %r9d, (%rdi,%r8,4)
jle 0xa012
movl %r9d, (%rdi,%r8,4)
incq %r8
cmpq %r8, %rcx
jne 0xa000
incq %rsi
cmpq %rcx, %rsi
jne 0x9ff5
incq %r15
jmp 0x9fbf
movq (%rsp), %rdi
movq 0x8(%rsp), %rdx
cmpq %rdx, %rdi
je 0xa04b
subq %rdi, %rdx
addq $-0x4, %rdx
andq $-0x4, %rdx
addq $0x4, %rdx
xorl %esi, %esi
callq 0x2110
movq 0x40(%rsp), %r15
movq 0x48(%rsp), %rbp
cmpq %rbp, %r15
je 0xa071
movq %rsp, %r12
movq %r15, %rdi
movq %r12, %rsi
callq 0x8c34
addq $0x18, %r15
cmpq %rbp, %r15
jne 0xa05d
xorl %r15d, %r15d
movq %r14, %rdi
callq 0x1dfcc
movl %r15d, %r15d
cmpq %r15, %rax
jbe 0xa0e1
movq 0x40(%rsp), %rax
leaq (%r15,%r15,2), %r12
movq (%rax,%r12,8), %rax
movl $0x0, (%rax,%r15,4)
xorl %ebp, %ebp
movq %r14, %rdi
movl %r15d, %esi
callq 0x1dc78
movq 0x8(%rax), %rcx
subq (%rax), %rcx
sarq $0x2, %rcx
cmpq %rbp, %rcx
jbe 0xa0dc
movq %r14, %rdi
movl %r15d, %esi
callq 0x1dc78
movq (%rax), %rax
movl (%rax,%rbp,4), %eax
movq 0x40(%rsp), %rcx
movq (%rcx,%r12,8), %rcx
movl $0x1, (%rcx,%rax,4)
incq %rbp
jmp 0xa09b
incl %r15d
jmp 0xa074
xorl %r15d, %r15d
movq %r14, %rdi
callq 0x1dfcc
cmpq %r15, %rax
jbe 0xa17f
movq 0x40(%rsp), %rax
movq 0x48(%rsp), %rcx
subq %rax, %rcx
je 0xa177
sarq $0x3, %rcx
imulq %r13, %rcx
movq 0x20(%rsp), %rdx
leaq (,%r15,8), %rsi
leaq (%rsi,%rsi,2), %rsi
movq (%rdx,%rsi), %rdi
addq %rax, %rsi
cmpq $0x1, %rcx
adcq $0x0, %rcx
xorl %r8d, %r8d
leaq (,%r8,8), %r9
leaq (%r9,%r9,2), %r9
movq (%rdx,%r9), %r10
addq %rax, %r9
xorl %r11d, %r11d
movl (%rdi,%r11,4), %ebp
addl (%r10,%r15,4), %ebp
cmpl %ebp, (%r10,%r11,4)
jne 0xa167
movq (%r9), %r12
movq (%rsi), %rbp
movl (%rbp,%r11,4), %ebp
imull (%r12,%r15,4), %ebp
addl %ebp, (%r12,%r11,4)
incq %r11
cmpq %r11, %rcx
jne 0xa145
incq %r8
cmpq %rcx, %r8
jne 0xa12f
incq %r15
jmp 0xa0e4
xorl %r15d, %r15d
movq %rbx, 0x60(%rsp)
movq %r14, 0x70(%rsp)
movq %r14, %rdi
callq 0x1dfcc
movl %r15d, %r12d
cmpq %r12, %rax
jbe 0xa280
leaq (,%r12,8), %rax
leaq (%rax,%rax,2), %rax
movq %rax, 0x68(%rsp)
xorl %ebp, %ebp
movq %r14, %rdi
callq 0x1dfcc
movl %ebp, %ecx
cmpq %rcx, %rax
movq 0x60(%rsp), %rbx
jbe 0xa278
movq (%rbx), %rax
movq 0x8(%rbx), %rdx
subq %rax, %rdx
je 0xa26b
sarq $0x3, %rdx
movq 0x20(%rsp), %rsi
movq 0x68(%rsp), %r9
leaq (%rsi,%r9), %rdi
movq 0x40(%rsp), %r8
addq %r8, %r9
xorl %r10d, %r10d
xorl %r11d, %r11d
cmpl %ecx, %r12d
sete %bl
cmpl %r11d, %r15d
sete %r14b
cmpl %r11d, %ebp
sete %r13b
orb %r14b, %r13b
orb %bl, %r13b
jne 0xa25c
movq (%rdi), %rbx
movq (%rsi,%r10), %r14
movl (%r14,%rcx,4), %r14d
addl (%rbx,%r11,4), %r14d
cmpl %r14d, (%rbx,%rcx,4)
jne 0xa25c
movq (%r9), %rbx
movq (%r8,%r10), %r14
movl (%r14,%rcx,4), %r14d
imull (%rbx,%r11,4), %r14d
xorps %xmm0, %xmm0
cvtsi2sd %r14d, %xmm0
xorps %xmm1, %xmm1
cvtsi2sdl (%rbx,%rcx,4), %xmm1
divsd %xmm1, %xmm0
addsd (%rax,%r11,8), %xmm0
movsd %xmm0, (%rax,%r11,8)
incq %r11
movl %r11d, %ebx
addq $0x18, %r10
cmpq %rbx, %rdx
ja 0xa1fb
incq %rbp
movq 0x70(%rsp), %r14
jmp 0xa1b3
incq %r15
jmp 0xa18c
movq (%rbx), %rax
movq 0x8(%rbx), %rcx
subq %rax, %rcx
je 0xa2b2
sarq $0x3, %rcx
xorl %edx, %edx
movsd 0x25d9e(%rip), %xmm0    # 0x30038
movsd (%rax,%rdx,8), %xmm1
mulsd %xmm0, %xmm1
movsd %xmm1, (%rax,%rdx,8)
incq %rdx
movl %edx, %esi
cmpq %rsi, %rcx
ja 0xa29a
movq (%rsp), %rdi
testq %rdi, %rdi
je 0xa2c8
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x2250
leaq 0x40(%rsp), %rdi
callq 0xd87a
leaq 0x20(%rsp), %rdi
callq 0xd87a
movq %rbx, %rax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xa318
movq %rax, %r14
jmp 0xa345
movq %rax, %r14
jmp 0xa331
jmp 0xa318
jmp 0xa318
jmp 0xa318
jmp 0xa318
jmp 0xa318
jmp 0xa318
jmp 0xa318
jmp 0xa318
jmp 0xa318
movq %rax, %r14
movq 0x60(%rsp), %rbx
jmp 0xa31b
jmp 0xa318
movq %rax, %r14
movq (%rsp), %rdi
testq %rdi, %rdi
je 0xa331
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x2250
leaq 0x40(%rsp), %rdi
callq 0xd87a
leaq 0x20(%rsp), %rdi
callq 0xd87a
movq (%rbx), %rdi
testq %rdi, %rdi
je 0xa359
movq 0x10(%rbx), %rsi
subq %rdi, %rsi
callq 0x2250
movq %r14, %rdi
callq 0x23b0