Code generator - cases 1 to 6