I'll hold off posting the assembly because I have a ton of half finished analysis notes in it. For reference, the routine I am looking at is approx 03:AD67 through 03:B0AD. By the time it's called, a partial AI sequence is available around $3659 or above, depending on the monster index. By partial, I mean it is cut off at the next Chain Divider (FB) or a few others, I imagine FC,FE,FF.
Also interesting to point out that the caster's action, subaction, and target bits have already been set, based on that partial sequence, even though the sequence has not yet been executed. For simple monsters, they'll already have C0 and a random target picked. For AI with a target instruction, it will have run and set the target. If the target failed, the partial sequence is modified to replace the main action with an E1 and store a zero for their target. I think that is why the routine in question does not re-target.