I wonder if you could bootstrap a superoptimizer using the entire body of 6502 code written thus far.
See: Automatic Generation of Peephole Superoptimizers, Sorav Bansal and Alex Aiken, ASPLOS 2006. https://theory.stanford.edu/~aiken/publications/papers/asplo...
My implementation: https://github.com/RussellSprouts/6502-enumerator