code: private void select_sort_split(int p, int n) {
          int pa, pb, pi, pn;
          int f, v;
  
          pa = p; /* pa is start of group being picked out. */
          pn = p + n - 1; /* pn is last position of subarray. */
          while (pa < pn) {
              for (pi = pb = pa + 1, f = KEY(pa); pi <= pn; ++pi)
                  if ((v = KEY(pi)) < f) {
                      f = v; /* f is smallest key found. */
                      SWAP(pi, pa); /* place smallest element at beginning. */
                      pb = pa + 1; /* pb is position for elements equal to f. */
                  } else if (v == f) { /* if equal to smallest key. */
                      SWAP(pi, pb); /* place next to other smallest elements. */
                      ++pb;
                  }
              update_group(pa, pb - 1); /* update group values for new group. */
              pa = pb; /* continue sorting rest of the subarray. */
          }
          if (pa == pn) { /* check if last part is single element. */
              V[start + I[pa]] = pa;
              I[pa] = -1; /* sorted group. */
          }
      }
docs: Quadratic sorting method to use for small subarrays. To be able to update group
  numbers consistently, a variant of selection sorting is used.