Hi Miro,
We are aware of this sub-optimal code generation issue for M0 etc. It is on our list of things to fix. Rest assured we will get to it in the near future. In the meantime, the code generated for M3 looks like T1 code and mostly valid for M0. You could compile this code snippet for M3 and link for an M0 target if you wanted a work-around.
Thanks,Tejas.