// File: fjamour[P]icentral/src/graph_t.cc
// Function: graph_t::get_shortest_path(unsigned int, unsigned int, std::vector<unsigned int, std::allocator<unsigned int>>&)
void graph_t::get_shortest_path(
        node_id_t src,
        node_id_t dst,
        vector<node_id_t>& out_path)
{
    //do a BFS from dst to src and store path
    vector<int>         dist_vec;
    vector<node_id_t>   parent_vec;
    dist_vec.resize(size());
    parent_vec.resize(size());
    fill(dist_vec.begin(), dist_vec.end(), -1);
    fill(parent_vec.begin(), parent_vec.end(), -1);
    
    queue<node_id_t> q;
    dist_vec[dst] = 0;
    q.push(dst);
    while(!q.empty()) {
        node_id_t node = q.front(); q.pop();
        if(node == src)
            break;
        vector<node_id_t> nbr_vec = get_nbrs(node);
        for(int i = 0; i < nbr_vec.size(); ++i) {
            node_id_t nbr_id = nbr_vec[i];
            if(dist_vec[nbr_id] == -1) {
                dist_vec[nbr_id] = dist_vec[node] + 1;
                parent_vec[nbr_id] = node;
                q.push(nbr_id);
            }
        }
    }
    //fill the output path vector:
    out_path.clear();
    node_id_t nd = src;
    while(parent_vec[nd] != -1) {
        out_path.push_back(nd);
        nd = parent_vec[nd];
    }
    out_path.push_back(nd);//insert dst
}

// Assembly:
subq $0x158, %rsp            # imm = 0x158
movq %rdi, 0x150(%rsp)
movl %esi, 0x14c(%rsp)
movl %edx, 0x148(%rsp)
movq %rcx, 0x140(%rsp)
movq 0x150(%rsp), %rax
movq %rax, 0x40(%rsp)
leaq 0x128(%rsp), %rdi
movq %rdi, 0x48(%rsp)
callq 0xfc40
leaq 0x110(%rsp), %rdi
callq 0xfcd0
movq 0x40(%rsp), %rdi
callq 0x56b40
movq 0x48(%rsp), %rdi
movq %rax, %rsi
callq 0x2cfc0
jmp 0x56f9a
movq 0x40(%rsp), %rdi
callq 0x56b40
movq %rax, %rsi
leaq 0x110(%rsp), %rdi
callq 0x415e0
jmp 0x56fb6
leaq 0x128(%rsp), %rdi
movq %rdi, 0x38(%rsp)
callq 0x109f0
movq 0x38(%rsp), %rdi
movq %rax, 0xf8(%rsp)
callq 0x10a20
movq %rax, 0xf0(%rsp)
movl $0xffffffff, 0xec(%rsp) # imm = 0xFFFFFFFF
movq 0xf8(%rsp), %rdi
movq 0xf0(%rsp), %rsi
leaq 0xec(%rsp), %rdx
callq 0x21f20
jmp 0x5700c
leaq 0x110(%rsp), %rdi
movq %rdi, 0x30(%rsp)
callq 0x10cf0
movq 0x30(%rsp), %rdi
movq %rax, 0xe0(%rsp)
callq 0x10d20
movq %rax, 0xd8(%rsp)
movl $0xffffffff, 0xd4(%rsp) # imm = 0xFFFFFFFF
movq 0xe0(%rsp), %rdi
movq 0xd8(%rsp), %rsi
leaq 0xd4(%rsp), %rdx
callq 0x41680
jmp 0x57062
leaq 0x80(%rsp), %rdi
callq 0x10580
jmp 0x57071
movl 0x148(%rsp), %eax
movl %eax, %esi
leaq 0x128(%rsp), %rdi
callq 0xfc50
movl $0x0, (%rax)
leaq 0x80(%rsp), %rdi
leaq 0x148(%rsp), %rsi
callq 0x105b0
jmp 0x570a4
jmp 0x570a6
leaq 0x80(%rsp), %rdi
callq 0x105e0
movb %al, 0x2f(%rsp)
jmp 0x570b9
movb 0x2f(%rsp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x570c8
jmp 0x57266
leaq 0x80(%rsp), %rdi
callq 0x10600
movq %rax, 0x20(%rsp)
jmp 0x570dc
movq 0x20(%rsp), %rax
movl (%rax), %eax
movl %eax, 0x7c(%rsp)
leaq 0x80(%rsp), %rdi
callq 0x10610
jmp 0x570f6
movl 0x7c(%rsp), %eax
cmpl 0x14c(%rsp), %eax
jne 0x5713a
jmp 0x57266
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x108(%rsp)
movl %eax, 0x104(%rsp)
jmp 0x57315
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x108(%rsp)
movl %eax, 0x104(%rsp)
jmp 0x57308
movq 0x40(%rsp), %rdi
movl 0x7c(%rsp), %esi
callq 0x566f0
movq %rax, %rsi
leaq 0x60(%rsp), %rdi
callq 0x10b20
jmp 0x57157
movl $0x0, 0x5c(%rsp)
movslq 0x5c(%rsp), %rax
movq %rax, 0x18(%rsp)
leaq 0x60(%rsp), %rdi
callq 0xfd50
movq %rax, %rcx
movq 0x18(%rsp), %rax
cmpq %rcx, %rax
jae 0x57257
movslq 0x5c(%rsp), %rsi
leaq 0x60(%rsp), %rdi
callq 0xfbc0
movl (%rax), %eax
movl %eax, 0x58(%rsp)
movl 0x58(%rsp), %eax
movl %eax, %esi
leaq 0x128(%rsp), %rdi
callq 0xfc50
cmpl $-0x1, (%rax)
jne 0x57245
movl 0x7c(%rsp), %eax
movl %eax, %esi
leaq 0x128(%rsp), %rdi
movq %rdi, 0x8(%rsp)
callq 0xfc50
movq 0x8(%rsp), %rdi
movl (%rax), %eax
incl %eax
movl %eax, 0x10(%rsp)
movl 0x58(%rsp), %eax
movl %eax, %esi
callq 0xfc50
movl 0x10(%rsp), %ecx
movl %ecx, (%rax)
movl 0x7c(%rsp), %eax
movl %eax, 0x14(%rsp)
movl 0x58(%rsp), %eax
movl %eax, %esi
leaq 0x110(%rsp), %rdi
callq 0xfbc0
movl 0x14(%rsp), %ecx
movl %ecx, (%rax)
leaq 0x80(%rsp), %rdi
leaq 0x58(%rsp), %rsi
callq 0x105b0
jmp 0x57220
jmp 0x57245
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x108(%rsp)
movl %eax, 0x104(%rsp)
leaq 0x60(%rsp), %rdi
callq 0x10520
jmp 0x57308
jmp 0x57247
movl 0x5c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x5c(%rsp)
jmp 0x5715f
leaq 0x60(%rsp), %rdi
callq 0x10520
jmp 0x570a6
movq 0x140(%rsp), %rdi
callq 0x10a50
movl 0x14c(%rsp), %eax
movl %eax, 0x54(%rsp)
movl 0x54(%rsp), %eax
movl %eax, %esi
leaq 0x110(%rsp), %rdi
callq 0xfbc0
cmpl $-0x1, (%rax)
je 0x572c5
movq 0x140(%rsp), %rdi
leaq 0x54(%rsp), %rsi
callq 0xfce0
jmp 0x572aa
movl 0x54(%rsp), %eax
movl %eax, %esi
leaq 0x110(%rsp), %rdi
callq 0xfbc0
movl (%rax), %eax
movl %eax, 0x54(%rsp)
jmp 0x5727e
movq 0x140(%rsp), %rdi
leaq 0x54(%rsp), %rsi
callq 0xfce0
jmp 0x572d9
leaq 0x80(%rsp), %rdi
callq 0x10620
leaq 0x110(%rsp), %rdi
callq 0x10520
leaq 0x128(%rsp), %rdi
callq 0xfc70
addq $0x158, %rsp            # imm = 0x158
retq
leaq 0x80(%rsp), %rdi
callq 0x10620
leaq 0x110(%rsp), %rdi
callq 0x10520
leaq 0x128(%rsp), %rdi
callq 0xfc70
movq 0x108(%rsp), %rdi
callq 0x9cf0
nopl (%rax)