After Melchior tells you about an ancient rock that could be used to repair the Masamune, you should go to the past.
Go to the Past
Go back to the gate in the imps' closet and head to the End of Time. Use the pillar to Mystic Mountain, 65,000,000 B.C.
Beat the Reptites. Then meet a new character (default: Ayla). Follow her to the next area.
Open the chest on the way (Berserker). Use Lightning on the dinosaurs to weaken them, then regular attacks.
Out on the world map, check out the huts. In one, a woman will give you "sweet water" which replenishes your HP/MP.
Go to the Chief's Hut and talk to Ayla.
At the party, talk to your friends and Ayla a few times, and eventually the soup-eating contest begins.
In the morning, wake up Ayla.