Refactored control flow optimization to use TargetValue.asInt().