Just because something is new to you, doesn't mean that professionals that deal with this every day have never thought about it.
(The actual answer depends on the State, entity type, if it was dissolved or suspended, if a bankruptcy is involved, etc. and you should just consult a contracts lawyer)
> Suppose that Small Co sells the assets of a business unit to Big Co. Do you now have a contract with Small Co. or Big Co.? Small Co. no longer has the rights to the software
That's right, that's what they sold.
> Big Co. may not agree to the terms of the old license.
Then I guess maybe they shouldn't have bought it.
> Suppose someone dies and their assets go to their heirs. Do you now have a contract with the heirs?
Yes. They inherited the deceased's assets.
> What if there are no heirs, so the assets go to the government? Do you now have a contract with the government?
You'd probably have to ask an estate planning attorney about the specifics of this, but so what if you did?
> I can think of some fun terms to add to a software license from someone on their deathbed if that's the case.
You should totally do it lol
What'll happen in cases like that is that it'll be litigated, interpreted, and either amended through a settlement agreement or annulled.
As others have said, the law isn't a programming language. It's a human system that, while being rigorous, strict, structured, and binding for the most part, is nonetheless capable by design of nuance and interpretation within known and constrained bounds.
Suppose that Small Co sells the assets of a business unit to Big Co. Do you now have a contract with Small Co. or Big Co.? Small Co. no longer has the rights to the software. Big Co. may not agree to the terms of the old license.
Suppose someone dies and their assets go to their heirs. Do you now have a contract with the heirs?
What if there are no heirs, so the assets go to the government? Do you now have a contract with the government? I can think of some fun terms to add to a software license from someone on their deathbed if that's the case.