code: def _generate_range_overflow_safe_signed(
      endpoint, periods, stride, side
  ):
      """
      A special case for _generate_range_overflow_safe where `periods * stride`
      can be calculated without overflowing int64 bounds.
      """
      assert side in ["start", "end"]
      if side == "end":
          stride *= -1
  
      with np.errstate(over="raise"):
          addend = np.int64(periods) * np.int64(stride)
          try:
              # easy case with no overflows
              return np.int64(endpoint) + addend
          except (FloatingPointError, OverflowError):
              # with endpoint negative and addend positive we risk
              #  FloatingPointError; with reversed signed we risk OverflowError
              pass
  
          # if stride and endpoint had opposite signs, then endpoint + addend
          #  should never overflow.  so they must have the same signs
          assert (stride > 0 and endpoint >= 0) or (
              stride < 0 and endpoint <= 0
          )
  
          if stride > 0:
              # watch out for very special case in which we just slightly
              #  exceed implementation bounds, but when passing the result to
              #  np.arange will get a result slightly within the bounds
              assert endpoint >= 0
              result = np.uint64(endpoint) + np.uint64(addend)
              i64max = np.uint64(np.iinfo(np.int64).max)
              assert result > i64max
              if result <= i64max + np.uint64(stride):
                  return result
  
      raise OutOfBoundsDatetime(
          "Cannot generate range with "
          "{side}={endpoint} and "
          "periods={periods}".format(
              side=side, endpoint=endpoint, periods=periods
          )
      )
  
imports: import numpy
  from pandas._libs.tslibs import OutOfBoundsDatetime, Timestamp
  from pandas.tseries.offsets import Tick, generate_range
label_desc: Use image node_id 3 for calling a global function with example usage: _generate_range_overflow_safe_signed(endpoint, periods, stride, side) and returns: unknown, result