public static Cons yieldOptimizedInCursorClausesForIntegerInterval(Cons collectiontree, StandardObject collectiontype, Symbol keyvar, Symbol valuevar, Object [] MV_returnarray) {
    {
      collectiontype = collectiontype;
      keyvar = keyvar;
    }
    { Stella_Object upperbound = collectiontree.rest.rest.value;
      boolean unboundedP = (upperbound == Stella.SYM_STELLA_NULL) ||
          (upperbound == Stella.SYM_STELLA_NULL_INTEGER);
      Symbol iteratorvar = valuevar;
      Symbol upperboundvar = null;
      Symbol testoperator = Stella.SYM_STELLA_le;

      if (!(unboundedP)) {
        if (Stella_Object.consP(upperbound)) {
          { Cons ub = ((Cons)(upperbound));

            if ((ub.value == Stella.SYM_STELLA_1_) ||
                ((ub.value == Stella.SYM_STELLA__) &&
                 (Stella_Object.eqlP(ub.rest.value, Stella.ONE_WRAPPER) &&
                  (ub.rest.rest.rest == Stella.NIL)))) {
              upperbound = ub.rest.value;
              testoperator = Stella.SYM_STELLA_l;
            }
          }
        }
        upperbound = Stella_Object.sysTree(Stella_Object.walkExpressionTree(upperbound, Stella.SGT_STELLA_INTEGER, Stella.SYM_STELLA_FOREACH, false, new Object[1]), Stella.SGT_STELLA_INTEGER, new Object[1]);
        if (!(Stella_Object.atomicExpressionP(upperbound))) {
          upperboundvar = Stella.localGensym("UPPER-BOUND");
        }
      }
      { Cons _return_temp = Cons.cons(Cons.cons(iteratorvar, Cons.list$(Cons.cons(Stella.SGT_STELLA_INTEGER, Cons.cons(collectiontree.rest.value, Cons.cons(Stella.NIL, Stella.NIL))))), (((upperboundvar != null) ? Cons.cons(Cons.cons(upperboundvar, Cons.list$(Cons.cons(Stella.SGT_STELLA_INTEGER, Cons.cons(upperbound, Cons.cons(Stella.NIL, Stella.NIL))))), Stella.NIL) : Stella.NIL)).concatenate(Stella.NIL, Stella.NIL));

        MV_returnarray[0] = Stella.NIL;
        MV_returnarray[1] = Cons.cons(Cons.list$(Cons.cons(Stella.SYM_STELLA_ii, Cons.cons(iteratorvar, Cons.cons(Stella.NIL, Stella.NIL)))), Stella.NIL);
        MV_returnarray[2] = (unboundedP ? ((StandardObject)(Stella.SYM_STELLA_TRUE)) : ((StandardObject)(Cons.cons(testoperator, Cons.cons(iteratorvar, Cons.cons(((upperboundvar != null) ? upperboundvar : upperbound), Stella.NIL))))));
        return (_return_temp);
      }
    }
  }