code: private void ssInsertionSort(int PA, int first, int last, int depth) {
          // PA, first, last are pointers in SA
          int i, j;// pointers in SA
          int t, r;
  
          for (i = last - 2; first <= i; --i) {
              for (t = SA[i], j = i + 1; 0 < (r = ssCompare(PA + t, PA + SA[j], depth)); ) {
                  do {
                      SA[j - 1] = SA[j];
                  }
                  while ((++j < last) && (SA[j] < 0));
                  if (last <= j) {
                      break;
                  }
              }
              if (r == 0) {
                  SA[j] = ~SA[j];
              }
              SA[j - 1] = t;
          }
  
      }
docs: Insertionsort for small size groups