code: def zetasum_sieved(critical_line, sre, sim, a, n, wp):
      if a < 1:
          raise ValueError("a cannot be less than 1")
      sieve, primes, mult = primesieve(a + n)
      basic_powers = {}
      one = MPZ_ONE << wp
      one_2wp = MPZ_ONE << (2 * wp)
      wp2 = wp + wp
      ln2 = ln2_fixed(wp)
      pi2 = pi_fixed(wp - 1)
      for p in primes:
          if p * 2 > a + n:
              break
          log = log_int_fixed(p, wp, ln2)
          cos, sin = cos_sin_fixed((-sim * log) >> wp, wp, pi2)
          if critical_line:
              u = one_2wp // isqrt_fast(p << wp2)
          else:
              u = exp_fixed((-sre * log) >> wp, wp)
          pre = (u * cos) >> wp
          pim = (u * sin) >> wp
          basic_powers[p] = [(pre, pim)]
          tre, tim = pre, pim
          for m in range(1, int(math.log(a + n, p) + 0.01) + 1):
              tre, tim = ((pre * tre - pim * tim) >> wp), (
                  (pim * tre + pre * tim) >> wp
              )
              basic_powers[p].append((tre, tim))
      xre = MPZ_ZERO
      xim = MPZ_ZERO
      if a == 1:
          xre += one
      aa = max(a, 2)
      for k in xrange(aa, a + n + 1):
          p = sieve[k]
          if p in basic_powers:
              m = mult[k]
              tre, tim = basic_powers[p][m - 1]
              while 1:
                  k //= p**m
                  if k == 1:
                      break
                  p = sieve[k]
                  m = mult[k]
                  pre, pim = basic_powers[p][m - 1]
                  tre, tim = ((pre * tre - pim * tim) >> wp), (
                      (pim * tre + pre * tim) >> wp
                  )
          else:
              log = log_int_fixed(k, wp, ln2)
              cos, sin = cos_sin_fixed((-sim * log) >> wp, wp, pi2)
              if critical_line:
                  u = one_2wp // isqrt_fast(k << wp2)
              else:
                  u = exp_fixed((-sre * log) >> wp, wp)
              tre = (u * cos) >> wp
              tim = (u * sin) >> wp
          xre += tre
          xim += tim
      return xre, xim
  
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 26 for calling a global function with example usage: zetasum_sieved(critical_line, sre, sim, a, n, wp) and returns: xre,  xim