// File: /workspace/github_cpp_makefile_star2_O1/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 0xc49c(%rip), %rdi      # 0x31b40
callq 0x2350
movq 0x108(%rbx), %rsi
leaq 0xbb99(%rip), %rdi      # 0x31250
xorl %eax, %eax
callq 0x2030
movq %rbx, %rdi
callq 0x1e160
leaq 0xbb91(%rip), %rdi      # 0x3125e
movq %rax, %rsi
xorl %eax, %eax
callq 0x2030
movq 0x58(%rbx), %rsi
leaq 0xbb91(%rip), %rdi      # 0x31273
xorl %eax, %eax
callq 0x2030
leaq 0xbb98(%rip), %rdi      # 0x31288
xorl %eax, %eax
callq 0x2030
xorps %xmm0, %xmm0
cvtsi2sd %ebp, %xmm0
movsd %xmm0, 0x8(%rsp)
cmpl $-0x1, %ebp
je 0x257cf
leaq 0x28(%rsp), %rdi
xorl %esi, %esi
callq 0x2360
leaq 0x48(%rsp), %rdi
movq %rbx, %rsi
movl %ebp, %edx
callq 0xb150
leaq 0x38(%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 0x1e160
xorps %xmm0, %xmm0
cvtsi2sd %r14, %xmm0
movsd 0xba42(%rip), %xmm1     # 0x311a0
divsd %xmm1, %xmm0
cvtsi2sd %r13, %xmm2
cvtsi2sd %r12, %xmm3
addsd %xmm0, %xmm2
divsd %xmm1, %xmm3
xorps %xmm0, %xmm0
cvtsi2sd %r15, %xmm0
addsd %xmm3, %xmm0
movq %rax, %xmm1
punpckldq 0xba93(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subsd %xmm0, %xmm2
subpd 0xba97(%rip), %xmm1     # 0x31230
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
mulsd %xmm2, %xmm0
divsd 0x8(%rsp), %xmm0
movapd %xmm0, 0x10(%rsp)
movsd 0x20(%rsp), %xmm1
ucomisd %xmm0, %xmm1
seta %r14b
leaq 0x48(%rsp), %rdi
callq 0xd8b4
jmp 0x257d2
movb $0x1, %r14b
testb %r14b, %r14b
je 0x258b1
leaq 0x28(%rsp), %rdi
xorl %esi, %esi
callq 0x2360
leaq 0x48(%rsp), %rdi
movq %rbx, %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0xb150
leaq 0x38(%rsp), %r14
movq %r14, %rdi
xorl %esi, %esi
callq 0x2360
cvtsi2sdq -0x10(%r14), %xmm4
xorps %xmm1, %xmm1
cvtsi2sdq -0x8(%r14), %xmm1
movsd 0xb981(%rip), %xmm2     # 0x311a0
divsd %xmm2, %xmm1
xorps %xmm3, %xmm3
cvtsi2sdq (%r14), %xmm3
xorps %xmm0, %xmm0
cvtsi2sdq 0x8(%r14), %xmm0
addsd %xmm4, %xmm1
divsd %xmm2, %xmm0
addsd %xmm3, %xmm0
subsd %xmm1, %xmm0
leaq 0xbc0f(%rip), %rdi      # 0x3145a
movapd %xmm0, 0x10(%rsp)
movb $0x1, %al
callq 0x2030
movq %rbx, %rdi
callq 0x1e160
movq %rax, %xmm0
punpckldq 0xb9b3(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0xb9bb(%rip), %xmm0     # 0x31230
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
movapd 0x10(%rsp), %xmm0
divsd %xmm1, %xmm0
leaq 0xbac7(%rip), %rdi      # 0x31359
movb $0x1, %al
callq 0x2030
leaq 0xc9a0(%rip), %rdi      # 0x32240
callq 0x2350
leaq 0x48(%rsp), %rdi
callq 0xd8b4
jmp 0x2592c
leaq 0xbba2(%rip), %rdi      # 0x3145a
movaps 0x10(%rsp), %xmm0
movb $0x1, %al
callq 0x2030
xorps %xmm0, %xmm0
cvtsi2sdq 0x28(%rsp), %xmm0
xorps %xmm1, %xmm1
cvtsi2sdq 0x30(%rsp), %xmm1
movsd 0xb8c0(%rip), %xmm2     # 0x311a0
divsd %xmm2, %xmm1
addsd %xmm0, %xmm1
xorps %xmm3, %xmm3
cvtsi2sdq 0x38(%rsp), %xmm3
xorps %xmm0, %xmm0
cvtsi2sdq 0x40(%rsp), %xmm0
divsd %xmm2, %xmm0
addsd %xmm3, %xmm0
subsd %xmm1, %xmm0
divsd 0x8(%rsp), %xmm0
leaq 0xba44(%rip), %rdi      # 0x31359
movb $0x1, %al
callq 0x2030
leaq 0xc811(%rip), %rdi      # 0x32134
movl %ebp, %esi
xorl %eax, %eax
callq 0x2030
movaps 0x10(%rsp), %xmm0
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x25942
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0xd8b4
movq %rbx, %rdi
callq 0x23b0