int __cdecl s_atoi(const char *s) { static int _acu_;
__asm{ mov _acu_, 0x00 sub esp, 0x4 mov ecx, 0xa mov edi, s cmp [edi], 0x2d /* - */ jne __it inc edi mov [esp], 0x1 call __cmp __it: call __cmp movzx ebx, [edi] sub bl, '0' mov eax, _acu_ mul ecx add eax, ebx mov _acu_, eax inc edi cmp byte ptr[edi], 0x00 jne __it jmp __exit __atexit: add esp, 0x4 jmp __exit __ret: ret
__cmp: cmp byte ptr[edi], 0x39 ja __atexit cmp byte ptr[edi], 0x30 jb __atexit ret __exit: cmp [esp], 0x1 je __neg add esp, 0x4 jmp __ex __neg: neg _acu_ add esp, 0x4 __ex: } return _acu_; } |