First version of loop splitting