Factorize code to be run on serialized lines

This simplifies running more code after all loops have been
unrolled/serialized.
Handle register aliases after unrolling loops

Register aliases can be set conditionally within loops as well,
so they should be evaluated only once the loops and ifs within
them have been handled.