I would like to make this clear once and for all, since this seems to be a common misconception:
You can only use asm!
in a naked function, and NOTHING ELSE.
This is explicitly stated in both the GCC and Clang documentation.
The fact that this is not currently enforced by rustc is a bug, not a feature. The use of any local variables, including any inserted by rustc for temporary values can and will cause stack corruption, especially in debug builds. Just because your code seems to work correctly in release builds does not mean it doesn't have undefined behavior, it just means you got lucky and your code may break when built with a future compiler.