// File: /workspace/github_cpp_makefile_star2_O2/iPapatsoris[P]Maximum-Independent-Set/src/Alg.hpp
// Function: Alg::BranchingRule::choose(Graph const&, Reductions&, unsigned int&, Alg::SearchNode*)
void choose(const Graph &graph, Reductions &reductions, uint32_t &theta, SearchNode *searchNode) {
            uint32_t maxDegree = 0;
            uint32_t maxDegreeNode = NONE;
            graph.getMaxNodeDegree(maxDegreeNode, maxDegree);
            bool run = true;
            while (run) {
                //std::cout << "theta " << theta << " max degree " << maxDegree << "\n";
                run = false;
                switch (theta) {
                    case 8:
                    case 7:
                    case 6:
                        if (maxDegree > theta) {
                            type = Type::MAX_DEGREE;
                        } else if (maxDegree == theta) {
                            graph.getOptimalShortEdge(theta, node1, node2, container);
                            if (node1 != NONE) {
                                type = Type::SHORT_EDGE;
                                //std::cout << "optimal short edge " << node1 << " " << node2 << " with size " << container.size() << "\n";
                            } else {
                                type = Type::OPTNODE;
                                getOptimalNode(graph, theta);
                            }
                        } else {
                            theta = maxDegree;
                            if (theta < 3) {
                                theta = 3;
                            } else if (theta == 5 && searchNode->handleCuts()) {
                                return;
                            }
                            if (graph.nodeIndex.size()) {
                                reductions.run(theta);
                                graph.getMaxNodeDegree(maxDegreeNode, maxDegree);
                                run = true;
                            } else {
                                type = Type::DONE;
                            }
                        }
                        break;
                    case 5:
                        if (!maxDegree) {
                            type = Type::DONE;
                        } else if (maxDegree >= 6) {
                            type = Type::MAX_DEGREE;
                        } else if (graph.getGoodFunnelTheta5(node1, node2)) {
                            type = Type::GOOD_FUNNEL;
                        } else if (graph.getGoodPair(node1, node2, container)) {
                            type = Type::GOOD_PAIR;
                        } else if (maxDegree >= 5) {
                            node1 = graph.getOptimalDegree5Node();
                            type = Type::OPTNODE;
                        } else if (maxDegree < theta) {
                            theta = maxDegree;
                            if (theta < 3) {
                                theta = 3;
                            }
                            if (graph.nodeIndex.size()) {
                                reductions.run(theta);
                                graph.getMaxNodeDegree(maxDegreeNode, maxDegree);
                                run = true;
                            } else {
                                type = Type::DONE;
                            }
                        }
                        break;
                    case 4: {
                        type = Type::MAX_DEGREE;
                        if (maxDegree >= 5) {
                            uint32_t goodNode = graph.getGoodNode(reductions.getCCToNodes());
                            if (goodNode != NONE) {
                                maxDegreeNode = goodNode;
                            }
                        } else if (graph.getGoodFunnel(node1, node2)) {
                            type = Type::GOOD_FUNNEL;
                        } else if (graph.get4Cycle(container)) {
                            type = Type::FOUR_CYCLE;
                            //std::cout << "branching on optimal cycle " << container[0] << "-" << container[1] << "-" << container[2] << "-" << container[3] << "\n";
                        } else if (maxDegree == theta) {
                            node1 = graph.getOptimalDegree4Node();
                            assert(node1 != NONE);
                            type = Type::OPT4NODE;
                        }
                        else if (maxDegree < theta) {
                            theta = 3;
                            if (graph.nodeIndex.size()) {
                                reductions.run(theta);
                                graph.getMaxNodeDegree(maxDegreeNode, maxDegree);
                                run = true;
                            } else {
                                type = Type::DONE;
                            }
                        } else {
                            assert(false);
                        }
                        break;
                    }
                    case 3:
                        if (!maxDegree) {
                            type = Type::DONE;
                        }
                        else {
                            uint32_t effectiveNode = NONE;
                            uint32_t nodeV = NONE;
                            uint32_t nodeA = NONE;
                            graph.getEffectiveNodeOrOptimalFunnel(effectiveNode, nodeV, nodeA);
                            if (effectiveNode != NONE) {
                                node1 = effectiveNode;
                                type = Type::EFFECTIVE_NODE;
                            } else if (nodeV != NONE && nodeA != NONE) {
                                node1 = nodeA;
                                node2 = nodeV;
                                type = Type::GOOD_FUNNEL;
                            } else if (graph.get4CycleTheta3(container)) {
                                type = Type::FOUR_CYCLE;
                            }
                            else {
                                node1 = graph.getOptimalNodeTheta3(maxDegreeNode, maxDegree);
                                type = Type::MAX_DEGREE;
                            }
                        }
                        break;
                    case 0:
                        break;
                    default:
                        assert(false);
                }
            }
            if (type == Type::MAX_DEGREE) {
                node1 = maxDegreeNode;
            }
        }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %r8, 0x48(%rsp)
movq %rcx, 0x40(%rsp)
movq %rdx, %r13
movq %rsi, %r15
movq %rdi, %r14
leaq 0x10(%rsp), %r12
andl $0x0, (%r12)
leaq 0x24(%rsp), %rbx
orl $-0x1, (%rbx)
leaq 0x14(%rsp), %rbp
orl $-0x1, (%rbp)
movq %rsi, %rdi
movq %rbx, %rsi
movq %r12, %rdx
movq %rbp, %rcx
callq 0x2732
leaq 0x4(%r14), %rax
movq %rax, 0x18(%rsp)
leaq 0x8(%r14), %rax
movq %rax, 0x30(%rsp)
movq %r14, 0x8(%rsp)
leaq 0x10(%r14), %rax
movq %rax, 0x28(%rsp)
movq %r12, %r14
movq %r15, %r12
movq %rbx, %r15
movq 0x40(%rsp), %rbx
movq %r13, 0x50(%rsp)
movl (%rbx), %ecx
cmpq $0x8, %rcx
ja 0x127b1
leaq 0x5539(%rip), %rdx      # 0x179c0
movslq (%rdx,%rcx,4), %rax
addq %rdx, %rax
jmpq *%rax
movl 0x10(%rsp), %eax
cmpl %ecx, %eax
ja 0x125ea
je 0x125f7
movl %eax, (%rbx)
cmpl $0x2, %eax
jbe 0x1251d
cmpl $0x5, %eax
jne 0x125b5
movq 0x48(%rsp), %rdi
callq 0x11e90
testb %al, %al
je 0x125b5
jmp 0x1278b
movq 0x8(%rsp), %rax
andl $0x0, (%rax)
cmpl $0x5, 0x10(%rsp)
jae 0x126b1
movq %r12, %rdi
movq 0x18(%rsp), %rsi
movq 0x30(%rsp), %rdx
callq 0x5090
testb %al, %al
jne 0x1262c
movq %r12, %rdi
movq 0x28(%rsp), %rsi
callq 0x4080
testb %al, %al
jne 0x126d2
movl (%rbx), %eax
cmpl %eax, 0x10(%rsp)
je 0x126f2
jae 0x127d0
movl $0x3, (%rbx)
jmp 0x125b5
movl 0x10(%rsp), %eax
testl %eax, %eax
je 0x126a1
cmpl $0x5, %eax
ja 0x125ea
movq 0x28(%rsp), %r13
movq %r12, %rdi
movq 0x30(%rsp), %rbx
movq 0x18(%rsp), %r14
movq %r14, %rsi
movq %rbx, %rdx
callq 0x5190
testb %al, %al
jne 0x1262c
movq %r12, %rbp
movq %r12, %rdi
movq %r14, %rsi
movq %rbx, %rdx
movq %r13, %rcx
callq 0x53ee
testb %al, %al
jne 0x126e2
movl 0x10(%rsp), %eax
cmpl $0x5, %eax
jae 0x12717
movq 0x40(%rsp), %rbx
cmpl (%rbx), %eax
pushq $0x3
popq %rcx
movq 0x50(%rsp), %r13
leaq 0x10(%rsp), %r14
movq %rbp, %r12
leaq 0x14(%rsp), %rbp
jae 0x12776
cmpl $0x4, %eax
cmovbl %ecx, %eax
movl %eax, (%rbx)
movq 0x8(%r12), %rax
cmpq (%r12), %rax
je 0x126a1
movq %r13, %rdi
movq %rbx, %rsi
callq 0xdf4c
orl $-0x1, 0x14(%rsp)
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
movq %rbp, %rcx
callq 0x2732
jmp 0x12474
movq 0x8(%rsp), %rax
andl $0x0, (%rax)
jmp 0x12780
movq %r12, %rdi
movq %rbx, %rsi
movq %rbx, %r14
movq 0x18(%rsp), %rbx
movq %rbx, %rdx
movq 0x30(%rsp), %rcx
movq 0x28(%rsp), %r8
callq 0x5b9a
cmpl $-0x1, (%rbx)
je 0x1263c
movq 0x8(%rsp), %rax
movl $0x1, (%rax)
jmp 0x1278b
movq 0x8(%rsp), %rax
movl $0x3, (%rax)
jmp 0x1278b
movq 0x8(%rsp), %rdi
movl $0x2, (%rdi)
movq %r12, %rsi
movq %r14, %rdx
callq 0x13dd6
jmp 0x12776
cmpl $0x0, 0x10(%rsp)
je 0x126a1
movq 0x30(%rsp), %r14
leaq 0x14(%rsp), %rbx
orl $-0x1, (%rbx)
leaq 0x3c(%rsp), %rdx
orl $-0x1, (%rdx)
leaq 0x38(%rsp), %rcx
orl $-0x1, (%rcx)
movq %r12, %rdi
movq %rbx, %rsi
callq 0x47b6
movl (%rbx), %eax
pushq $-0x1
popq %rcx
cmpl %ecx, %eax
je 0x1272f
movq 0x18(%rsp), %rcx
movl %eax, (%rcx)
pushq $0x7
jmp 0x1276e
movq 0x8(%rsp), %rax
movl $0xb, (%rax)
jmp 0x1278b
addq $0x18, %r13
movq %r12, %rdi
movq %r13, %rsi
callq 0x597e
cmpl $-0x1, %eax
je 0x12776
movl %eax, 0x24(%rsp)
jmp 0x12776
movq 0x8(%rsp), %rax
movl $0x5, (%rax)
jmp 0x1278b
movq 0x8(%rsp), %rax
movl $0x4, (%rax)
jmp 0x1278b
movq %r12, %rdi
callq 0x39e8
movq 0x18(%rsp), %rcx
movl %eax, (%rcx)
cmpl $-0x1, %eax
je 0x127ef
movq 0x8(%rsp), %rax
movl $0x6, (%rax)
jmp 0x1278b
movq %rbp, %rdi
callq 0x556e
movq 0x8(%rsp), %rcx
movl %eax, 0x4(%rcx)
movl $0x2, (%rcx)
jmp 0x1278b
movl 0x3c(%rsp), %eax
cmpl $-0x1, %eax
setne %dl
movl 0x38(%rsp), %ecx
cmpl $-0x1, %ecx
setne %sil
andb %dl, %sil
cmpb $0x1, %sil
movq 0x18(%rsp), %rbx
jne 0x1275b
movl %ecx, (%rbx)
movl %eax, (%r14)
pushq $0x3
jmp 0x1276e
movq %r12, %rdi
movq 0x28(%rsp), %rsi
callq 0x442c
testb %al, %al
je 0x1279a
pushq $0x5
popq %rcx
movq 0x8(%rsp), %rax
movl %ecx, (%rax)
movq 0x8(%rsp), %rax
cmpl $0x0, (%rax)
jne 0x1278b
movl 0x24(%rsp), %eax
movq 0x18(%rsp), %rcx
movl %eax, (%rcx)
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl 0x24(%rsp), %esi
leaq 0x10(%rsp), %rdx
movq %r12, %rdi
callq 0x3910
movl %eax, (%rbx)
xorl %ecx, %ecx
jmp 0x1276f
leaq 0x5130(%rip), %rdi      # 0x178e8
leaq 0x5326(%rip), %rsi      # 0x17ae5
leaq 0x532b(%rip), %rcx      # 0x17af1
movl $0xa5, %edx
callq 0x2100
leaq 0x5111(%rip), %rdi      # 0x178e8
leaq 0x5307(%rip), %rsi      # 0x17ae5
leaq 0x530c(%rip), %rcx      # 0x17af1
movl $0x85, %edx
callq 0x2100
leaq 0x52e1(%rip), %rdi      # 0x17ad7
leaq 0x52e8(%rip), %rsi      # 0x17ae5
leaq 0x52ed(%rip), %rcx      # 0x17af1
pushq $0x78
popq %rdx
callq 0x2100