I think a few 30mm cannons would be more appropriate there, never likely to get out gunned either and they would likely turn back before they got anywhere near the ship.
edit: better still if it was a 30mm gattling cannon...
No, no no. To deal with pirates (or just about any other surface threat at sea), what you want is the 18" gun designed and developed by my great, great, great, great uncle's company at his Elswick factory. It could hurl a 1510kg shell over 26km with a muzzle velocity of nearly 700m/s.
a mate of mine was out that way a few years ago ,before he whimped out
and went oil service in brazil
told me loads of stories about these pirate folk and the quite desperate
means they go to to jump ships
kill em all