Which analysis of خَرَجْتُ مِنَ الْفَصْلِ لِأَشْرَبَ الْمَاءَ is correct?

Kay, Idhan, Hatta and Purpose Li