I guess I would have three rules. Rule ONE which has A as it's input and temp(B) as it's output. And rule TWO and THREE which has B as it's input and C and D as it's output.
Would this make sense. Or is this what you have? Otherwise, could you post a minimal example?