Oxygen in the Earth's core: a first-principles study