// File: /workspace/github_cpp_makefile_star2_O2/iPapatsoris[P]Maximum-Independent-Set/src/Graph.cpp
// Function: Graph::getNeighborsAtDistance2(unsigned int const&, std::unordered_set<unsigned int, std::hash<unsigned int>, std::equal_to<unsigned int>, std::allocator<unsigned int>>&, unsigned int const&, unsigned int*) const
void Graph::getNeighborsAtDistance2(const uint32_t &node, unordered_set<uint32_t> &neighbors, const uint32_t &degree, uint32_t *count) const {
    if (degree != NONE && count != NULL) {
        *count = 0;
    }
    uint32_t pos = (!mapping ? node : idToPos->at(node));
    uint32_t neighborCount = nodeIndex[pos].edges;
    uint32_t nextNodeOffset = (pos == nodeIndex.size()-1 ? edgeBuffer->size() : nodeIndex[pos+1].offset);
    for (uint32_t i = nodeIndex[pos].offset ; i < nextNodeOffset && neighborCount ; i++) {
        uint32_t nPos = (!mapping ? (*edgeBuffer)[i] : idToPos->at((*edgeBuffer)[i]));
        if (!nodeIndex[nPos].removed) {
            neighborCount--;
            uint32_t neighborCount2 = nodeIndex[nPos].edges;
            uint32_t nextNodeOffset2 = (nPos == nodeIndex.size()-1 ? edgeBuffer->size() : nodeIndex[nPos+1].offset);
            for (uint32_t j = nodeIndex[nPos].offset ; j < nextNodeOffset2 && neighborCount2 ; j++) {
                uint32_t id = (*edgeBuffer)[j];
                uint32_t nPos2 = (!mapping ? id : idToPos->at(id));
                if (!nodeIndex[nPos2].removed) {
                    neighborCount2--;
                    if (id != node && !edgeExists(id, node)) {
                        neighbors.insert(id);
                        if (degree != NONE && count != NULL && nodeIndex[nPos2].edges < degree) {
                            (*count)++;
                        }
                    }
                }
            }
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rcx, 0x38(%rsp)
movq %rdx, 0x40(%rsp)
movq %rsi, %r12
movq %rdi, %r13
movq %r8, 0x18(%rsp)
testq %r8, %r8
je 0x29a0
movq 0x38(%rsp), %rax
cmpl $-0x1, (%rax)
je 0x29a0
movq 0x18(%rsp), %rax
andl $0x0, (%rax)
cmpb $0x1, 0x3c(%r13)
movq %r12, %rax
jne 0x29b6
movq 0x40(%r13), %rdi
movq %r12, %rsi
callq 0xb880
movl (%rax), %r8d
movq (%r13), %rcx
movq 0x8(%r13), %rax
imulq $0xc, %r8, %rdi
leaq (%rcx,%rdi), %rsi
subq %rcx, %rax
pushq $0xc
popq %r9
cqto
idivq %r9
decq %rax
cmpq %r8, %rax
jne 0x29ee
movq 0x18(%r13), %rdx
movq 0x8(%rdx), %rax
subq (%rdx), %rax
shrq $0x2, %rax
jmp 0x29f8
incl %r8d
imulq $0xc, %r8, %rax
movl (%rcx,%rax), %eax
movl 0x4(%rcx,%rdi), %ebx
movl (%rsi), %r14d
movl %eax, %r15d
leaq 0x8(%rsp), %rsi
movq %r15, 0x28(%rsp)
movq %r12, 0x10(%rsp)
cmpq %r15, %r14
jae 0x2b9e
testl %ebx, %ebx
je 0x2b9e
cmpb $0x0, 0x3c(%r13)
je 0x2a48
movq 0x18(%r13), %rax
movq 0x40(%r13), %rdi
leaq (,%r14,4), %rsi
addq (%rax), %rsi
callq 0xb880
leaq 0x8(%rsp), %rsi
jmp 0x2a57
movq 0x18(%r13), %rcx
leaq (,%r14,4), %rax
addq (%rcx), %rax
movl (%rax), %edi
movq (%r13), %rcx
imulq $0xc, %rdi, %r9
cmpb $0x0, 0x8(%rcx,%r9)
jne 0x2b96
movq 0x8(%r13), %rax
subq %rcx, %rax
cqto
pushq $0xc
popq %r8
idivq %r8
decq %rax
cmpq %rdi, %rax
movq %r14, 0x30(%rsp)
jne 0x2a9b
movq 0x18(%r13), %rdx
movq 0x8(%rdx), %rax
subq (%rdx), %rax
shrq $0x2, %rax
jmp 0x2aa4
incl %edi
imulq $0xc, %rdi, %rax
movl (%rcx,%rax), %eax
addq %r9, %rcx
decl %ebx
movl %ebx, 0xc(%rsp)
movl 0x4(%rcx), %ebx
movl (%rcx), %r15d
movl %eax, %r14d
movq %r14, 0x20(%rsp)
cmpq %r14, %r15
jae 0x2b88
testl %ebx, %ebx
je 0x2b88
movq 0x18(%r13), %rax
movq (%rax), %rax
movl (%rax,%r15,4), %eax
movl %eax, 0x8(%rsp)
cmpb $0x1, 0x3c(%r13)
jne 0x2af2
movq 0x40(%r13), %rdi
callq 0xb880
leaq 0x8(%rsp), %rsi
movl (%rax), %eax
movl %eax, %eax
movq (%r13), %rcx
imulq $0xc, %rax, %rbp
cmpb $0x0, 0x8(%rcx,%rbp)
jne 0x2b80
decl %ebx
movl 0x8(%rsp), %eax
cmpl (%r12), %eax
je 0x2b80
movq %r13, %rdi
movq %r12, %rdx
movq %rsi, %r14
callq 0x9e3a
testb %al, %al
je 0x2b26
movq %r14, %rsi
jmp 0x2b7b
cmpq $0x0, 0x18(%rsp)
sete %r12b
movq 0x40(%rsp), %rdi
movq %r14, %rsi
callq 0xbc1a
movq 0x38(%rsp), %rax
movl (%rax), %eax
cmpl $-0x1, %eax
sete %cl
orb %r12b, %cl
jne 0x2b71
movq (%r13), %rcx
cmpl %eax, 0x4(%rcx,%rbp)
movq 0x20(%rsp), %r14
jae 0x2b65
movq 0x18(%rsp), %rax
incl (%rax)
movq 0x10(%rsp), %r12
leaq 0x8(%rsp), %rsi
jmp 0x2b80
movq 0x10(%rsp), %r12
leaq 0x8(%rsp), %rsi
movq 0x20(%rsp), %r14
incq %r15
jmp 0x2abb
movl 0xc(%rsp), %ebx
movq 0x30(%rsp), %r14
movq 0x28(%rsp), %r15
incq %r14
jmp 0x2a11
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop