// File: /workspace/github_cpp_makefile_star2_O3/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 $0xe8, %rsp
movq %rdi, %rbx
movl %esi, 0x4(%rsp)
movq 0x10(%rdi), %rax
subq 0x8(%rdi), %rax
movl %edx, %r14d
shrq $0x3, %rax
imull $0x286bca1b, %eax, %eax # imm = 0x286BCA1B
xorps %xmm0, %xmm0
leaq 0xa0(%rsp), %rdi
movaps %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
movslq %eax, %r15
movq %r15, %rsi
callq 0xc094
leaq 0x30(%rsp), %rdx
movl $0x40000000, (%rdx)     # imm = 0x40000000
leaq 0x80(%rsp), %rdi
leaq 0xb8(%rsp), %rcx
movq %r15, %rsi
callq 0xc0d0
leaq 0x30(%rsp), %rdx
movb $0x0, (%rdx)
leaq 0xb8(%rsp), %rdi
leaq 0x8(%rsp), %rcx
movq %r15, %rsi
callq 0xc24c
xorps %xmm0, %xmm0
leaq 0x30(%rsp), %rdi
movaps %xmm0, 0x40(%rdi)
movaps %xmm0, 0x30(%rdi)
movaps %xmm0, 0x20(%rdi)
movaps %xmm0, 0x10(%rdi)
movaps %xmm0, (%rdi)
xorl %esi, %esi
callq 0xd74a
movq 0x60(%rsp), %rcx
movq 0x70(%rsp), %rax
addq $-0x4, %rax
cmpq %rax, %rcx
movq %r14, 0x98(%rsp)
je 0xb730
movl 0x4(%rsp), %eax
movl %eax, (%rcx)
addq $0x4, %rcx
movq %rcx, 0x60(%rsp)
jmp 0xb748
leaq 0x30(%rsp), %rdi
leaq 0x4(%rsp), %rsi
callq 0xd8c0
movl 0x4(%rsp), %eax
movq 0x60(%rsp), %rcx
cltq
movq 0x80(%rsp), %rdx
movl $0x0, (%rdx,%rax,4)
movq 0x40(%rsp), %rax
cmpq %rax, %rcx
je 0xb917
movabsq $-0x8000000000000000, %r15 # imm = 0x8000000000000000
leaq 0x3f(%r15), %r14
leaq 0x30(%rsp), %r12
movl (%rax), %ecx
movl %ecx, 0x8(%rsp)
movq 0x50(%rsp), %rdx
addq $-0x4, %rdx
cmpq %rdx, %rax
je 0xb794
addq $0x4, %rax
jmp 0xb7ca
movq 0x48(%rsp), %rdi
movl $0x200, %esi            # imm = 0x200
callq 0x3230
movq 0x58(%rsp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, 0x58(%rsp)
movq 0x8(%rax), %rax
movq %rax, 0x48(%rsp)
leaq 0x200(%rax), %rcx
movq %rcx, 0x50(%rsp)
movl 0x8(%rsp), %ecx
movq %rax, 0x40(%rsp)
movslq %ecx, %rcx
movq 0xb8(%rsp), %rdx
leal 0x3f(%rcx), %r8d
testl %ecx, %ecx
cmovnsl %ecx, %r8d
sarl $0x6, %r8d
movq %rcx, %rsi
andq %r14, %rsi
xorl %r9d, %r9d
cmpq %r15, %rsi
setbe %r9b
movl $0x1, %edi
shlq %cl, %rdi
movslq %r8d, %r8
leaq (%rdx,%r8,8), %r10
movq -0x8(%r10,%r9,8), %r9
btq %rcx, %r9
jb 0xb90c
movq %rbx, %rbp
movq 0x8(%rbx), %r9
imulq $0x98, %rcx, %rcx
movq 0x10(%r9,%rcx), %r13
movq 0x18(%r9,%rcx), %rbx
cmpq %rbx, %r13
je 0xb8f8
movslq (%r13), %rax
movq 0x80(%rsp), %rcx
movslq 0x8(%rsp), %rdx
movl (%rcx,%rdx,4), %edx
cmpl %edx, (%rcx,%rax,4)
jle 0xb8bc
incl %edx
movl %edx, (%rcx,%rax,4)
movslq (%r13), %rax
movq 0xa0(%rsp), %rcx
leaq (%rax,%rax,2), %rax
leaq (%rcx,%rax,8), %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0xb883
movl 0x8(%rsp), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rdi)
jmp 0xb88d
leaq 0x8(%rsp), %rdx
callq 0xdad4
movq 0x60(%rsp), %rax
movq 0x70(%rsp), %rcx
addq $-0x4, %rcx
cmpq %rcx, %rax
je 0xb8b1
movl (%r13), %ecx
movl %ecx, (%rax)
addq $0x4, %rax
movq %rax, 0x60(%rsp)
jmp 0xb8bc
movq %r12, %rdi
movq %r13, %rsi
callq 0xd8c0
addq $0x4, %r13
cmpq %rbx, %r13
jne 0xb837
movslq 0x8(%rsp), %rcx
leal 0x3f(%rcx), %esi
testq %rcx, %rcx
movq 0xb8(%rsp), %rdx
movq 0x40(%rsp), %rax
cmovnsl %ecx, %esi
sarl $0x6, %esi
movslq %esi, %r8
movq %rcx, %rsi
andq %r14, %rsi
movl $0x1, %edi
shlq %cl, %rdi
xorl %ecx, %ecx
cmpq %r15, %rsi
setbe %cl
leaq (%rdx,%r8,8), %rdx
orq %rdi, -0x8(%rdx,%rcx,8)
movq %rbp, %rbx
cmpq %rax, 0x60(%rsp)
jne 0xb77a
leaq 0xc2c2(%rip), %r14      # 0x17be0
movq %r14, 0x8(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
movl 0x4(%rsp), %eax
leaq 0x50(%rbx), %rdi
movq 0x98(%rsp), %r15
movq %r15, %rcx
shlq $0x20, %rcx
orq %rax, %rcx
leaq 0xe0(%rsp), %rsi
movq %rcx, (%rsi)
callq 0xc33e
leaq 0xa0(%rsp), %rdx
leaq 0x8(%rsp), %r8
movq %rbx, %rdi
movl %r15d, %esi
movq %rax, %rcx
callq 0xba98
movq %r14, 0x8(%rsp)
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0xb995
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x3230
leaq 0x30(%rsp), %rdi
callq 0xc5e8
movq 0xb8(%rsp), %rdi
testq %rdi, %rdi
je 0xb9bc
movq 0xd8(%rsp), %rsi
subq %rdi, %rsi
callq 0x3230
movq 0x80(%rsp), %rdi
testq %rdi, %rdi
je 0xb9d9
movq 0x90(%rsp), %rsi
subq %rdi, %rsi
callq 0x3230
leaq 0xa0(%rsp), %rdi
callq 0x9100
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xba2c
movq %rax, %rbx
jmp 0xba39
movq %rax, %rbx
jmp 0xba56
jmp 0xba06
movq %rax, %rbx
jmp 0xba73
movq %rax, %rbx
movq %r14, 0x8(%rsp)
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0xba2f
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x3230
jmp 0xba2f
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0xc5e8
movq 0xb8(%rsp), %rdi
testq %rdi, %rdi
je 0xba56
movq 0xd8(%rsp), %rsi
subq %rdi, %rsi
callq 0x3230
movq 0x80(%rsp), %rdi
testq %rdi, %rdi
je 0xba73
movq 0x90(%rsp), %rsi
subq %rdi, %rsi
callq 0x3230
leaq 0xa0(%rsp), %rdi
callq 0x9100
movq %rbx, %rdi
callq 0x3370