Maybe could help disabling optimization before the asm function and reenabling it after with {$O-} and {$O+}.
I'm wondering about registers used too. In free pascal you can tell to compiler the registers used, so it will preserve them, though I'm not sure about delphi:

[pascal]procedure foo (value: longint); assembler;
asm
mov ebx, eax
...
...
end ['ebx'];
[/pascal]

:think: