I am a beginner in RE. I compiled some code (x86 32bit), and opened it up in Ghidra. I come across the following instruction block:
CALL _strcmp
MOV dword ptr [EBP + local_1c], EAX
MOV EAX, dword ptr [EBP + local_1c]
ADD EAX, 0x4
CMP EAX, 0x8
JA LAB_xxxx
I understand this takes the return value of _strcmp and decides whether to jump or not. But why does the compiler decide to add the ADD EAX, 0x4 instruction right before the CMP? Shouldn't it simply CMP to 0x4 in the first place? (Which is also what I have in my code: if x<=4...)
Thanks!