One option is the relooper [1][2] which is used in emscripten. It recreates high-level control structures as best it can, then falls back to a helper variable when it can't. Another option is node-splitting, where irreducible control flow is solved by duplicating code (but that has a bad worst-case code size increase).
[1] http://dl.acm.org/citation.cfm?doid=2048147.2048224
[2] https://github.com/kripken/emscripten-fastcomp/blob/master/l...