code: private void reusePreviouslyUsedVariableMap(SortedSet<Assignment> varsToRename) {
      // If prevUsedRenameMap had duplicate values then this pass would be
      // non-deterministic.
      // In such a case, the following will throw an IllegalArgumentException.
      checkNotNull(prevUsedRenameMap.getNewNameToOriginalNameMap());
      for (Assignment a : varsToRename) {
        String prevNewName = prevUsedRenameMap.lookupNewName(a.oldName);
        if (prevNewName == null || reservedNames.contains(prevNewName)) {
          continue;
        }
  
        if (a.isLocal
            || (!externNames.contains(a.oldName)
                && prevNewName.startsWith(prefix))) {
          reservedNames.add(prevNewName);
          finalizeNameAssignment(a, prevNewName);
        }
      }
    }
docs: Runs through the assignments and reuses as many names as possible from the previously used
  variable map. Updates reservedNames with the set of names that were reused.