// File: fjamour[P]icentral/src/bicon.cc
// Function: graph_t::i_bcc_dfs_visitor(unsigned int, std::vector<int, std::allocator<int>>&, std::vector<int, std::allocator<int>>&, std::vector<int, std::allocator<int>>&, std::vector<unsigned int, std::allocator<unsigned int>>&, std::stack<std::pair<unsigned int, unsigned int>, std::deque<std::pair<unsigned int, unsigned int>, std::allocator<std::pair<unsigned int, unsigned int>>>>&, int&, std::vector<graph_hash_t, std::allocator<graph_hash_t>>&)
void graph_t::i_bcc_dfs_visitor(node_id_t u,
                                    vector<int>& color_vec,
                                    vector<int>& low_vec,
                                    vector<int>& d_vec,
                                    vector<node_id_t>& pred_vec,
                                    stack<edge_t>& edge_stack,
                                    int& time,
                                    vector<graph_hash_t>& bcc_vec)
{
    color_vec[u] = 1;           //1 means grey
    d_vec[u] = ++time;
    low_vec[u] = d_vec[u];
    vector<node_id_t> nbr_vec = get_nbrs(u);
    int tree_edge_cnt = 0;
    for(int i = 0; i < nbr_vec.size(); ++i) {
        node_id_t v = nbr_vec[i];
        if(color_vec[v] == 0) { // (u, v) is a tree edge
            edge_stack.push(make_pair(u, v));
            pred_vec[v] = u;
            tree_edge_cnt++;
            i_bcc_dfs_visitor(v,
                    color_vec,
                    low_vec,
                    d_vec,
                    pred_vec,
                    edge_stack,
                    time,
                    bcc_vec);
            low_vec[u] = min(low_vec[u], low_vec[v]);
            if(low_vec[v] >= d_vec[u]) {
                // u is an articulation point, ready to output a bcc
                edge_t last_edge = make_pair(u, v);
                edge_t e;
                graph_hash_t bcc;
                do {
                    e = edge_stack.top();
                    edge_stack.pop();
                    bcc.insert_edge(e.first, e.second);
                } while(e != last_edge);
                bcc_vec.push_back(bcc);
            }
        } else if(v != pred_vec[u] && d_vec[v] < d_vec[u]) {   // (u, v) is a back edge
            edge_stack.push(make_pair(u, v));
            low_vec[u] = min(low_vec[u], d_vec[v]);
        }
    }
}

// Assembly:
pushq %rbx
subq $0x3e0, %rsp            # imm = 0x3E0
movq 0x400(%rsp), %rax
movq 0x3f8(%rsp), %rax
movq 0x3f0(%rsp), %rax
movq %rdi, 0x3d8(%rsp)
movl %esi, 0x3d4(%rsp)
movq %rdx, 0x3c8(%rsp)
movq %rcx, 0x3c0(%rsp)
movq %r8, 0x3b8(%rsp)
movq %r9, 0x3b0(%rsp)
movq 0x3d8(%rsp), %rax
movq %rax, 0xa8(%rsp)
movq 0x3c8(%rsp), %rdi
movl 0x3d4(%rsp), %eax
movl %eax, %esi
callq 0xfc50
movl $0x1, (%rax)
movq 0x3f8(%rsp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0xa0(%rsp)
movl %ecx, (%rax)
movq 0x3b8(%rsp), %rdi
movl 0x3d4(%rsp), %eax
movl %eax, %esi
callq 0xfc50
movl 0xa0(%rsp), %ecx
movl %ecx, (%rax)
movq 0x3b8(%rsp), %rdi
movl 0x3d4(%rsp), %eax
movl %eax, %esi
callq 0xfc50
movl (%rax), %eax
movl %eax, 0xa4(%rsp)
movq 0x3c0(%rsp), %rdi
movl 0x3d4(%rsp), %eax
movl %eax, %esi
callq 0xfc50
movl 0xa4(%rsp), %ecx
movq 0xa8(%rsp), %rdi
movl %ecx, (%rax)
movl 0x3d4(%rsp), %esi
callq 0x566f0
movq %rax, %rsi
leaq 0x398(%rsp), %rdi
callq 0x10b20
movl $0x0, 0x394(%rsp)
movl $0x0, 0x390(%rsp)
movslq 0x390(%rsp), %rax
movq %rax, 0x98(%rsp)
leaq 0x398(%rsp), %rdi
callq 0xfd50
movq %rax, %rcx
movq 0x98(%rsp), %rax
cmpq %rcx, %rax
jae 0x40981
movslq 0x390(%rsp), %rsi
leaq 0x398(%rsp), %rdi
callq 0xfbc0
movl (%rax), %eax
movl %eax, 0x38c(%rsp)
movq 0x3c8(%rsp), %rdi
movl 0x38c(%rsp), %eax
movl %eax, %esi
callq 0xfc50
cmpl $0x0, (%rax)
jne 0x40840
movq 0x3f0(%rsp), %rax
movq %rax, 0x88(%rsp)
leaq 0x3d4(%rsp), %rdi
leaq 0x38c(%rsp), %rsi
callq 0x41730
movq %rax, 0x90(%rsp)
jmp 0x405a5
movq 0x88(%rsp), %rdi
movq 0x90(%rsp), %rax
movq %rax, 0x384(%rsp)
leaq 0x384(%rsp), %rsi
callq 0x41700
jmp 0x405cc
movl 0x3d4(%rsp), %eax
movl %eax, 0x84(%rsp)
movq 0x3b0(%rsp), %rdi
movl 0x38c(%rsp), %eax
movl %eax, %esi
callq 0xfbc0
movl 0x84(%rsp), %ecx
movq 0xa8(%rsp), %rdi
movl %ecx, (%rax)
movl 0x394(%rsp), %eax
incl %eax
movl %eax, 0x394(%rsp)
movl 0x38c(%rsp), %esi
movq 0x3c8(%rsp), %rdx
movq 0x3c0(%rsp), %rcx
movq 0x3b8(%rsp), %r8
movq 0x3b0(%rsp), %r9
movq 0x3f0(%rsp), %r10
movq 0x3f8(%rsp), %r11
movq 0x400(%rsp), %rbx
movq %rsp, %rax
movq %rbx, 0x10(%rax)
movq %r11, 0x8(%rax)
movq %r10, (%rax)
callq 0x403e0
jmp 0x40665
movq 0x3c0(%rsp), %rdi
movl 0x3d4(%rsp), %eax
movl %eax, %esi
callq 0xfc50
movq %rax, 0x70(%rsp)
movq 0x3c0(%rsp), %rdi
movl 0x38c(%rsp), %eax
movl %eax, %esi
callq 0xfc50
movq 0x70(%rsp), %rdi
movq %rax, %rsi
callq 0x2d1a0
movq %rax, 0x78(%rsp)
jmp 0x406aa
movq 0x78(%rsp), %rax
movl (%rax), %eax
movl %eax, 0x68(%rsp)
movq 0x3c0(%rsp), %rdi
movl 0x3d4(%rsp), %eax
movl %eax, %esi
callq 0xfc50
movl 0x68(%rsp), %ecx
movl %ecx, (%rax)
movq 0x3c0(%rsp), %rdi
movl 0x38c(%rsp), %eax
movl %eax, %esi
callq 0xfc50
movl (%rax), %eax
movl %eax, 0x6c(%rsp)
movq 0x3b8(%rsp), %rdi
movl 0x3d4(%rsp), %eax
movl %eax, %esi
callq 0xfc50
movq %rax, %rcx
movl 0x6c(%rsp), %eax
cmpl (%rcx), %eax
jl 0x4083b
leaq 0x3d4(%rsp), %rdi
leaq 0x38c(%rsp), %rsi
callq 0x41730
movq %rax, 0x60(%rsp)
jmp 0x4072e
movq 0x60(%rsp), %rax
movq %rax, 0x36c(%rsp)
leaq 0x364(%rsp), %rdi
callq 0x41760
jmp 0x4074a
leaq 0xb8(%rsp), %rdi
callq 0x41780
jmp 0x40759
jmp 0x4075b
movq 0x3f0(%rsp), %rdi
callq 0x41e20
movq %rax, 0x58(%rsp)
jmp 0x4076f
movq 0x58(%rsp), %rsi
leaq 0x364(%rsp), %rdi
callq 0x41e30
jmp 0x40783
movq 0x3f0(%rsp), %rdi
callq 0x41e60
jmp 0x40792
movl 0x364(%rsp), %esi
movl 0x368(%rsp), %edx
leaq 0xb8(%rsp), %rdi
callq 0x52420
jmp 0x407af
jmp 0x407b1
leaq 0x364(%rsp), %rdi
leaq 0x36c(%rsp), %rsi
callq 0x41e70
movb %al, 0x57(%rsp)
jmp 0x407cc
movb 0x57(%rsp), %al
testb $0x1, %al
jne 0x4075b
jmp 0x407d6
movq 0x400(%rsp), %rdi
leaq 0xb8(%rsp), %rsi
callq 0x41ea0
jmp 0x407ed
leaq 0xb8(%rsp), %rdi
callq 0x41f20
jmp 0x4083b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x378(%rsp)
movl %eax, 0x374(%rsp)
jmp 0x40997
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x378(%rsp)
movl %eax, 0x374(%rsp)
leaq 0xb8(%rsp), %rdi
callq 0x41f20
jmp 0x40997
jmp 0x40969
movl 0x38c(%rsp), %eax
movl %eax, 0x50(%rsp)
movq 0x3b0(%rsp), %rdi
movl 0x3d4(%rsp), %eax
movl %eax, %esi
callq 0xfbc0
movq %rax, %rcx
movl 0x50(%rsp), %eax
cmpl (%rcx), %eax
je 0x40967
movq 0x3b8(%rsp), %rdi
movl 0x38c(%rsp), %eax
movl %eax, %esi
callq 0xfc50
movl (%rax), %eax
movl %eax, 0x4c(%rsp)
movq 0x3b8(%rsp), %rdi
movl 0x3d4(%rsp), %eax
movl %eax, %esi
callq 0xfc50
movq %rax, %rcx
movl 0x4c(%rsp), %eax
cmpl (%rcx), %eax
jge 0x40967
movq 0x3f0(%rsp), %rax
movq %rax, 0x38(%rsp)
leaq 0x3d4(%rsp), %rdi
leaq 0x38c(%rsp), %rsi
callq 0x41730
movq %rax, 0x40(%rsp)
jmp 0x408da
movq 0x38(%rsp), %rdi
movq 0x40(%rsp), %rax
movq %rax, 0xb0(%rsp)
leaq 0xb0(%rsp), %rsi
callq 0x41700
jmp 0x408fb
movq 0x3c0(%rsp), %rdi
movl 0x3d4(%rsp), %eax
movl %eax, %esi
callq 0xfc50
movq %rax, 0x28(%rsp)
movq 0x3b8(%rsp), %rdi
movl 0x38c(%rsp), %eax
movl %eax, %esi
callq 0xfc50
movq 0x28(%rsp), %rdi
movq %rax, %rsi
callq 0x2d1a0
movq %rax, 0x30(%rsp)
jmp 0x40940
movq 0x30(%rsp), %rax
movl (%rax), %eax
movl %eax, 0x24(%rsp)
movq 0x3c0(%rsp), %rdi
movl 0x3d4(%rsp), %eax
movl %eax, %esi
callq 0xfc50
movl 0x24(%rsp), %ecx
movl %ecx, (%rax)
jmp 0x40969
jmp 0x4096b
movl 0x390(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x390(%rsp)
jmp 0x40508
leaq 0x398(%rsp), %rdi
callq 0x10520
addq $0x3e0, %rsp            # imm = 0x3E0
popq %rbx
retq
leaq 0x398(%rsp), %rdi
callq 0x10520
movq 0x378(%rsp), %rdi
callq 0x9cf0
nopw %cs:(%rax,%rax)