SEOUL -- Things looked bright for Samsung Electronics in 2016. The company had just announced South Korea's biggest-ever corporate takeover. Halfway around the world the future U.S. president was also using a Galaxy smartphone to tweet scathing attacks against the company's archrival Apple.
But a lot can change in three years.
Trump swapped his Galaxy for an iPhone. More significantly, he launched a trade war that radically altered the global tech landscape, and with that Samsung's future.
Today, the world's biggest smartphone maker must grapple not only with the uncertainty of the trade war, but also a slump in its mainstay chip business, the rapid rise of Chinese tech rivals and a resurgent Apple.
Worse still, the man who is expected to continue steering Samsung through these challenges may be on his way to jail.
2016 already seems like a distant memory to many at Samsung, a company that in many ways defines South Korea.
Back then Lee Jae-yong, vice chairman of Samsung Electronics but in reality the group's de facto leader and heir apparent, had just spearheaded the $8 billion acquisition of Harman, the U.S. audio components maker.
The news conference announcing the deal was watched with excitement in Seoul, and for good reason: where Samsung goes, so goes the South Korean economy. The company accounts for 20% of the country's exports, employs 310,000 people across its affiliates, and its market value accounts for one fifth of the country's benchmark stock market. Its influence in the country is such that people joke that South Korea is the Republic of Samsung.
More importantly, the deal was the first big move by Lee, who just two months earlier had taken over a board seat. Everyone was curious to see how he would put his stamp on the business empire that his grandfather founded.
The omens were auspicious. Investors liked the deal as the acquisition boosted the quality of Samsung devices, particularly its smartphones, which now have a global market share of 21%. Indeed, six months later the company's share price had soared almost 50%.
Last week, however, Lee was back in the public spotlight for the wrong reasons. This time, the 51-year-old was attending a public hearing as part of a process that could see him sent to jail on a lengthy sentence for bribery.
Losing its leader now would be an especially heavy blow as the company needs to map out a strategy for future growth in an ever more uncertain world. As a South Korean company, Samsung has been spared Trump's tariffs. But no conglomerate, even one as big as Samsung, is an island.
The twin pillars of Samsung's earnings are smartphones and chips -- each provided around 3 trillion won ($2.6 billion) in operating profit in the most recent quarter. Those are huge numbers, but they also mask underlying uncertainties.
Start with smartphones, where in many ways, Samsung has had a good trade war so far.
Trump's campaign against China's Huawei Technologies, the world's largest telecoms equipment supplier and a major smartphone competitor, has been a boon for Samsung's smartphones.
Outside of China, the U.S. offensive has seen Samsung's market share rise at the expense of Huawei, which is running neck-and-neck with Apple for the No. 2 spot.
"Samsung Electronics has managed to increase its market share after facing declines in the past five years," said CW Chung, a senior analyst at Nomura. "We believe Samsung will further benefit from the U.S.'s continued restriction on Huawei."
In addition, Samsung has been adept at inserting its phones into the space opened by Huawei thanks to its mid-price line of phones.
"Samsung's new A series effectively took advantage and boosted sales volumes. This was possible because Samsung had a product portfolio that closely matched the target price range of [Huawei's] mid-to-low price lineup," Lim Su-Jeong, an analyst at Counterpoint Research, said. "In some cases, the value for money proposition was so high that making the switch was quite logical for the practical user."
As a result, Samsung's profit from its mobile and network business surged 30% on the year in the third quarter, a welcome turnaround after five years of struggling. This is in part thanks to Lee, who emphasized the importance of 5G networks and gave his full backing to the mobile division's CEO, Koh Dong-jin.
There are clouds on the horizon, however. The global smartphone market is saturated and growth was almost flat during in the third quarter, with 380 million units shipped, according to Counterpoint Research.
At the top end of the market, Apple is enjoying a strong response to its latest iPhone lineup. At the budget end meanwhile, smaller Chinese makers are snatching market share -- in Indonesia, for example, Samsung recently lost its top spot to Oppo.
Then there are semiconductor chips, the other half of the company's story. Samsung is the world's biggest maker of semiconductors by revenue, and here the picture is far less rosy.
Ostensibly, the trade war has been a blessing for Samsung here too, at least so far. The company controls 40% of the global DRAM market and about one-third of the NAND market, the two main types of memory chips. Chinese companies like Huawei, worried about being cut off from U.S. suppliers, have stockpiled DRAM chips, boosting orders from Samsung.
According to Taipei-based market intelligence firm TrendForce, Samsung's DRAM sales rose 30% in the previous quarter while revenue climbed to $7.12 billion as "Chinese smartphone vendors aggressively pulled their quarterly shipments forward."
Some within the company have even welcomed the opportunity that the dispute between Beijing and Washington has provided.
"It's true that our share of the 5G network equipment market has jumped recently," said one employee familiar with the matter asking not to be named. "It's not appropriate to talk about our rival's situation, but market researchers take the view that Huawei's trouble helped boost our market share."
The trade spat also gave Samsung a political opportunity: to woo Trump. On a visit in June, the president invited Lee and other leaders of South Korean chaebol, as the country's massive conglomerates are known, to a meeting at the Grand Hyatt in Seoul. There he praised their previous investments in the U.S. and pressed them for more.
But the longer-term picture is bleaker.
The trade tensions have spurred Beijing to build out its own chip industry faster than originally planned. A country that produced virtually no memory chips last year is slated to begin mass production next year and provide as much as 5% of the global memory chip output.
Samsung had been banking on a recovery in memory chip prices, which have sagged for two years. Indeed, Samsung's semiconductor division saw operating profit plunge almost 80% on the year in the third quarter due to the persistent downturn in DRAM and NAND prices. The expected entry of new Chinese makers could prolong that pain and put a ceiling on the recovery.
To face that challenge, the company has begun a much-touted strategic shift.
To counter the commoditization of memory chips, Samsung announced in April it will invest 133 trillion won in logic chips. These provide the brains for electronics devices, and their prices tend to be more stable than those of memory chips.
Lee himself vowed the company will be the "No. 1 player in the nonmemory sector" by 2030.
"Memory chips are a tough market.... Samsung is competitive in prices, but other can easily catch up," said Kim Kyung-won, a professor of business administration at Sejong University, who had previously worked for Samsung Economic Research Institute. "But the company would be able to command better prices in logic chips, where there is more differentiation."
Analysts say however that it could take years for Samsung to compete with the quality of market leaders such as Intel of the U.S., the leader in central processing units, or CPUs, and Japan's Sony, the top player in image sensors, another key logic chip.
In addition to the longer-term uncertainties surrounding its key phones and chip businesses, Samsung has a more immediate concern: Japan's recent restriction on certain types of exports to South Korea that Samsung needs.
Facing such an uncertain world, Samsung is understandably keen to keep its de facto chief out of jail and at the helm of the company.
Officially, Samsung is run by three CEOs in charge of the semiconductor, mobile and home appliance sectors, and the company is keeping quiet about any contingency plans it has made should Lee be sent to jail. "We cannot comment on our plan in the case of Lee's absence because nothing has come out yet," a spokesperson told Nikkei.
Lee was initially handed a two-and-a-half-year suspended sentence after being found guilty of providing millions of dollars in bribes to former South Korean President Park Geun-hye. But the Supreme Court in August overturned that sentence as insufficient and ordered a new trial, which began last month.
If the worst comes to pass and Lee is found guilty, he could return as company leader when his sentence finishes, as happened with the heads of some other chaebol figures, such as SK Group chairman Chey Tae-won and CJ Group chairman Lee Jay-hyun.
But that would be a long-distance solution to problems that are pressing now. It is Lee, as heir, who makes decisions on key group issues such as mergers and acquisitions and major investment plans like those it is making in chips. Some also fear that without Lee -- the company's self styled "center of gravity" -- Samsung will be unable to keep its global network together.
Samsung is mobilizing all its resources to defend Lee. It has taken to publicizing his activities and emphasizing his importance to the company and the country.
Some of the company's insiders, however, are skeptical whether it will be possible to keep Lee out of prison.
Investors should take note: The company's share price is near all-time highs, but when the Supreme Court ruled in August on Lee's retrial, it lost 2.5% in a day.
"Frankly speaking, we should be prepared for the worst scenario," said a senior Samsung manager, asking not to be named. "We did not expect the Supreme Court ruling, but it happened. It could happen again."
Nikkei staff writer Kotaro Hosokawa contributed to this story.