C code for lofasm data IO