// File: /workspace/github_cpp_makefile_star2_O3/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, %r12
movq %rdi, %r14
leaq 0x10(%rsp), %rbp
movl $0x0, (%rbp)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
leaq 0x24(%rsp), %rbx
movl %eax, (%rbx)
leaq 0x14(%rsp), %r15
movl %eax, (%r15)
movq %rsi, %rdi
movq %rbx, %rsi
movq %rbp, %rdx
movq %r15, %rcx
callq 0x2a00
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 %rbx, %r14
movq 0x40(%rsp), %rbx
movq %rax, 0x28(%rsp)
movq %r13, 0x50(%rsp)
movl (%rbx), %ecx
cmpq $0x8, %rcx
ja 0x14659
leaq 0x568e(%rip), %rdx      # 0x199a4
movslq (%rdx,%rcx,4), %rax
addq %rdx, %rax
jmpq *%rax
movl 0x10(%rsp), %eax
cmpl %ecx, %eax
ja 0x14487
je 0x14497
movl %eax, (%rbx)
cmpl $0x2, %eax
jbe 0x143af
cmpl $0x5, %eax
jne 0x1444f
movq 0x48(%rsp), %rdi
callq 0x13bfe
testb %al, %al
je 0x1444f
jmp 0x1464a
movq 0x8(%rsp), %rax
movl $0x0, (%rax)
cmpl $0x5, 0x10(%rsp)
jae 0x14553
movq %r12, %rdi
movq 0x18(%rsp), %rsi
movq 0x30(%rsp), %rdx
callq 0x5cd4
testb %al, %al
jne 0x144cc
movq %r12, %rdi
movq 0x28(%rsp), %rsi
callq 0x48e6
testb %al, %al
jne 0x14574
movl (%rbx), %eax
cmpl %eax, 0x10(%rsp)
je 0x14594
jae 0x14678
movl $0x3, (%rbx)
jmp 0x1444f
movl 0x10(%rsp), %eax
testl %eax, %eax
je 0x14543
cmpl $0x5, %eax
ja 0x14487
movq 0x28(%rsp), %r13
movq %r12, %rdi
movq 0x30(%rsp), %rbx
movq 0x18(%rsp), %rbp
movq %rbp, %rsi
movq %rbx, %rdx
callq 0x5de2
testb %al, %al
jne 0x144cc
movq %r14, %r15
movq %r12, %r14
movq %r12, %rdi
movq %rbp, %rsi
movq %rbx, %rdx
movq %r13, %rcx
callq 0x6082
testb %al, %al
jne 0x14584
movl 0x10(%rsp), %eax
cmpl $0x5, %eax
jae 0x145bc
movq 0x40(%rsp), %rbx
cmpl (%rbx), %eax
movq 0x50(%rsp), %r13
leaq 0x10(%rsp), %rbp
movq %r14, %r12
movq %r15, %r14
leaq 0x14(%rsp), %r15
jae 0x14635
cmpl $0x4, %eax
movl $0x3, %ecx
cmovbl %ecx, %eax
movl %eax, (%rbx)
movq 0x8(%r12), %rax
cmpq (%r12), %rax
je 0x14543
movq %r13, %rdi
movq %rbx, %rsi
callq 0xf680
movl $0xffffffff, 0x14(%rsp) # imm = 0xFFFFFFFF
movq %r12, %rdi
movq %r14, %rsi
movq %rbp, %rdx
movq %r15, %rcx
callq 0x2a00
jmp 0x14303
movq 0x8(%rsp), %rax
movl $0x0, (%rax)
jmp 0x1463f
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 0x6974
cmpl $-0x1, (%rbx)
je 0x144dc
movq 0x8(%rsp), %rax
movl $0x1, (%rax)
jmp 0x1464a
movq 0x8(%rsp), %rax
movl $0x3, (%rax)
jmp 0x1464a
movq 0x8(%rsp), %rdi
movl $0x2, (%rdi)
movq %r12, %rsi
movq %r14, %rdx
callq 0x15f78
jmp 0x14635
cmpl $0x0, 0x10(%rsp)
je 0x14543
movq 0x30(%rsp), %r14
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
leaq 0x14(%rsp), %rbx
movl %ebp, (%rbx)
leaq 0x3c(%rsp), %rdx
movl %ebp, (%rdx)
leaq 0x38(%rsp), %rcx
movl %ebp, (%rcx)
movq %r12, %rdi
movq %rbx, %rsi
callq 0x5300
movl (%rbx), %eax
cmpl %ebp, %eax
je 0x145d4
movq 0x18(%rsp), %rcx
movl %eax, (%rcx)
movl $0x7, %ecx
jmp 0x1462e
movq 0x8(%rsp), %rax
movl $0xb, (%rax)
jmp 0x1464a
addq $0x18, %r13
movq %r12, %rdi
movq %r13, %rsi
callq 0x6754
cmpl $-0x1, %eax
je 0x14635
movl %eax, 0x24(%rsp)
jmp 0x14635
movq 0x8(%rsp), %rax
movl $0x5, (%rax)
jmp 0x1464a
movq 0x8(%rsp), %rax
movl $0x4, (%rax)
jmp 0x1464a
movq %r12, %rdi
callq 0x418c
movq 0x18(%rsp), %rcx
movl %eax, (%rcx)
cmpl $-0x1, %eax
je 0x14697
movq 0x8(%rsp), %rax
movl $0x6, (%rax)
jmp 0x1464a
movq %r14, %rdi
callq 0x624e
movq 0x8(%rsp), %rcx
movl %eax, 0x4(%rcx)
movl $0x2, (%rcx)
jmp 0x1464a
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 0x14603
movl %ecx, (%rbx)
movl %eax, (%r14)
movl $0x3, %ecx
jmp 0x1462e
movq %r12, %rdi
movq 0x28(%rsp), %rsi
callq 0x4dc8
movl $0x5, %ecx
testb %al, %al
jne 0x1462e
movl 0x24(%rsp), %esi
leaq 0x10(%rsp), %rdx
movq %r12, %rdi
callq 0x40a4
movl %eax, (%rbx)
xorl %ecx, %ecx
movq 0x8(%rsp), %rax
movl %ecx, (%rax)
movq 0x8(%rsp), %rax
cmpl $0x0, (%rax)
jne 0x1464a
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
leaq 0x526b(%rip), %rdi      # 0x198cb
leaq 0x5462(%rip), %rsi      # 0x19ac9
leaq 0x5467(%rip), %rcx      # 0x19ad5
movl $0xa5, %edx
callq 0x2110
leaq 0x524c(%rip), %rdi      # 0x198cb
leaq 0x5443(%rip), %rsi      # 0x19ac9
leaq 0x5448(%rip), %rcx      # 0x19ad5
movl $0x85, %edx
callq 0x2110
leaq 0x541d(%rip), %rdi      # 0x19abb
leaq 0x5424(%rip), %rsi      # 0x19ac9
leaq 0x5429(%rip), %rcx      # 0x19ad5
movl $0x78, %edx
callq 0x2110