NEW YORK (CNNMoney.com) -- It's coming down to the wire for General Motors.

With GM rapidly burning through its cash reserves due to hefty losses amid an historic slump in auto sales, President Obama said the Treasury Department would give the automaker the cash it needs to continue operations on the condition that GM restructure its debt or file for bankruptcy by June 1.

The automaker set a May 26 deadline for its bondholders to reach a restructuring agreement. GM chief executive officer Fritz Henderson has repeatedly said that the difficulty in inking a deal makes a bankruptcy filing for the automaker "probable."

A spokeswoman for GM said Friday the company continues to plan for a bankruptcy, which is the likely next step if no agreement is reached.

A deal with bondholders is one of the last major hurdles for GM (GM, Fortune 500) to clear in order to avoid bankruptcy. GM has reached agreements with the United Auto Workers and Canadian Auto Workers unions that will allow the company to reduce some of its labor and retiree health care costs. The Canadian deal was ratified by union members on Sunday; the UAW vote is expected to be completed later this week.

Rival Chrysler, which has also received billions of dollars from the federal government, filed for bankruptcy last month despite reaching a deal with the UAW, after several bondholders held out of the restructuring agreement.

So if GM cannot work out a deal with bondholders, it could file for bankruptcy as early as some time next week.

Bondholders key to avoiding Chapter 11

Still, bankruptcy is not a done deal.

"In very hostile negotiations, most of the progress is made at the 11th hour," said Edward Neiger, founder of Neiger LLP, a creditors' rights and bankruptcy law firm. "It's very hard to predict what the outcome will be until the 11th hour, when the parties often realize the alternative is worse for both of them."

To avoid bankruptcy, GM would need to convince the bondholders to accept a much reduced stake in the company.

GM's proposal would give bondholders a 10% stake in the automaker, even though they currently own about 40% of the company's debt. The Treasury would get about a 50% stake in GM.

Bondholders have issued a counteroffer that would give them a 58% stake in the company. The Treasury, however, would not receive any stake in GM, and the automaker would remain liable to pay back the money that the government has lent it.

Late Friday GM said it borrowed an additional $4 billion from the U.S. government making a total of $19.4 billion borrowed from the Treasury Department.

Under both plans, the UAW would receive about a 40% stake in the company.

Henderson has suggested that it will be up to the government, not GM, to determine whether bondholders should get a better deal, but the government has not given any sign it will adjust its offer.

The Treasury has indicated it wants to protect the interest of the taxpayers who have given billions to the automaker. A spokeswoman for the Treasury said Friday the government continues to work with all stakeholders to reach an agreement.

But Rep. Jeb Hensarling, R-Texas, wrote in a letter to Treasury Secretary Tim Geithner Friday that more negotiations "must take place soon and at an expedited pace."

"Bondholders must have a seat at the table during negotiations in how the company would be restructured. The company, the government, the union and the bondholders should negotiate details of a reasonable debt-to-equity swap before stepping into court," Hensarling wrote.

Bankruptcy would be bad for investors, suppliers and dealers

Should GM file for bankruptcy, the court will determine just what debts will be paid to various creditors. Bondholders could end up with a better deal than GM's offer, and many appear willing to take that gamble.

GM's stockholders, however, would likely be cleaned out. Although many GM shareholders have essentially been wiped out already. The stock currently trades for about $1.40 a share, more than 90% lower than year-ago levels.

Auto parts suppliers could also take a hit. GM pays its parts makers an average of $2 billion a month. The company would be able to pay some of the money it owes suppliers, but only those whom the court determines to be "critical vendors."

The fate of many GM dealers could also be decided by a bankruptcy court. GM notified 1,100 of the 6,000 dealerships in its network that it would be terminating their contracts next year. Some of those dealers would likely close this year.

Some dealers are hopeful that state franchise laws could protect them from having to be shut down, but many legal experts have said that the dealers will face an uphill battle if GM actually does wind up filing for bankruptcy.

-- CNNMoney.com senior writer Chris Isidore and CNN Congressional producer Deirdre Walsh contributed to this story.