Clean, 386 375 216 196196 189 bytes
Look ma, no regex!
import StdEnv,Text,Data.List
?[_,'=':b]= $b
?b= $b
$['if(':s]#(h,[_:t])=span((<>)')')s
=h++['?': $t]?t]
$[';else ':s]=[':': $s]?s]
$[a:b]|b>[]=[a: $b]=b
@s=hd[[v,e:replaceSubString[v,e][]($s)]\\['else $s]\\['else ',v,e=:'=':_]<-tails s]