public static void collectPatternQueryBindings(ControlFrame frame) {
    { PatternRecord patternrecord = frame.patternRecord;
      Vector iovariables = patternrecord.optimalPattern.ioVariables;
      Cons iovariablevalues = Stella.NIL;

      { PatternVariable v = null;
        Vector vector000 = iovariables;
        int index000 = 0;
        int length000 = vector000.length();
        Cons collect000 = null;

        for (;index000 < length000; index000 = index000 + 1) {
          v = ((PatternVariable)((vector000.theArray)[index000]));
          if (collect000 == null) {
            {
              collect000 = Cons.cons((((QueryIterator)(Logic.$QUERYITERATOR$.get())).currentPatternRecord.variableBindings.theArray)[(v.boundToOffset)], Stella.NIL);
              if (iovariablevalues == Stella.NIL) {
                iovariablevalues = collect000;
              }
              else {
                Cons.addConsToEndOfConsList(iovariablevalues, collect000);
              }
            }
          }
          else {
            {
              collect000.rest = Cons.cons((((QueryIterator)(Logic.$QUERYITERATOR$.get())).currentPatternRecord.variableBindings.theArray)[(v.boundToOffset)], Stella.NIL);
              collect000 = collect000.rest;
            }
          }
        }
      }
      switch (iovariablevalues.length()) {
        case 1: 
          if (iovariablevalues.value == null) {
            Stella.STANDARD_WARNING.nativeStream.println("Warning: Pushing NULL binding onto collection.  Variable= `" + ((PatternVariable)((iovariables.theArray)[0])) + "'");
            return;
          }
          patternrecord.collectionList.push(iovariablevalues.value);
        break;
        default:
          patternrecord.collectionList.push(iovariablevalues);
        break;
      }
    }
  }