It may seem strange to compare International Business Machines (IBM 0.16%) and McDonald's (MCD 0.47%) given that they are very different companies. IBM is an IT company, known for its hulking mainframe computers, global services business, and increasingly, its Watson cognitive computing system. McDonald's is a restaurant company with a global footprint, operating or franchising more than 36,000 restaurants worldwide, which together generate roughly $90 billion in systemwide sales annually.

Despite their differences, IBM and McDonald's have a lot in common. Both companies have so far stood the test of time; IBM has been operating for more than a century, while McDonald's first opened its doors 75 years ago. Both companies are included in the Dow Jones Industrial Average Index, two of just 30 members.

Both IBM and McDonald's are also facing surprisingly similar challenges. IBM, after years of rising profits, is facing a fundamental shift in the IT market, with cloud computing upending its business model, and with new competitors like Amazon making life difficult. McDonald's, after years of steady same-store sales growth, is facing robust competition from fast-casual restaurants like Chipotle. Consumers are increasingly demanding healthier, more nutritious options, and McDonald's has largely struggled to transform itself.

With both IBM and McDonald's fighting for relevance, which stock is the better buy right now?

Big Blue's beaten-down stock price


Image source: IBM.

IBM is going through a major transition, shifting resources toward high-value, high-growth areas like business analytics and cognitive computing. IBM calls its growth businesses "strategic imperatives," and growth has been swift. In 2015, this set of businesses grew by 26% on an adjusted basis, accounting for 35% of the company's revenue.

The rest of the business is shrinking, though, and coupled with the negative effects of a strong U.S. dollar, IBM's total revenue has been declining fast. In 2015, revenue slumped 12%, and non-GAAP net income fell 10%, with the fourth quarter, marking the 15th consecutive quarter of year-over-year revenue declines. Adjusted for currency and divestitures, revenue declined by just 1% -- still not a great result.

This prolonged revenue slump has generated a tremendous amount of pessimism surrounding IBM, and over the past few years, the stock has tumbled. A recovery over the past couple of months has allowed investors to regain some ground, but shares of IBM are still down about 28% over the past three years.

IBM Chart

IBM data by YCharts.

The stock is relatively inexpensive based on IBM's guidance for 2016. The company expects non-GAAP EPS of at least $13.50, with currency having a major negative effect, putting the forward price-to-earnings ratio at about 11. A slumping stock price has also made IBM a solid dividend stock, with a yield of about 3.4%.

Whether IBM is a bargain at this price depends on whether the turnaround succeeds. The strategy is to focus on areas where IBM can deliver value and build a competitive advantage. In the cloud computing market, while IBM does compete in the infrastructure-as-a-service segment, delivering software like Watson and other as-a-service analytics offerings, and helping clients move to the cloud, are areas where IBM can truly differentiate itself. IBM's turnaround isn't guaranteed to be a success, and a return to earnings growth may still be years away, but the company's strategy makes sense. Investors will need to be patient.

All-day breakfast

Image source: McDonald's.

McDonald's went through a bit of a rough patch in 2014 and 2015. Revenue and profits declined in both of those years, with EPS of $4.80 in 2015 the lowest since 2010. Global comparable sales declined for six straight quarters, driven by execution issues as well as increased competition. Initiatives meant to boost sales overcomplicated the menu, slowing down service and frustrating franchisees. Meanwhile, fast-casual chains that tout healthy, natural ingredients have grown more popular than ever, pressuring traditional fast-food companies.

McDonald's has started to turn things around, and its all-day breakfast initiative helped drive an increase in comparable sales during the third quarter of last year. However, the effort has further complicated the menu, and franchisees view it as a disaster, according to a survey done by Nomura analyst Mark Kalinowski.

Despite the problems at McDonald's, the stock has been on a tear over the past year, a surge that ended a few years of stagnation. Shares of McDonald's are currently sitting at an all-time high of around $127, up 32% over the past 12 months.

MCD Chart

MCD data by YCharts.

McDonald's generous capital return policy has been one thing driving the stock. The company plans to return a total of $30 billion to shareholders during the three-year period ending 2016 -- $10 billion more than its previously announced plan. Much of this extra $10 billion will be funded with debt, but the scope of the buyback program should reduce the share count substantially.

It terms of valuation, McDonald's is not a cheap stock like IBM. Based on 2015 earnings, shares of McDonald's trade at a P/E ratio of about 26.5, a number that bakes in the assumption that the company will return to robust growth sooner rather than later. McDonald's is buying back shares at this elevated valuation, and raising debt to do so, which brings into question the wisdom of the company's capital return policy.

Which is a better buy? I'd say it's IBM hands down. Both companies are facing their fair share of issues, but McDonald's is priced as if there's nothing but smooth sailing ahead. There's no argument that McDonald's has a fantastic business model, with lush margins and a high return on investment. However, the elevated stock price and the short-sighted capital return policy make McDonald's a stock to avoid, at least until the price comes down.