Darboux coordinates, Yang-Yang functional, and gauge theory