docs: private int reduceSubsetChanges(Mode[] mode_type, int[] mode_length, int index_point) {
  
          int totalLength = 0;
          int i, length;
          Mode current, last, next;
  
          for (i = 0; i < index_point; i++) {
              current = mode_type[i];
              length = mode_length[i];
              if (i != 0) {
                  last = mode_type[i - 1];
              } else {
                  last = Mode.NULL;
              }
              if (i != index_point - 1) {
                  next = mode_type[i + 1];
              } else {
                  next = Mode.NULL;
              }
  
              /* ISO 15417 Annex E Note 2 */
              /* Calculate difference between logical length and actual length in this block */
              int extraLength = 0;
              for (int j = 0; j < length - extraLength; j++) {
                  if (length(inputData[totalLength + j], current) == 2) {
                      extraLength++;
                  }
              }
  
              if (i == 0) { /* first block */
                  if ((index_point == 1) && ((length == 2) && (current == Mode.ABORC))) { /* Rule 1a */
                      mode_type[i] = Mode.LATCHC;
                      current = Mode.LATCHC;
                  }
                  if (current == Mode.ABORC) {
                      if (length >= 4) { /* Rule 1b */
                          mode_type[i] = Mode.LATCHC;
                          current = Mode.LATCHC;
                      } else {
                          mode_type[i] = Mode.AORB;
                          current = Mode.AORB;
                      }
                  }
                  if (current == Mode.SHIFTA) { /* Rule 1c */
                      mode_type[i] = Mode.LATCHA;
                      current = Mode.LATCHA;
                  }
                  if ((current == Mode.AORB) && (next == Mode.SHIFTA)) { /* Rule 1c */
                      mode_type[i] = Mode.LATCHA;
                      current = Mode.LATCHA;
                  }
                  if (current == Mode.AORB) { /* Rule 1d */
                      mode_type[i] = Mode.LATCHB;
                      current = Mode.LATCHB;
                  }
              } else {
                  if ((current == Mode.ABORC) && (length >= 4)) { /* Rule 3 */
                      mode_type[i] = Mode.LATCHC;
                      current = Mode.LATCHC;
                  }
                  if (current == Mode.ABORC) {
                      mode_type[i] = Mode.AORB;
                      current = Mode.AORB;
                  }
                  if ((current == Mode.AORB) && (last == Mode.LATCHA)) {
                      mode_type[i] = Mode.LATCHA;
                      current = Mode.LATCHA;
                  }
                  if ((current == Mode.AORB) && (last == Mode.LATCHB)) {
                      mode_type[i] = Mode.LATCHB;
                      current = Mode.LATCHB;
                  }
                  if ((current == Mode.AORB) && (next == Mode.SHIFTA)) {
                      mode_type[i] = Mode.LATCHA;
                      current = Mode.LATCHA;
                  }
                  if ((current == Mode.AORB) && (next == Mode.SHIFTB)) {
                      mode_type[i] = Mode.LATCHB;
                      current = Mode.LATCHB;
                  }
                  if (current == Mode.AORB) {
                      mode_type[i] = Mode.LATCHB;
                      current = Mode.LATCHB;
                  }
                  if ((current == Mode.SHIFTA) && (length > 1)) { /* Rule 4 */
                      mode_type[i] = Mode.LATCHA;
                      current = Mode.LATCHA;
                  }
                  if ((current == Mode.SHIFTB) && (length > 1)) { /* Rule 5 */
                      mode_type[i] = Mode.LATCHB;
                      current = Mode.LATCHB;
                  }
                  if ((current == Mode.SHIFTA) && (last == Mode.LATCHA)) {
                      mode_type[i] = Mode.LATCHA;
                      current = Mode.LATCHA;
                  }
                  if ((current == Mode.SHIFTB) && (last == Mode.LATCHB)) {
                      mode_type[i] = Mode.LATCHB;
                      current = Mode.LATCHB;
                  }
                  if ((current == Mode.SHIFTA) && (next == Mode.AORB)) {
                      mode_type[i] = Mode.LATCHA;
                      current = Mode.LATCHA;
                  }
                  if ((current == Mode.SHIFTB) && (next == Mode.AORB)) {
                      mode_type[i] = Mode.LATCHB;
                      current = Mode.LATCHB;
                  }
                  if ((current == Mode.SHIFTA) && (last == Mode.LATCHC)) {
                      mode_type[i] = Mode.LATCHA;
                      current = Mode.LATCHA;
                  }
                  if ((current == Mode.SHIFTB) && (last == Mode.LATCHC)) {
                      mode_type[i] = Mode.LATCHB;
                      current = Mode.LATCHB;
                  }
              } /* Rule 2 is implemented elsewhere, Rule 6 is implied */
  
              /* ISO 15417 Annex E Note 2 */
              /* Convert logical length back to actual length for this block, now that we've decided on a subset */
              mode_length[i] -= extraLength;
              totalLength += mode_length[i];
          }
  
          return combineSubsetBlocks(mode_type, mode_length, index_point);
      }