// File: /workspace/github_cpp_makefile_star2_O2/ynilu[P]elastic/graph.cpp
// Function: Phy_graph::BFS_find_path(int, int)
void Phy_graph::BFS_find_path(int source, int destination)
{
    int num_nodes = node_list.size();
    vector<Parents> parents;
    parents.resize(num_nodes);
    vector<int> distance(num_nodes, 1 << 30);
    vector<bool> visited(num_nodes, false);
    queue<int> Q;

    // BFS
    Q.push(source);
    distance[source] = 0;

    while (!Q.empty())
    {
        int v = Q.front();
        Q.pop();

        if(visited[v])
        {
            continue;
        }

        for(auto &w : get_node(v).neighbor)
        {
            if(distance[w] > distance[v])
            {
                distance[w] = distance[v] + 1;
                parents[w].push_back(v);
                Q.push(w);
            }
        }

        visited[v] = true;

    }

    CandidatePath path;
    DFS_back_trace(destination, parents, get_path_list(source, destination), path);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movl %edx, %ebx
movq %rdi, %r14
movl %esi, (%rsp)
movq 0x10(%rdi), %rax
subq 0x8(%rdi), %rax
movl $0x98, %ecx
cqto
idivq %rcx
leaq 0x30(%rsp), %rdi
andq $0x0, 0x10(%rdi)
xorps %xmm0, %xmm0
movaps %xmm0, (%rdi)
movslq %eax, %r15
movq %r15, %rsi
callq 0x9c96
leaq 0x88(%rsp), %rdx
movl $0x40000000, (%rdx)     # imm = 0x40000000
leaq 0x48(%rsp), %rdi
leaq 0x60(%rsp), %rcx
movq %r15, %rsi
callq 0x9ccc
leaq 0x88(%rsp), %rdx
movb $0x0, (%rdx)
leaq 0x60(%rsp), %rdi
leaq 0x8(%rsp), %rcx
movq %r15, %rsi
callq 0x9d22
leaq 0x88(%rsp), %rdi
callq 0x9d86
movl %ebx, 0x4(%rsp)
leaq 0x88(%rsp), %rdi
movq %rsp, %rsi
callq 0xb2d8
movslq (%rsp), %rax
movq 0x48(%rsp), %rcx
andl $0x0, (%rcx,%rax,4)
leaq 0x88(%rsp), %r15
leaq 0x60(%rsp), %r12
leaq 0x8(%rsp), %r13
movq 0x98(%rsp), %rax
cmpq %rax, 0xb8(%rsp)
je 0x97c2
movl (%rax), %eax
movl %eax, 0x8(%rsp)
movq %r15, %rdi
callq 0xb50c
movslq 0x8(%rsp), %rsi
movq %r12, %rdi
callq 0x9da2
testq %rdx, (%rax)
jne 0x9717
movslq 0x8(%rsp), %rax
movq 0x8(%r14), %rcx
imulq $0x98, %rax, %rax
movq 0x10(%rcx,%rax), %rbp
movq 0x18(%rcx,%rax), %rbx
cmpq %rbx, %rbp
je 0x97ad
movslq (%rbp), %rax
movq 0x48(%rsp), %rcx
movslq 0x8(%rsp), %rdx
movl (%rcx,%rdx,4), %edx
cmpl %edx, (%rcx,%rax,4)
jle 0x97a7
incl %edx
movl %edx, (%rcx,%rax,4)
movslq (%rbp), %rax
imulq $0x18, %rax, %rdi
addq 0x30(%rsp), %rdi
movq %r13, %rsi
callq 0x9dc0
movq %r15, %rdi
movq %rbp, %rsi
callq 0xb2d8
addq $0x4, %rbp
jmp 0x9767
movslq 0x8(%rsp), %rsi
movq %r12, %rdi
callq 0x9da2
orq %rdx, (%rax)
jmp 0x9717
leaq 0xe427(%rip), %rax      # 0x17bf0
movq %rax, 0x8(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rsp)
andq $0x0, 0x20(%rsp)
movl (%rsp), %esi
movq %r14, %rdi
movl 0x4(%rsp), %ebx
movl %ebx, %edx
callq 0x99d8
leaq 0x30(%rsp), %rdx
leaq 0x8(%rsp), %r8
movq %r14, %rdi
movl %ebx, %esi
movq %rax, %rcx
callq 0x98b8
leaq 0x8(%rsp), %rdi
callq 0x9bde
leaq 0x88(%rsp), %rdi
callq 0xa0a0
leaq 0x60(%rsp), %rdi
callq 0x9dde
leaq 0x48(%rsp), %rdi
callq 0x6f54
leaq 0x30(%rsp), %rdi
callq 0x6c18
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x9871
movq %rax, %rbx
jmp 0x9881
movq %rax, %rbx
jmp 0x988b
jmp 0x9859
movq %rax, %rbx
jmp 0x9895
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x9bde
jmp 0x9874
jmp 0x9871
jmp 0x9871
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
callq 0xa0a0
leaq 0x60(%rsp), %rdi
callq 0x9dde
leaq 0x48(%rsp), %rdi
callq 0x6f54
leaq 0x30(%rsp), %rdi
callq 0x6c18
movq %rbx, %rdi
callq 0x2320
nop