This is (mostly) following standard Markdown rules.
But if you surround an * or _ with spaces, it’ll be treated as a literal asterisk or underscore.
So in your second example, the first asterisk opens <emp> but the second is a literal asterisk and so the <emp> is never closed.
The third example is the opposite.
So, Obsidian is being inconsistent with its parsing here, but neither example is valid Markdown so all bets are off.