// File: minimind[P]simple-graph/unittest/../graph/graph.hpp
// Function: void visit_edges_depth_first_hidden<(anonymous namespace)::NodeVisitor, SimpleGraph::NodeIterator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, SimpleGraph::EdgeIterator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>(SimpleGraph::NodeIterator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, (anonymous namespace)::NodeVisitor&, unsigned long)
void visit_edges_depth_first_hidden( I head, F& visitor, const unsigned long keyToIgnore )
{
  if ( head.key() == keyToIgnore )
  {
    return;
  }

  std::set< unsigned long >                            visitedNodes;
  typename std::stack< std::pair< unsigned long, J > > nodeKeysToVisit;

  add_edges_to_stack( nodeKeysToVisit, head, keyToIgnore );
  visitedNodes.insert( head.key() );

  while ( !nodeKeysToVisit.empty() )
  {
    std::pair< unsigned long, J > currentEdge = nodeKeysToVisit.top();
    nodeKeysToVisit.pop();

    const unsigned long currentNodeKey = currentEdge.first;
    I realLeft  = currentEdge.second.left();
    I realRight = currentEdge.second.right();

    if ( realLeft.key() != currentNodeKey )
    {
      std::swap( realLeft, realRight );
    }

    // Might need to visit the real right node...
    if ( visitedNodes.find( realRight.key() ) == visitedNodes.end() &&
         realLeft.key()  != keyToIgnore                             &&
         realRight.key() != keyToIgnore )
    {
      // We do have to visit this node...
      // Actually perform the user code
      visitor( realLeft, realRight, currentEdge.second );
      visitedNodes.insert( currentNodeKey );
      add_edges_to_stack( nodeKeysToVisit, realRight, keyToIgnore );
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x180, %rsp            # imm = 0x180
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
leaq -0x8(%rbp), %rdi
callq 0x55570
cmpq -0x18(%rbp), %rax
jne 0x65e6b
jmp 0x66180
leaq -0x48(%rbp), %rdi
callq 0x6c0e0
leaq -0x98(%rbp), %rdi
callq 0x6c100
jmp 0x65e82
movq -0x18(%rbp), %rdx
leaq -0x98(%rbp), %rdi
leaq -0x8(%rbp), %rsi
callq 0x6c130
jmp 0x65e98
leaq -0x8(%rbp), %rdi
callq 0x55570
movq %rax, -0xb0(%rbp)
leaq -0x48(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0x6c210
movb %dl, -0x131(%rbp)
movq %rax, -0x130(%rbp)
jmp 0x65ec7
movb -0x131(%rbp), %al
movq -0x130(%rbp), %rcx
movq %rcx, -0xc0(%rbp)
movb %al, -0xb8(%rbp)
leaq -0x98(%rbp), %rdi
callq 0x6c260
movb %al, -0x132(%rbp)
jmp 0x65ef5
movb -0x132(%rbp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x65f06
jmp 0x6616b
leaq -0x98(%rbp), %rdi
callq 0x6c280
movq %rax, -0x140(%rbp)
jmp 0x65f1b
movq -0x140(%rbp), %rax
movups (%rax), %xmm0
movaps %xmm0, -0xd0(%rbp)
leaq -0x98(%rbp), %rdi
callq 0x6c2a0
jmp 0x65f3a
movq -0xd0(%rbp), %rax
movq %rax, -0xd8(%rbp)
leaq -0xc8(%rbp), %rdi
callq 0x55620
movq %rax, -0x148(%rbp)
jmp 0x65f5d
movq -0x148(%rbp), %rax
movq %rax, -0xe0(%rbp)
leaq -0xc8(%rbp), %rdi
callq 0x55650
movq %rax, -0x150(%rbp)
jmp 0x65f80
movq -0x150(%rbp), %rax
movq %rax, -0xe8(%rbp)
leaq -0xe0(%rbp), %rdi
callq 0x55570
cmpq -0xd8(%rbp), %rax
je 0x65ff2
leaq -0xe0(%rbp), %rdi
leaq -0xe8(%rbp), %rsi
callq 0x6c2c0
jmp 0x65ff2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
jmp 0x66189
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa0(%rbp)
movl %eax, -0xa4(%rbp)
leaq -0x98(%rbp), %rdi
callq 0x6c420
jmp 0x66189
leaq -0xe8(%rbp), %rdi
callq 0x55570
movq %rax, -0xf8(%rbp)
leaq -0x48(%rbp), %rdi
leaq -0xf8(%rbp), %rsi
callq 0x6c330
movq %rax, -0x158(%rbp)
jmp 0x6601e
movq -0x158(%rbp), %rax
movq %rax, -0xf0(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x6c370
movq %rax, -0x100(%rbp)
leaq -0xf0(%rbp), %rdi
leaq -0x100(%rbp), %rsi
callq 0x6c300
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, -0x159(%rbp)
jne 0x66060
jmp 0x66096
leaq -0xe0(%rbp), %rdi
callq 0x55570
movq %rax, %rcx
xorl %eax, %eax
cmpq -0x18(%rbp), %rcx
movb %al, -0x159(%rbp)
je 0x66096
leaq -0xe8(%rbp), %rdi
callq 0x55570
cmpq -0x18(%rbp), %rax
setne %al
movb %al, -0x159(%rbp)
movb -0x159(%rbp), %al
testb $0x1, %al
jne 0x660a5
jmp 0x66166
movq -0x10(%rbp), %rax
movq %rax, -0x168(%rbp)
leaq -0x108(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
callq 0x57dc0
jmp 0x660c5
leaq -0x110(%rbp), %rdi
leaq -0xe8(%rbp), %rsi
callq 0x57dc0
jmp 0x660da
leaq -0xc8(%rbp), %rsi
leaq -0x118(%rbp), %rdi
callq 0x6c3a0
jmp 0x660ef
movq -0x168(%rbp), %rdi
leaq -0x108(%rbp), %rsi
leaq -0x110(%rbp), %rdx
leaq -0x118(%rbp), %rcx
callq 0x661a0
jmp 0x66112
leaq -0x48(%rbp), %rdi
leaq -0xd8(%rbp), %rsi
callq 0x6c3d0
movb %dl, -0x171(%rbp)
movq %rax, -0x170(%rbp)
jmp 0x66131
movb -0x171(%rbp), %al
movq -0x170(%rbp), %rcx
movq %rcx, -0x128(%rbp)
movb %al, -0x120(%rbp)
movq -0x18(%rbp), %rdx
leaq -0x98(%rbp), %rdi
leaq -0xe8(%rbp), %rsi
callq 0x6c130
jmp 0x66164
jmp 0x66166
jmp 0x65ee1
leaq -0x98(%rbp), %rdi
callq 0x6c420
leaq -0x48(%rbp), %rdi
callq 0x6c440
addq $0x180, %rsp            # imm = 0x180
popq %rbp
retq
leaq -0x48(%rbp), %rdi
callq 0x6c440
movq -0xa0(%rbp), %rdi
callq 0xb920
nop