scantwopermHK: Filling out C code