// File: iPapatsoris[P]Maximum-Independent-Set/src/Alg.hpp
// Function: Alg::BranchingRule::getOptimalNode(Graph const&, unsigned int const&)
void getOptimalNode(const Graph &graph, const uint32_t &theta) {
            bool found = false;
            uint32_t count = 0;
            Graph::GraphTraversal graphTraversal(graph);
            while (graphTraversal.curNode != NONE) {
                if (graph.getNodeDegree(graphTraversal.curNode) == theta) {
                    count++;
                    uint32_t node = graphTraversal.curNode;
                    switch (theta) {
                        case 8: {
                            uint32_t degree8Neighbors = graph.getNumberOfDegreeNeighbors(node, 8);
                            if (degree8Neighbors <= 7) {
                                found = true;
                            } else if (degree8Neighbors == 8 && getMeasure(graph, node) >= 36) {
                                found = true;
                            }
                            break;
                        }
                        case 7: {
                            std::unordered_set<uint32_t> extendedGrandchildren;
                            graph.getExtendedGrandchildren(graphTraversal, extendedGrandchildren, NULL, true);
                            if (extendedGrandchildren.size()) {
                                found = true;
                            } else {
                                uint32_t degree7Neighbors = graph.getNumberOfDegreeNeighbors(node, 7);
                                if (degree7Neighbors <= 5) {
                                    found = true;
                                } else {
                                    uint32_t measure = getMeasure(graph, node);
                                    if (degree7Neighbors == 6 && measure >= 22 - 2 * graph.getNumberOfDegreeNeighbors(node, 3) - graph.getNumberOfDegreeNeighbors(node, 4) ||
                                    degree7Neighbors == 7 && measure >= 26) {
                                        found = true;
                                    }
                                }
                            }
                            break;
                        }
                        case 6: {
                            if (graph.getNumberOfDegreeNeighbors(node, 3) >= 1) {
                                found = true;
                            } else {
                                uint32_t degree6Neighbors = graph.getNumberOfDegreeNeighbors(node, 6);
                                if (degree6Neighbors <= 3) {
                                    found = true;
                                } else {
                                    uint32_t degree5Neighbors = graph.getNumberOfDegreeNeighbors(node, 5);
                                    if (degree6Neighbors == 4 && degree5Neighbors <= 1) {
                                        found = true;
                                    } else {
                                        std::unordered_set<uint32_t> neighborsAtDistance2;
                                        uint32_t count = 0;
                                        graph.getNeighborsAtDistance2(node, neighborsAtDistance2, theta, &count);
                                        uint32_t measure = getMeasure(graph, node, &neighborsAtDistance2);
                                        measure += count;
                                        if (degree6Neighbors == 4 && degree5Neighbors == 2 && measure >= 17 ||
                                        degree6Neighbors == 5 && graph.getNumberOfDegreeNeighbors(node, 4) == 1 && measure >= 18 ||
                                        degree6Neighbors == 5 && degree5Neighbors == 1 && measure >= 19 ||
                                        degree6Neighbors == 6 && measure >= 22) {
                                            found = true;
                                        }
                                    }
                                }
                            }
                            break;
                        }
                        default:
                            assert(false);
                    }
                    if (found) {
                        break;
                    }
                }
                graph.getNextNode(graphTraversal);
            }
            assert(found);
            node1 = graphTraversal.curNode;
        }

// Assembly:
subq $0x168, %rsp            # imm = 0x168
movq %rdi, 0x160(%rsp)
movq %rsi, 0x158(%rsp)
movq %rdx, 0x150(%rsp)
movq 0x160(%rsp), %rax
movq %rax, 0x50(%rsp)
movb $0x0, 0x14f(%rsp)
movl $0x0, 0x148(%rsp)
movq 0x158(%rsp), %rsi
leaq 0x140(%rsp), %rdi
callq 0x2a40
cmpl $-0x1, 0x140(%rsp)
je 0x3f01b
movq 0x158(%rsp), %rdi
leaq 0x140(%rsp), %rsi
callq 0x1a040
movq 0x150(%rsp), %rcx
cmpl (%rcx), %eax
jne 0x3f001
movl 0x148(%rsp), %eax
incl %eax
movl %eax, 0x148(%rsp)
movl 0x140(%rsp), %eax
movl %eax, 0x13c(%rsp)
movq 0x150(%rsp), %rax
movl (%rax), %eax
movl %eax, 0x4c(%rsp)
subl $0x6, %eax
je 0x3ed51
jmp 0x3ea7e
movl 0x4c(%rsp), %eax
subl $0x7, %eax
je 0x3eb29
jmp 0x3ea8d
movl 0x4c(%rsp), %eax
subl $0x8, %eax
jne 0x3efd4
jmp 0x3ea9c
movq 0x158(%rsp), %rdi
movl $0x8, 0x134(%rsp)
movl $0x0, 0x130(%rsp)
leaq 0x13c(%rsp), %rsi
leaq 0x134(%rsp), %rdx
leaq 0x130(%rsp), %rcx
callq 0x2d40
movl %eax, 0x138(%rsp)
cmpl $0x7, 0x138(%rsp)
ja 0x3eaf2
movb $0x1, 0x14f(%rsp)
jmp 0x3eb24
cmpl $0x8, 0x138(%rsp)
jne 0x3eb22
movq 0x158(%rsp), %rdi
leaq 0x13c(%rsp), %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0x3f080
cmpl $0x24, %eax
jb 0x3eb22
movb $0x1, 0x14f(%rsp)
jmp 0x3eb24
jmp 0x3eff3
leaq 0xf8(%rsp), %rdi
movq %rdi, 0x40(%rsp)
callq 0x1a020
movq 0x40(%rsp), %rdx
movq 0x158(%rsp), %rdi
movb $0x1, 0xf7(%rsp)
xorl %eax, %eax
movl %eax, %ecx
leaq 0x140(%rsp), %rsi
leaq 0xf7(%rsp), %r8
callq 0x4f80
jmp 0x3eb6b
leaq 0xf8(%rsp), %rdi
callq 0x191e0
cmpq $0x0, %rax
je 0x3ebb1
movb $0x1, 0x14f(%rsp)
jmp 0x3ed3f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xe8(%rsp)
movl %eax, 0xe4(%rsp)
leaq 0xf8(%rsp), %rdi
callq 0x1a030
jmp 0x3f05d
movq 0x158(%rsp), %rdi
movl $0x7, 0xdc(%rsp)
movl $0x0, 0xd8(%rsp)
leaq 0x13c(%rsp), %rsi
leaq 0xdc(%rsp), %rdx
leaq 0xd8(%rsp), %rcx
callq 0x2d40
movl %eax, 0x3c(%rsp)
jmp 0x3ebf2
movl 0x3c(%rsp), %eax
movl %eax, 0xe0(%rsp)
cmpl $0x5, 0xe0(%rsp)
ja 0x3ec14
movb $0x1, 0x14f(%rsp)
jmp 0x3ed3d
movq 0x158(%rsp), %rdi
xorl %eax, %eax
movl %eax, %edx
leaq 0x13c(%rsp), %rsi
callq 0x3f080
movl %eax, 0x38(%rsp)
jmp 0x3ec33
movl 0x38(%rsp), %eax
movl %eax, 0xd4(%rsp)
cmpl $0x6, 0xe0(%rsp)
jne 0x3ed02
movl 0xd4(%rsp), %eax
movl %eax, 0x30(%rsp)
movq 0x158(%rsp), %rdi
movl $0x3, 0xd0(%rsp)
movl $0x0, 0xcc(%rsp)
leaq 0x13c(%rsp), %rsi
leaq 0xd0(%rsp), %rdx
leaq 0xcc(%rsp), %rcx
callq 0x2d40
movl %eax, 0x34(%rsp)
jmp 0x3ec98
movl 0x34(%rsp), %ecx
addl %ecx, %ecx
movl $0x16, %eax
subl %ecx, %eax
movl %eax, 0x28(%rsp)
movq 0x158(%rsp), %rdi
movl $0x4, 0xc8(%rsp)
movl $0x0, 0xc4(%rsp)
leaq 0x13c(%rsp), %rsi
leaq 0xc8(%rsp), %rdx
leaq 0xc4(%rsp), %rcx
callq 0x2d40
movl %eax, 0x2c(%rsp)
jmp 0x3ecea
movl 0x30(%rsp), %ecx
movl 0x2c(%rsp), %eax
movl 0x28(%rsp), %edx
subl %eax, %edx
movb $0x1, %al
cmpl %edx, %ecx
movb %al, 0x27(%rsp)
jae 0x3ed29
xorl %eax, %eax
cmpl $0x7, 0xe0(%rsp)
movb %al, 0x26(%rsp)
jne 0x3ed21
cmpl $0x1a, 0xd4(%rsp)
setae %al
movb %al, 0x26(%rsp)
movb 0x26(%rsp), %al
movb %al, 0x27(%rsp)
movb 0x27(%rsp), %al
testb $0x1, %al
jne 0x3ed33
jmp 0x3ed3b
movb $0x1, 0x14f(%rsp)
jmp 0x3ed3d
jmp 0x3ed3f
leaq 0xf8(%rsp), %rdi
callq 0x1a030
jmp 0x3eff3
movq 0x158(%rsp), %rdi
movl $0x3, 0xc0(%rsp)
movl $0x0, 0xbc(%rsp)
leaq 0x13c(%rsp), %rsi
leaq 0xc0(%rsp), %rdx
leaq 0xbc(%rsp), %rcx
callq 0x2d40
cmpl $0x1, %eax
jb 0x3ed9e
movb $0x1, 0x14f(%rsp)
jmp 0x3efd2
movq 0x158(%rsp), %rdi
movl $0x6, 0xb4(%rsp)
movl $0x0, 0xb0(%rsp)
leaq 0x13c(%rsp), %rsi
leaq 0xb4(%rsp), %rdx
leaq 0xb0(%rsp), %rcx
callq 0x2d40
movl %eax, 0xb8(%rsp)
cmpl $0x3, 0xb8(%rsp)
ja 0x3edf7
movb $0x1, 0x14f(%rsp)
jmp 0x3efd0
movq 0x158(%rsp), %rdi
movl $0x5, 0xa8(%rsp)
movl $0x0, 0xa4(%rsp)
leaq 0x13c(%rsp), %rsi
leaq 0xa8(%rsp), %rdx
leaq 0xa4(%rsp), %rcx
callq 0x2d40
movl %eax, 0xac(%rsp)
cmpl $0x4, 0xb8(%rsp)
jne 0x3ee5a
cmpl $0x1, 0xac(%rsp)
ja 0x3ee5a
movb $0x1, 0x14f(%rsp)
jmp 0x3efce
leaq 0x68(%rsp), %rdi
movq %rdi, 0x18(%rsp)
callq 0x1a020
movq 0x18(%rsp), %rdx
movl $0x0, 0x64(%rsp)
movq 0x158(%rsp), %rdi
movq 0x150(%rsp), %rcx
leaq 0x13c(%rsp), %rsi
leaq 0x64(%rsp), %r8
callq 0x2f30
jmp 0x3ee9a
movq 0x158(%rsp), %rdi
leaq 0x13c(%rsp), %rsi
leaq 0x68(%rsp), %rdx
callq 0x3f080
movl %eax, 0x14(%rsp)
jmp 0x3eeba
movl 0x14(%rsp), %eax
movl %eax, 0x60(%rsp)
movl 0x64(%rsp), %eax
addl 0x60(%rsp), %eax
movl %eax, 0x60(%rsp)
cmpl $0x4, 0xb8(%rsp)
jne 0x3eef3
cmpl $0x2, 0xac(%rsp)
jne 0x3eef3
movb $0x1, %al
cmpl $0x11, 0x60(%rsp)
movb %al, 0x13(%rsp)
jae 0x3ef8d
cmpl $0x5, 0xb8(%rsp)
jne 0x3ef48
movq 0x158(%rsp), %rdi
movl $0x4, 0x5c(%rsp)
movl $0x0, 0x58(%rsp)
leaq 0x13c(%rsp), %rsi
leaq 0x5c(%rsp), %rdx
leaq 0x58(%rsp), %rcx
callq 0x2d40
movl %eax, 0xc(%rsp)
jmp 0x3ef32
movl 0xc(%rsp), %eax
cmpl $0x1, %eax
jne 0x3ef48
movb $0x1, %al
cmpl $0x12, 0x60(%rsp)
movb %al, 0x13(%rsp)
jae 0x3ef8d
cmpl $0x5, 0xb8(%rsp)
jne 0x3ef69
cmpl $0x1, 0xac(%rsp)
jne 0x3ef69
movb $0x1, %al
cmpl $0x13, 0x60(%rsp)
movb %al, 0x13(%rsp)
jae 0x3ef8d
xorl %eax, %eax
cmpl $0x6, 0xb8(%rsp)
movb %al, 0xb(%rsp)
jne 0x3ef85
cmpl $0x16, 0x60(%rsp)
setae %al
movb %al, 0xb(%rsp)
movb 0xb(%rsp), %al
movb %al, 0x13(%rsp)
movb 0x13(%rsp), %al
testb $0x1, %al
jne 0x3ef97
jmp 0x3efc4
movb $0x1, 0x14f(%rsp)
jmp 0x3efc4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xe8(%rsp)
movl %eax, 0xe4(%rsp)
leaq 0x68(%rsp), %rdi
callq 0x1a030
jmp 0x3f05d
leaq 0x68(%rsp), %rdi
callq 0x1a030
jmp 0x3efd0
jmp 0x3efd2
jmp 0x3eff3
leaq 0x71ab(%rip), %rdi      # 0x46186
leaq 0x7b2b(%rip), %rsi      # 0x46b0d
movl $0xef, %edx
leaq 0x7b82(%rip), %rcx      # 0x46b70
callq 0x2110
testb $0x1, 0x14f(%rsp)
je 0x3efff
jmp 0x3f01b
jmp 0x3f001
movq 0x158(%rsp), %rdi
leaq 0x140(%rsp), %rsi
callq 0x185f0
jmp 0x3ea14
testb $0x1, 0x14f(%rsp)
je 0x3f027
jmp 0x3f046
leaq 0x7b8b(%rip), %rdi      # 0x46bb9
leaq 0x7ad8(%rip), %rsi      # 0x46b0d
movl $0xf7, %edx
leaq 0x7b2f(%rip), %rcx      # 0x46b70
callq 0x2110
movq 0x50(%rsp), %rax
movl 0x140(%rsp), %ecx
movl %ecx, 0x4(%rax)
addq $0x168, %rsp            # imm = 0x168
retq
movq 0xe8(%rsp), %rdi
callq 0x2310
nopw (%rax,%rax)