Correlation of energy loss and crystallographic transformation in ion-irradiated carbon foils