// File: /workspace/github_cpp_makefile_star2_O3/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, %r12
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movq %rsi, 0x78(%rsp)
movl %ebp, (%rsi)
movq %rdx, 0x70(%rsp)
movl %ebp, (%rdx)
leaq 0x4(%rsp), %rbx
movq $-0x1, (%rbx)
movq %rbx, %rsi
callq 0xb94a
movl $0xffffffff, 0x10(%rsp) # imm = 0xFFFFFFFF
cmpl %ebp, (%rbx)
je 0x4895
leaq 0x4(%rsp), %rbx
movq %rsp, %r13
leaq 0x2c(%rsp), %rbp
movl $0xffffffff, 0xc(%rsp)  # imm = 0xFFFFFFFF
movq %r12, %rdi
movq %rbx, %rsi
callq 0xc2d2
cmpl $0x4, %eax
jne 0x487f
xorps %xmm0, %xmm0
movaps %xmm0, 0x50(%rsp)
movq $0x0, 0x60(%rsp)
movl $0xffffffff, 0x30(%rsp) # imm = 0xFFFFFFFF
movq %r12, %rdi
movq %rbx, %rsi
leaq 0x50(%rsp), %rdx
xorl %ecx, %ecx
leaq 0x30(%rsp), %r8
callq 0xc092
movq 0x50(%rsp), %rbx
movq 0x58(%rsp), %r14
xorl %r15d, %r15d
cmpq %r14, %rbx
je 0x466e
movl (%rbx), %eax
movl %eax, 0x30(%rsp)
movq %r12, %rdi
leaq 0x30(%rsp), %rsi
callq 0xc2d2
xorl %ecx, %ecx
cmpl $0x3, %eax
sete %cl
addl %ecx, %r15d
addq $0x4, %rbx
jmp 0x4645
movl 0xc(%rsp), %ecx
cmpl $-0x1, %ecx
sete %al
cmpl %ecx, %r15d
seta %cl
orb %al, %cl
je 0x4692
movl 0x4(%rsp), %eax
movq 0x70(%rsp), %rcx
movl %eax, (%rcx)
movl %r15d, 0xc(%rsp)
movq 0x50(%rsp), %rdi
movl 0x10(%rsp), %eax
cmpl $-0x1, %eax
je 0x46a9
cmpl %eax, %r15d
jbe 0x4870
movq 0x58(%rsp), %rax
movq %rax, 0x80(%rsp)
cmpq %rax, %rdi
je 0x4870
movq %rdi, 0x68(%rsp)
movl (%rdi), %eax
movl %eax, 0x1c(%rsp)
movq %r12, %rdi
leaq 0x1c(%rsp), %rsi
callq 0xc2d2
cmpl $0x4, %eax
jne 0x4854
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
movq $0x0, 0x40(%rsp)
movl $0xffffffff, (%rsp)     # imm = 0xFFFFFFFF
movq %r12, %rdi
leaq 0x1c(%rsp), %rsi
leaq 0x30(%rsp), %rdx
xorl %ecx, %ecx
movq %r13, %r8
callq 0xc092
movl 0x4(%rsp), %eax
movl %eax, 0x2c(%rsp)
movq 0x30(%rsp), %rcx
movq 0x38(%rsp), %rdx
cmpq %rdx, %rcx
je 0x4756
xorl %esi, %esi
movl (%rcx), %edi
cmpl %eax, %edi
je 0x474d
cmpl $0x2, %esi
je 0x4747
cmpl $0x1, %esi
je 0x4741
testl %esi, %esi
jne 0x474b
movl %edi, (%rsp)
jmp 0x474b
movl %edi, 0x18(%rsp)
jmp 0x474b
movl %edi, 0x14(%rsp)
incl %esi
addq $0x4, %rcx
cmpq %rdx, %rcx
jne 0x4728
movq %r12, %rdi
movq %r13, %rsi
leaq 0x18(%rsp), %rbx
movq %rbx, %rdx
callq 0xbf3a
movl %eax, 0x28(%rsp)
movq %r12, %rdi
movq %rbx, %rsi
leaq 0x14(%rsp), %rbx
movq %rbx, %rdx
callq 0xbf3a
movl %eax, 0x24(%rsp)
movq %r12, %rdi
movq %r13, %rsi
movq %rbx, %rdx
callq 0xbf3a
movl %eax, 0x20(%rsp)
movq %r12, %rdi
movq %rbp, %rsi
movq %r13, %rdx
callq 0xbf3a
movl %eax, %ebx
movq %r12, %rdi
movq %rbp, %rsi
leaq 0x18(%rsp), %rdx
callq 0xbf3a
movq %r12, %rdi
movl %eax, %r12d
movq %rdi, %r13
movq %rbp, %r14
movq %rbp, %rsi
leaq 0x14(%rsp), %rdx
callq 0xbf3a
andl %ebx, %r12d
andl %eax, %r12d
cmpl $-0x1, %r12d
je 0x47e6
movq %r13, %r12
movq %rsp, %r13
movq %r14, %rbp
jmp 0x4845
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 %r13, %r12
movq %rsp, %r13
movq %r14, %rbp
jne 0x4835
cmpl $-0x1, %esi
setne %al
movl %edi, %ecx
andl %edx, %ecx
cmpl $-0x1, %ecx
sete %cl
testb %cl, %al
jne 0x4835
cmpl $-0x1, %edi
sete %al
andl %edx, %esi
cmpl $-0x1, %esi
setne %cl
orb %al, %cl
jne 0x4845
movl 0x4(%rsp), %eax
movq 0x78(%rsp), %rcx
movl %eax, (%rcx)
movl %r15d, 0x10(%rsp)
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x4854
callq 0x21a0
movq 0x68(%rsp), %rdi
addq $0x4, %rdi
cmpq 0x80(%rsp), %rdi
jne 0x46bf
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
leaq 0x4(%rsp), %rbx
je 0x487f
callq 0x21a0
movq %r12, %rdi
movq %rbx, %rsi
callq 0xb94a
cmpl $-0x1, 0x4(%rsp)
jne 0x45f4
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x48cb
jmp 0x48b5
jmp 0x48b5
jmp 0x48b5
jmp 0x48b5
jmp 0x48b5
jmp 0x48b5
movq %rax, %rbx
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x48ce
callq 0x21a0
jmp 0x48ce
jmp 0x48cb
movq %rax, %rbx
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x48dd
callq 0x21a0
movq %rbx, %rdi
callq 0x2320
nop