Alternatively, you could make a function that (clearly) breaks under optimization at a certain point, and then stop optimizing it once it breaks.
Alternatively, you could make a function that (clearly) breaks under optimization at a certain point, and then stop optimizing it once it breaks.