public static List variablizeInstances(List form, List instances) {
    { Stella_Object bind = null;
      Cons iter000 = instances.theConsList;

      for (;!(iter000 == Stella.NIL); iter000 = iter000.rest) {
        bind = iter000.value;
        { Symbol var = Logic.internLogicSymbol("?X" + Native.stringify(IntegerWrapper.wrapInteger(Logic.$CASE_VARIABLE_COUNTER$)));

          Logic.$CASE_VARIABLE_COUNTER$ = Logic.$CASE_VARIABLE_COUNTER$ + 1;
          Logic.$SYMBOL_VARIABLE_HASH_TABLE$.insertAt(((Symbol)(bind)), var);
          Logic.$SEEN_INSTANCES$.push(((Symbol)(bind)));
          { Cons clause = null;
            Cons iter001 = form.theConsList;

            for (;!(iter001 == Stella.NIL); iter001 = iter001.rest) {
              clause = ((Cons)(iter001.value));
              Stella_Object.substituteConsTree(clause, var, bind);
            }
          }
        }
      }
    }
    return (form);
  }