// File: fjamour[P]icentral/src/unit_tests.h
// Function: test__Update_BC_mem()
bool test__Update_BC_mem()
{
    bool passed = false;
    printf("Testing [Update_BC_mem] ...\t");
    vector<double> BC_vec;
    graph_t g;
    
    
    edge_t e = make_pair(0, 2);
    //fill_test_graph(g);
    g.read_graph(string("Erdos02.lcc.net"));
    e = *(g.edge_set.begin());
    g.remove_edge(e.first, e.second);
    
    printf("(%d, %d)\n", e.first, e.second);
    
    
    vector<iter_info_t> iter_info_vec;
    component_t comp;
    comp.comp_type = GRAPH;
    comp.subgraph.fill_graph(g);
    vector<double> dummy_BC_vec;
    dummy_BC_vec.resize(g.size());
    for (node_id_t s = 0; s < g.size(); ++s) {
        iter_info_t iter_info;
        iter_info.init_all(g.size());
        BBFS(iter_info, comp, s);
        RBFS(dummy_BC_vec, comp, s, iter_info, false, false);
        iter_info_vec.push_back(iter_info);
    }
    
    fast_brandes_BC(g, BC_vec);
    Update_BC_mem(BC_vec, g, GRAPH, e, iter_info_vec);
    
    g.insert_edge(e.first, e.second);
    vector<double> ref_BC_vec = brandes_bc(g);
    passed = true;
    for(node_id_t v = 0; v < BC_vec.size(); ++v) {
        if(abs((BC_vec[v] - ref_BC_vec[v])) > EPS) {
            passed = false;
            printf("(%d) --\t[%f]\t\t[%f]\n", v, BC_vec[v], ref_BC_vec[v]);
        }
        //printf("(%d) --\t[%f]\t\t[%f]\n", v, BC_vec[v], ref_BC_vec[v]);
    }
    if(passed) {
        printf("PASSED\n");
    } else {
        printf("FAILED\n");
    }
    return passed;
}

// Assembly:
subq $0x5a8, %rsp            # imm = 0x5A8
movb $0x0, 0x5a7(%rsp)
leaq 0x201d5(%rip), %rdi     # 0x7bddb
xorl %eax, %eax
callq 0x9040
leaq 0x588(%rsp), %rdi
callq 0xfa00
leaq 0x460(%rsp), %rdi
callq 0x5eda0
jmp 0x5bc29
movl $0x0, 0x440(%rsp)
movl $0x2, 0x43c(%rsp)
leaq 0x440(%rsp), %rdi
leaq 0x43c(%rsp), %rsi
callq 0x5f060
movq %rax, 0x58(%rsp)
jmp 0x5bc5b
movq 0x58(%rsp), %rax
movq %rax, 0x444(%rsp)
leaq 0x44c(%rsp), %rdi
leaq 0x444(%rsp), %rsi
callq 0x5f090
jmp 0x5bc7f
leaq 0x417(%rsp), %rdi
movq %rdi, 0x50(%rsp)
callq 0x9d00
movq 0x50(%rsp), %rdx
leaq 0x2006d(%rip), %rsi     # 0x7bd0a
leaq 0x418(%rsp), %rdi
callq 0x5ef00
jmp 0x5bcac
leaq 0x460(%rsp), %rdi
leaq 0x418(%rsp), %rsi
callq 0x56b50
jmp 0x5bcc3
leaq 0x418(%rsp), %rdi
callq 0x9410
leaq 0x417(%rsp), %rdi
callq 0x97d0
leaq 0x490(%rsp), %rdi
callq 0x420d0
movq %rax, 0x408(%rsp)
leaq 0x408(%rsp), %rdi
callq 0x42100
movq %rax, %rsi
leaq 0x44c(%rsp), %rdi
callq 0x41e30
jmp 0x5bd11
movl 0x44c(%rsp), %esi
movl 0x450(%rsp), %edx
leaq 0x460(%rsp), %rdi
callq 0x56850
jmp 0x5bd2e
movl 0x44c(%rsp), %esi
movl 0x450(%rsp), %edx
leaq 0x1f668(%rip), %rdi     # 0x7b3ab
xorl %eax, %eax
callq 0x9040
jmp 0x5bd4c
leaq 0x3f0(%rsp), %rdi
callq 0x5f200
leaq 0x1c0(%rsp), %rdi
callq 0xf7c0
jmp 0x5bd68
movl $0x2, 0x3e8(%rsp)
leaq 0x1c0(%rsp), %rdi
leaq 0x460(%rsp), %rsi
callq 0x78110
jmp 0x5bd8a
leaq 0x1a8(%rsp), %rdi
callq 0xfa00
leaq 0x460(%rsp), %rdi
callq 0x56b40
movq %rax, 0x48(%rsp)
jmp 0x5bdab
movq 0x48(%rsp), %rsi
leaq 0x1a8(%rsp), %rdi
callq 0xf680
jmp 0x5bdbf
movl $0x0, 0x1a4(%rsp)
movl 0x1a4(%rsp), %eax
movq %rax, 0x38(%rsp)
leaq 0x460(%rsp), %rdi
callq 0x56b40
movq %rax, 0x40(%rsp)
jmp 0x5bdea
movq 0x38(%rsp), %rax
movq 0x40(%rsp), %rcx
cmpq %rcx, %rax
jae 0x5bfa2
leaq 0x88(%rsp), %rdi
callq 0xf850
leaq 0x460(%rsp), %rdi
callq 0x56b40
movq %rax, 0x30(%rsp)
jmp 0x5be1e
movq 0x30(%rsp), %rsi
leaq 0x88(%rsp), %rdi
callq 0x59910
jmp 0x5be32
movl 0x1a4(%rsp), %edx
leaq 0x88(%rsp), %rdi
leaq 0x1c0(%rsp), %rsi
callq 0xb790
jmp 0x5be50
movl 0x1a4(%rsp), %edx
leaq 0x1a8(%rsp), %rdi
leaq 0x1c0(%rsp), %rsi
leaq 0x88(%rsp), %rcx
xorl %r9d, %r9d
movl %r9d, %r8d
callq 0xba90
jmp 0x5be7c
leaq 0x3f0(%rsp), %rdi
leaq 0x88(%rsp), %rsi
callq 0x5f210
jmp 0x5be93
leaq 0x88(%rsp), %rdi
callq 0xf910
movl 0x1a4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1a4(%rsp)
jmp 0x5bdca
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x458(%rsp)
movl %eax, 0x454(%rsp)
jmp 0x5c212
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x458(%rsp)
movl %eax, 0x454(%rsp)
jmp 0x5c205
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x458(%rsp)
movl %eax, 0x454(%rsp)
jmp 0x5bf1f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x458(%rsp)
movl %eax, 0x454(%rsp)
leaq 0x418(%rsp), %rdi
callq 0x9410
leaq 0x417(%rsp), %rdi
callq 0x97d0
jmp 0x5c205
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x458(%rsp)
movl %eax, 0x454(%rsp)
jmp 0x5c1f8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x458(%rsp)
movl %eax, 0x454(%rsp)
jmp 0x5c1eb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x458(%rsp)
movl %eax, 0x454(%rsp)
jmp 0x5c1de
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x458(%rsp)
movl %eax, 0x454(%rsp)
leaq 0x88(%rsp), %rdi
callq 0xf910
jmp 0x5c1de
leaq 0x460(%rsp), %rdi
leaq 0x588(%rsp), %rsi
callq 0xa2d0
jmp 0x5bfb9
movq 0x44c(%rsp), %rax
movq %rax, 0x80(%rsp)
movq 0x80(%rsp), %rcx
leaq 0x588(%rsp), %rdi
leaq 0x460(%rsp), %rsi
movl $0x2, %edx
leaq 0x3f0(%rsp), %r8
callq 0x1fb10
jmp 0x5bff5
movl 0x44c(%rsp), %esi
movl 0x450(%rsp), %edx
leaq 0x460(%rsp), %rdi
callq 0x56720
jmp 0x5c012
leaq 0x68(%rsp), %rdi
leaq 0x460(%rsp), %rsi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x28720
jmp 0x5c02b
movb $0x1, 0x5a7(%rsp)
movl $0x0, 0x64(%rsp)
movl 0x64(%rsp), %eax
movq %rax, 0x28(%rsp)
leaq 0x588(%rsp), %rdi
callq 0xfa10
movq %rax, %rcx
movq 0x28(%rsp), %rax
cmpq %rcx, %rax
jae 0x5c14c
movl 0x64(%rsp), %eax
movl %eax, %esi
leaq 0x588(%rsp), %rdi
callq 0xfa30
movsd (%rax), %xmm0
movsd %xmm0, 0x18(%rsp)
movl 0x64(%rsp), %eax
movl %eax, %esi
leaq 0x68(%rsp), %rdi
callq 0xfa30
movsd 0x18(%rsp), %xmm0
movsd (%rax), %xmm1
subsd %xmm1, %xmm0
callq 0x5f0c0
movsd %xmm0, 0x20(%rsp)
jmp 0x5c0aa
movsd 0x20(%rsp), %xmm0
movsd 0x1fc20(%rip), %xmm1    # 0x7bcd8
ucomisd %xmm1, %xmm0
jbe 0x5c13a
movb $0x0, 0x5a7(%rsp)
movl 0x64(%rsp), %eax
movl %eax, 0xc(%rsp)
movl %eax, %esi
leaq 0x588(%rsp), %rdi
callq 0xfa30
movsd (%rax), %xmm0
movsd %xmm0, 0x10(%rsp)
movl 0x64(%rsp), %eax
movl %eax, %esi
leaq 0x68(%rsp), %rdi
callq 0xfa30
movl 0xc(%rsp), %esi
movsd 0x10(%rsp), %xmm0
movsd (%rax), %xmm1
leaq 0x1fc4f(%rip), %rdi     # 0x7bd5b
movb $0x2, %al
callq 0x9040
jmp 0x5c115
jmp 0x5c13a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x458(%rsp)
movl %eax, 0x454(%rsp)
leaq 0x68(%rsp), %rdi
callq 0xfa50
jmp 0x5c1de
jmp 0x5c13c
movl 0x64(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x64(%rsp)
jmp 0x5c03b
testb $0x1, 0x5a7(%rsp)
je 0x5c168
leaq 0x1fbbd(%rip), %rdi     # 0x7bd1a
xorl %eax, %eax
callq 0x9040
jmp 0x5c166
jmp 0x5c17a
leaq 0x1fbb3(%rip), %rdi     # 0x7bd22
xorl %eax, %eax
callq 0x9040
jmp 0x5c178
jmp 0x5c17a
movb 0x5a7(%rsp), %al
movb %al, 0xb(%rsp)
leaq 0x68(%rsp), %rdi
callq 0xfa50
leaq 0x1a8(%rsp), %rdi
callq 0xfa50
leaq 0x1c0(%rsp), %rdi
callq 0xf9d0
leaq 0x3f0(%rsp), %rdi
callq 0x5f290
leaq 0x460(%rsp), %rdi
callq 0x5efc0
leaq 0x588(%rsp), %rdi
callq 0xfa50
movb 0xb(%rsp), %al
andb $0x1, %al
addq $0x5a8, %rsp            # imm = 0x5A8
retq
leaq 0x1a8(%rsp), %rdi
callq 0xfa50
leaq 0x1c0(%rsp), %rdi
callq 0xf9d0
leaq 0x3f0(%rsp), %rdi
callq 0x5f290
leaq 0x460(%rsp), %rdi
callq 0x5efc0
leaq 0x588(%rsp), %rdi
callq 0xfa50
movq 0x458(%rsp), %rdi
callq 0x9cf0
nopl (%rax)