Laszlo: Thx that got me somewhere.
I got this output from msvc'08: (output looks better with tab==8 spaces in your editor)
Code:
; Listing generated by Microsoft (R) Optimizing Compiler Version 15.00.30729.01
TITLE p:\My Documents\AutoHotkey\RegionGetColor\SumIntBytes.c
.686P
.XMM
include listing.inc
.model flat
INCLUDELIB MSVCRTD
INCLUDELIB OLDNAMES
PUBLIC _SumIntBytes
EXTRN __RTC_Shutdown:PROC
EXTRN __RTC_InitBase:PROC
; COMDAT rtc$TMZ
; File p:\my documents\autohotkey\regiongetcolor\sumintbytes.c
rtc$TMZ SEGMENT
__RTC_Shutdown.rtc$TMZ DD FLAT:__RTC_Shutdown
rtc$TMZ ENDS
; COMDAT rtc$IMZ
rtc$IMZ SEGMENT
__RTC_InitBase.rtc$IMZ DD FLAT:__RTC_InitBase
; Function compile flags: /Odtp /RTCsu /ZI
rtc$IMZ ENDS
; COMDAT _SumIntBytes
_TEXT SEGMENT
_i$ = -8 ; size = 4
_x$ = 8 ; size = 4
_l$ = 12 ; size = 4
_a$ = 16 ; size = 4
_b$ = 20 ; size = 4
_c$ = 24 ; size = 4
_d$ = 28 ; size = 4
_SumIntBytes PROC ; COMDAT
; 19 : {
00000 55 push ebp
00001 8b ec mov ebp, esp
00003 81 ec cc 00 00
00 sub esp, 204 ; 000000ccH
00009 53 push ebx
0000a 56 push esi
0000b 57 push edi
0000c 8d bd 34 ff ff
ff lea edi, DWORD PTR [ebp-204]
00012 b9 33 00 00 00 mov ecx, 51 ; 00000033H
00017 b8 cc cc cc cc mov eax, -858993460 ; ccccccccH
0001c f3 ab rep stosd
; 20 : uint i;
; 21 : for(i = 0; i < l; i = i + 1)
0001e c7 45 f8 00 00
00 00 mov DWORD PTR _i$[ebp], 0
00025 eb 09 jmp SHORT $LN3@SumIntByte
$LN2@SumIntByte:
00027 8b 45 f8 mov eax, DWORD PTR _i$[ebp]
0002a 83 c0 01 add eax, 1
0002d 89 45 f8 mov DWORD PTR _i$[ebp], eax
$LN3@SumIntByte:
00030 8b 45 f8 mov eax, DWORD PTR _i$[ebp]
00033 3b 45 0c cmp eax, DWORD PTR _l$[ebp]
00036 0f 83 94 00 00
00 jae $LN4@SumIntByte
; 22 : {
; 23 : //return *a;
; 24 : //return x[i] >> 8 & 0xff;
; 25 : *a = *a + (x[i] >> 24);
0003c 8b 45 f8 mov eax, DWORD PTR _i$[ebp]
0003f 8b 4d 08 mov ecx, DWORD PTR _x$[ebp]
00042 8b 14 81 mov edx, DWORD PTR [ecx+eax*4]
00045 c1 ea 18 shr edx, 24 ; 00000018H
00048 33 c0 xor eax, eax
0004a 8b 4d 10 mov ecx, DWORD PTR _a$[ebp]
0004d 03 11 add edx, DWORD PTR [ecx]
0004f 8b 49 04 mov ecx, DWORD PTR [ecx+4]
00052 13 c8 adc ecx, eax
00054 8b 45 10 mov eax, DWORD PTR _a$[ebp]
00057 89 10 mov DWORD PTR [eax], edx
00059 89 48 04 mov DWORD PTR [eax+4], ecx
; 26 : *b = *b + (x[i] >> 16 & 0xff);
0005c 8b 45 f8 mov eax, DWORD PTR _i$[ebp]
0005f 8b 4d 08 mov ecx, DWORD PTR _x$[ebp]
00062 8b 14 81 mov edx, DWORD PTR [ecx+eax*4]
00065 c1 ea 10 shr edx, 16 ; 00000010H
00068 81 e2 ff 00 00
00 and edx, 255 ; 000000ffH
0006e 33 c0 xor eax, eax
00070 8b 4d 14 mov ecx, DWORD PTR _b$[ebp]
00073 03 11 add edx, DWORD PTR [ecx]
00075 8b 49 04 mov ecx, DWORD PTR [ecx+4]
00078 13 c8 adc ecx, eax
0007a 8b 45 14 mov eax, DWORD PTR _b$[ebp]
0007d 89 10 mov DWORD PTR [eax], edx
0007f 89 48 04 mov DWORD PTR [eax+4], ecx
; 27 : *c = *c + (x[i] >> 8 & 0xff);
00082 8b 45 f8 mov eax, DWORD PTR _i$[ebp]
00085 8b 4d 08 mov ecx, DWORD PTR _x$[ebp]
00088 8b 14 81 mov edx, DWORD PTR [ecx+eax*4]
0008b c1 ea 08 shr edx, 8
0008e 81 e2 ff 00 00
00 and edx, 255 ; 000000ffH
00094 33 c0 xor eax, eax
00096 8b 4d 18 mov ecx, DWORD PTR _c$[ebp]
00099 03 11 add edx, DWORD PTR [ecx]
0009b 8b 49 04 mov ecx, DWORD PTR [ecx+4]
0009e 13 c8 adc ecx, eax
000a0 8b 45 18 mov eax, DWORD PTR _c$[ebp]
000a3 89 10 mov DWORD PTR [eax], edx
000a5 89 48 04 mov DWORD PTR [eax+4], ecx
; 28 : *d = *d + (x[i] & 0xff);
000a8 8b 45 f8 mov eax, DWORD PTR _i$[ebp]
000ab 8b 4d 08 mov ecx, DWORD PTR _x$[ebp]
000ae 8b 14 81 mov edx, DWORD PTR [ecx+eax*4]
000b1 81 e2 ff 00 00
00 and edx, 255 ; 000000ffH
000b7 33 c0 xor eax, eax
000b9 8b 4d 1c mov ecx, DWORD PTR _d$[ebp]
000bc 03 11 add edx, DWORD PTR [ecx]
000be 8b 49 04 mov ecx, DWORD PTR [ecx+4]
000c1 13 c8 adc ecx, eax
000c3 8b 45 1c mov eax, DWORD PTR _d$[ebp]
000c6 89 10 mov DWORD PTR [eax], edx
000c8 89 48 04 mov DWORD PTR [eax+4], ecx
; 29 : }
000cb e9 57 ff ff ff jmp $LN2@SumIntByte
$LN4@SumIntByte:
; 30 : }
000d0 5f pop edi
000d1 5e pop esi
000d2 5b pop ebx
000d3 8b e5 mov esp, ebp
000d5 5d pop ebp
000d6 c3 ret 0
_SumIntBytes ENDP
_TEXT ENDS
END
I'm assuming i need the second part from 00000 to 000d6:
Code:
55
8b ec
81 ec cc 00 00
00
53
56
57
8d bd 34 ff ff
ff
b9 33 00 00 00
b8 cc cc cc cc
f3 ab
c7 45 f8 00 00
00 00
eb 09
8b 45 f8
83 c0 01
89 45 f8
8b 45 f8
3b 45 0c
0f 83 94 00 00
00
8b 45 f8
8b 4d 08
8b 14 81
c1 ea 18
33 c0
8b 4d 10
03 11
8b 49 04
13 c8
8b 45 10
89 10
89 48 04
8b 45 f8
8b 4d 08
8b 14 81
c1 ea 10
81 e2 ff 00 00
00
33 c0
8b 4d 14
03 11
8b 49 04
13 c8
8b 45 14
89 10
89 48 04
8b 45 f8
8b 4d 08
8b 14 81
c1 ea 08
81 e2 ff 00 00
00
33 c0
8b 4d 18
03 11
8b 49 04
13 c8
8b 45 18
89 10
89 48 04
8b 45 f8
8b 4d 08
8b 14 81
81 e2 ff 00 00
00
33 c0
8b 4d 1c
03 11
8b 49 04
13 c8
8b 45 1c
89 10
89 48 04
e9 57 ff ff ff
5f
5e
5b
8b e5
5d
c3
Which results, when contat:
Code:
558bec81eccc0000005356578dbd34ffffffb933000000b8ccccccccf3abc745
f800000000eb098b45f883c0018945f88b45f83b450c0f83940000008b45f88b
4d088b1481c1ea1833c08b4d1003118b490413c88b451089108948048b45f88b
4d088b1481c1ea1081e2ff00000033c08b4d1403118b490413c88b4514891089
48048b45f88b4d088b1481c1ea0881e2ff00000033c08b4d1803118b490413c8
8b451889108948048b45f88b4d088b148181e2ff00000033c08b4d1c03118b49
0413c88b451c8910894804e957ffffff5f5e5b8be55dc3
Does this look right?