// File: fjamour[P]icentral/src/qube.cc
// Function: graph_t::insert_edge_update_muc(unsigned int, unsigned int)
void graph_t::insert_edge_update_muc(node_id_t src, node_id_t dst)
{
    muc_id_t src_muc_id = node_to_muc_vec[src];
    muc_id_t dst_muc_id = node_to_muc_vec[dst];
    if(src_muc_id == dst_muc_id) {
        //case 1: both @src and @dst are in the same muc
        //        then just update the graph and the muc graph
        //just update the muc and the graph
        muc_vec[src_muc_id].muc_subgraph.insert_edge(src, dst);
        insert_edge(src, dst);
    } else {
        //case 2: @src and @dst are not in the same muc
        muc_t new_muc;
        vector<node_id_t> shortest_path;
        get_shortest_path(src, dst, shortest_path);
        new_muc.id = muc_vec.size();
        merge_muc_muc(new_muc, muc_vec[dst_muc_id]);
        merge_muc_muc(new_muc, muc_vec[src_muc_id]);
        for(int i = 0; i < shortest_path.size(); ++i) {
            muc_id_t node_muc_id = node_to_muc_vec[shortest_path[i]];
            if(node_muc_id != new_muc.id) {
                merge_muc_muc(new_muc, muc_vec[node_muc_id]);
            }
        }
        new_muc.muc_subgraph.insert_edge(src, dst);
        //cout << endl << endl;
        //new_muc.muc_subgraph.print_graph();
        muc_vec.push_back(new_muc);
        insert_edge(src, dst);
        //TODO updating the connection vertices must be done in a much faster way!
        find_conn_verts();
        find_muc_subgraphs(new_muc.id);
    }   
}

// Assembly:
subq $0x5d8, %rsp            # imm = 0x5D8
movq %rdi, 0x5d0(%rsp)
movl %esi, 0x5cc(%rsp)
movl %edx, 0x5c8(%rsp)
movq 0x5d0(%rsp), %rdi
movq %rdi, 0x20(%rsp)
addq $0x18, %rdi
movl 0x5cc(%rsp), %eax
movl %eax, %esi
callq 0xfbc0
movq 0x20(%rsp), %rdi
movl (%rax), %eax
movl %eax, 0x5c4(%rsp)
addq $0x18, %rdi
movl 0x5c8(%rsp), %eax
movl %eax, %esi
callq 0xfbc0
movl (%rax), %eax
movl %eax, 0x5c0(%rsp)
movl 0x5c4(%rsp), %eax
cmpl 0x5c0(%rsp), %eax
jne 0x688e3
movq 0x20(%rsp), %rdi
addq $0x60, %rdi
movl 0x5c4(%rsp), %eax
movl %eax, %esi
callq 0x4dcb0
movq %rax, %rdi
addq $0x60, %rdi
movl 0x5cc(%rsp), %esi
movl 0x5c8(%rsp), %edx
callq 0x52420
movq 0x20(%rsp), %rdi
movl 0x5cc(%rsp), %esi
movl 0x5c8(%rsp), %edx
callq 0x56720
jmp 0x68ad2
leaq 0x58(%rsp), %rdi
callq 0x660a0
leaq 0x40(%rsp), %rdi
movq %rdi, 0x18(%rsp)
callq 0xfcd0
movq 0x20(%rsp), %rdi
movq 0x18(%rsp), %rcx
movl 0x5cc(%rsp), %esi
movl 0x5c8(%rsp), %edx
callq 0x56f30
jmp 0x6891b
movq 0x20(%rsp), %rdi
addq $0x60, %rdi
movq %rdi, 0x10(%rsp)
callq 0x6e040
movq 0x10(%rsp), %rdi
movl %eax, 0x360(%rsp)
movl 0x5c0(%rsp), %eax
movl %eax, %esi
callq 0x4dcb0
movq 0x20(%rsp), %rdi
movq %rax, %rdx
leaq 0x58(%rsp), %rsi
callq 0x684b0
jmp 0x6895c
movq 0x20(%rsp), %rdi
addq $0x60, %rdi
movl 0x5c4(%rsp), %eax
movl %eax, %esi
callq 0x4dcb0
movq 0x20(%rsp), %rdi
movq %rax, %rdx
leaq 0x58(%rsp), %rsi
callq 0x684b0
jmp 0x68987
movl $0x0, 0x30(%rsp)
movslq 0x30(%rsp), %rax
movq %rax, 0x8(%rsp)
leaq 0x40(%rsp), %rdi
callq 0xfd50
movq %rax, %rcx
movq 0x8(%rsp), %rax
cmpq %rcx, %rax
jae 0x68a53
movq 0x20(%rsp), %rax
addq $0x18, %rax
movq %rax, (%rsp)
movslq 0x30(%rsp), %rsi
leaq 0x40(%rsp), %rdi
callq 0xfbc0
movq (%rsp), %rdi
movl (%rax), %eax
movl %eax, %esi
callq 0xfbc0
movl (%rax), %eax
movl %eax, 0x2c(%rsp)
movl 0x2c(%rsp), %eax
cmpl 0x360(%rsp), %eax
je 0x68a41
movq 0x20(%rsp), %rdi
addq $0x60, %rdi
movl 0x2c(%rsp), %eax
movl %eax, %esi
callq 0x4dcb0
movq 0x20(%rsp), %rdi
movq %rax, %rdx
leaq 0x58(%rsp), %rsi
callq 0x684b0
jmp 0x68a18
jmp 0x68a41
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x38(%rsp)
movl %eax, 0x34(%rsp)
leaq 0x40(%rsp), %rdi
callq 0x10520
leaq 0x58(%rsp), %rdi
callq 0x5faf0
jmp 0x68ada
jmp 0x68a43
movl 0x30(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x30(%rsp)
jmp 0x6898f
leaq 0xb8(%rsp), %rdi
movl 0x5cc(%rsp), %esi
movl 0x5c8(%rsp), %edx
callq 0x52420
jmp 0x68a70
movq 0x20(%rsp), %rdi
addq $0x60, %rdi
leaq 0x58(%rsp), %rsi
callq 0x6e1f0
jmp 0x68a85
movq 0x20(%rsp), %rdi
movl 0x5cc(%rsp), %esi
movl 0x5c8(%rsp), %edx
callq 0x56720
jmp 0x68a9f
movq 0x20(%rsp), %rdi
callq 0x66b30
jmp 0x68aab
movq 0x20(%rsp), %rdi
movl 0x360(%rsp), %esi
callq 0x66f50
jmp 0x68abe
leaq 0x40(%rsp), %rdi
callq 0x10520
leaq 0x58(%rsp), %rdi
callq 0x5faf0
addq $0x5d8, %rsp            # imm = 0x5D8
retq
movq 0x38(%rsp), %rdi
callq 0x9cf0
nopw %cs:(%rax,%rax)