code: def dup_inner_gcd(f, g, K):
      """
      Computes polynomial GCD and cofactors of `f` and `g` in `K[x]`.
  
      Returns ``(h, cff, cfg)`` such that ``a = gcd(f, g)``,
      ``cff = quo(f, h)``, and ``cfg = quo(g, h)``.
  
      Examples
      ========
  
      >>> from sympy.polys import ring, ZZ
      >>> R, x = ring("x", ZZ)
  
      >>> R.dup_inner_gcd(x**2 - 1, x**2 - 3*x + 2)
      (x - 1, x + 1, x - 2)
  
      """
      # XXX: This used to check for K.is_Exact but leads to awkward results when
      # the domain is something like RR[z] e.g.:
      #
      # >>> g, p, q = Poly(1, x).cancel(Poly(51.05*x*y - 1.0, x))
      # >>> g
      # 1.0
      # >>> p
      # Poly(17592186044421.0, x, domain='RR[y]')
      # >>> q
      # Poly(898081097567692.0*y*x - 17592186044421.0, x, domain='RR[y]'))
      #
      # Maybe it would be better to flatten into multivariate polynomials first.
      if K.is_RR or K.is_CC:
          try:
              exact = K.get_exact()
          except DomainError:
              return [K.one], f, g
  
          f = dup_convert(f, K, exact)
          g = dup_convert(g, K, exact)
  
          h, cff, cfg = dup_inner_gcd(f, g, exact)
  
          h = dup_convert(h, exact, K)
          cff = dup_convert(cff, exact, K)
          cfg = dup_convert(cfg, exact, K)
  
          return h, cff, cfg
      elif K.is_Field:
          if K.is_QQ and query("USE_HEU_GCD"):
              try:
                  return dup_qq_heu_gcd(f, g, K)
              except HeuristicGCDFailed:
                  pass
  
          return dup_ff_prs_gcd(f, g, K)
      else:
          if K.is_ZZ and query("USE_HEU_GCD"):
              try:
                  return dup_zz_heu_gcd(f, g, K)
              except HeuristicGCDFailed:
                  pass
  
          return dup_rr_prs_gcd(f, g, K)
  
imports: from sympy.polys.densearith import dup_sub_mul, dup_neg, dmp_neg, dmp_add, dmp_sub, dup_mul, dmp_mul, dmp_pow, dup_div, dmp_div, dup_rem, dup_quo, dmp_quo, dup_prem, dmp_prem, dup_mul_ground, dmp_mul_ground, dmp_mul_term, dup_quo_ground, dmp_quo_ground, dup_max_norm, dmp_max_norm
  from sympy.polys.densebasic import dup_strip, dmp_raise, dmp_zero, dmp_one, dmp_ground, dmp_one_p, dmp_zero_p, dmp_zeros, dup_degree, dmp_degree, dmp_degree_in, dup_LC, dmp_LC, dmp_ground_LC, dmp_multi_deflate, dmp_inflate, dup_convert, dmp_convert, dmp_apply_pairs
  from sympy.polys.densetools import dup_clear_denoms, dmp_clear_denoms, dup_diff, dmp_diff, dup_eval, dmp_eval, dmp_eval_in, dup_trunc, dmp_ground_trunc, dup_monic, dmp_ground_monic, dup_primitive, dmp_ground_primitive, dup_extract, dmp_ground_extract
  from sympy.polys.galoistools import gf_int, gf_crt
  from sympy.polys.polyconfig import query
  from sympy.polys.polyerrors import MultivariatePolynomialError, HeuristicGCDFailed, HomomorphismFailed, NotInvertible, DomainError
label_desc: Use image node_id 40 for calling a global function with example usage: dup_inner_gcd(f, g, K) and returns: h,  cff,  cfg, dup_ff_prs_gcd, dup_rr_prs_gcd, list,  f,  g, dup_qq_heu_gcd, dup_zz_heu_gcd