// File: iPapatsoris[P]Maximum-Independent-Set/src/Graph.cpp
// Function: Graph::nodeIsEffective(unsigned int const&) const
uint32_t Graph::nodeIsEffective(const uint32_t &node) const {
    vector<uint32_t> neighbors;
    gatherNeighbors(node, neighbors);
    neighbors.push_back(node);
    unordered_set<uint32_t> neighborsAtDistance2;
    getNeighborsAtDistance2(node, neighborsAtDistance2);
    uint32_t f = 0;
    for (auto it = neighborsAtDistance2.begin() ; it != neighborsAtDistance2.end() ; it++) {
        for (auto neighbor: neighbors) {
            if (edgeExists(*it, neighbor)) {
                f++;
            }
        }
    }
    uint32_t g = 0;
    for (auto it = neighborsAtDistance2.begin() ; it != neighborsAtDistance2.end() ; it++) {
        g += (5 - getNodeDegree(*it) + f - neighborsAtDistance2.size());
    }

    uint32_t k4 = getNumberOfDegreeNeighbors(node, 4);
    uint32_t k5 = getNumberOfDegreeNeighbors(node, 5);
    bool effective = false;
    if (k4 == 0 && k5 == 5) {
        if (f >= 14 && g >= 0 || f >= 12 && g >= 3 || f >= 10 && g >= 5) {
            effective = true;
        }
    } else if (k4 == 1 && k5 == 4) {
        if (f >= 13 && g >= 0 || f >= 11 && g >= 2) {
            effective = true;
        }
    } else if (k4 == 2 && k5 == 3) {
        if (f >= 12 && g >= 0 || f >= 10 && g >= 2) {
            effective = true;
        }
    } else if (k4 == 3 && k5 == 2 && f >= 11 && g >= 0) {
        effective = true;
    } else if (k4 == 4 && k5 == 1) {
        if (f >= 12 && g >= 0 || f >= 10 && g >= 1) {
            effective = true;
        }
    } else if (k4 == 5 && k5 == 0 && f >= 10 && g >= 0) {
        effective = true;
    }
    return effective;
}

// Assembly:
subq $0x138, %rsp            # imm = 0x138
movq %rdi, 0x130(%rsp)
movq %rsi, 0x128(%rsp)
movq 0x130(%rsp), %rax
movq %rax, 0x30(%rsp)
leaq 0x110(%rsp), %rdi
movq %rdi, 0x38(%rsp)
callq 0x17e60
movq 0x30(%rsp), %rdi
movq 0x38(%rsp), %rdx
movq 0x128(%rsp), %rsi
movl $0xffffffff, 0x10c(%rsp) # imm = 0xFFFFFFFF
xorl %eax, %eax
movl %eax, %ecx
leaq 0x10c(%rsp), %r8
callq 0x19c30
jmp 0x8a26
movq 0x128(%rsp), %rsi
leaq 0x110(%rsp), %rdi
callq 0x19070
jmp 0x8a3d
leaq 0xc0(%rsp), %rdi
movq %rdi, 0x28(%rsp)
callq 0x1a020
movq 0x30(%rsp), %rdi
movq 0x28(%rsp), %rdx
movq 0x128(%rsp), %rsi
movl $0xffffffff, 0xbc(%rsp) # imm = 0xFFFFFFFF
xorl %eax, %eax
movl %eax, %r8d
leaq 0xbc(%rsp), %rcx
callq 0x2f30
jmp 0x8a80
movl $0x0, 0xb8(%rsp)
leaq 0xc0(%rsp), %rdi
callq 0x19220
movq %rax, 0xb0(%rsp)
leaq 0xc0(%rsp), %rdi
callq 0x19250
movq %rax, 0xa8(%rsp)
leaq 0xb0(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
callq 0x19280
testb $0x1, %al
jne 0x8ad3
jmp 0x8bf7
leaq 0x110(%rsp), %rax
movq %rax, 0xa0(%rsp)
movq 0xa0(%rsp), %rdi
callq 0x19b50
movq %rax, 0x98(%rsp)
movq 0xa0(%rsp), %rdi
callq 0x1a0e0
movq %rax, 0x90(%rsp)
leaq 0x98(%rsp), %rdi
leaq 0x90(%rsp), %rsi
callq 0x1a110
testb $0x1, %al
jne 0x8b2b
jmp 0x8bd9
leaq 0x98(%rsp), %rdi
callq 0x1a150
movl (%rax), %eax
movl %eax, 0x8c(%rsp)
leaq 0xb0(%rsp), %rdi
callq 0x192a0
movq 0x30(%rsp), %rdi
movq %rax, %rsi
leaq 0x8c(%rsp), %rdx
callq 0x18920
movb %al, 0x27(%rsp)
jmp 0x8b69
movb 0x27(%rsp), %al
testb $0x1, %al
jne 0x8b73
jmp 0x8bc5
movl 0xb8(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xb8(%rsp)
jmp 0x8bc5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x100(%rsp)
movl %eax, 0xfc(%rsp)
jmp 0x8e9a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x100(%rsp)
movl %eax, 0xfc(%rsp)
leaq 0xc0(%rsp), %rdi
callq 0x1a030
jmp 0x8e9a
jmp 0x8bc7
leaq 0x98(%rsp), %rdi
callq 0x1a160
jmp 0x8b0d
jmp 0x8bdb
leaq 0xb0(%rsp), %rdi
xorl %esi, %esi
callq 0x1a5d0
movq %rax, 0x80(%rsp)
jmp 0x8aa0
movl $0x0, 0x7c(%rsp)
leaq 0xc0(%rsp), %rdi
callq 0x19220
movq %rax, 0x70(%rsp)
leaq 0xc0(%rsp), %rdi
callq 0x19250
movq %rax, 0x68(%rsp)
leaq 0x70(%rsp), %rdi
leaq 0x68(%rsp), %rsi
callq 0x19280
testb $0x1, %al
jne 0x8c38
jmp 0x8ca4
leaq 0x70(%rsp), %rdi
callq 0x192a0
movq 0x30(%rsp), %rdi
movq %rax, %rsi
callq 0x1a040
movl %eax, 0x20(%rsp)
jmp 0x8c55
movl 0x20(%rsp), %ecx
movl $0x5, %eax
subl %ecx, %eax
addl 0xb8(%rsp), %eax
movl %eax, %eax
movq %rax, 0x18(%rsp)
leaq 0xc0(%rsp), %rdi
callq 0x191e0
movq 0x18(%rsp), %rcx
subq %rax, %rcx
movl 0x7c(%rsp), %eax
addq %rcx, %rax
movl %eax, 0x7c(%rsp)
leaq 0x70(%rsp), %rdi
xorl %esi, %esi
callq 0x1a5d0
movq %rax, 0x60(%rsp)
jmp 0x8c11
movq 0x30(%rsp), %rdi
movq 0x128(%rsp), %rsi
movl $0x4, 0x58(%rsp)
movl $0x0, 0x54(%rsp)
leaq 0x58(%rsp), %rdx
leaq 0x54(%rsp), %rcx
callq 0x2d40
movl %eax, 0x14(%rsp)
jmp 0x8cd6
movq 0x30(%rsp), %rdi
movl 0x14(%rsp), %eax
movl %eax, 0x5c(%rsp)
movq 0x128(%rsp), %rsi
movl $0x5, 0x4c(%rsp)
movl $0x0, 0x48(%rsp)
leaq 0x4c(%rsp), %rdx
leaq 0x48(%rsp), %rcx
callq 0x2d40
movl %eax, 0x10(%rsp)
jmp 0x8d10
movl 0x10(%rsp), %eax
movl %eax, 0x50(%rsp)
movb $0x0, 0x47(%rsp)
cmpl $0x0, 0x5c(%rsp)
jne 0x8d68
cmpl $0x5, 0x50(%rsp)
jne 0x8d68
cmpl $0xe, 0xb8(%rsp)
jb 0x8d3c
cmpl $0x0, 0x7c(%rsp)
jae 0x8d5e
cmpl $0xc, 0xb8(%rsp)
jb 0x8d4d
cmpl $0x3, 0x7c(%rsp)
jae 0x8d5e
cmpl $0xa, 0xb8(%rsp)
jb 0x8d63
cmpl $0x5, 0x7c(%rsp)
jb 0x8d63
movb $0x1, 0x47(%rsp)
jmp 0x8e67
cmpl $0x1, 0x5c(%rsp)
jne 0x8da2
cmpl $0x4, 0x50(%rsp)
jne 0x8da2
cmpl $0xd, 0xb8(%rsp)
jb 0x8d87
cmpl $0x0, 0x7c(%rsp)
jae 0x8d98
cmpl $0xb, 0xb8(%rsp)
jb 0x8d9d
cmpl $0x2, 0x7c(%rsp)
jb 0x8d9d
movb $0x1, 0x47(%rsp)
jmp 0x8e65
cmpl $0x2, 0x5c(%rsp)
jne 0x8ddc
cmpl $0x3, 0x50(%rsp)
jne 0x8ddc
cmpl $0xc, 0xb8(%rsp)
jb 0x8dc1
cmpl $0x0, 0x7c(%rsp)
jae 0x8dd2
cmpl $0xa, 0xb8(%rsp)
jb 0x8dd7
cmpl $0x2, 0x7c(%rsp)
jb 0x8dd7
movb $0x1, 0x47(%rsp)
jmp 0x8e63
cmpl $0x3, 0x5c(%rsp)
jne 0x8e02
cmpl $0x2, 0x50(%rsp)
jne 0x8e02
cmpl $0xb, 0xb8(%rsp)
jb 0x8e02
cmpl $0x0, 0x7c(%rsp)
jb 0x8e02
movb $0x1, 0x47(%rsp)
jmp 0x8e61
cmpl $0x4, 0x5c(%rsp)
jne 0x8e39
cmpl $0x1, 0x50(%rsp)
jne 0x8e39
cmpl $0xc, 0xb8(%rsp)
jb 0x8e21
cmpl $0x0, 0x7c(%rsp)
jae 0x8e32
cmpl $0xa, 0xb8(%rsp)
jb 0x8e37
cmpl $0x1, 0x7c(%rsp)
jb 0x8e37
movb $0x1, 0x47(%rsp)
jmp 0x8e5f
cmpl $0x5, 0x5c(%rsp)
jne 0x8e5d
cmpl $0x0, 0x50(%rsp)
jne 0x8e5d
cmpl $0xa, 0xb8(%rsp)
jb 0x8e5d
cmpl $0x0, 0x7c(%rsp)
jb 0x8e5d
movb $0x1, 0x47(%rsp)
jmp 0x8e5f
jmp 0x8e61
jmp 0x8e63
jmp 0x8e65
jmp 0x8e67
movb 0x47(%rsp), %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, 0xc(%rsp)
leaq 0xc0(%rsp), %rdi
callq 0x1a030
leaq 0x110(%rsp), %rdi
callq 0x18520
movl 0xc(%rsp), %eax
addq $0x138, %rsp            # imm = 0x138
retq
leaq 0x110(%rsp), %rdi
callq 0x18520
movq 0x100(%rsp), %rdi
callq 0x2310
nopw %cs:(%rax,%rax)