C code for OS hws. Being evil.