A fast simultaneous input vector generation and gate replacement algorithm for leakage power reduction