This post contains spoilers for “Avengers: Infinity War.”

What would happen to the economy if half the population suddenly disappeared?

Thanos — a space warlord who’s the main villain in the crossover Marvel film “Avengers: Infinity War” — decides to eliminate 50% of all living beings at random, in a single snap. He spends the movie acquiring infinity stones, which grant him the ability to manipulate reality and carry out his goal.

Rather than seeing swaths of people suffer, he decides that decreasing the population would be an “egalitarian” way of responding to limited resources.

“That, of course, is a horrible solution,” said Zachary Feinstein, an assistant professor at Washington University in St. Louis who analyzes fictional economies. “But being a mad being, he thought it was the only possible solution.”

“Avengers: Endgame,” the sequel to “Infinity War,” premieres this week, marking the end of an arc in the Marvel Cinematic Universe that’s spanned about 11 years and 21 films. It’ll feature its wide cast of characters, teaming up to defeat Thanos.

Thanos’s concerns parallel those of some environmentalists who argue that population growth has run amok. But the sudden disappearance of half of all people could, of course, have some devastating effects on the global economy, including a shake-up in the housing market.

The economic consequences

Feinstein said the term “bus factor” in business management generally refers to a hypothetical question: How many of your employees could be hit by a bus before your company stopped being able to function?

“Virtually at any company, this is much lower than 50 percent,” Feinstein said. “So without even getting into the other consequences, this bus factor is going to be a huge problem.”

Technology firms would probably be hit especially hard by loss of institutional knowledge and valuable skill sets, partly because of their reliance on specialized labor, along with the kind of complex infrastructure that Feinstein said tends to require a large workforce.

When it comes to real estate, the demand for new houses would go down, while supply would go up. The result: a huge drop in the price of housing, harkening back to the 2007-08 financial crisis, Feinstein said.

To make troubles worse, Feinstein noted that half of the Federal Reserve, which helped steer us during the last financial crisis, would be gone as well.

Ronald Lee, a demography and economics professor at the University of California, Berkeley, pointed out that many rural areas in the real world already have shrinking populations.

“When you hit a certain size, then you can’t support a school anymore, you may not be able to support a fire department, and a police department, and so on,” Lee said.

Of course, all of these projections hinge on an assumption that society would continue to march on after the snap. Lee said he expects there’d be total chaos and a collapse of all institutions.

“We would revert to pre-industrial arrangements for the economic life cycle, which would mean older people would work — they wouldn’t retire,” Lee said. “And to the extent they needed assistance and weren’t healthy enough to work, and so on, their families, their children, would support them.”

Alternatives to the snap

A common question people have raised about Thanos’s decision is: Why didn’t he just double the planet’s resources?

Anthony Russo and Joe Russo, the film’s directors, responded to that argument in the movie release’s commentary track, citing character motivations.

Joe Russo described Thanos as “not a stable individual” and said he has a “messianic complex.”

But Feinstein suggested Russo could’ve just pointed to some good old-fashioned economic principles to explain Thanos’ call.

“If, instead of halving the population, we doubled the amount of resources, this is going to be a shift in the supply curve on every single good on the market, which would ultimately cause more goods to flood the market,” Feinstein said.

He explained that this would lower prices, causing deflationary pressure. Companies whose goods decline in price might have trouble handling their debts, which could put pressure on employers to reduce costs by cutting wages or workers.

And if you’re trying to enter the real estate market, you’re not going to pay the previously prevailing price, Feinstein said.

“You’re going to be paying based on the new value of the dollar, which means anyone selling at that moment is going to get less than they expected,” he said. “We’d have many more foreclosures, many more defaults and, as we saw in 2008 when this was happening in large markets, like the real estate market, it has very severe economic consequences.”

Instead, assuming that a space warlord with an all-powerful gauntlet that can bend reality to his will exists out there, Feinstein suggests … the replicator.

It’s a device with the ability to create and recycle objects, used in the “Star Trek” universe, which has a post-scarcity economy. Feinstein views it as an ideal solution to the problem of limited resources.

“[It] changes the rules because all of economics is written with the notion of, “We have scarce goods. How should this be used?” Feinstein said.