C: start of sim_dmg_max() implementation