// File: /workspace/github_cpp_makefile_star2_O3/iPapatsoris[P]Maximum-Independent-Set/src/Graph.cpp
// Function: Graph::getOptimalShortEdge(unsigned int const&, unsigned int&, unsigned int&, std::vector<unsigned int, std::allocator<unsigned int>>&) const
void Graph::getOptimalShortEdge(const uint32_t &degree, uint32_t &finalNode1, uint32_t &finalNode2, vector<uint32_t> &finalContainer) const {
    finalNode1 = NONE;
    finalNode2 = NONE;
    vector<uint32_t> commonNeighbors;
    bool done = false;
    for (uint32_t pos = 0 ; pos < nodeIndex.size() && !done ; pos++) {
        if (nodeIndex[pos].removed) {
            continue;
        }
        if (nodeIndex[pos].edges == degree) {
            uint32_t neighborCount = degree;
            uint32_t nextNodeOffset = (pos == nodeIndex.size()-1 ? edgeBuffer->size() : nodeIndex[pos+1].offset);
            for (uint32_t offset = nodeIndex[pos].offset ; offset < nextNodeOffset && neighborCount; offset++) {
                uint32_t nPos = (!mapping ? (*edgeBuffer)[offset] : idToPos->at((*edgeBuffer)[offset]));
                if (nodeIndex[nPos].removed) {
                    continue;
                }
                neighborCount--;
                if (nodeIndex[nPos].edges == degree || (degree == 6 && nodeIndex[nPos].edges == 5)) {
                    uint32_t node1 = (!mapping ? pos : posToId->at(pos));
                    uint32_t node2 = (!mapping ? nPos : posToId->at(nPos));
                    if (node1 < node2) {
                        getCommonNeighbors(node1, node2, commonNeighbors);
                        if ((degree == 6 && commonNeighbors.size() >= 3 || (degree == 7 || degree == 8) && commonNeighbors.size() >= 4) &&
                        commonNeighbors.size() > finalContainer.size()) {
                            finalContainer.clear();
                            finalContainer.insert(finalContainer.end(), commonNeighbors.begin(), commonNeighbors.end());
                            finalNode1 = node1;
                            finalNode2 = node2;
                            if (finalContainer.size() == degree - 1) {
                                done = true;
                                break;
                            }
                        }
                        commonNeighbors.clear();
                    }
                }
            }
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %r8, 0x30(%rsp)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movq %rdx, 0x40(%rsp)
movl %eax, (%rdx)
movq %rcx, 0x48(%rsp)
movl %eax, (%rcx)
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
movq (%rdi), %rax
movq 0x8(%rdi), %rcx
subq %rax, %rcx
je 0x6c37
movq %rsi, %rbx
movq %rdi, %r13
sarq $0x2, %rcx
movabsq $-0x5555555555555555, %rdx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rdx, %rcx
xorl %ebp, %ebp
movq %rsi, 0x38(%rsp)
leaq (,%rbp,2), %rdx
addq %rbp, %rdx
cmpb $0x0, 0x8(%rax,%rdx,4)
jne 0x6bf4
leaq (%rax,%rdx,4), %rdx
movl 0x4(%rdx), %r15d
cmpl (%rbx), %r15d
jne 0x6bf4
decq %rcx
cmpq %rbp, %rcx
jne 0x6a1a
movq 0x18(%r13), %rcx
movq 0x8(%rcx), %rax
subq (%rcx), %rax
shrq $0x2, %rax
jmp 0x6a24
leal 0x1(%rbp), %ecx
leaq (%rcx,%rcx,2), %rcx
movl (%rax,%rcx,4), %eax
movl (%rdx), %r14d
cmpl %eax, %r14d
setae %cl
testl %r15d, %r15d
sete %dl
orb %cl, %dl
jne 0x6bf4
movl %eax, %eax
movq %rax, 0x50(%rsp)
leaq (,%r14,4), %r12
incq %r14
cmpb $0x0, 0x3c(%r13)
je 0x6a76
movq 0x18(%r13), %rax
movq 0x40(%r13), %rdi
movq (%rax), %rsi
addq %r12, %rsi
callq 0xd37a
testq %rax, %rax
je 0x6c46
addq $0xc, %rax
jmp 0x6a80
movq 0x18(%r13), %rax
movq (%rax), %rax
addq %r12, %rax
movl (%rax), %esi
movq (%r13), %rax
leaq (%rsi,%rsi,2), %rcx
cmpb $0x0, 0x8(%rax,%rcx,4)
jne 0x6bd9
leaq (%rax,%rcx,4), %rax
decl %r15d
movl 0x4(%rax), %eax
movl (%rbx), %ecx
cmpl %ecx, %eax
je 0x6ab3
xorl $0x6, %ecx
xorl $0x5, %eax
orl %ecx, %eax
jne 0x6bd9
cmpb $0x1, 0x3c(%r13)
jne 0x6aea
movq 0x48(%r13), %rcx
movq (%rcx), %rax
movq 0x8(%rcx), %rdx
subq %rax, %rdx
sarq $0x2, %rdx
cmpq %rbp, %rdx
jbe 0x6c52
movl (%rax,%rbp,4), %ecx
movl %ecx, 0x8(%rsp)
cmpq %rsi, %rdx
jbe 0x6c63
movl (%rax,%rsi,4), %esi
jmp 0x6af0
movl %ebp, 0x8(%rsp)
movl %ebp, %ecx
movl %esi, 0xc(%rsp)
cmpl %esi, %ecx
jae 0x6bd9
movl $0x0, 0x2c(%rsp)
movq %r13, %rdi
leaq 0x8(%rsp), %rsi
leaq 0xc(%rsp), %rdx
leaq 0x10(%rsp), %rcx
leaq 0x2c(%rsp), %r8
callq 0x4c42
movl (%rbx), %eax
cmpl $0x6, %eax
jne 0x6b42
movq 0x10(%rsp), %rdx
movq 0x18(%rsp), %rcx
movq %rcx, %rax
subq %rdx, %rax
cmpq $0x8, %rax
ja 0x6b60
jmp 0x6bcf
addl $-0x7, %eax
movq 0x10(%rsp), %rdx
movq 0x18(%rsp), %rcx
cmpl $0x1, %eax
ja 0x6bcf
movq %rcx, %rax
subq %rdx, %rax
cmpq $0xd, %rax
jb 0x6bcf
movq 0x30(%rsp), %rdi
movq (%rdi), %rsi
movq 0x8(%rdi), %r8
movq %r8, %r9
subq %rsi, %r9
cmpq %r9, %rax
jbe 0x6bcf
cmpq %rsi, %r8
movq 0x30(%rsp), %rbx
je 0x6b88
movq %rsi, 0x8(%rbx)
xorl %r9d, %r9d
addq %r9, %rsi
movq %rbx, %rdi
callq 0xe46c
movq (%rbx), %rax
movl 0x8(%rsp), %ecx
movq 0x40(%rsp), %rdx
movl %ecx, (%rdx)
movl 0xc(%rsp), %ecx
movq 0x48(%rsp), %rdx
movl %ecx, (%rdx)
movq 0x8(%rbx), %rcx
subq %rax, %rcx
sarq $0x2, %rcx
movq 0x38(%rsp), %rbx
movl (%rbx), %eax
decl %eax
cmpq %rax, %rcx
je 0x6c24
movq 0x10(%rsp), %rdx
movq 0x18(%rsp), %rcx
cmpq %rdx, %rcx
je 0x6bd9
movq %rdx, 0x18(%rsp)
xorl %edx, %edx
cmpq 0x50(%rsp), %r14
jae 0x6bf6
addq $0x4, %r12
incq %r14
testl %r15d, %r15d
jne 0x6a4d
jmp 0x6bf6
xorl %edx, %edx
incl %ebp
movq (%r13), %rax
movq 0x8(%r13), %rcx
subq %rax, %rcx
sarq $0x2, %rcx
movabsq $-0x5555555555555555, %rsi # imm = 0xAAAAAAAAAAAAAAAB
imulq %rsi, %rcx
cmpq %rbp, %rcx
jbe 0x6c28
testb %dl, %dl
je 0x69da
jmp 0x6c28
movb $0x1, %dl
jmp 0x6bf6
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x6c37
callq 0x21a0
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x12b83(%rip), %rdi     # 0x197d0
callq 0x2280
leaq 0x12b85(%rip), %rdi     # 0x197de
movq %rbp, %rsi
xorl %eax, %eax
callq 0x22a0
leaq 0x12b74(%rip), %rdi     # 0x197de
xorl %eax, %eax
callq 0x22a0
jmp 0x6c7b
jmp 0x6c7b
jmp 0x6c7b
jmp 0x6c7b
jmp 0x6c7b
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x6c8d
callq 0x21a0
movq %rbx, %rdi
callq 0x2320
nop