If you knew it was rape, I think you could first pull the gun and fire a couple of shots in the air. That would probably stop everything and make the crowd run.
If they still kept at it, and you had a clear shot at the perpetrators without endangering the girl, I say shoot them.
Warning shots are a no no and you might end up needing the ammo.
Never, ever fire a warning shot. If you shot the assailant(s), when the cops arrive say you would like to speak with an attorney and say nothing else.
Warning shots are a bad idea for many reasons and are illegal in some states. In court they can be used to claim you weren’t really in any danger.