// File: /workspace/github_cpp_makefile_star2_O1/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, 0x30(%rsp)
movq %rdx, 0x38(%rsp)
movq %rsi, %rbx
movq %rdi, %r13
movq %r8, 0x20(%rsp)
testq %r8, %r8
je 0x2cc1
movq 0x30(%rsp), %rax
cmpl $-0x1, (%rax)
je 0x2cc1
movq 0x20(%rsp), %rax
movl $0x0, (%rax)
cmpb $0x1, 0x3c(%r13)
movq %rbx, %rax
jne 0x2cd7
movq 0x40(%r13), %rdi
movq %rbx, %rsi
callq 0xda16
movl (%rax), %ecx
movq (%r13), %rdx
movq 0x8(%r13), %rsi
leaq (%rcx,%rcx,2), %rax
leaq (%rdx,%rax,4), %rax
movl 0x4(%rax), %ebp
subq %rdx, %rsi
sarq $0x2, %rsi
movabsq $-0x5555555555555555, %rdi # imm = 0xAAAAAAAAAAAAAAAB
imulq %rdi, %rsi
decq %rsi
cmpq %rcx, %rsi
jne 0x2d1a
movq 0x18(%r13), %rdx
movq 0x8(%rdx), %rcx
subq (%rdx), %rcx
shrq $0x2, %rcx
jmp 0x2d23
incl %ecx
leaq (%rcx,%rcx,2), %rcx
movl (%rdx,%rcx,4), %ecx
movl (%rax), %r14d
cmpl %ecx, %r14d
setb %al
testl %ebp, %ebp
setne %dl
andb %al, %dl
cmpb $0x1, %dl
jne 0x2ef0
movl %ecx, %r15d
movq %rsp, %rsi
movq %r15, 0x8(%rsp)
movq %rbx, 0x10(%rsp)
cmpb $0x0, 0x3c(%r13)
je 0x2d70
movq 0x18(%r13), %rax
movq 0x40(%r13), %rdi
leaq (,%r14,4), %rsi
addq (%rax), %rsi
callq 0xda16
movq %rsp, %rsi
jmp 0x2d7f
movq 0x18(%r13), %rcx
leaq (,%r14,4), %rax
addq (%rcx), %rax
movl (%rax), %edx
movq (%r13), %rax
leaq (%rdx,%rdx,2), %rcx
cmpb $0x0, 0x8(%rax,%rcx,4)
jne 0x2ee0
movq 0x8(%r13), %r8
subq %rax, %r8
sarq $0x2, %r8
movabsq $-0x5555555555555555, %rdi # imm = 0xAAAAAAAAAAAAAAAB
imulq %rdi, %r8
decq %r8
cmpq %rdx, %r8
movq %r14, 0x18(%rsp)
jne 0x2dcb
movq 0x18(%r13), %rdi
movq 0x8(%rdi), %rdx
subq (%rdi), %rdx
shrq $0x2, %rdx
jmp 0x2dd4
incl %edx
leaq (%rdx,%rdx,2), %rdx
movl (%rax,%rdx,4), %edx
leaq (%rax,%rcx,4), %rax
decl %ebp
movl 0x4(%rax), %r15d
movl (%rax), %r14d
cmpl %edx, %r14d
setb %al
testl %r15d, %r15d
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x2ed6
movl %ebp, 0x4(%rsp)
movl %edx, %ebp
incq %r14
movq %rbp, 0x28(%rsp)
movq 0x18(%r13), %rax
movq (%rax), %rax
movl -0x4(%rax,%r14,4), %eax
movl %eax, (%rsp)
cmpb $0x1, 0x3c(%r13)
jne 0x2e2a
movq 0x40(%r13), %rdi
callq 0xda16
movq %rsp, %rsi
movl (%rax), %eax
movl %eax, %eax
movq (%r13), %rcx
leaq (%rax,%rax,2), %r12
cmpb $0x0, 0x8(%rcx,%r12,4)
jne 0x2ec1
decl %r15d
movl (%rsp), %eax
cmpl (%rbx), %eax
je 0x2ec1
movq %r13, %rdi
movq %rbx, %rdx
movq %rsi, %rbp
callq 0xc5e2
cmpl $-0x1, %eax
je 0x2e62
movq %rbp, %rsi
jmp 0x2ebc
cmpq $0x0, 0x20(%rsp)
sete %bl
movq 0x38(%rsp), %rdi
movq %rdi, 0x40(%rsp)
movq %rbp, %rsi
leaq 0x40(%rsp), %rdx
callq 0xdc3e
movq 0x30(%rsp), %rax
movl (%rax), %eax
cmpl $-0x1, %eax
sete %cl
orb %bl, %cl
jne 0x2eb4
movq (%r13), %rcx
cmpl %eax, 0x4(%rcx,%r12,4)
movq 0x28(%rsp), %rbp
jae 0x2eaa
movq 0x20(%rsp), %rax
incl (%rax)
movq 0x10(%rsp), %rbx
movq %rsp, %rsi
jmp 0x2ec1
movq 0x10(%rsp), %rbx
movq %rsp, %rsi
movq 0x28(%rsp), %rbp
cmpq %rbp, %r14
jae 0x2ed2
incq %r14
testl %r15d, %r15d
jne 0x2e06
movl 0x4(%rsp), %ebp
movq 0x18(%rsp), %r14
movq 0x8(%rsp), %r15
incq %r14
cmpq %r15, %r14
jae 0x2ef0
testl %ebp, %ebp
jne 0x2d4c
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop