Matt Krantz

USA TODAY

Corrections and clarifications: An earlier version of this story understated the value of Yahoo's stake in Yahoo Japan.

Yahoo (YHOO) just disclosed the size of its executive pay packages and Marissa Mayer stands to make millions coming or going.

The CEO of the embattled online news site, currently trying to sell itself, is entitled to severance benefits valued at $54.9 million in case she is terminated without cause, according to a regulatory filing after the market closed Friday. The potential payout would also be triggered by a "change of control," which includes the sale of the company, according to the filing.

Mayer's potential payout includes cash severance of $3 million, $26,324 to continue her health benefits, $15,000 for outplacement, and -- if that's enough -- nearly $52 million worth of accelerated restricted stock and options.

But wait. That's just what Mayer gets if she leaves. Mayer was already paid $36 million in 2015 as her regular annual compensation. That total pay package was down nearly 15% from the prior year, but is still well above the median of roughly $12 million paid by executives in the Standard & Poor's 500. Mayer was paid $42.1 million in 2014, making her the most highly paid female CEO in the S&P 500.

Meanwhile, Yahoo shareholders continue to suffer. The value of Yahoo's stock lost roughly a third of its value last year. Shares closed Friday at $36.60. And there's a reason the stock is headed in the wrong direction. Yahoo went from making $7.5 billion in 2014 to losing $4.4 billion in 2015.

Shares of Yahoo are up 134% since Mayer took the helm in July 17, 2012. But that's entirely due to the meteoric rise in the company's stake in Chinese e-commerce company, Alibaba (BABA). Yahoo's 15% stake in Alibaba is worth $30.2 billion, which almost worth as much as Yahoo itself with a market value of $34.7 billion. Yahoo also has a 36% stake in Yahoo Japan worth about $8 billion and $6 billion in cash, So that means the market sees business of Yahoo itself as worthless.

But Mayer's pay package is quite the opposite.

Follow Matt Krantz on Twitter @mattkrantz,