// File: /workspace/github_cpp_makefile_star2_O2/fjamour[P]icentral/src/unit_tests.h
// Function: timing__Update_BC_graph(graph_t&, std::vector<std::pair<unsigned int, unsigned int>, std::allocator<std::pair<unsigned int, unsigned int>>>&, int, comp_type_t, bool, double, int, bool, operation_t)
void timing__Update_BC_graph(
            graph_t&        graph,
            vector<edge_t>& edge_vec,
            int             num_sources,
            comp_type_t     algo_flag,
            bool            do_brandes = true,
            double          brandes_time = 0.0,
            int             num_threads = 1,
            bool            del_edge = false,//in case the edges are already in the graph
            operation_t     op = INSERTION
        )
{
    int rank, size;
    MPI_Comm_rank(MPI_COMM_WORLD, &rank);
    MPI_Comm_size(MPI_COMM_WORLD, &size);
    MPI_Status    status;
    
    timer           tm;
    vector<double>  BC_vec;
    vector<double>  tm_vec;
    vector<double>  speedup_vec;
    
    BC_vec.resize(graph.size());
    if(do_brandes) {
        tm.start();
        //fast_brandes_BC(graph, BC_vec);
        BC_vec = brandes_bc(graph);
        tm.stop();
        brandes_time = tm.interval();
    }
    if(rank == 0) {
        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];
        if(del_edge) graph.remove_edge(e.first, e.second);
        tm.start();
        Update_BC(BC_vec, graph, algo_flag, e, num_threads, op);
        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);
        
        if(rank == 0) {
            printf("e(%-6d,%-6d)  tm[%.2f]  sup[%.2f]\n",
                    e.first,
                    e.second,
                    e_time,
                    e_speedup);
        }
        if(del_edge) graph.insert_edge(e.first, e.second);
        //synchronization barrier so no one starts next edge before others
        MPI_Barrier(MPI_COMM_WORLD);
    }
    
    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);
    
    if(rank == 0)
        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 $0x138, %rsp            # imm = 0x138
movl %r9d, 0x24(%rsp)
movsd %xmm0, 0x10(%rsp)
movl %r8d, %ebx
movl %ecx, 0x20(%rsp)
movq %rsi, %r14
movq %rdi, %r15
movq 0x1e6e6(%rip), %r12     # 0x38fc8
leaq 0xc(%rsp), %rsi
movq %r12, %rdi
callq 0x2310
leaq 0xac(%rsp), %rsi
movq %r12, %rdi
callq 0x22a0
xorpd %xmm0, %xmm0
movapd %xmm0, 0x40(%rsp)
andq $0x0, 0x50(%rsp)
movapd %xmm0, 0x80(%rsp)
andq $0x0, 0x90(%rsp)
movapd %xmm0, 0x60(%rsp)
andq $0x0, 0x70(%rsp)
movq %r15, %rdi
callq 0x18d3c
leaq 0x40(%rsp), %rdi
movq %rax, %rsi
callq 0x45f0
testb %bl, %bl
je 0x1a99b
leaq 0x118(%rsp), %rdi
callq 0xb094
leaq 0x28(%rsp), %rdi
pushq $-0x1
popq %rdx
movq %r15, %rsi
callq 0x8fa3
leaq 0x40(%rsp), %rdi
leaq 0x28(%rsp), %rbx
movq %rbx, %rsi
callq 0x1a0a8
movq %rbx, %rdi
callq 0x5754
leaq 0x118(%rsp), %rbx
movq %rbx, %rdi
callq 0xb09c
movq %rbx, %rdi
callq 0xb0a8
movsd %xmm0, 0x10(%rsp)
cmpl $0x0, 0xc(%rsp)
jne 0x1a9cf
movq 0x108(%r15), %rbx
movq %r15, %rdi
callq 0x18d3c
movq 0x58(%r15), %rcx
leaq 0xe2d3(%rip), %rdi      # 0x28c8f
movq %rbx, %rsi
movq %rax, %rdx
movsd 0x10(%rsp), %xmm0
movb $0x1, %al
callq 0x2030
xorl %ebp, %ebp
leaq 0x118(%rsp), %r13
movq (%r14), %rax
movq 0x8(%r14), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %rbp, %rcx
jbe 0x1aad9
movl (%rax,%rbp,8), %r12d
movl 0x4(%rax,%rbp,8), %ebx
cmpb $0x0, 0x170(%rsp)
je 0x1aa0f
movq %r15, %rdi
movl %r12d, %esi
movl %ebx, %edx
callq 0x18bfe
movq %r13, %rdi
callq 0xb094
movq %rbx, %rcx
shlq $0x20, %rcx
orq %r12, %rcx
leaq 0x40(%rsp), %rdi
movq %r15, %rsi
movl 0x20(%rsp), %edx
movl 0x24(%rsp), %r8d
movl 0x178(%rsp), %r9d
callq 0x2888
movq %r13, %rdi
callq 0xb09c
movq %r13, %rdi
callq 0xb0a8
movsd %xmm0, 0x28(%rsp)
leaq 0x80(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0x163a4
movsd 0x10(%rsp), %xmm0
divsd 0x28(%rsp), %xmm0
movsd %xmm0, 0x18(%rsp)
leaq 0x60(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0x163a4
cmpl $0x0, 0xc(%rsp)
jne 0x1aaae
movsd 0x28(%rsp), %xmm0
movsd 0x18(%rsp), %xmm1
leaq 0xe218(%rip), %rdi      # 0x28cba
movl %r12d, %esi
movl %ebx, %edx
movb $0x2, %al
callq 0x2030
cmpb $0x0, 0x170(%rsp)
je 0x1aac5
movq %r15, %rdi
movl %r12d, %esi
movl %ebx, %edx
callq 0x18b56
movq 0x1e4fc(%rip), %rdi     # 0x38fc8
callq 0x21a0
incq %rbp
jmp 0x1a9d9
leaq 0xc8(%rsp), %rdi
leaq 0x80(%rsp), %rsi
callq 0x163c6
leaq 0xc8(%rsp), %rdi
leaq 0x28(%rsp), %rsi
leaq 0x18(%rsp), %rdx
leaq 0x110(%rsp), %rcx
leaq 0x108(%rsp), %r8
leaq 0x100(%rsp), %r9
callq 0x26ad4
leaq 0xc8(%rsp), %rdi
callq 0x5754
leaq 0xb0(%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0x163c6
leaq 0xb0(%rsp), %rdi
leaq 0xa0(%rsp), %rsi
leaq 0xf8(%rsp), %rdx
leaq 0xf0(%rsp), %rcx
leaq 0xe8(%rsp), %r8
leaq 0xe0(%rsp), %r9
callq 0x26ad4
leaq 0xb0(%rsp), %rdi
callq 0x5754
cmpl $0x0, 0xc(%rsp)
jne 0x1aba2
movsd 0x28(%rsp), %xmm0
movsd 0xa0(%rsp), %xmm1
leaq 0xe142(%rip), %rdi      # 0x28cdd
movb $0x2, %al
callq 0x2030
leaq 0x60(%rsp), %rdi
callq 0x5754
leaq 0x80(%rsp), %rdi
callq 0x5754
leaq 0x40(%rsp), %rdi
callq 0x5754
addq $0x138, %rsp            # imm = 0x138
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1abfe
movq %rax, %rbx
leaq 0xb0(%rsp), %rdi
jmp 0x1abef
movq %rax, %rbx
leaq 0xc8(%rsp), %rdi
callq 0x5754
jmp 0x1ac01
jmp 0x1abfe
jmp 0x1abfe
jmp 0x1abfe
jmp 0x1abfe
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x5754
leaq 0x80(%rsp), %rdi
callq 0x5754
leaq 0x40(%rsp), %rdi
callq 0x5754
movq %rbx, %rdi
callq 0x23d0