code: def _plan_and_convert(tir_mod, pools=None):
      target = Target("c")
  
      if pools is None:
          pools = [
              WorkspacePoolInfo(
                  "global_workspace",
                  [target],
              )
          ]
  
      tir_mod = _assign_targets_to_primfuncs_irmodule(tir_mod, target)
      tir_mod = assign_poolinfos_to_allocates_in_irmodule(
          tir_mod, pools
      )
      main_func = tir_mod["__tvm_main__"]
      buffer_analysis = tvm.tir.usmp.analysis.extract_buffer_info(
          main_func, tir_mod
      )
      buffer_info_map = buffer_analysis.buffer_info_stmts
  
      fcreate_array_bi = tvm.get_global_func(
          "tir.usmp.CreateArrayBufferInfo"
      )
      buffer_info_arr = fcreate_array_bi(buffer_info_map)
      fusmp_algo_greedy_by_size = tvm.get_global_func(
          "tir.usmp.algo.greedy_by_size"
      )
      buffer_pool_allocations = fusmp_algo_greedy_by_size(
          buffer_info_arr, buffer_analysis.memory_pressure
      )
      fassign_stmt_pool_allocations = tvm.get_global_func(
          "tir.usmp.AssignStmtPoolAllocations"
      )
      pool_allocations = fassign_stmt_pool_allocations(
          buffer_info_map, buffer_pool_allocations
      )
      tir_mod_with_offsets = (
          tvm.tir.usmp.transform.convert_pool_allocations_to_offsets(
              pool_allocations, emit_tvmscript_printable=True
          )(tir_mod)
      )
  
      return tir_mod_with_offsets
  
imports: import sys
  import pytest
  import tvm
  from tvm import PoolInfoProperties, WorkspacePoolInfo
  from tvm.script import tir, ir
  from tvm.target import Target
  from tvm.tir import stmt_functor
  from tvm.tir.usmp import utils
label_desc: Use image node_id 5 for calling a global function with example usage: _plan_and_convert(tir_mod, pools) and returns: tir_mod_with_offsets