Dune
As I remember it (haven't looked it up) the O2 on Arrakis was belched out by the sandworms. The thermodynamics and chemistry weren't all that clear. Don't know the official story on Tatooine, but I suspect plenty of fans have put forth speculation.
