// File: /workspace/github_cpp_makefile_star2_O1/guitld[P]Graph-Algorithms/source/Graph.cpp
// Function: Graph::BFS(int, int)
int Graph::BFS(int u, int v){
     if (adj_lists.find(u) == adj_lists.end() || adj_lists.find(v) == adj_lists.end()){
          cout << "Vertex not found" << endl;
          return 0;
     }

     // Defining structures for the algorithm
     vector <int> visited;
     queue <int> queue;
     queue.push(u);
     unordered_map <int, int> parentNode;
     
     while (!queue.empty()){
          // Popping first item of the queue
          int curr_v = queue.front();
          queue.pop();
          // Looping through its neighbors
          for (auto const &neighbor : adj_lists[curr_v]){
               // If the neighbor vertex is not marked as visited, the vertex is added to the queue and marked as visited
               // The father vertex is setted in the parent hash map
               if (find(visited.begin(), visited.end(), neighbor.first) == visited.end()){
                    parentNode[neighbor.first] = curr_v;
                    visited.push_back(neighbor.first);
                    queue.push(neighbor.first);
               }
               // If the vertex was found, loops through the parent hash map to print the BFS path
               if (neighbor.first == v){
                    cout << v << "<-";
                    parentNode[get<0>(neighbor)] = curr_v;
                    int count = 0;
                    while (v != u){
                         v = parentNode[v];
                         cout << v;
                         if (v != u)
                              cout << "<-";
                         count++;
                    }
                    cout << endl;
                    return count;
               }
          }
     }
     cout << "No path found" << endl;
     return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movl %edx, %ecx
movl %esi, -0x30(%rbp)
movl %edx, -0x2c(%rbp)
movslq %esi, %rax
movq (%rdi), %r10
movq %rdi, -0xb8(%rbp)
movq 0x8(%rdi), %r9
xorl %ebx, %ebx
xorl %edx, %edx
divq %r9
movq (%r10,%rdx,8), %rax
testq %rax, %rax
je 0x36e7
movq (%rax), %r11
movq %rax, %rbx
cmpl %esi, 0x8(%r11)
je 0x36e7
movq %rdx, %rdi
movq %r11, %r14
movq (%r11), %r11
testq %r11, %r11
je 0x36e5
movslq 0x8(%r11), %r8
movq %r8, %rax
xorl %edx, %edx
divq %r9
movl $0x0, %ebx
cmpq %rdi, %rdx
jne 0x36e7
movq %r14, %rbx
cmpl %esi, %r8d
jne 0x36ba
jmp 0x36e7
xorl %ebx, %ebx
testq %rbx, %rbx
je 0x37a6
cmpq $0x0, (%rbx)
je 0x37a6
movslq %ecx, %rax
xorl %r11d, %r11d
xorl %edx, %edx
divq %r9
movq (%r10,%rdx,8), %rax
testq %rax, %rax
je 0x374b
movq (%rax), %r8
movq %rax, %r11
cmpl %ecx, 0x8(%r8)
je 0x374b
movq %rdx, %rsi
movq %r8, %r10
movq (%r8), %r8
testq %r8, %r8
je 0x3748
movslq 0x8(%r8), %rdi
movq %rdi, %rax
xorl %edx, %edx
divq %r9
movl $0x0, %r11d
cmpq %rsi, %rdx
jne 0x374b
movq %r10, %r11
cmpl %ecx, %edi
jne 0x371d
jmp 0x374b
xorl %r11d, %r11d
testq %r11, %r11
je 0x37a6
cmpq $0x0, (%r11)
je 0x37a6
xorps %xmm0, %xmm0
movaps %xmm0, -0x50(%rbp)
movq $0x0, -0x40(%rbp)
leaq -0xb0(%rbp), %rdi
movaps %xmm0, 0x40(%rdi)
movaps %xmm0, 0x30(%rdi)
movaps %xmm0, 0x20(%rdi)
movaps %xmm0, 0x10(%rdi)
movaps %xmm0, (%rdi)
xorl %esi, %esi
callq 0x54fe
movq -0x80(%rbp), %rax
movq -0x70(%rbp), %rcx
addq $-0x4, %rcx
cmpq %rcx, %rax
je 0x3800
movl -0x30(%rbp), %ecx
movl %ecx, (%rax)
addq $0x4, %rax
movq %rax, -0x80(%rbp)
jmp 0x3810
movq 0x6823(%rip), %rbx      # 0x9fd0
leaq 0x3887(%rip), %rsi      # 0x703b
movl $0x10, %edx
movq %rbx, %rdi
callq 0x2180
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2140
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20f0
xorl %r13d, %r13d
movl %r13d, %eax
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq -0xb0(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x56a4
leaq -0xc0(%rbp), %rax
movq %rax, -0x30(%rax)
movq $0x1, -0x28(%rax)
xorps %xmm0, %xmm0
movups %xmm0, -0x20(%rax)
movl $0x3f800000, -0x10(%rax) # imm = 0x3F800000
movups %xmm0, -0x8(%rax)
movq 0x6794(%rip), %r14      # 0x9fd0
movq -0xa0(%rbp), %rax
cmpq %rax, -0x80(%rbp)
je 0x3a27
movl (%rax), %ecx
movl %ecx, -0x34(%rbp)
movq -0x90(%rbp), %rcx
addq $-0x4, %rcx
cmpq %rcx, %rax
je 0x3868
addq $0x4, %rax
jmp 0x38a4
movq -0x98(%rbp), %rdi
movl $0x200, %esi            # imm = 0x200
callq 0x2160
movq -0x88(%rbp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, -0x88(%rbp)
movq 0x8(%rax), %rax
movq %rax, -0x98(%rbp)
leaq 0x200(%rax), %rcx
movq %rcx, -0x90(%rbp)
movq %rax, -0xa0(%rbp)
movq -0xb8(%rbp), %rdi
leaq -0x34(%rbp), %rsi
callq 0x4ed4
movq %rax, -0x60(%rbp)
movq %rax, %r15
movq (%r15), %r15
cmpq -0x60(%rbp), %r15
je 0x3a1b
leaq 0x10(%r15), %rbx
movq -0x50(%rbp), %rdi
movq -0x48(%rbp), %rsi
movq %rbx, %rdx
callq 0x59d8
cmpq -0x48(%rbp), %rax
jne 0x3951
movl -0x34(%rbp), %r12d
leaq -0xf0(%rbp), %rdi
movq %rbx, %rsi
callq 0x521c
movl %r12d, (%rax)
movq -0x48(%rbp), %rsi
cmpq -0x40(%rbp), %rsi
je 0x3917
movl (%rbx), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, -0x48(%rbp)
jmp 0x3923
leaq -0x50(%rbp), %rdi
movq %rbx, %rdx
callq 0x58b6
movq -0x80(%rbp), %rax
movq -0x70(%rbp), %rcx
addq $-0x4, %rcx
cmpq %rcx, %rax
je 0x3942
movl (%rbx), %ecx
movl %ecx, (%rax)
addq $0x4, %rax
movq %rax, -0x80(%rbp)
jmp 0x3951
leaq -0xb0(%rbp), %rdi
movq %rbx, %rsi
callq 0x56a4
movl (%rbx), %eax
movl -0x2c(%rbp), %r12d
movl %eax, -0x54(%rbp)
cmpl %r12d, %eax
jne 0x3a11
movq %r14, %rdi
movl %r12d, %esi
callq 0x2250
movl $0x2, %edx
movq %rax, %rdi
leaq 0x36cf(%rip), %rsi      # 0x704c
callq 0x2180
movl -0x34(%rbp), %r13d
leaq -0xf0(%rbp), %rdi
movq %rbx, %rsi
callq 0x521c
movl %r13d, (%rax)
movl -0x2c(%rbp), %eax
xorl %r13d, %r13d
cmpl -0x30(%rbp), %eax
je 0x39ea
xorl %r13d, %r13d
leaq -0xf0(%rbp), %rdi
leaq -0x2c(%rbp), %rsi
callq 0x521c
movl (%rax), %esi
movl %esi, -0x2c(%rbp)
movq %r14, %rdi
callq 0x2250
movl -0x2c(%rbp), %eax
cmpl -0x30(%rbp), %eax
je 0x39df
movl $0x2, %edx
movq %r14, %rdi
leaq 0x3672(%rip), %rsi      # 0x704c
callq 0x2180
incl %r13d
movl -0x2c(%rbp), %eax
cmpl -0x30(%rbp), %eax
jne 0x39a6
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2140
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20f0
cmpl %r12d, -0x54(%rbp)
jne 0x38c2
cmpq -0x60(%rbp), %r15
je 0x383c
jmp 0x3a70
movq 0x65a2(%rip), %rbx      # 0x9fd0
leaq 0x361a(%rip), %rsi      # 0x704f
movl $0xd, %edx
movq %rbx, %rdi
callq 0x2180
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2140
movsbl %al, %esi
movq 0x6570(%rip), %rdi      # 0x9fd0
callq 0x2030
xorl %r13d, %r13d
movq %rax, %rdi
callq 0x20f0
leaq -0xf0(%rbp), %rdi
callq 0x4dc4
leaq -0xb0(%rbp), %rdi
callq 0x4d6a
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
je 0x37eb
movq -0x40(%rbp), %rsi
subq %rdi, %rsi
callq 0x2160
jmp 0x37eb
movq %rax, %rbx
jmp 0x3ac9
movq %rax, %rbx
jmp 0x3ad5
jmp 0x3aba
jmp 0x3aba
jmp 0x3aba
jmp 0x3aba
jmp 0x3aba
movq %rax, %rbx
leaq -0xf0(%rbp), %rdi
callq 0x4dc4
leaq -0xb0(%rbp), %rdi
callq 0x4d6a
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
je 0x3aea
movq -0x40(%rbp), %rsi
subq %rdi, %rsi
callq 0x2160
movq %rbx, %rdi
callq 0x2260