You then go and hire a good tax accountant who has experience with the Double Irish tax dodge (look it up on Wikipedia), and Bob's your uncle. (Though a double irish is harder to create for new firms since 2015 - you might have to acquire a ready-made shell corporation.)
Of course all this only makes sense if you have profits in the tens or hundreds of millions, so that paying for the shell companies, your Irish headquarters, your tax accountants and your lawyers is cheaper than actually paying tax.