C++ in-file assembly
It took some finagling but I got it to work. Some hints for someone who comes in later:
Your in and out registers for your algorithm should be aliases like $[[par0]] $[[return]] (those should only be one set of brackets per but the forum software is trying to make them links) which you will define and map to variables in the return and parameter constraints of the asm block.
Even if you stack and unstack your temp registers, still put them in the "clobber" so GCC doesn't choose to try to pass your parameters in on them.
Remember the order is code-return-parameters-clobber if you mix up parameter and return GCC will happily overwrite your input with your output variable, and do it by reference because why not.
If you're porting from an assembly subroutine for the love of God, remove your "BX lr" first. Just return in your wrapping function to make life easier.
Despite what everything I read says, you can use plain old r1, r2, r3, etc. instead of %1, %2, %3.
Ignore the LDP documentation: it's very x86 oriented and may confuse you if you aren't that familiar. http://www.ethernut.de/en/documents/arm-inline-asm.html seems much better for learning instead of quick reference.