https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71033
--- Comment #1 from Uroš Bizjak <ubizjak at gmail dot com> --- x86 ABI requires that %ebx is preserved across function call. So, you need to save it to stack in f.s and restore it before function returs. Or, you can use %edx instead, which can be clobbered in function.