ATT syntax.
I’m trying to understand what the following piece of assembly code does:
movl 8(%ebp), %edx
movl $0, %eax
testl %edx, %edx
je .L7
.L10:
xorl %edx, %eax
shrl %edx
jne .L10
.L7:
andl $1, %eax
It’s supposed to be the body of a function with one parameter: unsigned x. I know that this is a do-while loop but how can I completely convert it to C code?
1 Answer