Here is a C code helper.