use inner function to avoid the 'cmp' mangling