// File: /workspace/github_cpp_makefile_star2_O2/iPapatsoris[P]Maximum-Independent-Set/src/Reductions.cpp
// Function: Reductions::removeLineGraphs(unsigned int const&)
void Reductions::removeLineGraphs(const uint32_t &theta) {
    //cout << "\n**Performing line graph reduction**" << endl;
    vector<unordered_map<uint32_t, vector<uint32_t>* >::iterator> removedCCs;
    for (auto it = ccToNodes.begin() ; it != ccToNodes.end() ; it++) {
        vector<uint32_t> *cc = it->second;
        vector<Graph::GraphTraversal> clique1;
        vector<Graph::GraphTraversal> clique2;
        clique1.reserve(5);
        clique2.reserve(5);
        uint32_t checks;
        if (theta >= 6) {
            checks = 3;
        } else {
            checks = 1;
        }
        for (uint32_t i = 0 ; i < checks ; i++) {
            uint32_t nodes, degree, clique1Size, clique2Size;
            if (theta >= 6) {
                switch (i) {
                    case 0:
                        nodes = 10;
                        degree = 6;
                        clique1Size = clique2Size = 4;
                        break;
                    case 1:
                        nodes = 15;
                        degree = 8;
                        clique1Size = clique2Size = 5;
                        break;
                    case 2:
                        nodes = 20;
                        degree = 7;
                        clique1Size = 5;
                        clique2Size = 4;
                        break;
                }
            } else if (theta == 5) {
                nodes = 12;
                degree = 5;
                clique1Size = 4;
                clique2Size = 3;
            } else if (theta <= 4) {
                nodes = 6;
                degree = 4;
                clique1Size = clique2Size = 3;
            }
            if (cc->size() == nodes && nodeDegreesEqualTo(*cc, degree, graph)) {
                bool foundCliques = true;
                for (auto node : *cc) {
                    clique1.clear();
                    clique2.clear();
                    clique1.push_back(Graph::GraphTraversal(graph, node));
                    if (!findClique(clique1, NULL, clique1Size)) {
                        foundCliques = false;
                        break;
                    }
                    clique2.push_back(Graph::GraphTraversal(graph, node));
                    if (!findClique(clique2, &clique1, clique2Size)) {
                        foundCliques = false;
                        break;
                    }
                }
                if (foundCliques) {
                    //cout << "Removing component " << it->first << "\n";
                    findMisInComponent(*cc);
                    graph.remove(*cc, reduceInfo, true);
                    removedCCs.push_back(it);
                    break;
                } else {
                    break;
                }
            }
        }
    }
    if (removedCCs.empty()) {
        //cout << "No nodes removed" << endl;
    } else {
        for (auto cc : removedCCs) {
            delete cc->second;
            ccToNodes.erase(cc);
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rsi, %r14
movq %rdi, %r15
xorps %xmm0, %xmm0
leaq 0x60(%rsp), %rax
movaps %xmm0, (%rax)
andq $0x0, 0x10(%rax)
leaq 0x18(%rdi), %rax
movq %rax, 0x88(%rsp)
leaq 0x28(%rdi), %rax
leaq 0x10(%rdi), %rcx
movq %rcx, 0x80(%rsp)
leaq 0x20(%rsp), %rbx
pushq $0x5
popq %r12
leaq 0x40(%rsp), %rbp
movq (%rax), %rax
movq %rax, 0x58(%rsp)
testq %rax, %rax
je 0xe899
movq 0x10(%rax), %r13
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
andq $0x0, 0x30(%rsp)
movaps %xmm0, 0x40(%rsp)
andq $0x0, 0x50(%rsp)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x107a6
movq %rbp, %rdi
movq %r12, %rsi
callq 0x107a6
xorl %eax, %eax
cmpl $0x6, (%r14)
setae %al
leal 0x1(,%rax,2), %ebx
xorl %ebp, %ebp
cmpl %ebp, %ebx
je 0xe871
movl (%r14), %eax
cmpl $0x6, %eax
jb 0xe6ca
cmpl $0x2, %ebp
je 0xe702
cmpl $0x1, %ebp
jne 0xe71e
movl $0x8, 0x10(%rsp)
pushq $0x5
popq %rax
movl %eax, 0x8(%rsp)
movl %eax, 0xc(%rsp)
pushq $0xf
jmp 0xe733
cmpl $0x5, %eax
jne 0xe6eb
movl $0x5, 0x10(%rsp)
movl $0x4, 0xc(%rsp)
movl $0x3, 0x8(%rsp)
pushq $0xc
jmp 0xe733
movl $0x4, 0x10(%rsp)
pushq $0x3
popq %rax
movl %eax, 0x8(%rsp)
movl %eax, 0xc(%rsp)
pushq $0x6
jmp 0xe733
movl $0x7, 0x10(%rsp)
movl $0x5, 0xc(%rsp)
movl $0x4, 0x8(%rsp)
pushq $0x14
jmp 0xe733
movl $0x6, 0x10(%rsp)
pushq $0x4
popq %rax
movl %eax, 0x8(%rsp)
movl %eax, 0xc(%rsp)
pushq $0xa
popq %rax
movq 0x8(%r13), %rcx
subq (%r13), %rcx
sarq $0x2, %rcx
cmpq %rax, %rcx
jne 0xe759
movq (%r15), %rdx
movq %r13, %rdi
leaq 0x10(%rsp), %rsi
callq 0x1083a
testb %al, %al
jne 0xe760
incl %ebp
jmp 0xe699
movq (%r13), %rbx
movq 0x8(%r13), %rax
movq %rax, 0x90(%rsp)
cmpq 0x90(%rsp), %rbx
je 0xe82d
movl (%rbx), %eax
movl %eax, 0x14(%rsp)
movq 0x20(%rsp), %rax
cmpq %rax, 0x28(%rsp)
je 0xe795
movq %rax, 0x28(%rsp)
movq 0x40(%rsp), %rax
cmpq %rax, 0x48(%rsp)
je 0xe7a6
movq %rax, 0x48(%rsp)
movq (%r15), %rsi
leaq 0x18(%rsp), %rbp
movq %rbp, %rdi
leaq 0x14(%rsp), %rdx
callq 0x2720
leaq 0x20(%rsp), %r12
movq %r12, %rdi
movq %rbp, %rsi
callq 0x11248
movq %r15, %rdi
movq %r12, %rsi
xorl %edx, %edx
leaq 0xc(%rsp), %rcx
callq 0x100b0
testb %al, %al
je 0xe871
movq (%r15), %rsi
leaq 0x18(%rsp), %rbp
movq %rbp, %rdi
leaq 0x14(%rsp), %rdx
callq 0x2720
leaq 0x40(%rsp), %r12
movq %r12, %rdi
movq %rbp, %rsi
callq 0x11248
movq %r15, %rdi
movq %r12, %rsi
leaq 0x20(%rsp), %rdx
leaq 0x8(%rsp), %rcx
callq 0x100b0
addq $0x4, %rbx
testb %al, %al
jne 0xe770
jmp 0xe871
movq %r15, %rdi
movq %r13, %rsi
callq 0x1019c
movq (%r15), %rdi
movb $0x1, 0x18(%rsp)
movb $0x0, 0x14(%rsp)
movq %r13, %rsi
movq 0x80(%rsp), %rdx
leaq 0x18(%rsp), %rcx
xorl %r8d, %r8d
leaq 0x14(%rsp), %r9
callq 0x9e48
leaq 0x60(%rsp), %rdi
leaq 0x58(%rsp), %rsi
callq 0x105e0
leaq 0x40(%rsp), %rbp
movq %rbp, %rdi
callq 0x111fe
leaq 0x20(%rsp), %rbx
movq %rbx, %rdi
callq 0x111fe
movq 0x58(%rsp), %rax
pushq $0x5
popq %r12
jmp 0xe643
movq 0x60(%rsp), %r15
movq 0x68(%rsp), %r12
cmpq %r12, %r15
je 0xe8df
cmpq %r12, %r15
je 0xe8df
movq (%r15), %rbx
movq 0x10(%rbx), %r14
testq %r14, %r14
je 0xe8c1
movq %r14, %rdi
callq 0xb872
movq %r14, %rdi
callq 0x2160
movq 0x88(%rsp), %rdi
movq %rbx, %rsi
callq 0x10dde
addq $0x8, %r15
jmp 0xe8a8
leaq 0x60(%rsp), %rdi
callq 0x10c92
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xe90c
jmp 0xe90c
movq %rax, %rbx
jmp 0xe923
jmp 0xe90c
jmp 0xe90c
jmp 0xe90c
jmp 0xe90c
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x111fe
leaq 0x20(%rsp), %rdi
callq 0x111fe
leaq 0x60(%rsp), %rdi
callq 0x10c92
movq %rbx, %rdi
callq 0x22c0
nop