Constraint generation for software-based post-silicon bug masking with scalable resynthesis technique for constraint optimizatio