otool on Mac gives this assembly for a strcmp
rep
cmpsb %es:(%edi), (%esi)
movl $__mh_bundle_header, %eax
je 0xe0eb
Some of this makes sense:
edi and esi are char pointers to the strings to be compared. cmpsb compares the first character of the two strings and increments edi and esi. rep repeats the following operation ecx times, so ecx contains the length of one of the strings.
What I don't understand:
rep is an unconditional repeat so will compare ecx characters of both strings and will only set flags for the last comparison. How does the loop stop when a mismatch is found?
What does es do? Is this used as an offset into both strings?
What is __mh_bundle_header?
Thank you for any help with this.