private static @Nullable LoopModel from(List<PsiStatement> statements, int count, boolean mayTrimTail) {
      int size = statements.size();
      List<PsiExpression> expressionsToReplace = new ArrayList<>();
      List<PsiExpression> expressionsToIterate = new ArrayList<>();
      int offset;
      for (offset = count; offset + count <= size; offset += count) {
        if (!tryConsumeIteration(statements, count, offset, expressionsToReplace, expressionsToIterate)) {
          if (!mayTrimTail || offset == count) return null;
          break;
        }
      }
      statements = statements.subList(0, offset);
      PsiType type = expressionsToIterate.isEmpty() ? null : expressionsToIterate.get(0).getType();
      return new LoopModel(expressionsToIterate, expressionsToReplace, statements, count, type);
    }
private static @Nullable LoopModel from(List<PsiStatement> statements, int count, boolean mayTrimTail)