core: equal2_p: Add short-circuit and eliminate tail call.