It's an exciting time for investors after the S&P 500 recently closed at a new all-time high, confirming the bull market that began off the lows in October 2022. Investors could be in for a good stretch, considering the average bull market lasts nearly three years.

But the ride may get bumpy along the way. Stock prices do fall, sometimes by double-digit percentages, even in bull markets. Instead of fearing these bumps in the road, embrace them. When they occur, they can send great stocks down to appealing prices for long-term investors.

Artificial intelligence (AI) has been a hot theme since last year, so circle these three stocks as potential buys when the next market downturn hits. They've already enjoyed monster gains -- a dip would offer an opportune chance to buy before they head higher over the long term.

1. Microsoft

Technology stalwart Microsoft (MSFT 1.82%) wedged its way into the thick of the AI race with its strategic tie-up with OpenAI, the developer that created ChatGPT. The partnership gives Microsoft financial perks and cloud exclusivity, which should help it grow Microsoft Azure, its cloud platform, if OpenAI continues expanding. More importantly, Microsoft is expanding its use of AI through the company, improving various existing products and services, such as its Microsoft 365 suite and enterprise software tools.

The tech giant's AI exposure could be a case of the rich getting richer. The stock is already one of history's most outstanding performers, and the business has rock-solid financials, including annual free cash flow totaling $63 billion. With those cash flows and a market cap of $3 trillion, Microsoft has deep pockets that few companies can come close to matching. Of course, management must spend that money effectively, but its stellar 22% average return on invested capital over the past decade signals that shouldn't be a concern.

The stock's valuation has become the only hurdle to buying Microsoft today. Shares trade at a hefty 36 times forward earnings, which is a little high for a business analysts believe will grow earnings by 15% annually. Should the stock cool off, consider jumping in to add a proven winner with staying power to your portfolio.

2. ASML

If computer chips are the building block of AI, ASML (ASML 2.04%) is the company behind the machines that build these building blocks. ASML builds and sells extreme ultraviolet (EUV) lithography systems that print complex patterns at the smallest scales on silicon wafers -- a crucial step in the manufacturing of the most advanced computer chips. According to Mordor Intelligence, ASML is the only company making these machines, which locks in its growth potential for as long as technology demands increasingly better chips.

The world could be in the early stages of an AI chip boom. AMD CEO Lisa Su believes the AI chip market could grow to $400 billion annually over the next four years. Such high demand suggests that ASML will remain busy building its high-tech EUV systems for the world's computer chip manufacturers.

The combination of its opportunity and its monopoly in its market boosted sentiment toward ASML stock. Shares rose an impressive 30% over the past year. Unfortunately, the stock's valuation seems to have gotten a little ahead of itself. Analysts believe ASML can grow earnings by 21% annually over time. That's great, but it doesn't justify the current forward P/E of 42. That makes ASML a great target to buy in a market correction, which is bound to happen at some point.

3. CrowdStrike

AI is already a game-changer for cybersecurity, and companies like CrowdStrike (CRWD 2.03%) are using it to power new security products that are far better than traditional antivirus software. CrowdStrike's core product, the Falcon XDR Platform, creates a connected network of all the devices it protects. It proactively hunts for potential threats and improves quickly as it digests more data. If it stops a breach on one device, the network will learn and then automatically protect the rest of its devices from that same threat.

Cybersecurity should remain a top priority for corporate budgets because the financial damage a breach can cause continues to rise as the degree to which companies rely on digital tools and data grows. According to IBM, the average breach last year caused $4.45 million in damages. Meanwhile, implementing next-generation security saves companies an average of $1.76 million. That's a no-brainer proposition for many businesses.

CrowdStrike plays in a competitive field, but its growth has shown it belongs. Analysts believe its earnings will grow at a compound annual rate of 44% over the long term. But its staggering valuation of 98 times forward earnings makes the stock a bit expensive to bite into right now. After all, the stock is up nearly 180% over the past 12 months. I'd recommend waiting for the stock to give some of that back before backing up the truck.