Extract branch conversion to its own function.