code: def _minmax(
      func: Callable,
      values: np.ndarray,
      mask: npt.NDArray[np.bool_],
      *,
      skipna: bool = True,
      axis: AxisInt | None = None,
  ):
      """
      Reduction for 1D masked array.
  
      Parameters
      ----------
      func : np.min or np.max
      values : np.ndarray
          Numpy array with the values (can be of any dtype that support the
          operation).
      mask : np.ndarray[bool]
          Boolean numpy array (True values indicate missing values).
      skipna : bool, default True
          Whether to skip NA.
      axis : int, optional, default None
      """
      if not skipna:
          if mask.any() or not values.size:
              # min/max with empty array raise in numpy, pandas returns NA
              return libmissing.NA
          else:
              return func(values, axis=axis)
      else:
          subset = values[~mask]
          if subset.size:
              return func(subset, axis=axis)
          else:
              # min/max with empty array raise in numpy, pandas returns NA
              return libmissing.NA
  
file_path: pandas/pandas/core/array_algos/masked_reductions.py
imports: from __future__ import annotations
  from typing import TYPE_CHECKING, Callable
  import warnings
  import numpy
  from pandas._libs import missing
  from pandas.core.nanops import check_below_min_count
label_desc: Use image node_id 4 for calling a global function with example usage: _minmax(func, values, mask) and returns: libmissing, func, func, libmissing