This is such a wide-open scenario that it's actually not even possible to accurately predict the outcome. Yes, a lot would depend on the skill of your lawyer, I'd say even more depends on your local prosecutor and how he feels about it.
Most states do NOT want you getting involved in that situation. On one (sympathetic) hand, nobody wants to see someone else taking a beating. But the reality is that you literally have no idea, none, ZERO, what the situation is. None whatsoever.
Your best bet in that situation, if you REALLY want to keep someone from taking a further beating immediately, is to try to verbally stop the incident. And the safest way for you to keep from being prosecuted and yet still stop the beating would be if the threat gets re-directed to YOU before you start shooting. And any witnesses who perceived that you escalated the situation in any way that led to a shooting will only be harmful to your freedom.
If it's your child, your wife, your date, totally different when you act on their behalf. Two strangers? There's not much law that provides for you to swoop in and get involved. Especially if there isn't a weapon involved other than fists. Escalation of force is strictly defined in each state. You can find yourself in trouble for shooting someone even if they have punched you in many situations.
You may not like it, you might not think it's right, you may put more value on someone else's life and good health than the law does, but that's just how it is and you either accept it or you take one helluva personal risk.
Life isn't fair, and if you aren't a sworn officer of the law then you will be wide, WIDE open to trouble if/when you intervene. Even if you are cleared in the end, the monetary costs and time/trouble is so catastrophic that you'd have a hard time assessing a value to it.
Attention Brass rats and other reloaders: I really need .327 Federal Magnum brass, no lot size too small. Tell me what caliber you need and I'll see what I have to swap. PM me and we'll discuss.