A detailed view of the heart and aortic arches

All that is fundamentally required to get the topology of the mammalian four-chambered heart from a reptile-like three-chambered heart (e.g. B, although this should not be taken as an exact representative of the ancestral state) is extension of the septum (the wall dividing the chambers and lost of the right systemic arch. The lineage leading to crocodiles evolved a four-chambered heart along a different pathway, keeping both systemic arches.

From Figure 9-5, p. 112 of: Farrell, A. P. (1997). "Evolution of cardiovascular systems: Insights into ontogeny". Development of cardiovascular systems: molecules to organisms. Burggren, W. W. and Keller, B. B., Eds. Cambridge, UK ; New York, NY, USA, Cambridge University Press: 101-113.