What native does in this case is to create a structure like
if (!broken) body; if (!broken) body; if (!broken) body;
which is well and good, but can't exactly be constructed through incremental and independent lowering like I was proposing. So we will indeed need to construct this manually.
If the only problem is ending up with a "chained" rather than "nested" structure to avoid hitting some depth limit, wouldn't it be simpler to add another pass that converts from one to the other? I didn't think this through (and I haven't read the MR yet), but superficially it doesn't look too hard. I guess that a nested unrolling of a loop would look like this: ```c bool broken = false; // loop body, which might set broken if (!broken) { // loop body, which might set broken if (!broken) { // etc } } ``` We could run all the optimization on this structure, which is more conducive to copy propagation (because we're not polluting the control flow with variables that would have to be tracked). Then, for as long as trailing constructs like `if (!broken)` exist, we move them out of the outer selection construct. This looks sound to do. It would become: ```c bool broken = false; // loop body if (!broken) { // loop body } if (!broken) { // etc } ```