// File: /workspace/github_cpp_makefile_star2_O3/iPapatsoris[P]Maximum-Independent-Set/src/Graph.cpp
// Function: Graph::get4Cycle(std::vector<unsigned int, std::allocator<unsigned int>>&) const
bool Graph::get4Cycle(vector<uint32_t> &optimalCycle) const {
    optimalCycle.clear();
    uint32_t maxDegree3NodesCount = NONE;
    GraphTraversal graphTraversal(*this);
    while (graphTraversal.curNode != NONE) {
        if (getNodeDegree(graphTraversal.curNode) == 4) {
            vector<uint32_t> neighbors;
            gatherNeighbors(graphTraversal.curNode, neighbors);
            uint32_t b, d;
            for (uint32_t i = 0 ; i < 6 ; i++) {
                switch (i) {
                    case 0:
                        b = neighbors[0];
                        d = neighbors[1];
                        break;
                    case 1:
                        b = neighbors[0];
                        d = neighbors[2];
                        break;
                    case 2:
                        b = neighbors[0];
                        d = neighbors[3];
                        break;
                    case 3:
                        b = neighbors[1];
                        d = neighbors[2];
                        break;
                    case 4:
                        b = neighbors[1];
                        d = neighbors[3];
                        break;
                    case 5:
                        b = neighbors[2];
                        d = neighbors[3];
                        break;
                    default:
                        assert(false);
                }
                vector<uint32_t> commonNeighbors;
                getCommonNeighbors(b, d, commonNeighbors);
                for (auto c: commonNeighbors) {
                    if (c == graphTraversal.curNode) {
                        continue;
                    }
                    uint32_t degree3NodesCount = 0;
                    if (getNodeDegree(b) == 3) {
                        degree3NodesCount++;
                    }
                    if (getNodeDegree(c) == 3) {
                        degree3NodesCount++;
                    }
                    if (getNodeDegree(d) == 3) {
                        degree3NodesCount++;
                    }
                    if (maxDegree3NodesCount == NONE || degree3NodesCount > maxDegree3NodesCount) {
                        maxDegree3NodesCount = degree3NodesCount;
                        optimalCycle.clear();
                        optimalCycle.push_back(graphTraversal.curNode);
                        optimalCycle.push_back(b);
                        optimalCycle.push_back(c);
                        optimalCycle.push_back(d);
                        if (maxDegree3NodesCount == 3) {
                            return true;
                        }
                    }
                }
            }
        }
        getNextNode(graphTraversal);
    }
    return maxDegree3NodesCount != NONE;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rsi, %rbx
movq %rdi, %r12
movq (%rsi), %rax
cmpq %rax, 0x8(%rsi)
je 0x4907
movq %rax, 0x8(%rbx)
leaq 0x18(%rsp), %r15
movq $-0x1, (%r15)
movq %r12, %rdi
movq %r15, %rsi
callq 0xb94a
cmpl $-0x1, (%r15)
je 0x4bfd
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
leaq 0x18(%rsp), %rsi
movq %r12, %rdi
movq %rsi, %r14
callq 0xc2d2
cmpl $0x4, %eax
jne 0x4994
xorps %xmm0, %xmm0
movaps %xmm0, 0x50(%rsp)
movq $0x0, 0x60(%rsp)
movl $0xffffffff, 0x30(%rsp) # imm = 0xFFFFFFFF
movq %r12, %rdi
movq %r14, %rsi
leaq 0x50(%rsp), %rdx
xorl %ecx, %ecx
leaq 0x30(%rsp), %r8
callq 0xc092
xorl %eax, %eax
movq 0x50(%rsp), %rcx
movl %eax, %edx
leaq 0x1469d(%rip), %rsi     # 0x19020
movslq (%rsi,%rdx,4), %rdx
addq %rsi, %rdx
movl $0x0, 0x2c(%rsp)
jmpq *%rdx
movq %r14, %rsi
jmp 0x4bdc
movl (%rcx), %edx
movl %edx, 0x10(%rsp)
movl 0x4(%rcx), %ecx
movl %ecx, 0xc(%rsp)
movq %rax, 0x20(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
movq $0x0, 0x40(%rsp)
movl $0x0, 0x14(%rsp)
movq %r12, %r14
movq %r12, %rdi
leaq 0x10(%rsp), %rsi
leaq 0xc(%rsp), %rdx
leaq 0x30(%rsp), %rcx
leaq 0x14(%rsp), %r8
callq 0x4c42
movq 0x30(%rsp), %r15
movq 0x38(%rsp), %rax
movb $0x1, %bpl
movq %rax, 0x70(%rsp)
cmpq %rax, %r15
je 0x4b53
movl (%r15), %eax
movl %eax, 0x14(%rsp)
cmpl 0x18(%rsp), %eax
je 0x4b32
movq %r14, %rdi
leaq 0x10(%rsp), %rsi
callq 0xc2d2
movl %eax, %ebp
movq %r14, %rdi
leaq 0x14(%rsp), %rsi
callq 0xc2d2
movl %eax, %r12d
movq %r14, %rdi
leaq 0xc(%rsp), %rsi
callq 0xc2d2
xorl %ecx, %ecx
cmpl $0x3, %ebp
sete %cl
leal 0x1(%rcx), %edx
cmpl $0x3, %r12d
cmovnel %ecx, %edx
xorl %ebp, %ebp
cmpl $0x3, %eax
sete %bpl
addl %edx, %ebp
cmpl $-0x1, %r13d
sete %al
cmpl %r13d, %ebp
seta %cl
orb %al, %cl
cmpb $0x1, %cl
jne 0x4b32
movq (%rbx), %rax
movq 0x8(%rbx), %rsi
cmpq %rax, %rsi
je 0x4a86
movq %rax, 0x8(%rbx)
movq %rax, %rsi
movq 0x10(%rbx), %rax
cmpq %rax, %rsi
je 0x4a9f
movl 0x18(%rsp), %ecx
movl %ecx, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rbx)
jmp 0x4ab4
movq %rbx, %rdi
leaq 0x18(%rsp), %rdx
callq 0xd7b4
movq 0x8(%rbx), %rsi
movq 0x10(%rbx), %rax
cmpq %rax, %rsi
je 0x4ac9
movl 0x10(%rsp), %ecx
movl %ecx, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rbx)
jmp 0x4ade
movq %rbx, %rdi
leaq 0x10(%rsp), %rdx
callq 0xd7b4
movq 0x8(%rbx), %rsi
movq 0x10(%rbx), %rax
cmpq %rax, %rsi
je 0x4af3
movl 0x14(%rsp), %ecx
movl %ecx, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rbx)
jmp 0x4b08
movq %rbx, %rdi
leaq 0x14(%rsp), %rdx
callq 0xd7b4
movq 0x8(%rbx), %rsi
movq 0x10(%rbx), %rax
cmpq %rax, %rsi
je 0x4b1d
movl 0xc(%rsp), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rbx)
jmp 0x4b2a
movq %rbx, %rdi
leaq 0xc(%rsp), %rdx
callq 0xd7b4
movl %ebp, %r13d
cmpl $0x3, %ebp
je 0x4b46
addq $0x4, %r15
cmpq 0x70(%rsp), %r15
jne 0x4a01
movb $0x1, %bpl
jmp 0x4b4e
movl $0x3, %r13d
xorl %ebp, %ebp
movq 0x30(%rsp), %r15
testq %r15, %r15
je 0x4b60
movq %r15, %rdi
callq 0x21a0
testb %bpl, %bpl
movq %r14, %r12
je 0x4bc1
movq 0x20(%rsp), %rcx
leal 0x1(%rcx), %eax
cmpl $0x5, %ecx
setae %cl
movl %ecx, 0x2c(%rsp)
cmpl $0x6, %eax
je 0x4bc1
movq 0x50(%rsp), %rcx
movl %eax, %edx
leaq 0x14493(%rip), %rsi     # 0x19020
movslq (%rsi,%rdx,4), %rdx
addq %rsi, %rdx
jmpq *%rdx
movl (%rcx), %edx
jmp 0x4ba2
movl 0x8(%rcx), %edx
jmp 0x4bb5
movl 0x4(%rcx), %edx
movl %edx, 0x10(%rsp)
movl 0x8(%rcx), %ecx
jmp 0x49a5
movl 0x4(%rcx), %edx
jmp 0x4bb5
movl (%rcx), %edx
movl %edx, 0x10(%rsp)
movl 0xc(%rcx), %ecx
jmp 0x49a5
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x4bd0
callq 0x21a0
testb $0x1, 0x2c(%rsp)
leaq 0x18(%rsp), %rsi
je 0x4c01
movq %r12, %rdi
callq 0xb94a
leaq 0x18(%rsp), %rsi
cmpl $-0x1, 0x18(%rsp)
jne 0x4933
cmpl $-0x1, %r13d
setne %al
jmp 0x4c03
xorl %eax, %eax
jmp 0x4c03
movb $0x1, %al
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x4c2b
jmp 0x4c19
movq %rax, %rbx
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x4c2b
callq 0x21a0
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x4c3a
callq 0x21a0
movq %rbx, %rdi
callq 0x2320