The Core Mass Function across Galactic Environments. II. Infrared Dark Cloud Clumps