how is the energy of star produced