// File: iPapatsoris[P]Maximum-Independent-Set/src/Graph.hpp
// Function: Graph::getNextNode(Graph::GraphTraversal&) const
void getNextNode(GraphTraversal &graphTraversal) const {
        bool firstTime = true;
        uint32_t pos;
        if (graphTraversal.curNode == NONE) {
            pos = NONE;
        } else {
            pos = (!mapping ? graphTraversal.curNode : idToPos->at(graphTraversal.curNode));
        }
        while (firstTime || pos == NONE || !nodeIndex[pos].edges) {
            if (pos == NONE && nodeIndex.size() || pos != NONE && pos < nodeIndex.size() - 1) {
                pos = (pos == NONE ? 0 : pos+1);
                if (nodeIndex[pos].removed) {
                    continue;
                }
                graphTraversal.curNode = (!mapping ? pos : (*posToId)[pos]);
                uint32_t offset = getFirstValidNeighborOffset(pos);
                if ((graphTraversal.curEdgeOffset = offset) != NONE) {
                    firstTime = false;
                }
            }
            else {
                graphTraversal.curNode = NONE;
                graphTraversal.curEdgeOffset = NONE;
                break;
            }
        }
    }

// Assembly:
subq $0x48, %rsp
movq %rdi, 0x40(%rsp)
movq %rsi, 0x38(%rsp)
movq 0x40(%rsp), %rax
movq %rax, 0x20(%rsp)
movb $0x1, 0x37(%rsp)
movq 0x38(%rsp), %rax
cmpl $-0x1, (%rax)
jne 0x18621
movl $0xffffffff, 0x30(%rsp) # imm = 0xFFFFFFFF
jmp 0x1865a
movq 0x20(%rsp), %rax
testb $0x1, 0x3c(%rax)
jne 0x18639
movq 0x38(%rsp), %rax
movl (%rax), %eax
movl %eax, 0x1c(%rsp)
jmp 0x18652
movq 0x20(%rsp), %rax
movq 0x40(%rax), %rdi
movq 0x38(%rsp), %rsi
callq 0x188b0
movl (%rax), %eax
movl %eax, 0x1c(%rsp)
movl 0x1c(%rsp), %eax
movl %eax, 0x30(%rsp)
jmp 0x1865c
movb $0x1, %al
testb $0x1, 0x37(%rsp)
movb %al, 0x1b(%rsp)
jne 0x18693
movb $0x1, %al
cmpl $-0x1, 0x30(%rsp)
movb %al, 0x1b(%rsp)
je 0x18693
movq 0x20(%rsp), %rdi
movl 0x30(%rsp), %eax
movl %eax, %esi
callq 0x18850
cmpl $0x0, 0x4(%rax)
setne %al
xorb $-0x1, %al
movb %al, 0x1b(%rsp)
movb 0x1b(%rsp), %al
testb $0x1, %al
jne 0x186a0
jmp 0x187aa
cmpl $-0x1, 0x30(%rsp)
jne 0x186b7
movq 0x20(%rsp), %rdi
callq 0x18830
cmpq $0x0, %rax
jne 0x186ea
cmpl $-0x1, 0x30(%rsp)
je 0x1878c
movq 0x20(%rsp), %rdi
movl 0x30(%rsp), %eax
movq %rax, 0x10(%rsp)
callq 0x18830
movq %rax, %rcx
movq 0x10(%rsp), %rax
subq $0x1, %rcx
cmpq %rcx, %rax
jae 0x1878c
cmpl $-0x1, 0x30(%rsp)
jne 0x186f9
xorl %eax, %eax
movl %eax, 0xc(%rsp)
jmp 0x18704
movl 0x30(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xc(%rsp)
movq 0x20(%rsp), %rdi
movl 0xc(%rsp), %eax
movl %eax, 0x30(%rsp)
movl 0x30(%rsp), %eax
movl %eax, %esi
callq 0x18850
testb $0x1, 0x8(%rax)
je 0x18727
jmp 0x1865c
movq 0x20(%rsp), %rax
testb $0x1, 0x3c(%rax)
jne 0x1873c
movl 0x30(%rsp), %eax
movl %eax, 0x8(%rsp)
jmp 0x18756
movq 0x20(%rsp), %rax
movq 0x48(%rax), %rdi
movl 0x30(%rsp), %eax
movl %eax, %esi
callq 0x18900
movl (%rax), %eax
movl %eax, 0x8(%rsp)
movq 0x20(%rsp), %rdi
movl 0x8(%rsp), %ecx
movq 0x38(%rsp), %rax
movl %ecx, (%rax)
leaq 0x30(%rsp), %rsi
callq 0x1ca50
movl %eax, 0x2c(%rsp)
movl 0x2c(%rsp), %eax
movq 0x38(%rsp), %rcx
movl %eax, 0x4(%rcx)
cmpl $-0x1, %eax
je 0x1878a
movb $0x0, 0x37(%rsp)
jmp 0x187a5
movq 0x38(%rsp), %rax
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
movq 0x38(%rsp), %rax
movl $0xffffffff, 0x4(%rax)  # imm = 0xFFFFFFFF
jmp 0x187aa
jmp 0x1865c
addq $0x48, %rsp
retq
nop