There are people applying synthesis techniques to superoptimization. So something like this would possibly apply.