// File: iPapatsoris[P]Maximum-Independent-Set/src/Reductions.cpp
// Function: Reductions::buildCC()
void Reductions::buildCC() {
    for (auto &cc: ccToNodes) {
        delete cc.second;
    }
    ccToNodes.clear();
    uint32_t component = 0;
    unordered_set<uint32_t> exploredSet;
    stack<uint32_t> frontier;
    Graph::GraphTraversal graphTraversal(graph);
    while (graphTraversal.curNode != NONE) {
        if (exploredSet.insert(graphTraversal.curNode).second) {
            vector<uint32_t> *componentNodes = new vector<uint32_t>();
            componentNodes->push_back(graphTraversal.curNode);
            frontier.push(graphTraversal.curNode);
            bool big = false;
            while (!frontier.empty()) {
                uint32_t node = frontier.top();
                frontier.pop();
                Graph::GraphTraversal neighbors(graph, node);
                while (neighbors.curEdgeOffset != NONE) {
                    node = (*graph.edgeBuffer)[neighbors.curEdgeOffset];
                    if (exploredSet.insert(node).second) {
                        frontier.push(node);
                        if (!big) {
                            componentNodes->push_back(node);
                        }
                        else if (componentNodes->size() > 20) {
                            big = true;
                        }
                    }
                    graph.getNextEdge(neighbors);
                }
            }
            if (!big) {
                ccToNodes.insert({component, componentNodes});
                component++;
            } else {
                delete componentNodes;
            }
        }
        graph.getNextNode(graphTraversal);
    }
}

// Assembly:
subq $0x1b8, %rsp            # imm = 0x1B8
movq %rdi, 0x1b0(%rsp)
movq 0x1b0(%rsp), %rax
movq %rax, 0x68(%rsp)
addq $0x18, %rax
movq %rax, 0x1a8(%rsp)
movq 0x1a8(%rsp), %rdi
callq 0x334d0
movq %rax, 0x1a0(%rsp)
movq 0x1a8(%rsp), %rdi
callq 0x33520
movq %rax, 0x198(%rsp)
leaq 0x1a0(%rsp), %rdi
leaq 0x198(%rsp), %rsi
callq 0x33500
testb $0x1, %al
jne 0x2ed4d
jmp 0x2ed9e
leaq 0x1a0(%rsp), %rdi
callq 0x34240
movq %rax, 0x190(%rsp)
movq 0x190(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x60(%rsp)
cmpq $0x0, %rax
je 0x2ed8d
movq 0x60(%rsp), %rdi
callq 0x18520
movq 0x60(%rsp), %rdi
callq 0x2180
jmp 0x2ed8f
leaq 0x1a0(%rsp), %rdi
callq 0x34260
jmp 0x2ed32
movq 0x68(%rsp), %rdi
addq $0x18, %rdi
callq 0x34290
movl $0x0, 0x18c(%rsp)
leaq 0x150(%rsp), %rdi
callq 0x1a020
leaq 0x100(%rsp), %rdi
callq 0x1b5d0
jmp 0x2edd3
movq 0x68(%rsp), %rax
movq (%rax), %rsi
leaq 0xec(%rsp), %rdi
callq 0x2a40
jmp 0x2edea
jmp 0x2edec
cmpl $-0x1, 0xec(%rsp)
je 0x2f14c
leaq 0x150(%rsp), %rdi
leaq 0xec(%rsp), %rsi
callq 0x18960
movb %dl, 0x57(%rsp)
movq %rax, 0x58(%rsp)
jmp 0x2ee1a
movb 0x57(%rsp), %al
movq 0x58(%rsp), %rcx
movq %rcx, 0xc8(%rsp)
movb %al, 0xd0(%rsp)
movq 0xc8(%rsp), %rax
movq %rax, 0xd8(%rsp)
movb 0xd0(%rsp), %al
movb %al, 0xe0(%rsp)
testb $0x1, 0xe0(%rsp)
je 0x2f130
movl $0x18, %edi
callq 0x21b0
movq %rax, 0x48(%rsp)
jmp 0x2ee6f
movq 0x48(%rsp), %rdi
xorps %xmm0, %xmm0
movaps %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
callq 0x17e60
movq 0x48(%rsp), %rax
movq %rax, 0xc0(%rsp)
movq 0xc0(%rsp), %rdi
leaq 0xec(%rsp), %rsi
callq 0x19070
jmp 0x2eeab
leaq 0x100(%rsp), %rdi
leaq 0xec(%rsp), %rsi
callq 0x1b630
jmp 0x2eec2
movb $0x0, 0xbf(%rsp)
leaq 0x100(%rsp), %rdi
callq 0x1b660
movb %al, 0x47(%rsp)
jmp 0x2eedd
movb 0x47(%rsp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x2eeec
jmp 0x2f08c
leaq 0x100(%rsp), %rdi
callq 0x1b680
movq %rax, 0x38(%rsp)
jmp 0x2ef00
movq 0x38(%rsp), %rax
movl (%rax), %eax
movl %eax, 0xb8(%rsp)
leaq 0x100(%rsp), %rdi
callq 0x1b690
jmp 0x2ef1d
movq 0x68(%rsp), %rax
movq (%rax), %rsi
leaq 0xb0(%rsp), %rdi
leaq 0xb8(%rsp), %rdx
callq 0x2a70
jmp 0x2ef3c
jmp 0x2ef3e
cmpl $-0x1, 0xb4(%rsp)
je 0x2f087
movq 0x68(%rsp), %rax
movq (%rax), %rax
movq 0x18(%rax), %rdi
movl 0xb4(%rsp), %eax
movl %eax, %esi
callq 0x18900
movl (%rax), %eax
movl %eax, 0xb8(%rsp)
leaq 0x150(%rsp), %rdi
leaq 0xb8(%rsp), %rsi
callq 0x18960
movb %dl, 0x2f(%rsp)
movq %rax, 0x30(%rsp)
jmp 0x2ef8f
movb 0x2f(%rsp), %al
movq 0x30(%rsp), %rcx
movq %rcx, 0x90(%rsp)
movb %al, 0x98(%rsp)
movq 0x90(%rsp), %rax
movq %rax, 0xa0(%rsp)
movb 0x98(%rsp), %al
movb %al, 0xa8(%rsp)
testb $0x1, 0xa8(%rsp)
je 0x2f06b
leaq 0x100(%rsp), %rdi
leaq 0xb8(%rsp), %rsi
callq 0x1b630
jmp 0x2efea
testb $0x1, 0xbf(%rsp)
jne 0x2f04c
movq 0xc0(%rsp), %rdi
leaq 0xb8(%rsp), %rsi
callq 0x19070
jmp 0x2f00b
jmp 0x2f069
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xf8(%rsp)
movl %eax, 0xf4(%rsp)
jmp 0x2f16e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xf8(%rsp)
movl %eax, 0xf4(%rsp)
leaq 0x100(%rsp), %rdi
callq 0x1b6a0
jmp 0x2f16e
movq 0xc0(%rsp), %rdi
callq 0x188e0
cmpq $0x14, %rax
jbe 0x2f067
movb $0x1, 0xbf(%rsp)
jmp 0x2f069
jmp 0x2f06b
movq 0x68(%rsp), %rax
movq (%rax), %rdi
leaq 0xb0(%rsp), %rsi
callq 0x19560
jmp 0x2f082
jmp 0x2ef3e
jmp 0x2eeca
testb $0x1, 0xbf(%rsp)
jne 0x2f105
movq 0x68(%rsp), %rax
addq $0x18, %rax
movq %rax, 0x20(%rsp)
leaq 0x80(%rsp), %rdi
leaq 0x18c(%rsp), %rsi
leaq 0xc0(%rsp), %rdx
callq 0x342f0
jmp 0x2f0c3
movq 0x20(%rsp), %rdi
leaq 0x80(%rsp), %rsi
callq 0x342a0
movb %dl, 0x17(%rsp)
movq %rax, 0x18(%rsp)
jmp 0x2f0e0
movb 0x17(%rsp), %al
movq 0x18(%rsp), %rcx
movq %rcx, 0x70(%rsp)
movb %al, 0x78(%rsp)
movl 0x18c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x18c(%rsp)
jmp 0x2f12e
movq 0xc0(%rsp), %rax
movq %rax, 0x8(%rsp)
cmpq $0x0, %rax
je 0x2f12c
movq 0x8(%rsp), %rdi
callq 0x18520
movq 0x8(%rsp), %rdi
callq 0x2180
jmp 0x2f12e
jmp 0x2f130
movq 0x68(%rsp), %rax
movq (%rax), %rdi
leaq 0xec(%rsp), %rsi
callq 0x185f0
jmp 0x2f147
jmp 0x2edec
leaq 0x100(%rsp), %rdi
callq 0x1b6a0
leaq 0x150(%rsp), %rdi
callq 0x1a030
addq $0x1b8, %rsp            # imm = 0x1B8
retq
leaq 0x150(%rsp), %rdi
callq 0x1a030
movq 0xf8(%rsp), %rdi
callq 0x2310
nopl (%rax,%rax)