public static void reorderGoals(Proposition andproposition, List initiallyclosedgoals, List goalsequence, List residuegoals) {
    { Vector arguments = andproposition.arguments;
      int originalnumberofarguments = arguments.length();
      int index = 0;

      { Proposition g = null;
        Cons iter000 = initiallyclosedgoals.theConsList;

        for (;!(iter000 == Stella.NIL); iter000 = iter000.rest) {
          g = ((Proposition)(iter000.value));
          (arguments.theArray)[index] = g;
          index = index + 1;
        }
      }
      { Proposition g = null;
        Cons iter001 = goalsequence.theConsList;

        for (;!(iter001 == Stella.NIL); iter001 = iter001.rest) {
          g = ((Proposition)(iter001.value));
          residuegoals.remove(g);
          (arguments.theArray)[index] = g;
          index = index + 1;
        }
      }
      { Proposition g = null;
        Cons iter002 = residuegoals.theConsList;

        for (;!(iter002 == Stella.NIL); iter002 = iter002.rest) {
          g = ((Proposition)(iter002.value));
          (arguments.theArray)[index] = g;
          index = index + 1;
        }
      }
      if (index < originalnumberofarguments) {
        andproposition.arguments = Vector.newVector(index);
        { Stella_Object arg = null;
          Vector vector000 = arguments;
          int index000 = 0;
          int length000 = vector000.length();
          int i = Stella.NULL_INTEGER;
          int iter003 = 0;
          int upperBound000 = index - 1;

          for (;(index000 < length000) &&
                    (iter003 <= upperBound000); index000 = index000 + 1, iter003 = iter003 + 1) {
            arg = (vector000.theArray)[index000];
            i = iter003;
            (andproposition.arguments.theArray)[i] = arg;
          }
        }
      }
    }
  }