This document describes how Lambda Lifting (LL) works. LL is responsible for transforming 'closures' into (environment, function) pairs.
The basic approach is that captured vars need to be put on the heap and that the calling chain needs to be explicitly modelled. Things to consider:
proc a =
var v = 0