code: def test_replace_direct_write0():
      s, target = replace_ir_builder(realize=True)
      old_hash = s.mod["main"].__hash__()
      sref = s.get_sref(s.mod["main"].body.block.body[1])
      s.replace(sref, target)
      # There is no other reference so the AST node can be written directly
      assert old_hash == s.mod["main"].__hash__()
      # Check the replaced part is equal to the target
      tvm.ir.assert_structural_equal(
          s.mod["main"].body.block.body[1], target
      )
      # The target reuse the stmt of the sref, so the sref won't be None
      assert sref.stmt is not None
  
imports: import gc
  import sys
  import pytest
  import tvm
  import tvm.testing
  from tvm import tir
  from tvm.ir import IRModule
  from tvm.script import tir
label_desc: Use image node_id 7 for calling a global function with example usage: test_replace_direct_write0() without return types