optimization - Assembly uses CALL ESI 3 times on GetTickCount why? -
can explain why gettickcount
called 3 times in row when 1 result used?
this isn't whole function of assembly part has gettickcount many times. don't think it's human error in programming that? sort of optimization trick or compiler screw up?
the output below ollydbg
00412eb0 /$ 81ec f4010000 sub esp,1f4 00412eb6 |. 53 push ebx 00412eb7 |. 55 push ebp 00412eb8 |. 56 push esi 00412eb9 |. 8b35 14b24d00 mov esi,dword ptr ds:[<&kernel32.gettick>; kernel32.gettickcount 00412ebf |. 57 push edi 00412ec0 |. ffd6 call esi ; [gettickcount 00412ec2 |. ffd6 call esi ; [gettickcount 00412ec4 |. ffd6 call esi ; [gettickcount 00412ec6 |. 8bc8 mov ecx,eax 00412ec8 |. b8 cdcccccc mov eax,cccccccd 00412ecd |. f7e1 mul ecx 00412ecf |. c1ea 03 shr edx,3 00412ed2 |. 895424 14 mov dword ptr ss:[esp+14],edx 00412ed6 |. ffd6 call esi ; [gettickcount 00412ed8 |. ffd6 call esi ; [gettickcount 00412eda |. ffd6 call esi ; [gettickcount 00412edc |. 8bd0 mov edx,eax 00412ede |. b8 cdcccccc mov eax,cccccccd 00412ee3 |. f7e2 mul edx 00412ee5 |. c1ea 03 shr edx,3 00412ee8 |. 895424 1c mov dword ptr ss:[esp+1c],edx 00412eec |. ffd6 call esi ; [gettickcount 00412eee |. 8b0d a87c4300 mov ecx,dword ptr ds:[437ca8] 00412ef4 |. 33c0 xor eax,eax 00412ef6 |. 3bc8 cmp ecx,eax 00412ef8 |. 894424 18 mov dword ptr ss:[esp+18],eax 00412efc |. a3 20594d00 mov dword ptr ds:[4d5920],eax
hex-ray's decompiled result
dword gettickcountdivideddby10; // [sp+14h] [bp-1f0h]@1 unsigned int v41; // [sp+18h] [bp-1ech]@1 dword gettickcountdividedby10; // [sp+1ch] [bp-1e8h]@1 gettickcount(); gettickcount(); gettickcountdivideddby10 = gettickcount() / 0xa; gettickcount(); gettickcount(); gettickcountdividedby10 = gettickcount() / 0xa; gettickcount(); v41 = 0; dword_4d5920 = 0;
executable file: http://www.mediafire.com/download/qnqb00q4yk4kq6v/
Comments
Post a Comment