// File: /workspace/github_cpp_makefile_star2_O2/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, (%rsp)
movq %rsi, %rbx
movq %rdi, %r14
xorpd %xmm0, %xmm0
movapd %xmm0, 0x70(%rsp)
andq $0x0, 0x80(%rsp)
movapd %xmm0, 0x50(%rsp)
andq $0x0, 0x60(%rsp)
movapd %xmm0, 0x30(%rsp)
andq $0x0, 0x40(%rsp)
testl %r8d, %r8d
je 0x1b007
leaq 0x100(%rsp), %rdi
callq 0xb094
leaq 0x238(%rsp), %rdi
pushq $-0x1
popq %rdx
movq %r14, %rsi
callq 0x8fa3
leaq 0x70(%rsp), %rdi
leaq 0x238(%rsp), %r15
movq %r15, %rsi
callq 0x1a0a8
movq %r15, %rdi
callq 0x5754
leaq 0x100(%rsp), %r15
movq %r15, %rdi
callq 0xb09c
movq %r15, %rdi
callq 0xb0a8
movsd %xmm0, (%rsp)
xorpd %xmm0, %xmm0
movapd %xmm0, 0x10(%rsp)
andq $0x0, 0x20(%rsp)
leaq 0x238(%rsp), %rdi
callq 0x4622
leaq 0x238(%rsp), %rdi
movl $0x2, 0x228(%rdi)
movq %r14, %rsi
callq 0x26858
xorl %ebp, %ebp
leaq 0x218(%rsp), %r12
leaq 0x120(%rsp), %r15
leaq 0x10(%rsp), %r13
movq %r14, %rdi
callq 0x18d3c
movl %ebp, %ecx
cmpq %rcx, %rax
jbe 0x1b0cd
andq $0x0, 0x208(%rsp)
andl $0x0, 0x210(%rsp)
movl $0xe4, %edx
movq %r15, %rdi
xorl %esi, %esi
callq 0x2110
xorpd %xmm0, %xmm0
movupd %xmm0, (%r12)
movupd %xmm0, 0x10(%r12)
movq %r14, %rdi
callq 0x18d3c
movq %r15, %rdi
movq %rax, %rsi
callq 0x1a0fc
movq %r15, %rdi
leaq 0x238(%rsp), %rsi
movl %ebp, %edx
callq 0x32e4
movq %r13, %rdi
movq %r15, %rsi
callq 0x1d364
movq %r15, %rdi
callq 0x4668
incl %ebp
jmp 0x1b051
movq 0x108(%r14), %r15
movq %r14, %rdi
callq 0x18d3c
movq 0x58(%r14), %rcx
leaq 0xdba8(%rip), %rdi      # 0x28c8f
movq %r15, %rsi
movq %rax, %rdx
movsd (%rsp), %xmm0
movb $0x1, %al
callq 0x2030
xorl %ebp, %ebp
leaq 0x100(%rsp), %r15
movq (%rbx), %rax
movq 0x8(%rbx), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %rbp, %rcx
jbe 0x1b1c3
movl (%rax,%rbp,8), %r13d
movl 0x4(%rax,%rbp,8), %r12d
movq %r15, %rdi
callq 0xb094
movq %r12, %rcx
shlq $0x20, %rcx
orq %r13, %rcx
leaq 0x70(%rsp), %rdi
movq %r14, %rsi
pushq $0x2
popq %rdx
leaq 0x10(%rsp), %r8
callq 0x6914
movq %r15, %rdi
callq 0xb09c
movq %r15, %rdi
callq 0xb0a8
movsd %xmm0, 0x120(%rsp)
leaq 0x50(%rsp), %rdi
leaq 0x120(%rsp), %rsi
callq 0x163a4
movsd (%rsp), %xmm0
divsd 0x120(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
leaq 0x30(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x163a4
movsd 0x120(%rsp), %xmm0
movsd 0x8(%rsp), %xmm1
leaq 0xdb0c(%rip), %rdi      # 0x28cba
movl %r13d, %esi
movl %r12d, %edx
movb $0x2, %al
callq 0x2030
incq %rbp
jmp 0x1b103
leaq 0xb0(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0x163c6
leaq 0xb0(%rsp), %rdi
leaq 0x120(%rsp), %rsi
leaq 0x8(%rsp), %rdx
leaq 0xf8(%rsp), %rcx
leaq 0xf0(%rsp), %r8
leaq 0xe8(%rsp), %r9
callq 0x26ad4
leaq 0xb0(%rsp), %rdi
callq 0x5754
leaq 0x98(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x163c6
leaq 0x98(%rsp), %rdi
leaq 0x90(%rsp), %rsi
leaq 0xe0(%rsp), %rdx
leaq 0xd8(%rsp), %rcx
leaq 0xd0(%rsp), %r8
leaq 0xc8(%rsp), %r9
callq 0x26ad4
leaq 0x98(%rsp), %rdi
callq 0x5754
movsd 0x120(%rsp), %xmm0
movsd 0x90(%rsp), %xmm1
leaq 0xda5c(%rip), %rdi      # 0x28cdd
movb $0x2, %al
callq 0x2030
leaq 0x238(%rsp), %rdi
callq 0x46de
leaq 0x10(%rsp), %rdi
callq 0x1d394
leaq 0x30(%rsp), %rdi
callq 0x5754
leaq 0x50(%rsp), %rdi
callq 0x5754
leaq 0x70(%rsp), %rdi
callq 0x5754
addq $0x468, %rsp            # imm = 0x468
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x1b32e
movq %rax, %rbx
leaq 0x98(%rsp), %rdi
jmp 0x1b2ec
movq %rax, %rbx
leaq 0xb0(%rsp), %rdi
callq 0x5754
jmp 0x1b317
movq %rax, %rbx
jmp 0x1b324
jmp 0x1b302
jmp 0x1b302
jmp 0x1b302
jmp 0x1b302
jmp 0x1b302
movq %rax, %rbx
jmp 0x1b317
movq %rax, %rbx
leaq 0x120(%rsp), %rdi
callq 0x4668
leaq 0x238(%rsp), %rdi
callq 0x46de
leaq 0x10(%rsp), %rdi
callq 0x1d394
leaq 0x30(%rsp), %rdi
callq 0x5754
leaq 0x50(%rsp), %rdi
callq 0x5754
leaq 0x70(%rsp), %rdi
callq 0x5754
movq %rbx, %rdi
callq 0x23d0