code: function findMatchIndexes(compareFn, a,b, divergenceIndexA,divergenceIndexB, aSubMin, bSubMin) {
      var maxNForA = divergenceIndexA-aSubMin
      var maxNForB = divergenceIndexB-bSubMin
      var maxN = Math.max(maxNForA, maxNForB)
      for(var n=1; n<=maxN; n++) {
          var newestA = a[divergenceIndexA-n] // the current item farthest from the divergence index being compared
          var newestB = b[divergenceIndexB-n]
  
          if(n<=maxNForB && n<=maxNForA && compareFn(newestA, newestB)) {
              return {a:divergenceIndexA-n, b:divergenceIndexB-n}
          }
  
          for(var j=0; j<n; j++) {
              var elemA = a[divergenceIndexA-j] // an element between the divergence index and the newest items
              var elemB = b[divergenceIndexB-j]
  
              if(n<=maxNForB && compareFn(elemA, newestB)) {
                  return {a:divergenceIndexA-j, b:divergenceIndexB-n}
              } else if(n<=maxNForA && compareFn(newestA, elemB)) {
                  return {a:divergenceIndexA-n, b:divergenceIndexB-j}
              }
          }
      }
      // else
      return {a: aSubMin-1, b: bSubMin-1}
  }
docs: finds and returns the closest indexes in a and b that match starting with divergenceIndex note: loops backwards like the rest of this stuff returns the index beyond the first element (aSubMin-1 or bSubMin-1) for each if there is no match parameters: compareFn - determines what matches (returns true if the arguments match) a,b - two arrays to compare divergenceIndexA,divergenceIndexB - the two positions of a and b to start comparing from aSubMin,bSubMin - the two positions to compare until