code: def commingle_loop_vars(prog):
      """
      prog: Program
  
      # NN backend expects output vars as loop vars. Example:
      #
      # Given:
      #    main(%a: (1, 2, fp32),
      #         %b: (1, 2, fp32)) {
      #      block0() {
      #        %loop:0: (1, 2, fp32), %loop:1: (1, 2, fp32) = \
      #        while_loop(loop_vars=(%a, %b))
      #          loop_cond(%a.x, %b.x) {
      #            %cond_var: (bool) = some_op(x=%a.x, y=%b.x)
      #          } -> (%cond_var)
      #          loop_body(%a.x, %b.x) {
      #            %add_0: (1, 2, fp32) = add(x=%a.x, y=%b.x)
      #          } -> (%add_0, %b.x)
      #      } -> (%loop:0, %loop:1)
      #    }
      #
      # Result:
      #    main(%a: (1, 2, fp32),
      #         %b: (1, 2, fp32)) {
      #      block0() {
      #        %loop:0: (1, 2, fp32), %loop:1: (1, 2, fp32) = \
      #        while_loop(loop_vars=(%a, %b))
      #          loop_cond(%loop:0, %loop:1) {
      #            %cond_var: (bool) = some_op(x=%loop:0, y=%loop:1)
      #          } -> (%cond_var)
      #          loop_body(%loop:0, %loop:1) {
      #            %add_0: (1, 2, fp32) = add(x=%loop:0, y=%loop:1)
      #          } -> (%add_0, %loop:1)
      #      } -> (%loop:0, %loop:1)
      #    }
      #
      # Comment: The resulting program is no longer SSA (multiple assignments on
      # %loop:0).
      """
      for f_name, f in prog.functions.items():
          commingle_loop_vars_block(f)
  
imports: from __future__ import print_function
  from __future__ import division
  from __future__ import absolute_import
  from coremltools.converters.mil.mil.passes.pass_registry import register_pass
label_desc: Use image node_id 2 for calling a global function with example usage: commingle_loop_vars(prog) without return types