Original C code