// File: /workspace/github_cpp_makefile_star2_O3/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 0xa616
movq (%r13), %r12
movq 0x8(%r13), %rsi
testb %al, %al
je 0x7f93
movq %rsi, %rdx
subq %r12, %rdx
je 0x7f9c
movq 0x8(%r15), %rcx
subq (%r15), %rcx
je 0x7f93
movq 0x28(%rsp), %rax
cmpq $0x2, 0x18(%rax)
ja 0x7fba
movq %r15, 0x18(%rsp)
movq %r14, 0x30(%rsp)
leaq 0xc(%rsp), %r13
leaq 0x14(%rsp), %rbp
movl $0x0, 0x10(%rsp)
movq %rsi, 0x20(%rsp)
movl (%r12), %eax
movl %eax, 0xc(%rsp)
movq %rbx, %rdi
movq %r13, %rsi
callq 0xc2d2
movl %eax, %r14d
movq 0x28(%rsp), %rax
movq 0x10(%rax), %r15
testq %r15, %r15
je 0x7ece
movl 0x8(%r15), %eax
movl %eax, 0x14(%rsp)
movq %rbx, %rdi
movq %rbp, %rsi
movq %r13, %rdx
callq 0xbf3a
xorl %ecx, %ecx
cmpl $-0x1, %eax
setne %cl
subl %ecx, %r14d
movq (%r15), %r15
jmp 0x7ea3
cmpl $0x3, %r14d
movl $0x0, %eax
cmovbl %eax, %r14d
addl %r14d, 0x10(%rsp)
addq $0x4, %r12
movq 0x20(%rsp), %rsi
cmpq %rsi, %r12
jne 0x7e84
movq 0x18(%rsp), %rax
movq (%rax), %r15
movq 0x8(%rax), %rax
movq %rax, 0x18(%rsp)
xorl %esi, %esi
cmpq %rax, %r15
je 0x7f83
leaq 0xc(%rsp), %r12
leaq 0x14(%rsp), %r13
movq %rsi, 0x20(%rsp)
movl (%r15), %eax
movl %eax, 0xc(%rsp)
movq %rbx, %rdi
movq %r12, %rsi
callq 0xc2d2
movl %eax, %ebp
movq 0x28(%rsp), %rax
movq 0x10(%rax), %r14
testq %r14, %r14
je 0x7f5c
movl 0x8(%r14), %eax
movl %eax, 0x14(%rsp)
movq %rbx, %rdi
movq %r13, %rsi
movq %r12, %rdx
callq 0xbf3a
xorl %ecx, %ecx
cmpl $-0x1, %eax
setne %cl
subl %ecx, %ebp
movq (%r14), %r14
jmp 0x7f32
movq 0x20(%rsp), %rsi
leal (%rsi,%rbp), %eax
cmpl 0x10(%rsp), %eax
setae %cl
cmpl $0x3, %ebp
setae %dl
cmovael %eax, %esi
testb %cl, %dl
jne 0x7f83
addq $0x4, %r15
cmpq 0x18(%rsp), %r15
jne 0x7f10
cmpl %esi, 0x10(%rsp)
movq 0x30(%rsp), %rax
setbe (%rax)
movb $0x1, %al
jmp 0x7fab
cmpq %r12, %rsi
je 0x7f9c
movq %r12, 0x8(%r13)
movq (%r15), %rax
cmpq %rax, 0x8(%r15)
je 0x7fa9
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 0x7fca
xorl %eax, %eax
cmpq $0x63, %rcx
ja 0x7fab
movb %al, (%r14)
testb %al, %al
cmovneq %r13, %r15
movq (%r15), %r12
movq 0x8(%r15), %r15
xorl %ecx, %ecx
cmpq %r15, %r12
je 0x7fa9
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 0xc2d2
movl %eax, %ecx
addl %ebp, %ecx
cmpl $0x11, %ecx
setae %al
jae 0x7fab
leaq 0x4(%r12), %rdx
cmpq %r15, %r12
movq %rdx, %r12
jne 0x7fea
jmp 0x7fab
nop