Venezuela is running out of food. Hospitals are overcrowded with sick children while doctors don't have enough medicine or X-ray machines. Electricity isn't guaranteed.

About the only thing Venezuela has in abundance is chaos.

The economy has spiraled toward collapse, and a humanitarian crisis has plunged hordes into needless sickness and starvation.

The country is also in the grip of a political crisis. The referendum on Sunday called by President Nicolas Maduro could erode the last vestiges of democracy.

The vote would allow him to rewrite the constitution and replace the National Assembly, which is controlled by the opposition, with an entirely new legislative body filled with his hand-picked nominees.

Venezuela was once the richest country in Latin America. Here's how it fell apart.

Related: Live Updates from Venezuela

Venezuela's economy: 'It's at the point of no return'

Venezuela holds the world's largest supply of crude oil -- what once seemed like an endless gusher of cash. Now the government is running out of money, prices are soaring, and nobody knows how much worse it will get.

Venezuela was a powerhouse of South America in the 1990s. Former President Bill Clinton made it his first stop on a trip to the region in 1997.

But inequality grew extreme. A small elite class controlled everything while the increasingly impoverished masses fumed.

The country turned toward socialism in 1999 and elected Hugo Chavez president. He championed populism, cut ties with the United States and cozied up to China and Russia, both of which loaned Venezuela billions. Chavez ruled until his death in 2013, and is still seen today as a hero for the poor.

Related: Venezuelans lose weight as food shortages worsen

But his government far overspent on welfare programs, and it fixed prices for everything. It declared farmlands state property and then abandoned them, and instead made the nation dependent on selling its oil abroad.

Before he died, Chavez picked Maduro to succeed him, and Maduro kept up the regime's practices. His administration also stopped publishing any reliable statistics, including on economic growth and inflation. It accepted millions in bribes for construction projects and racked up debts that it is still struggling to pay.

Meanwhile, the only commodity Venezuela had left began to plunge in value.

In 2014, the price of oil was about $100 a barrel. Then several countries started to pump too much oil as previously inaccessible oil could be dredged up with new drilling technology. At the same time, businesses globally weren't buying more gasoline. Too much oil caused the global price to drop to $26 in 2016.

Today it hovers around $50, which means Venezuela's income has been cut in half.

Related: Trump could hit Venezuela where it hurts: Oil

With oil prices low and the government's cash dwindling, price controls have become a huge problem. The state still subsidizes food far below normal prices to appease the poor. Maduro has printed money at breakneck speed, and the bolivar has plunged in value, wiping out jobs and income.

At the same time, Maduro's hostility to foreign business has created a corporate exodus. Pepsi (PEP), General Motors (GM)and United (UAL) are just some of the companies that have cut back or left entirely. Unemployment in Venezuela this year could reach 25%, according to the International Monetary Fund.

Inflation is only getting worse. In 2010, one American dollar was worth about eight bolivars. Today it's worth over 8,000 bolivars, according to the unofficial exchange rate, which many Venezuelans use because government rates are considered far overvalued. Prices could rise an astounding 2,000% next year.

To keep up, Maduro has raised the minimum wage three times this year. That has provided a little short-term relief to the poor, but experts say it creates long-term pain in the form of a worthless currency.

"The economy is really chaotic. It's totally collapsed. It's at the point of no return," says Alberto Ramos, an economist who heads Latin America research at Goldman Sachs.

Maduro blames his opponents for Venezuela's economic woes and says U.S. sanctions on Venezuelan leaders are proof the United States is waging an "economic war."

Regardless of where the blame lies, humanitarian misery has followed the economic plunge.

Related: Venezuela's hyperinflation is jaw-dropping. See for yourself

'There are people in Venezuela who are literally starving. This is apocalyptic stuff'

For several years, Maduro has had a stark choice: Pay down debts to China, Russia and foreign investors -- or buy food and medicine from abroad.

He has chosen to pay the bills. The result: Starving Venezuelans and soaring deaths in hospitals. Food shortages are so severe that the average Venezuelan living in extreme poverty lost 19 pounds last year, according to a national poll.

"There are people in Venezuela who are literally starving. This is apocalyptic stuff," says Eric Farnsworth, vice president at the Council of the Americas, a business organization. "I would call Venezuela a failing state."

Related: Venezuelans scramble for food, but it's often out of reach

Venezuela ships in food primarily from Brazil, Colombia and Mexico because the government stopped cultivating its rich farmland years ago.

For the first five months of this year, food exports from those countries to Venezuela were down 61% from the same period in 2015, according to Panjiva, a research firm.

Medical shortages are worse: 756 women died during and shortly after childbirth last year, a 76% increase from 2015, according to a rare release of government records that Maduro condemned.

Nearly 11,500 infants died in 2016, a 30% rise from the prior year. Malaria cases jumped to 240,000, a 76% rise from 2015.

"Even at the hospital there is still no food for the patients," says Dr. Huniades Urbina-Medina, head of pediatrics at Hospital de Niños J.M. de los Rios, a children's hospital in Caracas. "We still don't have medicines, X-rays, CT scans -- nothing."

It's not just food and medicine. Venezuelans sometimes must ration electricity and water during droughts.

The crises have literally pushed Venezuela's upper and middle classes out, creating a severe brain drain. Nearly 2 million Venezuelans have left the country since 1999, according to research by Tomas Paez, a sociology professor at the Central University of Venezuela in Caracas. Venezuela is a country of only 30 million people.

Political turmoil has brewed for years

It seemed like a potential political turning point in 2015 when opposition leaders won a majority of seats in the National Assembly, dealing a blow to Maduro. But gridlock was the result.

Early in 2016, Maduro stacked the Supreme Court with his supporters to block the National Assembly from impeaching him. Then, in March, the Supreme Court attempted to dissolve the National Assembly altogether, leading to months of protests that have left nearly 100 dead.

Sunday's vote brings the turmoil to a head. As Venezuela lurches into chaos, Maduro acts as if the opposite is true.

He recently tweeted a video of himself driving through Caracas on streets tightly controlled by the police. On camera, Maduro insists the streets are safe, and that people are working and living ordinary lives.

But just a few miles away, off camera, young Venezuelans clashed with riot police as fires burned in the streets.