// File: /workspace/github_cpp_makefile_star2_O3/iPapatsoris[P]Maximum-Independent-Set/src/Graph.cpp
// Function: Graph::getNextNodeWithIdenticalNeighbors(unsigned int const&, std::vector<unsigned int, std::allocator<unsigned int>> const&) const
uint32_t Graph::getNextNodeWithIdenticalNeighbors(const uint32_t &previousNode, const vector<uint32_t> &neighbors) const {
    uint32_t pos = (!mapping ? previousNode : idToPos->at(previousNode));
    for (pos = pos+1 ; pos < nodeIndex.size() ; pos++) {
        if (!nodeIndex[pos].removed && nodeIndex[pos].edges == neighbors.size()) {
            uint32_t neighborCount = neighbors.size();
            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 && find(neighbors.begin(), neighbors.end(), (*edgeBuffer)[offset]) != neighbors.end()) {
                    neighborCount--;
                }
            }
            if (!neighborCount) {
                return (!mapping ? pos : posToId->at(pos));
            }
        }
    }
    return NONE;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %r14
movq %rdi, %rbx
cmpb $0x1, 0x3c(%rdi)
jne 0x3cb1
movq 0x40(%rbx), %rdi
callq 0xd37a
testq %rax, %rax
je 0x3e4b
movq %rax, %rsi
addq $0xc, %rsi
movl (%rsi), %r9d
leal 0x1(%r9), %r10d
movq (%rbx), %rax
movq 0x8(%rbx), %rcx
movq %rcx, %rdx
subq %rax, %rdx
sarq $0x2, %rdx
movabsq $-0x5555555555555555, %r11 # imm = 0xAAAAAAAAAAAAAAAB
imulq %r11, %rdx
cmpq %r10, %rdx
jbe 0x3e0b
movl %r9d, %edi
movl %r10d, %r9d
leaq (%r10,%r10,2), %rsi
cmpb $0x0, 0x8(%rax,%rsi,4)
jne 0x3df8
leaq (%rax,%rsi,4), %rsi
movl 0x4(%rsi), %ebp
movq 0x8(%r14), %r8
subq (%r14), %r8
sarq $0x2, %r8
cmpq %rbp, %r8
jne 0x3df8
decq %rdx
cmpq %r10, %rdx
movq %r9, 0x8(%rsp)
movq %r10, 0x10(%rsp)
jne 0x3d33
movq 0x18(%rbx), %rcx
movq 0x8(%rcx), %rax
subq (%rcx), %rax
shrq $0x2, %rax
jmp 0x3d3d
addl $0x2, %edi
leaq (%rdi,%rdi,2), %rcx
movl (%rax,%rcx,4), %eax
movl (%rsi), %r13d
cmpl %eax, %r13d
setae %dl
testl %ebp, %ebp
setne %cl
sete %sil
orb %dl, %sil
jne 0x3dde
movl %eax, %r15d
leaq (,%r13,4), %r12
incq %r13
cmpb $0x0, 0x3c(%rbx)
je 0x3d8e
movq 0x18(%rbx), %rax
movq 0x40(%rbx), %rdi
movq (%rax), %rsi
addq %r12, %rsi
callq 0xd37a
testq %rax, %rax
je 0x3e4b
addq $0xc, %rax
jmp 0x3d98
movq 0x18(%rbx), %rax
movq (%rax), %rax
addq %r12, %rax
movl (%rax), %eax
movq (%rbx), %rcx
leaq (%rax,%rax,2), %rax
cmpb $0x0, 0x8(%rcx,%rax,4)
jne 0x3dc9
movq (%r14), %rdi
movq 0x8(%r14), %rsi
movq 0x18(%rbx), %rax
movq (%rax), %rdx
addq %r12, %rdx
callq 0xdd05
xorl %ecx, %ecx
cmpq 0x8(%r14), %rax
setne %cl
subl %ecx, %ebp
testl %ebp, %ebp
setne %cl
cmpq %r15, %r13
jae 0x3dde
addq $0x4, %r12
incq %r13
testl %ebp, %ebp
jne 0x3d66
testb %cl, %cl
je 0x3e1f
movq (%rbx), %rax
movq 0x8(%rbx), %rcx
movq 0x8(%rsp), %r9
movabsq $-0x5555555555555555, %r11 # imm = 0xAAAAAAAAAAAAAAAB
leal 0x1(%r9), %r10d
movq %rcx, %rdx
subq %rax, %rdx
sarq $0x2, %rdx
jmp 0x3cd3
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpb $0x1, 0x3c(%rbx)
movq 0x8(%rsp), %rax
jne 0x3e10
movq 0x48(%rbx), %rcx
movq (%rcx), %rax
movq 0x8(%rcx), %rdx
subq %rax, %rdx
sarq $0x2, %rdx
movq 0x10(%rsp), %rsi
cmpq %rsi, %rdx
jbe 0x3e57
movl (%rax,%rsi,4), %eax
jmp 0x3e10
leaq 0x1597e(%rip), %rdi     # 0x197d0
callq 0x2280
leaq 0x15980(%rip), %rdi     # 0x197de
xorl %eax, %eax
callq 0x22a0
nop