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

Disassembly:
sub esp, 0x64
push ebx
mov ebx, dword [esp + 0x6c]
push ebp
push esi
push edi
mov esi, ecx
push ebx
call fcn.004ea900
test al, al
jne 0x503281
mov ecx, dword [esi + 0xc]
mov eax, 0xff
cmp ecx, eax
jg 0x50325c
cmp dword [esi + 0x10], eax
jg 0x50325c
mov ecx, esi
call fcn.004e07f0
mov cx, word [esi + 0x16]
mov dword [esp + 0x20], eax
cmp cx, 8
ja 0x502f11
test eax, eax
je 0x503281
mov eax, dword [esi + 0xc]
mov edi, dword [esi + 0x1c]
add eax, 0x1f
and ecx, 0xffff
cdq
and edx, 0x1f
mov ebp, ecx
add eax, edx
mov edx, dword [esi + 0x10]
sar eax, 5
shl eax, 2
imul edx, eax
mov ecx, esi
mov dword [esp + 0x28], eax
mov dword [esp + 0x1c], edx
mov dword [esp + 0x18], edi
call fcn.004f77c0
test al, al
je 0x502f6b
mov ecx, dword [esi + 0x28]
xor eax, eax
cmp ecx, eax
jne 0x502f6d
mov ecx, dword [esi + 0x10]
mov ebp, 0x20
imul ecx, dword [esi + 0xc]
shl ecx, 2
mov dword [esp + 0x18], ecx
mov edi, ecx
jmp 0x502f6d
xor eax, eax
mov dl, byte [esi + 0xc]
mov ecx, 1
mov byte [esp + 0x3c], dl
mov dl, byte [esi + 0x10]
mov byte [esp + 0x3d], dl
mov dl, byte [esi + 0x28]
mov byte [esp + 0x3e], dl
mov edx, dword [esi + 0x28]
mov word [esp + 0x36], cx
mov word [esp + 0x38], cx
lea edx, [edi + edx*4 + 0x28]
mov word [esp + 0x58], cx
add edx, dword [esp + 0x1c]
push ecx
lea ecx, [esp + 0x38]
mov word [esp + 0x38], ax
mov dword [esp + 0x48], edx
mov edx, dword [esi + 0xc]
mov dword [esp + 0x54], edx
mov edx, dword [esi + 0x10]
mov word [esp + 0x44], ax
mov dword [esp + 0x60], eax
mov dword [esp + 0x68], eax
mov dword [esp + 0x6c], eax
mov dword [esp + 0x70], eax
mov dword [esp + 0x74], eax
mov eax, dword [ebx]
push 6
shl edx, 1
push ecx
mov ecx, ebx
mov byte [esp + 0x4b], 0
mov word [esp + 0x4e], bp
mov dword [esp + 0x54], 0x16
mov dword [esp + 0x58], 0x28
mov dword [esp + 0x60], edx
mov word [esp + 0x66], bp
mov dword [esp + 0x6c], edi
call dword [eax + 0xc]
mov edx, dword [ebx]
push 1
lea eax, [esp + 0x40]
push 0x10
push eax
mov ecx, ebx
call dword [edx + 0xc]
mov edx, dword [ebx]
push 1
lea eax, [esp + 0x50]
push 0x28
push eax
mov ecx, ebx
call dword [edx + 0xc]
mov eax, dword [esp + 0x20]
test eax, eax
je 0x50303e
mov ecx, dword [esi + 0x28]
mov edx, dword [ebx]
shl ecx, 2
push 1
push ecx
push eax
mov ecx, ebx
call dword [edx + 0xc]
mov ecx, esi
call fcn.004f77c0
test al, al
je 0x5030e1
mov eax, dword [esi + 0x28]
test eax, eax
jne 0x5030e1
mov ebp, dword [esi + 0x34]
push edi
call fcn.0055c8a6
mov edi, eax
mov eax, dword [esi + 0x10]
add esp, 4
mov dword [esp + 0x20], edi
test eax, eax
mov dword [esp + 0x14], 0
jle 0x5030c7
mov eax, dword [esi + 0xc]
xor ebx, ebx
test eax, eax
jle 0x5030af
mov dl, byte [ebp]
mov byte [edi], dl
mov al, byte [ebp + 1]
inc edi
inc ebp
mov edx, dword [esp + 0x14]
mov byte [edi], al
mov cl, byte [ebp + 1]
inc edi
inc ebp
push edx
push ebx
mov byte [edi], cl
inc edi
mov ecx, esi
inc ebp
call fcn.004f7aa0
mov byte [edi], al
mov eax, dword [esi + 0xc]
inc edi
inc ebx
cmp ebx, eax
jl 0x503082
mov eax, dword [esp + 0x14]
mov ecx, dword [esi + 0x10]
inc eax
cmp eax, ecx
mov dword [esp + 0x14], eax
jl 0x503079
mov ebx, dword [esp + 0x78]
mov edi, dword [esp + 0x20]
mov ecx, dword [esp + 0x18]
mov eax, dword [ebx]
push 1
push ecx
push edi
mov ecx, ebx
call dword [eax + 0xc]
push edi
call fcn.0055c8ac
add esp, 4
jmp 0x5030ef
mov eax, dword [esi + 0x34]
mov edx, dword [ebx]
push 1
push edi
push eax
mov ecx, ebx
call dword [edx + 0xc]
mov ecx, dword [esp + 0x1c]
push 1
push ecx
call fcn.0055ce30
mov ebp, eax
add esp, 8
test ebp, ebp
mov dword [esp + 0x20], ebp
je 0x503281
lea edx, [esp + 0x24]
mov ecx, esi
push edx
call fcn.004e02f0
mov ecx, dword [esi + 0x14c]
mov eax, dword [eax]
cmp ecx, 0xffffffff
mov ecx, esi
mov dword [esp + 0x24], eax
setne byte [esp + 0x13]
call fcn.004f7ba0
mov ecx, esi
mov byte [esp + 0x12], al
call fcn.004f77c0
mov byte [esp + 0x11], al
mov eax, dword [esi + 0x10]
xor edi, edi
test eax, eax
mov dword [esp + 0x18], edi
jle 0x503238
mov dword [esp + 0x14], edi
mov eax, dword [esi + 0xc]
xor ebp, ebp
test eax, eax
jle 0x503216
mov al, byte [esp + 0x11]
xor ebx, ebx
test al, al
je 0x503180
push edi
push ebp
mov ecx, esi
call fcn.004f7aa0
test al, al
jne 0x503180
mov ebx, 1
mov al, byte [esp + 0x12]
test al, al
je 0x5031a4
push 1
push edi
lea ecx, [esp + 0x34]
push ebp
push ecx
mov ecx, esi
call fcn.004e0a50
mov cl, byte [eax + 3]
test cl, cl
jne 0x5031a4
mov ebx, 1
push 0
push edi
lea edx, [esp + 0x38]
push ebp
push edx
mov ecx, esi
call fcn.004e0a50
mov cl, byte [esp + 0x13]
mov eax, dword [eax]
test cl, cl
je 0x5031c9
cmp eax, dword [esp + 0x24]
jne 0x5031c9
mov ebx, 1
mov ecx, dword [esp + 0x14]
mov eax, dword [esp + 0x20]
mov edi, ebp
sar edi, 3
add edi, ecx
add edi, eax
mov eax, ebp
and eax, 0x80000007
jns 0x5031e8
dec eax
or eax, 0xfffffff8
inc eax
mov ecx, 7
mov dl, 1
sub ecx, eax
mov al, byte [edi]
shl dl, cl
and bl, 1
shl bl, cl
not dl
and dl, al
or dl, bl
inc ebp
mov byte [edi], dl
mov eax, dword [esi + 0xc]
mov edi, dword [esp + 0x18]
cmp ebp, eax
jl 0x503164
mov ebx, dword [esp + 0x78]
mov eax, dword [esp + 0x28]
mov ecx, dword [esp + 0x14]
add ecx, eax
mov eax, dword [esi + 0x10]
inc edi
mov dword [esp + 0x14], ecx
cmp edi, eax
mov dword [esp + 0x18], edi
jl 0x503157
mov ebp, dword [esp + 0x20]
mov eax, dword [esp + 0x1c]
mov edx, dword [ebx]
push 1
push eax
push ebp
mov ecx, ebx
call dword [edx + 0xc]
push ebp
call fcn.0055c8ac
add esp, 4
mov al, 1
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x64
ret 4
mov edi, str.Cant_save_this_image_as_icon
or ecx, 0xffffffff
xor eax, eax
lea edx, [esi + 0x44]
repne scasb al, byte es:[edi]
not ecx
sub edi, ecx
mov eax, ecx
mov esi, edi
mov edi, edx
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov ecx, eax
and ecx, 3
rep movsb byte es:[edi], byte [esi]
pop edi
pop esi
pop ebp
xor al, al
pop ebx
add esp, 0x64
ret 4