Guiding code analysis and generation with probabilistic constraints