code: def mpi_gamma(z, prec, type=0):
      a, b = z
      wp = prec + 20
  
      if type == 1:
          return mpi_gamma(mpi_add(z, mpi_one, wp), prec, 0)
  
      # increasing
      if mpf_gt(a, gamma_min_b):
          if type == 0:
              c = mpf_gamma(a, prec, round_floor)
              d = mpf_gamma(b, prec, round_ceiling)
          elif type == 2:
              c = mpf_rgamma(b, prec, round_floor)
              d = mpf_rgamma(a, prec, round_ceiling)
          elif type == 3:
              c = mpf_loggamma(a, prec, round_floor)
              d = mpf_loggamma(b, prec, round_ceiling)
      # decreasing
      elif mpf_gt(a, fzero) and mpf_lt(b, gamma_min_a):
          if type == 0:
              c = mpf_gamma(b, prec, round_floor)
              d = mpf_gamma(a, prec, round_ceiling)
          elif type == 2:
              c = mpf_rgamma(a, prec, round_floor)
              d = mpf_rgamma(b, prec, round_ceiling)
          elif type == 3:
              c = mpf_loggamma(b, prec, round_floor)
              d = mpf_loggamma(a, prec, round_ceiling)
      else:
          # TODO: reflection formula
          znew = mpi_add(z, mpi_one, wp)
          if type == 0:
              return mpi_div(mpi_gamma(znew, prec + 2, 0), z, prec)
          if type == 2:
              return mpi_mul(mpi_gamma(znew, prec + 2, 2), z, prec)
          if type == 3:
              return mpi_sub(
                  mpi_gamma(znew, prec + 2, 3),
                  mpi_log(z, prec + 2),
                  prec,
              )
      return c, d
  
imports: from .backend import xrange
  from .libmpf import ComplexResult, round_down, round_up, round_floor, round_ceiling, round_nearest, prec_to_dps, repr_dps, dps_to_prec, bitcount, from_float, fnan, finf, fninf, fzero, fhalf, fone, fnone, mpf_sign, mpf_lt, mpf_le, mpf_gt, mpf_ge, mpf_eq, mpf_cmp, mpf_min_max, mpf_floor, from_int, to_int, to_str, from_str, mpf_abs, mpf_neg, mpf_pos, mpf_add, mpf_sub, mpf_mul, mpf_mul_int, mpf_div, mpf_shift, mpf_pow_int, from_man_exp, MPZ_ONE
  from .libelefun import mpf_log, mpf_exp, mpf_sqrt, mpf_atan, mpf_atan2, mpf_pi, mod_pi2, mpf_cos_sin
  from .gammazeta import mpf_gamma, mpf_rgamma, mpf_loggamma, mpc_loggamma
label_desc: Use image node_id 57 for calling a global function with example usage: mpi_gamma(z, prec, type) and returns: c,  d, mpi_gamma, mpi_div, mpi_mul, mpi_sub