WANLs but, while Trish's answer is completely accurate for the most of the 1st world—foreign companies can simply fully own their offshore subsidiaries outright or structure their stock to always maintain controlling interest—I thought it went without saying that Smacofa wasn't 1st world and the entire point of the question was about what companies can do when that isn't the case.
Three main cases come to mind:
Dystopian Nightmare (Cyberpunk Banana)
If the parent company is economically strong enough or influential enough in a strong enough base country, it can always just deal directly with the Smacovian government over the head of its subsidiary... sometimes to the point of replacing the government with friendlier Smacovians.
Widespread corporate espionage is a thing but, in the real world, actually fielding strike forces to enforce compliance is almost exclusively used by management to deal with labor (separate US article). The exception has been when 3rd world countries have been considered labor, most infamously in the Anglosphere by the United Fruit Company (i.e. Chiquita) and the Anglo-Persian Oil Company (i.e. BP). Even then, just like management prefers to get the local gov't to handle that for them whenever possible, they mostly lean on the UK and US governments to lean on the local guys rather than doing it themselves.
Slightly less dystopianly, there are other carrot-&-stick approaches to foreign governments to get them to treat companies more favorably. In most of the world, bribery goes without saying and support for various prestige projects (e.g.) can amount to the same thing. Some companies—particularly modern social media—are building up a huge amount of influence, mostly behind the scenes through deniable algorithm tweaking and content moderation (1, 2), although even that isn't without risk (e.g.).
Contracts (Play Fair)
As colonialism gets more toxic & locals more defensive, companies can keep things generally aboveboard. In any country with reliable property rights and rule of law, even if there are restrictions on foreign ownership, the local partner (it's not a subsidiary if the parent doesn't own it) can freely enter into contracts. The foreign direct investment from the parent company simply comes with strings attached, up to and usually including control over who directs the local company and how profit sharing is going to work out.
The main issue with this one is... well, any country with functioning courts and private property safe from local leaders, police, gangs, warlords, &c. usually doesn't forbid foreign-owned companies from simply operating in their markets or owning subsidiaries outright. Google Ireland is 100% owned by Google Ireland Holding Co., 99% owned by Google Bermuda, 100% owned by Alphabet (i.e., Google). You also risk breach of contract turning out to be more profitable at some point for the local affiliate, particularly given the jurisdiction is always going to be more favorable towards them. Still, there might be specific reasons in some cases for the parent company to want to go this route, probably plausible deniability or liability or tax avoidance.
Nothing (China)
A huge exception to all of this is the PRC.
Chinese law generally forbids foreign companies from ever operating freely themselves or owning a controlling interest in their joint ventures with local companies. Local companies generally have a parallel management of Party members with tons of influence if not outright control. Xi has worked on reducing the corruption implicit in that influence and joint ventures actually have perks over domestic companies to push Chinese businessmen into setting them up... largely to facilitate technology transfer in a jurisdiction with limited legal protections in a market with tight currency controls limiting foreign investors' ability to pull out once in or even repatriate substantial profits.
Companies have still signed onto this for decades.
Some of it was pressure from the US and other western governments to help out, keeping China away from the Soviets and on a supposed path to liberalization. That's gone now but you still have an educated, hardworking, and mostly law-abiding workforce producing goods for the largest market in the world as it moves from abject poverty to working class and even to middle class by the hundreds of millions. It's a Communist government but they haven't nationalized anything lately.
You can't copy that without essentially pretending that Simcofa is China but there could be situations where your company is obliged by the Americans to partner with the Simcovians for reasons of national interest... Then you're basically hoping that the current administration (and the next few as well) will remember and be grateful, so that you end up with other contracts to make up for your losses investing in Simcofa's cobalt mines or whatever.