// File: /workspace/github_cpp_makefile_star2_O1/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 $0xf8, %rsp
movq %rdi, %rbx
movl %esi, 0xc(%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 0xd0(%rsp), %rdi
movaps %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
movslq %eax, %r15
movq %r15, %rsi
callq 0xb98a
leaq 0x60(%rsp), %rdx
movl $0x40000000, (%rdx)     # imm = 0x40000000
leaq 0xb0(%rsp), %rdi
leaq 0x10(%rsp), %rcx
movq %r15, %rsi
callq 0xb9c6
leaq 0x60(%rsp), %rdx
movb $0x0, (%rdx)
leaq 0x10(%rsp), %rdi
leaq 0x38(%rsp), %rcx
movq %r15, %rsi
callq 0xba44
xorps %xmm0, %xmm0
leaq 0x60(%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 0xcf00
movq %r14, 0xc8(%rsp)
movq 0x90(%rsp), %rax
movq 0xa0(%rsp), %rcx
addq $-0x4, %rcx
cmpq %rcx, %rax
je 0xb011
movl 0xc(%rsp), %ecx
movl %ecx, (%rax)
addq $0x4, %rax
movq %rax, 0x90(%rsp)
jmp 0xb020
leaq 0x60(%rsp), %rdi
leaq 0xc(%rsp), %rsi
callq 0xd076
movslq 0xc(%rsp), %rax
movq 0xb0(%rsp), %rcx
movl $0x0, (%rcx,%rax,4)
movq 0x70(%rsp), %rax
cmpq %rax, 0x90(%rsp)
je 0xb1f9
movabsq $-0x8000000000000000, %r15 # imm = 0x8000000000000000
leaq 0x3f(%r15), %r14
leaq 0x60(%rsp), %r12
movl (%rax), %ecx
movl %ecx, 0x38(%rsp)
movq 0x80(%rsp), %rcx
addq $-0x4, %rcx
cmpq %rcx, %rax
je 0xb077
addq $0x4, %rax
jmp 0xb0b2
movq 0x78(%rsp), %rdi
movl $0x200, %esi            # imm = 0x200
callq 0x3230
movq 0x88(%rsp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, 0x88(%rsp)
movq 0x8(%rax), %rax
movq %rax, 0x78(%rsp)
leaq 0x200(%rax), %rcx
movq %rcx, 0x80(%rsp)
movq %rax, 0x70(%rsp)
movslq 0x38(%rsp), %rax
leaq 0x3f(%rax), %rcx
testq %rax, %rax
cmovnsq %rax, %rcx
sarq $0x6, %rcx
shlq $0x3, %rcx
addq 0x10(%rsp), %rcx
movq %rax, %rdx
andq %r14, %rdx
xorl %esi, %esi
cmpq %r15, %rdx
setbe %sil
movq -0x8(%rcx,%rsi,8), %rcx
btq %rax, %rcx
jb 0xb1e6
movq %rbx, %rbp
movq 0x8(%rbx), %rcx
imulq $0x98, %rax, %rax
movq 0x10(%rcx,%rax), %r13
movq 0x18(%rcx,%rax), %rbx
cmpq %rbx, %r13
je 0xb1aa
movslq (%r13), %rax
movq 0xb0(%rsp), %rcx
movslq 0x38(%rsp), %rdx
movl (%rcx,%rdx,4), %edx
cmpl %edx, (%rcx,%rax,4)
jle 0xb1a1
incl %edx
movl %edx, (%rcx,%rax,4)
movslq (%r13), %rax
movq 0xd0(%rsp), %rcx
leaq (%rax,%rax,2), %rax
leaq (%rcx,%rax,8), %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0xb15f
movl 0x38(%rsp), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rdi)
jmp 0xb169
leaq 0x38(%rsp), %rdx
callq 0xd28a
movq 0x90(%rsp), %rax
movq 0xa0(%rsp), %rcx
addq $-0x4, %rcx
cmpq %rcx, %rax
je 0xb196
movl (%r13), %ecx
movl %ecx, (%rax)
addq $0x4, %rax
movq %rax, 0x90(%rsp)
jmp 0xb1a1
movq %r12, %rdi
movq %r13, %rsi
callq 0xd076
addq $0x4, %r13
jmp 0xb10a
movslq 0x38(%rsp), %rcx
leaq 0x3f(%rcx), %rax
testq %rcx, %rcx
cmovnsq %rcx, %rax
sarq $0x6, %rax
shlq $0x3, %rax
addq 0x10(%rsp), %rax
movq %rcx, %rdx
andq %r14, %rdx
xorl %esi, %esi
cmpq %r15, %rdx
setbe %sil
movl $0x1, %edx
shlq %cl, %rdx
orq %rdx, -0x8(%rax,%rsi,8)
movq %rbp, %rbx
movq 0x70(%rsp), %rax
cmpq %rax, 0x90(%rsp)
jne 0xb05a
leaq 0xc9e0(%rip), %r14      # 0x17be0
movq %r14, 0x38(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x40(%rsp)
movq $0x0, 0x50(%rsp)
movl 0xc(%rsp), %eax
leaq 0x50(%rbx), %rdi
movq 0xc8(%rsp), %r15
movq %r15, %rcx
shlq $0x20, %rcx
orq %rax, %rcx
leaq 0xf0(%rsp), %rsi
movq %rcx, (%rsi)
callq 0xbb3a
leaq 0xd0(%rsp), %rdx
leaq 0x38(%rsp), %r8
movq %rbx, %rdi
movl %r15d, %esi
movq %rax, %rcx
callq 0xb3a0
movq %r14, 0x38(%rsp)
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0xb277
movq 0x50(%rsp), %rsi
subq %rdi, %rsi
callq 0x3230
leaq 0x60(%rsp), %rdi
callq 0xbddc
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0xb2b1
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x3230
xorl %eax, %eax
movq %rax, 0x10(%rsp)
movl %eax, 0x18(%rsp)
movq %rax, 0x20(%rsp)
movl %eax, 0x28(%rsp)
movq %rax, 0x30(%rsp)
movq 0xb0(%rsp), %rdi
testq %rdi, %rdi
je 0xb2ce
movq 0xc0(%rsp), %rsi
subq %rdi, %rsi
callq 0x3230
leaq 0xd0(%rsp), %rdi
callq 0x8d44
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xb321
movq %rax, %rbx
jmp 0xb32e
movq %rax, %rbx
jmp 0xb35e
jmp 0xb2fb
movq %rax, %rbx
jmp 0xb37b
movq %rax, %rbx
movq %r14, 0x38(%rsp)
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0xb324
movq 0x50(%rsp), %rsi
subq %rdi, %rsi
callq 0x3230
jmp 0xb324
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0xbddc
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0xb35e
movq 0x30(%rsp), %rsi
subq %rdi, %rsi
callq 0x3230
xorl %eax, %eax
movq %rax, 0x10(%rsp)
movl %eax, 0x18(%rsp)
movq %rax, 0x20(%rsp)
movl %eax, 0x28(%rsp)
movq %rax, 0x30(%rsp)
movq 0xb0(%rsp), %rdi
testq %rdi, %rdi
je 0xb37b
movq 0xc0(%rsp), %rsi
subq %rdi, %rsi
callq 0x3230
leaq 0xd0(%rsp), %rdi
callq 0x8d44
movq %rbx, %rdi
callq 0x3370