When Leticia Miranda had a job selling newspapers on the streets, she earned about $160 a month, just enough to pay for a tiny apartment she shared with her 8-year-old son in a poor neighborhood of Rio de Janeiro.
When she lost her job about six months ago amid Brazil's worst economic crisis in decades, Miranda had no choice but to move to an abandoned building where several hundred people were already living. All of her possessions — a bed, a fridge, a stove and some clothes — have been jammed into a small room that like all the others in the building has windows with no glass. Residents bathe in large garbage cans filled with water and do their best to live with the stench of mountains of trash and rummaging pigs in the center of the building.
"I want to leave here, but there is nowhere to go," said Miranda, 28, dressed in a bikini top, shorts and sandals to deal with the heat. "I'm applying for jobs and did two interviews. So far, nothing."
Between 2004 and 2014, tens of millions of Brazilians emerged from poverty and the country was often cited as an example for the world. High prices for the country's raw materials and newly developed oil resources helped finance social welfare programs that put money into the pockets of the poorest.
But that trend has been reversed over the last two years due to the deepest recession in Brazil's history and cuts to the subsidy programs, raising the specter that this continent-sized nation has lost its way in addressing wide inequalities that go back to colonial times.
"Many people who had risen out of poverty, and even those who had risen into the middle class, have fallen back," said Monica de Bolle, a senior fellow at the Washington-based Peterson Institute for International Economics.
The World Bank estimates about 28.6 million Brazilians moved out of poverty between 2004 and 2014. But the bank estimates that from the start of 2016 to the end of this year, 2.5 million to 3.6 million will have fallen back below the poverty line of 140 Brazilian reais per month, about $44 at current exchange rates.
Those figures are likely underestimates, de Bolle said, and they don't capture the fact that many lower-middle class Brazilians who gained ground during the boom years have since slid back closer to poverty.
Economists say high unemployment and cuts to key social welfare programs could exacerbate the problems. In July, the last month for which data is available, unemployment was close to 13 percent, a huge increase from 4 percent at the end of 2004.
Lines of job-seekers stretching several blocks have become commonplace whenever any business announces openings. When a university in Rio this month offered low-skilled jobs paying $400 a month, thousands showed up, including many who stood outside in the rain a day before the process began.
Meanwhile, budgetary pressures and the conservative policies of President Michel Temer are translating into cuts in social services. Among those hit is the Bolsa Familia — Family Allowance — program that gives small subsidies each month to qualifying low-income people. It's credited with much of the poverty reduction during Brazil's boom decade.
Non-labor income, including social programs like Bolsa Familia, accounted for nearly 60 percent of the reduction in the number of people living in extreme poverty during the boom decade, said Emmanuel Skoufias, a World Bank economist and one of the authors of the report on Brazil's "new poor."
Now, even as job losses have been pushing more people toward the program, fewer are being covered.
"Every day is a struggle to survive," 40-year-old Simone Batista said, tears streaming down her face as she recounted being cut from Bolsa Familia after her now 1-year-old was born. She wants to appeal, but doesn't have enough money to take buses to the administrative office downtown. Batista lives in Jardim Gramacho, a slum in northern Rio where she and hundreds of other destitute residents find food by rummaging through garbage illegally dumped in the area.
An Associated Press review of Bolsa Familia data found coverage declined 4 percentage points between May 2016, when Temer became acting president, and May of this year. Part of that may be due to a crackdown on alleged fraud that started late last year. Temer's administration announced it had found "irregularities" in the records of 1.1 million recipients — about 8 percent of the 14 million people who receive the benefit. The infractions ranged from fraud to families that were earning above $150 a month, the cutoff to receive the benefit.
"The government shouldn't lose focus on the priority" of keeping people out of poverty, said Skoufias, adding that Bolsa Familia represented only about 0.5 percent of Brazil's gross domestic product and the government should be looking to allocate more, not fewer, resources to it.
Still, any discussion of increased spending is likely doomed in Congress, where a spending cap was passed earlier this year and Temer is pushing to make large cuts to the pension system. The fiscal situation is even worse for many states, including Rio.
A year after hosting the 2016 Summer Olympics, Rio is so broke that thousands of public workers are not being paid, or are being paid late in installments. Many budget items, from garbage collection to a community policing program, have been sharply reduced.
For many who live in Rio's hundreds of favelas, or slums, an already hardscrabble existence feels increasingly precarious.
Maria de Pena Souza, 59, lives with her 24-year-old son in a small house with a zinc roof in the Lins favela in western Rio. They want to move because the home sits on a steep hill that is prone to deadly mudslides. But her son hasn't been able to find work since finishing his military service a few years ago.
"I would leave if there was a way, but there isn't," said de Pena Souza, who added: "When it rains, I can't sleep."
The economic doldrums are clearly fueling the political comeback of former President Luiz Inacio Lula da Silva, who from 2003 to 2010 presided over much of the boom. After leaving office with approval ratings over 80 percent, da Silva's popularity plunged as he and his party were ensnared in corruption investigations. Da Silva is appealing a conviction and nearly 10-year sentence for corruption. But he still consistently leads preference polls for next year's presidential election.
On the campaign trail, da Silva promises both a return to better economic times and refocusing on the poor.
"Lula is not just Lula," da Silva said at a recent rally in Rio, using the name most Brazilians call him. "It's an idea represented by millions of men and women. Prepare yourselves because the working class will return to govern this country."
Associated Press writer Peter Prengaman reported this story in Rio de Janeiro, AP writer Sarah DiLorenzo reported from Sao Paulo and AP writer Daniel Trielli reported from Washington. AP video journalist Diarlei Rodrigues in Rio de Janeiro contributed to this report.