code: def test_top_level_nested_if():
      x = relay.var("x", shape=(), dtype="bool")
      y = relay.var("y", shape=(), dtype="float32")
      z = relay.var("z", shape=(), dtype="float32")
      cond_t = relay.const(True)
      cond_f = relay.const(False)
      one = relay.const(1, dtype="float32")
      three = relay.const(3, dtype="float32")
      y2 = relay.add(y, y)
      z2 = relay.add(z, z)
      true_branch = relay.If(
          cond_t, relay.add(z2, y2), relay.add(three, y2)
      )
      false_branch = relay.If(cond_f, z2, one)
      body = relay.If(x, true_branch, false_branch)
      """
      free_var %x: bool
      if (%x) {
        if (True) {
          free_var %z: float32
          %0 = add(%z, %z);
          free_var %y: float32
          %1 = add(%y, %y);
          add(%0, %1)
        } else {
          add(3f, %1)
        }
      } else {
        if (False) {
          %0
        } else {
          1f
        }
      }
      """
  
      def expected():
          x = relay.var("x", shape=(), dtype="bool")
          y = relay.var("y", shape=(), dtype="float32")
          z = relay.var("z", shape=(), dtype="float32")
          cond_t = relay.const(True)
          cond_f = relay.const(False)
          one = relay.const(1, dtype="float32")
          three = relay.const(3, dtype="float32")
          y2 = relay.var("y2")
          z2 = relay.var("z2")
          true_branch = relay.If(
              cond_t, relay.add(z2, y2), relay.add(three, y2)
          )
          true_branch = relay.Let(y2, relay.add(y, y), true_branch)
          false_branch = relay.If(cond_f, z2, one)
          body = relay.If(x, true_branch, false_branch)
          body = relay.Let(z2, relay.add(z, z), body)
          return body
  
      bblock = run_opt_pass(
          body,
          [transform.ToBasicBlockNormalForm(), transform.InferType()],
      )
      """
      free_var %z: float32
      let %x: float32 = add(%z, %z) /* ty=float32 */;
      free_var %x1: bool
      if (%x1) {
        free_var %y: float32
        let %x2: float32 = add(%y, %y) /* ty=float32 */;
        if (True /* ty=bool */) {
          add(%x, %x2) /* ty=float32 */
        } else {
          add(3f /* ty=float32 */, %x2) /* ty=float32 */
        }
      } else {
        if (False /* ty=bool */) {
          %x
        } else {
          1f /* ty=float32 */
        }
      }
      """
      expected_output = run_opt_pass(expected(), transform.InferType())
      assert tvm.ir.structural_equal(
          bblock, expected_output, map_free_vars=True
      )
  
imports: import pytest
  import numpy
  import tvm
  from tvm import te
  from tvm import relay
  from tvm.relay.analysis import detect_feature
  from tvm.relay import op, create_executor, transform
  from tvm.relay.prelude import Prelude
  from tvm.relay.testing import count, create_workload
  from tvm.relay.analysis import Feature
  from tvm.relay.analysis import check_basic_block_normal_form
label_desc: Use image node_id 4 for calling a global function with example usage: test_top_level_nested_if() and returns: body