Taiwan Semiconductor Manufacturing (TSM -4.86%), popularly known as TSMC, has been in fine form on the stock market of late as shares of the chip foundry giant have shot up 30% since early November 2022. That might seem a tad surprising given the turmoil in the broader market and concerns that semiconductor sales could decline in 2023.

Nonetheless, a closer look at TSMC's performance in recent quarters suggests that the stock's rally is well deserved. But will this semiconductor bellwether be able to sustain its rally over the next year? Let's find out.

TSMC could see a slowdown in orders

TSMC enjoyed a terrific 2022 as the company's revenue increased at an impressive pace. It is yet to report its fourth-quarter 2022 results, but its revenue guidance of $20.3 billion would translate into a 30% year-over-year increase in the top line. What's more, the company expects to finish 2022 with a 54% year-over-year increase in fourth-quarter earnings to $1.77 per share.

However, recent reports suggest that customers may have cut their orders because of weak demand. More specifically, it is being speculated that Advanced Micro Devices, Nvidia, and Qualcomm are among those that possibly scaled back their chip orders, forcing TSMC to shut down four of its high-end machines that produce advanced chips.

Weak sales of personal computers, a tepid smartphone market, U.S. restrictions on sales of advanced data-center chips to China, and supply chain disruptions caused by the coronavirus in China are said to be the reasons TSMC could face order cuts.

The grapevine suggests that the utilization rates of TSMC's 7-nanometer (nm) and 6-nm fabs could fall to 50% due to the headwinds mentioned above. As a result, revenue in the first and second quarters of 2023 is expected to decline sequentially.

Consensus estimates indicate the same. Analysts expect the company's revenue in the first quarter of 2023 to grow just 2% year over year to $17.9 billion. For the full year, revenue is expected to increase by just 3% to $77 billion. That would be a big drop over 2022's impressive revenue increase of nearly 32%.

So TSMC's rally could come to an abrupt halt when the company reports its next set of results later this month if the supply chain rumors turn out to be true. However, that could open an opportunity for savvy investors to buy the stock, with semiconductor demand expected to recover in the second half of 2023.

The stock could rebound after a difficult start to the year

One reason TSMC delivered terrific growth in the third quarter of 2022 and guided strongly for the fourth quarter was its relationship with Apple (AAPL -0.57%). The iPhone maker is one of TSMC's top customers, reportedly producing a quarter of TSMC's revenue in 2021. Apple's latest A16 Bionic processor that powers the iPhone 14 Pro and the iPhone 14 Pro Max was built using TSMC's 4-nm process.

Apple is expected to move to TSMC's 3-nm chips in 2023 for its next iteration of the iPhone, which should ideally hit the market in the second half of the year. And it will reportedly pay 20% more for the 3-nm chips.

As a result, TSMC could benefit from higher shipment volumes and improved average selling prices from Apple in 2023 as sales of the iPhone are expected to increase to 233 million units this year from last year's estimate of 220 million.

It is worth noting that TSMC already started volume production of its 3-nm chips, which are also expected to power other applications such as supercomputers and servers. Meanwhile, reports indicate that the company might be supplying most of Qualcomm's flagship mobile processors this year thanks to TSMC's better production yields. So TSMC is likely to win business from Samsung -- the other foundry from which Qualcomm procures chips -- which is reportedly struggling with weaker yields.

The growing demand for chips from the automotive and the Internet of Things (IoT) markets could be another tailwind for TSMC over the next year. The company had a 15% quarter-over-quarter increase in revenue from automotive chips in the third quarter of 2022, while IoT revenue was up 33%.

There is a shortage of chips in the automotive market, which explains why chipmakers catering to this space have sold out their inventories for the next year. Not surprisingly, global automotive semiconductor revenue is expected to increase 11% in 2023 to $54.2 billion. The size of the market could increase to $115 billion by 2030, suggesting that TSMC has a secular growth opportunity here that it can take advantage of.

What should investors do?

Investors may want to take advantage of any dips in TSMC's stock price in the next few months if the headwinds hamper its near-term growth. The company is expected to regain its mojo in the second half of the year, and that could supercharge the shares. The stock carries a 12-month median price target of $100, according to a consensus of nine analysts, which would translate into a 25% upside from current levels.

And the stock trades at a cheap 14.4 times trailing earnings as compared to its five-year average price-to-earnings ratio of 23. Investors may not want to miss buying this semiconductor stock if it becomes cheaper, considering the potential upside it could deliver. TSMC is expected to clock annual earnings growth of 21% for the next five years, indicating that this stock could turn out to be a winner in the long run.