// File: /workspace/github_cpp_makefile_star2_O1/iPapatsoris[P]Maximum-Independent-Set/src/Reductions.cpp
// Function: Reductions::findMis(std::vector<unsigned int, std::allocator<unsigned int>> const&)
void Reductions::findMis(const vector<uint32_t> &cc) {
    vector<uint32_t> independentSet;
    vector<uint32_t> maximumIndependentSet;
    vector<uint32_t> frontier; // cc array indexes
    vector<unordered_set<uint32_t> > removedNodes;
    frontier.push_back(0);
    removedNodes.push_back(unordered_set<uint32_t>());
    while (frontier.size()) {
        uint32_t node = cc[frontier.back()];
        Graph::GraphTraversal graphTraversal(graph, node);
        while (graphTraversal.curEdgeOffset != NONE) {
            removedNodes.back().insert((*graph.edgeBuffer)[graphTraversal.curEdgeOffset]);
            graph.getNextEdge(graphTraversal);
        }
        uint32_t newNode = NONE;
        uint32_t newIndex;
        bool found = false;
        for (newIndex = frontier.back()+1 ; newIndex < cc.size() ; newIndex++) {
            if (cc.size() - newIndex + frontier.size() <= maximumIndependentSet.size()) {
                break;
            }
            newNode = cc[newIndex];
            if (removedNodes.back().find(newNode) == removedNodes.back().end()) {
                found = true;
                break;
            }
        }
        if (found) {
            frontier.push_back(newIndex);
            removedNodes.push_back(removedNodes.back());
        } else {
            if (frontier.size() > maximumIndependentSet.size()) {
                maximumIndependentSet = frontier;
            }
            while (frontier.size()) {
                newIndex = frontier.back() + 1;
                frontier.pop_back();
                removedNodes.pop_back();
                found = false;
                for (; newIndex < cc.size() ; newIndex++) {
                    if (cc.size() - newIndex + frontier.size() <= maximumIndependentSet.size()) {
                        break;
                    }
                    newNode = cc[newIndex];
                    if (!removedNodes.size() || removedNodes.size() && removedNodes.back().find(newNode) == removedNodes.back().end()) {
                        found = true;
                        break;
                    }
                }
                if (found) {
                    frontier.push_back(newIndex);
                    removedNodes.push_back((removedNodes.size() ? removedNodes.back() : unordered_set<uint32_t>()));
                    break;
                }
            }
        }
    }
    vector<uint32_t> &mis = this->mis.getMis();
    for (auto &i: maximumIndependentSet) {
        mis.push_back(cc[i]);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movq %rsi, %r12
movq %rdi, %r14
xorps %xmm0, %xmm0
movaps %xmm0, 0x60(%rsp)
xorl %eax, %eax
movq %rax, 0x70(%rsp)
movq %rax, 0x20(%rsp)
movaps %xmm0, 0x10(%rsp)
movq %rax, 0x40(%rsp)
movaps %xmm0, 0x30(%rsp)
movl $0x0, 0x80(%rsp)
movq 0x18(%rsp), %rsi
testq %rsi, %rsi
je 0x11aa4
movl $0x0, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x18(%rsp)
jmp 0x11ab6
leaq 0x10(%rsp), %rdi
leaq 0x80(%rsp), %rdx
callq 0xfbfa
xorps %xmm0, %xmm0
leaq 0xb0(%rsp), %rax
movaps %xmm0, -0x30(%rax)
movaps %xmm0, -0x10(%rax)
movaps %xmm0, -0x20(%rax)
movq $0x0, (%rax)
movq %rax, -0x30(%rax)
movq $0x1, -0x28(%rax)
movl $0x3f800000, -0x10(%rax) # imm = 0x3F800000
movups %xmm0, -0x8(%rax)
leaq 0x30(%rsp), %rdi
leaq 0x80(%rsp), %rsi
callq 0x135d2
leaq 0x80(%rsp), %rbx
movq %rbx, %rdi
callq 0xcff8
movq 0x18(%rsp), %rax
cmpq 0x10(%rsp), %rax
je 0x11f6f
leaq 0xc0(%rsp), %r15
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
movq %r12, 0x28(%rsp)
movl -0x4(%rax), %eax
movq (%r12), %rcx
movl (%rcx,%rax,4), %eax
movl %eax, 0x7c(%rsp)
movq (%r14), %rsi
movq %r15, %rdi
leaq 0x7c(%rsp), %rdx
callq 0x29ee
movl 0xc4(%rsp), %esi
cmpq %r13, %rsi
je 0x11b8e
movq 0x38(%rsp), %rdi
addq $-0x38, %rdi
movq (%r14), %rax
movq 0x18(%rax), %rax
shlq $0x2, %rsi
addq (%rax), %rsi
movq %rdi, 0x80(%rsp)
movq %rbx, %rdx
callq 0xdc3e
movq (%r14), %rdi
movq %r15, %rsi
callq 0xc4d8
jmp 0x11b4e
movq 0x18(%rsp), %r11
leaq -0x4(%r11), %rax
movq (%r12), %rsi
movq 0x8(%r12), %r10
subq %rsi, %r10
sarq $0x2, %r10
movq %r11, 0x58(%rsp)
subq 0x10(%rsp), %r11
sarq $0x2, %r11
movq 0x68(%rsp), %rbx
subq 0x60(%rsp), %rbx
sarq $0x2, %rbx
movq 0x38(%rsp), %r15
movl (%rax), %ebp
incl %ebp
movl %ebp, 0xc(%rsp)
movq %r10, %rax
subq %rbp, %rax
jbe 0x11c81
addq %r11, %rax
cmpq %rbx, %rax
jbe 0x11c81
movl (%rsi,%rbp,4), %ecx
movq -0x38(%r15), %r8
movq -0x30(%r15), %r13
movq %rcx, %rax
xorl %edx, %edx
divq %r13
movq %rdx, %rdi
movq (%r8,%rdx,8), %rdx
movl $0x0, %eax
testq %rdx, %rdx
je 0x11c48
movq (%rdx), %r12
movq %rdx, %rax
cmpl 0x8(%r12), %ecx
je 0x11c48
movq %r12, %r9
movq (%r12), %r12
testq %r12, %r12
je 0x11c46
movl 0x8(%r12), %r8d
movq %r8, %rax
xorl %edx, %edx
divq %r13
movl $0x0, %eax
cmpq %rdi, %rdx
jne 0x11c48
movq %r9, %rax
cmpl %r8d, %ecx
jne 0x11c19
jmp 0x11c48
xorl %eax, %eax
testq %rax, %rax
je 0x11c5c
cmpq $0x0, (%rax)
leaq 0xc(%rsp), %rax
jne 0x11bc8
movq 0x58(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x11e20
movl %ebp, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x18(%rsp)
movq 0x28(%rsp), %r12
jmp 0x11e34
movq 0x58(%rsp), %rcx
subq 0x10(%rsp), %rcx
movq 0x68(%rsp), %rax
subq 0x60(%rsp), %rax
cmpq %rax, %rcx
movq 0x28(%rsp), %r12
jbe 0x11cae
leaq 0x60(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0xbee6
movq 0x18(%rsp), %rax
cmpq 0x10(%rsp), %rax
je 0x11f49
movl -0x4(%rax), %ecx
addq $-0x4, %rax
incl %ecx
movl %ecx, 0xc(%rsp)
movq %rax, 0x18(%rsp)
movq 0x38(%rsp), %rdi
addq $-0x38, %rdi
movq %rdi, 0x38(%rsp)
callq 0xcff8
movq (%r12), %r10
movq 0x8(%r12), %r11
subq %r10, %r11
sarq $0x2, %r11
movl 0xc(%rsp), %eax
movq %rax, 0x50(%rsp)
cmpq %rax, %r11
jbe 0x11ddb
movq 0x18(%rsp), %rsi
movq %rsi, 0xc8(%rsp)
subq 0x10(%rsp), %rsi
sarq $0x2, %rsi
movq 0x68(%rsp), %rbx
subq 0x60(%rsp), %rbx
sarq $0x2, %rbx
movq 0x30(%rsp), %rax
movq %rax, 0x58(%rsp)
movq 0x38(%rsp), %rbp
movq 0x50(%rsp), %r9
movq %r9, %rax
movq %r11, %rcx
subq %rax, %rcx
addq %rsi, %rcx
cmpq %rbx, %rcx
jbe 0x11ddb
cmpq 0x58(%rsp), %rbp
je 0x11dfa
movl (%r10,%rax,4), %ecx
movq -0x38(%rbp), %r8
movq -0x30(%rbp), %r15
movq %rcx, %rax
xorl %edx, %edx
divq %r15
movq %rdx, %rdi
movq (%r8,%rdx,8), %rdx
movl $0x0, %eax
testq %rdx, %rdx
je 0x11dbc
movq (%rdx), %r13
movq %rdx, %rax
cmpl 0x8(%r13), %ecx
je 0x11dbc
movq %r13, %r12
movq (%r13), %r13
testq %r13, %r13
je 0x11dba
movl 0x8(%r13), %r8d
movq %r8, %rax
xorl %edx, %edx
divq %r15
movl $0x0, %eax
cmpq %rdi, %rdx
jne 0x11dbc
movq %r12, %rax
cmpl %r8d, %ecx
jne 0x11d8e
jmp 0x11dbc
xorl %eax, %eax
testq %rax, %rax
je 0x11df5
cmpq $0x0, (%rax)
je 0x11df5
incl %r9d
movl %r9d, 0xc(%rsp)
movq %r9, %rax
cmpq %r9, %r11
ja 0x11d40
movq 0x18(%rsp), %rax
cmpq 0x10(%rsp), %rax
movq 0x28(%rsp), %r12
jne 0x11cbe
jmp 0x11f49
movq %r9, 0x50(%rsp)
movq 0xc8(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
movq 0x28(%rsp), %r12
je 0x11e4c
movq 0x50(%rsp), %rax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x18(%rsp)
jmp 0x11e5b
leaq 0x10(%rsp), %rdi
leaq 0xc(%rsp), %rdx
callq 0xdeac
movq 0x28(%rsp), %r12
movq 0x38(%rsp), %rsi
addq $-0x38, %rsi
leaq 0x30(%rsp), %rdi
callq 0x12cf4
jmp 0x11f49
leaq 0x10(%rsp), %rdi
leaq 0xc(%rsp), %rdx
callq 0xdeac
movq 0x38(%rsp), %rax
cmpq 0x30(%rsp), %rax
je 0x11ece
leaq -0x38(%rax), %rsi
xorl %edx, %edx
movq %rdx, 0x80(%rsp)
movq -0x30(%rax), %rcx
movq %rcx, 0x88(%rsp)
movq %rdx, 0x90(%rsp)
movq -0x20(%rax), %rcx
movq %rcx, 0x98(%rsp)
movups -0x18(%rax), %xmm0
leaq 0xa0(%rsp), %rax
movups %xmm0, (%rax)
movq %rdx, 0xb0(%rsp)
leaq 0x80(%rsp), %rbx
movq %rbx, 0xd0(%rsp)
movq %rbx, %rdi
leaq 0xd0(%rsp), %rdx
callq 0x131a2
jmp 0x11f34
xorps %xmm0, %xmm0
movaps %xmm0, 0x80(%rsp)
movaps %xmm0, 0xa0(%rsp)
movaps %xmm0, 0x90(%rsp)
movq $0x0, 0xb0(%rsp)
leaq 0xb0(%rsp), %rax
movq %rax, 0x80(%rsp)
movq $0x1, 0x88(%rsp)
leaq 0xa0(%rsp), %rax
movups %xmm0, -0x10(%rax)
movl $0x3f800000, 0xa0(%rsp) # imm = 0x3F800000
movups %xmm0, 0x8(%rax)
leaq 0x80(%rsp), %rbx
leaq 0x30(%rsp), %rdi
movq %rbx, %rsi
callq 0x135d2
movq %rbx, %rdi
callq 0xcff8
movq 0x18(%rsp), %rax
cmpq 0x10(%rsp), %rax
leaq 0x80(%rsp), %rbx
leaq 0xc0(%rsp), %r15
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
jne 0x11b30
movq 0x60(%rsp), %rbx
movq 0x68(%rsp), %r15
cmpq %r15, %rbx
je 0x11fb5
movq 0x8(%r14), %r14
movl (%rbx), %edx
shlq $0x2, %rdx
addq (%r12), %rdx
movq 0x8(%r14), %rsi
cmpq 0x10(%r14), %rsi
je 0x11fa4
movl (%rdx), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%r14)
jmp 0x11fac
movq %r14, %rdi
callq 0xdeac
addq $0x4, %rbx
cmpq %r15, %rbx
jne 0x11f82
leaq 0x30(%rsp), %rdi
callq 0x12d5c
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x11fce
callq 0x21a0
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x11fdd
callq 0x21a0
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1200d
jmp 0x11ff5
jmp 0x1200d
movq %rax, %rbx
leaq 0x80(%rsp), %rdi
callq 0xcff8
jmp 0x12010
jmp 0x1200d
jmp 0x1200d
jmp 0x1200d
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x12d5c
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x12029
callq 0x21a0
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x12038
callq 0x21a0
movq %rbx, %rdi
callq 0x2320