Geochemical controls on the distribution and composition of biogenic and sedimentary carbon