// File: /workspace/github_cpp_makefile_star2_O1/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %r8, %r14
movq %rcx, %r15
movq %rdx, %r13
movq %rdi, %rbx
movq %rsi, 0x28(%rsp)
callq 0xac06
testb %al, %al
je 0x80cd
movq (%r13), %r12
movq 0x8(%r13), %rdx
movq %rdx, 0x18(%rsp)
subq %r12, %rdx
je 0x80cd
movq 0x8(%r15), %rcx
subq (%r15), %rcx
je 0x80cd
movq 0x28(%rsp), %rax
cmpq $0x2, 0x18(%rax)
ja 0x80f9
movq %r15, 0x20(%rsp)
movq %r14, 0x30(%rsp)
movl $0x0, 0x10(%rsp)
cmpq 0x18(%rsp), %r12
je 0x8023
leaq 0xc(%rsp), %r13
leaq 0x14(%rsp), %rbp
movl $0x0, 0x10(%rsp)
movl (%r12), %eax
movl %eax, 0xc(%rsp)
movq %rbx, %rdi
movq %r13, %rsi
callq 0xc98e
movl %eax, %r14d
movq 0x28(%rsp), %rax
movq 0x10(%rax), %r15
testq %r15, %r15
je 0x8006
movl 0x8(%r15), %eax
movl %eax, 0x14(%rsp)
movq %rbx, %rdi
movq %rbp, %rsi
movq %r13, %rdx
callq 0xc5e2
xorl %ecx, %ecx
cmpl $-0x1, %eax
setne %cl
subl %ecx, %r14d
movq (%r15), %r15
jmp 0x7fdb
cmpl $0x3, %r14d
movl $0x0, %eax
cmovbl %eax, %r14d
addl %r14d, 0x10(%rsp)
addq $0x4, %r12
cmpq 0x18(%rsp), %r12
jne 0x7fbc
movq 0x20(%rsp), %rax
movq (%rax), %r14
movq 0x8(%rax), %rax
movq %rax, 0x20(%rsp)
cmpq %rax, %r14
movl $0x0, %esi
je 0x80bd
xorl %esi, %esi
leaq 0xc(%rsp), %r12
leaq 0x14(%rsp), %r13
movq %rsi, 0x18(%rsp)
movl (%r14), %eax
movl %eax, 0xc(%rsp)
movq %rbx, %rdi
movq %r12, %rsi
callq 0xc98e
movl %eax, %ebp
movq 0x28(%rsp), %rax
movq 0x10(%rax), %r15
testq %r15, %r15
je 0x8096
movl 0x8(%r15), %eax
movl %eax, 0x14(%rsp)
movq %rbx, %rdi
movq %r13, %rsi
movq %r12, %rdx
callq 0xc5e2
xorl %ecx, %ecx
cmpl $-0x1, %eax
setne %cl
subl %ecx, %ebp
movq (%r15), %r15
jmp 0x806c
movq 0x18(%rsp), %rsi
leal (%rsi,%rbp), %eax
cmpl 0x10(%rsp), %eax
setae %cl
cmpl $0x3, %ebp
setae %dl
cmovael %eax, %esi
testb %cl, %dl
jne 0x80bd
addq $0x4, %r14
cmpq 0x20(%rsp), %r14
jne 0x804a
cmpl %esi, 0x10(%rsp)
movq 0x30(%rsp), %rax
setbe (%rax)
movb $0x1, %al
jmp 0x80ea
movq (%r13), %rax
cmpq %rax, 0x8(%r13)
je 0x80db
movq %rax, 0x8(%r13)
movq (%r15), %rax
cmpq %rax, 0x8(%r15)
je 0x80e8
movq %rax, 0x8(%r15)
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movb $0x1, %al
cmpq $0x64, %rdx
jb 0x8109
xorl %eax, %eax
cmpq $0x63, %rcx
ja 0x80ea
movb %al, (%r14)
testb %al, %al
cmovneq %r13, %r15
movq (%r15), %r12
movq 0x8(%r15), %r15
xorl %ecx, %ecx
cmpq %r15, %r12
je 0x80e8
addq $0x4, %r12
leaq 0xc(%rsp), %r14
movl %ecx, %ebp
movl -0x4(%r12), %eax
movl %eax, 0xc(%rsp)
movq %rbx, %rdi
movq %r14, %rsi
callq 0xc98e
movl %eax, %ecx
addl %ebp, %ecx
cmpl $0x11, %ecx
setae %al
jae 0x80ea
leaq 0x4(%r12), %rdx
cmpq %r15, %r12
movq %rdx, %r12
jne 0x8129
jmp 0x80ea