// File: fjamour[P]icentral/src/experiments.cc
// Function: count_bcc(graph_t&, int)
void count_bcc(graph_t& graph, int num_edges)
{
    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);
    
    vector<int> bcc_sz_vec;
    int num_bcc = 0;
    if(bcc_vec.size() > 1) {
        for(int i = 0; i < bcc_vec.size(); ++i) {
            bcc_sz_vec.push_back(bcc_vec[i].edge_set.size());
            if(bcc_vec[i].edge_set.size() >= num_edges) {
                num_bcc++;
            }
        }
    }
    
    printf("\n");
    if(bcc_sz_vec.size() > 2) {
        sort(bcc_sz_vec.begin(), bcc_sz_vec.end());
        printf("Num edges in LBCC:\t[%d]\n", bcc_sz_vec.back());
        printf("Num edges in 2nd largest BCC:\t[%d]\n",
                bcc_sz_vec[bcc_sz_vec.size()-2]);
    }
    printf("\n");
    double frac_edges_in_lbcc = bcc_sz_vec.back()/(double)graph.edge_set.size();
    printf("Frac edges in LBCC:\t\t[%f]\n", frac_edges_in_lbcc);
    printf("\n");
    printf("Num BCC:\t\t\t[%d]\n", bcc_vec.size());
    printf("Num BCC with # edges >= %d:\t[%d]\n", num_edges, num_bcc);
}

// Assembly:
subq $0xa8, %rsp
movq %rdi, 0xa0(%rsp)
movl %esi, 0x9c(%rsp)
leaq 0x2e553(%rip), %rdi     # 0x7b2e0
xorl %eax, %eax
movb %al, 0x27(%rsp)
callq 0x9040
movq 0xa0(%rsp), %rdi
addq $0x108, %rdi            # imm = 0x108
callq 0x9250
movq %rax, %rsi
movb 0x27(%rsp), %al
leaq 0x2e562(%rip), %rdi     # 0x7b31c
callq 0x9040
movq 0xa0(%rsp), %rdi
callq 0x56b40
movq %rax, %rsi
movb 0x27(%rsp), %al
leaq 0x2e550(%rip), %rdi     # 0x7b32a
callq 0x9040
movq 0xa0(%rsp), %rdi
addq $0x30, %rdi
callq 0x4dbe0
movq %rax, %rsi
movb 0x27(%rsp), %al
leaq 0x2e541(%rip), %rdi     # 0x7b33f
callq 0x9040
leaq 0x80(%rsp), %rdi
movq %rdi, 0x28(%rsp)
callq 0x42080
movq 0x28(%rsp), %rsi
movq 0xa0(%rsp), %rdi
callq 0x40080
jmp 0x4ce29
leaq 0x58(%rsp), %rdi
callq 0xfc40
movl $0x0, 0x54(%rsp)
leaq 0x80(%rsp), %rdi
callq 0x42090
cmpq $0x1, %rax
jbe 0x4cf31
movl $0x0, 0x50(%rsp)
movslq 0x50(%rsp), %rax
movq %rax, 0x18(%rsp)
leaq 0x80(%rsp), %rdi
callq 0x42090
movq %rax, %rcx
movq 0x18(%rsp), %rax
cmpq %rcx, %rax
jae 0x4cf2f
movslq 0x50(%rsp), %rsi
leaq 0x80(%rsp), %rdi
callq 0x420b0
movq %rax, %rdi
addq $0x30, %rdi
callq 0x4dbe0
movl %eax, 0x4c(%rsp)
leaq 0x58(%rsp), %rdi
leaq 0x4c(%rsp), %rsi
callq 0x4e1a0
jmp 0x4ceb5
movslq 0x50(%rsp), %rsi
leaq 0x80(%rsp), %rdi
callq 0x420b0
movq %rax, %rdi
addq $0x30, %rdi
callq 0x4dbe0
movslq 0x9c(%rsp), %rcx
cmpq %rcx, %rax
jb 0x4cf1d
movl 0x54(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x54(%rsp)
jmp 0x4cf1d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x78(%rsp)
movl %eax, 0x74(%rsp)
jmp 0x4d0c3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x78(%rsp)
movl %eax, 0x74(%rsp)
leaq 0x58(%rsp), %rdi
callq 0xfc70
jmp 0x4d0c3
jmp 0x4cf1f
movl 0x50(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x50(%rsp)
jmp 0x4ce5a
jmp 0x4cf31
leaq 0x2eeea(%rip), %rdi     # 0x7be22
xorl %eax, %eax
callq 0x9040
jmp 0x4cf41
leaq 0x58(%rsp), %rdi
callq 0x1eb00
cmpq $0x2, %rax
jbe 0x4cfd9
leaq 0x58(%rsp), %rdi
movq %rdi, 0x10(%rsp)
callq 0x109f0
movq 0x10(%rsp), %rdi
movq %rax, 0x40(%rsp)
callq 0x10a20
movq %rax, 0x38(%rsp)
movq 0x40(%rsp), %rdi
movq 0x38(%rsp), %rsi
callq 0x4e1d0
jmp 0x4cf89
leaq 0x58(%rsp), %rdi
callq 0x4e210
movl (%rax), %esi
leaq 0x2eb5c(%rip), %rdi     # 0x7baf8
xorl %eax, %eax
callq 0x9040
jmp 0x4cfa5
leaq 0x58(%rsp), %rdi
movq %rdi, 0x8(%rsp)
callq 0x1eb00
movq 0x8(%rsp), %rdi
movq %rax, %rsi
addq $-0x2, %rsi
callq 0xfc50
movl (%rax), %esi
leaq 0x2eb43(%rip), %rdi     # 0x7bb11
xorl %eax, %eax
callq 0x9040
jmp 0x4cfd7
jmp 0x4cfd9
leaq 0x2ee42(%rip), %rdi     # 0x7be22
xorl %eax, %eax
callq 0x9040
jmp 0x4cfe9
leaq 0x58(%rsp), %rdi
callq 0x4e210
cvtsi2sdl (%rax), %xmm0
movsd %xmm0, (%rsp)
movq 0xa0(%rsp), %rdi
addq $0x30, %rdi
callq 0x4dbe0
movsd (%rsp), %xmm0
movq %rax, %xmm1
movaps 0x2e292(%rip), %xmm2    # 0x7b2b0
punpckldq %xmm2, %xmm1    # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
movapd 0x2e296(%rip), %xmm2    # 0x7b2c0
subpd %xmm2, %xmm1
movaps %xmm1, %xmm2
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm2, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, 0x30(%rsp)
movsd 0x30(%rsp), %xmm0
leaq 0x2eae5(%rip), %rdi     # 0x7bb35
movb $0x1, %al
callq 0x9040
jmp 0x4d059
leaq 0x2edc2(%rip), %rdi     # 0x7be22
xorl %eax, %eax
callq 0x9040
jmp 0x4d069
leaq 0x80(%rsp), %rdi
callq 0x42090
movq %rax, %rsi
leaq 0x2ead0(%rip), %rdi     # 0x7bb50
xorl %eax, %eax
callq 0x9040
jmp 0x4d089
movl 0x9c(%rsp), %esi
movl 0x54(%rsp), %edx
leaq 0x2eac6(%rip), %rdi     # 0x7bb61
xorl %eax, %eax
callq 0x9040
jmp 0x4d0a4
leaq 0x58(%rsp), %rdi
callq 0xfc70
leaq 0x80(%rsp), %rdi
callq 0x421a0
addq $0xa8, %rsp
retq
leaq 0x80(%rsp), %rdi
callq 0x421a0
movq 0x78(%rsp), %rdi
callq 0x9cf0
nopw (%rax,%rax)