// File: /workspace/github_cpp_makefile_star2_O2/iPapatsoris[P]Maximum-Independent-Set/src/Alg.hpp
// Function: Alg::branchRight(Alg::BranchingRule&, Alg::SearchNode*, Mis&) const
void branchRight(BranchingRule &branchingRule, SearchNode *searchNode, Mis &parentMis) const {
        //std::cout << "right\n";
        switch (branchingRule.type) {
            case BranchingRule::Type::MAX_DEGREE:
            case BranchingRule::Type::OPTNODE:
            case BranchingRule::Type::EFFECTIVE_NODE: {
                branchOnExtendedGranchildren(branchingRule, searchNode);
                break;
            }
            case BranchingRule::Type::SHORT_EDGE: {
                branchingRule.container.push_back(branchingRule.node1);
                branchingRule.container.push_back(branchingRule.node2);
                searchNode->graph.remove(branchingRule.container, searchNode->reductions->getReduceInfo());
                std::vector<uint32_t> neighbors1, neighbors2;
                searchNode->graph.gatherNeighbors(branchingRule.node1, neighbors1);
                searchNode->graph.gatherNeighbors(branchingRule.node2, neighbors2);
                std::unordered_map<uint32_t, uint32_t> &subsequentNodes = searchNode->mis.getSubsequentNodes();
                for (auto neighbor1: neighbors1) {
                    subsequentNodes.insert({neighbor1, branchingRule.node2});
                    searchNode->graph.addEdges(neighbor1, neighbors2);
                }
                for (auto neighbor2: neighbors2) {
                    subsequentNodes.insert({neighbor2, branchingRule.node1});
                    searchNode->graph.addEdges(neighbor2, neighbors1);
                }
                break;
            }
            case BranchingRule::Type::GOOD_FUNNEL: {
                searchNode->mis.getMis().push_back(branchingRule.node2);
                std::vector<uint32_t> neighbors;
                searchNode->graph.gatherNeighbors(branchingRule.node2, neighbors);
                neighbors.push_back(branchingRule.node2);
                searchNode->graph.remove(neighbors, searchNode->reductions->getReduceInfo());
                break;
            }
            case BranchingRule::Type::GOOD_PAIR: {
                searchNode->graph.remove(branchingRule.container, searchNode->reductions->getReduceInfo());
                break;
            }
            case BranchingRule::Type::FOUR_CYCLE: {
                std::vector<uint32_t> nonAdjacent;
                nonAdjacent.push_back(branchingRule.container[1]);
                nonAdjacent.push_back(branchingRule.container[3]);
                searchNode->graph.remove(nonAdjacent, searchNode->reductions->getReduceInfo());
                break;
            }
            case BranchingRule::Type::OPT4NODE: {
                std::vector<uint32_t> neighbors;
                searchNode->graph.gatherNeighbors(branchingRule.node1, neighbors);
                neighbors.push_back(branchingRule.node1);
                searchNode->mis.getMis().push_back(branchingRule.node1);
                searchNode->graph.remove(neighbors, searchNode->reductions->getReduceInfo());
                break;
            }
            case BranchingRule::Type::CUT: {
                //std::cout << "right cut" << std::endl;
                std::vector<uint32_t> *component1 = (searchNode->actualComponent1 ? &(searchNode->c1) : &(searchNode->c2));
                std::vector<uint32_t> *component2 = (searchNode->actualComponent1 ? &(searchNode->c2) : &(searchNode->c1));
                std::set<uint32_t> neighbors;
                searchNode->graph.gatherAllNeighbors(searchNode->cut, neighbors);
                component2->insert(component2->end(), searchNode->cut.begin(), searchNode->cut.end());
                searchNode->graph.remove(*component2, searchNode->reductions->getReduceInfo());
                for (auto c: searchNode->cut) {
                    component2->pop_back();
                }
                searchNode->graph.remove(neighbors, searchNode->reductions->getReduceInfo());
                std::unordered_set<uint32_t> nodesInComponent;
                nodesInComponent.insert(component1->begin(), component1->end());
                for (auto n: neighbors) {
                    nodesInComponent.erase(n);
                }
                searchNode->graph.rebuildFromNodes(nodesInComponent);
                searchNode->mis.getMis().clear();
                searchNode->mis.removeSubsequentNodes(nodesInComponent);
                parentMis.removeHypernodes(searchNode->mis.getHypernodeToInnerNode());
                break;
            }
            case BranchingRule::Type::CUT_RIGHT_1: {
                //std::cout << "right cut 1" << std::endl;
                std::vector<uint32_t> *component1 = (searchNode->actualComponent1 ? &(searchNode->c1) : &(searchNode->c2));
                std::vector<uint32_t> *component2 = (searchNode->actualComponent1 ? &(searchNode->c2) : &(searchNode->c1));
                searchNode->graph.remove(*component1, searchNode->reductions->getReduceInfo());
                std::unordered_set<uint32_t> nodesInComponent;
                nodesInComponent.insert(component2->begin(), component2->end());
                nodesInComponent.insert(searchNode->cut.begin(), searchNode->cut.end());
                searchNode->graph.rebuildFromNodes(nodesInComponent);
                searchNode->mis.getMis().clear();
                searchNode->mis.removeSubsequentNodes(nodesInComponent);
                parentMis.removeHypernodes(searchNode->mis.getHypernodeToInnerNode());
                break;
            }
            case BranchingRule::Type::CUT_RIGHT_2: {
                //std::cout << "right cut 2" << std::endl;
                std::vector<uint32_t> *component1 = (searchNode->actualComponent1 ? &(searchNode->c1) : &(searchNode->c2));
                std::vector<uint32_t> *component2 = (searchNode->actualComponent1 ? &(searchNode->c2) : &(searchNode->c1));
                component1->insert(component1->end(), searchNode->cut.begin(), searchNode->cut.end());
                searchNode->graph.remove(*component1, searchNode->reductions->getReduceInfo());
                for (auto c: searchNode->cut) {
                    component1->pop_back();
                }
                std::unordered_set<uint32_t> nodesInComponent;
                nodesInComponent.insert(component2->begin(), component2->end());
                searchNode->graph.rebuildFromNodes(nodesInComponent);
                searchNode->mis.getMis().clear();
                searchNode->mis.removeSubsequentNodes(nodesInComponent);
                parentMis.removeHypernodes(searchNode->mis.getHypernodeToInnerNode());
                break;
            }
            default:
                assert(false);
        }
        uint32_t dummy, maxDegree;
        uint32_t oldTheta = searchNode->theta;
        searchNode->graph.getMaxNodeDegree(dummy, maxDegree, oldTheta);
        if (maxDegree < oldTheta) {
            if (maxDegree >= 3) {
                searchNode->theta = maxDegree;
            } else {
                searchNode->theta = 3;
            }
        }
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movl (%rsi), %eax
cmpq $0xa, %rax
ja 0x135b2
movq %rcx, %r14
movq %rdx, %r13
movq %rsi, %r15
leaq 0x4b61(%rip), %rcx      # 0x17a08
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %r15, %rsi
movq %r13, %rdx
callq 0x1434a
jmp 0x13568
leaq 0x168(%r13), %rbx
leaq 0x180(%r13), %rax
xorl %edi, %edi
cmpb %dil, 0x198(%r13)
movq %rax, %rsi
cmovneq %rbx, %rsi
cmovneq %rax, %rbx
leaq 0x30(%r13), %r15
movq 0x108(%r13), %rdx
addq $0x10, %rdx
leaq 0x10(%rsp), %rcx
movb %dil, (%rcx)
leaq 0x60(%rsp), %r9
movb %dil, (%r9)
movq %r15, %rdi
xorl %r8d, %r8d
callq 0x9e48
leaq 0x40(%rsp), %rax
movq %rax, -0x30(%rax)
movq $0x1, -0x28(%rax)
xorps %xmm0, %xmm0
movups %xmm0, -0x20(%rax)
movl $0x3f800000, -0x10(%rax) # imm = 0x3F800000
movups %xmm0, -0x8(%rax)
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
leaq 0x10(%rsp), %rdi
callq 0x14716
movq 0x140(%r13), %rsi
leaq 0x10(%rsp), %rdi
xorl %edx, %edx
callq 0xc7c8
leaq 0x10(%rsp), %rsi
movq %r15, %rdi
callq 0x2f6a
leaq 0x80(%r13), %rdi
movq 0x80(%r13), %rax
cmpq %rax, 0x88(%r13)
je 0x12f7e
movq %rax, 0x88(%r13)
leaq 0x10(%rsp), %rsi
callq 0x15018
leaq 0x98(%r13), %rsi
movq %r14, %rdi
callq 0x14fac
jmp 0x131c3
leaq 0x10(%rsp), %rdx
andq $0x0, 0x10(%rdx)
xorps %xmm0, %xmm0
movaps %xmm0, (%rdx)
leaq 0x30(%r13), %r14
addq $0x4, %r15
leaq 0x60(%rsp), %r8
orl $-0x1, (%r8)
movq %r14, %rdi
movq %r15, %rsi
xorl %ecx, %ecx
callq 0xa3c8
leaq 0x10(%rsp), %rdi
movq %r15, %rsi
callq 0xa1ac
leaq 0x80(%r13), %rdi
movq %r15, %rsi
callq 0xa1ac
movq 0x108(%r13), %rdx
addq $0x10, %rdx
xorl %eax, %eax
leaq 0x60(%rsp), %rcx
movb %al, (%rcx)
leaq 0x8(%rsp), %r9
movb %al, (%r9)
leaq 0x10(%rsp), %rsi
movq %r14, %rdi
xorl %r8d, %r8d
callq 0x9e48
jmp 0x13304
leaq 0x30(%r13), %rdi
addq $0x10, %r15
movq 0x108(%r13), %rdx
addq $0x10, %rdx
xorl %eax, %eax
leaq 0x10(%rsp), %rcx
movb %al, (%rcx)
leaq 0x60(%rsp), %r9
movb %al, (%r9)
movq %r15, %rsi
xorl %r8d, %r8d
callq 0x9e48
jmp 0x13568
leaq 0x10(%rsp), %rdi
andq $0x0, 0x10(%rdi)
xorps %xmm0, %xmm0
movaps %xmm0, (%rdi)
movq 0x10(%r15), %rsi
addq $0x4, %rsi
callq 0xa1ac
movq 0x10(%r15), %rsi
addq $0xc, %rsi
leaq 0x10(%rsp), %rdi
callq 0xa1ac
leaq 0x30(%r13), %rdi
movq 0x108(%r13), %rdx
addq $0x10, %rdx
xorl %eax, %eax
leaq 0x60(%rsp), %rcx
movb %al, (%rcx)
leaq 0x8(%rsp), %r9
movb %al, (%r9)
leaq 0x10(%rsp), %rsi
xorl %r8d, %r8d
callq 0x9e48
jmp 0x13304
movq %r14, 0x50(%rsp)
movb 0x198(%r13), %bpl
leaq 0x168(%r13), %rbx
leaq 0x180(%r13), %r15
testb %bpl, %bpl
movq %r15, %r12
cmovneq %rbx, %r12
movq 0x8(%r12), %rsi
leaq 0x140(%r13), %r14
movq 0x140(%r13), %rdx
movq %r12, %rdi
xorl %ecx, %ecx
callq 0x14504
leaq 0x30(%r13), %rdi
movq %r13, 0x58(%rsp)
movq 0x108(%r13), %rdx
addq $0x10, %rdx
leaq 0x10(%rsp), %rcx
xorl %eax, %eax
movb %al, (%rcx)
leaq 0x60(%rsp), %r9
movb %al, (%r9)
movq %rdi, 0x90(%rsp)
movq %r12, %rsi
xorl %r8d, %r8d
callq 0x9e48
movq (%r14), %r14
testq %r14, %r14
je 0x13135
addq $-0x4, 0x8(%r12)
jmp 0x13125
testb %bpl, %bpl
cmovneq %r15, %rbx
leaq 0x40(%rsp), %rax
movq %rax, -0x30(%rax)
movq $0x1, -0x28(%rax)
xorps %xmm0, %xmm0
movups %xmm0, -0x20(%rax)
movl $0x3f800000, -0x10(%rax) # imm = 0x3F800000
movups %xmm0, -0x8(%rax)
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
leaq 0x10(%rsp), %rdi
callq 0x14716
movq 0x58(%rsp), %r13
movq 0x50(%rsp), %rbx
leaq 0x10(%rsp), %rsi
movq 0x90(%rsp), %rdi
callq 0x2f6a
leaq 0x80(%r13), %rdi
movq 0x80(%r13), %rax
cmpq %rax, 0x88(%r13)
je 0x131aa
movq %rax, 0x88(%r13)
leaq 0x10(%rsp), %rsi
callq 0x15018
leaq 0x98(%r13), %rsi
movq %rbx, %rdi
callq 0x14fac
leaq 0x10(%rsp), %rdi
callq 0xad26
jmp 0x13568
movq %r14, 0x50(%rsp)
leaq 0x168(%r13), %r12
leaq 0x180(%r13), %rax
cmpb $0x0, 0x198(%r13)
movq %rax, %rbx
cmovneq %r12, %rbx
cmovneq %rax, %r12
leaq 0x68(%rsp), %rbp
andl $0x0, (%rbp)
andq $0x0, 0x8(%rbp)
movq %rbp, 0x10(%rbp)
movq %rbp, 0x18(%rbp)
andq $0x0, 0x20(%rbp)
leaq 0x30(%r13), %r15
leaq 0x130(%r13), %rsi
leaq 0x10(%rsp), %rcx
orl $-0x1, (%rcx)
leaq 0x60(%rsp), %rdx
movq %r15, %rdi
callq 0x1482a
movq 0x8(%r12), %rsi
movq 0x140(%r13), %rdx
movq %r12, %rdi
xorl %ecx, %ecx
callq 0x14504
movq 0x108(%r13), %rdx
addq $0x10, %rdx
xorl %eax, %eax
leaq 0x10(%rsp), %rcx
movb %al, (%rcx)
leaq 0x8(%rsp), %r9
movb %al, (%r9)
movq %r15, %rdi
movq %r12, %rsi
xorl %r8d, %r8d
callq 0x9e48
leaq 0x140(%r13), %rax
movq (%rax), %rax
testq %rax, %rax
je 0x13413
addq $-0x4, 0x8(%r12)
jmp 0x1327a
leaq 0x80(%r13), %rdi
addq $0x8, %r15
movq %r15, %rsi
callq 0xa1ac
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %rdx
movaps %xmm0, (%rdx)
andq $0x0, 0x10(%rdx)
leaq 0x30(%r13), %r14
leaq 0x60(%rsp), %r8
orl $-0x1, (%r8)
movq %r14, %rdi
movq %r15, %rsi
xorl %ecx, %ecx
callq 0xa3c8
leaq 0x10(%rsp), %rdi
movq %r15, %rsi
callq 0xa1ac
movq 0x108(%r13), %rdx
addq $0x10, %rdx
xorl %eax, %eax
leaq 0x60(%rsp), %rcx
movb %al, (%rcx)
leaq 0x8(%rsp), %r9
movb %al, (%r9)
leaq 0x10(%rsp), %rsi
movq %r14, %rdi
xorl %r8d, %r8d
callq 0x9e48
leaq 0x10(%rsp), %rdi
callq 0xb872
jmp 0x13568
leaq 0x10(%r15), %rbx
leaq 0x4(%r15), %rbp
movq %rbx, %rdi
movq %rbp, %rsi
callq 0xa1ac
addq $0x8, %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0xa1ac
leaq 0x30(%r13), %r12
movq %r13, 0x58(%rsp)
movq 0x108(%r13), %rdx
addq $0x10, %rdx
xorl %eax, %eax
leaq 0x10(%rsp), %r14
movb %al, (%r14)
leaq 0x60(%rsp), %r13
movb %al, (%r13)
movq %r12, %rdi
movq %rbx, %rsi
movq %r14, %rcx
xorl %r8d, %r8d
movq %r13, %r9
callq 0x9e48
xorps %xmm0, %xmm0
movaps %xmm0, (%r14)
andq $0x0, 0x10(%r14)
movaps %xmm0, (%r13)
andq $0x0, 0x10(%r13)
leaq 0x8(%rsp), %r8
orl $-0x1, (%r8)
leaq 0x10(%rsp), %rdx
movq %r12, %rdi
movq %rbp, 0x50(%rsp)
movq %rbp, %rsi
xorl %ecx, %ecx
callq 0xa3c8
leaq 0x8(%rsp), %r8
orl $-0x1, (%r8)
leaq 0x60(%rsp), %rdx
movq %r12, %rdi
movq %r15, %rsi
xorl %ecx, %ecx
callq 0xa3c8
movq 0x58(%rsp), %rax
leaq 0xd0(%rax), %r13
movq 0x10(%rsp), %rbp
movq 0x18(%rsp), %rbx
cmpq %rbx, %rbp
je 0x13509
movl (%rbp), %r14d
movl %r14d, 0x8(%rsp)
movl (%r15), %eax
movl %eax, 0xc(%rsp)
movq %r13, %rdi
leaq 0x8(%rsp), %rsi
callq 0xbfd8
movq %r12, %rdi
movl %r14d, %esi
leaq 0x60(%rsp), %rdx
callq 0x5e38
addq $0x4, %rbp
jmp 0x133d7
movq 0x108(%r13), %rdx
addq $0x10, %rdx
xorl %eax, %eax
leaq 0x10(%rsp), %rcx
movb %al, (%rcx)
leaq 0x8(%rsp), %r9
movb %al, (%r9)
leaq 0x60(%rsp), %rsi
movq %r15, %rdi
xorl %r8d, %r8d
callq 0x103da
leaq 0x40(%rsp), %rax
movq %rax, -0x30(%rax)
movq $0x1, -0x28(%rax)
xorps %xmm0, %xmm0
movups %xmm0, -0x20(%rax)
movl $0x3f800000, -0x10(%rax) # imm = 0x3F800000
movups %xmm0, -0x8(%rax)
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
leaq 0x10(%rsp), %rdi
callq 0x14716
movq %r13, %r14
movq 0x78(%rsp), %r13
leaq 0x10(%rsp), %rbx
leaq 0x8(%rsp), %r12
cmpq %rbp, %r13
je 0x134aa
movl 0x20(%r13), %eax
movl %eax, 0x8(%rsp)
movq %rbx, %rdi
movq %r12, %rsi
callq 0xb93a
movq %r13, %rdi
callq 0x21b0
movq %rax, %r13
jmp 0x13485
leaq 0x10(%rsp), %rsi
movq %r15, %rdi
callq 0x2f6a
movq %r14, %r13
leaq 0x80(%r14), %rdi
movq 0x80(%r14), %rax
cmpq %rax, 0x88(%r14)
je 0x134d8
movq %rax, 0x88(%r13)
leaq 0x10(%rsp), %rsi
callq 0x15018
leaq 0x98(%r13), %rsi
movq 0x50(%rsp), %rdi
callq 0x14fac
leaq 0x10(%rsp), %rdi
callq 0xad26
leaq 0x60(%rsp), %rdi
callq 0xacde
jmp 0x13568
movq 0x60(%rsp), %r14
movq 0x68(%rsp), %r15
leaq 0x10(%rsp), %rbp
cmpq %r15, %r14
je 0x1354f
movl (%r14), %ebx
movl %ebx, 0x8(%rsp)
movq 0x50(%rsp), %rax
movl (%rax), %eax
movl %eax, 0xc(%rsp)
movq %r13, %rdi
leaq 0x8(%rsp), %rsi
callq 0xbfd8
movq %r12, %rdi
movl %ebx, %esi
movq %rbp, %rdx
callq 0x5e38
addq $0x4, %r14
jmp 0x13518
leaq 0x60(%rsp), %rdi
callq 0xb872
leaq 0x10(%rsp), %rdi
callq 0xb872
movq 0x58(%rsp), %r13
movl 0x4(%r13), %eax
leaq 0x8(%rsp), %rbx
movl %eax, (%rbx)
leaq 0x30(%r13), %rdi
leaq 0x10(%rsp), %rsi
leaq 0x60(%rsp), %r14
movq %r14, %rdx
movq %rbx, %rcx
callq 0x2732
movl (%r14), %eax
cmpl (%rbx), %eax
jae 0x135a0
cmpl $0x4, %eax
pushq $0x3
popq %rcx
cmovael %eax, %ecx
movl %ecx, 0x4(%r13)
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x432f(%rip), %rdi      # 0x178e8
leaq 0x4525(%rip), %rsi      # 0x17ae5
leaq 0x46e0(%rip), %rcx      # 0x17ca7
movl $0x21b, %edx            # imm = 0x21B
callq 0x2100
jmp 0x135e5
jmp 0x135ee
jmp 0x135ee
jmp 0x135e5
jmp 0x135ee
jmp 0x1360c
jmp 0x135ee
jmp 0x135e5
jmp 0x1360c
jmp 0x135ee
movq %rax, %rbx
jmp 0x13632
jmp 0x135ee
jmp 0x135ee
movq %rax, %rbx
jmp 0x13619
jmp 0x13625
jmp 0x135f7
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0xad26
jmp 0x1363c
jmp 0x1360c
jmp 0x1360c
jmp 0x1360c
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0xb872
leaq 0x10(%rsp), %rdi
callq 0xb872
jmp 0x1363c
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0xad26
leaq 0x60(%rsp), %rdi
callq 0xacde
movq %rbx, %rdi
callq 0x22c0