Prepared temporary variables for recursion with no extra memory