def get_addr_range(addrs, addr):
    """
    Return the range of either functions/blocks/codes with a binary search, O(log N)
    :param addrs: the list containing a start/end address pair
    :param addr: the target address range one looks for
    :return: (start, end) if any (0,0) otherwise
    """
    starts = [start for (start, end) in addrs]
    ends = [end for (start, end) in addrs]

    first = 0
    last = len(starts) - 1
    while first <= last:
        mid = (first+last)//2
        if starts[mid] <= addr < ends[mid]:
            return starts[mid], ends[mid]
        else:
            if starts[mid] < addr:
                first = mid + 1
            else:
                last = mid - 1

    # When no range has been found
    return 0,0