code: def test_normalize_to_iter_sum():
      x = tvm.tir.Var("x", "int64")
      y = tvm.tir.Var("y", "int64")
      z = tvm.tir.Var("z", "int64")
      a = tvm.tir.Var("a", "int64")
      n = tvm.tir.Var("n", "int64")
      flm = tvm.tir.floormod
  
      assert_normalize_to_iter_sum(
          z + ((y + x * 4 + 2) * n) + 3,
          var_dom([(x, 9), (y, 4), (z, 3)]),
          [(x, n * 4), (y, n), (z, 1)],
          2 * n + 3,
      )
  
      # max cannot detected so it goes into base
      assert_normalize_to_iter_sum(
          tvm.tir.max(z, a) + ((y + x * 4 + 2) * n) + 3,
          var_dom([(x, 9), (y, 4), (z, 3)]),
          [(x, n * 4), (y, n)],
          tvm.tir.max(z, a) + 2 * n + 3,
      )
  
      # order by symbolc prod
      assert_normalize_to_iter_sum(
          z + ((y * 4 * a + x * 4 + 2) * n) + 3,
          var_dom([(y, a * n * 4), (x, n * 4), (z, a)]),
          [(y, a * n * 4), (x, n * 4), (z, 1)],
          2 * n + 3,
      )
  
      # order by cscale
      assert_normalize_to_iter_sum(
          z + 2 * y * 3 + 4 * x,
          var_dom([(y, a * n * 4), (x, n * 4), (z, a)]),
          [(y, 6), (x, 4), (z, 1)],
          0,
      )
  
      # split pattern
      assert_normalize_to_iter_sum(
          z + 2 * y * 3 + 4 * (x // 2),
          var_dom([(y, a * n * 4), (x, n * 4), (z, a)]),
          [(y, 6), (x // 2, 4), (z, 1)],
          0,
      )
  
      # non-divisible
      assert_normalize_to_iter_sum(
          x // 5,
          var_dom([(x, 4096)]),
          [
              tvm.arith.IterSplitExpr(
                  tvm.arith.IterMark(x, 4096),
                  lower_factor=tvm.tir.const(5, "int64"),
                  extent=tvm.tir.const(820, "int64"),
                  scale=tvm.tir.const(1, "int64"),
              )
          ],
          0,
      )
  
      # iter simplify
      assert_normalize_to_iter_sum(
          z * 2 + 2 * y * 3 + 4 * (x // 4) + (x % 4),
          var_dom([(y, a * n * 4), (x, n * 4), (z, a)]),
          [(y, 6), (z, 2), (x, 1)],
          0,
      )
  
imports: import tvm
  import tvm.testing
  from tvm.tir import floordiv, floormod
label_desc: Use image node_id 29 for calling a global function with example usage: test_normalize_to_iter_sum() without return types