Synthesis of FSMs: logic optimization