PuremeM: A structured programming model for transiently powered computers