atexit: clean up all the atexit code and fix the improper casts
Turns out atexit isn't a cc65 bug rather an interesting property of the
compiler.
cc65 requires the called function to unstack the arguments so that it can
fold together the argument popping and local recovery. This means that
calling a function declared as foo(void) cast as foo(int) doesn't work and
trashes your local variables.
A new to me and excitingly novel way of shooting yourself in the boot, but
perfectly valid compiler behaviour.