The first function call in the main loop of the collision detection code goes to a function that handles sprites that were hit by the player's magic shortly before the current sprite update. The code of that function is located between the offsets $8151 and $81A6.
The first sprite array that's accessed right in the first line should be familiar. It's already been used in the main loop to determine if the function at $8151 should be called or not. It contains the ID of the magic the sprite was hit by. As only three (Deluge, Thunder, Fire) of the five different kinds of magic throw the enemy back only these three types need to be handled in this function.
Afterwards the three relevant kinds of magic are handled. Deluge comes first (Magic ID: 0), then comes Thunder (Magic ID: 1) and at the end the code for the Fire magic (Magic ID: 2) follows. Deluge pushes the enemy back by 3 pixels, Thunder by 2 and Fire pushes the enemy back as far as possible (until a wall comes or the edge of a screen was reached).
The array between $33C and $343 contains other information that is relevant for moving the enemy. The bytes there contain a counter that's initialized with a certain value when a sprite is hit by magic and decreases by one every time the $8151 function is called. Practically speaking it's a counter for how often this function should be called (at least for Deluge and Thunder). That means that Deluge actually moves the enemy by Counter times 3 pixels and Thunder moves the enemy by Counter times 2 pixels.