Inside indexedAccess function (Release build)
•
•// Both functions useArray and indexedAccess are in the same compilation unit
•
•Arrays!indexedAccess:
•nop
•nop
•nop
•nop
•nop
•mov     eax,[esp+0x4] ; arrayParam ;
•mov     dword ptr [eax+0x4],0x2 ; arrayParam[1]
•mov     dword ptr [eax+0x2c],0x4 ; arrayParam[11]
•nop
•mov     ecx,[esp+0x8] ; index
•mov     dword ptr [eax+0x28],0x1 ; arrayParam[10]
•mov     dword ptr [eax],0x2 ; arrayParam[0]
•mov     eax,[eax+ecx*4] ; arrayParam[index]
•ret
•
•// If you think VC7 compiler is too smart see next slides where I put both functions into different compilation units
•