// File: /workspace/github_cpp_makefile_star2_O1/iPapatsoris[P]Maximum-Independent-Set/src/Graph.cpp
// Function: Graph::getOptimalDegree4Node3(unsigned int&, unsigned int&) const
void Graph::getOptimalDegree4Node3(uint32_t &maxNodeWithCond, uint32_t &maxNode) const {
    uint32_t maxDegree3NeighborsWithCond = NONE;
    maxNodeWithCond = NONE;
    uint32_t maxDegree3Neighbors = NONE;
    maxNode = NONE;
    GraphTraversal graphTraversal(*this);
    while (graphTraversal.curNode != NONE) {
        if (getNodeDegree(graphTraversal.curNode) == 4) {
            vector<uint32_t> neighborsV;
            gatherNeighbors(graphTraversal.curNode, neighborsV);
            uint32_t degree3Neighbors = 0;
            for (uint32_t neighborV: neighborsV) {
                if (getNodeDegree(neighborV) == 3) {
                    degree3Neighbors++;
                }
            }
            if (maxDegree3Neighbors == NONE || degree3Neighbors > maxDegree3Neighbors) {
                maxDegree3Neighbors = degree3Neighbors;
                maxNode = graphTraversal.curNode;
            }
            if (maxDegree3NeighborsWithCond == NONE || degree3Neighbors > maxDegree3NeighborsWithCond) {
                for (uint32_t neighborV: neighborsV) {
                    if (getNodeDegree(neighborV) == 4) {
                        vector<uint32_t> neighborsN;
                        gatherNeighbors(neighborV, neighborsN);
                        uint32_t a, b, c;
                        uint32_t v = graphTraversal.curNode;
                        uint32_t i = 0;
                        for (uint32_t n: neighborsN) {
                            if (n != v) {
                                if (i == 0) {
                                    a = n;
                                } else if (i == 1) {
                                    b = n;
                                } else if (i == 2) {
                                    c = n;
                                }
                                i++;
                            }
                        }
                        bool ab = edgeExists(a, b);
                        bool bc = edgeExists(b, c);
                        bool ac = edgeExists(a, c);
                        bool va = edgeExists(v, a);
                        bool vb = edgeExists(v, b);
                        bool vc = edgeExists(v, c);
                        if (!va && !vb && !vc && (ab && !bc && !ac || bc && !ab && !ac || ac && !ab && !bc)) {
                            maxDegree3NeighborsWithCond = degree3Neighbors;
                            maxNodeWithCond = graphTraversal.curNode;
                        }
                    }
                }
            }
        }
        getNextNode(graphTraversal);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rdi, %rbp
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
movq %rsi, 0x78(%rsp)
movl %r14d, (%rsi)
movq %rdx, 0x70(%rsp)
movl %r14d, (%rdx)
leaq 0x8(%rsp), %rbx
movq $-0x1, (%rbx)
movq %rbx, %rsi
callq 0xc034
movl $0xffffffff, 0x14(%rsp) # imm = 0xFFFFFFFF
cmpl %r14d, (%rbx)
je 0x4802
leaq 0x8(%rsp), %rbx
leaq 0x4(%rsp), %r13
movl $0xffffffff, 0x10(%rsp) # imm = 0xFFFFFFFF
movq %rbp, %rdi
movq %rbx, %rsi
callq 0xc98e
cmpl $0x4, %eax
jne 0x47ec
xorps %xmm0, %xmm0
movaps %xmm0, 0x50(%rsp)
movq $0x0, 0x60(%rsp)
movl $0xffffffff, 0x30(%rsp) # imm = 0xFFFFFFFF
movq %rbp, %rdi
movq %rbx, %rsi
leaq 0x50(%rsp), %rdx
xorl %ecx, %ecx
leaq 0x30(%rsp), %r8
callq 0xc714
movq 0x50(%rsp), %rbx
movq 0x58(%rsp), %r15
xorl %r14d, %r14d
cmpq %r15, %rbx
je 0x45e9
movl (%rbx), %eax
movl %eax, 0x30(%rsp)
movq %rbp, %rdi
leaq 0x30(%rsp), %rsi
callq 0xc98e
xorl %ecx, %ecx
cmpl $0x3, %eax
sete %cl
addl %ecx, %r14d
addq $0x4, %rbx
jmp 0x45c0
movl 0x10(%rsp), %ecx
cmpl $-0x1, %ecx
sete %al
cmpl %ecx, %r14d
seta %cl
orb %al, %cl
je 0x460d
movl 0x8(%rsp), %eax
movq 0x70(%rsp), %rcx
movl %eax, (%rcx)
movl %r14d, 0x10(%rsp)
movl 0x14(%rsp), %eax
cmpl $-0x1, %eax
movq %rsp, %rbx
je 0x4622
cmpl %eax, %r14d
jbe 0x47d8
movq 0x50(%rsp), %r15
movq 0x58(%rsp), %rax
movq %rax, 0x80(%rsp)
cmpq %rax, %r15
je 0x47d8
movl (%r15), %eax
movl %eax, 0x1c(%rsp)
movq %rbp, %rdi
leaq 0x1c(%rsp), %rsi
callq 0xc98e
cmpl $0x4, %eax
jne 0x47c6
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
movq $0x0, 0x40(%rsp)
movl $0xffffffff, (%rsp)     # imm = 0xFFFFFFFF
movq %rbp, %rdi
leaq 0x1c(%rsp), %rsi
leaq 0x30(%rsp), %rdx
xorl %ecx, %ecx
movq %rbx, %r8
callq 0xc714
movl 0x8(%rsp), %eax
movl %eax, 0x2c(%rsp)
movq 0x30(%rsp), %rcx
movq 0x38(%rsp), %rdx
cmpq %rdx, %rcx
je 0x46d0
xorl %esi, %esi
movl (%rcx), %edi
cmpl %eax, %edi
je 0x46c7
cmpl $0x2, %esi
je 0x46c1
cmpl $0x1, %esi
je 0x46bb
testl %esi, %esi
jne 0x46c5
movl %edi, (%rsp)
jmp 0x46c5
movl %edi, 0x18(%rsp)
jmp 0x46c5
movl %edi, 0x4(%rsp)
incl %esi
addq $0x4, %rcx
cmpq %rdx, %rcx
jne 0x46a2
movq %rbp, %rdi
movq %rbx, %rsi
leaq 0x18(%rsp), %r12
movq %r12, %rdx
callq 0xc5e2
movl %eax, 0x28(%rsp)
movq %rbp, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0xc5e2
movl %eax, 0x24(%rsp)
movq %rbp, %rdi
movq %rbx, %rsi
movq %r13, %rdx
callq 0xc5e2
movl %eax, 0x20(%rsp)
movq %rbp, %rdi
leaq 0x2c(%rsp), %r13
movq %r13, %rsi
movq %rbx, %rdx
callq 0xc5e2
movl %eax, %ebx
movq %rbp, %rdi
movq %r13, %rsi
leaq 0x18(%rsp), %rdx
callq 0xc5e2
movq %rbp, %rdi
movl %eax, %ebp
movq %rdi, %r12
movq %r13, %rsi
leaq 0x4(%rsp), %rdx
callq 0xc5e2
andl %ebx, %ebp
andl %eax, %ebp
cmpl $-0x1, %ebp
je 0x4756
movq %r12, %rbp
movq %rsp, %rbx
jmp 0x47b2
movl 0x28(%rsp), %edx
cmpl $-0x1, %edx
setne %al
movl 0x20(%rsp), %edi
movl %edi, %ecx
movl 0x24(%rsp), %esi
andl %esi, %ecx
cmpl $-0x1, %ecx
sete %cl
testb %cl, %al
movq %r12, %rbp
movq %rsp, %rbx
jne 0x47a2
cmpl $-0x1, %esi
setne %al
movl %edi, %ecx
andl %edx, %ecx
cmpl $-0x1, %ecx
sete %cl
testb %cl, %al
jne 0x47a2
cmpl $-0x1, %edi
sete %al
andl %edx, %esi
cmpl $-0x1, %esi
setne %cl
orb %al, %cl
jne 0x47b2
movl 0x8(%rsp), %eax
movq 0x78(%rsp), %rcx
movl %eax, (%rcx)
movl %r14d, 0x14(%rsp)
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x47c1
callq 0x21a0
leaq 0x4(%rsp), %r13
addq $0x4, %r15
cmpq 0x80(%rsp), %r15
jne 0x463d
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x47e7
callq 0x21a0
leaq 0x8(%rsp), %rbx
movq %rbp, %rdi
movq %rbx, %rsi
callq 0xc034
cmpl $-0x1, 0x8(%rsp)
jne 0x456f
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x4838
jmp 0x4822
jmp 0x4822
jmp 0x4822
jmp 0x4822
jmp 0x4822
jmp 0x4822
movq %rax, %rbx
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x483b
callq 0x21a0
jmp 0x483b
jmp 0x4838
movq %rax, %rbx
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x484a
callq 0x21a0
movq %rbx, %rdi
callq 0x2320