Made me recall this article on why the 6502 isn't great as a C target, including a follow up with some pointers on avoiding some issues with it.

https://www.xtof.info/coding-c-8-bit-6502-cpu.html

Yeah, it’s better to use a “high-level” language designed for the architecture, such as this: https://github.com/dschmenk/PLASMA