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

Disassembly:
push ebx
push ebp
mov ebp, dword [esp + 0xc]
push esi
test ebp, ebp
push edi
je 0x515cb1
mov esi, dword [esp + 0x18]
test esi, esi
je 0x515cb1
push esi
push ebp
call fcn.005157f0
mov al, byte [esi + 8]
add esp, 8
test al, 8
je 0x515a13
mov ecx, dword [esi + 0x10]
xor eax, eax
mov ax, word [esi + 0x14]
push eax
push ecx
push ebp
call fcn.0051f940
add esp, 0xc
jmp 0x515a27
cmp byte [esi + 0x19], 3
jne 0x515a27
push str.Valid_palette_required_for_paletted_images
push ebp
call fcn.00513ff0
add esp, 8
test byte [esi + 8], 0x10
je 0x515a7d
test dword [ebp + 0x74], 0x80000
je 0x515a5f
cmp byte [esi + 0x19], 3
jne 0x515a5f
xor eax, eax
cmp word [esi + 0x16], ax
jbe 0x515a5f
mov edx, dword [esi + 0x50]
mov bl, byte [edx + eax]
lea ecx, [edx + eax]
or dl, 0xff
sub dl, bl
inc eax
mov byte [ecx], dl
xor ecx, ecx
mov cx, word [esi + 0x16]
cmp eax, ecx
jl 0x515a44
xor edx, edx
xor eax, eax
mov dl, byte [esi + 0x19]
mov ax, word [esi + 0x16]
push edx
mov edx, dword [esi + 0x50]
lea ecx, [esi + 0x54]
push eax
push ecx
push edx
push ebp
call fcn.00520480
add esp, 0x14
test byte [esi + 8], 0x20
je 0x515a96
xor eax, eax
lea ecx, [esi + 0x5e]
mov al, byte [esi + 0x19]
push eax
push ecx
push ebp
call fcn.005205f0
add esp, 0xc
test byte [esi + 8], 0x40
je 0x515ab3
mov eax, dword [esi + 0x80]
xor edx, edx
mov dx, word [esi + 0x14]
push edx
push eax
push ebp
call fcn.00520760
add esp, 0xc
mov eax, dword [esi + 8]
test ah, 1
je 0x515ad2
mov edx, dword [esi + 0x6c]
mov eax, dword [esi + 0x68]
xor ecx, ecx
mov cl, byte [esi + 0x70]
push ecx
push edx
push eax
push ebp
call fcn.00520d30
add esp, 0x10
mov eax, dword [esi + 8]
test ah, 4
je 0x515b18
mov ecx, dword [esi + 0xb4]
mov edx, dword [esi + 0xb0]
push ecx
xor eax, eax
mov al, byte [esi + 0xb9]
xor ecx, ecx
mov cl, byte [esi + 0xb8]
push edx
mov edx, dword [esi + 0xac]
push eax
mov eax, dword [esi + 0xa8]
push ecx
mov ecx, dword [esi + 0xa4]
push edx
push eax
push ecx
push ebp
call fcn.00520db0
add esp, 0x20
mov eax, dword [esi + 8]
test ah, 0x40
je 0x515b40
mov edx, dword [esi + 0xe8]
mov eax, dword [esi + 0xe4]
xor ecx, ecx
push edx
mov cl, byte [esi + 0xe0]
push eax
push ecx
push ebp
call fcn.00520f40
add esp, 0x10
test byte [esi + 8], 0x80
je 0x515b5d
mov eax, dword [esi + 0x78]
mov ecx, dword [esi + 0x74]
xor edx, edx
mov dl, byte [esi + 0x7c]
push edx
push eax
push ecx
push ebp
call fcn.00520ff0
add esp, 0x10
mov eax, dword [esi + 8]
mov edi, 0x200
test edi, eax
je 0x515b7e
lea edx, [esi + 0x3c]
push edx
push ebp
call fcn.00521070
mov eax, dword [ebp + 0x6c]
add esp, 8
or eax, edi
mov dword [ebp + 0x6c], eax
mov eax, dword [esi + 8]
test ah, 0x20
je 0x515bb4
mov eax, dword [esi + 0xdc]
xor edi, edi
test eax, eax
jle 0x515bb4
xor ebx, ebx
mov eax, dword [esi + 0xd8]
add eax, ebx
push eax
push ebp
call fcn.00520130
mov eax, dword [esi + 0xdc]
add esp, 8
inc edi
add ebx, 0x10
cmp edi, eax
jl 0x515b94
mov eax, dword [esi + 0x30]
xor ebx, ebx
test eax, eax
jle 0x515c37
xor edi, edi
mov ecx, dword [esi + 0x38]
lea eax, [ecx + edi]
mov ecx, dword [ecx + edi]
test ecx, ecx
jle 0x515be8
mov edx, dword [eax + 8]
push edx
mov edx, dword [eax + 0x18]
push edx
mov edx, dword [eax + 0x14]
mov eax, dword [eax + 4]
push edx
push eax
push ecx
push ebp
call fcn.00520ba0
add esp, 0x18
jmp 0x515c22
jne 0x515c0a
mov edx, dword [eax + 8]
mov eax, dword [eax + 4]
push ecx
push 0
push edx
push eax
push ebp
call fcn.00520a80
mov ecx, dword [esi + 0x38]
add esp, 0x14
mov dword [ecx + edi], 0xfffffffe
jmp 0x515c2c
cmp ecx, 0xffffffff
jne 0x515c2c
mov edx, dword [eax + 8]
mov eax, dword [eax + 4]
push 0
push edx
push eax
push ebp
call fcn.005209d0
add esp, 0x10
mov ecx, dword [esi + 0x38]
mov dword [ecx + edi], 0xfffffffd
mov eax, dword [esi + 0x30]
inc ebx
add edi, 0x1c
cmp ebx, eax
jl 0x515bbf
mov eax, dword [esi + 0xc4]
test eax, eax
je 0x515cb1
mov edi, dword [esi + 0xc0]
lea edx, [eax + eax*4]
lea eax, [edi + edx*4]
cmp edi, eax
jae 0x515cb1
mov ebx, 0x10000
push edi
push ebp
call fcn.00514a00
add esp, 8
cmp eax, 1
je 0x515c98
mov cl, byte [edi + 0x10]
test cl, cl
je 0x515c98
test cl, 2
je 0x515c98
test cl, 4
jne 0x515c98
test byte [edi + 3], 0x20
jne 0x515c86
cmp eax, 3
je 0x515c86
test dword [ebp + 0x70], ebx
je 0x515c98
mov ecx, dword [edi + 0xc]
mov edx, dword [edi + 8]
push ecx
push edx
push edi
push ebp
call fcn.0051f420
add esp, 0x10
mov eax, dword [esi + 0xc4]
mov ecx, dword [esi + 0xc0]
add edi, 0x14
lea eax, [eax + eax*4]
lea edx, [ecx + eax*4]
cmp edi, edx
jb 0x515c56
pop edi
pop esi
pop ebp
pop ebx
ret