I must say this is a thoughtful discussion...quite unlike many threads on this subject.
I will throw in my $0.02. I am a former naval officer and small arms qualified. I have never owned any firearm of any sort and do not intend to.
I believe first and foremost in prevention...not looking like a target and not showing money or possessions. And avoiding areas where there might be trouble. Having been to some of the worst places on earth for violence...I have no interest in seeing them again.
I also believe in the numbers. Pirate attacks are rare, especially fatal ones. I am much more concerned with the sea and weather. I need to focus on making my boat a safe vessal for passagemaking and will not devote much if any time to pirates.
The issue of having a firearm aboard and dealing with the myriad of local authorities and their whim of the day is most significant. You are simply offering them probable cause to throw you in jail. And in third world countries, you do not have the rights we enjoy here. You could be there a long time, lose your boat etc.
Finally, being in a firefight would be your worst nightmare. If you are attacked by pirates, they get to chose the time and place, they have thought out their strategy and tactics in advance, they have experience in doing this and there will be more of them than you and they will have more firepower.
You can fight off prowlers and petty thieves without firearms.
You will not be able to fight off pirates with any firearm you could bring aboard.
One sad article I read on piracy was a story of a couple cruising. They were approached by a boat they thought to be pirates. The boat came along side and they were talking to the husband. While this was happening, his wife went to the forward hatch
and came out with a gun. They shot her dead in an instant and simply left.