Stocks are having a terrible time in 2022 thanks to several factors, including high inflation, the possibility of a recession in the U.S., and a global economic slowdown.

These headwinds have led the S&P 500 into bear market territory, with the index down 18% so far in 2022. However, this may be a good time for investors to buy some promising companies on the cheap, especially considering that a bull market could arrive in the next few months.

Bank of America estimates that the bear market could end in October 2022. Historical trends suggest that stocks could go on a multiyear bull run once the bear market ends. If that indeed turns out to be the case, investors may want to buy the likes of Nutanix (NTNX -1.94%) and Lam Research (LRCX -2.56%) -- two companies that are not only cheap right now, but also have terrific prospects that could supercharge their stock prices in a bull market. Let's see why.

1. Nutanix

It may be surprising that Nutanix stock dropped 52% in 2022, given its impressive pace of growth. The company's revenue had increased 17% year over year in the third quarter of fiscal 2022 (which ended on April 30, 2022) to $403.7 million. Nutanix also reduced its adjusted loss by a massive margin to $0.05 per share last quarter from $0.41 per share in the year-ago period.

Wall Street, however, was concerned about the near-term challenges that Nutanix is facing. Supply chain bottlenecks will restrict the availability of hardware from the company's partners, and as a result, its new subscription contracts will come into effect later than expected. However, there is a healthy demand for Nutanix's enterprise solutions, which help customers move toward a hybrid cloud model that combines the usage of both public and private cloud infrastructure.

Mordor Intelligence estimates that the hybrid cloud market could post annual growth of 21% through 2026. Nutanix is in an excellent position to take advantage of this solid incremental growth, as it is the second-largest player in this space, with a market share of nearly 25%. Moreover, a closer look at the growth of Nutanix's customer base and billings indicates that any slowdown is likely to be temporary.

Nutanix's customer base swelled 13% year over year last quarter to nearly 22,000. Additionally, there was a nice jump in customer spending. That was evident from the count of 1,747 customers who clocked lifetime bookings of more than $1 million last quarter, up 22% over the year-ago period. Now, Nutanix predicts that its addressable revenue opportunity in hybrid cloud and adjacent markets could be worth $61 billion by 2025 as compared to $39 billion in 2020.

Throw the company's robust market share into the equation, and it is easy to see why Nutanix should continue to enjoy a nice mix of customer growth and increased spending. Finally, with Nutanix stock trading at just 2.1 times sales following its massive plunge this year as compared to its five-year average sales multiple of 4.95, now may be a good time to buy this cloud specialist before it goes on a bull run.

2. Lam Research

Lam Research is another stock that has been battered badly this year, losing 37% of its value so far. As a result, Lam is now trading at just 14 times trailing earnings, a discount to the S&P 500's multiple of 20.4.

This makes Lam stock an enticing buy right now because the company will play an important role in solving a major problem: the global chip shortage. The company makes, refurbishes, and services semiconductor manufacturing equipment that's used to fabricate integrated circuits. Not surprisingly, Lam has witnessed healthy growth in its revenue and earnings over the past few years as semiconductor demand has boomed, increasing the demand for manufacturing equipment.

However, the company is going to run into challenges in the near term on account of component shortages. Still, the demand for its offerings remains solid, as its deferred revenue balance was up by $600 million last quarter to $2 billion. Additionally, Lam Research predicts that the demand for wafer and fabrication equipment is expected to remain strong thanks to the growing demand for semiconductors, especially memory chips.

Lam counts the likes of Samsung, SK Hynix, Micron Technology, and Taiwan Semiconductor Manufacturing (popularly known as TSMC) as customers. These chipmakers are gearing up for massive capital investments in the coming years. Micron, for instance, plans to spend $150 billion by 2030 in manufacturing and research and development, while TSMC has also hiked its spending forecast for the year significantly.

The healthy end-market prospects explain why Lam's bottom line is expected to clock healthy double-digit growth of nearly 14% a year for the next five years. The company is expected to post 15% revenue growth in 2022 to $16.8 billion, followed by a 16% increase next year.

All this indicates that investors looking to add a semiconductor stock to their portfolios right now shouldn't miss the opportunity to buy Lam Research, as the stock could step on the gas thanks to the impressive end-market opportunity it is sitting on.