// File: fjamour[P]icentral/src/bc.cc
// Function: incremental_brandes_experimental(graph_t&, unsigned int, unsigned int, std::vector<double, std::allocator<double>>&, std::vector<double, std::allocator<double>>&, std::vector<int, std::allocator<int>>&)
void incremental_brandes_experimental(graph_t& graph_in,
        node_id_t src,
        node_id_t dst,
        vector<double>& bc_vec,
        vector<double>& time_vec,
        vector<int>&    cnt_vec)
{
    vector<int> d_src_vec, d_dst_vec;
    d_src_vec.resize(graph_in.size());
    d_dst_vec.resize(graph_in.size());
    fill(d_src_vec.begin(), d_src_vec.end(), -1);
    fill(d_dst_vec.begin(), d_dst_vec.end(), -1);
    graph_in.find_sssp(src, d_src_vec);
    graph_in.find_sssp(dst, d_dst_vec);
    
    //fill(bc_vec.begin(), bc_vec.end(), 0);
    
    int    cnt_arr[] = {0,0,0};
    double tot_arr[] = {0,0,0};
    for(node_id_t s = 0; s < graph_in.size(); ++s) {
        timer tm;
        tm.start();
        if(d_src_vec[s] != d_dst_vec[s]) { 
            brandes_delta_iter(graph_in,
                    s, 
                    src, 
                    dst, 
                    d_src_vec[s], 
                    d_dst_vec[s], 
                    bc_vec);
        }
        tm.stop();
        int diff = d_src_vec[s] - d_dst_vec[s];
        int abs_diff = abs(diff);
        switch(abs_diff) {
            case 0:
                cnt_arr[0]++;
                tot_arr[0]+=tm.interval();
                break;
            case 1:
                cnt_arr[1]++;
                tot_arr[1]+=tm.interval();
                break;
            default:
                cnt_arr[2]++;
                tot_arr[2]+=tm.interval();
        }
    }
    cnt_vec.insert(cnt_vec.begin(), cnt_arr, cnt_arr+3);
    time_vec.insert(time_vec.begin(), tot_arr, tot_arr+3);
}

// Assembly:
subq $0x1b8, %rsp            # imm = 0x1B8
movq %rdi, 0x1b0(%rsp)
movl %esi, 0x1ac(%rsp)
movl %edx, 0x1a8(%rsp)
movq %rcx, 0x1a0(%rsp)
movq %r8, 0x198(%rsp)
movq %r9, 0x190(%rsp)
leaq 0x178(%rsp), %rdi
callq 0xfc40
leaq 0x160(%rsp), %rdi
callq 0xfc40
movq 0x1b0(%rsp), %rdi
callq 0x56b40
movq %rax, 0x98(%rsp)
jmp 0x2c026
movq 0x98(%rsp), %rsi
leaq 0x178(%rsp), %rdi
callq 0x2cfc0
jmp 0x2c03d
movq 0x1b0(%rsp), %rdi
callq 0x56b40
movq %rax, 0x90(%rsp)
jmp 0x2c054
movq 0x90(%rsp), %rsi
leaq 0x160(%rsp), %rdi
callq 0x2cfc0
jmp 0x2c06b
leaq 0x178(%rsp), %rdi
movq %rdi, 0x88(%rsp)
callq 0x109f0
movq 0x88(%rsp), %rdi
movq %rax, 0x148(%rsp)
callq 0x10a20
movq %rax, 0x140(%rsp)
movl $0xffffffff, 0x13c(%rsp) # imm = 0xFFFFFFFF
movq 0x148(%rsp), %rdi
movq 0x140(%rsp), %rsi
leaq 0x13c(%rsp), %rdx
callq 0x21f20
jmp 0x2c0c7
leaq 0x160(%rsp), %rdi
movq %rdi, 0x80(%rsp)
callq 0x109f0
movq 0x80(%rsp), %rdi
movq %rax, 0x130(%rsp)
callq 0x10a20
movq %rax, 0x128(%rsp)
movl $0xffffffff, 0x124(%rsp) # imm = 0xFFFFFFFF
movq 0x130(%rsp), %rdi
movq 0x128(%rsp), %rsi
leaq 0x124(%rsp), %rdx
callq 0x21f20
jmp 0x2c123
movq 0x1b0(%rsp), %rdi
movl 0x1ac(%rsp), %esi
leaq 0x178(%rsp), %rdx
callq 0x57410
jmp 0x2c141
movq 0x1b0(%rsp), %rdi
movl 0x1a8(%rsp), %esi
leaq 0x160(%rsp), %rdx
callq 0x57410
jmp 0x2c15f
leaq 0x118(%rsp), %rdi
xorl %esi, %esi
movl $0xc, %edx
callq 0x9350
leaq 0x100(%rsp), %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x9350
movl $0x0, 0xfc(%rsp)
movl 0xfc(%rsp), %eax
movq %rax, 0x70(%rsp)
movq 0x1b0(%rsp), %rdi
callq 0x56b40
movq %rax, 0x78(%rsp)
jmp 0x2c1b2
movq 0x70(%rsp), %rax
movq 0x78(%rsp), %rcx
cmpq %rcx, %rax
jae 0x2c428
leaq 0xd8(%rsp), %rdi
callq 0x2d430
jmp 0x2c1d4
movl 0xfc(%rsp), %eax
movl %eax, %esi
leaq 0x178(%rsp), %rdi
callq 0xfc50
movl (%rax), %eax
movl %eax, 0x6c(%rsp)
movl 0xfc(%rsp), %eax
movl %eax, %esi
leaq 0x160(%rsp), %rdi
callq 0xfc50
movq %rax, %rcx
movl 0x6c(%rsp), %eax
cmpl (%rcx), %eax
je 0x2c2d1
movq 0x1b0(%rsp), %rax
movq %rax, 0x50(%rsp)
movl 0xfc(%rsp), %eax
movl %eax, 0x5c(%rsp)
movl 0x1ac(%rsp), %ecx
movl %ecx, 0x60(%rsp)
movl 0x1a8(%rsp), %ecx
movl %ecx, 0x64(%rsp)
movl %eax, %esi
leaq 0x178(%rsp), %rdi
callq 0xfc50
movl (%rax), %eax
movl %eax, 0x68(%rsp)
movl 0xfc(%rsp), %eax
movl %eax, %esi
leaq 0x160(%rsp), %rdi
callq 0xfc50
movq 0x50(%rsp), %rdi
movl 0x5c(%rsp), %esi
movl 0x60(%rsp), %edx
movl 0x64(%rsp), %ecx
movl 0x68(%rsp), %r8d
movl (%rax), %r9d
movq 0x1a0(%rsp), %r10
movq %rsp, %rax
movq %r10, (%rax)
callq 0x29f10
jmp 0x2c29c
jmp 0x2c2d1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x158(%rsp)
movl %eax, 0x154(%rsp)
leaq 0x160(%rsp), %rdi
callq 0xfc70
leaq 0x178(%rsp), %rdi
callq 0xfc70
jmp 0x2c514
leaq 0xd8(%rsp), %rdi
callq 0x2d450
jmp 0x2c2e0
movl 0xfc(%rsp), %eax
movl %eax, %esi
leaq 0x178(%rsp), %rdi
callq 0xfc50
movl (%rax), %eax
movl %eax, 0x48(%rsp)
movl 0xfc(%rsp), %eax
movl %eax, %esi
leaq 0x160(%rsp), %rdi
callq 0xfc50
movq %rax, %rcx
movl 0x48(%rsp), %eax
movl (%rcx), %ecx
subl %ecx, %eax
movl %eax, 0xd4(%rsp)
movl 0xd4(%rsp), %eax
movl %eax, %ecx
negl %ecx
cmovnsl %ecx, %eax
movl %eax, 0xd0(%rsp)
movl 0xd0(%rsp), %eax
movl %eax, 0x4c(%rsp)
testl %eax, %eax
je 0x2c355
jmp 0x2c34a
movl 0x4c(%rsp), %eax
subl $0x1, %eax
je 0x2c394
jmp 0x2c3d3
movl 0x118(%rsp), %eax
incl %eax
movl %eax, 0x118(%rsp)
leaq 0xd8(%rsp), %rdi
callq 0x2d470
movsd %xmm0, 0x40(%rsp)
jmp 0x2c37a
movsd 0x40(%rsp), %xmm0
addsd 0x100(%rsp), %xmm0
movsd %xmm0, 0x100(%rsp)
jmp 0x2c410
movl 0x11c(%rsp), %eax
incl %eax
movl %eax, 0x11c(%rsp)
leaq 0xd8(%rsp), %rdi
callq 0x2d470
movsd %xmm0, 0x38(%rsp)
jmp 0x2c3b9
movsd 0x38(%rsp), %xmm0
addsd 0x108(%rsp), %xmm0
movsd %xmm0, 0x108(%rsp)
jmp 0x2c410
movl 0x120(%rsp), %eax
incl %eax
movl %eax, 0x120(%rsp)
leaq 0xd8(%rsp), %rdi
callq 0x2d470
movsd %xmm0, 0x30(%rsp)
jmp 0x2c3f8
movsd 0x30(%rsp), %xmm0
addsd 0x110(%rsp), %xmm0
movsd %xmm0, 0x110(%rsp)
jmp 0x2c412
movl 0xfc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xfc(%rsp)
jmp 0x2c192
movq 0x190(%rsp), %rdi
movq %rdi, 0x20(%rsp)
callq 0x109f0
movq %rax, 0xc0(%rsp)
leaq 0xc8(%rsp), %rdi
leaq 0xc0(%rsp), %rsi
callq 0x2d580
movq 0x20(%rsp), %rdi
leaq 0x124(%rsp), %rcx
movq 0xc8(%rsp), %rsi
leaq 0x118(%rsp), %rdx
callq 0x2d4d0
movq %rax, 0x28(%rsp)
jmp 0x2c480
movq 0x28(%rsp), %rax
movq %rax, 0xb8(%rsp)
movq 0x198(%rsp), %rdi
movq %rdi, 0x10(%rsp)
callq 0xf760
movq %rax, 0xa8(%rsp)
leaq 0xb0(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
callq 0x2d670
movq 0x10(%rsp), %rdi
leaq 0x118(%rsp), %rcx
movq 0xb0(%rsp), %rsi
leaq 0x100(%rsp), %rdx
callq 0x2d5c0
movq %rax, 0x18(%rsp)
jmp 0x2c4e5
movq 0x18(%rsp), %rax
movq %rax, 0xa0(%rsp)
leaq 0x160(%rsp), %rdi
callq 0xfc70
leaq 0x178(%rsp), %rdi
callq 0xfc70
addq $0x1b8, %rsp            # imm = 0x1B8
retq
movq 0x158(%rsp), %rdi
callq 0x9cf0
nopw %cs:(%rax,%rax)