State oil firms risk wasting $400 billion as energy transition speeds up