public static Stella_Object consifyListsAndIterators(Stella_Object tree) {
    if (tree == null) {
      return (tree);
    }
    { Surrogate testValue000 = Stella_Object.safePrimaryType(tree);

      if (testValue000 == Stella.SGT_STELLA_CONS) {
        { Cons tree000 = ((Cons)(tree));

          { ConsIterator cons = tree000.allocateIterator();

            while (cons.nextP()) {
              cons.valueSetter(Stella_Object.consifyListsAndIterators(cons.value));
            }
          }
          return (tree000);
        }
      }
      else if (Surrogate.subtypeOfP(testValue000, Stella.SGT_STELLA_LIST)) {
        { List tree000 = ((List)(tree));

          { Cons conslist = Stella.NIL;

            { Stella_Object item = null;
              Cons iter000 = tree000.theConsList;
              int i = Stella.NULL_INTEGER;
              int iter001 = 0;
              int upperBound000 = Stella.$PRETTY_PRINT_LIST_CUTOFF$;
              boolean unboundedP000 = upperBound000 == Stella.NULL_INTEGER;
              Cons collect000 = null;

              for (;(!(iter000 == Stella.NIL)) &&
                        (unboundedP000 ||
                         (iter001 <= upperBound000)); iter000 = iter000.rest, iter001 = iter001 + 1) {
                item = iter000.value;
                i = iter001;
                if (collect000 == null) {
                  {
                    collect000 = Cons.cons(((i == Stella.$PRETTY_PRINT_LIST_CUTOFF$) ? Stella.ELIPSIS : item), Stella.NIL);
                    if (conslist == Stella.NIL) {
                      conslist = collect000;
                    }
                    else {
                      Cons.addConsToEndOfConsList(conslist, collect000);
                    }
                  }
                }
                else {
                  {
                    collect000.rest = Cons.cons(((i == Stella.$PRETTY_PRINT_LIST_CUTOFF$) ? Stella.ELIPSIS : item), Stella.NIL);
                    collect000 = collect000.rest;
                  }
                }
              }
            }
            return (conslist);
          }
        }
      }
      else if (Surrogate.subtypeOfP(testValue000, Stella.SGT_STELLA_ITERATOR)) {
        { Iterator tree000 = ((Iterator)(tree));

          { Cons conslist = Stella.NIL;

            { Stella_Object item = null;
              Iterator iter002 = tree000;
              int i = Stella.NULL_INTEGER;
              int iter003 = 0;
              int upperBound001 = Stella.$PRETTY_PRINT_LIST_CUTOFF$;
              boolean unboundedP001 = upperBound001 == Stella.NULL_INTEGER;
              Cons collect001 = null;

              for (;iter002.nextP() &&
                        (unboundedP001 ||
                         (iter003 <= upperBound001)); iter003 = iter003 + 1) {
                item = iter002.value;
                i = iter003;
                if (collect001 == null) {
                  {
                    collect001 = Cons.cons(((i == Stella.$PRETTY_PRINT_LIST_CUTOFF$) ? Stella.ELIPSIS : item), Stella.NIL);
                    if (conslist == Stella.NIL) {
                      conslist = collect001;
                    }
                    else {
                      Cons.addConsToEndOfConsList(conslist, collect001);
                    }
                  }
                }
                else {
                  {
                    collect001.rest = Cons.cons(((i == Stella.$PRETTY_PRINT_LIST_CUTOFF$) ? Stella.ELIPSIS : item), Stella.NIL);
                    collect001 = collect001.rest;
                  }
                }
              }
            }
            return (conslist);
          }
        }
      }
      else {
        return (tree);
      }
    }
  }