Same result: Zero, when using sub result, result.
Why do we need to clear result, anyway ? Won't it be overwritten then by bsr result, n?
EDIT: Isn't n passed to the function in EAX, and result is also EAX ? Then xor result, result would simply set the argument to zero.
I just read this - "Important to note, however, that the registers used for a 32-bit resp. a 64-bit target are not the same! On a 32-bit platform, the registers used for the arguments are EAX and EDX, the function return value having to be in EAX. On a 64-bit platform, the registers used for the arguments are RCX, RDX, R8 and R9, the function return value having to be in RAX."
That would explain why the code does not work in 32 bit mode.