Correctly treat remaining factors in optimization

instead of asserting they did not exist.
Generalize optimization to more inputs in mul
Add test for the opt local_dot22_to_dot22scalar
Make local_dot22_to_dot22scalar opt work in one more case.
code cleanup.
Merge pull request #3 from nouiz/lamblin-fix_1507

Add tests and opt one more case.
Merge pull request #1515 from lamblin/fix_1507

Fix in local_dot22_to_dot22scalar