// File: iPapatsoris[P]Maximum-Independent-Set/src/Graph.hpp
// Function: Graph::findEdgeOffset(unsigned int const&, unsigned int const&) const
uint32_t findEdgeOffset(const uint32_t &node, const uint32_t &neighbor) const {
        uint32_t pos = (!mapping ? node : idToPos->at(node));
        uint32_t nPos = (!mapping ? neighbor : idToPos->at(neighbor));
        assert(!nodeIndex[pos].removed && !nodeIndex[nPos].removed);
        uint32_t offset = nodeIndex[pos].offset;
        uint32_t endOffset = (pos == nodeIndex.size()-1 ? edgeBuffer->size() - 1 : nodeIndex[pos+1].offset - 1);
        if (offset == endOffset+1) {
            return NONE;
        }
        uint32_t startIndex = 0;
        uint32_t endIndex = endOffset - offset;
        uint32_t index = (endIndex - startIndex) / 2;
        while (startIndex != endIndex) {
            if ((*edgeBuffer)[offset + startIndex + index] == neighbor) {
                return offset + startIndex + index;
            } else if ((*edgeBuffer)[offset + startIndex + index] < neighbor) {
                startIndex += index + 1;
            } else {
                if (!index) {
                    return NONE;
                }
                endIndex = startIndex + index - 1;
            }
            index = (endIndex - startIndex) / 2;
        }
        return ((*edgeBuffer)[offset + startIndex + index] == neighbor ? offset + startIndex + index : NONE);
    }

// Assembly:
subq $0x78, %rsp
movq %rdi, 0x68(%rsp)
movq %rsi, 0x60(%rsp)
movq %rdx, 0x58(%rsp)
movq 0x68(%rsp), %rax
movq %rax, 0x30(%rsp)
testb $0x1, 0x3c(%rax)
jne 0x198c0
movq 0x60(%rsp), %rax
movl (%rax), %eax
movl %eax, 0x2c(%rsp)
jmp 0x198d9
movq 0x30(%rsp), %rax
movq 0x40(%rax), %rdi
movq 0x60(%rsp), %rsi
callq 0x188b0
movl (%rax), %eax
movl %eax, 0x2c(%rsp)
movq 0x30(%rsp), %rax
movl 0x2c(%rsp), %ecx
movl %ecx, 0x54(%rsp)
testb $0x1, 0x3c(%rax)
jne 0x198f9
movq 0x58(%rsp), %rax
movl (%rax), %eax
movl %eax, 0x28(%rsp)
jmp 0x19912
movq 0x30(%rsp), %rax
movq 0x40(%rax), %rdi
movq 0x58(%rsp), %rsi
callq 0x188b0
movl (%rax), %eax
movl %eax, 0x28(%rsp)
movq 0x30(%rsp), %rdi
movl 0x28(%rsp), %eax
movl %eax, 0x50(%rsp)
movl 0x54(%rsp), %eax
movl %eax, %esi
callq 0x18850
movq %rax, %rcx
xorl %eax, %eax
testb $0x1, 0x8(%rcx)
movb %al, 0x27(%rsp)
jne 0x19952
movq 0x30(%rsp), %rdi
movl 0x50(%rsp), %eax
movl %eax, %esi
callq 0x18850
movb 0x8(%rax), %al
xorb $-0x1, %al
movb %al, 0x27(%rsp)
movb 0x27(%rsp), %al
testb $0x1, %al
jne 0x1995c
jmp 0x1995e
jmp 0x1997d
leaq 0x2cdce(%rip), %rdi     # 0x46733
leaq 0x2cd89(%rip), %rsi     # 0x466f5
movl $0xcb, %edx
leaq 0x2cdef(%rip), %rcx     # 0x46767
callq 0x2110
movq 0x30(%rsp), %rdi
movl 0x54(%rsp), %eax
movl %eax, %esi
callq 0x18850
movq 0x30(%rsp), %rdi
movl (%rax), %eax
movl %eax, 0x4c(%rsp)
movl 0x54(%rsp), %eax
movq %rax, 0x18(%rsp)
callq 0x18830
movq %rax, %rcx
movq 0x18(%rsp), %rax
subq $0x1, %rcx
cmpq %rcx, %rax
jne 0x199d0
movq 0x30(%rsp), %rax
movq 0x18(%rax), %rdi
callq 0x188e0
subq $0x1, %rax
movq %rax, 0x10(%rsp)
jmp 0x199f1
movq 0x30(%rsp), %rdi
movl 0x54(%rsp), %eax
addl $0x1, %eax
movl %eax, %eax
movl %eax, %esi
callq 0x18850
movl (%rax), %eax
subl $0x1, %eax
movl %eax, %eax
movq %rax, 0x10(%rsp)
movq 0x10(%rsp), %rax
movl %eax, 0x48(%rsp)
movl 0x4c(%rsp), %eax
movl 0x48(%rsp), %ecx
addl $0x1, %ecx
cmpl %ecx, %eax
jne 0x19a16
movl $0xffffffff, 0x74(%rsp) # imm = 0xFFFFFFFF
jmp 0x19b41
movl $0x0, 0x44(%rsp)
movl 0x48(%rsp), %eax
subl 0x4c(%rsp), %eax
movl %eax, 0x40(%rsp)
movl 0x40(%rsp), %eax
subl 0x44(%rsp), %eax
shrl %eax
movl %eax, 0x3c(%rsp)
movl 0x44(%rsp), %eax
cmpl 0x40(%rsp), %eax
je 0x19af3
movq 0x30(%rsp), %rax
movq 0x18(%rax), %rdi
movl 0x4c(%rsp), %eax
addl 0x44(%rsp), %eax
addl 0x3c(%rsp), %eax
movl %eax, %eax
movl %eax, %esi
callq 0x18900
movl (%rax), %eax
movq 0x58(%rsp), %rcx
cmpl (%rcx), %eax
jne 0x19a84
movl 0x4c(%rsp), %eax
addl 0x44(%rsp), %eax
addl 0x3c(%rsp), %eax
movl %eax, 0x74(%rsp)
jmp 0x19b41
movq 0x30(%rsp), %rax
movq 0x18(%rax), %rdi
movl 0x4c(%rsp), %eax
addl 0x44(%rsp), %eax
addl 0x3c(%rsp), %eax
movl %eax, %eax
movl %eax, %esi
callq 0x18900
movl (%rax), %eax
movq 0x58(%rsp), %rcx
cmpl (%rcx), %eax
jae 0x19abe
movl 0x3c(%rsp), %eax
addl $0x1, %eax
addl 0x44(%rsp), %eax
movl %eax, 0x44(%rsp)
jmp 0x19ade
cmpl $0x0, 0x3c(%rsp)
jne 0x19acf
movl $0xffffffff, 0x74(%rsp) # imm = 0xFFFFFFFF
jmp 0x19b41
movl 0x44(%rsp), %eax
addl 0x3c(%rsp), %eax
subl $0x1, %eax
movl %eax, 0x40(%rsp)
jmp 0x19ae0
movl 0x40(%rsp), %eax
subl 0x44(%rsp), %eax
shrl %eax
movl %eax, 0x3c(%rsp)
jmp 0x19a38
movq 0x30(%rsp), %rax
movq 0x18(%rax), %rdi
movl 0x4c(%rsp), %eax
addl 0x44(%rsp), %eax
addl 0x3c(%rsp), %eax
movl %eax, %eax
movl %eax, %esi
callq 0x18900
movl (%rax), %eax
movq 0x58(%rsp), %rcx
cmpl (%rcx), %eax
jne 0x19b2e
movl 0x4c(%rsp), %eax
addl 0x44(%rsp), %eax
addl 0x3c(%rsp), %eax
movl %eax, 0xc(%rsp)
jmp 0x19b39
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %eax, 0xc(%rsp)
jmp 0x19b39
movl 0xc(%rsp), %eax
movl %eax, 0x74(%rsp)
movl 0x74(%rsp), %eax
addq $0x78, %rsp
retq
nopw (%rax,%rax)