// File: /workspace/github_cpp_makefile_star2_O3/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 0x167c1(%rip), %rdi     # 0x30b40
callq 0x2350
movq 0x108(%rbx), %rsi
leaq 0x15ebe(%rip), %rdi     # 0x30250
xorl %eax, %eax
callq 0x2030
movq %rbx, %rdi
callq 0x1dfcc
leaq 0x15eb6(%rip), %rdi     # 0x3025e
movq %rax, %rsi
xorl %eax, %eax
callq 0x2030
movq 0x58(%rbx), %rsi
leaq 0x15eb6(%rip), %rdi     # 0x30273
xorl %eax, %eax
callq 0x2030
xorpd %xmm0, %xmm0
leaq 0xa0(%rsp), %rsi
movapd %xmm0, (%rsi)
movq $0x0, 0x10(%rsi)
movq %rbx, %rdi
callq 0x146c2
movq %rbx, %rdi
callq 0x1dfcc
addl 0x58(%rbx), %eax
movq %rax, 0x10(%rsp)
movq %rbx, %rdi
callq 0x1dfcc
movq %rax, 0x48(%rsp)
xorpd %xmm0, %xmm0
movapd %xmm0, 0x20(%rsp)
movq $0x0, 0x30(%rsp)
leaq 0x16711(%rip), %rdi     # 0x30b2c
callq 0x2350
cmpl $0x0, (%rsp)
jle 0x1a4e7
xorl %ebp, %ebp
leaq 0xc0(%rsp), %r12
movq $0x0, 0xc0(%rsp)
callq 0x2070
movl %eax, %r15d
movq %rbx, %rdi
callq 0x1dfcc
movq %rax, %r14
callq 0x2070
movl %eax, %r13d
movq %rbx, %rdi
callq 0x1dfcc
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 0x1e644
testb %al, %al
jne 0x1a440
movq 0x20(%rsp), %rdi
movq 0x28(%rsp), %rsi
movq %r12, %rdx
callq 0x1b3f6
movq 0x28(%rsp), %rsi
cmpq %rsi, %rax
jne 0x1a440
cmpq 0x30(%rsp), %rax
je 0x1a4cf
movq 0xc0(%rsp), %rax
movq %rax, (%rsi)
addq $0x8, 0x28(%rsp)
jmp 0x1a4dc
leaq 0x20(%rsp), %rdi
movq %r12, %rdx
callq 0x16d4c
incl %ebp
cmpl (%rsp), %ebp
jne 0x1a434
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 0x1a737
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 0x152ae
movq %rbx, %rdi
movl %r14d, %esi
movl %r12d, %edx
callq 0x1dc86
movq %rbx, %rdi
movq %rbp, %rsi
movl %r14d, %edx
movl %r12d, %ecx
callq 0x14bc4
movq %rbx, %rdi
movl %r14d, %esi
movl %r12d, %edx
callq 0x1dd70
movq %r12, 0x48(%rsp)
movq %r14, 0x10(%rsp)
movq %rbp, %rdi
callq 0x1c4e0
movq %rax, %r14
movq %r15, 0x80(%rsp)
movq 0x118(%rsp), %r12
movq %rbp, %r13
movq %rbp, %rdi
callq 0x1c4e0
movq %rax, %rbp
movq 0x118(%rsp), %r15
movq %rbx, %rdi
callq 0x1dfcc
addl %r14d, %r12d
xorps %xmm0, %xmm0
cvtsi2sd %r12d, %xmm0
divsd 0x70(%rsp), %xmm0
cvtsi2sd %ebp, %xmm1
movq %rax, %xmm3
punpckldq 0x15c40(%rip), %xmm3 # xmm3 = xmm3[0],mem[0],xmm3[1],mem[1]
subpd 0x15c48(%rip), %xmm3    # 0x30230
movapd %xmm3, %xmm2
unpckhpd %xmm3, %xmm2            # xmm2 = xmm2[1],xmm3[1]
addsd %xmm3, %xmm2
movsd %xmm1, (%rsp)
divsd %xmm2, %xmm1
leaq 0x16374(%rip), %rdi     # 0x30978
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 0x1cf7e
movl 0x18(%rsp), %edx
xorps %xmm0, %xmm0
cvtsi2sd %edx, %xmm0
movsd (%rsp), %xmm2
divsd %xmm2, %xmm0
movsd 0x159ca(%rip), %xmm3    # 0x30030
movapd %xmm3, %xmm1
subsd %xmm0, %xmm1
divsd 0x68(%rsp), %xmm2
mulsd %xmm1, %xmm2
movsd 0x78(%rsp), %xmm4
mulsd %xmm2, %xmm4
movapd %xmm3, %xmm1
divsd %xmm4, %xmm1
movsd %xmm1, 0x40(%rsp)
movq 0x58(%rsp), %rsi
cmpq 0x60(%rsp), %rsi
movq 0x80(%rsp), %r15
je 0x1a6b3
movsd %xmm1, (%rsi)
addq $0x8, %rsi
movq %rsi, 0x58(%rsp)
jmp 0x1a6d2
leaq 0x50(%rsp), %rdi
leaq 0x40(%rsp), %rdx
callq 0x1b766
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 0x161f3(%rip), %rdi     # 0x308da
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 0x15650
incq %r15
movq 0x20(%rsp), %rax
movq 0x28(%rsp), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %r15, %rcx
ja 0x1a53d
leaq 0x88(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0x1b2b8
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 0x2f758
movq 0x88(%rsp), %rdi
testq %rdi, %rdi
je 0x1a78f
movq 0x98(%rsp), %rsi
subq %rdi, %rsi
callq 0x2250
movl $0xa, %edi
callq 0x22f0
leaq 0x1619f(%rip), %rbx     # 0x3093f
movsd 0x15a68(%rip), %xmm0    # 0x30210
movq %rbx, %rdi
movb $0x1, %al
callq 0x2030
movsd 0x15a5e(%rip), %xmm5    # 0x30218
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 0x16114(%rip), %r14     # 0x3090f
movq %r14, %rdi
movb $0x5, %al
callq 0x2030
movsd (%rsp), %xmm0
mulsd 0x8(%rsp), %xmm0
movsd %xmm0, (%rsp)
movsd 0x159cb(%rip), %xmm0    # 0x301e8
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 0x16152(%rip), %rdi     # 0x309c1
movsd (%rsp), %xmm0
movsd 0x10(%rsp), %xmm1
movb $0x2, %al
callq 0x2030
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x1a898
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x2250
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x1a8af
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x2250
leaq 0xa0(%rsp), %rdi
callq 0x15702
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 0x1a91a
movq 0x98(%rsp), %rsi
subq %rdi, %rsi
callq 0x2250
jmp 0x1a91a
jmp 0x1a8ff
jmp 0x1a8f6
jmp 0x1a8f6
movq %rax, %rbx
jmp 0x1a94f
jmp 0x1a935
jmp 0x1a90a
movq %rax, %rbx
jmp 0x1a91a
jmp 0x1a90a
jmp 0x1a90a
jmp 0x1a90a
movq %rax, %rbx
leaq 0xc0(%rsp), %rdi
callq 0x15650
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x1a938
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x2250
jmp 0x1a938
jmp 0x1a935
movq %rax, %rbx
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0x1a94f
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x2250
leaq 0xa0(%rsp), %rdi
callq 0x15702
movq %rbx, %rdi
callq 0x23b0