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

     // Defining structures for the algorithm
     vector <int> visited;
     stack <int> stack;
     stack.push(u);
     visited.push_back(u);

     while (!stack.empty()){
          // Popping the top of the stack
          int curr_v = stack.top();
          // Printing the path
          cout << curr_v << "->";
          stack.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 pushed to the stack and marked as visited
               if (find(visited.begin(), visited.end(), neighbor.first) == visited.end()){
                    visited.push_back(neighbor.first);
                    stack.push(neighbor.first);
               }
          }    
     }
     cout << endl;
     return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
leaq -0x2c(%rbp), %rax
movl %esi, (%rax)
movq %rdi, -0xb8(%rbp)
movq %rax, %rsi
callq 0x57b0
testq %rax, %rax
je 0x3a4a
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 0x52d6
movq -0x80(%rbp), %rax
movq -0x70(%rbp), %rcx
addq $-0x4, %rcx
cmpq %rcx, %rax
je 0x3a91
movl -0x2c(%rbp), %ecx
movl %ecx, (%rax)
addq $0x4, %rax
movq %rax, -0x80(%rbp)
jmp 0x3aa1
movq 0x657f(%rip), %rbx      # 0x9fd0
leaq 0x35e3(%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
jmp 0x3c50
leaq -0xb0(%rbp), %rdi
leaq -0x2c(%rbp), %rsi
callq 0x547c
movq -0x48(%rbp), %rsi
cmpq -0x40(%rbp), %rsi
je 0x3aba
movl -0x2c(%rbp), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, -0x48(%rbp)
jmp 0x3ac7
leaq -0x50(%rbp), %rdi
leaq -0x2c(%rbp), %rdx
callq 0x568e
movq -0x80(%rbp), %rax
cmpq -0xa0(%rbp), %rax
je 0x3c00
leaq -0x50(%rbp), %r13
leaq -0xb0(%rbp), %r14
cmpq -0x78(%rbp), %rax
jne 0x3af9
movq -0x68(%rbp), %rax
movq -0x8(%rax), %rax
movl $0x200, %ecx            # imm = 0x200
addq %rcx, %rax
movl -0x4(%rax), %esi
movl %esi, -0x54(%rbp)
movq 0x64ca(%rip), %rdi      # 0x9fd0
callq 0x2250
movl $0x2, %edx
movq %rax, %rdi
leaq 0x3543(%rip), %rsi      # 0x705d
callq 0x2180
movq -0x80(%rbp), %rax
movq -0x78(%rbp), %rdi
cmpq %rdi, %rax
je 0x3b32
addq $-0x4, %rax
jmp 0x3b61
movl $0x200, %esi            # imm = 0x200
callq 0x2160
movq -0x68(%rbp), %rax
leaq -0x8(%rax), %rcx
movq %rcx, -0x68(%rbp)
movq -0x8(%rax), %rax
movq %rax, -0x78(%rbp)
leaq 0x200(%rax), %rcx
movq %rcx, -0x70(%rbp)
addq $0x1fc, %rax            # imm = 0x1FC
movq %rax, -0x80(%rbp)
movq -0xb8(%rbp), %rdi
leaq -0x54(%rbp), %rsi
callq 0x4d1c
movq %rax, %r15
movq (%rax), %rbx
cmpq %r15, %rbx
je 0x3bef
leaq 0x10(%rbx), %r12
movq -0x50(%rbp), %rdi
movq -0x48(%rbp), %rsi
movq %r12, %rdx
callq 0x5811
movq -0x48(%rbp), %rsi
cmpq %rsi, %rax
jne 0x3bea
cmpq -0x40(%rbp), %rax
je 0x3bb3
movl (%r12), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, -0x48(%rbp)
jmp 0x3bbe
movq %r13, %rdi
movq %r12, %rdx
callq 0x568e
movq -0x80(%rbp), %rax
movq -0x70(%rbp), %rcx
addq $-0x4, %rcx
cmpq %rcx, %rax
je 0x3bdf
movl (%r12), %ecx
movl %ecx, (%rax)
addq $0x4, %rax
movq %rax, -0x80(%rbp)
jmp 0x3bea
movq %r14, %rdi
movq %r12, %rsi
callq 0x547c
movq (%rbx), %rbx
jmp 0x3b7b
movq -0x80(%rbp), %rax
cmpq -0xa0(%rbp), %rax
jne 0x3ae3
movq 0x63c9(%rip), %rdi      # 0x9fd0
movq (%rdi), %rax
addq -0x18(%rax), %rdi
movl $0xa, %esi
callq 0x2140
movsbl %al, %esi
movq 0x63ae(%rip), %rdi      # 0x9fd0
callq 0x2030
movq %rax, %rdi
callq 0x20f0
leaq -0xb0(%rbp), %rdi
callq 0x4ba6
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
je 0x3c50
movq -0x40(%rbp), %rsi
subq %rdi, %rsi
callq 0x2160
xorl %eax, %eax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x3c80
jmp 0x3c71
jmp 0x3c71
jmp 0x3c71
jmp 0x3c71
movq %rax, %rbx
leaq -0xb0(%rbp), %rdi
callq 0x4ba6
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
je 0x3c95
movq -0x40(%rbp), %rsi
subq %rdi, %rsi
callq 0x2160
movq %rbx, %rdi
callq 0x2260
nop