Scalable don't-care-based logic optimization and resynthesis