function skipDeadEnd(vertices, deadEnd, indices, maximumIndexPlusOne) {
    while (deadEnd.length >= 1) {
      // while the stack is not empty
      const d = deadEnd[deadEnd.length - 1]; // top of the stack
      deadEnd.splice(deadEnd.length - 1, 1); // pop the stack

      if (vertices[d].numLiveTriangles > 0) {
        return d;
      }
    }

    while (cursor < maximumIndexPlusOne) {
      if (vertices[cursor].numLiveTriangles > 0) {
        ++cursor;
        return cursor - 1;
      }
      ++cursor;
    }
    return -1;
  }
Optimizes triangles for the post-vertex shader cache.

@param {object} options Object with the following properties:
@param {number[]} options.indices Lists triads of numbers corresponding to the indices of the vertices
                       in the vertex buffer that define the geometry's triangles.
@param {number} [options.maximumIndex] The maximum value of the elements in <code>args.indices</code>.
                                    If not supplied, this value will be computed.
@param {number} [options.cacheSize=24] The number of vertices that can be stored in the cache at any one time.
@returns {number[]} A list of the input indices in an optimized order.

@exception {DeveloperError} indices length must be a multiple of three.
@exception {DeveloperError} cacheSize must be greater than two.

@example
const indices = [0, 1, 2, 3, 4, 5];
const maxIndex = 5;
const cacheSize = 3;
const reorderedIndices = Cesium.Tipsify.tipsify({indices : indices, maxIndex : maxIndex, cacheSize : cacheSize});