// File: /workspace/github_cpp_makefile_star2_O3/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 $0xb8, %rsp
movq %rsi, %rbx
movq %rdi, %r14
xorps %xmm0, %xmm0
movaps %xmm0, 0x50(%rsp)
xorl %eax, %eax
movq %rax, 0x60(%rsp)
leaq 0x10(%rsp), %rdi
movq %rax, 0x10(%rdi)
movaps %xmm0, (%rdi)
movq %rax, 0x40(%rsp)
movaps %xmm0, 0x30(%rsp)
leaq 0x70(%rsp), %rdx
movl $0x0, (%rdx)
xorl %esi, %esi
callq 0xf5ac
leaq 0xa0(%rsp), %rax
movq $0x0, -0x10(%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)
leaq 0x30(%rsp), %rdi
leaq 0x70(%rsp), %rsi
callq 0x12c02
leaq 0x70(%rsp), %r15
movq %r15, %rdi
callq 0xc950
movq 0x18(%rsp), %rax
cmpq 0x10(%rsp), %rax
je 0x11639
leaq 0xb0(%rsp), %r12
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
leaq 0x2c(%rsp), %rbp
movl -0x4(%rax), %eax
movq (%rbx), %rcx
movl (%rcx,%rax,4), %eax
movl %eax, 0x4c(%rsp)
movq (%r14), %rsi
movq %r12, %rdi
leaq 0x4c(%rsp), %rdx
callq 0x29ee
movl 0xb4(%rsp), %esi
cmpq %r13, %rsi
je 0x113a5
movq 0x38(%rsp), %rdi
addq $-0x38, %rdi
movq (%r14), %rax
movq 0x18(%rax), %rax
shlq $0x2, %rsi
addq (%rax), %rsi
movq %rdi, 0x70(%rsp)
movq %r15, %rdx
callq 0xd538
movq (%r14), %rdi
movq %r12, %rsi
callq 0xbe2e
jmp 0x11368
movl $0xffffffff, 0x2c(%rsp) # imm = 0xFFFFFFFF
movq 0x18(%rsp), %rcx
addq $-0x4, %rcx
movl (%rcx), %edx
incl %edx
movl %edx, 0xc(%rsp)
movq (%rbx), %rsi
movq 0x8(%rbx), %r8
subq %rsi, %r8
sarq $0x2, %r8
movq 0x10(%rsp), %rcx
movq 0x18(%rsp), %rax
movq 0x50(%rsp), %r10
movq 0x58(%rsp), %rdi
movq %rax, %r9
subq %rcx, %r9
subq %rdx, %r8
jbe 0x1144a
movq %r9, %r11
sarq $0x2, %r11
addq %r11, %r8
subq %r10, %rdi
movq %rdi, %r10
sarq $0x2, %r10
cmpq %r10, %r8
jbe 0x1144d
movl (%rsi,%rdx,4), %eax
movl %eax, 0x2c(%rsp)
movq 0x38(%rsp), %rdi
addq $-0x38, %rdi
movq %rbp, %rsi
callq 0xdcaa
leaq 0xc(%rsp), %rcx
testq %rax, %rax
jne 0x113b6
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x11607
movl 0xc(%rsp), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x18(%rsp)
jmp 0x11616
subq %r10, %rdi
cmpq %rdi, %r9
jbe 0x1146b
leaq 0x50(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0xb7ee
movq 0x10(%rsp), %rcx
movq 0x18(%rsp), %rax
cmpq %rcx, %rax
je 0x11629
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 0xc950
movl 0xc(%rsp), %eax
movq (%rbx), %rcx
movq 0x8(%rbx), %rdx
subq %rcx, %rdx
sarq $0x2, %rdx
cmpq %rax, %rdx
jbe 0x1150a
movq 0x18(%rsp), %rsi
movq %rsi, %rdi
subq 0x10(%rsp), %rdi
subq %rax, %rdx
sarq $0x2, %rdi
addq %rdx, %rdi
movq 0x58(%rsp), %rdx
subq 0x50(%rsp), %rdx
sarq $0x2, %rdx
cmpq %rdx, %rdi
jbe 0x1150a
movl (%rcx,%rax,4), %eax
movl %eax, 0x2c(%rsp)
movq 0x38(%rsp), %rdi
cmpq 0x30(%rsp), %rdi
je 0x11524
addq $-0x38, %rdi
movq %rbp, %rsi
callq 0xdcaa
testq %rax, %rax
je 0x1151f
movl 0xc(%rsp), %eax
incl %eax
movl %eax, 0xc(%rsp)
jmp 0x1149d
movq 0x18(%rsp), %rax
cmpq 0x10(%rsp), %rax
jne 0x11474
jmp 0x11629
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x1153c
movl 0xc(%rsp), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x18(%rsp)
jmp 0x1154b
leaq 0x10(%rsp), %rdi
leaq 0xc(%rsp), %rdx
callq 0xd7b4
movq 0x38(%rsp), %rax
cmpq 0x30(%rsp), %rax
je 0x115b1
leaq -0x38(%rax), %rsi
xorl %edx, %edx
movq %rdx, 0x70(%rsp)
movq -0x30(%rax), %rcx
movq %rcx, 0x78(%rsp)
movq %rdx, 0x80(%rsp)
movq -0x20(%rax), %rcx
movq %rcx, 0x88(%rsp)
movups -0x18(%rax), %xmm0
leaq 0x80(%rsp), %rax
movups %xmm0, 0x10(%rax)
movq %rdx, 0xa0(%rsp)
movq %r15, 0xa8(%rsp)
movq %r15, %rdi
leaq 0xa8(%rsp), %rdx
callq 0x127d4
jmp 0x115f0
movq $0x0, 0x90(%rsp)
leaq 0xa0(%rsp), %rax
movq %rax, 0x70(%rsp)
movq $0x1, 0x78(%rsp)
leaq 0x80(%rsp), %rax
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movl $0x3f800000, 0x90(%rsp) # imm = 0x3F800000
movups %xmm0, 0x18(%rax)
leaq 0x30(%rsp), %rdi
movq %r15, %rsi
callq 0x12c02
movq %r15, %rdi
callq 0xc950
jmp 0x11629
leaq 0x10(%rsp), %rdi
leaq 0xc(%rsp), %rdx
callq 0xd7b4
movq 0x38(%rsp), %rsi
addq $-0x38, %rsi
leaq 0x30(%rsp), %rdi
callq 0x12428
movq 0x18(%rsp), %rax
cmpq 0x10(%rsp), %rax
jne 0x1134b
movq 0x50(%rsp), %r15
movq 0x58(%rsp), %r12
cmpq %r12, %r15
je 0x1167f
movq 0x8(%r14), %r14
movl (%r15), %edx
shlq $0x2, %rdx
addq (%rbx), %rdx
movq 0x8(%r14), %rsi
cmpq 0x10(%r14), %rsi
je 0x1166e
movl (%rdx), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%r14)
jmp 0x11676
movq %r14, %rdi
callq 0xd7b4
addq $0x4, %r15
cmpq %r12, %r15
jne 0x1164c
leaq 0x30(%rsp), %rdi
callq 0x12490
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x11698
callq 0x21a0
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x116a7
callq 0x21a0
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x116c1
jmp 0x116d8
jmp 0x116d8
jmp 0x116d8
movq %rax, %rbx
leaq 0x70(%rsp), %rdi
callq 0xc950
jmp 0x116db
jmp 0x116d8
jmp 0x116d8
jmp 0x116d8
jmp 0x116d8
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x12490
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x116f4
callq 0x21a0
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x11703
callq 0x21a0
movq %rbx, %rdi
callq 0x2320
nop