// File: fjamour[P]icentral/src/bcc_delta.cc
// Function: graph_t::find_edge_bcc(bcc_delta_t&, unsigned int, unsigned int)
void graph_t::find_edge_bcc(bcc_delta_t&  bcc,
                                node_id_t src,
                                node_id_t dst)
{
    //a. find the bcc subgraph
    //b. find the articulation points in bcc
    //c. find the sizes of the subgraphs connected to each art point
    find_edge_bcc_subgraph(bcc.bcc_subgraph, src, dst);
    bcc.bcc_fast_subgraph.fill_graph(bcc.bcc_subgraph);
    vector<node_id_t> art_pt_vec;
    find_art_points(art_pt_vec);
    set<node_id_t> art_pt_set;
    for(int i = 0; i < art_pt_vec.size(); ++i) {
        art_pt_set.insert(art_pt_vec[i]);
    }
    
    graph_hash_t::nodes_map_t::iterator it;
    for(it = bcc.bcc_subgraph.nodes_map.begin();
        it != bcc.bcc_subgraph.nodes_map.end();
        ++it) {
        node_id_t v = it->first;
        if(art_pt_set.find(v) != art_pt_set.end()) {
            // the node is an articulation point and it belongs to the bcc
            // of interest, so it must be added to the art point of this bcc
            // along with the sizes of the subgraphs it connects the bcc to
            vector<int> subgraph_sz_vec;
            vector<bool> visited_vec;
            visited_vec.resize(size());
            fill(visited_vec.begin(), visited_vec.end(), false);
            visited_vec[v] = true;
            vector<node_id_t> v_nbr_vec = get_nbrs(v);
            for(int i = 0; i < v_nbr_vec.size(); ++i) {
                node_id_t u = v_nbr_vec[i];
                if(!bcc.bcc_subgraph.has_edge(v, u) && !visited_vec[u]) {
                    //do a dfs from this guy to figure out the size
                    //of the connected component connected to the bcc through v
                    //and this edge
                    int cnt = 0;
                    stack<node_id_t> S;
                    S.push(u);
                    visited_vec[u] = true;
                    while(!S.empty()) {
                        node_id_t vv = S.top();
                        S.pop();
                        cnt++;
                        vector<node_id_t> nbr_vec = get_nbrs(vv);
                        for(int i = 0; i < nbr_vec.size(); ++i) {
                            node_id_t nbr = nbr_vec[i];
                            if(!visited_vec[nbr]) {
                                visited_vec[nbr] = true;
                                S.push(nbr);
                            }
                        }
                    }
                    subgraph_sz_vec.push_back(cnt);
                }
            }
            bcc.art_pt_map.insert(make_pair(v, subgraph_sz_vec));
        }
    }
    
    //fix art_pt_map
    bcc_delta_t::art_pt_map_t new_art_pt_map;
    for(bcc_delta_t::art_pt_map_t::iterator it = bcc.art_pt_map.begin();
            it != bcc.art_pt_map.end();
            ++it) {
        node_id_t new_v = bcc.bcc_fast_subgraph.outin_label_map[it->first];
        new_art_pt_map.insert(make_pair(new_v, it->second));
    }
    bcc.art_pt_map = new_art_pt_map;
}

// Assembly:
subq $0x4a8, %rsp            # imm = 0x4A8
movq %rdi, 0x4a0(%rsp)
movq %rsi, 0x498(%rsp)
movl %edx, 0x494(%rsp)
movl %ecx, 0x490(%rsp)
movq 0x4a0(%rsp), %rdi
movq %rdi, 0x140(%rsp)
movq 0x498(%rsp), %rsi
addq $0x30, %rsi
movl 0x494(%rsp), %edx
movl 0x490(%rsp), %ecx
callq 0x409c0
movq 0x498(%rsp), %rsi
movq %rsi, %rdi
addq $0x2d8, %rdi            # imm = 0x2D8
addq $0x30, %rsi
callq 0x77eb0
leaq 0x478(%rsp), %rdi
movq %rdi, 0x148(%rsp)
callq 0xfcd0
movq 0x140(%rsp), %rdi
movq 0x148(%rsp), %rsi
callq 0x3f970
jmp 0x33b6b
leaq 0x438(%rsp), %rdi
callq 0x3ad20
movl $0x0, 0x434(%rsp)
movslq 0x434(%rsp), %rax
movq %rax, 0x138(%rsp)
leaq 0x478(%rsp), %rdi
callq 0xfd50
movq %rax, %rcx
movq 0x138(%rsp), %rax
cmpq %rcx, %rax
jae 0x33c50
movslq 0x434(%rsp), %rsi
leaq 0x478(%rsp), %rdi
callq 0xfbc0
movq %rax, %rsi
leaq 0x438(%rsp), %rdi
callq 0x3ad30
movb %dl, 0x12f(%rsp)
movq %rax, 0x130(%rsp)
jmp 0x33bea
movb 0x12f(%rsp), %al
movq 0x130(%rsp), %rcx
movq %rcx, 0x420(%rsp)
movb %al, 0x428(%rsp)
movl 0x434(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x434(%rsp)
jmp 0x33b83
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x470(%rsp)
movl %eax, 0x46c(%rsp)
jmp 0x34735
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x470(%rsp)
movl %eax, 0x46c(%rsp)
jmp 0x34728
leaq 0x410(%rsp), %rdi
callq 0x3ad90
jmp 0x33c5f
movq 0x498(%rsp), %rdi
addq $0x30, %rdi
callq 0x2d6b0
movq %rdx, 0x118(%rsp)
movq %rax, 0x120(%rsp)
jmp 0x33c82
movq 0x118(%rsp), %rax
movq 0x120(%rsp), %rcx
movq %rcx, 0x400(%rsp)
movq %rax, 0x408(%rsp)
movq 0x400(%rsp), %rax
movq %rax, 0x410(%rsp)
movq 0x408(%rsp), %rax
movq %rax, 0x418(%rsp)
movq 0x498(%rsp), %rdi
addq $0x30, %rdi
callq 0x2d710
movq %rdx, 0x108(%rsp)
movq %rax, 0x110(%rsp)
jmp 0x33ce5
movq 0x108(%rsp), %rax
movq 0x110(%rsp), %rcx
movq %rcx, 0x3f0(%rsp)
movq %rax, 0x3f8(%rsp)
leaq 0x410(%rsp), %rdi
leaq 0x3f0(%rsp), %rsi
callq 0x2d6f0
movb %al, 0x107(%rsp)
jmp 0x33d23
movb 0x107(%rsp), %al
testb $0x1, %al
jne 0x33d33
jmp 0x34499
leaq 0x410(%rsp), %rdi
callq 0x2d750
movq %rax, 0xf8(%rsp)
jmp 0x33d4a
movq 0xf8(%rsp), %rax
movl (%rax), %eax
movl %eax, 0x3ec(%rsp)
leaq 0x438(%rsp), %rdi
leaq 0x3ec(%rsp), %rsi
callq 0x3add0
movq %rax, 0xf0(%rsp)
jmp 0x33d7a
movq 0xf0(%rsp), %rax
movq %rax, 0x3e0(%rsp)
leaq 0x438(%rsp), %rdi
callq 0x3ae10
movq %rax, 0x3d8(%rsp)
leaq 0x3e0(%rsp), %rdi
leaq 0x3d8(%rsp), %rsi
callq 0x3adb0
testb $0x1, %al
jne 0x33dbd
jmp 0x34483
leaq 0x3c0(%rsp), %rdi
callq 0xfc40
leaq 0x398(%rsp), %rdi
callq 0x15640
movq 0x140(%rsp), %rdi
callq 0x56b40
movq %rax, 0xe8(%rsp)
jmp 0x33dee
movq 0xe8(%rsp), %rsi
leaq 0x398(%rsp), %rdi
xorl %edx, %edx
callq 0x24c90
jmp 0x33e07
leaq 0x398(%rsp), %rdi
movq %rdi, 0xe0(%rsp)
callq 0x1f400
movq 0xe0(%rsp), %rdi
movl %edx, 0x380(%rsp)
movq %rax, 0x378(%rsp)
movl 0x380(%rsp), %eax
movl %eax, 0x390(%rsp)
movq 0x378(%rsp), %rax
movq %rax, 0x388(%rsp)
callq 0x21fd0
movl %edx, 0x360(%rsp)
movq %rax, 0x358(%rsp)
movl 0x360(%rsp), %eax
movl %eax, 0x370(%rsp)
movq 0x358(%rsp), %rax
movq %rax, 0x368(%rsp)
movb $0x0, 0x357(%rsp)
movq 0x388(%rsp), %rdi
movl 0x390(%rsp), %esi
movq 0x368(%rsp), %rdx
movl 0x370(%rsp), %ecx
leaq 0x357(%rsp), %r8
callq 0x21f60
jmp 0x33eb8
movl 0x3ec(%rsp), %eax
movl %eax, %esi
leaq 0x398(%rsp), %rdi
callq 0x10a70
movq %rdx, 0xd0(%rsp)
movq %rax, 0xd8(%rsp)
jmp 0x33ee0
movq 0xd0(%rsp), %rax
movq 0xd8(%rsp), %rcx
movq %rcx, 0x340(%rsp)
movq %rax, 0x348(%rsp)
leaq 0x340(%rsp), %rdi
movl $0x1, %esi
callq 0x10ad0
movq 0x140(%rsp), %rdi
movl 0x3ec(%rsp), %esi
callq 0x566f0
movq %rax, 0xc8(%rsp)
jmp 0x33f30
movq 0xc8(%rsp), %rsi
leaq 0x328(%rsp), %rdi
callq 0x10b20
jmp 0x33f47
movl $0x0, 0x324(%rsp)
movslq 0x324(%rsp), %rax
movq %rax, 0xc0(%rsp)
leaq 0x328(%rsp), %rdi
callq 0xfd50
movq %rax, %rcx
movq 0xc0(%rsp), %rax
cmpq %rcx, %rax
jae 0x34371
movslq 0x324(%rsp), %rsi
leaq 0x328(%rsp), %rdi
callq 0xfbc0
movl (%rax), %eax
movl %eax, 0x320(%rsp)
movq 0x498(%rsp), %rdi
addq $0x30, %rdi
movl 0x3ec(%rsp), %esi
movl 0x320(%rsp), %edx
callq 0x52960
movb %al, 0xbf(%rsp)
jmp 0x33fc9
movb 0xbf(%rsp), %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, 0xbe(%rsp)
jne 0x3403e
jmp 0x33fe0
movl 0x320(%rsp), %eax
movl %eax, %esi
leaq 0x398(%rsp), %rdi
callq 0x10a70
movq %rdx, 0xa8(%rsp)
movq %rax, 0xb0(%rsp)
jmp 0x34008
movq 0xa8(%rsp), %rax
movq 0xb0(%rsp), %rcx
movq %rcx, 0x310(%rsp)
movq %rax, 0x318(%rsp)
leaq 0x310(%rsp), %rdi
callq 0x10c20
xorb $-0x1, %al
movb %al, 0xbe(%rsp)
movb 0xbe(%rsp), %al
testb $0x1, %al
jne 0x3404e
jmp 0x34359
movl $0x0, 0x30c(%rsp)
leaq 0x2b8(%rsp), %rdi
callq 0x21da0
jmp 0x34068
leaq 0x2b8(%rsp), %rdi
leaq 0x320(%rsp), %rsi
callq 0x21d50
jmp 0x3407f
movl 0x320(%rsp), %eax
movl %eax, %esi
leaq 0x398(%rsp), %rdi
callq 0x10a70
movq %rdx, 0x98(%rsp)
movq %rax, 0xa0(%rsp)
jmp 0x340a7
movq 0x98(%rsp), %rax
movq 0xa0(%rsp), %rcx
movq %rcx, 0x2a8(%rsp)
movq %rax, 0x2b0(%rsp)
leaq 0x2a8(%rsp), %rdi
movl $0x1, %esi
callq 0x10ad0
leaq 0x2b8(%rsp), %rdi
callq 0x21ee0
movb %al, 0x97(%rsp)
jmp 0x340ef
movb 0x97(%rsp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x34101
jmp 0x34321
leaq 0x2b8(%rsp), %rdi
callq 0x21f00
movq %rax, 0x88(%rsp)
jmp 0x34118
movq 0x88(%rsp), %rax
movl (%rax), %eax
movl %eax, 0x2a4(%rsp)
leaq 0x2b8(%rsp), %rdi
callq 0x21f10
jmp 0x34138
movq 0x140(%rsp), %rdi
movl 0x30c(%rsp), %eax
incl %eax
movl %eax, 0x30c(%rsp)
movl 0x2a4(%rsp), %esi
callq 0x566f0
movq %rax, 0x80(%rsp)
jmp 0x34166
movq 0x80(%rsp), %rsi
leaq 0x288(%rsp), %rdi
callq 0x10b20
jmp 0x3417d
movl $0x0, 0x284(%rsp)
movslq 0x284(%rsp), %rax
movq %rax, 0x78(%rsp)
leaq 0x288(%rsp), %rdi
callq 0xfd50
movq %rax, %rcx
movq 0x78(%rsp), %rax
cmpq %rcx, %rax
jae 0x3430f
movslq 0x284(%rsp), %rsi
leaq 0x288(%rsp), %rdi
callq 0xfbc0
movl (%rax), %eax
movl %eax, 0x280(%rsp)
movl 0x280(%rsp), %eax
movl %eax, %esi
leaq 0x398(%rsp), %rdi
callq 0x10a70
movq %rdx, 0x68(%rsp)
movq %rax, 0x70(%rsp)
jmp 0x341f3
movq 0x68(%rsp), %rax
movq 0x70(%rsp), %rcx
movq %rcx, 0x270(%rsp)
movq %rax, 0x278(%rsp)
leaq 0x270(%rsp), %rdi
callq 0x10c20
xorb $-0x1, %al
testb $0x1, %al
jne 0x34225
jmp 0x342f7
movl 0x280(%rsp), %eax
movl %eax, %esi
leaq 0x398(%rsp), %rdi
callq 0x10a70
movq %rdx, 0x58(%rsp)
movq %rax, 0x60(%rsp)
jmp 0x34247
movq 0x58(%rsp), %rax
movq 0x60(%rsp), %rcx
movq %rcx, 0x260(%rsp)
movq %rax, 0x268(%rsp)
leaq 0x260(%rsp), %rdi
movl $0x1, %esi
callq 0x10ad0
leaq 0x2b8(%rsp), %rdi
leaq 0x280(%rsp), %rsi
callq 0x21d50
jmp 0x3428a
jmp 0x342f7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x470(%rsp)
movl %eax, 0x46c(%rsp)
jmp 0x34464
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x470(%rsp)
movl %eax, 0x46c(%rsp)
jmp 0x34457
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x470(%rsp)
movl %eax, 0x46c(%rsp)
jmp 0x34347
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x470(%rsp)
movl %eax, 0x46c(%rsp)
leaq 0x288(%rsp), %rdi
callq 0x10520
jmp 0x34347
jmp 0x342f9
movl 0x284(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x284(%rsp)
jmp 0x34188
leaq 0x288(%rsp), %rdi
callq 0x10520
jmp 0x340d9
leaq 0x3c0(%rsp), %rdi
leaq 0x30c(%rsp), %rsi
callq 0x3ae40
jmp 0x34338
leaq 0x2b8(%rsp), %rdi
callq 0x21e40
jmp 0x34359
leaq 0x2b8(%rsp), %rdi
callq 0x21e40
jmp 0x34457
jmp 0x3435b
movl 0x324(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x324(%rsp)
jmp 0x33f52
movq 0x498(%rsp), %rax
movq %rax, 0x50(%rsp)
leaq 0x220(%rsp), %rdi
leaq 0x3ec(%rsp), %rsi
leaq 0x3c0(%rsp), %rdx
callq 0x3aee0
jmp 0x3439d
leaq 0x240(%rsp), %rdi
leaq 0x220(%rsp), %rsi
callq 0x1e5b0
jmp 0x343b4
movq 0x50(%rsp), %rsi
leaq 0x208(%rsp), %rdi
leaq 0x240(%rsp), %rdx
callq 0x3aeb0
jmp 0x343d0
leaq 0x240(%rsp), %rdi
callq 0x16f10
leaq 0x220(%rsp), %rdi
callq 0x1e600
leaq 0x328(%rsp), %rdi
callq 0x10520
leaq 0x398(%rsp), %rdi
callq 0x15650
leaq 0x3c0(%rsp), %rdi
callq 0xfc70
jmp 0x34483
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x470(%rsp)
movl %eax, 0x46c(%rsp)
jmp 0x3444a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x470(%rsp)
movl %eax, 0x46c(%rsp)
leaq 0x240(%rsp), %rdi
callq 0x16f10
leaq 0x220(%rsp), %rdi
callq 0x1e600
leaq 0x328(%rsp), %rdi
callq 0x10520
leaq 0x398(%rsp), %rdi
callq 0x15650
leaq 0x3c0(%rsp), %rdi
callq 0xfc70
jmp 0x34728
jmp 0x34485
leaq 0x410(%rsp), %rdi
callq 0x2d760
jmp 0x34494
jmp 0x33cc2
leaq 0x1d5(%rsp), %rdi
movq %rdi, 0x48(%rsp)
callq 0x15450
movq 0x48(%rsp), %r8
leaq 0x1d8(%rsp), %rdi
movl $0xa, %esi
leaq 0x1d7(%rsp), %rdx
leaq 0x1d6(%rsp), %rcx
callq 0x15460
jmp 0x344d4
leaq 0x1d5(%rsp), %rdi
callq 0x154a0
movq 0x498(%rsp), %rdi
callq 0x3acb0
movq %rdx, 0x38(%rsp)
movq %rax, 0x40(%rsp)
jmp 0x344fa
movq 0x38(%rsp), %rax
movq 0x40(%rsp), %rcx
movq %rcx, 0x1c0(%rsp)
movq %rax, 0x1c8(%rsp)
movq 0x498(%rsp), %rdi
callq 0x10710
movq %rdx, 0x28(%rsp)
movq %rax, 0x30(%rsp)
jmp 0x3452d
movq 0x28(%rsp), %rax
movq 0x30(%rsp), %rcx
movq %rcx, 0x1b0(%rsp)
movq %rax, 0x1b8(%rsp)
leaq 0x1c0(%rsp), %rdi
leaq 0x1b0(%rsp), %rsi
callq 0x10630
movb %al, 0x27(%rsp)
jmp 0x34562
movb 0x27(%rsp), %al
testb $0x1, %al
jne 0x3456f
jmp 0x346d5
movq 0x498(%rsp), %rax
addq $0x338, %rax            # imm = 0x338
movq %rax, 0x10(%rsp)
leaq 0x1c0(%rsp), %rdi
callq 0x1e5f0
movq %rax, 0x18(%rsp)
jmp 0x34596
movq 0x18(%rsp), %rsi
movq 0x10(%rsp), %rdi
callq 0xfab0
movq %rax, 0x8(%rsp)
jmp 0x345ac
movq 0x8(%rsp), %rax
movl (%rax), %eax
movl %eax, 0x1ac(%rsp)
leaq 0x1c0(%rsp), %rdi
callq 0x1e5f0
movq %rax, (%rsp)
jmp 0x345cd
movq (%rsp), %rdx
addq $0x8, %rdx
leaq 0x168(%rsp), %rdi
leaq 0x1ac(%rsp), %rsi
callq 0x3aee0
jmp 0x345ec
leaq 0x188(%rsp), %rdi
leaq 0x168(%rsp), %rsi
callq 0x1e5b0
jmp 0x34603
leaq 0x150(%rsp), %rdi
leaq 0x1d8(%rsp), %rsi
leaq 0x188(%rsp), %rdx
callq 0x3aeb0
jmp 0x34622
leaq 0x188(%rsp), %rdi
callq 0x16f10
leaq 0x168(%rsp), %rdi
callq 0x1e600
leaq 0x1c0(%rsp), %rdi
callq 0x3acf0
jmp 0x3464b
jmp 0x34514
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x470(%rsp)
movl %eax, 0x46c(%rsp)
leaq 0x1d5(%rsp), %rdi
callq 0x154a0
jmp 0x34728
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x470(%rsp)
movl %eax, 0x46c(%rsp)
jmp 0x3471b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x470(%rsp)
movl %eax, 0x46c(%rsp)
jmp 0x346c6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x470(%rsp)
movl %eax, 0x46c(%rsp)
leaq 0x188(%rsp), %rdi
callq 0x16f10
leaq 0x168(%rsp), %rdi
callq 0x1e600
jmp 0x3471b
movq 0x498(%rsp), %rdi
leaq 0x1d8(%rsp), %rsi
callq 0x3af20
jmp 0x346ec
leaq 0x1d8(%rsp), %rdi
callq 0x16bf0
leaq 0x438(%rsp), %rdi
callq 0x3af50
leaq 0x478(%rsp), %rdi
callq 0x10520
addq $0x4a8, %rsp            # imm = 0x4A8
retq
leaq 0x1d8(%rsp), %rdi
callq 0x16bf0
leaq 0x438(%rsp), %rdi
callq 0x3af50
leaq 0x478(%rsp), %rdi
callq 0x10520
movq 0x470(%rsp), %rdi
callq 0x9cf0
nop