protected static boolean isRegListSequential(RegisterSpecList list) {
    int sz = list.size();

    if (sz < 2) {
      return true;
    }

    int first = list.get(0).getReg();
    int next = first;

    for (int i = 0; i < sz; i++) {
      RegisterSpec one = list.get(i);
      if (one.getReg() != next) {
        return false;
      }
      next += one.getCategory();
    }

    return true;
  }
Helper method to determine if a list of registers are sequential, including degenerate cases
for empty or single-element lists.

@param list {@code non-null;} the list of registers
@return {@code true} iff the list is sequentially ordered
android/android_framework/dex-maker/src/main/java/com/android/dx/dex/code/InsnFormat.java