Electronic control of the spin–orbit branching ratio in the photodissociation and predissociation of HCl