public static void printAsKif(Stella_Object self, OutputStream stream) {
    { int currentindentcounter = ((Integer)(Logic.$INDENTCOUNTER$.get())).intValue();

      { Object old$Indentcounter$000 = Logic.$INDENTCOUNTER$.get();
        Object old$Printlogicalformstream$000 = Logic.$PRINTLOGICALFORMSTREAM$.get();
        Object old$PrettyprintkifP$000 = Logic.$PRETTYPRINTKIFp$.get();

        try {
          Native.setIntSpecial(Logic.$INDENTCOUNTER$, currentindentcounter);
          Native.setSpecial(Logic.$PRINTLOGICALFORMSTREAM$, stream);
          Native.setBooleanSpecial(Logic.$PRETTYPRINTKIFp$, ((Boolean)(Logic.$PRETTYPRINTLOGICALFORMSp$.get())).booleanValue());
          Logic.printAsKifInternal(self);

        } finally {
          Logic.$PRETTYPRINTKIFp$.set(old$PrettyprintkifP$000);
          Logic.$PRINTLOGICALFORMSTREAM$.set(old$Printlogicalformstream$000);
          Logic.$INDENTCOUNTER$.set(old$Indentcounter$000);
        }
      }
    }
  }