Pharma firm Mallinckrodt has agreed to buy Questcor Pharmaceuticals for $5.6bn (€4bn) to add specialty drugs in the latest industry deal that moves a US company to Ireland for a lower tax rate.