// File: iPapatsoris[P]Maximum-Independent-Set/src/Graph.cpp
// Function: Graph::getOptimalDegree4Node2() const
uint32_t Graph::getOptimalDegree4Node2() const {
    GraphTraversal graphTraversal(*this);
    while (graphTraversal.curNode != NONE) {
        if (getNodeDegree(graphTraversal.curNode) == 4) {
            vector<uint32_t> neighborsV;
            gatherNeighbors(graphTraversal.curNode, neighborsV);
            for (uint32_t neighborV: neighborsV) {
                if (getNodeDegree(neighborV) == 3) {
                    vector<uint32_t> neighborsN;
                    gatherNeighbors(neighborV, neighborsN);
                    for (uint32_t neighborN: neighborsN) {
                        if (neighborN != graphTraversal.curNode && getNodeDegree(neighborN) == 4) {
                            return graphTraversal.curNode;
                        }
                    }
                }
            }
        }
        getNextNode(graphTraversal);
    }
    return NONE;
}

// Assembly:
subq $0xd8, %rsp
movq %rdi, 0xc8(%rsp)
movq 0xc8(%rsp), %rsi
movq %rsi, 0x28(%rsp)
leaq 0xc0(%rsp), %rdi
callq 0x2a40
cmpl $-0x1, 0xc0(%rsp)
je 0x57f9
movq 0x28(%rsp), %rdi
leaq 0xc0(%rsp), %rsi
callq 0x1a040
cmpl $0x4, %eax
jne 0x57e2
leaq 0xa8(%rsp), %rdi
movq %rdi, 0x20(%rsp)
callq 0x17e60
movq 0x28(%rsp), %rdi
movq 0x20(%rsp), %rdx
movl $0xffffffff, 0xa4(%rsp) # imm = 0xFFFFFFFF
xorl %eax, %eax
movl %eax, %ecx
leaq 0xc0(%rsp), %rsi
leaq 0xa4(%rsp), %r8
callq 0x19c30
jmp 0x55e4
leaq 0xa8(%rsp), %rax
movq %rax, 0x88(%rsp)
movq 0x88(%rsp), %rdi
callq 0x19b50
movq %rax, 0x80(%rsp)
movq 0x88(%rsp), %rdi
callq 0x1a0e0
movq %rax, 0x78(%rsp)
leaq 0x80(%rsp), %rdi
leaq 0x78(%rsp), %rsi
callq 0x1a110
testb $0x1, %al
jne 0x5636
jmp 0x57b0
leaq 0x80(%rsp), %rdi
callq 0x1a150
movq 0x28(%rsp), %rdi
movl (%rax), %eax
movl %eax, 0x74(%rsp)
leaq 0x74(%rsp), %rsi
callq 0x1a040
movl %eax, 0x1c(%rsp)
jmp 0x565e
movl 0x1c(%rsp), %eax
cmpl $0x3, %eax
jne 0x579c
leaq 0x58(%rsp), %rdi
movq %rdi, 0x10(%rsp)
callq 0x17e60
movq 0x28(%rsp), %rdi
movq 0x10(%rsp), %rdx
movl $0xffffffff, 0x54(%rsp) # imm = 0xFFFFFFFF
xorl %eax, %eax
movl %eax, %ecx
leaq 0x74(%rsp), %rsi
leaq 0x54(%rsp), %r8
callq 0x19c30
jmp 0x56a1
leaq 0x58(%rsp), %rax
movq %rax, 0x48(%rsp)
movq 0x48(%rsp), %rdi
callq 0x19b50
movq %rax, 0x40(%rsp)
movq 0x48(%rsp), %rdi
callq 0x1a0e0
movq %rax, 0x38(%rsp)
leaq 0x40(%rsp), %rdi
leaq 0x38(%rsp), %rsi
callq 0x1a110
testb $0x1, %al
jne 0x56e1
jmp 0x577e
leaq 0x40(%rsp), %rdi
callq 0x1a150
movl (%rax), %eax
movl %eax, 0x34(%rsp)
movl 0x34(%rsp), %eax
cmpl 0xc0(%rsp), %eax
je 0x576d
movq 0x28(%rsp), %rdi
leaq 0x34(%rsp), %rsi
callq 0x1a040
movl %eax, 0xc(%rsp)
jmp 0x5713
movl 0xc(%rsp), %eax
cmpl $0x4, %eax
jne 0x576d
movl 0xc0(%rsp), %eax
movl %eax, 0xd4(%rsp)
movl $0x1, 0x30(%rsp)
jmp 0x5786
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x98(%rsp)
movl %eax, 0x94(%rsp)
jmp 0x57d3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x98(%rsp)
movl %eax, 0x94(%rsp)
leaq 0x58(%rsp), %rdi
callq 0x18520
jmp 0x57d3
jmp 0x576f
leaq 0x40(%rsp), %rdi
callq 0x1a160
jmp 0x56c9
movl $0x0, 0x30(%rsp)
leaq 0x58(%rsp), %rdi
callq 0x18520
movl 0x30(%rsp), %eax
testl %eax, %eax
jne 0x57b8
jmp 0x579a
jmp 0x579c
jmp 0x579e
leaq 0x80(%rsp), %rdi
callq 0x1a160
jmp 0x561b
movl $0x0, 0x30(%rsp)
leaq 0xa8(%rsp), %rdi
callq 0x18520
movl 0x30(%rsp), %eax
testl %eax, %eax
je 0x57d1
jmp 0x57cf
jmp 0x5804
jmp 0x57e2
leaq 0xa8(%rsp), %rdi
callq 0x18520
jmp 0x5813
movq 0x28(%rsp), %rdi
leaq 0xc0(%rsp), %rsi
callq 0x185f0
jmp 0x5579
movl $0xffffffff, 0xd4(%rsp) # imm = 0xFFFFFFFF
movl 0xd4(%rsp), %eax
addq $0xd8, %rsp
retq
movq 0x98(%rsp), %rdi
callq 0x2310