Function at 0x508640
Capabilities:
Resolve function by parsing pe exports

Disassembly:
sub esp, 0x4c
push ebx
push ebp
push esi
mov esi, ecx
test esi, esi
push edi
je 0x50889d
mov eax, dword [esi + 8]
test eax, eax
jle 0x50889d
mov ecx, dword [esi]
test ecx, ecx
jle 0x50889d
mov eax, dword [esi + 4]
test eax, eax
jle 0x50889d
mov edi, dword [esp + 0x6c]
test edi, edi
je 0x50889d
mov eax, dword [edi + 8]
test eax, eax
jle 0x50889d
mov ebp, dword [edi]
test ebp, ebp
jle 0x50889d
mov edx, dword [edi + 4]
test edx, edx
jle 0x50889d
mov ebx, dword [esp + 0x60]
mov eax, dword [esp + 0x64]
add ecx, ebx
mov dword [esp + 0x40], eax
mov dword [esp + 0x44], ecx
mov ecx, dword [esi + 4]
add ecx, eax
mov eax, dword [esp + 0x70]
mov dword [esp + 0x48], ecx
mov ecx, dword [esp + 0x74]
mov dword [esp + 0x2c], eax
add ebp, eax
add edx, ecx
mov dword [esp + 0x30], ecx
lea eax, [esp + 0x2c]
mov dword [esp + 0x38], edx
lea ecx, [esp + 0x3c]
push eax
lea edx, [esp + 0x50]
push ecx
push edx
mov dword [esp + 0x48], ebx
mov dword [esp + 0x40], ebp
call dword [sym.imp.user32.dll_IntersectRect]
mov ecx, dword [esp + 0x50]
mov eax, dword [esp + 0x4c]
mov edx, dword [esp + 0x54]
mov dword [esp + 0x20], ecx
mov dword [esp + 0x1c], eax
mov eax, dword [esp + 0x58]
lea ecx, [esp + 0x1c]
mov dword [esp + 0x24], edx
push ecx
mov dword [esp + 0x2c], eax
call dword [sym.imp.user32.dll_IsRectEmpty]
test eax, eax
jne 0x50889d
mov eax, dword [esp + 0x24]
mov ecx, dword [esp + 0x1c]
mov edx, dword [esp + 0x28]
sub eax, ecx
mov dword [esp + 0x6c], eax
mov eax, dword [esp + 0x20]
mov ebp, dword [esi + 0xc]
mov esi, dword [esi]
sub edx, eax
mov dword [esp + 0x60], esi
mov dword [esp + 0x10], edx
mov edx, dword [esp + 0x68]
mov esi, eax
lea edx, [edx + edx*2]
lea edx, [ebp + edx*4]
mov ebp, dword [esp + 0x64]
sub esi, ebp
mov ebp, dword [edi + 0xc]
imul esi, dword [esp + 0x60]
sub esi, ebx
mov ebx, dword [edx + 8]
add esi, ecx
mov edi, dword [edi]
mov dword [esp + 0x18], edi
lea ebx, [ebx + esi*4]
mov esi, dword [esp + 0x78]
lea esi, [esi + esi*2]
lea esi, [ebp + esi*4]
mov ebp, dword [esp + 0x74]
sub eax, ebp
mov ebp, dword [esp + 0x70]
imul eax, edi
sub eax, ebp
add eax, ecx
mov ecx, dword [esi + 8]
lea ebp, [ecx + eax*4]
mov eax, dword [edx]
cmp eax, 0xff000000
mov dword [esp + 0x64], eax
je 0x5087c9
mov ecx, eax
xor edx, edx
mov dl, byte [esp + 0x66]
and ecx, 0xff
shl ecx, 0x10
or edx, ecx
and eax, 0xff00
or edx, eax
mov dword [esp + 0x74], 1
mov dword [esp + 0x78], edx
xor eax, eax
jmp 0x5087cf
xor eax, eax
mov dword [esp + 0x74], eax
mov esi, dword [esi]
cmp esi, 0xff000000
mov dword [esp + 0x64], esi
je 0x508806
mov ecx, esi
xor edx, edx
mov dl, byte [esp + 0x66]
and ecx, 0xff
shl ecx, 0x10
or edx, ecx
and esi, 0xff00
or edx, esi
mov dword [esp + 0x64], 1
mov dword [esp + 0x14], edx
jmp 0x50880a
mov dword [esp + 0x64], eax
mov ecx, dword [esp + 0x10]
mov dword [esp + 0x68], eax
cmp ecx, eax
jle 0x50889d
mov ecx, dword [esp + 0x6c]
cmp ecx, eax
mov edx, ebx
mov esi, ebp
mov dword [esp + 0x70], eax
jle 0x508881
mov eax, dword [edx]
mov ecx, dword [esi]
mov edi, dword [esp + 0x74]
add edx, 4
add esi, 4
test edi, edi
je 0x508842
cmp eax, dword [esp + 0x78]
je 0x50886a
and eax, 0xff000000
cmp eax, 0xff000000
je 0x50886a
mov eax, dword [esp + 0x64]
test eax, eax
je 0x50885c
cmp ecx, dword [esp + 0x14]
je 0x50886a
and ecx, 0xff000000
cmp ecx, 0xff000000
jne 0x5088a9
mov eax, dword [esp + 0x70]
mov ecx, dword [esp + 0x6c]
inc eax
cmp eax, ecx
mov dword [esp + 0x70], eax
jl 0x50882a
mov edi, dword [esp + 0x18]
xor eax, eax
mov edx, dword [esp + 0x60]
mov esi, dword [esp + 0x10]
lea ebp, [ebp + edi*4]
lea ebx, [ebx + edx*4]
mov edx, dword [esp + 0x68]
inc edx
cmp edx, esi
mov dword [esp + 0x68], edx
jl 0x50881e
pop edi
pop esi
pop ebp
xor eax, eax
pop ebx
add esp, 0x4c
ret 0x1c
pop edi
pop esi
pop ebp
mov eax, 1
pop ebx
add esp, 0x4c
ret 0x1c