Fuzzy bsearch is useful for finding an entry in a prefix sum array (value is >= ele[0], < ele[1]), and the reentrant version is good when data needs to be passed to the compare function. Adapted from the code used in pr_resolve.