public static void printQueryResultsCache(int limit) {
    if (limit == Stella.NULL_INTEGER) {
      limit = 100;
    }
    { int count = limit;

      System.out.println("Failed goal cutoffs:    " + Logic.$FAILED_GOAL_CUTOFFS$);
      {
        System.out.println("Succeeded goal cutoffs: " + Logic.$SUCCEEDED_GOAL_CUTOFFS$);
        System.out.println();
      }
;
      System.out.println("Cached failed goals:");
      { AtomicGoalCache cache = null;
        Vector vector000 = Logic.$FAILED_GOALS_CACHE$;
        int index000 = 0;
        int length000 = vector000.length();
        int i = Stella.NULL_INTEGER;
        int iter000 = 0;

        loop000 : for (;index000 < length000; index000 = index000 + 1, iter000 = iter000 + 1) {
          cache = ((AtomicGoalCache)((vector000.theArray)[index000]));
          i = iter000;
          { boolean testValue000 = false;

            testValue000 = cache != null;
            if (testValue000) {
              testValue000 = !cache.proposition.deletedP();
              if (testValue000) {
                testValue000 = !(cache.proposition.operator.symbolId == -1);
                if (testValue000) {
                  { boolean foundP000 = false;

                    { Stella_Object arg = null;
                      Vector vector001 = cache.proposition.arguments;
                      int index001 = 0;
                      int length001 = vector001.length();
                      Stella_Object binding = null;
                      Cons iter001 = cache.bindings;

                      loop001 : for (;(index001 < length001) &&
                                (!(iter001 == Stella.NIL)); index001 = index001 + 1, iter001 = iter001.rest) {
                        arg = (vector001.theArray)[index001];
                        binding = iter001.value;
                        if (arg.deletedP() ||
                            ((binding != null) &&
                             binding.deletedP())) {
                          foundP000 = true;
                          break loop001;
                        }
                      }
                    }
                    testValue000 = foundP000;
                  }
                  testValue000 = !testValue000;
                }
              }
            }
            if (testValue000) {
              if (count <= 0) {
                break loop000;
              }
              System.out.println(i + ": " + cache);
              count = count - 1;
            }
          }
        }
      }
      count = limit;
      {
        System.out.println();
        System.out.println("Cached succeeded goals:");
      }
;
      { AtomicGoalCache cache = null;
        Vector vector002 = Logic.$SUCCEEDED_GOALS_CACHE$;
        int index002 = 0;
        int length002 = vector002.length();
        int i = Stella.NULL_INTEGER;
        int iter002 = 0;

        loop002 : for (;index002 < length002; index002 = index002 + 1, iter002 = iter002 + 1) {
          cache = ((AtomicGoalCache)((vector002.theArray)[index002]));
          i = iter002;
          { boolean testValue001 = false;

            testValue001 = cache != null;
            if (testValue001) {
              testValue001 = !cache.proposition.deletedP();
              if (testValue001) {
                testValue001 = !(cache.proposition.operator.symbolId == -1);
                if (testValue001) {
                  { boolean foundP001 = false;

                    { Stella_Object arg = null;
                      Vector vector003 = cache.proposition.arguments;
                      int index003 = 0;
                      int length003 = vector003.length();
                      Stella_Object binding = null;
                      Cons iter003 = cache.bindings;

                      loop003 : for (;(index003 < length003) &&
                                (!(iter003 == Stella.NIL)); index003 = index003 + 1, iter003 = iter003.rest) {
                        arg = (vector003.theArray)[index003];
                        binding = iter003.value;
                        if (arg.deletedP() ||
                            ((binding != null) &&
                             binding.deletedP())) {
                          foundP001 = true;
                          break loop003;
                        }
                      }
                    }
                    testValue001 = foundP001;
                  }
                  testValue001 = !testValue001;
                }
              }
            }
            if (testValue001) {
              if (count <= 0) {
                break loop002;
              }
              System.out.println(i + ": " + cache);
              count = count - 1;
            }
          }
        }
      }
    }
  }