private static boolean replaceObjObjValue(@Nonnull InsnList instructions,
	                                          @Nonnull AbstractInsnNode stackValueProducerInsnA,
	                                          @Nonnull AbstractInsnNode stackValueProducerInsnB,
	                                          @Nonnull ReValue stackTopValueA,
	                                          @Nonnull ReValue stackTopValueB,
	                                          @Nonnull JumpInsnNode jump,
	                                          @Nonnull BiPredicate<ObjectValue, ObjectValue> gotoCondition,
	                                          @Nonnull BiPredicate<ObjectValue, ObjectValue> fallCondition) {
		if (stackTopValueA instanceof ObjectValue objValueA && stackTopValueB instanceof ObjectValue objValueB) {
			// Objects are a bit more complicated than primitives, so we have separate checks for replacing as a goto
			// versus a fallthrough case. Additionally, if neither conditions pass we must be in a state where the values
			// are technically known, but not well enough to the point where we can make a decision.
			AbstractInsnNode replacement = gotoCondition.test(objValueA, objValueB) ? new JumpInsnNode(GOTO, jump.label) : null;
			if (replacement == null) replacement = fallCondition.test(objValueA, objValueB) ? new InsnNode(NOP) : null;
			if (replacement == null) return false;
			instructions.set(jump, replacement);
			instructions.set(stackValueProducerInsnA, new InsnNode(NOP));
			instructions.set(stackValueProducerInsnB, new InsnNode(NOP));
			return true;
		}
		return false;
	}
A transformer that folds opaque predicates into single-path control flows.

@author Matt Coley
recaf-core/src/main/java/software/coley/recaf/services/deobfuscation/transform/generic/OpaquePredicateFoldingTransformer.java