SHANGHAI, Aug 10 (Reuters) - Microsoft Corp has emerged as the most likely buyer of the U.S. operations of TikTok, the popular Chinese short-video app that U.S. President Donald Trump is preparing to effectively ban on national security grounds.

A deal would be in line with Microsoft's stance toward China where the firm has a sizeable presence - unlike fellow U.S. tech heavyweights such as Facebook Inc and Alphabet Inc's Google which appear to have given up on China's consumer-facing market with its miscellany of government strictures.

The country accounts for over $2 billion in annual revenue, Microsoft President Brad Smith said earlier this year.

WHAT DOES MICROSOFT DO IN CHINA?

Microsoft employs roughly 6,000 people in the country, with offices in Shanghai, Beijing and Suzhou.

Its flagship Windows operating system is widely used, though revenue has long been crimped by piracy. In recent years the firm has pushed its Azure cloud computing product, launched in 2013 via a partnership with local data service company 21Vianet.

China's cyber-security law limits Microsoft to providing Azure's software and services while 21Vianet runs associated data centres. It is a small player in a sector dominated by local providers Alibaba Group Holding Ltd, Baidu Inc , Tencent Holdings Ltd and Huawei Technologies Co Ltd.

Microsoft operates both its Bing search engine and LinkedIn social network in China, though again is a small player compared with local giants.

Its most important China operation is arguably the Microsoft Research Asia, famous as a leader in artificial intelligence (AI).

Founded in 1998 with help from renowned Taiwanese-American AI scientist Kaifu Lee - who went on to lead Google's China office - the lab has produced alumni who went on to become executives at TikTok owner ByteDance, Baidu, Xiaomi Corp and Chinese facial recognition unicorns.

DOES MICROSOFT SELF-CENSOR IN CHINA?

Bing and LinkedIn in China appear similar to their global counterparts but Microsoft censors search results and content the Chinese government considers sensitive.

Upon LinkedIn's China launch in 2014, two years before the company was bought by Microsoft, then-Chief Executive Jeff Weiner said censoring content would be "necessary" for the firm to grow in the country.

In 2019, free speech advocates criticised LinkedIn's position on censorship after human rights activist Zhou Fengsuo said his profile was not viewable in China. LinkedIn blamed an "error" and restored its visibility.

Software development website GitHub, which Microsoft purchased in 2019, is also accessible from China. The site, a coding repository, has been used by activists in China to preserve internet content before authorities censor the source.

HAS MICROSOFT HAD SCRAPES WITH CHINA'S GOVERNMENT?

Microsoft has bemoaned rampant piracy of Windows in China for decades and has occasionally filed lawsuits and complaints even against state-backed companies to address its concerns.

Its most notable tussle with the government was in 2014 when authorities raided four Microsoft offices demanding access to contracts and other information as part of an anti-trust investigation.

The same year, the government called on all agencies to ban the purchase of Windows 8 citing security reasons.

Microsoft eventually released a "China Government" edition of Windows 10 following a joint venture formed in 2015 with state-owned China Electronics Technology Corp.

WHAT ABOUT BILL GATES?

Microsoft co-founder Bill Gates has spoken in mostly positive terms about China in recent years. In November, he held a public meeting with Peng Liyuan, wife of President Xi Jinping.

Also late last year, Gates criticised the U.S. government's restrictions on telecommunications equipment maker Huawei and spoke about sharing Windows source code with China's government which aided official acceptance of the software in the country.

He has praised China's response to COVID-19, which earned him public thanks from Xi, and the Bill & Melinda Gates Foundation has donated $5 million to China for COVID-19 relief.

The foundation is one of few overseas charities or non-governmental organisations to maintain operations in China, where it has worked with the government and academic institutions against diseases such as malaria and tuberculosis. (Reporting by Josh Horwitz; Editing by Christopher Cushing)