code: def test_complex():
      @rewrite_ops(
          {"+": "add_op", "*": "mul_op", "-": "sub_op", "/": "div_op"},
          {"-": "neg_op"},
          {0.0: "zero"},
      )
      def foo(add_op, mul_op, x, y, z):
          sub_op = ops.BINARY_INVERSES[add_op]  # noqa: F841
          div_op = ops.BINARY_INVERSES[mul_op]  # noqa: F841
          neg_op = ops.UNARY_INVERSES[add_op]  # noqa: F841
          zero = ops.UNITS[add_op]  # noqa: F841
          return (-y) * (x + y * z - 0.0 / x)
  
      actual = foo
  
      def foo(add_op, mul_op, x, y, z):
          sub_op = ops.BINARY_INVERSES[add_op]
          div_op = ops.BINARY_INVERSES[mul_op]
          neg_op = ops.UNARY_INVERSES[add_op]
          zero = ops.UNITS[add_op]
          return mul_op(
              neg_op(y),
              sub_op(add_op(x, mul_op(y, z)), div_op(zero, x)),
          )
  
      expected = foo
  
      assert_fn_eq(actual, expected)
  
      args = (ops.add, ops.mul, 1.23, 4.56, 7.89)
      assert actual(*args) == expected(*args)
  
      args = (ops.add, ops.add, 1.23, 4.56, 7.89)
      assert actual(*args) == expected(*args)
  
      args = (ops.mul, ops.mul, 1.23, 4.56, 7.89)
      assert actual(*args) == expected(*args)
  
file_path: funsor/test/test_syntax.py
imports: import operator
  import sys
  import pytest
  from funsor import ops
  from funsor.syntax import rewrite_ops
label_desc: Use image node_id 4 for calling a global function with example usage: test_complex() and returns: unknown, mul_op