Work statistics and symmetry breaking in an excited-state quantum phase transition