Sequential Optimization of Asynchronous and Synchronous Finite-State Machines: Algorithms and Tools