Recode if-branches with smooth functions