Loop phase which converts for and while loops to while loops