// File: iPapatsoris[P]Maximum-Independent-Set/src/Graph.cpp
// Function: Graph::checkSeparation(std::unordered_set<unsigned int, std::hash<unsigned int>, std::equal_to<unsigned int>, std::allocator<unsigned int>> const&, std::vector<unsigned int, std::allocator<unsigned int>>&, std::vector<unsigned int, std::allocator<unsigned int>>&, bool&) const
bool Graph::checkSeparation(const unordered_set<uint32_t> &cut, vector<uint32_t> &component1, vector<uint32_t> &component2, bool &actualComponent1) const {
    if (!buildCC(cut, component1, component2) || !component1.size() || !component2.size()) {
        //cout << "more than 2 cc" << endl;
        component1.clear();
        component2.clear();
        return false;
    }
    if (cut.size() < 3) {
        uint32_t degreeSum1 = 0;
        for (auto node: component1) {
            uint32_t degree = getNodeDegree(node);
            for (auto z: cut) {
                if (edgeExists(z, node)) {
                    degree--;
                }
            }
            if (degree >= 3) {
                degreeSum1 += degree;
            }
        }

        uint32_t degreeSum2 = 0;
        for (auto node: component2) {
            uint32_t degree = getNodeDegree(node);
            for (auto z: cut) {
                if (edgeExists(z, node)) {
                    degree--;
                }
            }
            if (degree >= 3) {
                degreeSum2 += degree;
                if (degreeSum2 >= degreeSum1) {
                    break;
                }
            }
        }
        if (degreeSum1 <= degreeSum2) {
            actualComponent1 = true;
        } else {
            actualComponent1 = false;
        }
        return true;
    } else {
        if (component1.size() <= 24) {
            actualComponent1 = true;
        } else if (component2.size() <= 24) {
            actualComponent1 = false;
        } else {
            return false;
        }
        vector<uint32_t> *c = (actualComponent1 ? &component1 : &component2);
        uint32_t degreeSum = 0;
        for (auto node: *c) {
            degreeSum += getNodeDegree(node);
            if (degreeSum >= 17) {
                return true;
            }
        }
        return false;
    }
}

// Assembly:
subq $0xf8, %rsp
movq %rdi, 0xe8(%rsp)
movq %rsi, 0xe0(%rsp)
movq %rdx, 0xd8(%rsp)
movq %rcx, 0xd0(%rsp)
movq %r8, 0xc8(%rsp)
movq 0xe8(%rsp), %rdi
movq %rdi, 0x8(%rsp)
movq 0xe0(%rsp), %rsi
movq 0xd8(%rsp), %rdx
movq 0xd0(%rsp), %rcx
callq 0xe7a0
testb $0x1, %al
jne 0xadcf
jmp 0xadf5
movq 0xd8(%rsp), %rdi
callq 0x188e0
cmpq $0x0, %rax
je 0xadf5
movq 0xd0(%rsp), %rdi
callq 0x188e0
cmpq $0x0, %rax
jne 0xae1c
movq 0xd8(%rsp), %rdi
callq 0x191c0
movq 0xd0(%rsp), %rdi
callq 0x191c0
movb $0x0, 0xf7(%rsp)
jmp 0xb21e
movq 0xe0(%rsp), %rdi
callq 0x191e0
cmpq $0x3, %rax
jae 0xb10c
movl $0x0, 0xc4(%rsp)
movq 0xd8(%rsp), %rax
movq %rax, 0xb8(%rsp)
movq 0xb8(%rsp), %rdi
callq 0x19b50
movq %rax, 0xb0(%rsp)
movq 0xb8(%rsp), %rdi
callq 0x1a0e0
movq %rax, 0xa8(%rsp)
leaq 0xb0(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
callq 0x1a110
testb $0x1, %al
jne 0xae96
jmp 0xafa5
leaq 0xb0(%rsp), %rdi
callq 0x1a150
movq 0x8(%rsp), %rdi
movl (%rax), %eax
movl %eax, 0xa4(%rsp)
leaq 0xa4(%rsp), %rsi
callq 0x1a040
movl %eax, 0xa0(%rsp)
movq 0xe0(%rsp), %rax
movq %rax, 0x98(%rsp)
movq 0x98(%rsp), %rdi
callq 0x1b520
movq %rax, 0x90(%rsp)
movq 0x98(%rsp), %rdi
callq 0x1b550
movq %rax, 0x88(%rsp)
leaq 0x90(%rsp), %rdi
leaq 0x88(%rsp), %rsi
callq 0x19280
testb $0x1, %al
jne 0xaf1a
jmp 0xaf72
leaq 0x90(%rsp), %rdi
callq 0x1b580
movq 0x8(%rsp), %rdi
movl (%rax), %eax
movl %eax, 0x84(%rsp)
leaq 0x84(%rsp), %rsi
leaq 0xa4(%rsp), %rdx
callq 0x18920
testb $0x1, %al
jne 0xaf50
jmp 0xaf61
movl 0xa0(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0xa0(%rsp)
jmp 0xaf63
leaq 0x90(%rsp), %rdi
callq 0x1b5a0
jmp 0xaeff
cmpl $0x3, 0xa0(%rsp)
jb 0xaf91
movl 0xa0(%rsp), %eax
addl 0xc4(%rsp), %eax
movl %eax, 0xc4(%rsp)
jmp 0xaf93
leaq 0xb0(%rsp), %rdi
callq 0x1a160
jmp 0xae78
movl $0x0, 0x80(%rsp)
movq 0xd0(%rsp), %rax
movq %rax, 0x78(%rsp)
movq 0x78(%rsp), %rdi
callq 0x19b50
movq %rax, 0x70(%rsp)
movq 0x78(%rsp), %rdi
callq 0x1a0e0
movq %rax, 0x68(%rsp)
leaq 0x70(%rsp), %rdi
leaq 0x68(%rsp), %rsi
callq 0x1a110
testb $0x1, %al
jne 0xaff3
jmp 0xb0d7
leaq 0x70(%rsp), %rdi
callq 0x1a150
movq 0x8(%rsp), %rdi
movl (%rax), %eax
movl %eax, 0x64(%rsp)
leaq 0x64(%rsp), %rsi
callq 0x1a040
movl %eax, 0x60(%rsp)
movq 0xe0(%rsp), %rax
movq %rax, 0x58(%rsp)
movq 0x58(%rsp), %rdi
callq 0x1b520
movq %rax, 0x50(%rsp)
movq 0x58(%rsp), %rdi
callq 0x1b550
movq %rax, 0x48(%rsp)
leaq 0x50(%rsp), %rdi
leaq 0x48(%rsp), %rsi
callq 0x19280
testb $0x1, %al
jne 0xb056
jmp 0xb099
leaq 0x50(%rsp), %rdi
callq 0x1b580
movq 0x8(%rsp), %rdi
movl (%rax), %eax
movl %eax, 0x44(%rsp)
leaq 0x44(%rsp), %rsi
leaq 0x64(%rsp), %rdx
callq 0x18920
testb $0x1, %al
jne 0xb080
jmp 0xb08b
movl 0x60(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x60(%rsp)
jmp 0xb08d
leaq 0x50(%rsp), %rdi
callq 0x1b5a0
jmp 0xb041
cmpl $0x3, 0x60(%rsp)
jb 0xb0c6
movl 0x60(%rsp), %eax
addl 0x80(%rsp), %eax
movl %eax, 0x80(%rsp)
movl 0x80(%rsp), %eax
cmpl 0xc4(%rsp), %eax
jb 0xb0c4
jmp 0xb0d7
jmp 0xb0c6
jmp 0xb0c8
leaq 0x70(%rsp), %rdi
callq 0x1a160
jmp 0xafdb
movl 0xc4(%rsp), %eax
cmpl 0x80(%rsp), %eax
ja 0xb0f4
movq 0xc8(%rsp), %rax
movb $0x1, (%rax)
jmp 0xb0ff
movq 0xc8(%rsp), %rax
movb $0x0, (%rax)
movb $0x1, 0xf7(%rsp)
jmp 0xb21e
movq 0xd8(%rsp), %rdi
callq 0x188e0
cmpq $0x18, %rax
ja 0xb12c
movq 0xc8(%rsp), %rax
movb $0x1, (%rax)
jmp 0xb15b
movq 0xd0(%rsp), %rdi
callq 0x188e0
cmpq $0x18, %rax
ja 0xb14c
movq 0xc8(%rsp), %rax
movb $0x0, (%rax)
jmp 0xb159
movb $0x0, 0xf7(%rsp)
jmp 0xb21e
jmp 0xb15b
movq 0xc8(%rsp), %rax
testb $0x1, (%rax)
je 0xb176
movq 0xd8(%rsp), %rax
movq %rax, (%rsp)
jmp 0xb182
movq 0xd0(%rsp), %rax
movq %rax, (%rsp)
movq (%rsp), %rax
movq %rax, 0x38(%rsp)
movl $0x0, 0x34(%rsp)
movq 0x38(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0x28(%rsp), %rdi
callq 0x19b50
movq %rax, 0x20(%rsp)
movq 0x28(%rsp), %rdi
callq 0x1a0e0
movq %rax, 0x18(%rsp)
leaq 0x20(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0x1a110
testb $0x1, %al
jne 0xb1d0
jmp 0xb216
leaq 0x20(%rsp), %rdi
callq 0x1a150
movq 0x8(%rsp), %rdi
movl (%rax), %eax
movl %eax, 0x14(%rsp)
leaq 0x14(%rsp), %rsi
callq 0x1a040
addl 0x34(%rsp), %eax
movl %eax, 0x34(%rsp)
cmpl $0x11, 0x34(%rsp)
jb 0xb208
movb $0x1, 0xf7(%rsp)
jmp 0xb21e
jmp 0xb20a
leaq 0x20(%rsp), %rdi
callq 0x1a160
jmp 0xb1bb
movb $0x0, 0xf7(%rsp)
movb 0xf7(%rsp), %al
andb $0x1, %al
addq $0xf8, %rsp
retq
nop