// File: /workspace/github_cpp_makefile_star2_O3/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 0x32d5
leaq -0x98(%rbp), %r14
leaq -0xa0(%rbp), %r13
movl 0x8(%r15), %eax
movl %eax, -0xa0(%rbp)
leaq 0x10(%r15), %rsi
movq %r14, %rdi
callq 0x4b00
movl -0xa0(%rbp), %eax
movl %eax, -0x50(%rbp)
movq %rbx, %rdi
leaq -0x50(%rbp), %rsi
callq 0x4d1c
movq 0x10(%rax), %r12
leaq -0xd8(%rbp), %rdi
movq %r13, %rsi
callq 0x5026
movl %r12d, (%rax)
movq -0x98(%rbp), %rdi
cmpq %r14, %rdi
je 0x32cd
movq (%rdi), %r12
movl $0x18, %esi
callq 0x2160
movq %r12, %rdi
cmpq %r14, %r12
jne 0x32b8
movq (%r15), %r15
testq %r15, %r15
jne 0x326b
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 0x52d6
xorps %xmm0, %xmm0
movaps %xmm0, -0x50(%rbp)
movq $0x0, -0x40(%rbp)
movq 0x10(%rbx), %rax
leaq 0x8(%rax), %rsi
movq -0x70(%rbp), %rcx
movq -0x60(%rbp), %rdx
addq $-0x4, %rdx
cmpq %rdx, %rcx
je 0x332f
movl (%rsi), %edx
movl %edx, (%rcx)
addq $0x4, %rcx
movq %rcx, -0x70(%rbp)
jmp 0x3343
leaq -0xa0(%rbp), %rdi
callq 0x547c
movq 0x10(%rbx), %rax
movq -0x70(%rbp), %rcx
movl 0x8(%rax), %eax
movl %eax, -0x2c(%rbp)
cmpq -0x90(%rbp), %rcx
je 0x34e1
leaq -0xd8(%rbp), %r12
leaq -0x2c(%rbp), %r15
movq %r12, %rdi
movq %r15, %rsi
callq 0x5026
cmpl $0x0, (%rax)
je 0x3391
movq -0x70(%rbp), %rax
movq -0x60(%rbp), %rcx
addq $-0x4, %rcx
cmpq %rcx, %rax
je 0x33b1
movl -0x2c(%rbp), %ecx
movl %ecx, (%rax)
addq $0x4, %rax
movq %rax, -0x70(%rbp)
jmp 0x33c0
movq -0x48(%rbp), %rsi
cmpq -0x40(%rbp), %rsi
je 0x3469
movl -0x2c(%rbp), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, -0x48(%rbp)
jmp 0x3475
leaq -0xa0(%rbp), %rdi
movq %r15, %rsi
callq 0x547c
movq %rbx, %rdi
movq %r15, %rsi
callq 0x4d1c
movq 0x8(%rax), %rax
movl 0x10(%rax), %eax
movl %eax, -0x30(%rbp)
cmpl %eax, -0x2c(%rbp)
jne 0x342c
movq %rbx, %rdi
movq %r15, %rsi
callq 0x4d1c
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 0x5026
decl (%rax)
movq %r12, %rdi
leaq -0x30(%rbp), %rsi
callq 0x5026
decl (%rax)
movl -0x30(%rbp), %eax
movl %eax, -0x2c(%rbp)
movq -0x70(%rbp), %rax
jmp 0x34d4
movq %rbx, %rdi
leaq -0x30(%rbp), %rsi
callq 0x4d1c
movq %rax, %r13
movq (%rax), %r14
cmpq %r13, %r14
je 0x33da
movl 0x10(%r14), %eax
cmpl -0x2c(%rbp), %eax
jne 0x3464
movq %rbx, %rdi
leaq -0x30(%rbp), %rsi
callq 0x4d1c
leaq 0x10(%r14), %rsi
movq %rax, %rdi
callq 0x480e
movq (%r14), %r14
jmp 0x343e
leaq -0x50(%rbp), %rdi
movq %r15, %rdx
callq 0x568e
movq -0x70(%rbp), %rax
movq -0x68(%rbp), %rdi
cmpq %rdi, %rax
je 0x348e
movl -0x4(%rax), %ecx
addq $-0x4, %rax
movl %ecx, -0x2c(%rbp)
jmp 0x34d0
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)
cmpq -0x90(%rbp), %rax
jne 0x3361
movq -0x48(%rbp), %rax
subq -0x50(%rbp), %rax
shrq $0x2, %rax
decl %eax
js 0x3531
movl %eax, %r15d
incq %r15
movq 0x6ad2(%rip), %rbx      # 0x9fd0
leaq 0x3b31(%rip), %r14      # 0x7036
movq -0x50(%rbp), %rax
movl -0x4(%rax,%r15,4), %esi
movq %rbx, %rdi
callq 0x2250
cmpq $0x1, %r15
je 0x3531
movl $0x4, %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2180
decq %r15
jg 0x3505
movq 0x6a98(%rip), %rdi      # 0x9fd0
movq (%rdi), %rax
addq -0x18(%rax), %rdi
movl $0xa, %esi
callq 0x2140
movsbl %al, %esi
movq 0x6a7d(%rip), %rdi      # 0x9fd0
callq 0x2030
movq %rax, %rdi
callq 0x20f0
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
je 0x3575
movq -0x40(%rbp), %rsi
subq %rdi, %rsi
callq 0x2160
leaq -0xa0(%rbp), %rdi
callq 0x4ba6
leaq -0xd8(%rbp), %rdi
callq 0x4c0c
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x35d8
jmp 0x35a9
jmp 0x35d8
jmp 0x35d8
jmp 0x35d8
movq %rax, %rbx
jmp 0x35fc
jmp 0x35d8
movq %rax, %rbx
movq -0x98(%rbp), %rdi
cmpq %r14, %rdi
je 0x35fc
movq (%rdi), %r15
movl $0x18, %esi
callq 0x2160
movq %r15, %rdi
cmpq %r14, %r15
jne 0x35bf
jmp 0x35fc
jmp 0x35d8
movq %rax, %rbx
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
je 0x35f0
movq -0x40(%rbp), %rsi
subq %rdi, %rsi
callq 0x2160
leaq -0xa0(%rbp), %rdi
callq 0x4ba6
leaq -0xd8(%rbp), %rdi
callq 0x4c0c
movq %rbx, %rdi
callq 0x2260