function forEachPairOfNewAndLegacyPhrase(
  newPhrases,
  legacyPhrases,
  matchedPhraseCallback /*: (newPhrase, legacyPhrase) => void */,
  addedPhraseCallback /*: (newPhrase, legacyPhrase) => void */,
  removedPhraseCallback /*: (newPhrase, legacyPhrase) => void */,
) /*: void */ {
  const sortedNewPhrases = newPhrases.sort(comparePhrases);
  const sortedLegacyPhrases = legacyPhrases.sort(comparePhrases);
  for (
    let legacyPointer = 0, newPointer = 0;
    legacyPointer < sortedLegacyPhrases.length &&
    newPointer < sortedNewPhrases.length;

  ) {
    const legacyPhrase = sortedLegacyPhrases[legacyPointer];
    const newPhrase = sortedNewPhrases[newPointer];
    const comparison = comparePhrases(newPhrase, legacyPhrase);
    if (comparison === 0) {
      matchedPhraseCallback(newPhrase, legacyPhrase);
      legacyPointer++;
      newPointer++;
    } else if (comparison < 0) {
      addedPhraseCallback(newPhrase, legacyPhrase);
      newPointer++;
    } else {
      removedPhraseCallback(newPhrase, legacyPhrase);
      legacyPointer++;
    }
  }
}
Match new and legacy phrase and run `callback` on each pair of matched phrases