code: def dup_zz_factor(f, K):
      """
      Factor (non square-free) polynomials in `Z[x]`.
  
      Given a univariate polynomial `f` in `Z[x]` computes its complete
      factorization `f_1, ..., f_n` into irreducibles over integers::
  
                  f = content(f) f_1**k_1 ... f_n**k_n
  
      The factorization is computed by reducing the input polynomial
      into a primitive square-free polynomial and factoring it using
      Zassenhaus algorithm. Trial division is used to recover the
      multiplicities of factors.
  
      The result is returned as a tuple consisting of::
  
                (content(f), [(f_1, k_1), ..., (f_n, k_n))
  
      Examples
      ========
  
      Consider the polynomial `f = 2*x**4 - 2`::
  
          >>> from sympy.polys import ring, ZZ
          >>> R, x = ring("x", ZZ)
  
          >>> R.dup_zz_factor(2*x**4 - 2)
          (2, [(x - 1, 1), (x + 1, 1), (x**2 + 1, 1)])
  
      In result we got the following factorization::
  
                   f = 2 (x - 1) (x + 1) (x**2 + 1)
  
      Note that this is a complete factorization over integers,
      however over Gaussian integers we can factor the last term.
  
      By default, polynomials `x**n - 1` and `x**n + 1` are factored
      using cyclotomic decomposition to speedup computations. To
      disable this behaviour set cyclotomic=False.
  
      References
      ==========
  
      .. [1] [Gathen99]_
  
      """
      if GROUND_TYPES == "flint":
          f_flint = fmpz_poly(f[::-1])
          cont, factors = f_flint.factor()
          factors = [(fac.coeffs()[::-1], exp) for fac, exp in factors]
          return cont, factors
  
      cont, g = dup_primitive(f, K)
  
      n = dup_degree(g)
  
      if dup_LC(g, K) < 0:
          cont, g = -cont, dup_neg(g, K)
  
      if n <= 0:
          return cont, []
      elif n == 1:
          return cont, [(g, 1)]
  
      if query("USE_IRREDUCIBLE_IN_FACTOR"):
          if dup_zz_irreducible_p(g, K):
              return cont, [(g, 1)]
  
      g = dup_sqf_part(g, K)
      H = None
  
      if query("USE_CYCLOTOMIC_FACTOR"):
          H = dup_zz_cyclotomic_factor(g, K)
  
      if H is None:
          H = dup_zz_zassenhaus(g, K)
  
      factors = dup_trial_division(f, H, K)
      return cont, factors
  
imports: from sympy.external.gmpy import GROUND_TYPES
  from sympy.core.random import _randint
  from sympy.polys.galoistools import gf_from_int_poly, gf_to_int_poly, gf_lshift, gf_add_mul, gf_mul, gf_div, gf_rem, gf_gcdex, gf_sqf_p, gf_factor_sqf, gf_factor
  from sympy.polys.densebasic import dup_LC, dmp_LC, dmp_ground_LC, dup_TC, dup_convert, dmp_convert, dup_degree, dmp_degree, dmp_degree_in, dmp_degree_list, dmp_from_dict, dmp_zero_p, dmp_one, dmp_nest, dmp_raise, dup_strip, dmp_ground, dup_inflate, dmp_exclude, dmp_include, dmp_inject, dmp_eject, dup_terms_gcd, dmp_terms_gcd
  from sympy.polys.densearith import dup_neg, dmp_neg, dup_add, dmp_add, dup_sub, dmp_sub, dup_mul, dmp_mul, dup_sqr, dmp_pow, dup_div, dmp_div, dup_quo, dmp_quo, dmp_expand, dmp_add_mul, dup_sub_mul, dmp_sub_mul, dup_lshift, dup_max_norm, dmp_max_norm, dup_l1_norm, dup_mul_ground, dmp_mul_ground, dup_quo_ground, dmp_quo_ground
  from sympy.polys.densetools import dup_clear_denoms, dmp_clear_denoms, dup_trunc, dmp_ground_trunc, dup_content, dup_monic, dmp_ground_monic, dup_primitive, dmp_ground_primitive, dmp_eval_tail, dmp_eval_in, dmp_diff_eval_in, dmp_compose, dup_shift, dup_mirror
  from sympy.polys.euclidtools import dmp_primitive, dup_inner_gcd, dmp_inner_gcd
  from sympy.polys.sqfreetools import dup_sqf_p, dup_sqf_norm, dmp_sqf_norm, dup_sqf_part, dmp_sqf_part
  from sympy.polys.polyutils import _sort_factors
  from sympy.polys.polyconfig import query
  from sympy.polys.polyerrors import ExtraneousFactors, DomainError, CoercionFailed, EvaluationFailed
  from sympy.utilities import subsets
  from math import ceil, log
label_desc: Use image node_id 15 for calling a global function with example usage: dup_zz_factor(f, K) and returns: cont,  factors, cont,  factors, cont,  list, cont,  list, cont,  list