// File: /workspace/github_cpp_makefile_star2_O3/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, 0x5c(%rsp)
movsd %xmm0, 0x48(%rsp)
movl %r8d, %r12d
movl %ecx, 0x58(%rsp)
movq %rsi, %r14
movq %rdi, %r15
movq 0x1eb0f(%rip), %r13     # 0x3efc8
leaq 0xc(%rsp), %rsi
movq %r13, %rdi
callq 0x2300
leaq 0xfc(%rsp), %rsi
movq %r13, %rdi
callq 0x22a0
xorl %eax, %eax
movq %rax, 0x40(%rsp)
xorpd %xmm0, %xmm0
movapd %xmm0, 0x30(%rsp)
movq %rax, 0x90(%rsp)
movapd %xmm0, 0x80(%rsp)
movq %rax, 0x70(%rsp)
movapd %xmm0, 0x60(%rsp)
movq %r15, %rdi
callq 0x1dfcc
leaq 0x30(%rsp), %rdi
movq %rax, %rsi
callq 0x5be8
testb %r12b, %r12b
je 0x205e7
leaq 0xd8(%rsp), %rdi
xorl %esi, %esi
callq 0x2360
leaq 0x10(%rsp), %rdi
movq %r15, %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0xaa33
movq 0x30(%rsp), %rdi
movq 0x40(%rsp), %rsi
movaps 0x10(%rsp), %xmm0
movaps %xmm0, 0x30(%rsp)
movq 0x20(%rsp), %rax
movq %rax, 0x40(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
testq %rdi, %rdi
je 0x20595
subq %rdi, %rsi
callq 0x2250
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x20595
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x2250
leaq 0xe8(%rsp), %r12
movq %r12, %rdi
xorl %esi, %esi
callq 0x2360
xorps %xmm0, %xmm0
cvtsi2sdq -0x10(%r12), %xmm0
cvtsi2sdq -0x8(%r12), %xmm1
movsd 0xfbe0(%rip), %xmm2     # 0x301a0
divsd %xmm2, %xmm1
cvtsi2sdq (%r12), %xmm3
cvtsi2sdq 0x8(%r12), %xmm4
addsd %xmm0, %xmm1
divsd %xmm2, %xmm4
addsd %xmm3, %xmm4
subsd %xmm1, %xmm4
movsd %xmm4, 0x48(%rsp)
cmpl $0x0, 0xc(%rsp)
jne 0x2061b
movq 0x108(%r15), %r12
movq %r15, %rdi
callq 0x1dfcc
movq 0x58(%r15), %rcx
leaq 0x106c7(%rip), %rdi     # 0x30ccf
movq %r12, %rsi
movq %rax, %rdx
movsd 0x48(%rsp), %xmm0
movb $0x1, %al
callq 0x2030
movq (%r14), %rax
cmpq %rax, 0x8(%r14)
je 0x207b9
movb 0x170(%rsp), %bl
xorl %ebp, %ebp
movl (%rax,%rbp,8), %r13d
movl 0x4(%rax,%rbp,8), %r12d
testb %bl, %bl
je 0x2064c
movq %r15, %rdi
movl %r13d, %esi
movl %r12d, %edx
callq 0x1dd70
leaq 0xd8(%rsp), %rdi
xorl %esi, %esi
callq 0x2360
movq %r12, %rcx
shlq $0x20, %rcx
orq %r13, %rcx
leaq 0x30(%rsp), %rdi
movq %r15, %rsi
movl 0x58(%rsp), %edx
movl 0x5c(%rsp), %r8d
movl 0x178(%rsp), %r9d
callq 0x3496
leaq 0xe8(%rsp), %rdi
xorl %esi, %esi
callq 0x2360
xorps %xmm1, %xmm1
cvtsi2sdq 0xd8(%rsp), %xmm1
xorps %xmm2, %xmm2
cvtsi2sdq 0xe0(%rsp), %xmm2
movsd 0xfaec(%rip), %xmm4     # 0x301a0
divsd %xmm4, %xmm2
xorps %xmm3, %xmm3
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, 0x10(%rsp)
movq 0x88(%rsp), %rsi
cmpq 0x90(%rsp), %rsi
je 0x2070c
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x88(%rsp)
jmp 0x2071e
leaq 0x80(%rsp), %rdi
leaq 0x10(%rsp), %rdx
callq 0x1b766
movsd 0x48(%rsp), %xmm0
divsd 0x10(%rsp), %xmm0
movsd %xmm0, 0x50(%rsp)
movq 0x68(%rsp), %rsi
cmpq 0x70(%rsp), %rsi
je 0x2074b
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x68(%rsp)
jmp 0x2075a
leaq 0x60(%rsp), %rdi
leaq 0x50(%rsp), %rdx
callq 0x1b766
cmpl $0x0, 0xc(%rsp)
jne 0x20781
movsd 0x10(%rsp), %xmm0
movsd 0x50(%rsp), %xmm1
leaq 0x10586(%rip), %rdi     # 0x30cfa
movl %r13d, %esi
movl %r12d, %edx
movb $0x2, %al
callq 0x2030
testb %bl, %bl
je 0x20793
movq %r15, %rdi
movl %r13d, %esi
movl %r12d, %edx
callq 0x1dc86
movq 0x1e82e(%rip), %rdi     # 0x3efc8
callq 0x21a0
incq %rbp
movq (%r14), %rax
movq 0x8(%r14), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %rbp, %rcx
ja 0x20631
leaq 0xb8(%rsp), %rdi
leaq 0x80(%rsp), %rsi
callq 0x1b2b8
leaq 0xb8(%rsp), %rdi
leaq 0x10(%rsp), %rsi
leaq 0x50(%rsp), %rdx
leaq 0x130(%rsp), %rcx
leaq 0x128(%rsp), %r8
leaq 0x120(%rsp), %r9
callq 0x2f758
movq 0xb8(%rsp), %rdi
testq %rdi, %rdi
je 0x2081a
movq 0xc8(%rsp), %rsi
subq %rdi, %rsi
callq 0x2250
leaq 0xa0(%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0x1b2b8
leaq 0xa0(%rsp), %rdi
leaq 0xd0(%rsp), %rsi
leaq 0x118(%rsp), %rdx
leaq 0x110(%rsp), %rcx
leaq 0x108(%rsp), %r8
leaq 0x100(%rsp), %r9
callq 0x2f758
movq 0xa0(%rsp), %rdi
testq %rdi, %rdi
je 0x2087e
movq 0xb0(%rsp), %rsi
subq %rdi, %rsi
callq 0x2250
cmpl $0x0, 0xc(%rsp)
jne 0x208a2
movsd 0x10(%rsp), %xmm0
movsd 0xd0(%rsp), %xmm1
leaq 0x10482(%rip), %rdi     # 0x30d1d
movb $0x2, %al
callq 0x2030
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x208b9
movq 0x70(%rsp), %rsi
subq %rdi, %rsi
callq 0x2250
movq 0x80(%rsp), %rdi
testq %rdi, %rdi
je 0x208d6
movq 0x90(%rsp), %rsi
subq %rdi, %rsi
callq 0x2250
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x208ed
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x2250
addq $0x138, %rsp            # imm = 0x138
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x20945
movq %rax, %rbx
movq 0xa0(%rsp), %rdi
testq %rdi, %rdi
je 0x20948
movq 0xb0(%rsp), %rsi
jmp 0x20933
movq %rax, %rbx
movq 0xb8(%rsp), %rdi
testq %rdi, %rdi
je 0x20948
movq 0xc8(%rsp), %rsi
subq %rdi, %rsi
callq 0x2250
jmp 0x20948
jmp 0x20945
jmp 0x20945
jmp 0x20945
jmp 0x20945
movq %rax, %rbx
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x2095f
movq 0x70(%rsp), %rsi
subq %rdi, %rsi
callq 0x2250
movq 0x80(%rsp), %rdi
testq %rdi, %rdi
je 0x2097c
movq 0x90(%rsp), %rsi
subq %rdi, %rsi
callq 0x2250
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x20993
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x2250
movq %rbx, %rdi
callq 0x23b0