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

Disassembly:
sub esp, 0xac
push ebx
mov ebx, dword [esp + 0xcc]
mov ecx, dword [ebx + 4]
push ebp
push esi
mov esi, dword [ebx + 8]
cmp ecx, esi
push edi
jle 0x4be0b6
mov eax, dword [esp + 0xd0]
mov dword [esp + 0x24], eax
mov eax, esi
imul eax, dword [esp + 0xd4]
cdq
idiv ecx
cmp eax, 1
mov dword [esp + 0x18], eax
jg 0x4be0df
mov dword [esp + 0x18], 1
jmp 0x4be0df
mov edx, dword [esp + 0xd4]
mov eax, ecx
imul eax, dword [esp + 0xd0]
mov dword [esp + 0x18], edx
cdq
idiv esi
cmp eax, 1
mov dword [esp + 0x24], eax
jg 0x4be0df
mov dword [esp + 0x24], 1
cmp byte [0x598e8e], 0
jne 0x4be0fc
cmp dword [esp + 0x24], ecx
jl 0x4be0fc
cmp dword [esp + 0x18], esi
jl 0x4be0fc
mov dword [esp + 0x24], ecx
mov dword [esp + 0x18], esi
cmp dword [ebx + 0x24], 0xffffffff
je 0x4be11a
mov ebp, dword [esp + 0xd0]
mov edi, dword [esp + 0xd4]
mov dword [esp + 0x70], ebp
mov dword [esp + 0x68], edi
jmp 0x4be12e
mov eax, dword [esp + 0x24]
mov ecx, dword [esp + 0x18]
mov dword [esp + 0x70], eax
mov dword [esp + 0x68], ecx
mov ebp, eax
mov edi, ecx
mov eax, ebp
cdq
sub eax, edx
mov ecx, eax
mov eax, dword [esp + 0xd0]
cdq
sub eax, edx
mov esi, eax
mov eax, dword [esp + 0x24]
cdq
sub eax, edx
sar eax, 1
sar ecx, 1
sar esi, 1
sub esi, ecx
add esi, dword [esp + 0xc8]
sub ecx, eax
mov eax, dword [esp + 0xcc]
sub eax, edi
add eax, dword [esp + 0xd4]
mov dword [esp + 0x80], esi
mov dword [esp + 0x78], eax
mov eax, edi
sub eax, dword [esp + 0x18]
mov dword [esp + 0x90], ecx
mov dword [esp + 0x60], eax
mov eax, dword [ebx + 0xc]
test eax, eax
je 0x4be1c2
cmp dword [ebx + 0x10], ebp
jne 0x4be1b8
cmp dword [ebx + 0x14], edi
jne 0x4be1b8
cmp dword [ebx + 0x20], 0
je 0x4be1a8
mov edx, dword [esp + 0xdc]
cmp dword [ebx + 0x18], edx
jne 0x4be1b8
mov ecx, dword [esp + 0xe0]
cmp dword [ebx + 0x1c], ecx
je 0x4be864
test eax, eax
je 0x4be1c2
push eax
call fcn.004a4810
mov edx, edi
imul edx, ebp
add edx, edx
add edx, edx
push edx
call fcn.004a47b0
mov edx, dword [esp + 0xc4]
mov ecx, dword [esp + 0xe0]
mov dword [ebx + 0xc], eax
mov eax, dword [esp + 0xdc]
push eax
push edx
mov dword [ebx + 0x10], ebp
mov dword [ebx + 0x14], edi
mov dword [ebx + 0x18], eax
mov dword [ebx + 0x1c], ecx
call dword [sym.imp.GDI32.dll_GetNearestColor]
movzx ecx, al
movzx edx, ah
shr eax, 0x10
movzx eax, al
xor esi, esi
cmp dword [ebx + 0x24], 0xffffffff
mov dword [esp + 0x14], ecx
mov dword [esp + 0x10], edx
mov dword [esp + 0x28], eax
mov dword [esp + 0x1c], esi
mov dword [esp + 0x40], esi
je 0x4be286
mov ecx, dword [esp + 0xc4]
push ecx
call dword [sym.imp.GDI32.dll_CreateCompatibleDC]
test eax, eax
mov dword [esp + 0x5c], eax
je 0x4be286
lea edx, [esp + 0x88]
push edx
mov edx, dword [ebx + 0x24]
lea ecx, [esp + 0x88]
push ecx
push edi
push ebp
push eax
mov eax, dword [esp + 0xd4]
push edx
push eax
call fcn.004befa0
test eax, eax
je 0x4be27b
mov ecx, dword [esp + 0x84]
mov edx, dword [esp + 0x88]
mov dword [esp + 0x1c], ecx
mov dword [esp + 0x40], edx
mov esi, ecx
mov eax, dword [esp + 0x5c]
push eax
call dword [sym.imp.GDI32.dll_DeleteDC]
test edi, edi
mov ecx, dword [ebx + 0xc]
mov dword [esp + 0x8c], ecx
jle 0x4be83f
mov eax, dword [esp + 0x60]
neg eax
mov dword [esp + 0x58], eax
mov dword [esp + 0x5c], edi
test ebp, ebp
jle 0x4be82c
mov ecx, dword [esp + 0x90]
neg ecx
mov dword [esp + 0x60], ebp
jmp 0x4be2c0
mov ebp, dword [ebx + 4]
mov eax, ebp
imul eax, ecx
cdq
idiv dword [esp + 0x24]
add ecx, 1
mov dword [esp + 0x6c], ecx
mov dword [esp + 0x7c], ebp
mov dword [esp + 0x30], eax
mov eax, ebp
imul eax, ecx
cdq
idiv dword [esp + 0x24]
mov ecx, dword [ebx + 8]
mov dword [esp + 0x54], ecx
mov dword [esp + 0x3c], eax
mov eax, ecx
imul eax, dword [esp + 0x58]
cdq
idiv dword [esp + 0x18]
mov edi, eax
mov eax, ecx
mov ecx, dword [esp + 0x58]
add ecx, 1
imul eax, ecx
cdq
idiv dword [esp + 0x18]
xor edx, edx
mov dword [esp + 0x50], edi
mov dword [esp + 0x38], edx
mov dword [esp + 0x44], edx
mov dword [esp + 0x4c], edx
mov dword [esp + 0x2c], edx
mov dword [esp + 0x74], edx
mov dword [esp + 0x64], edi
cmp edi, eax
mov dword [esp + 0x48], eax
jge 0x4be5ae
mov eax, dword [ebx]
mov edx, ebp
imul edx, edi
add edx, dword [esp + 0x30]
lea ecx, [eax + edx*4]
mov dword [esp + 0x20], ecx
lea esp, [esp]
mov edx, dword [esp + 0x30]
mov eax, dword [esp + 0x3c]
cmp edx, eax
mov dword [esp + 0x34], edx
jge 0x4be454
sub eax, edx
add dword [esp + 0x74], eax
lea ebx, [ebx]
test edx, edx
mov eax, dword [esp + 0x64]
jl 0x4be40f
test eax, eax
jl 0x4be40f
cmp edx, ebp
jge 0x4be40f
cmp eax, dword [esp + 0x54]
jge 0x4be40f
movzx eax, byte [ecx]
movzx edi, byte [ecx + 1]
sub eax, dword [esp + 0x28]
sub edi, dword [esp + 0x10]
add ecx, 1
movzx ebp, byte [ecx + 1]
add ecx, 1
movzx ebx, byte [ecx + 1]
imul eax, ebx
imul edi, ebx
add ecx, 1
mov esi, eax
sub ebp, dword [esp + 0x14]
mov eax, 0x80808081
imul esi
imul ebp, ebx
add edx, esi
sar edx, 7
mov esi, edx
shr esi, 0x1f
add esi, edx
mov eax, 0x80808081
imul edi
add edx, edi
add esi, dword [esp + 0x28]
sar edx, 7
mov edi, edx
shr edi, 0x1f
add edi, edx
add edi, dword [esp + 0x10]
mov eax, 0x80808081
imul ebp
add edx, ebp
mov ebp, dword [esp + 0x7c]
sar edx, 7
mov eax, edx
shr eax, 0x1f
add eax, edx
add ecx, 1
add eax, dword [esp + 0x14]
jmp 0x4be420
mov esi, dword [esp + 0x28]
mov edi, dword [esp + 0x10]
mov eax, dword [esp + 0x14]
add ecx, 4
xor ebx, ebx
mov edx, dword [esp + 0x34]
add dword [esp + 0x4c], esi
add dword [esp + 0x44], edi
add dword [esp + 0x38], eax
add dword [esp + 0x2c], ebx
add edx, 1
cmp edx, dword [esp + 0x3c]
mov dword [esp + 0x34], edx
jl 0x4be370
mov edi, dword [esp + 0x50]
mov ebx, dword [esp + 0xd8]
mov esi, dword [esp + 0x1c]
mov edx, dword [esp + 0x64]
mov ecx, dword [esp + 0x20]
add edx, 1
lea eax, [ebp*4]
add ecx, eax
cmp edx, dword [esp + 0x48]
mov dword [esp + 0x64], edx
mov dword [esp + 0x20], ecx
jl 0x4be350
mov ecx, dword [esp + 0x74]
test ecx, ecx
je 0x4be5ac
mov eax, dword [esp + 0x4c]
cdq
idiv ecx
mov ebx, eax
mov eax, dword [esp + 0x44]
cdq
idiv ecx
mov dword [esp + 0x4c], ebx
mov ebp, eax
mov eax, dword [esp + 0x38]
cdq
idiv ecx
mov dword [esp + 0x44], ebp
mov edi, eax
mov eax, dword [esp + 0x2c]
cdq
idiv ecx
test esi, esi
mov dword [esp + 0x38], edi
mov dword [esp + 0x2c], eax
je 0x4be59f
movzx ebp, byte [esi]
movzx ebx, byte [esi + 1]
mov eax, dword [esp + 0x40]
add esi, 1
movzx ecx, byte [esi + 1]
add eax, 1
movzx edi, byte [eax + 1]
add esi, 1
add eax, 1
add eax, 1
mov dword [esp + 0x20], ecx
movzx ecx, byte [eax - 3]
add esi, 1
mov dword [esp + 0x40], eax
mov dword [esp + 0x1c], esi
movzx esi, byte [eax - 2]
lea edx, [edi + esi]
add edx, ecx
mov eax, 0x55555556
imul edx
mov eax, edx
shr eax, 0x1f
add eax, edx
mov edx, dword [esp + 0x20]
mov dword [esp + 0x48], eax
add edx, ebx
add edx, ebp
mov eax, 0x55555556
imul edx
mov eax, edx
shr eax, 0x1f
add eax, edx
mov edx, dword [esp + 0x48]
sub eax, edx
add eax, 0xff
cmp eax, dword [esp + 0x2c]
mov dword [esp + 0x50], ebx
jle 0x4be53f
mov dword [esp + 0x2c], eax
sub ecx, ebp
imul ecx, dword [esp + 0x4c]
mov eax, 0x80808081
imul ecx
add edx, ecx
sar edx, 7
mov ecx, edx
shr ecx, 0x1f
add ecx, edx
add ecx, ebp
mov ebp, dword [esp + 0x50]
sub esi, ebp
imul esi, dword [esp + 0x44]
mov eax, 0x80808081
imul esi
add edx, esi
mov esi, dword [esp + 0x20]
sar edx, 7
sub edi, esi
imul edi, dword [esp + 0x38]
mov eax, edx
shr eax, 0x1f
add eax, edx
add ebp, eax
mov eax, 0x80808081
imul edi
add edx, edi
mov ebx, ecx
sar edx, 7
mov ecx, edx
shr ecx, 0x1f
add ecx, edx
add ecx, esi
mov edi, ecx
mov ecx, ebx
mov ebx, dword [esp + 0x2c]
mov esi, ebp
jmp 0x4be768
xor edx, edx
mov eax, dword [esp + 0x30]
cmp eax, edx
jl 0x4be64c
cmp edi, edx
jl 0x4be64c
cmp eax, ebp
jge 0x4be64c
cmp edi, dword [esp + 0x54]
jge 0x4be64c
mov edx, dword [ebx]
imul ebp, edi
add ebp, eax
movzx ecx, byte [edx + ebp*4]
sub ecx, dword [esp + 0x28]
lea eax, [edx + ebp*4]
movzx esi, byte [eax + 1]
sub esi, dword [esp + 0x10]
add eax, 1
movzx ebx, byte [eax + 2]
movzx edi, byte [eax + 1]
imul ecx, ebx
imul esi, ebx
add eax, 1
sub edi, dword [esp + 0x14]
mov eax, 0x80808081
imul ecx
imul edi, ebx
add edx, ecx
sar edx, 7
mov ecx, edx
shr ecx, 0x1f
add ecx, edx
mov eax, 0x80808081
imul esi
add edx, esi
add ecx, dword [esp + 0x28]
sar edx, 7
mov esi, edx
shr esi, 0x1f
add esi, edx
add esi, dword [esp + 0x10]
mov eax, 0x80808081
imul edi
add edx, edi
sar edx, 7
mov edi, edx
shr edi, 0x1f
add edi, edx
add edi, dword [esp + 0x14]
jmp 0x4be65a
mov ecx, dword [esp + 0x28]
mov esi, dword [esp + 0x10]
mov edi, dword [esp + 0x14]
xor ebx, ebx
mov eax, dword [esp + 0x1c]
test eax, eax
je 0x4be768
movzx edx, byte [eax]
movzx ebp, byte [eax + 1]
add eax, 1
add eax, 1
add eax, 1
mov dword [esp + 0x1c], eax
mov dword [esp + 0x20], edx
movzx edx, byte [eax - 1]
mov eax, dword [esp + 0x40]
add eax, 1
mov dword [esp + 0x34], edx
movzx edx, byte [eax - 1]
add eax, 1
mov dword [esp + 0x54], edx
movzx edx, byte [eax - 1]
add eax, 1
mov dword [esp + 0x3c], edx
movzx edx, byte [eax - 1]
mov dword [esp + 0x40], eax
mov eax, dword [esp + 0x3c]
mov dword [esp + 0x7c], edx
add edx, eax
add edx, dword [esp + 0x54]
mov eax, 0x55555556
imul edx
mov eax, edx
shr eax, 0x1f
add eax, edx
mov edx, dword [esp + 0x34]
mov dword [esp + 0x48], eax
add edx, ebp
add edx, dword [esp + 0x20]
mov eax, 0x55555556
imul edx
mov eax, edx
shr eax, 0x1f
add eax, edx
mov edx, dword [esp + 0x48]
sub eax, edx
add eax, 0xff
cmp eax, ebx
mov dword [esp + 0x50], ebp
jle 0x4be6f8
mov ebx, eax
mov ebp, dword [esp + 0x20]
mov eax, dword [esp + 0x54]
sub eax, ebp
imul eax, ecx
mov ecx, eax
mov eax, 0x80808081
imul ecx
mov eax, dword [esp + 0x3c]
add edx, ecx
sar edx, 7
mov ecx, edx
shr ecx, 0x1f
add ecx, edx
add ecx, ebp
mov ebp, dword [esp + 0x50]
sub eax, ebp
imul eax, esi
mov esi, eax
mov eax, 0x80808081
imul esi
add edx, esi
sar edx, 7
mov eax, edx
shr eax, 0x1f
add eax, edx
add eax, ebp
mov ebp, dword [esp + 0x34]
mov esi, eax
mov eax, dword [esp + 0x7c]
sub eax, ebp
imul eax, edi
mov edi, eax
mov eax, 0x80808081
imul edi
add edx, edi
sar edx, 7
mov eax, edx
shr eax, 0x1f
add eax, edx
add eax, ebp
mov edi, eax
sub ecx, dword [esp + 0x28]
mov ebp, dword [esp + 0x8c]
imul ecx, dword [esp + 0xe0]
sub esi, dword [esp + 0x10]
mov eax, 0x80808081
imul ecx
add edx, ecx
sar edx, 7
mov ecx, edx
shr ecx, 0x1f
add ecx, edx
add cl, byte [esp + 0x28]
sub edi, dword [esp + 0x14]
mov byte [ebp], cl
mov ecx, dword [esp + 0xe0]
imul esi, ecx
imul edi, ecx
imul ebx, ecx
mov eax, 0x80808081
imul esi
add edx, esi
sar edx, 7
mov eax, edx
shr eax, 0x1f
add eax, edx
add al, byte [esp + 0x10]
add ebp, 1
mov byte [ebp], al
mov eax, 0x80808081
imul edi
add edx, edi
sar edx, 7
mov eax, edx
shr eax, 0x1f
add eax, edx
add al, byte [esp + 0x14]
add ebp, 1
mov esi, dword [esp + 0x1c]
mov byte [ebp], al
mov eax, 0x80808081
imul ebx
add edx, ebx
mov ebx, dword [esp + 0xd8]
sar edx, 7
mov ecx, edx
shr ecx, 0x1f
add ebp, 1
add ecx, edx
mov byte [ebp], cl
mov ecx, dword [esp + 0x6c]
add ebp, 1
sub dword [esp + 0x60], 1
mov dword [esp + 0x8c], ebp
jne 0x4be2c0
mov ebp, dword [esp + 0x70]
mov edi, dword [esp + 0x68]
mov eax, 1
add dword [esp + 0x58], eax
sub dword [esp + 0x5c], eax
jne 0x4be2a6
test esi, esi
je 0x4be85d
mov edx, dword [esp + 0x88]
push edx
call fcn.004a4810
mov eax, dword [esp + 0x84]
push eax
call fcn.004a4810
mov esi, dword [esp + 0x80]
mov ecx, dword [esp + 0xc4]
push 3
push ecx
call dword [sym.imp.GDI32.dll_SetStretchBltMode]
mov dword [esp + 0x6c], eax
xor eax, eax
mov dword [esp + 0xa0], eax
mov dword [esp + 0xa4], eax
mov dword [esp + 0x94], eax
mov dword [esp + 0x98], eax
mov dword [esp + 0x9c], eax
mov dword [esp + 0xa8], eax
mov dword [esp + 0xac], eax
mov dword [esp + 0xb0], eax
mov dword [esp + 0xb4], eax
mov dword [esp + 0xb8], eax
mov dword [esp + 0xa4], eax
mov eax, dword [esp + 0xc4]
mov edx, edi
neg edx
push eax
mov dword [esp + 0x98], 0x28
mov dword [esp + 0x9c], ebp
mov dword [esp + 0xa0], edx
mov word [esp + 0xa4], 1
mov word [esp + 0xa6], 0x20
call dword [0x58ef84]
test al, 1
push 0xcc0020
push 0
je 0x4be944
mov edx, dword [ebx + 0xc]
mov ebx, dword [esp + 0xcc]
lea ecx, [esp + 0x9c]
push ecx
push edx
mov edx, dword [esp + 0x88]
push edi
mov eax, ebp
neg eax
push eax
push 0
lea ecx, [ebp - 1]
push ecx
push edi
push ebp
push edx
push esi
push ebx
call dword [sym.imp.GDI32.dll_StretchDIBits]
jmp 0x4be976
mov ecx, dword [ebx + 0xc]
mov edx, dword [esp + 0x80]
lea eax, [esp + 0x9c]
push eax
mov eax, dword [esp + 0xd0]
push ecx
push edi
push ebp
push 0
push 0
push edi
push ebp
push edx
push esi
push eax
call dword [sym.imp.GDI32.dll_StretchDIBits]
mov ebx, dword [esp + 0xc4]
mov ecx, dword [esp + 0x6c]
push ecx
push ebx
call dword [sym.imp.GDI32.dll_SetStretchBltMode]
mov edx, dword [esp + 0xdc]
push edx
push ebx
call fcn.004ae2c0
mov ecx, dword [esp + 0xd4]
mov edx, dword [esp + 0xd0]
mov ebx, eax
mov eax, dword [esp + 0x78]
push ebx
push edi
push ebp
push eax
mov eax, dword [esp + 0xdc]
push esi
push ecx
mov ecx, dword [esp + 0xe0]
push edx
mov edx, dword [esp + 0xe0]
push eax
push ecx
push edx
call fcn.004aaf50
push ebx
call dword [sym.imp.GDI32.dll_DeleteObject]
pop edi
pop esi
pop ebp
pop ebx
add esp, 0xac
ret 0x24