In case you haven't noticed, the stock market ended the first half of the year within a stone's throw of an all-time high. Although stock market corrections -- that is, declines of at least 10% from recent highs -- are commonplace, the market has shown its resilience time and again. Since 1950, all 37 corrections in the S&P 500 have been firmly placed in the rearview mirror.

However, just because the stock market is heading higher doesn't mean every stock is necessarily faring well. As a predominantly contrarian investor who loves to buy unpopular value stocks, I can attest firsthand that all-time highs for the S&P 500 rarely lend to new highs for my portfolio. But that doesn't stop me from scooping up value stocks and hanging on for the long haul.

Since the year began, I've actively been buying shares of two stocks that, based on analyst recommendations and share-price performance, Wall Street absolutely hates.

An investor writing and circling the word "buy" underneath a dip on a stock chart.

Image source: Getty Images.

Teva Pharmaceutical Industries

A strong argument can be made that generic and branded drug developer Teva Pharmaceutical Industries (TEVA 0.63%) is the most-hated stock on Wall Street. And make no mistake about it, there are valid reasons why the company has shed 85% of its value over the past four years. (Take a deep breath.) Teva has been buried by debt following its Actavis acquisition, is contending with generic-price weakness and litigation concerns as an opioid retailer, settled with the Justice Department over international bribery allegations, cut its outlook multiple times, had its lead drug hit by generic competitors, and eliminated its dividend.

And yes...this is a company I have actively bought into many times over in recent weeks.

The biggest negative for Teva had always been the inevitable loss of patent protection on Copaxone, the company's blockbuster multiple sclerosis injection. Teva reformulated the drug in an effort to stave off generic competitors and utilized the courts as long as it could to keep competitors out of the picture, but generic competition was always expected. With the worst of this sales loss out of the way and opioid litigation concerns overdone, I believe now is the time to get aggressive with Teva.

Prescription drug tablets covering a one-hundred-dollar bill, with Ben Franklin's eyes peering out between the pills.

Image source: Getty Images.

Following its Actavis acquisition, Teva became the largest generic-drug producer in the world. Although generics are lower-margin products than brand-name therapies, this is a volume-based business that favors Teva. Since the global population is getting older and access to medical care is improving, the thought here is that Teva is primed to succeed in the numbers game over the long run. Plus, the sheer vastness of its portfolio should give it significant longer-term pricing power.

The debt also isn't as big a worry as Wall Street makes it out to be. While Teva isn't exactly going to be making an Actavis-like acquisition anytime soon, the company has reduced its net debt by about $8 billion in two years. Some of this reduction has derived from the sale of noncore assets (e.g., its women's health operations), whereas the bulk has come from using its continued strong operating cash flow to reduce debt.

All told, Teva is valued at less than four times 2019 and 2020 earnings per share, which is historically cheap by any measure for any healthcare industry. Even if lawmakers throw the book at Teva for its opioid role, that's perhaps $4 billion in aggregate fines that are amortized over many years. Yet Teva is still generating $2 billion or more in operating cash flow per year. The worries here are overblown, which makes Teva one of my favorite stocks to buy at the moment.

An offshore drilling rig in the water.

Image source: Getty Images.

Noble Corp.

Though Teva might be the most-hated individual stock in the entire market, no industry seems to be more loathed by the investment community than offshore drillers.

Lower oil prices (since 2014) and a more competitive environment for offshore drilling have negatively impacted what drillers are able to net in daily pay (known as dayrate). That's a problem considering that many of these offshore drillers went deeply into debt to expand and/or modernize their fleets in the latter part of the previous decade and early part of the current decade. This describes why so many offshore drillers, including Noble (NEBLQ), have been decimated.

Despite seeing them decline roughly 95% since the beginning of 2014, Yours Truly has been actively gobbling up shares of Noble on its recent drop below $2 a share. Even with the risk of delisting or a reverse split on the horizon if Noble's share price drops below $1, I see too much value here.

In a recent company presentation, Noble's data showed that 98% of the company's jack-up fleet was being utilized in the second quarter, up from 80% in the year-ago period. Further, backlog for jack-ups reached $124.2 million as of the end of May, up from $71.1 million at the end of May 2018. Among the offshore landscape, jack-up rigs are among the first to feel the positive effects of higher oil prices. With one of the youngest offshore jack-up fleets, Noble should be a prime beneficiary of OPEC's efforts to reduce global supply.

Barrels filled with oil lined up in a row.

Image source: Getty Images.

Furthermore, Noble's data presents evidence that the market for offshore contracts isn't as dire as Wall Street would lead you to believe. Since the end of 2017, the dayrate for Noble's jack-up rigs has risen between 80% and 90% for its four North Sea contracts and 50% to 70% for its seven Middle East contracts. Sure, the actual number of contracted days could be improved for its jack-up fleet on a 12-month forward basis, but we're already seeing tangible improvements in utilization and the price Noble is charging per day of drilling. The relatively young age of its fleet helps with dayrate pricing, too.

Most important, while being priced at bankruptcy levels, Noble has only $629 million in various debt maturities through 2023 but is fully capable of generating $90 million to $230 million in operating cash flow per year between 2020 and 2022 (2019 is the company's perceived trough year). Keep in mind that these cash-flow assessments could easily improve if oil prices were to rise modestly from current levels and stick.

Things may look dire with Noble, but I'm placing a wager that Wall Street's emotions have gotten the better of investors.