The Evolutionary Origin of Biological Function and Complexity