// File: iPapatsoris[P]Maximum-Independent-Set/src/Graph.cpp
// Function: Graph::getCommonNeighbors(unsigned int const&, unsigned int const&, std::vector<unsigned int, std::allocator<unsigned int>>&, unsigned int const&) const
void Graph::getCommonNeighbors(const uint32_t &node1, const uint32_t &node2, vector<uint32_t> &commonNeighbors, const uint32_t &atLeast) const {
    uint32_t pos1 = (!mapping ? node1 : idToPos->at(node1));
    uint32_t pos2 = (!mapping ? node2 : idToPos->at(node2));
    assert(!nodeIndex[pos1].removed && !nodeIndex[pos2].removed);
    uint32_t count = 0;
    vector<uint32_t> neighbors1;
    gatherNeighbors(node1, neighbors1);
    for (auto &neighbor: neighbors1) {
        if (edgeExists(neighbor, node2)) {
            commonNeighbors.push_back(neighbor);
            if (atLeast && ++count == atLeast) {
                return;
            }
        }
    }
}

// Assembly:
subq $0xb8, %rsp
movq %rdi, 0xb0(%rsp)
movq %rsi, 0xa8(%rsp)
movq %rdx, 0xa0(%rsp)
movq %rcx, 0x98(%rsp)
movq %r8, 0x90(%rsp)
movq 0xb0(%rsp), %rax
movq %rax, 0x20(%rsp)
testb $0x1, 0x3c(%rax)
jne 0x6302
movq 0xa8(%rsp), %rax
movl (%rax), %eax
movl %eax, 0x1c(%rsp)
jmp 0x631e
movq 0x20(%rsp), %rax
movq 0x40(%rax), %rdi
movq 0xa8(%rsp), %rsi
callq 0x188b0
movl (%rax), %eax
movl %eax, 0x1c(%rsp)
movq 0x20(%rsp), %rax
movl 0x1c(%rsp), %ecx
movl %ecx, 0x8c(%rsp)
testb $0x1, 0x3c(%rax)
jne 0x6344
movq 0xa0(%rsp), %rax
movl (%rax), %eax
movl %eax, 0x18(%rsp)
jmp 0x6360
movq 0x20(%rsp), %rax
movq 0x40(%rax), %rdi
movq 0xa0(%rsp), %rsi
callq 0x188b0
movl (%rax), %eax
movl %eax, 0x18(%rsp)
movq 0x20(%rsp), %rdi
movl 0x18(%rsp), %eax
movl %eax, 0x88(%rsp)
movl 0x8c(%rsp), %eax
movl %eax, %esi
callq 0x18850
movq %rax, %rcx
xorl %eax, %eax
testb $0x1, 0x8(%rcx)
movb %al, 0x17(%rsp)
jne 0x63a9
movq 0x20(%rsp), %rdi
movl 0x88(%rsp), %eax
movl %eax, %esi
callq 0x18850
movb 0x8(%rax), %al
xorb $-0x1, %al
movb %al, 0x17(%rsp)
movb 0x17(%rsp), %al
testb $0x1, %al
jne 0x63b3
jmp 0x63b5
jmp 0x63d4
leaq 0x3fe00(%rip), %rdi     # 0x461bc
leaq 0x3fc77(%rip), %rsi     # 0x4603a
movl $0x463, %edx            # imm = 0x463
leaq 0x3fe22(%rip), %rcx     # 0x461f1
callq 0x2110
movl $0x0, 0x84(%rsp)
leaq 0x68(%rsp), %rdi
movq %rdi, 0x8(%rsp)
callq 0x17e60
movq 0x20(%rsp), %rdi
movq 0x8(%rsp), %rdx
movq 0xa8(%rsp), %rsi
movl $0xffffffff, 0x64(%rsp) # imm = 0xFFFFFFFF
xorl %eax, %eax
movl %eax, %ecx
leaq 0x64(%rsp), %r8
callq 0x19c30
jmp 0x6418
leaq 0x68(%rsp), %rax
movq %rax, 0x48(%rsp)
movq 0x48(%rsp), %rdi
callq 0x19b50
movq %rax, 0x40(%rsp)
movq 0x48(%rsp), %rdi
callq 0x1a0e0
movq %rax, 0x38(%rsp)
leaq 0x40(%rsp), %rdi
leaq 0x38(%rsp), %rsi
callq 0x1a110
testb $0x1, %al
jne 0x6458
jmp 0x6503
leaq 0x40(%rsp), %rdi
callq 0x1a150
movq 0x20(%rsp), %rdi
movq %rax, 0x30(%rsp)
movq 0x30(%rsp), %rsi
movq 0xa0(%rsp), %rdx
callq 0x18920
movb %al, 0x7(%rsp)
jmp 0x6484
movb 0x7(%rsp), %al
testb $0x1, %al
jne 0x648e
jmp 0x64f2
movq 0x98(%rsp), %rdi
movq 0x30(%rsp), %rsi
callq 0x19070
jmp 0x64a2
movq 0x90(%rsp), %rax
cmpl $0x0, (%rax)
je 0x64f0
movl 0x84(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x84(%rsp)
movq 0x90(%rsp), %rcx
cmpl (%rcx), %eax
jne 0x64f0
movl $0x1, 0x2c(%rsp)
jmp 0x650b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x58(%rsp)
movl %eax, 0x54(%rsp)
leaq 0x68(%rsp), %rdi
callq 0x18520
jmp 0x651d
jmp 0x64f2
jmp 0x64f4
leaq 0x40(%rsp), %rdi
callq 0x1a160
jmp 0x6440
movl $0x0, 0x2c(%rsp)
leaq 0x68(%rsp), %rdi
callq 0x18520
addq $0xb8, %rsp
retq
movq 0x58(%rsp), %rdi
callq 0x2310
nopw (%rax,%rax)