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

Disassembly:
push ebp
mov ebp, esp
and esp, 0xfffffff8
sub esp, 0x7c
push ebx
mov ebx, dword [ebp + 8]
push esi
mov esi, dword [ebp + 0xc]
push edi
mov eax, ebx
mov ecx, esi
call fcn.004605c7
test al, al
jne 0x50983e
xor al, al
jmp 0x509e29
cmp dword [esi], 2
jne 0x509837
mov eax, dword [ebx]
cmp eax, 8
je 0x50984f
cmp eax, 9
jne 0x509837
mov eax, esi
lea edi, [esp + 0x60]
call fcn.0045fe6c
push ebx
lea eax, [esp + 0x78]
push eax
call fcn.00425926
mov edi, ebx
lea esi, [esp + 0x40]
call fcn.0045ff26
lea esi, [esp + 0x50]
call fcn.0045ff74
mov eax, dword [ebp + 0xc]
mov eax, dword [eax + 8]
cmp eax, 2
push 7
mov dword [esp + 0x38], eax
pop esi
jl 0x509c18
lea ecx, [esp + 0x60]
call fcn.0042590f
test al, al
je 0x509837
lea ecx, [esp + 0x74]
call fcn.0042590f
test al, al
je 0x509837
lea ecx, [esp + 0x40]
call fcn.0042590f
test al, al
je 0x509837
lea ecx, [esp + 0x50]
call fcn.0042590f
test al, al
je 0x509837
mov eax, dword [esp + 0x68]
mov ebx, eax
add eax, dword [esp + 0x6c]
mov dword [esp + 0x68], eax
mov dword [esp + 0x24], eax
mov eax, dword [esp + 0x7c]
mov dword [esp + 0x20], eax
add eax, dword [esp + 0x80]
mov dword [esp + 0x7c], eax
mov dword [esp + 0x28], eax
mov eax, dword [esp + 0x48]
mov dword [esp + 0x2c], eax
mov eax, dword [esp + 0x58]
mov dword [esp + 0x30], eax
mov eax, dword [ebp + 0xc]
mov eax, dword [eax + 4]
cmp eax, 2
jl 0x509af7
mov ecx, eax
shr ecx, 1
mov dword [esp + 0x3c], ecx
neg ecx
lea eax, [eax + ecx*2]
mov dword [esp + 0x38], eax
mov ax, word [ebx]
mov word [esp + 0x10], ax
mov edx, dword [esp + 0x10]
movzx eax, byte [esp + 0x11]
mov edi, dword [esp + 0x10]
shr edx, 0xd
and edx, esi
or edx, eax
mov eax, dword [esp + 0x10]
shr eax, 3
movzx eax, al
shr edi, 9
and edi, 3
or edi, eax
mov al, byte [esp + 0x10]
movzx ecx, al
shr cl, 2
shl al, 3
movzx eax, al
push edx
mov dword [esp + 0x20], edx
and ecx, esi
or ecx, eax
mov eax, edi
mov dword [esp + 0x18], edi
mov dword [esp + 0x1c], ecx
call fcn.0046665b
mov ecx, dword [esp + 0x20]
mov byte [ecx], al
mov ax, word [ebx + 2]
mov word [esp + 0x10], ax
mov edx, dword [esp + 0x10]
movzx eax, byte [esp + 0x11]
mov edi, dword [esp + 0x10]
shr edx, 0xd
and edx, esi
or edx, eax
mov eax, dword [esp + 0x10]
add dword [esp + 0x1c], edx
shr eax, 3
movzx eax, al
shr edi, 9
and edi, 3
or edi, eax
mov al, byte [esp + 0x10]
add dword [esp + 0x14], edi
movzx ecx, al
shr cl, 2
shl al, 3
movzx eax, al
push edx
and ecx, esi
or ecx, eax
add dword [esp + 0x1c], ecx
mov eax, edi
call fcn.0046665b
mov ecx, dword [esp + 0x20]
mov byte [ecx + 1], al
mov eax, dword [esp + 0x24]
mov ax, word [eax]
mov word [esp + 0x10], ax
mov edx, dword [esp + 0x10]
movzx eax, byte [esp + 0x11]
mov edi, dword [esp + 0x10]
shr edx, 0xd
and edx, esi
or edx, eax
mov eax, dword [esp + 0x10]
shr eax, 3
movzx eax, al
shr edi, 9
and edi, 3
or edi, eax
mov al, byte [esp + 0x10]
movzx ecx, al
shr cl, 2
shl al, 3
movzx eax, al
and ecx, esi
or ecx, eax
add dword [esp + 0x1c], edx
add dword [esp + 0x14], edi
add dword [esp + 0x18], ecx
push edx
mov eax, edi
call fcn.0046665b
mov ecx, dword [esp + 0x28]
mov byte [ecx], al
mov eax, dword [esp + 0x24]
mov ax, word [eax + 2]
mov word [esp + 0x10], ax
mov eax, dword [esp + 0x10]
movzx ecx, byte [esp + 0x11]
mov edx, eax
shr edx, 0xd
and edx, esi
or edx, ecx
mov ecx, dword [esp + 0x10]
shr ecx, 3
add dword [esp + 0x1c], edx
shr eax, 9
movzx ecx, cl
and eax, 3
or eax, ecx
mov edi, eax
mov al, byte [esp + 0x10]
add dword [esp + 0x14], edi
movzx ecx, al
shr cl, 2
shl al, 3
movzx eax, al
push edx
and ecx, esi
or ecx, eax
add dword [esp + 0x1c], ecx
mov eax, edi
call fcn.0046665b
push dword [esp + 0x18]
mov ecx, dword [esp + 0x2c]
push dword [esp + 0x20]
mov edx, dword [esp + 0x1c]
push 2
pop edi
mov byte [ecx + 1], al
mov ecx, edi
call fcn.0046667d
push dword [esp + 0x14]
mov ecx, dword [esp + 0x30]
push dword [esp + 0x20]
mov edx, dword [esp + 0x20]
mov byte [ecx], al
mov ecx, edi
call fcn.004666b1
mov ecx, dword [esp + 0x30]
inc dword [esp + 0x2c]
inc dword [esp + 0x30]
add dword [esp + 0x24], 4
add dword [esp + 0x20], edi
add dword [esp + 0x28], edi
invalid