// File: /workspace/github_cpp_makefile_star2_O3/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 %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movsd %xmm0, 0x20(%rsp)
movl %esi, %ebp
movq %rdi, %rbx
leaq 0xb674(%rip), %rdi      # 0x30b40
callq 0x2350
movq 0x108(%rbx), %rsi
leaq 0xad71(%rip), %rdi      # 0x30250
xorl %eax, %eax
callq 0x2030
movq %rbx, %rdi
callq 0x1dfcc
leaq 0xad69(%rip), %rdi      # 0x3025e
movq %rax, %rsi
xorl %eax, %eax
callq 0x2030
movq 0x58(%rbx), %rsi
leaq 0xad69(%rip), %rdi      # 0x30273
xorl %eax, %eax
callq 0x2030
leaq 0xad70(%rip), %rdi      # 0x30288
xorl %eax, %eax
callq 0x2030
cmpl $-0x1, %ebp
je 0x255fb
leaq 0x58(%rsp), %rdi
xorl %esi, %esi
callq 0x2360
leaq 0x28(%rsp), %rdi
movq %rbx, %rsi
movl %ebp, %edx
callq 0xb162
leaq 0x68(%rsp), %r14
movq %r14, %rdi
xorl %esi, %esi
callq 0x2360
movq -0x10(%r14), %r15
movq -0x8(%r14), %r12
movq (%r14), %r13
movq 0x8(%r14), %r14
movq %rbx, %rdi
callq 0x1dfcc
cvtsi2sd %r14, %xmm0
movsd 0xac2a(%rip), %xmm1     # 0x301a0
divsd %xmm1, %xmm0
cvtsi2sd %r13, %xmm2
addsd %xmm0, %xmm2
xorps %xmm0, %xmm0
cvtsi2sd %r12, %xmm0
divsd %xmm1, %xmm0
xorps %xmm1, %xmm1
cvtsi2sd %r15, %xmm1
addsd %xmm0, %xmm1
movq %rax, %xmm0
punpckldq 0xac78(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0xac80(%rip), %xmm0     # 0x30230
subsd %xmm1, %xmm2
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
movsd %xmm2, 0x18(%rsp)
mulsd %xmm2, %xmm1
xorps %xmm0, %xmm0
cvtsi2sd %ebp, %xmm0
movsd %xmm0, 0x10(%rsp)
divsd %xmm0, %xmm1
movapd %xmm1, (%rsp)
leaq 0x28(%rsp), %rdi
callq 0xd912
movsd 0x20(%rsp), %xmm0
ucomisd (%rsp), %xmm0
jbe 0x256cc
leaq 0x58(%rsp), %rdi
xorl %esi, %esi
callq 0x2360
leaq 0x28(%rsp), %rdi
movq %rbx, %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0xb162
leaq 0x68(%rsp), %r14
movq %r14, %rdi
xorl %esi, %esi
callq 0x2360
cvtsi2sdq -0x10(%r14), %xmm4
xorps %xmm1, %xmm1
cvtsi2sdq -0x8(%r14), %xmm1
movsd 0xab61(%rip), %xmm2     # 0x301a0
divsd %xmm2, %xmm1
cvtsi2sdq (%r14), %xmm3
xorps %xmm0, %xmm0
cvtsi2sdq 0x8(%r14), %xmm0
addsd %xmm4, %xmm1
divsd %xmm2, %xmm0
addsd %xmm3, %xmm0
subsd %xmm1, %xmm0
leaq 0xadf2(%rip), %rdi      # 0x3045a
movapd %xmm0, (%rsp)
movb $0x1, %al
callq 0x2030
movq %rbx, %rdi
callq 0x1dfcc
movq %rax, %xmm0
punpckldq 0xab97(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0xab9f(%rip), %xmm0     # 0x30230
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
movapd (%rsp), %xmm0
divsd %xmm1, %xmm0
leaq 0xacac(%rip), %rdi      # 0x30359
movb $0x1, %al
callq 0x2030
leaq 0xbb85(%rip), %rdi      # 0x31240
callq 0x2350
leaq 0x28(%rsp), %rdi
callq 0xd912
jmp 0x25708
leaq 0xad87(%rip), %rdi      # 0x3045a
movaps (%rsp), %xmm0
movb $0x1, %al
callq 0x2030
movsd 0x18(%rsp), %xmm0
divsd 0x10(%rsp), %xmm0
leaq 0xac68(%rip), %rdi      # 0x30359
movb $0x1, %al
callq 0x2030
leaq 0xba35(%rip), %rdi      # 0x31134
movl %ebp, %esi
xorl %eax, %eax
callq 0x2030
movaps (%rsp), %xmm0
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2571d
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0xd912
movq %rbx, %rdi
callq 0x23b0