Probabilistic branching in a stan framework

I am trying to program probabilistic branching in a stan framework.
I want to generate a sample from a distribution, then take actions based on the sign of this sample like in the code below.

// lets assume a and b are derived from data
mu ~ uniform(-10,10)
sigma ~ normal(2,1)
// d : generate sample from normal(mu, sigma)
d = normal_rng(mu, sigma)

if (d<0) {
    s ~ normal(a, b) 
if (d > 0) {
    s ~ normal(a,b) + exponential(d)

Please guide me on the possibility of doing this in stan.

You can’t call normal_rng (or any other _rng) function in the parameters, transformed parameters, or model blocks of a Stan program. Even if you could, the sampler would not perform well to the discontinuity. You presumably would need to reformulate your model as a mixture over d. See