[IR] Make unboxing analysis a bit more robust and work with closures

* Some cleanup and additional removal of hacks.
* Run analysis on closures as well and make it safe to run on
  scopes with closures.
* Analysis now works correctly on loop-based and closure-based
  versions of mandelbrot (type-guards are still missing). Some
  more tweaks are required for the closure version to get rid of
  some spurious boxing instructions.