Transformation of outer loop.

TODO:
  * Generate fresh variable logic for every loop.
  * Inner loop logic