Preparation of arbitrary quantum states with regular P functions