I've made some comments throughout (mostly minor changes). Some other observations:
No changes for 2.1 as there's no way to ensure the compiler doesn't optimise this out
No changes for 3.3
3.4 I believe is using some short circuiting behavior to return values to the caller, even though the proof may not have been created, @jaspervdm can confirm
3.6 I believe there is an ARG_CHECK for nbits already (I might be missing something about what the issue is saying?)
I've made some comments throughout (mostly minor changes). Some other observations: