Replace `if(..) ... else if(...) ...` with pattern matches