public static KeyValueList collectKeyValueList(Stella_Object tree) {
    if (Stella_Object.safePrimaryType(tree) == Stella.SGT_STELLA_CONS) {
      { Cons tree000 = ((Cons)(tree));

        { int length = tree000.length();
          Cons cursor = tree000;
          Stella_Object key = null;
          Stella_Object value = null;
          KeyValueList result = null;

          if (length == 0) {
            return (null);
          }
          if (((length % 2) == 1)) {
            { Object old$PrintreadablyP$000 = Stella.$PRINTREADABLYp$.get();

              try {
                Native.setBooleanSpecial(Stella.$PRINTREADABLYp$, true);
                Stella.signalTranslationError();
                if (!(Stella.suppressWarningsP())) {
                  Stella.printErrorContext(">> ERROR: ", Stella.STANDARD_ERROR);
                  {
                    Stella.STANDARD_ERROR.nativeStream.println();
                    Stella.STANDARD_ERROR.nativeStream.println(" Unbalanced keys and values in key-value list: `" + Stella_Object.deUglifyParseTree(tree000) + "'.");
                  }
;
                }

              } finally {
                Stella.$PRINTREADABLYp$.set(old$PrintreadablyP$000);
              }
            }
            return (null);
          }
          result = KeyValueList.newKeyValueList();
          loop000 : while (!(cursor == Stella.NIL)) {
            key = cursor.value;
            value = cursor.rest.value;
            cursor = cursor.rest.rest;
            if (!Stella_Object.isaP(key, Stella.SGT_STELLA_GENERALIZED_SYMBOL)) {
              { Object old$PrintreadablyP$001 = Stella.$PRINTREADABLYp$.get();

                try {
                  Native.setBooleanSpecial(Stella.$PRINTREADABLYp$, true);
                  Stella.signalTranslationError();
                  if (!(Stella.suppressWarningsP())) {
                    Stella.printErrorContext(">> ERROR: ", Stella.STANDARD_ERROR);
                    {
                      Stella.STANDARD_ERROR.nativeStream.println();
                      Stella.STANDARD_ERROR.nativeStream.println(" Ignoring illegal key `" + Stella_Object.deUglifyParseTree(key) + "' in key-value list: `" + Stella_Object.deUglifyParseTree(tree000) + "'.");
                    }
;
                  }

                } finally {
                  Stella.$PRINTREADABLYp$.set(old$PrintreadablyP$001);
                }
              }
              continue loop000;
            }
            if ((value == Stella.SYM_STELLA_TRUE) ||
                (value == Stella.SYM_STELLA_FALSE)) {
              value = Stella_Object.coerceToBoolean(value);
            }
            else {
              value = Stella_Object.permanentCopy(value);
            }
            result.insertAt(key.permanentify(), value);
          }
          return (result);
        }
      }
    }
    else {
      { Object old$PrintreadablyP$002 = Stella.$PRINTREADABLYp$.get();

        try {
          Native.setBooleanSpecial(Stella.$PRINTREADABLYp$, true);
          Stella.signalTranslationError();
          if (!(Stella.suppressWarningsP())) {
            Stella.printErrorContext(">> ERROR: ", Stella.STANDARD_ERROR);
            {
              Stella.STANDARD_ERROR.nativeStream.println();
              Stella.STANDARD_ERROR.nativeStream.println(" Illegal atomic key-value list: `" + Stella_Object.deUglifyParseTree(tree) + "'.");
            }
;
          }

        } finally {
          Stella.$PRINTREADABLYp$.set(old$PrintreadablyP$002);
        }
      }
      return (null);
    }
  }