Get occurrences for loops with 'break'/'continue' statements

This is an `undefined`-propagating helper function that's used quite a bit above.