replace nested if-then-else tree with fake case statement