The lungfish developed an extra organ that protruded from its gut. It consisted of many thin blood vessels that allows blood to pick up oxygen from the lung. As a result of this adaptation, two anterior gill arches eventually lost their gills, causing a direct linkage from the heart to the dorsal aorta. The twin atria in modern mammals likely developed as a result of these adaptations.
Work Step by Step