code: def mpf_atan2(y, x, prec, rnd=round_fast):
      xsign, xman, xexp, xbc = x
      ysign, yman, yexp, ybc = y
      if not yman:
          if y == fzero and x != fnan:
              if mpf_sign(x) >= 0:
                  return fzero
              return mpf_pi(prec, rnd)
          if y in (finf, fninf):
              if x in (finf, fninf):
                  return fnan
              # pi/2
              if y == finf:
                  return mpf_shift(mpf_pi(prec, rnd), -1)
              # -pi/2
              return mpf_neg(
                  mpf_shift(mpf_pi(prec, negative_rnd[rnd]), -1)
              )
          return fnan
      if ysign:
          return mpf_neg(
              mpf_atan2(mpf_neg(y), x, prec, negative_rnd[rnd])
          )
      if not xman:
          if x == fnan:
              return fnan
          if x == finf:
              return fzero
          if x == fninf:
              return mpf_pi(prec, rnd)
          if y == fzero:
              return fzero
          return mpf_shift(mpf_pi(prec, rnd), -1)
      tquo = mpf_atan(mpf_div(y, x, prec + 4), prec + 4)
      if xsign:
          return mpf_add(mpf_pi(prec + 4), tquo, prec, rnd)
      else:
          return mpf_pos(tquo, prec, rnd)
  
imports: import math
  from bisect import bisect
  from .backend import xrange
  from .backend import MPZ, MPZ_ZERO, MPZ_ONE, MPZ_TWO, MPZ_FIVE, BACKEND
  from .libmpf import round_floor, round_ceiling, round_down, round_up, round_nearest, round_fast, ComplexResult, bitcount, bctable, lshift, rshift, giant_steps, sqrt_fixed, from_int, to_int, from_man_exp, to_fixed, to_float, from_float, from_rational, normalize, fzero, fone, fnone, fhalf, finf, fninf, fnan, mpf_cmp, mpf_sign, mpf_abs, mpf_pos, mpf_neg, mpf_add, mpf_sub, mpf_mul, mpf_div, mpf_shift, mpf_rdiv_int, mpf_pow_int, mpf_sqrt, reciprocal_rnd, negative_rnd, mpf_perturb, isqrt_fast
  from .libintmath import ifib
label_desc: Use image node_id 33 for calling a global function with example usage: mpf_atan2(y, x, prec, rnd) and returns: fnan, mpf_neg, mpf_shift, mpf_add, mpf_pos, mpf_pi, mpf_neg, fnan, fzero, mpf_pi, fzero, fzero, fnan, mpf_shift