Rewrite the SRF as a C function