/Engine/Source/Runtime/Engine/Classes/Animation/AnimNode_StateMachine.h
Finds the highest priority valid transition, information pass via the OutPotentialTransition variable. OutVisitedStateIndices will let you know what states were checked, but is also used to make sure we don't get stuck in an infinite loop or recheck states
bool FindValidTransition ( const [FAnimationUpdateContext](API\Runtime\Engine\Animation\FAnimationUpdateContext) & Context, const [FBakedAnimationState](API\Runtime\Engine\Animation\FBakedAnimationState) & StateInfo, [FAnimationPotentialTransition](API\Runtime\Engine\Animation\FAnimationPotentialTransition) & OutPotentialTransition, [TArray](API\Runtime\Core\Containers\TArray)< int32, TInlineAllocator< 4 >> & OutVisitedStateIndices )