// File: /workspace/github_cpp_makefile_star2_O1/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 $0x28, %rsp
movq %rdx, 0x10(%rsp)
movq %rdi, %r14
cmpb $0x1, 0x3c(%rdi)
jne 0x3c4c
movq 0x40(%r14), %rdi
callq 0xda16
movq %rax, %rsi
movl (%rsi), %r9d
leal 0x1(%r9), %r11d
movq (%r14), %rax
movq 0x8(%r14), %rcx
subq %rax, %rcx
sarq $0x2, %rcx
movabsq $-0x5555555555555555, %r10 # imm = 0xAAAAAAAAAAAAAAAB
imulq %r10, %rcx
cmpq %r11, %rcx
jbe 0x3dcf
movq 0x10(%rsp), %r15
movl %r9d, %esi
movl %r11d, %r9d
leaq (%r11,%r11,2), %rdx
cmpb $0x0, 0x8(%rax,%rdx,4)
jne 0x3db0
leaq (%rax,%rdx,4), %rdx
movl 0x4(%rdx), %edi
movq 0x10(%rsp), %r8
movq 0x8(%r8), %rbp
subq (%r8), %rbp
sarq $0x2, %rbp
cmpq %rdi, %rbp
jne 0x3db0
decq %rcx
cmpq %r11, %rcx
movq %r9, 0x20(%rsp)
movq %r11, 0x18(%rsp)
jne 0x3cd5
movq 0x18(%r14), %rax
movq 0x8(%rax), %rcx
subq (%rax), %rcx
shrq $0x2, %rcx
jmp 0x3cdf
addl $0x2, %esi
leaq (%rsi,%rsi,2), %rcx
movl (%rax,%rcx,4), %ecx
movl (%rdx), %r13d
testl %ebp, %ebp
setne %al
cmpl %ecx, %r13d
jae 0x3d6a
testl %ebp, %ebp
je 0x3d6a
movl %ecx, %r12d
leaq (,%r13,4), %rbx
incq %r13
cmpb $0x0, 0x3c(%r14)
je 0x3d1a
movq 0x18(%r14), %rax
movq 0x40(%r14), %rdi
movq (%rax), %rsi
addq %rbx, %rsi
callq 0xda16
jmp 0x3d24
movq 0x18(%r14), %rax
movq (%rax), %rax
addq %rbx, %rax
movl (%rax), %eax
movq (%r14), %rcx
leaq (%rax,%rax,2), %rax
cmpb $0x0, 0x8(%rcx,%rax,4)
jne 0x3d55
movq (%r15), %rdi
movq 0x8(%r15), %rsi
movq 0x18(%r14), %rax
movq (%rax), %rdx
addq %rbx, %rdx
callq 0xe3b1
xorl %ecx, %ecx
cmpq 0x8(%r15), %rax
setne %cl
subl %ecx, %ebp
testl %ebp, %ebp
setne %al
cmpq %r12, %r13
jae 0x3d6a
addq $0x4, %rbx
incq %r13
testl %ebp, %ebp
jne 0x3cfe
testb %al, %al
movq 0x20(%rsp), %r9
movabsq $-0x5555555555555555, %r10 # imm = 0xAAAAAAAAAAAAAAAB
jne 0x3dac
cmpb $0x1, 0x3c(%r14)
movl %r9d, 0xc(%rsp)
jne 0x3dac
movq 0x48(%r14), %rdx
movq (%rdx), %rcx
movq 0x8(%rdx), %rdx
subq %rcx, %rdx
sarq $0x2, %rdx
movq 0x18(%rsp), %rsi
cmpq %rsi, %rdx
jbe 0x3dea
movl (%rcx,%rsi,4), %ecx
movl %ecx, 0xc(%rsp)
testb %al, %al
je 0x3dd7
leal 0x1(%r9), %r11d
movq (%r14), %rax
movq 0x8(%r14), %rcx
subq %rax, %rcx
sarq $0x2, %rcx
imulq %r10, %rcx
cmpq %r11, %rcx
ja 0x3c7d
movl $0xffffffff, 0xc(%rsp)  # imm = 0xFFFFFFFF
movl 0xc(%rsp), %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x169ed(%rip), %rdi     # 0x1a7de
xorl %eax, %eax
callq 0x22a0