public static Cons helpTransformBooleanProceduralExpression(Stella_Object expression, Symbol testvariable) {
    if ((!Stella_Object.consP(expression)) ||
        (!Stella_Object.proceduralExpressionP(expression))) {
      return (Cons.cons(Cons.list$(Cons.cons(Stella.SYM_STELLA_SETQ, Cons.cons(testvariable, Cons.cons(Cons.cons(expression, Stella.NIL), Stella.NIL)))), Stella.NIL));
    }
    { Cons exp = ((Cons)(expression));
      Stella_Object operator = exp.value;
      Stella_Object firstarg = exp.rest.value;
      Cons otherargs = exp.rest.rest;

      { GeneralizedSymbol testValue000 = ((GeneralizedSymbol)(operator));

        if (testValue000 == Stella.SYM_STELLA_AND) {
          if (otherargs == Stella.NIL) {
            return (Stella_Object.helpTransformBooleanProceduralExpression(firstarg, testvariable));
          }
          else if (Stella_Object.proceduralExpressionP(firstarg)) {
            return (Stella_Object.helpTransformBooleanProceduralExpression(firstarg, testvariable).concatenate(Cons.cons(Cons.list$(Cons.cons(Stella.SYM_STELLA_WHEN, Cons.cons(testvariable, Cons.cons(Stella_Object.helpTransformBooleanProceduralExpression(Cons.cons(Stella.SYM_STELLA_AND, otherargs.concatenate(Stella.NIL, Stella.NIL)), testvariable).concatenate(Stella.NIL, Stella.NIL), Stella.NIL)))), Stella.NIL), Stella.NIL));
          }
          else {
            return (Cons.list$(Cons.cons(Cons.list$(Cons.cons(Stella.SYM_STELLA_SETQ, Cons.cons(testvariable, Cons.cons(Cons.cons(firstarg, Stella.NIL), Stella.NIL)))), Cons.cons(Cons.list$(Cons.cons(Stella.SYM_STELLA_WHEN, Cons.cons(testvariable, Cons.cons(Stella_Object.helpTransformBooleanProceduralExpression(Cons.cons(Stella.SYM_STELLA_AND, otherargs.concatenate(Stella.NIL, Stella.NIL)), testvariable).concatenate(Stella.NIL, Stella.NIL), Stella.NIL)))), Cons.cons(Stella.NIL, Stella.NIL)))));
          }
        }
        else if (testValue000 == Stella.SYM_STELLA_OR) {
          if (otherargs == Stella.NIL) {
            return (Stella_Object.helpTransformBooleanProceduralExpression(firstarg, testvariable));
          }
          else if (Stella_Object.proceduralExpressionP(firstarg)) {
            return (Stella_Object.helpTransformBooleanProceduralExpression(firstarg, testvariable).concatenate(Cons.cons(Cons.list$(Cons.cons(Stella.SYM_STELLA_WHEN, Cons.cons(Cons.list$(Cons.cons(Stella.SYM_STELLA_NOT, Cons.cons(testvariable, Cons.cons(Stella.NIL, Stella.NIL)))), Cons.cons(Stella_Object.helpTransformBooleanProceduralExpression(Cons.cons(Stella.SYM_STELLA_OR, otherargs.concatenate(Stella.NIL, Stella.NIL)), testvariable).concatenate(Stella.NIL, Stella.NIL), Stella.NIL)))), Stella.NIL), Stella.NIL));
          }
          else {
            { Cons otherargstest = Stella_Object.helpTransformBooleanProceduralExpression(Cons.cons(Stella.SYM_STELLA_OR, otherargs.concatenate(Stella.NIL, Stella.NIL)), testvariable);

              if (!(otherargstest.rest == Stella.NIL)) {
                otherargstest = Cons.cons(Cons.cons(Stella.SYM_STELLA_PROGN, otherargstest.concatenate(Stella.NIL, Stella.NIL)), Stella.NIL);
              }
              return (Cons.cons(Cons.list$(Cons.cons(Stella.SYM_STELLA_IF, Cons.cons(firstarg, Cons.cons(Cons.cons(Cons.list$(Cons.cons(Stella.SYM_STELLA_SETQ, Cons.cons(testvariable, Cons.cons(Cons.cons(Stella.SYM_STELLA_TRUE, Stella.NIL), Stella.NIL)))), otherargstest.concatenate(Stella.NIL, Stella.NIL)), Stella.NIL)))), Stella.NIL));
            }
          }
        }
        else if (testValue000 == Stella.SYM_STELLA_NOT) {
          return (Stella_Object.helpTransformBooleanProceduralExpression(firstarg, testvariable).concatenate(Cons.cons(Cons.list$(Cons.cons(Stella.SYM_STELLA_SETQ, Cons.cons(testvariable, Cons.cons(Cons.cons(Cons.list$(Cons.cons(Stella.SYM_STELLA_NOT, Cons.cons(testvariable, Cons.cons(Stella.NIL, Stella.NIL)))), Stella.NIL), Stella.NIL)))), Stella.NIL), Stella.NIL));
        }
        else if (testValue000 == Stella.SYM_STELLA_VRLET) {
          { Cons cursor = otherargs;

            while (!(cursor.rest == Stella.NIL)) {
              cursor = cursor.rest;
            }
            cursor.value = Cons.list$(Cons.cons(Stella.SYM_STELLA_SETQ, Cons.cons(testvariable, Cons.cons(Cons.cons(cursor.value, Stella.NIL), Stella.NIL))));
          }
          return (Cons.cons(Cons.list$(Cons.cons(Stella.SYM_STELLA_LET, Cons.cons(firstarg, Cons.cons(otherargs.concatenate(Stella.NIL, Stella.NIL), Stella.NIL)))), Stella.NIL));
        }
        else {
          { OutputStringStream stream000 = OutputStringStream.newOutputStringStream();

            stream000.nativeStream.print("`" + testValue000 + "' is not a valid case option");
            throw ((StellaException)(StellaException.newStellaException(stream000.theStringReader()).fillInStackTrace()));
          }
        }
      }
    }
  }