The Chinese government has spent 1.5 trillion yuan ($236 billion) trying to prop up the country's plunging stock market, according to analysis by Goldman Sachs.

Bailout costs in August alone were 600 billion yuan ($94 billion). Since the middle of June, the Wall Street bank estimates Beijing's spending equals 3.5% of the value of all stocks in the country.

The numbers underscore the high cost of Beijing's efforts to prop up stocks -- a response that has been panned by some critics as unnecessary and counterproductive.

The first signs of trouble came in June, after the Shanghai Composite peaked at more than 5,100 points, a gain of roughly 150% over the previous 12 months. When the bubble burst, the index lost 32% of its value in just 18 trading sessions.

Related: IMF warns over China's slowdown

Beijing reacted forcefully. The People's Bank of China cut interest rates for the fifth time in nine months, regulators suspended new share listings, and threatened to throw short sellers in jail.

The China Securities Regulatory Commission, which polices the country's markets, organized the purchase of shares using cash supplied by the central bank. Much of the actual buying has been carried out by China's so-called "National Team," a group of state-backed investors, brokerages and funds that have purchased shares at the government's behest.

It's not clear whether the coordinated action is restoring investor confidence. After a few weeks of calm, the Shanghai Composite resumed its plunge in late August. The index has now lost more than 40% of its value since peaking in the middle of June.

What would happen, many wonder, if Beijing completely pulled out of the market?

"The lingering market concern over the Chinese government's potential exit from its market support is probably overdone," analysts at Goldman wrote, citing the experience of quantitative easing in the U.S. and other examples of state stimulus.