Static Transformation of Power Consumption for Program Tracing and Software Attestation