// File: /workspace/github_cpp_makefile_star2_O1/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
movl %esi, -0x2c(%rbp)
movslq %esi, %rax
movq (%rdi), %r9
movq %rdi, -0xb8(%rbp)
movq 0x8(%rdi), %r8
xorl %r10d, %r10d
xorl %edx, %edx
divq %r8
movq (%r9,%rdx,8), %rax
testq %rax, %rax
je 0x3b68
movq (%rax), %r9
movq %rax, %r10
cmpl %esi, 0x8(%r9)
je 0x3b68
movq %rdx, %rcx
movq %r9, %r11
movq (%r9), %r9
testq %r9, %r9
je 0x3b65
movslq 0x8(%r9), %rdi
movq %rdi, %rax
xorl %edx, %edx
divq %r8
movl $0x0, %r10d
cmpq %rcx, %rdx
jne 0x3b68
movq %r11, %r10
cmpl %esi, %edi
jne 0x3b3a
jmp 0x3b68
xorl %r10d, %r10d
testq %r10, %r10
je 0x3bc3
cmpq $0x0, (%r10)
je 0x3bc3
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 0x3c0a
movl -0x2c(%rbp), %ecx
movl %ecx, (%rax)
addq $0x4, %rax
movq %rax, -0x80(%rbp)
jmp 0x3c1a
movq 0x6406(%rip), %rbx      # 0x9fd0
leaq 0x346a(%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 0x3dc9
leaq -0xb0(%rbp), %rdi
leaq -0x2c(%rbp), %rsi
callq 0x56a4
movq -0x48(%rbp), %rsi
cmpq -0x40(%rbp), %rsi
je 0x3c33
movl -0x2c(%rbp), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, -0x48(%rbp)
jmp 0x3c40
leaq -0x50(%rbp), %rdi
leaq -0x2c(%rbp), %rdx
callq 0x58b6
movq -0x80(%rbp), %rax
cmpq -0xa0(%rbp), %rax
je 0x3d79
leaq -0x50(%rbp), %r13
leaq -0xb0(%rbp), %r14
cmpq -0x78(%rbp), %rax
jne 0x3c72
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 0x6351(%rip), %rdi      # 0x9fd0
callq 0x2250
movl $0x2, %edx
movq %rax, %rdi
leaq 0x33ca(%rip), %rsi      # 0x705d
callq 0x2180
movq -0x80(%rbp), %rax
movq -0x78(%rbp), %rdi
cmpq %rdi, %rax
je 0x3cab
addq $-0x4, %rax
jmp 0x3cda
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 0x4ed4
movq %rax, %r15
movq (%rax), %rbx
cmpq %r15, %rbx
je 0x3d68
leaq 0x10(%rbx), %r12
movq -0x50(%rbp), %rdi
movq -0x48(%rbp), %rsi
movq %r12, %rdx
callq 0x59d8
movq -0x48(%rbp), %rsi
cmpq %rsi, %rax
jne 0x3d63
cmpq -0x40(%rbp), %rsi
je 0x3d2c
movl (%r12), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, -0x48(%rbp)
jmp 0x3d37
movq %r13, %rdi
movq %r12, %rdx
callq 0x58b6
movq -0x80(%rbp), %rax
movq -0x70(%rbp), %rcx
addq $-0x4, %rcx
cmpq %rcx, %rax
je 0x3d58
movl (%r12), %ecx
movl %ecx, (%rax)
addq $0x4, %rax
movq %rax, -0x80(%rbp)
jmp 0x3d63
movq %r14, %rdi
movq %r12, %rsi
callq 0x56a4
movq (%rbx), %rbx
jmp 0x3cf4
movq -0x80(%rbp), %rax
cmpq -0xa0(%rbp), %rax
jne 0x3c5c
movq 0x6250(%rip), %rdi      # 0x9fd0
movq (%rdi), %rax
addq -0x18(%rax), %rdi
movl $0xa, %esi
callq 0x2140
movsbl %al, %esi
movq 0x6235(%rip), %rdi      # 0x9fd0
callq 0x2030
movq %rax, %rdi
callq 0x20f0
leaq -0xb0(%rbp), %rdi
callq 0x4d6a
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
je 0x3dc9
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 0x3df9
jmp 0x3dea
jmp 0x3dea
jmp 0x3dea
jmp 0x3dea
movq %rax, %rbx
leaq -0xb0(%rbp), %rdi
callq 0x4d6a
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
je 0x3e0e
movq -0x40(%rbp), %rsi
subq %rdi, %rsi
callq 0x2160
movq %rbx, %rdi
callq 0x2260