public static void optimizeOrderingOfConjuncts(Proposition andproposition) {
    { List initiallyclosedgoals = List.newList();
      List opengoals = List.newList();
      List goalsequence = List.newList();

      { Stella_Object g = null;
        Vector vector000 = andproposition.arguments;
        int index000 = 0;
        int length000 = vector000.length();

        for (;index000 < length000; index000 = index000 + 1) {
          g = (vector000.theArray)[index000];
          if (Proposition.allArgumentsBoundP(((Proposition)(g)))) {
            initiallyclosedgoals.insert(((Proposition)(g)));
          }
          else if (Proposition.hasDisjunctionP(((Proposition)(g))) ||
              (((Proposition)(g)).kind == Logic.KWD_FORALL)) {
            ((QueryIterator)(Logic.$QUERYITERATOR$.get())).residueGoals().insert(((Proposition)(g)));
          }
          else {
            opengoals.insert(((Proposition)(g)));
          }
        }
      }
      { Proposition goal = null;
        Cons iter000 = opengoals.theConsList;

        for (;!(iter000 == Stella.NIL); iter000 = iter000.rest) {
          goal = ((Proposition)(iter000.value));
          Proposition.distributeOpenGoal(goal);
        }
      }
      { Proposition g = null;
        Cons iter001 = opengoals.theConsList;

        for (;!(iter001 == Stella.NIL); iter001 = iter001.rest) {
          g = ((Proposition)(iter001.value));
          { boolean foundP000 = false;

            { Stella_Object arg = null;
              Vector vector001 = g.arguments;
              int index001 = 0;
              int length001 = vector001.length();

              loop003 : for (;index001 < length001; index001 = index001 + 1) {
                arg = (vector001.theArray)[index001];
                if (Logic.argumentBoundP(arg)) {
                  foundP000 = true;
                  break loop003;
                }
              }
            }
            if (foundP000) {
              Proposition.propagateSingleValuedConstraints(g, goalsequence);
            }
          }
        }
      }
      Proposition.computeOpenGoalOrdering(andproposition, opengoals, goalsequence);
      Proposition.reorderGoals(andproposition, initiallyclosedgoals.reverse(), ((QueryIterator)(Logic.$QUERYITERATOR$.get())).bestGoalSequence().reverse(), ((QueryIterator)(Logic.$QUERYITERATOR$.get())).residueGoals());
      if ((Stella.$TRACED_KEYWORDS$ != null) &&
          Stella.$TRACED_KEYWORDS$.membP(Logic.KWD_OPTIMIZER)) {
        System.out.println("Optimized goal: " + andproposition);
      }
    }
  }