def METHOD_NAME(begin, end, strides, length):
    begin = canonicalize_index(begin, length, strides)
    end = canonicalize_index(end, length, strides)
    len1 = tir.ceildiv(begin - end, -strides)
    len2 = tir.ceildiv(end - begin, strides)
    return tir.Select(strides < 0, len1, len2)