Rite Aid (RAD -27.27%) was one of the biggest losers for the first half of the year, and it's kicking off the second half of 2017 on the same downbeat tone. Shares of Rite Aid plummeted 19.3% last week after investors began to doubt that even a recently scaled back asset sale with Walgreens Boots Alliance (WBA -1.12%) will take place.

Investors have been in limbo since the original acquisition was announced 21 months ago. Regulators failed to approve the combination of the two drugstore chains, even after Rite Aid agreed to unload a bunch of its stores to smaller peer Fred's (FRED) to appease antitrust concerns. The deal officially came undone on June 29, when Rite Aid announced that it would instead sell less than half of its stores to Walgreens. A couple of analysts chimed in with cautious notes about Rite Aid over the past few days, including one from Leerink analyst David Larsen who on Friday put the chances of even the tweaked deal closing at 50-50 -- at best.

An ad for Rite Aid.

Image source: Rite Aid.

Pain killlers

It was a rough week for Rite Aid, and it was an even harder week for Fred's shareholders. Fred's stock plunged 26% in the aftermath of the terminated merger. The new deal calls for Rite Aid selling just 2,186 of its 4,523 locations to Walgreens, with none of the stores going to Fred's. 

Rite Aid's plunge seems overdone if -- and apparently that's a big "if" -- the deal gets done. Rite Aid is collecting a $325 million penalty from Walgreens as part of the deal's termination. Rite Aid will also be receiving $5.175 billion in the all-cash deal for the 2,186 stores. We're a far cry from the original deal that was valued at $17.2 billion, but the money will work wonders for Rite Aid with its $7.2 billion in debt.

The deal and termination fee combine for $5.5 billion, more than half -- 58% -- of its $9.5 billion in enterprise value. Rite Aid has enough in net operating loss carryforwards to offset most of the gain from the sale.

In short, Rite Aid will still be retaining more than half of its stores, dramatically cleaning up its balance sheet in the process. Rite Aid will also retain its EnvisionRx pharmacy benefit manager as well as its RediClinic and Health Dialog subsidiaries. Rite Aid also has the option to buy generic drugs sourced from a Walgreens affiliate -- at cost -- for 10 years. 

There's a lot to clean up at Rite Aid. It's been in limbo for nearly two years, and its status as a lame-duck acquisition has weighed on its focus. Revenue declined 5% to $7.8 billion in its latest quarter, held back by a 5% slide in comps. Rite Aid also posted a larger deficit than analysts were targeting. 

Rite Aid stock has plummeted 71% this year, making it one of the biggest large-cap losers of 2017. The road back will be long, but it's within reach if regulators finally let a watered-down version of a combination go through.