code: private int findBacktrackPosition(final int position) {
          int currentPosition = position;
  
          // check against stack size after the instruction was executed
          while (stackSizes.get(currentPosition).getRight() > 0) {
              currentPosition++;
          }
  
          return currentPosition;
      }
docs: Returns the next position where the stack will be empty.
  
  @param position The current position
  @return The next empty position