Source: Teva Pharmaceutical via Facebook.

What: Shares of Mylan (NASDAQ:MYL), a branded-drug developer that is also a large player in the generic drug market, surged by 22% in April, according to data from S&P Capital IQ. This happened after the company made a nonbinding offer to acquire a rival, and then, two weeks later, itself received a buyout offer from a separate competitor.

So what: In early April, Mylan proposed to acquire generic and over-the-counter drug maker Perrigo (NYSE:PRGO) for $28.9 billion, or $205 per share, in a cash-and-stock deal. Mylan suggested the combination with Perrigo would result in substantial cost savings and give the combined entity more leverage with pharmacy benefit managers and insurers. Perrigo formally rejected the nonbinding proposal two weeks later.

Shortly thereafter, Teva Pharmaceutical (NYSE:TEVA) offered to acquire Mylan for a whopping $40.1 billion, or $82 per share, in what would have been a 50/50 cash-and-stock deal. Similar to Mylan's pitch, Teva suggested the combined tax and cost savings could equal as much as $2 billion per year, and the companies' combined product portfolios would add leverage against PBMs, as well as better geographic diversity. Mylan rejected Teva's advances.

Mylan then said it would take its bid for Perrigo to that company's shareholders. Its new per-share offer was comprised of $75 in cash and 2.3 of its own shares, equaling a purchase price north of $240 per share. Perrigo's board again rejected the proposal, while Teva recommitted to pursuing Mylan.

Source: Teva Pharmaceutical via Facebook.

Now what: This mega-merger triangle has Mylan sitting pretty, as its shareholders' holdings will either be acquired by Teva for a substantial premium (I personally think it would take something north of $88 to get the deal done), or it will acquire the highly profitable Perrigo and receive an instant boost to its bottom line. There aren't many scenarios here in which Mylan comes out a loser, short of Teva suddenly making a successful bid for Perrigo.

The industry trend is also very much Mylan's friend. As branded drugs continue to fall off the patent cliff and drug developers focus on more-expensive targeted therapies, the need for low-cost generic drugs is only set to grow in the coming decades. Mylan's margins might not match Big Pharma's, but its long-term growth prospects are considerably steadier.

Even after Mylan's amazing run higher I wouldn't recommend investors away from nibbling on this stock as long as their intention is to hang on for the long term.