public static void helpPrettyPrintRelationDefinitionTree(Cons tree, OutputStream stream, int startindent, int keyindent, boolean forcefirstkeyonseparatelineP) {
    { Object old$PrintreadablyP$000 = Stella.$PRINTREADABLYp$.get();
      Object old$PrintprettyP$000 = Stella.$PRINTPRETTYp$.get();

      try {
        Native.setBooleanSpecial(Stella.$PRINTREADABLYp$, true);
        Native.setBooleanSpecial(Stella.$PRINTPRETTYp$, true);
        { Stella_Object value000 = null;

          { Stella_Object element = null;
            Cons iter000 = tree;

            loop000 : for (;!(iter000 == Stella.NIL); iter000 = iter000.rest) {
              element = iter000.value;
              if (Stella_Object.keywordP(element)) {
                value000 = element;
                break loop000;
              }
            }
          }
          { int nofheaderelements = tree.position(value000, 0);

            { PropertyList self000 = PropertyList.newPropertyList();

              self000.thePlist = Cons.extractOptions(tree, null);
              { PropertyList options = self000;
                int keylength = Stella.NULL_INTEGER;

                if (nofheaderelements == Stella.NULL_INTEGER) {
                  nofheaderelements = tree.length();
                }
                forcefirstkeyonseparatelineP = forcefirstkeyonseparatelineP ||
                    (options.length() > 1);
                stream.nativeStream.print("(");
                { Stella_Object element = null;
                  Cons iter001 = tree;
                  int i = Stella.NULL_INTEGER;
                  int iter002 = 1;
                  int upperBound000 = nofheaderelements;
                  boolean unboundedP000 = upperBound000 == Stella.NULL_INTEGER;

                  for (;(!(iter001 == Stella.NIL)) &&
                            (unboundedP000 ||
                             (iter002 <= upperBound000)); iter001 = iter001.rest, iter002 = iter002 + 1) {
                    element = iter001.value;
                    i = iter002;
                    if (i > 1) {
                      stream.nativeStream.print(" ");
                    }
                    stream.nativeStream.print(element);
                  }
                }
                { Stella_Object key = null;
                  Stella_Object value = null;
                  Cons iter003 = options.thePlist;
                  int i = Stella.NULL_INTEGER;
                  int iter004 = 1;

                  for (;!(iter003 == Stella.NIL); iter003 = iter003.rest.rest, iter004 = iter004 + 1) {
                    key = iter003.value;
                    value = iter003.rest.value;
                    i = iter004;
                    if ((i == 1) &&
                        (!forcefirstkeyonseparatelineP)) {
                      if (nofheaderelements > 0) {
                        stream.nativeStream.print(" ");
                      }
                    }
                    else {
                      stream.nativeStream.println();
                      Logic.printIndent(stream, startindent + keyindent);
                    }
                    if (Surrogate.subtypeOfKeywordP(Stella_Object.safePrimaryType(key))) {
                      { Keyword key000 = ((Keyword)(key));

                        keylength = (key000.symbolName).length() + 1;
                        stream.nativeStream.print(":" + key000.symbolName);
                      }
                    }
                    else {
                      keylength = 4;
                      stream.nativeStream.print(key);
                    }
                    stream.nativeStream.print(" ");
                    if (((key == Logic.KWD_SLOTS) ||
                        ((key == Logic.KWD_PUBLIC_SLOTS) ||
                         ((key == Logic.KWD_METHODS) ||
                          (key == Logic.KWD_PUBLIC_METHODS)))) &&
                        Stella_Object.consP(value)) {
                      stream.nativeStream.print("(");
                      { Stella_Object element = null;
                        Cons iter005 = ((Cons)(value));
                        int i000 = Stella.NULL_INTEGER;
                        int iter006 = 1;

                        for (;!(iter005 == Stella.NIL); iter005 = iter005.rest, iter006 = iter006 + 1) {
                          element = iter005.value;
                          i000 = iter006;
                          if (i000 > 1) {
                            stream.nativeStream.println();
                            Logic.printIndent(stream, keyindent + keylength + 2);
                          }
                          if (Stella_Object.consP(element)) {
                            Logic.helpPrettyPrintRelationDefinitionTree(((Cons)(element)), stream, startindent + keyindent + keylength + 2, keyindent, false);
                          }
                          else {
                            stream.nativeStream.print(value);
                          }
                        }
                      }
                      stream.nativeStream.print(")");
                    }
                    else {
                      stream.nativeStream.print(value);
                    }
                  }
                }
                { Stella_Object element = null;
                  Cons iter007 = tree.nthRest(nofheaderelements);

                  for (;!(iter007 == Stella.NIL); iter007 = iter007.rest) {
                    element = iter007.value;
                    stream.nativeStream.println();
                    Logic.printIndent(stream, keyindent);
                    stream.nativeStream.print(element);
                  }
                }
                stream.nativeStream.print(")");
                options.free();
              }
            }
          }
        }

      } finally {
        Stella.$PRINTPRETTYp$.set(old$PrintprettyP$000);
        Stella.$PRINTREADABLYp$.set(old$PrintreadablyP$000);
      }
    }
  }