Safely generate names.

During the analysis pass, collect all identifiers in the function.
When generating names, do not generate a name that clashes with an
existing identifier.

Use a separate name counter per base name.

Run the analysis on a per-function instead of per-file basis.