Reorder if-clauses to make more probable branches go first