// File: /workspace/github_cpp_makefile_star2_O2/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 $0x98, %rsp
movq %rsi, 0x78(%rsp)
orl $-0x1, (%rsi)
movq %rdi, %r15
movq %rdx, 0x70(%rsp)
orl $-0x1, (%rdx)
leaq 0x14(%rsp), %rdi
movq %r15, %rsi
callq 0x270e
pushq $-0x1
popq %rax
leaq 0x24(%rsp), %r13
leaq 0x2c(%rsp), %rbp
movl %eax, 0x1c(%rsp)
movl %eax, %ebx
movq %r15, 0x80(%rsp)
cmpl $-0x1, 0x14(%rsp)
je 0x4039
movl %ebx, 0xc(%rsp)
movq %r15, %rdi
leaq 0x14(%rsp), %rbx
movq %rbx, %rsi
callq 0xa5ce
cmpl $0x4, %eax
jne 0x3e77
andq $0x0, 0x60(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x50(%rsp)
orl $-0x1, 0x30(%rsp)
movq %r15, %rdi
movq %rbx, %rsi
leaq 0x50(%rsp), %rdx
xorl %ecx, %ecx
leaq 0x30(%rsp), %r8
callq 0xa3c8
movq 0x50(%rsp), %rbx
movq 0x58(%rsp), %r14
movl $0x0, 0x8(%rsp)
cmpq %r14, %rbx
je 0x3e2c
movl (%rbx), %eax
movl %eax, 0x30(%rsp)
movq %r15, %rdi
leaq 0x30(%rsp), %rsi
callq 0xa5ce
xorl %ecx, %ecx
cmpl $0x3, %eax
sete %cl
addl %ecx, 0x8(%rsp)
addq $0x4, %rbx
jmp 0x3e02
movl 0x1c(%rsp), %ecx
cmpl $-0x1, %ecx
sete %al
cmpl %ecx, 0x8(%rsp)
seta %cl
orb %al, %cl
je 0x3e54
movl 0x14(%rsp), %eax
movq 0x70(%rsp), %rcx
movl %eax, (%rcx)
movl 0x8(%rsp), %eax
movl %eax, 0x1c(%rsp)
movl 0xc(%rsp), %eax
cmpl $-0x1, %eax
leaq 0x10(%rsp), %rbx
leaq 0x20(%rsp), %r14
je 0x3e8d
cmpl %eax, 0x8(%rsp)
ja 0x3e8d
leaq 0x50(%rsp), %rdi
callq 0xb872
movl 0xc(%rsp), %ebx
movq %r15, %rdi
leaq 0x14(%rsp), %rsi
callq 0x9cf8
jmp 0x3d9e
movq 0x50(%rsp), %rax
movq 0x58(%rsp), %rcx
movq %rcx, 0x88(%rsp)
cmpq 0x88(%rsp), %rax
je 0x3e6d
movq %rax, 0x90(%rsp)
movl (%rax), %eax
movl %eax, 0x28(%rsp)
movq %r15, %rdi
leaq 0x28(%rsp), %rsi
callq 0xa5ce
cmpl $0x4, %eax
jne 0x4028
andq $0x0, 0x40(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
orl $-0x1, 0x24(%rsp)
movq %r15, %rdi
leaq 0x28(%rsp), %rsi
leaq 0x30(%rsp), %rdx
xorl %ecx, %ecx
movq %r13, %r8
callq 0xa3c8
movl 0x14(%rsp), %eax
movl %eax, 0x20(%rsp)
movq 0x30(%rsp), %rcx
movq 0x38(%rsp), %rdx
xorl %esi, %esi
cmpq %rdx, %rcx
je 0x3f3c
movl (%rcx), %edi
cmpl %eax, %edi
je 0x3f36
cmpl $0x2, %esi
je 0x3f30
cmpl $0x1, %esi
je 0x3f2a
testl %esi, %esi
jne 0x3f34
movl %edi, 0x24(%rsp)
jmp 0x3f34
movl %edi, 0x2c(%rsp)
jmp 0x3f34
movl %edi, 0x10(%rsp)
incl %esi
addq $0x4, %rcx
jmp 0x3f0b
movq %r15, %rdi
movq %r13, %rsi
movq %rbp, %rdx
callq 0x9e3a
movb %al, 0x7(%rsp)
movq %r15, %rdi
movq %rbp, %rsi
movq %rbx, %rdx
callq 0x9e3a
movb %al, 0x6(%rsp)
movq %r15, %rdi
movq %r13, %rsi
movq %rbx, %rdx
callq 0x9e3a
movb %al, 0x5(%rsp)
movq %r15, %rdi
movq %r14, %rsi
movq %r13, %r12
movq %r13, %rdx
callq 0x9e3a
movl %eax, %r13d
movq %r15, %rdi
movq %r14, %rsi
movq %rbp, %rbx
movq %rbp, %rdx
callq 0x9e3a
movl %eax, %ebp
movq %r15, %rdi
movq %r14, %rsi
leaq 0x10(%rsp), %rdx
callq 0x9e3a
orb %bpl, %r13b
orb %al, %r13b
je 0x3fb9
movq %r12, %r13
movq %rbx, %rbp
jmp 0x400c
movb 0x7(%rsp), %dl
movl %edx, %eax
xorb $0x1, %al
movb 0x6(%rsp), %sil
movl %esi, %ecx
movb 0x5(%rsp), %dil
orb %dil, %cl
orb %al, %cl
cmpb $0x1, %cl
movq %r12, %r13
movq %rbx, %rbp
jne 0x3ff9
movl %esi, %eax
xorb $0x1, %al
movl %edx, %ecx
orb %dil, %cl
orb %al, %cl
cmpb $0x1, %cl
jne 0x3ff9
xorb $0x1, %dil
orb %dl, %sil
orb %dil, %sil
jne 0x400c
movl 0x14(%rsp), %eax
movq 0x78(%rsp), %rcx
movl %eax, (%rcx)
movl 0x8(%rsp), %eax
movl %eax, 0xc(%rsp)
leaq 0x30(%rsp), %rdi
callq 0xb872
movq 0x80(%rsp), %r15
leaq 0x10(%rsp), %rbx
leaq 0x20(%rsp), %r14
movq 0x90(%rsp), %rax
addq $0x4, %rax
jmp 0x3e9f
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x406a
jmp 0x4059
jmp 0x4059
jmp 0x4059
jmp 0x4059
jmp 0x4059
jmp 0x4059
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0xb872
jmp 0x406d
jmp 0x406a
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0xb872
movq %rbx, %rdi
callq 0x22c0
nop