code: def complex_stirling_series(x, y, prec):
      # t = 1/z
      _m = (x * x + y * y) >> prec
      tre = (x << prec) // _m
      tim = (-y << prec) // _m
      # u = 1/z**2
      ure = (tre * tre - tim * tim) >> prec
      uim = tim * tre >> (prec - 1)
      # s = log(sqrt(2*pi)) - z
      sre = ln_sqrt2pi_fixed(prec) - x
      sim = -y
  
      # Add initial terms of Stirling's series
      sre += tre // 12
      sim += tim // 12
      tre, tim = ((tre * ure - tim * uim) >> prec), (
          (tre * uim + tim * ure) >> prec
      )
      sre -= tre // 360
      sim -= tim // 360
      tre, tim = ((tre * ure - tim * uim) >> prec), (
          (tre * uim + tim * ure) >> prec
      )
      sre += tre // 1260
      sim += tim // 1260
      tre, tim = ((tre * ure - tim * uim) >> prec), (
          (tre * uim + tim * ure) >> prec
      )
      sre -= tre // 1680
      sim -= tim // 1680
      tre, tim = ((tre * ure - tim * uim) >> prec), (
          (tre * uim + tim * ure) >> prec
      )
      if abs(tre) + abs(tim) < 5:
          return sre, sim
      sre += tre // 1188
      sim += tim // 1188
      tre, tim = ((tre * ure - tim * uim) >> prec), (
          (tre * uim + tim * ure) >> prec
      )
      sre -= 691 * tre // 360360
      sim -= 691 * tim // 360360
      tre, tim = ((tre * ure - tim * uim) >> prec), (
          (tre * uim + tim * ure) >> prec
      )
      sre += tre // 156
      sim += tim // 156
      tre, tim = ((tre * ure - tim * uim) >> prec), (
          (tre * uim + tim * ure) >> prec
      )
      if abs(tre) + abs(tim) < 5:
          return sre, sim
      sre -= 3617 * tre // 122400
      sim -= 3617 * tim // 122400
      tre, tim = ((tre * ure - tim * uim) >> prec), (
          (tre * uim + tim * ure) >> prec
      )
      sre += 43867 * tre // 244188
      sim += 43867 * tim // 244188
      tre, tim = ((tre * ure - tim * uim) >> prec), (
          (tre * uim + tim * ure) >> prec
      )
      sre -= 174611 * tre // 125400
      sim -= 174611 * tim // 125400
      tre, tim = ((tre * ure - tim * uim) >> prec), (
          (tre * uim + tim * ure) >> prec
      )
      if abs(tre) + abs(tim) < 5:
          return sre, sim
  
      k = 22
      # From here on, the coefficients are growing, so we
      # have to keep t at a roughly constant size
      usize = bitcount(max(abs(ure), abs(uim)))
      tsize = bitcount(max(abs(tre), abs(tim)))
      texp = 0
      while 1:
          p, q, pb, qb = stirling_coefficient(k)
          term_mag = tsize + pb + texp
          shift = -texp
          m = pb - term_mag
          if m > 0 and shift < m:
              p >>= m
              shift -= m
          m = tsize - term_mag
          if m > 0 and shift < m:
              wre = tre >> m
              wim = tim >> m
              shift -= m
          else:
              wre = tre
              wim = tim
          termre = (tre * p // q) >> shift
          termim = (tim * p // q) >> shift
          if abs(termre) + abs(termim) < 5:
              break
          sre += termre
          sim += termim
          tre, tim = ((tre * ure - tim * uim) >> usize), (
              (tre * uim + tim * ure) >> usize
          )
          texp -= prec - usize
          k += 2
      return sre, sim
  
imports: import math
  import sys
  from .backend import xrange
  from .backend import MPZ, MPZ_ZERO, MPZ_ONE, MPZ_THREE, gmpy
  from .libintmath import list_primes, ifac, ifac2, moebius
  from .libmpf import round_floor, round_ceiling, round_down, round_up, round_nearest, round_fast, lshift, sqrt_fixed, isqrt_fast, fzero, fone, fnone, fhalf, ftwo, finf, fninf, fnan, from_int, to_int, to_fixed, from_man_exp, from_rational, mpf_pos, mpf_neg, mpf_abs, mpf_add, mpf_sub, mpf_mul, mpf_mul_int, mpf_div, mpf_sqrt, mpf_pow_int, mpf_rdiv_int, mpf_perturb, mpf_le, mpf_lt, mpf_gt, mpf_shift, negative_rnd, reciprocal_rnd, bitcount, to_float, mpf_floor, mpf_sign, ComplexResult
  from .libelefun import constant_memo, def_mpf_constant, mpf_pi, pi_fixed, ln2_fixed, log_int_fixed, mpf_ln2, mpf_exp, mpf_log, mpf_pow, mpf_cosh, mpf_cos_sin, mpf_cosh_sinh, mpf_cos_sin_pi, mpf_cos_pi, mpf_sin_pi, ln_sqrt2pi_fixed, mpf_ln_sqrt2pi, sqrtpi_fixed, mpf_sqrtpi, cos_sin_fixed, exp_fixed
  from .libmpc import mpc_zero, mpc_one, mpc_half, mpc_two, mpc_abs, mpc_shift, mpc_pos, mpc_neg, mpc_add, mpc_sub, mpc_mul, mpc_div, mpc_add_mpf, mpc_mul_mpf, mpc_div_mpf, mpc_mpf_div, mpc_mul_int, mpc_pow_int, mpc_log, mpc_exp, mpc_pow, mpc_cos_pi, mpc_sin_pi, mpc_reciprocal, mpc_square, mpc_sub_mpf
label_desc: Use image node_id 33 for calling a global function with example usage: complex_stirling_series(x, y, prec) and returns: sre,  sim, sre,  sim, sre,  sim, sre,  sim