Algorithmic improvements to conflict handling.

Time to run single_test.py on all the headers improved from ~60s to ~30s.
Also, conflicts are properly annotated per-mode in the output, and deduplicated.