// File: /workspace/github_cpp_makefile_star2_O1/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 $0x368, %rsp            # imm = 0x368
movl %esi, (%rsp)
movq %rdi, %rbx
leaq 0x17711(%rip), %rdi     # 0x31b40
callq 0x2350
movq 0x108(%rbx), %rsi
leaq 0x16e0e(%rip), %rdi     # 0x31250
xorl %eax, %eax
callq 0x2030
movq %rbx, %rdi
callq 0x1e160
leaq 0x16e06(%rip), %rdi     # 0x3125e
movq %rax, %rsi
xorl %eax, %eax
callq 0x2030
movq 0x58(%rbx), %rsi
leaq 0x16e06(%rip), %rdi     # 0x31273
xorl %eax, %eax
callq 0x2030
xorpd %xmm0, %xmm0
leaq 0xa0(%rsp), %rsi
movapd %xmm0, (%rsi)
movq $0x0, 0x10(%rsi)
movq %rbx, %rdi
callq 0x147a2
movq %rbx, %rdi
callq 0x1e160
addl 0x58(%rbx), %eax
movq %rax, 0x10(%rsp)
movq %rbx, %rdi
callq 0x1e160
movq %rax, 0x48(%rsp)
xorpd %xmm0, %xmm0
movapd %xmm0, 0x20(%rsp)
movq $0x0, 0x30(%rsp)
leaq 0x17661(%rip), %rdi     # 0x31b2c
callq 0x2350
cmpl $0x0, (%rsp)
jle 0x1a597
xorl %ebp, %ebp
leaq 0xc0(%rsp), %r12
movq $0x0, 0xc0(%rsp)
callq 0x2070
movl %eax, %r15d
movq %rbx, %rdi
callq 0x1e160
movq %rax, %r14
callq 0x2070
movl %eax, %r13d
movq %rbx, %rdi
callq 0x1e160
movq %rax, %rcx
movslq %r13d, %rsi
movslq %r15d, %rax
xorl %edx, %edx
divq %r14
movq %rdx, %rdi
movq %rsi, %rax
xorl %edx, %edx
divq %rcx
movl %edi, 0xc0(%rsp)
movl %edx, 0xc4(%rsp)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x1e7bc
testb %al, %al
jne 0x1a4f0
movq 0x20(%rsp), %rdi
movq 0x28(%rsp), %rsi
movq %r12, %rdx
callq 0x1b49c
movq 0x28(%rsp), %rsi
cmpq %rsi, %rax
jne 0x1a4f0
cmpq 0x30(%rsp), %rsi
je 0x1a57f
movq 0xc0(%rsp), %rax
movq %rax, (%rsi)
addq $0x8, 0x28(%rsp)
jmp 0x1a58c
leaq 0x20(%rsp), %rdi
movq %r12, %rdx
callq 0x16e08
incl %ebp
cmpl (%rsp), %ebp
jne 0x1a4e4
movl $0xa, %edi
callq 0x22f0
xorpd %xmm0, %xmm0
movapd %xmm0, 0x50(%rsp)
movq $0x0, 0x60(%rsp)
movq 0x20(%rsp), %rax
cmpq %rax, 0x28(%rsp)
je 0x1a7ed
xorps %xmm0, %xmm0
cvtsi2sdl 0x10(%rsp), %xmm0
movsd %xmm0, 0x70(%rsp)
xorps %xmm0, %xmm0
cvtsi2sdl 0x48(%rsp), %xmm0
movsd %xmm0, 0x68(%rsp)
xorl %r15d, %r15d
leaq 0xc0(%rsp), %rbp
movl (%rax,%r15,8), %r14d
movl 0x4(%rax,%r15,8), %r12d
movq %rbp, %rdi
callq 0x153ae
movq %rbx, %rdi
movl %r14d, %esi
movl %r12d, %edx
callq 0x1de06
movq %rbx, %rdi
movq %rbp, %rsi
movl %r14d, %edx
movl %r12d, %ecx
callq 0x14ca4
movq %rbx, %rdi
movl %r14d, %esi
movl %r12d, %edx
callq 0x1deda
movq %r12, 0x48(%rsp)
movq %r14, 0x10(%rsp)
movq %rbp, %rdi
callq 0x1c62c
movq %rax, %r14
movq %r15, 0x80(%rsp)
movq 0x118(%rsp), %r12
movq %rbp, %r13
movq %rbp, %rdi
callq 0x1c62c
movq %rax, %rbp
movq 0x118(%rsp), %r15
movq %rbx, %rdi
callq 0x1e160
addl %r14d, %r12d
xorps %xmm0, %xmm0
cvtsi2sd %r12d, %xmm0
divsd 0x70(%rsp), %xmm0
cvtsi2sd %ebp, %xmm3
movq %rax, %xmm1
punpckldq 0x16b90(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x16b98(%rip), %xmm1    # 0x31230
movapd %xmm1, %xmm2
unpckhpd %xmm1, %xmm2            # xmm2 = xmm2[1],xmm1[1]
addsd %xmm1, %xmm2
movsd %xmm3, (%rsp)
movapd %xmm3, %xmm1
divsd %xmm2, %xmm1
leaq 0x172c0(%rip), %rdi     # 0x31978
movl $0x8, %esi
movl %ebp, %edx
movl $0x8, %ecx
movq %r15, %r8
movsd %xmm0, 0x78(%rsp)
movb $0x2, %al
callq 0x2030
movq %r13, %rbp
movq %r13, %rdi
movq 0x10(%rsp), %r14
movl %r14d, %esi
movq 0x48(%rsp), %r12
movl %r12d, %edx
leaq 0x18(%rsp), %rcx
leaq 0x8(%rsp), %r8
leaq 0x38(%rsp), %r9
callq 0x1d0a0
xorps %xmm0, %xmm0
cvtsi2sdl 0x18(%rsp), %xmm0
movsd (%rsp), %xmm3
divsd %xmm3, %xmm0
movsd 0x16918(%rip), %xmm2    # 0x31030
movapd %xmm2, %xmm1
subsd %xmm0, %xmm1
movapd %xmm3, %xmm0
divsd 0x68(%rsp), %xmm0
mulsd %xmm1, %xmm0
movsd 0x78(%rsp), %xmm1
mulsd %xmm0, %xmm1
movapd %xmm2, %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, 0x40(%rsp)
movq 0x58(%rsp), %rsi
cmpq 0x60(%rsp), %rsi
movq 0x80(%rsp), %r15
je 0x1a769
movsd %xmm0, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x58(%rsp)
jmp 0x1a778
leaq 0x50(%rsp), %rdi
leaq 0x40(%rsp), %rdx
callq 0x1b82c
movl 0x18(%rsp), %edx
xorps %xmm0, %xmm0
cvtsi2sd %edx, %xmm0
divsd (%rsp), %xmm0
movl 0x8(%rsp), %r8d
movl 0x38(%rsp), %r10d
subq $0x8, %rsp
leaq 0x1713d(%rip), %rdi     # 0x318da
movl $0x8, %esi
movl $0x8, %ecx
movl $0x8, %r9d
movb $0x1, %al
pushq %r12
pushq %r14
pushq %r10
callq 0x2030
addq $0x20, %rsp
movl $0xa, %edi
callq 0x22f0
movq %rbp, %rdi
callq 0x15750
incq %r15
movq 0x20(%rsp), %rax
movq 0x28(%rsp), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %r15, %rcx
ja 0x1a5ed
leaq 0x88(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0x1b35e
leaq 0x88(%rsp), %rdi
leaq 0x8(%rsp), %rsi
leaq 0x38(%rsp), %rdx
leaq 0x18(%rsp), %rcx
leaq 0xc0(%rsp), %r8
leaq 0x40(%rsp), %r9
callq 0x2fae4
movq 0x88(%rsp), %rdi
testq %rdi, %rdi
je 0x1a845
movq 0x98(%rsp), %rsi
subq %rdi, %rsi
callq 0x2250
movl $0xa, %edi
callq 0x22f0
leaq 0x170e9(%rip), %rbx     # 0x3193f
movsd 0x169b2(%rip), %xmm0    # 0x31210
movq %rbx, %rdi
movb $0x1, %al
callq 0x2030
movsd 0x169a8(%rip), %xmm5    # 0x31218
movsd %xmm5, (%rsp)
movsd 0x8(%rsp), %xmm0
mulsd %xmm5, %xmm0
movsd 0x38(%rsp), %xmm1
mulsd %xmm5, %xmm1
movsd 0x18(%rsp), %xmm2
mulsd %xmm5, %xmm2
movsd 0xc0(%rsp), %xmm3
mulsd %xmm5, %xmm3
movsd 0x40(%rsp), %xmm4
mulsd %xmm5, %xmm4
leaq 0x1705e(%rip), %r14     # 0x3190f
movq %r14, %rdi
movb $0x5, %al
callq 0x2030
movsd (%rsp), %xmm0
mulsd 0x8(%rsp), %xmm0
movsd %xmm0, (%rsp)
movsd 0x16915(%rip), %xmm0    # 0x311e8
movq %rbx, %rdi
movb $0x1, %al
callq 0x2030
movsd 0x8(%rsp), %xmm0
movsd 0x38(%rsp), %xmm1
movsd 0x18(%rsp), %xmm2
movsd 0xc0(%rsp), %xmm3
movsd 0x40(%rsp), %xmm4
movq %r14, %rdi
movb $0x5, %al
callq 0x2030
movsd 0x8(%rsp), %xmm0
movsd %xmm0, 0x10(%rsp)
movl $0xa, %edi
callq 0x22f0
leaq 0x1709c(%rip), %rdi     # 0x319c1
movsd (%rsp), %xmm0
movsd 0x10(%rsp), %xmm1
movb $0x2, %al
callq 0x2030
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x1a94e
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x2250
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x1a965
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x2250
leaq 0xa0(%rsp), %rdi
callq 0x15802
addq $0x368, %rsp            # imm = 0x368
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x88(%rsp), %rdi
testq %rdi, %rdi
je 0x1a9d0
movq 0x98(%rsp), %rsi
subq %rdi, %rsi
callq 0x2250
jmp 0x1a9d0
jmp 0x1a9b5
jmp 0x1a9ac
jmp 0x1a9ac
movq %rax, %rbx
jmp 0x1aa05
jmp 0x1a9eb
jmp 0x1a9c0
movq %rax, %rbx
jmp 0x1a9d0
jmp 0x1a9c0
jmp 0x1a9c0
jmp 0x1a9c0
movq %rax, %rbx
leaq 0xc0(%rsp), %rdi
callq 0x15750
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x1a9ee
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x2250
jmp 0x1a9ee
jmp 0x1a9eb
movq %rax, %rbx
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x1aa05
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x2250
leaq 0xa0(%rsp), %rdi
callq 0x15802
movq %rbx, %rdi
callq 0x23b0