It's been a tough three months for the stock market. The S&P 500 currently sits 8% below its late-July high, and is still knocking on the door of lower lows. In fact, most stocks are down for this time frame, albeit to varying degrees.

The so-called "smart money," however, knows these pullbacks are buying opportunities. These smart investors also know which stocks are the best ones to buy while they're beaten down. Here's a closer look at three such names that have seen more than a little bit of heavy-duty buying since the sell-off began. 

1. Occidental Petroleum

The energy business can be a tricky one to handicap. Oil prices are perpetually in flux, and oil companies don't always do a particularly great job of managing their production in a way that balances supply with demand. The advent and ongoing commercialization of alternative energy only adds to the unpredictability of oil and gas stocks.

There's a reason Warren Buffett's Berkshire Hathaway bought 136 million shares of energy outfit Occidental Petroleum (OXY -0.15%) early last year, however, and has continued adding to this position in the meantime -- including in the second quarter of this year. That reason is that the world still needs more and more oil, and this will be the case well into the distant future.

An outlook from the International Energy Agency puts things in perspective. The organization expects demand for oil to continue growing from the current pace of 102.1 million barrels per day to 105.7 million barrels per day in 2028. At that point, this growth pace should dramatically slow, but growth of crude oil consumption won't actually peak until the 2030s. Moreover, oil usage won't actually begin to meaningfully contract until 2050, and even at that point in time the U.S. Energy Information Administration believes renewables will only account for about one-fourth of worldwide energy production.

Simply put, the road to a world completely run on renewable energy is a long and winding one. There's lots of money to be made in the meantime by oil and gas companies like Occidental Petroleum, even if price volatility makes these profits uneven.

2. Walmart

There's certainly no mistaking Walmart (WMT -0.08%) for a growth stock. While it was a relatively big victory by the retailer's standards, its second-quarter sales growth of 5.7% would have been a disappointment were it in any other industry. Ditto for the quarter's same-store sales growth of 6.4% within the United States.

Not every company has to be a growth stock to be a worthy holding, though. What this company lacks in growth firepower, it makes up for in consistency. Not once since early 2016 has Walmart failed to produce year-over-year revenue growth, which includes periods before, during, and even after the COVID-19 pandemic. The same can't quite be said of its bottom line, although overhauls that have been underway for years are finally driving measurable, steady profit growth too.

WMT Revenue (TTM) Chart

WMT Revenue (TTM) data by YCharts

Connect the dots: If you're looking for a holding you can safely tuck away for several years -- or maybe even a couple of decades -- and not worry about, Walmart is arguably it.

The proof of this premise lies in the stock's recent performance. Whereas most other stocks are down and still falling, WMT shares have continued to gain ground since late July.

What gives? Safety, mostly.

As noted, although it's not a growth stock by any stretch of the imagination, Walmart stock produces persistent sales growth and respectable (even if choppy) profit growth in any and all environments. That includes the economic environment we're in right now. Clearly, more than a few investors recognize and value this resiliency. You might want to do the same, particularly if you fear the economy isn't going to snap out of its funk anytime soon.

3. Amazon

Last but not least, add Amazon (AMZN 3.43%) to the list of stocks the world's smartest investors seem to quietly be scooping up in droves while it's down.

If you know the company at all, you likely know why the stock's peeled back from its pandemic-prompted peak in late 2021. That is, the inflation bug has eaten away at its usually thin profit margins. Its e-commerce operation actually lost money last year, in fact, both here and abroad. Its cloud computing arm Amazon Web Services (or AWS) was the only profitable venture thanks to sky-high logistics and labor costs, yet even AWS's net profit margin rates contracted a bit; its operating costs were up as well.

But things are taking a turn for the better. E-commerce is profitable again, for instance, with overall operating income nearly doubling through the first half of 2023. Not only is the company getting a handle on freight and warehouse costs, its nascent advertising business -- ads that Amazon's sellers pay to feature their products on Amazon.com -- is expanding by leaps and bounds. Last quarter's advertising services revenue of $10.7 billion was up 22% year over year, extending a growth pace that's been underway for some time now. This is high-margin revenue, too!

Very little of this brewing turnaround is being reflected in the stock's price. Indeed, not only are Amazon shares well below analysts' consensus price target of $173.48, they're currently priced below the lowest analyst target of $138.00.

Goldman Sachs analyst Eric Sheridan chalks most of this weakness up to worries about its cloud computing business's foreseeable future, explaining, "Investor expectations for near-term AWS revenue growth have come down in the last month."

Sheridan goes on to say, however, "We would encourage investors to instead focus on the broader margin recapture story in AMZN's North America segment (relative to pre-COVID), as we expect margins to continue benefiting from operating leverage against a more streamlined fulfillment/shipping infrastructure over the next several quarters."

Translation: The market's looking right past Amazon's budding rebound.