C-implementation of NAC