Several new optimizations that give better translations for pattern matches