public static void printRuleInGoalTree(ControlFrame frame, Proposition impliesprop, int depth) {
    { PatternRecord patternrecord = frame.patternRecord;
      boolean reversepolarityP = frame.reversePolarityP;

      System.out.print("RULE: ");
      { Surrogate rulename = ((Surrogate)(KeyValueList.dynamicSlotValue(impliesprop.dynamicSlots, Logic.SYM_STELLA_SURROGATE_VALUE_INVERSE, null)));

        if ((rulename == null) &&
            (((Proposition)(KeyValueList.dynamicSlotValue(impliesprop.dynamicSlots, Logic.SYM_LOGIC_MASTER_PROPOSITION, null))) != null)) {
          rulename = ((Surrogate)(KeyValueList.dynamicSlotValue(((Proposition)(KeyValueList.dynamicSlotValue(impliesprop.dynamicSlots, Logic.SYM_LOGIC_MASTER_PROPOSITION, null))).dynamicSlots, Logic.SYM_STELLA_SURROGATE_VALUE_INVERSE, null)));
        }
        if (rulename != null) {
          System.out.println(rulename.symbolName);
          Logic.printIndent(Stella.STANDARD_OUTPUT, (2 * depth) + 6);
        }
      }
      { Object old$Printmode$000 = Logic.$PRINTMODE$.get();
        Object old$Printlogicalformstream$000 = Logic.$PRINTLOGICALFORMSTREAM$.get();
        Object old$Indentcounter$000 = Logic.$INDENTCOUNTER$.get();
        Object old$Queryiterator$000 = Logic.$QUERYITERATOR$.get();

        try {
          Native.setSpecial(Logic.$PRINTMODE$, Logic.KWD_FLAT);
          Native.setSpecial(Logic.$PRINTLOGICALFORMSTREAM$, Stella.STANDARD_OUTPUT);
          Native.setIntSpecial(Logic.$INDENTCOUNTER$, (2 * depth) + 7);
          Native.setSpecial(Logic.$QUERYITERATOR$, null);
          { Description chooseValue000 = null;

            if (reversepolarityP) {
              { Description temp000 = patternrecord.optimalPattern;

                chooseValue000 = ((temp000 != null) ? temp000 : patternrecord.description);
              }
            }
            else {
              chooseValue000 = ((Description)((impliesprop.arguments.theArray)[1]));
            }
            { Description chooseValue001 = null;

              if (reversepolarityP) {
                chooseValue001 = ((Description)((impliesprop.arguments.theArray)[0]));
              }
              else {
                { Description temp001 = patternrecord.optimalPattern;

                  chooseValue001 = ((temp001 != null) ? temp001 : patternrecord.description);
                }
              }
              Description.printDescriptionsAsKifRule(chooseValue000, chooseValue001, impliesprop, reversepolarityP);
            }
          }

        } finally {
          Logic.$QUERYITERATOR$.set(old$Queryiterator$000);
          Logic.$INDENTCOUNTER$.set(old$Indentcounter$000);
          Logic.$PRINTLOGICALFORMSTREAM$.set(old$Printlogicalformstream$000);
          Logic.$PRINTMODE$.set(old$Printmode$000);
        }
      }
    }
  }