This commit is split up in two parts.
First, usage of DEBUG is remapped to NDEBUG, such that the behaviour of
assert(3) is as expected with --enable-debug=false (i.e. asserts get
disabled, where they previously did not).
Second, instances of `printf` guarded by `#ifdef DEBUG` blocks have been
refactored into a dedicated `debug` macro to make the code a bit easier
to follow. `debug` is a no-op when `NDEBUG` is set.