waldwolf functions converted into plain C.