// File: /workspace/github_cpp_makefile_star2_O2/fjamour[P]icentral/src/experiments.cc
// Function: speedup_info(graph_t&, int)
void speedup_info(graph_t& graph, int num_edges_to_insert)
{
    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());
    vector<graph_hash_t> bcc_vec;
    graph.find_bicon_comp(bcc_vec);
    
    int G_s = graph.size() + graph.edge_set.size();
    int G_n                    = graph.size();
    
    vector<edge_t> rand_edge_vec;
    printf("Generating edges...\n");
    for(int i = 0; i < num_edges_to_insert; ++i) {
        edge_t rand_edge;
        node_id_t src, dst;
        do {
            src = rand()%graph.size();
            dst = rand()%graph.size();
            rand_edge.first    = src;
            rand_edge.second   = dst;
        } while(graph.has_edge(rand_edge) ||
                find(rand_edge_vec.begin(), rand_edge_vec.end(), rand_edge) != rand_edge_vec.end());
        rand_edge_vec.push_back(rand_edge);
    }
    
    
    printf("\n");
    vector<double> est_speedup_vec;
    for(int i = 0; i < rand_edge_vec.size(); ++i) {
        node_id_t src = rand_edge_vec[i].first;
        node_id_t dst = rand_edge_vec[i].second;
        graph_hash_t bcc;
        graph.insert_edge(src, dst);
        graph.find_edge_bcc_subgraph(bcc, src, dst);
        graph.remove_edge(src, dst);
        
        int bcc_s = bcc.size() + bcc.edge_set.size();
        int bcc_n = bcc.size();
        
        printf("BCC#nodes:[%*d]   BCC#edges:[%*d]   BCCSizeFrac:[%f]   BCCNodeFrac:[%f]\n",
                8,
                bcc_n,
                8,
                bcc.edge_set.size(),
                (double)bcc_s/G_s,
                (double)bcc_n/graph.size());
        
        int d0, d1, d2;
        bcc.find_pruning_counts_exp(src, dst, d0, d1, d2);
        
        double iter_frac = 1.0 - ((double)d0/bcc_n);
        double est_speedup = 1.0/(((double)bcc_n/G_n) * iter_frac * ((double)bcc_s/G_s));
        
        est_speedup_vec.push_back(est_speedup);
        
        printf("d0:[%*d][%f]   d1:[%*d]    d2:[%*d] -- Edge(%d, %d)\n",
                8,
                d0,
                (double)d0/bcc_n,
                8,
                d1,
                8,
                d2,
                src,
                dst);
        
        printf("\n");
    }
    
    double min, max, median;
    double mean, stddev;
    simple_stats(est_speedup_vec, mean, stddev, median, min, max);
    //estimate of the time it takes to do my long delta iteration
    //to the time it takes the normal iteration
    double long_iter_perc;
    long_iter_perc = 150.0;
    printf("\n");
    printf("Estimate ideal speedups: (delta iter to orig iter [%f])\n",
        long_iter_perc);
    printf("Mean[%f] Stddev[%f] Median[%f] Min[%f] Max[%f]\n",
        mean * (100/long_iter_perc),
        stddev * (100/long_iter_perc),
        median * (100/long_iter_perc),
        min * (100/long_iter_perc),
        max * (100/long_iter_perc));
    
    double worst_mean = mean * (100/long_iter_perc);
    long_iter_perc = 100.0;
    printf("Estimate ideal speedups: (delta iter to orig iter [%f])\n",
        long_iter_perc);
    printf("Mean[%f] Stddev[%f] Median[%f] Min[%f] Max[%f]\n",
        mean * (100/long_iter_perc),
        stddev * (100/long_iter_perc),
        median * (100/long_iter_perc),
        min * (100/long_iter_perc),
        max * (100/long_iter_perc));
    double best_mean = mean * (100/long_iter_perc);
    printf("\n");
    printf("[[Average speedup (ideal): %f - %f]]\n",
        worst_mean,
        best_mean);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x388, %rsp            # imm = 0x388
movl %esi, %r14d
movq %rdi, %rbx
leaq 0x134c1(%rip), %rdi     # 0x28b00
callq 0x2360
movq 0x108(%rbx), %rsi
leaq 0x12bbe(%rip), %rdi     # 0x28210
xorl %eax, %eax
callq 0x2030
movq %rbx, %rdi
callq 0x18d3c
leaq 0x12bb6(%rip), %rdi     # 0x2821e
movq %rax, %rsi
xorl %eax, %eax
callq 0x2030
movq 0x58(%rbx), %rsi
leaq 0x12bb6(%rip), %rdi     # 0x28233
xorl %eax, %eax
callq 0x2030
xorpd %xmm0, %xmm0
leaq 0xc0(%rsp), %rsi
movapd %xmm0, (%rsi)
andq $0x0, 0x10(%rsi)
movq %rbx, %rdi
callq 0x10aca
movq %rbx, %rdi
callq 0x18d3c
addl 0x58(%rbx), %eax
movq %rax, 0x10(%rsp)
movq %rbx, %rdi
callq 0x18d3c
movq %rax, 0x48(%rsp)
xorpd %xmm0, %xmm0
leaq 0x50(%rsp), %rax
movapd %xmm0, (%rax)
andq $0x0, 0x10(%rax)
leaq 0x13415(%rip), %rdi     # 0x28aec
callq 0x2360
xorl %ebp, %ebp
testl %r14d, %r14d
cmovlel %ebp, %r14d
movl %r14d, 0x30(%rsp)
leaq 0xe0(%rsp), %r13
cmpl 0x30(%rsp), %ebp
je 0x1578b
andq $0x0, 0xe0(%rsp)
callq 0x2070
movl %eax, %r15d
movq %rbx, %rdi
callq 0x18d3c
movq %rax, %r14
callq 0x2070
movl %eax, %r12d
movq %rbx, %rdi
callq 0x18d3c
movq %rax, %rcx
movslq %r12d, %rsi
movslq %r15d, %rax
xorl %edx, %edx
divq %r14
movq %rdx, %rdi
movq %rsi, %rax
xorl %edx, %edx
divq %rcx
movl %edi, 0xe0(%rsp)
movl %edx, 0xe4(%rsp)
movq %rbx, %rdi
movq %r13, %rsi
callq 0x191b4
testb %al, %al
jne 0x15705
movq 0x50(%rsp), %rdi
movq 0x58(%rsp), %rsi
movq %r13, %rdx
callq 0x1658d
cmpq 0x58(%rsp), %rax
jne 0x15705
leaq 0x50(%rsp), %rdi
movq %r13, %rsi
callq 0x117e2
incl %ebp
jmp 0x156f2
pushq $0xa
popq %rdi
callq 0x2300
xorpd %xmm0, %xmm0
leaq 0x80(%rsp), %rax
movapd %xmm0, (%rax)
andq $0x0, 0x10(%rax)
cvtsi2sdl 0x10(%rsp), %xmm0
movsd %xmm0, 0x68(%rsp)
cvtsi2sdl 0x48(%rsp), %xmm0
movapd %xmm0, 0xb0(%rsp)
xorl %r15d, %r15d
leaq 0xe0(%rsp), %r12
movq 0x50(%rsp), %rax
movq 0x58(%rsp), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %r15, %rcx
jbe 0x159b1
movl (%rax,%r15,8), %r14d
movl 0x4(%rax,%r15,8), %r13d
movq %r12, %rdi
callq 0x11468
movq %rbx, %rdi
movl %r14d, %esi
movl %r13d, %edx
callq 0x18b56
movq %rbx, %rdi
movq %r12, %rsi
movl %r14d, %edx
movl %r13d, %ecx
callq 0x10eea
movq %rbx, %rdi
movl %r14d, %esi
movl %r13d, %edx
callq 0x18bfe
movq %r13, 0x48(%rsp)
movq %r14, 0x10(%rsp)
movq %r15, 0x78(%rsp)
movq %r12, %rdi
callq 0x176f6
movq %rax, %r15
movq 0x138(%rsp), %rbp
movq %r12, %r14
movq %r12, %rdi
callq 0x176f6
movq %rax, %r12
movq 0x138(%rsp), %r13
movq %rbx, %rdi
callq 0x18d3c
addl %r15d, %ebp
cvtsi2sd %ebp, %xmm0
divsd 0x68(%rsp), %xmm0
cvtsi2sd %r12d, %xmm1
movq %rax, %xmm3
punpckldq 0x1296b(%rip), %xmm3 # xmm3 = xmm3[0],mem[0],xmm3[1],mem[1]
subpd 0x12973(%rip), %xmm3    # 0x28200
movapd %xmm3, %xmm2
unpckhpd %xmm3, %xmm2            # xmm2 = xmm2[1],xmm3[1]
addsd %xmm3, %xmm2
movapd %xmm1, 0x30(%rsp)
divsd %xmm2, %xmm1
leaq 0x1308e(%rip), %rdi     # 0x28938
pushq $0x8
popq %rbp
movl %ebp, %esi
movl %r12d, %edx
movl %ebp, %ecx
movq %r13, %r8
movsd %xmm0, 0x70(%rsp)
movb $0x2, %al
callq 0x2030
movq %r14, %r12
movq %r14, %rdi
movq 0x10(%rsp), %r14
movl %r14d, %esi
movq 0x48(%rsp), %r13
movl %r13d, %edx
leaq 0x18(%rsp), %rcx
leaq 0x8(%rsp), %r8
leaq 0x20(%rsp), %r9
callq 0x17dec
cvtsi2sdl 0x18(%rsp), %xmm0
movapd 0x30(%rsp), %xmm2
movapd %xmm2, %xmm1
unpcklpd %xmm0, %xmm1            # xmm1 = xmm1[0],xmm0[0]
movapd 0xb0(%rsp), %xmm0
unpcklpd %xmm2, %xmm0            # xmm0 = xmm0[0],xmm2[0]
divpd %xmm0, %xmm1
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
movsd 0x1271d(%rip), %xmm3    # 0x28040
movapd %xmm3, %xmm2
subsd %xmm0, %xmm2
mulsd %xmm1, %xmm2
movsd 0x70(%rsp), %xmm1
mulsd %xmm2, %xmm1
movapd %xmm3, %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, 0x28(%rsp)
leaq 0x80(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0x163a4
movq 0x78(%rsp), %r15
movl 0x18(%rsp), %edx
cvtsi2sd %edx, %xmm0
divsd 0x30(%rsp), %xmm0
movl 0x8(%rsp), %r8d
movl 0x20(%rsp), %r10d
subq $0x8, %rsp
leaq 0x12f19(%rip), %rdi     # 0x2889a
movl %ebp, %esi
movl %ebp, %ecx
movl %ebp, %r9d
movb $0x1, %al
pushq %r13
pushq %r14
pushq %r10
callq 0x2030
addq $0x20, %rsp
pushq $0xa
popq %rdi
callq 0x2300
movq %r12, %rdi
callq 0x1173e
incq %r15
jmp 0x157ce
leaq 0x98(%rsp), %rdi
leaq 0x80(%rsp), %rsi
callq 0x163c6
leaq 0x98(%rsp), %rdi
leaq 0x8(%rsp), %rsi
leaq 0x20(%rsp), %rdx
leaq 0x18(%rsp), %rcx
leaq 0xe0(%rsp), %r8
leaq 0x28(%rsp), %r9
callq 0x26ad4
leaq 0x98(%rsp), %rdi
callq 0x5754
pushq $0xa
popq %rbx
movl %ebx, %edi
callq 0x2300
leaq 0x12ef2(%rip), %r14     # 0x288ff
movsd 0x127c3(%rip), %xmm0    # 0x281d8
movq %r14, %rdi
movb $0x1, %al
callq 0x2030
movsd 0x127b9(%rip), %xmm5    # 0x281e0
movsd %xmm5, 0x30(%rsp)
movsd 0x8(%rsp), %xmm0
mulsd %xmm5, %xmm0
movsd 0x20(%rsp), %xmm1
mulsd %xmm5, %xmm1
movsd 0x18(%rsp), %xmm2
mulsd %xmm5, %xmm2
movsd 0xe0(%rsp), %xmm3
mulsd %xmm5, %xmm3
movsd 0x28(%rsp), %xmm4
mulsd %xmm5, %xmm4
leaq 0x12e66(%rip), %r15     # 0x288cf
movq %r15, %rdi
movb $0x5, %al
callq 0x2030
movsd 0x30(%rsp), %xmm0
mulsd 0x8(%rsp), %xmm0
movsd %xmm0, 0x30(%rsp)
movsd 0x12723(%rip), %xmm0    # 0x281b0
movq %r14, %rdi
movb $0x1, %al
callq 0x2030
movsd 0x8(%rsp), %xmm0
movsd 0x20(%rsp), %xmm1
movsd 0x18(%rsp), %xmm2
movsd 0xe0(%rsp), %xmm3
movsd 0x28(%rsp), %xmm4
movq %r15, %rdi
movb $0x5, %al
callq 0x2030
movsd 0x8(%rsp), %xmm0
movsd %xmm0, 0x10(%rsp)
movl %ebx, %edi
callq 0x2300
leaq 0x12ea5(%rip), %rdi     # 0x28981
movsd 0x30(%rsp), %xmm0
movsd 0x10(%rsp), %xmm1
movb $0x2, %al
callq 0x2030
leaq 0x80(%rsp), %rdi
callq 0x5754
leaq 0x50(%rsp), %rdi
callq 0x16656
leaq 0xc0(%rsp), %rdi
callq 0x11800
addq $0x388, %rsp            # imm = 0x388
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x98(%rsp), %rdi
callq 0x5754
jmp 0x15b61
jmp 0x15b48
jmp 0x15b3d
jmp 0x15b3d
movq %rax, %rbx
jmp 0x15b7f
jmp 0x15b51
jmp 0x15b51
jmp 0x15b51
movq %rax, %rbx
jmp 0x15b61
jmp 0x15b72
jmp 0x15b51
movq %rax, %rbx
leaq 0xe0(%rsp), %rdi
callq 0x1173e
leaq 0x80(%rsp), %rdi
callq 0x5754
jmp 0x15b75
jmp 0x15b72
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x16656
leaq 0xc0(%rsp), %rdi
callq 0x11800
movq %rbx, %rdi
callq 0x23d0