// File: /workspace/github_cpp_makefile_star2_O2/fjamour[P]icentral/src/paper_exp.cc
// Function: exp_brandes_p(graph_t&, int, std::vector<std::pair<unsigned int, unsigned int>, std::allocator<std::pair<unsigned int, unsigned int>>>, double)
double  exp_brandes_p(graph_t& graph,
            int num_iter,
            vector<edge_t> rand_edge_vec,
            double time_to_run_all_iter)
{
    printf("==========================================================\n");
    printf("Graph: \t\t\t%s\n", graph.graph_name.c_str());
    printf("Graph # nodes: \t\t%d\n", graph.size());
    printf("Graph # edges: \t\t%d\n", graph.edge_set.size());
    
    double  brandes_time;
    bool    do_all_iter = false;
    timer   tm;
    
    printf("Brandes runtime: \t");
    if(num_iter != -1) {
        tm.start();
        tr1_map_t(double) bc_vec = brandes_bc_hash_out(graph, num_iter);
        tm.stop();
        brandes_time = (tm.interval()*graph.size()/num_iter);
        if(brandes_time < time_to_run_all_iter) {
            do_all_iter = true;
        }
    } else {
        do_all_iter = true;
    }

    if(do_all_iter) {
        num_iter = -1;
        tm.start();
        tr1_map_t(double) bc_vec = brandes_bc_hash_out(graph, num_iter);
        tm.stop();
        brandes_time = tm.interval();
        printf("%f\n", brandes_time);
        printf("Brandes avg iter time: \t%f\n", tm.interval()/graph.size());
        printf("DID ALL ITERATIONS...\n");
    } else {
        printf("%f\n", brandes_time);
        printf("Brandes avg iter time: \t%f\n", tm.interval()/num_iter);
        printf("DID %d ITERATIONS...\n", num_iter);
    }
    
    return brandes_time;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x70, %rsp
movsd %xmm0, 0x10(%rsp)
movl %esi, %ebp
movq %rdi, %rbx
leaq 0xa556(%rip), %rdi      # 0x28b00
callq 0x2360
movq 0x108(%rbx), %rsi
leaq 0x9c53(%rip), %rdi      # 0x28210
xorl %eax, %eax
callq 0x2030
movq %rbx, %rdi
callq 0x18d3c
leaq 0x9c4b(%rip), %rdi      # 0x2821e
movq %rax, %rsi
xorl %eax, %eax
callq 0x2030
movq 0x58(%rbx), %rsi
leaq 0x9c4b(%rip), %rdi      # 0x28233
xorl %eax, %eax
callq 0x2030
leaq 0x9c52(%rip), %rdi      # 0x28248
xorl %eax, %eax
callq 0x2030
cmpl $-0x1, %ebp
je 0x1e69f
leaq 0x50(%rsp), %r14
movq %r14, %rdi
callq 0xb094
leaq 0x20(%rsp), %rdi
movq %rbx, %rsi
movl %ebp, %edx
callq 0x946d
movq %r14, %rdi
callq 0xb09c
movq %r14, %rdi
callq 0xb0a8
movsd %xmm0, 0x8(%rsp)
movq %rbx, %rdi
callq 0x18d3c
movq %rax, %xmm0
punpckldq 0x9ba3(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x9bab(%rip), %xmm0     # 0x28200
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
movsd 0x8(%rsp), %xmm2
mulsd %xmm1, %xmm2
cvtsi2sd %ebp, %xmm0
movsd %xmm0, 0x18(%rsp)
divsd %xmm0, %xmm2
movsd %xmm2, 0x8(%rsp)
leaq 0x20(%rsp), %rdi
callq 0xb070
movsd 0x10(%rsp), %xmm0
movsd 0x8(%rsp), %xmm1
ucomisd %xmm1, %xmm0
jbe 0x1e747
leaq 0x50(%rsp), %r14
movq %r14, %rdi
callq 0xb094
leaq 0x20(%rsp), %rdi
pushq $-0x1
popq %rdx
movq %rbx, %rsi
callq 0x946d
movq %r14, %rdi
callq 0xb09c
movq %r14, %rdi
callq 0xb0a8
leaq 0x9d47(%rip), %rdi      # 0x2841a
movsd %xmm0, 0x8(%rsp)
movb $0x1, %al
callq 0x2030
movq %r14, %rdi
callq 0xb0a8
movsd %xmm0, 0x10(%rsp)
movq %rbx, %rdi
callq 0x18d3c
movq %rax, %xmm0
punpckldq 0x9aed(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x9af5(%rip), %xmm0     # 0x28200
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
movsd 0x10(%rsp), %xmm0
divsd %xmm1, %xmm0
leaq 0x9bf1(%rip), %rdi      # 0x28319
movb $0x1, %al
callq 0x2030
leaq 0xaaca(%rip), %rdi      # 0x29200
callq 0x2360
leaq 0x20(%rsp), %rdi
callq 0xb070
jmp 0x1e787
movapd %xmm1, %xmm0
leaq 0x9cc8(%rip), %rdi      # 0x2841a
movb $0x1, %al
callq 0x2030
leaq 0x50(%rsp), %rdi
callq 0xb0a8
divsd 0x18(%rsp), %xmm0
leaq 0x9ba9(%rip), %rdi      # 0x28319
movb $0x1, %al
callq 0x2030
leaq 0xa976(%rip), %rdi      # 0x290f4
movl %ebp, %esi
xorl %eax, %eax
callq 0x2030
movsd 0x8(%rsp), %xmm0
addq $0x70, %rsp
popq %rbx
popq %r14
popq %rbp
retq
jmp 0x1e798
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0xb070
movq %rbx, %rdi
callq 0x23d0