// File: iPapatsoris[P]Maximum-Independent-Set/src/Graph.cpp
// Function: Graph::getNumberOfDegreeNeighbors(unsigned int const&, unsigned int const&, unsigned int const&) const
uint32_t Graph::getNumberOfDegreeNeighbors(const uint32_t &node, const uint32_t &degree, const uint32_t &atLeast) const {
    uint32_t 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--;
            if (nodeIndex[nPos].edges == degree) {
                count++;
                if (atLeast && count == atLeast) {
                    break;
                }
            }
        }
    }
    return count;
}

// Assembly:
subq $0x68, %rsp
movq %rdi, 0x60(%rsp)
movq %rsi, 0x58(%rsp)
movq %rdx, 0x50(%rsp)
movq %rcx, 0x48(%rsp)
movq 0x60(%rsp), %rax
movq %rax, 0x28(%rsp)
movl $0x0, 0x44(%rsp)
testb $0x1, 0x3c(%rax)
jne 0x2d7d
movq 0x58(%rsp), %rax
movl (%rax), %eax
movl %eax, 0x24(%rsp)
jmp 0x2d96
movq 0x28(%rsp), %rax
movq 0x40(%rax), %rdi
movq 0x58(%rsp), %rsi
callq 0x188b0
movl (%rax), %eax
movl %eax, 0x24(%rsp)
movq 0x28(%rsp), %rdi
movl 0x24(%rsp), %eax
movl %eax, 0x40(%rsp)
movl 0x40(%rsp), %eax
movl %eax, %esi
callq 0x18850
movq 0x28(%rsp), %rdi
movl 0x4(%rax), %eax
movl %eax, 0x3c(%rsp)
movl 0x40(%rsp), %eax
movq %rax, 0x18(%rsp)
callq 0x18830
movq %rax, %rcx
movq 0x18(%rsp), %rax
subq $0x1, %rcx
cmpq %rcx, %rax
jne 0x2dee
movq 0x28(%rsp), %rax
movq 0x18(%rax), %rdi
callq 0x188e0
movq %rax, 0x10(%rsp)
jmp 0x2e0a
movq 0x28(%rsp), %rdi
movl 0x40(%rsp), %eax
addl $0x1, %eax
movl %eax, %eax
movl %eax, %esi
callq 0x18850
movl (%rax), %eax
movq %rax, 0x10(%rsp)
movq 0x28(%rsp), %rdi
movq 0x10(%rsp), %rax
movl %eax, 0x38(%rsp)
movl 0x40(%rsp), %eax
movl %eax, %esi
callq 0x18850
movl (%rax), %eax
movl %eax, 0x34(%rsp)
movl 0x34(%rsp), %ecx
xorl %eax, %eax
cmpl 0x38(%rsp), %ecx
movb %al, 0xf(%rsp)
jae 0x2e45
cmpl $0x0, 0x3c(%rsp)
setne %al
movb %al, 0xf(%rsp)
movb 0xf(%rsp), %al
testb $0x1, %al
jne 0x2e52
jmp 0x2f26
movq 0x28(%rsp), %rax
testb $0x1, 0x3c(%rax)
jne 0x2e79
movq 0x28(%rsp), %rax
movq 0x18(%rax), %rdi
movl 0x34(%rsp), %eax
movl %eax, %esi
callq 0x18900
movl (%rax), %eax
movl %eax, 0x8(%rsp)
jmp 0x2ea7
movq 0x28(%rsp), %rax
movq 0x40(%rax), %rcx
movq %rcx, (%rsp)
movq 0x18(%rax), %rdi
movl 0x34(%rsp), %eax
movl %eax, %esi
callq 0x18900
movq (%rsp), %rdi
movq %rax, %rsi
callq 0x188b0
movl (%rax), %eax
movl %eax, 0x8(%rsp)
movq 0x28(%rsp), %rdi
movl 0x8(%rsp), %eax
movl %eax, 0x30(%rsp)
movl 0x30(%rsp), %eax
movl %eax, %esi
callq 0x18850
testb $0x1, 0x8(%rax)
jne 0x2f14
movq 0x28(%rsp), %rdi
movl 0x3c(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x3c(%rsp)
movl 0x30(%rsp), %eax
movl %eax, %esi
callq 0x18850
movl 0x4(%rax), %eax
movq 0x50(%rsp), %rcx
cmpl (%rcx), %eax
jne 0x2f12
movl 0x44(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x44(%rsp)
movq 0x48(%rsp), %rax
cmpl $0x0, (%rax)
je 0x2f10
movl 0x44(%rsp), %eax
movq 0x48(%rsp), %rcx
cmpl (%rcx), %eax
jne 0x2f10
jmp 0x2f26
jmp 0x2f12
jmp 0x2f14
jmp 0x2f16
movl 0x34(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x34(%rsp)
jmp 0x2e29
movl 0x44(%rsp), %eax
addq $0x68, %rsp
retq
nop