Replace an if expression by guards.