What does this line of assembly do?
I have this line of assembly:
Now, according to the references out there, cmpb does an immediate compare of two bytes. So it compares 0 with (%rax,%rcx,1). Can somebody explain what this second argument is / does?
This is the AT&T syntax for
cmp BYTE PTR [rax+rcx*1], 0
So it computes the address using rax + rcx, dereference it to obtain a byte, and then compare it with the number 0.
The general syntax for this type of memory operand is:
which gives you the address:
base + disp + offset*mult
So in your case (disp is 0), cmpb compares 0 and the value stored at:
%rax + (%rcx * 1)