// File: /workspace/github_cpp_makefile_star2_O1/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 $0x38, %rsp
movq %r8, 0x30(%rsp)
movq %rcx, %r12
movq %rdx, %r13
movq %rsi, %r14
movq %rdi, %rbp
leaq 0xc(%rsp), %rdx
movl $0x0, (%rdx)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
leaq 0x1c(%rsp), %rsi
movl %eax, (%rsi)
leaq 0x18(%rsp), %rcx
movl %eax, (%rcx)
movq %r14, %rdi
callq 0x2a00
leaq 0x4(%rbp), %rbx
leaq 0x8(%rbp), %r15
movq %rbp, 0x10(%rsp)
leaq 0x10(%rbp), %rax
movq %rax, 0x20(%rsp)
leaq 0x5c72(%rip), %rbp      # 0x1a9a4
movl (%r12), %ecx
cmpq $0x8, %rcx
ja 0x1502f
movslq (%rbp,%rcx,4), %rax
addq %rbp, %rax
jmpq *%rax
movl 0xc(%rsp), %eax
cmpl %ecx, %eax
ja 0x14e8c
je 0x14e9c
movl %eax, (%r12)
cmpl $0x2, %eax
jbe 0x14dda
cmpl $0x5, %eax
jne 0x14e50
movq 0x30(%rsp), %rdi
callq 0x1464a
testb %al, %al
je 0x14e50
jmp 0x14f4e
movq 0x10(%rsp), %rax
movl $0x0, (%rax)
cmpl $0x5, 0xc(%rsp)
jae 0x14f5d
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x5c28
testb %al, %al
jne 0x14ec5
movq %r14, %rdi
movq 0x20(%rsp), %rsi
callq 0x4852
testb %al, %al
jne 0x14f77
movl (%r12), %eax
cmpl %eax, 0xc(%rsp)
je 0x14f91
jae 0x1504e
movl $0x3, (%r12)
jmp 0x14e50
movl 0xc(%rsp), %eax
testl %eax, %eax
je 0x14f2d
cmpl $0x6, %eax
jae 0x14e8c
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x5d44
testb %al, %al
jne 0x14ec5
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
movq 0x20(%rsp), %rcx
callq 0x600a
testb %al, %al
jne 0x14f84
movl 0xc(%rsp), %eax
cmpl $0x5, %eax
jae 0x14fb1
cmpl (%r12), %eax
jae 0x14f38
cmpl $0x4, %eax
movl $0x3, %ecx
cmovbl %ecx, %eax
movl %eax, (%r12)
movq 0x8(%r14), %rax
cmpq (%r14), %rax
je 0x14f2d
movq %r13, %rdi
movq %r12, %rsi
callq 0xfcd0
movl $0xffffffff, 0x18(%rsp) # imm = 0xFFFFFFFF
movq %r14, %rdi
leaq 0x1c(%rsp), %rsi
leaq 0xc(%rsp), %rdx
leaq 0x18(%rsp), %rcx
callq 0x2a00
jmp 0x14d32
movq 0x10(%rsp), %rax
movl $0x0, (%rax)
jmp 0x14f38
movq %r14, %rdi
movq %r12, %rsi
movq %rbx, %rdx
movq %r15, %rcx
movq 0x20(%rsp), %r8
callq 0x6996
movq 0x10(%rsp), %rdi
cmpl $-0x1, 0x4(%rdi)
je 0x14ed2
movl $0x1, (%rdi)
jmp 0x14f38
movq 0x10(%rsp), %rax
movl $0x3, (%rax)
jmp 0x14f38
movl $0x2, (%rdi)
movq %r14, %rsi
movq %r12, %rdx
callq 0x1697a
jmp 0x14f38
cmpl $0x0, 0xc(%rsp)
je 0x14f2d
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
leaq 0x18(%rsp), %rbx
movl %ebp, (%rbx)
leaq 0x2c(%rsp), %rdx
movl %ebp, (%rdx)
leaq 0x28(%rsp), %rcx
movl %ebp, (%rcx)
movq %r14, %rdi
movq %rbx, %rsi
callq 0x521c
movl (%rbx), %eax
cmpl %ebp, %eax
je 0x14fcc
movq 0x10(%rsp), %rbx
movl %eax, 0x4(%rbx)
movl $0x7, %ecx
jmp 0x15028
movq 0x10(%rsp), %rax
movl $0xb, (%rax)
movq 0x10(%rsp), %rax
cmpl $0x0, (%rax)
jne 0x14f4e
movl 0x1c(%rsp), %eax
movq 0x10(%rsp), %rcx
movl %eax, 0x4(%rcx)
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
addq $0x18, %r13
movq %r14, %rdi
movq %r13, %rsi
callq 0x6706
cmpl $-0x1, %eax
je 0x14f38
movl %eax, 0x1c(%rsp)
jmp 0x14f38
movq 0x10(%rsp), %rax
movl $0x5, (%rax)
jmp 0x14f38
movq 0x10(%rsp), %rax
movl $0x4, (%rax)
jmp 0x14f38
movq %r14, %rdi
callq 0x40fc
movl %eax, (%rbx)
cmpl $-0x1, %eax
je 0x1506d
movq 0x10(%rsp), %rax
movl $0x6, (%rax)
jmp 0x14f38
movq %r14, %rdi
callq 0x6226
movq 0x10(%rsp), %rcx
movl %eax, 0x4(%rcx)
movl $0x2, (%rcx)
jmp 0x14f38
movl 0x2c(%rsp), %eax
cmpl $-0x1, %eax
setne %dl
movl 0x28(%rsp), %ecx
cmpl $-0x1, %ecx
setne %sil
andb %dl, %sil
cmpb $0x1, %sil
movq 0x10(%rsp), %rbx
jne 0x14ffc
movl %ecx, 0x4(%rbx)
movl %eax, 0x8(%rbx)
movl $0x3, %ecx
jmp 0x15028
movq %r14, %rdi
movq 0x20(%rsp), %rsi
callq 0x4d10
movl $0x5, %ecx
testb %al, %al
jne 0x15028
movl 0x1c(%rsp), %esi
leaq 0xc(%rsp), %rdx
movq %r14, %rdi
callq 0x4016
movl %eax, 0x4(%rbx)
xorl %ecx, %ecx
movl %ecx, (%rbx)
jmp 0x14f38
leaq 0x5895(%rip), %rdi      # 0x1a8cb
leaq 0x5a8c(%rip), %rsi      # 0x1aac9
leaq 0x5a91(%rip), %rcx      # 0x1aad5
movl $0xa5, %edx
callq 0x2110
leaq 0x5876(%rip), %rdi      # 0x1a8cb
leaq 0x5a6d(%rip), %rsi      # 0x1aac9
leaq 0x5a72(%rip), %rcx      # 0x1aad5
movl $0x85, %edx
callq 0x2110
leaq 0x5a47(%rip), %rdi      # 0x1aabb
leaq 0x5a4e(%rip), %rsi      # 0x1aac9
leaq 0x5a53(%rip), %rcx      # 0x1aad5
movl $0x78, %edx
callq 0x2110