If the engine is indeed shot, one thing you may do rather than buy an
engine from a wrecking yard is to find another Subaru that has a bad
tranny, or is wrecked in such a way that the engine is not harmed. If
you are in or near a fairly large city, something may show up on
Craigslist for a lot less that a wrecking yard would get for an engine.
First, ask the mechanic what he would charge to pull the engine out and
put it in yours, and the years and models of Subaru which would have the
same engine. I see stuff like this all the time on CL, for $200-300,
often with nearly new tires or other major parts that are nearly new.
Besides the engine, keep whatever else is in good shape and you think
you may use in the future, and sell the rest for scrap metal. Larry