// File: /workspace/github_cpp_makefile_star2_O1/guitld[P]Graph-Algorithms/source/Graph.cpp
// Function: Graph::hierholzerPath()
void Graph::hierholzerPath(){

     // Hash map to count the number of edges connected to a vertex
     unordered_map <int, int> edge_count;

     for (auto elem : this->adj_lists)
          edge_count[elem.first] = edgeCount(elem.first);

     // Creating a stack and a vector for the path for the algorithm and path
     stack <int> stack;
     vector <int> circuit;

     stack.push(this->adj_lists.begin()->first);
     int curr_v = this->adj_lists.begin()->first;
     
     while (!stack.empty()){
          // Check if there are edges connected to vertex
          if (edge_count[curr_v]){
               // Pushing vertex to the stack
               stack.push(curr_v);
               // Getting next vertex from its adjacency list
               int next_v = this->adj_lists[curr_v].back().first;
               // Removing the edge
               if (curr_v != next_v){
                    for (auto &elem : this->adj_lists[next_v])
                         if (elem.first == curr_v)
                              this->adj_lists[next_v].remove(elem);
               }
               this->adj_lists[curr_v].pop_back();
               edge_count[curr_v]--;
               edge_count[next_v]--;
               curr_v = next_v;
          }

          else{
               // Popping the stack
               circuit.push_back(curr_v);
               curr_v = stack.top();
               stack.pop();
          }
     }

     // Printing the path
     for (int i=circuit.size()-1; i>=0; i--){
          cout << circuit[i];
          if (i)
               cout<<" -> ";
     }
     cout << endl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movq %rdi, %rbx
leaq -0xa8(%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 0x10(%rdi), %r15
testq %r15, %r15
je 0x3333
leaq -0x98(%rbp), %r14
leaq -0xa0(%rbp), %r13
movl 0x8(%r15), %eax
movl %eax, -0xa0(%rbp)
leaq 0x10(%r15), %rsi
movq %r14, %rdi
callq 0x4cc4
movl -0xa0(%rbp), %eax
movl %eax, -0x50(%rbp)
movq %rbx, %rdi
leaq -0x50(%rbp), %rsi
callq 0x4ed4
movq 0x10(%rax), %r12
leaq -0xd8(%rbp), %rdi
movq %r13, %rsi
callq 0x521c
movl %r12d, (%rax)
movq -0x98(%rbp), %rdi
cmpq %r14, %rdi
je 0x332b
movq (%rdi), %r12
movl $0x18, %esi
callq 0x2160
movq %r12, %rdi
cmpq %r14, %r12
jne 0x3316
movq (%r15), %r15
testq %r15, %r15
jne 0x32c9
leaq -0xa0(%rbp), %rdi
xorps %xmm0, %xmm0
movaps %xmm0, 0x40(%rdi)
movaps %xmm0, 0x30(%rdi)
movaps %xmm0, 0x20(%rdi)
movaps %xmm0, 0x10(%rdi)
movaps %xmm0, (%rdi)
xorl %esi, %esi
callq 0x54fe
xorps %xmm0, %xmm0
movaps %xmm0, -0x50(%rbp)
movq $0x0, -0x40(%rbp)
movq 0x10(%rbx), %rsi
addq $0x8, %rsi
movq -0x70(%rbp), %rax
movq -0x60(%rbp), %rcx
addq $-0x4, %rcx
cmpq %rcx, %rax
je 0x338d
movl (%rsi), %ecx
movl %ecx, (%rax)
addq $0x4, %rax
movq %rax, -0x70(%rbp)
jmp 0x3399
leaq -0xa0(%rbp), %rdi
callq 0x56a4
movq 0x10(%rbx), %rax
movl 0x8(%rax), %eax
movl %eax, -0x2c(%rbp)
movq -0x70(%rbp), %rax
cmpq -0x90(%rbp), %rax
je 0x353f
leaq -0xd8(%rbp), %r12
leaq -0x2c(%rbp), %r15
movq %r12, %rdi
movq %r15, %rsi
callq 0x521c
cmpl $0x0, (%rax)
je 0x33ef
movq -0x70(%rbp), %rax
movq -0x60(%rbp), %rcx
addq $-0x4, %rcx
cmpq %rcx, %rax
je 0x340f
movl -0x2c(%rbp), %ecx
movl %ecx, (%rax)
addq $0x4, %rax
movq %rax, -0x70(%rbp)
jmp 0x341e
movq -0x48(%rbp), %rsi
cmpq -0x40(%rbp), %rsi
je 0x34c3
movl -0x2c(%rbp), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, -0x48(%rbp)
jmp 0x34cf
leaq -0xa0(%rbp), %rdi
movq %r15, %rsi
callq 0x56a4
movq %rbx, %rdi
movq %r15, %rsi
callq 0x4ed4
movq 0x8(%rax), %rax
movl 0x10(%rax), %eax
movl %eax, -0x30(%rbp)
cmpl %eax, -0x2c(%rbp)
jne 0x3486
movq %rbx, %rdi
movq %r15, %rsi
callq 0x4ed4
movq 0x8(%rax), %r13
decq 0x10(%rax)
movq %r13, %rdi
callq 0x2230
movl $0x18, %esi
movq %r13, %rdi
callq 0x2160
movq %r12, %rdi
movq %r15, %rsi
callq 0x521c
decl (%rax)
movq %r12, %rdi
leaq -0x30(%rbp), %rsi
callq 0x521c
decl (%rax)
movl -0x30(%rbp), %eax
movl %eax, -0x2c(%rbp)
jmp 0x352e
movq %rbx, %rdi
leaq -0x30(%rbp), %rsi
callq 0x4ed4
movq %rax, %r13
movq (%rax), %r14
cmpq %r13, %r14
je 0x3438
movl 0x10(%r14), %eax
cmpl -0x2c(%rbp), %eax
jne 0x34be
movq %rbx, %rdi
leaq -0x30(%rbp), %rsi
callq 0x4ed4
leaq 0x10(%r14), %rsi
movq %rax, %rdi
callq 0x49d4
movq (%r14), %r14
jmp 0x3498
leaq -0x50(%rbp), %rdi
movq %r15, %rdx
callq 0x58b6
movq -0x70(%rbp), %rax
movq -0x68(%rbp), %rdi
cmpq %rdi, %rax
je 0x34e8
movl -0x4(%rax), %ecx
addq $-0x4, %rax
movl %ecx, -0x2c(%rbp)
jmp 0x352a
movq -0x58(%rbp), %rax
movq -0x8(%rax), %rax
movl 0x1fc(%rax), %eax
movl %eax, -0x2c(%rbp)
movl $0x200, %esi            # imm = 0x200
callq 0x2160
movq -0x58(%rbp), %rax
leaq -0x8(%rax), %rcx
movq %rcx, -0x58(%rbp)
movq -0x8(%rax), %rax
movq %rax, -0x68(%rbp)
leaq 0x200(%rax), %rcx
movq %rcx, -0x60(%rbp)
movl $0x1fc, %ecx            # imm = 0x1FC
addq %rcx, %rax
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
cmpq -0x90(%rbp), %rax
jne 0x33bf
movq -0x48(%rbp), %rax
subq -0x50(%rbp), %rax
shrq $0x2, %rax
decl %eax
js 0x358f
movl %eax, %r15d
incq %r15
movq 0x6a74(%rip), %rbx      # 0x9fd0
leaq 0x3ad3(%rip), %r14      # 0x7036
movq -0x50(%rbp), %rax
movl -0x4(%rax,%r15,4), %esi
movq %rbx, %rdi
callq 0x2250
cmpq $0x1, %r15
je 0x358a
movl $0x4, %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2180
decq %r15
jg 0x3563
movq 0x6a3a(%rip), %rdi      # 0x9fd0
movq (%rdi), %rax
addq -0x18(%rax), %rdi
movl $0xa, %esi
callq 0x2140
movsbl %al, %esi
movq 0x6a1f(%rip), %rdi      # 0x9fd0
callq 0x2030
movq %rax, %rdi
callq 0x20f0
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
je 0x35d3
movq -0x40(%rbp), %rsi
subq %rdi, %rsi
callq 0x2160
leaq -0xa0(%rbp), %rdi
callq 0x4d6a
leaq -0xd8(%rbp), %rdi
callq 0x4dc4
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3636
jmp 0x3605
jmp 0x3636
jmp 0x3636
movq %rax, %rbx
jmp 0x365a
jmp 0x3636
jmp 0x3636
movq %rax, %rbx
movq -0x98(%rbp), %rdi
cmpq %r14, %rdi
je 0x365a
movq (%rdi), %r15
movl $0x18, %esi
callq 0x2160
movq %r15, %rdi
cmpq %r14, %r15
jne 0x361d
jmp 0x365a
jmp 0x3636
movq %rax, %rbx
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
je 0x364e
movq -0x40(%rbp), %rsi
subq %rdi, %rsi
callq 0x2160
leaq -0xa0(%rbp), %rdi
callq 0x4d6a
leaq -0xd8(%rbp), %rdi
callq 0x4dc4
movq %rbx, %rdi
callq 0x2260