Better replace strategy

Very cryptic but it works, generated using Wolfram Alpha. (http://www.wolframalpha.com/input/?i=%28A+%26+B+%26+C%29|%28A+%26+!B%29|%28!A+%26+!B+%26+C%29)
Only 5 boolean operations and the ASM code is very smaller (after profiling).