// File: fjamour[P]icentral/src/qube.cc
// Function: muc_t::compute_bc_inc(std::tr1::unordered_map<unsigned int, double, std::tr1::hash<unsigned int>, std::equal_to<unsigned int>, std::allocator<std::pair<unsigned int const, double>>>&, unsigned int, unsigned int, int)
void muc_t::compute_bc_inc(tr1_map_t(double)& bc_map,
                        node_id_t src,
                        node_id_t dst,
                        int max_iter)
{
    if(!valid)
        return;

    muc_fast_subgraph.fill_graph(muc_subgraph);
    tmp_conn_vertex_map.clear();
    tmp_subgraph_map.clear();
    for(conn_vert_map_t::iterator it = conn_vertex_map.begin();
            it != conn_vertex_map.end();
            ++it) {
        node_id_t new_v = muc_fast_subgraph.outin_label_map[it->first];
        tmp_conn_vertex_map.insert(make_pair(new_v, it->second));
    }
    for(subgraph_map_t::iterator it = subgraph_map.begin();
            it != subgraph_map.end();
            ++it) {
        node_id_t new_v = muc_fast_subgraph.outin_label_map[it->first];
        tmp_subgraph_map.insert(make_pair(new_v, it->second));
    }
    
    src = muc_fast_subgraph.outin_label_map[src];
    dst = muc_fast_subgraph.outin_label_map[dst];
    
    //bc_map will have for each vertex in the muc it's betweenness centrality
    muc_fast_subgraph.remove_edge(src, dst);
    vector<int> d_src_vec, d_dst_vec;
    muc_fast_subgraph.find_sssp(src, d_src_vec);
    muc_fast_subgraph.find_sssp(dst, d_dst_vec);
    
    //this must be commented in general.. if it's there it makes bc_map contain deltas
    //bcc_subgraph.i_fill_map<double>(bc_map, 0);
    if(max_iter == -1)
        max_iter = muc_fast_subgraph.nodes_vec.size();
    else
        max_iter = min(max_iter, (int)muc_fast_subgraph.nodes_vec.size());
    for(int i = 0; i < max_iter; ++i) {
        node_id_t s = i;
        if(d_src_vec[s] != d_dst_vec[s]) {
            i_iteration(s, 
                    src, 
                    dst, 
                    d_src_vec[s], 
                    d_dst_vec[s], 
                    bc_map);
        }
    }
    muc_fast_subgraph.insert_edge(src, dst);
}

// Assembly:
subq $0x718, %rsp            # imm = 0x718
movq %rdi, 0x710(%rsp)
movq %rsi, 0x708(%rsp)
movl %edx, 0x704(%rsp)
movl %ecx, 0x700(%rsp)
movl %r8d, 0x6fc(%rsp)
movq 0x710(%rsp), %rax
movq %rax, 0x80(%rsp)
testb $0x1, 0x30c(%rax)
jne 0x6a39b
jmp 0x6a97d
movq 0x80(%rsp), %rsi
movq %rsi, %rdi
addq $0x310, %rdi            # imm = 0x310
addq $0x60, %rsi
callq 0x77eb0
movq 0x80(%rsp), %rdi
addq $0x508, %rdi            # imm = 0x508
callq 0x43350
movq 0x80(%rsp), %rdi
addq $0x538, %rdi            # imm = 0x538
callq 0x5fbd0
movq 0x80(%rsp), %rdi
callq 0x6e360
movq %rax, 0x6e8(%rsp)
movq %rdx, 0x6f0(%rsp)
movq 0x80(%rsp), %rdi
callq 0x6e3c0
movq %rax, 0x6d8(%rsp)
movq %rdx, 0x6e0(%rsp)
leaq 0x6e8(%rsp), %rdi
leaq 0x6d8(%rsp), %rsi
callq 0x6e3a0
testb $0x1, %al
jne 0x6a436
jmp 0x6a557
movq 0x80(%rsp), %rax
addq $0x370, %rax            # imm = 0x370
movq %rax, 0x60(%rsp)
leaq 0x6e8(%rsp), %rdi
movq %rdi, 0x68(%rsp)
callq 0x32f00
movq 0x60(%rsp), %rdi
movq %rax, %rsi
callq 0xfab0
movq 0x68(%rsp), %rdi
movq %rax, %rcx
movq 0x80(%rsp), %rax
movl (%rcx), %ecx
movl %ecx, 0x6d4(%rsp)
addq $0x508, %rax            # imm = 0x508
movq %rax, 0x70(%rsp)
callq 0x32f00
movq %rax, %rdx
addq $0x8, %rdx
leaq 0x690(%rsp), %rdi
movq %rdi, 0x78(%rsp)
leaq 0x6d4(%rsp), %rsi
callq 0x54750
movq 0x78(%rsp), %rsi
leaq 0x6b0(%rsp), %rdi
callq 0x32ec0
jmp 0x6a4c6
movq 0x70(%rsp), %rsi
leaq 0x668(%rsp), %rdi
leaq 0x6b0(%rsp), %rdx
callq 0x54720
jmp 0x6a4e2
leaq 0x6b0(%rsp), %rdi
callq 0x32f10
leaq 0x690(%rsp), %rdi
callq 0x32f30
leaq 0x6e8(%rsp), %rdi
callq 0x6e4d0
jmp 0x6a3fb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x688(%rsp)
movl %eax, 0x684(%rsp)
jmp 0x6a545
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x688(%rsp)
movl %eax, 0x684(%rsp)
leaq 0x6b0(%rsp), %rdi
callq 0x32f10
leaq 0x690(%rsp), %rdi
callq 0x32f30
jmp 0x6a985
movq 0x80(%rsp), %rdi
addq $0x30, %rdi
callq 0x6e900
movq %rax, 0x658(%rsp)
movq %rdx, 0x660(%rsp)
movq 0x80(%rsp), %rdi
addq $0x30, %rdi
callq 0x6e960
movq %rax, 0x648(%rsp)
movq %rdx, 0x650(%rsp)
leaq 0x658(%rsp), %rdi
leaq 0x648(%rsp), %rsi
callq 0x6e940
testb $0x1, %al
jne 0x6a5b7
jmp 0x6a6d8
movq 0x80(%rsp), %rax
addq $0x370, %rax            # imm = 0x370
movq %rax, 0x40(%rsp)
leaq 0x658(%rsp), %rdi
movq %rdi, 0x48(%rsp)
callq 0x6e9a0
movq 0x40(%rsp), %rdi
movq %rax, %rsi
callq 0xfab0
movq 0x48(%rsp), %rdi
movq %rax, %rcx
movq 0x80(%rsp), %rax
movl (%rcx), %ecx
movl %ecx, 0x644(%rsp)
addq $0x538, %rax            # imm = 0x538
movq %rax, 0x50(%rsp)
callq 0x6e9a0
movq %rax, %rdx
addq $0x8, %rdx
leaq 0xe0(%rsp), %rdi
movq %rdi, 0x58(%rsp)
leaq 0x644(%rsp), %rsi
callq 0x6e430
movq 0x58(%rsp), %rsi
leaq 0x390(%rsp), %rdi
callq 0x6e470
jmp 0x6a647
movq 0x50(%rsp), %rsi
leaq 0xc8(%rsp), %rdi
leaq 0x390(%rsp), %rdx
callq 0x6e400
jmp 0x6a663
leaq 0x390(%rsp), %rdi
callq 0x5feb0
leaq 0xe0(%rsp), %rdi
callq 0x6e4b0
leaq 0x658(%rsp), %rdi
callq 0x6e9b0
jmp 0x6a578
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x688(%rsp)
movl %eax, 0x684(%rsp)
jmp 0x6a6c6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x688(%rsp)
movl %eax, 0x684(%rsp)
leaq 0x390(%rsp), %rdi
callq 0x5feb0
leaq 0xe0(%rsp), %rdi
callq 0x6e4b0
jmp 0x6a985
movq 0x80(%rsp), %rdi
movq %rdi, %rax
addq $0x310, %rax            # imm = 0x310
movq %rax, 0x30(%rsp)
addq $0x370, %rdi            # imm = 0x370
movq %rdi, 0x28(%rsp)
leaq 0x704(%rsp), %rsi
callq 0xfab0
movq 0x28(%rsp), %rdi
movl (%rax), %eax
movl %eax, 0x704(%rsp)
leaq 0x700(%rsp), %rsi
callq 0xfab0
movq 0x30(%rsp), %rdi
movl (%rax), %eax
movl %eax, 0x700(%rsp)
movl 0x704(%rsp), %esi
movl 0x700(%rsp), %edx
callq 0x77220
leaq 0xb0(%rsp), %rdi
movq %rdi, 0x38(%rsp)
callq 0xfc40
leaq 0x98(%rsp), %rdi
callq 0xfc40
movq 0x30(%rsp), %rdi
movq 0x38(%rsp), %rdx
movl 0x704(%rsp), %esi
callq 0x77ae0
jmp 0x6a77a
movq 0x80(%rsp), %rdi
addq $0x310, %rdi            # imm = 0x310
movl 0x700(%rsp), %esi
leaq 0x98(%rsp), %rdx
callq 0x77ae0
jmp 0x6a79f
cmpl $-0x1, 0x6fc(%rsp)
jne 0x6a7f9
movq 0x80(%rsp), %rdi
addq $0x310, %rdi            # imm = 0x310
callq 0x1ac90
movl %eax, 0x6fc(%rsp)
jmp 0x6a83e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x688(%rsp)
movl %eax, 0x684(%rsp)
leaq 0x98(%rsp), %rdi
callq 0xfc70
leaq 0xb0(%rsp), %rdi
callq 0xfc70
jmp 0x6a985
movq 0x80(%rsp), %rdi
addq $0x310, %rdi            # imm = 0x310
callq 0x1ac90
movl %eax, 0x94(%rsp)
leaq 0x6fc(%rsp), %rdi
leaq 0x94(%rsp), %rsi
callq 0x2d1a0
movq %rax, 0x20(%rsp)
jmp 0x6a830
movq 0x20(%rsp), %rax
movl (%rax), %eax
movl %eax, 0x6fc(%rsp)
movl $0x0, 0x90(%rsp)
movl 0x90(%rsp), %eax
cmpl 0x6fc(%rsp), %eax
jge 0x6a93f
movl 0x90(%rsp), %eax
movl %eax, 0x8c(%rsp)
movl 0x8c(%rsp), %eax
movl %eax, %esi
leaq 0xb0(%rsp), %rdi
callq 0xfc50
movl (%rax), %eax
movl %eax, 0x1c(%rsp)
movl 0x8c(%rsp), %eax
movl %eax, %esi
leaq 0x98(%rsp), %rdi
callq 0xfc50
movq %rax, %rcx
movl 0x1c(%rsp), %eax
cmpl (%rcx), %eax
je 0x6a927
movl 0x8c(%rsp), %eax
movl %eax, 0xc(%rsp)
movl 0x704(%rsp), %ecx
movl %ecx, 0x10(%rsp)
movl 0x700(%rsp), %ecx
movl %ecx, 0x14(%rsp)
movl %eax, %esi
leaq 0xb0(%rsp), %rdi
callq 0xfc50
movl (%rax), %eax
movl %eax, 0x18(%rsp)
movl 0x8c(%rsp), %eax
movl %eax, %esi
leaq 0x98(%rsp), %rdi
callq 0xfc50
movq 0x80(%rsp), %rdi
movl 0xc(%rsp), %esi
movl 0x10(%rsp), %edx
movl 0x14(%rsp), %ecx
movl 0x18(%rsp), %r8d
movl (%rax), %r9d
movq 0x708(%rsp), %r10
movq %rsp, %rax
movq %r10, (%rax)
callq 0x6a9a0
jmp 0x6a925
jmp 0x6a927
jmp 0x6a929
movl 0x90(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x90(%rsp)
jmp 0x6a849
movq 0x80(%rsp), %rdi
addq $0x310, %rdi            # imm = 0x310
movl 0x704(%rsp), %esi
movl 0x700(%rsp), %edx
callq 0x770e0
jmp 0x6a963
leaq 0x98(%rsp), %rdi
callq 0xfc70
leaq 0xb0(%rsp), %rdi
callq 0xfc70
addq $0x718, %rsp            # imm = 0x718
retq
movq 0x688(%rsp), %rdi
callq 0x9cf0
nopw %cs:(%rax,%rax)