Efficient generation of spin cat states with twist-and-turn dynamics via machine optimization