// File: /workspace/github_cpp_makefile_star2_O3/fjamour[P]icentral/src/unit_tests.h
// Function: timing__Update_BC_mem_graph(graph_t&, std::vector<std::pair<unsigned int, unsigned int>, std::allocator<std::pair<unsigned int, unsigned int>>>&, int, int, bool, double)
void timing__Update_BC_mem_graph(
            graph_t&        graph,
            vector<edge_t>& edge_vec,
            int             num_sources,
            int             algo_flag,
            bool            do_brandes = true,
            double          brandes_time = 0.0
        )
{
    timer           tm;
    vector<double>  BC_vec;
    vector<double>  tm_vec;
    vector<double>  speedup_vec;
    
    
    if(do_brandes) {
        tm.start();
        //fast_brandes_BC(graph, BC_vec);
        BC_vec = brandes_bc(graph);
        tm.stop();
        brandes_time = tm.interval();
    }
    
    
    
    vector<iter_info_t> iter_info_vec;
    component_t comp;
    comp.comp_type = GRAPH;
    comp.subgraph.fill_graph(graph);
    for (node_id_t s = 0; s < graph.size(); ++s) {
        iter_info_t iter_info;
        iter_info.init_all(graph.size());
        BBFS(iter_info, comp, s);
        iter_info_vec.push_back(iter_info);
    }
           
    printf("Graph[%s]  V[%d]  E[%d]  Brandes_tm[%.2f]\n",
            graph.graph_name.c_str(),
            graph.size(),
            graph.edge_set.size(),
            brandes_time);
    for(int i = 0; i < edge_vec.size(); ++i) {
        edge_t e = edge_vec[i];
        tm.start();
        Update_BC_mem(BC_vec, graph, GRAPH, e, iter_info_vec);
        tm.stop();
        double e_time = tm.interval();
        tm_vec.push_back(e_time);
        double e_speedup = brandes_time/e_time;
        speedup_vec.push_back(e_speedup);
        
        printf("e(%-6d,%-6d)  tm[%.2f]  sup[%.2f]\n",
                e.first,
                e.second,
                e_time,
                e_speedup);
    }
    
    double tm_mean, tm_stddev, tm_median, tm_min, tm_max;
    double su_mean, su_stddev, su_median, su_min, su_max;
    simple_stats(tm_vec, tm_mean, tm_stddev, tm_median, tm_min, tm_max);
    simple_stats(speedup_vec, su_mean, su_stddev, su_median, su_min, su_max);
    
    printf("Avg.tm[%.2f]  Avg.sup[%.2f]\n\n", tm_mean, su_mean);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x468, %rsp            # imm = 0x468
movsd %xmm0, 0x8(%rsp)
movq %rsi, %r14
movq %rdi, %r15
xorl %eax, %eax
movq %rax, 0x60(%rsp)
xorpd %xmm0, %xmm0
movapd %xmm0, 0x50(%rsp)
movq %rax, 0x40(%rsp)
movapd %xmm0, 0x30(%rsp)
movq %rax, 0x20(%rsp)
movapd %xmm0, 0x10(%rsp)
testl %r8d, %r8d
je 0x20f76
leaq 0xd8(%rsp), %rdi
xorl %esi, %esi
callq 0x2360
leaq 0x230(%rsp), %rdi
movq %r15, %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0xaa33
movq 0x50(%rsp), %rdi
movq 0x60(%rsp), %rsi
movaps 0x230(%rsp), %xmm0
movaps %xmm0, 0x50(%rsp)
movq 0x240(%rsp), %rax
movq %rax, 0x60(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x230(%rsp)
movq $0x0, 0x240(%rsp)
testq %rdi, %rdi
je 0x20f24
subq %rdi, %rsi
callq 0x2250
movq 0x230(%rsp), %rdi
testq %rdi, %rdi
je 0x20f24
movq 0x240(%rsp), %rsi
subq %rdi, %rsi
callq 0x2250
leaq 0xe8(%rsp), %rbx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x2360
xorps %xmm0, %xmm0
cvtsi2sdq -0x10(%rbx), %xmm0
cvtsi2sdq -0x8(%rbx), %xmm1
movsd 0xf253(%rip), %xmm2     # 0x301a0
divsd %xmm2, %xmm1
cvtsi2sdq (%rbx), %xmm3
cvtsi2sdq 0x8(%rbx), %xmm4
addsd %xmm0, %xmm1
divsd %xmm2, %xmm4
addsd %xmm3, %xmm4
subsd %xmm1, %xmm4
movsd %xmm4, 0x8(%rsp)
xorpd %xmm0, %xmm0
movapd %xmm0, 0x70(%rsp)
movq $0x0, 0x80(%rsp)
leaq 0x230(%rsp), %rdi
callq 0x6192
leaq 0x428(%rsp), %rdi
leaq 0x68(%rsp), %rax
leaq 0xd0(%rsp), %r10
leaq 0xc8(%rsp), %rdx
leaq 0x118(%rsp), %rcx
movq %rsp, %r8
leaq 0xc0(%rsp), %r9
movl $0xa, %esi
pushq %rax
pushq %r10
callq 0x6748
addq $0x10, %rsp
movq %r14, 0x88(%rsp)
leaq 0x230(%rsp), %rdi
movl $0x2, 0x228(%rdi)
movq %r15, %rsi
callq 0x2f2b8
xorl %ebx, %ebx
leaq 0x210(%rsp), %r14
leaq 0x118(%rsp), %r12
leaq 0x230(%rsp), %r13
leaq 0x70(%rsp), %rbp
movq %r15, %rdi
callq 0x1dfcc
movl %ebx, %ecx
cmpq %rcx, %rax
jbe 0x21092
movq $0x0, 0x200(%rsp)
movl $0x0, 0x208(%rsp)
movl $0xe4, %edx
movq %r12, %rdi
xorl %esi, %esi
callq 0x2110
xorpd %xmm0, %xmm0
movupd %xmm0, (%r14)
movupd %xmm0, 0x10(%r14)
movq %r15, %rdi
callq 0x1dfcc
movq %r12, %rdi
movq %rax, %rsi
callq 0x1f9ec
movq %r12, %rdi
movq %r13, %rsi
movl %ebx, %edx
callq 0x41ba
movq %rbp, %rdi
movq %r12, %rsi
callq 0x241d0
movq %r12, %rdi
callq 0x5c1a
incl %ebx
jmp 0x21017
movq 0x108(%r15), %rbx
movq %r15, %rdi
callq 0x1dfcc
movq 0x58(%r15), %rcx
leaq 0xfc23(%rip), %rdi      # 0x30ccf
movq %rbx, %rsi
movq %rax, %rdx
movsd 0x8(%rsp), %xmm0
movb $0x1, %al
callq 0x2030
movq 0x88(%rsp), %r14
movq (%r14), %rax
cmpq %rax, 0x8(%r14)
je 0x2121a
xorl %ebx, %ebx
leaq 0xfc1d(%rip), %r12      # 0x30cfa
movl (%rax,%rbx,8), %r13d
movl 0x4(%rax,%rbx,8), %ebp
leaq 0xd8(%rsp), %rdi
xorl %esi, %esi
callq 0x2360
movq %rbp, %rcx
shlq $0x20, %rcx
orq %r13, %rcx
leaq 0x50(%rsp), %rdi
movq %r15, %rsi
movl $0x2, %edx
leaq 0x70(%rsp), %r8
callq 0x7c3c
leaq 0xe8(%rsp), %rdi
xorl %esi, %esi
callq 0x2360
xorps %xmm1, %xmm1
cvtsi2sdq 0xd8(%rsp), %xmm1
xorps %xmm2, %xmm2
cvtsi2sdq 0xe0(%rsp), %xmm2
movsd 0xf05a(%rip), %xmm4     # 0x301a0
divsd %xmm4, %xmm2
cvtsi2sdq 0xe8(%rsp), %xmm3
xorps %xmm0, %xmm0
cvtsi2sdq 0xf0(%rsp), %xmm0
addsd %xmm1, %xmm2
divsd %xmm4, %xmm0
addsd %xmm3, %xmm0
subsd %xmm2, %xmm0
movsd %xmm0, 0x118(%rsp)
movq 0x38(%rsp), %rsi
cmpq 0x40(%rsp), %rsi
je 0x21195
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x38(%rsp)
jmp 0x211a7
leaq 0x30(%rsp), %rdi
leaq 0x118(%rsp), %rdx
callq 0x1b766
movsd 0x8(%rsp), %xmm0
divsd 0x118(%rsp), %xmm0
movsd %xmm0, (%rsp)
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x211d6
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x18(%rsp)
jmp 0x211e3
leaq 0x10(%rsp), %rdi
movq %rsp, %rdx
callq 0x1b766
movsd 0x118(%rsp), %xmm0
movsd (%rsp), %xmm1
movq %r12, %rdi
movl %r13d, %esi
movl %ebp, %edx
movb $0x2, %al
callq 0x2030
incq %rbx
movq (%r14), %rax
movq 0x8(%r14), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %rbx, %rcx
ja 0x210dd
leaq 0xa8(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x1b2b8
leaq 0xa8(%rsp), %rdi
leaq 0x118(%rsp), %rsi
movq %rsp, %rdx
leaq 0xd0(%rsp), %rcx
leaq 0xc8(%rsp), %r8
leaq 0xc0(%rsp), %r9
callq 0x2f758
movq 0xa8(%rsp), %rdi
testq %rdi, %rdi
je 0x21279
movq 0xb8(%rsp), %rsi
subq %rdi, %rsi
callq 0x2250
leaq 0x90(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x1b2b8
leaq 0x90(%rsp), %rdi
leaq 0x68(%rsp), %rsi
leaq 0x110(%rsp), %rdx
leaq 0x108(%rsp), %rcx
leaq 0x100(%rsp), %r8
leaq 0xf8(%rsp), %r9
callq 0x2f758
movq 0x90(%rsp), %rdi
testq %rdi, %rdi
je 0x212da
movq 0xa0(%rsp), %rsi
subq %rdi, %rsi
callq 0x2250
movsd 0x118(%rsp), %xmm0
movsd 0x68(%rsp), %xmm1
leaq 0xfa2d(%rip), %rdi      # 0x30d1d
movb $0x2, %al
callq 0x2030
leaq 0x428(%rsp), %rdi
callq 0x6858
leaq 0x230(%rsp), %rdi
callq 0x63d2
leaq 0x70(%rsp), %rdi
callq 0x24200
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x21332
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x2250
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x21349
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x2250
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x21360
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x2250
addq $0x468, %rsp            # imm = 0x468
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
jmp 0x21403
movq %rax, %r14
movq 0x90(%rsp), %rdi
testq %rdi, %rdi
je 0x213df
movq 0xa0(%rsp), %rsi
jmp 0x213ac
movq %rax, %r14
movq 0xa8(%rsp), %rdi
testq %rdi, %rdi
je 0x213df
movq 0xb8(%rsp), %rsi
subq %rdi, %rsi
callq 0x2250
jmp 0x213df
movq %rax, %r14
jmp 0x213ec
movq %rax, %r14
jmp 0x213f9
jmp 0x213ca
jmp 0x213ca
jmp 0x213ca
jmp 0x213ca
jmp 0x213ca
movq %rax, %r14
jmp 0x213df
movq %rax, %r14
leaq 0x118(%rsp), %rdi
callq 0x5c1a
leaq 0x428(%rsp), %rdi
callq 0x6858
leaq 0x230(%rsp), %rdi
callq 0x63d2
leaq 0x70(%rsp), %rdi
callq 0x24200
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x2141a
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x2250
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x21431
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x2250
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x21448
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x2250
movq %r14, %rdi
callq 0x23b0