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

Disassembly:
mov eax, dword fs:[0]
push 0xffffffffffffffff
push 0x520140
push eax
mov dword fs:[0], esp
sub esp, 0x60
push ebx
push ebp
mov ebp, ecx
push esi
push edi
mov eax, dword [ebp]
add eax, 0x128
mov ecx, dword [eax + 4]
mov edx, dword [eax + 8]
sub edx, ecx
add edx, 3
and edx, 0xfffffffc
add edx, ecx
mov dword [eax + 8], edx
mov eax, dword [ebp + 8]
test eax, eax
je 0x5098d1
mov edi, dword [ebp]
push eax
mov ecx, ebp
add edi, 0x128
call fcn.00501d80
mov ecx, dword [edi + 8]
mov esi, dword [edi + 4]
mov edx, dword [ebp + 8]
sub ecx, esi
sub ecx, eax
mov dword [edx + 4], ecx
mov ecx, dword [ebp]
mov edx, 0x108
add ecx, 0x128
call fcn.004fc940
mov edx, dword [esp + 0x80]
mov dword [ebp + 8], eax
mov dword [eax + 4], 0
mov eax, dword [ebp + 8]
mov dword [eax], 0xf
mov edi, dword [ebp + 8]
mov cl, byte [edx + 0x20]
mov dword [esp + 0x18], edi
mov byte [esp + 0x13], cl
add edi, 8
mov ecx, 0x40
xor eax, eax
rep stosd dword es:[edi], eax
mov edi, dword [edx + 4]
mov esi, dword [edx + 8]
cmp edi, esi
je 0x509982
xor edx, edx
mov bl, byte [ebp + 0xc]
test bl, bl
je 0x509941
mov eax, dword [ebp + 4]
mov ecx, edx
and ecx, 0xff
mov eax, dword [eax]
mov al, byte [ecx + eax + 0x104]
jmp 0x509943
mov al, dl
mov cl, byte [edi]
test bl, bl
mov byte [esp + 0x1c], cl
je 0x509963
mov ecx, dword [ebp + 4]
mov ebx, dword [esp + 0x1c]
and ebx, 0xff
mov ecx, dword [ecx]
mov cl, byte [ebx + ecx + 0x104]
cmp al, cl
jne 0x509972
mov eax, dword [esp + 0x18]
add eax, 8
mov byte [eax + edx], 1
inc edx
cmp edx, 0x100
jb 0x509924
add edi, 2
cmp edi, esi
jne 0x509922
mov eax, dword [esp + 0x80]
mov esi, dword [eax + 0x14]
mov eax, dword [eax + 0x18]
cmp esi, eax
mov dword [esp + 0x2c], eax
je 0x509b6d
mov al, byte [ebp + 0xc]
mov cl, byte [esi]
test al, al
mov byte [esp + 0x1c], cl
je 0x5099be
mov ecx, dword [ebp + 4]
mov edx, dword [esp + 0x1c]
and edx, 0xff
mov ecx, dword [ecx]
mov cl, byte [edx + ecx + 0x104]
mov bl, byte [esi + 2]
add esi, 2
test al, al
mov byte [esp + 0x24], cl
mov byte [esp + 0x20], bl
je 0x5099e6
mov eax, dword [ebp + 4]
mov edx, dword [esp + 0x20]
and edx, 0xff
mov eax, dword [eax]
mov bl, byte [edx + eax + 0x104]
mov eax, dword [ebp]
add esi, 2
mov byte [esp + 0x28], bl
test dword [eax + 8], 0x200000
je 0x509b29
mov byte [esp + 0x14], cl
lea ecx, [esp + 0x15]
lea edx, [esp + 0x14]
push ecx
mov ecx, dword [ebp + 4]
lea eax, [esp + 0x54]
push edx
push eax
mov byte [esp + 0x21], 0
call fcn.00506990
lea ecx, [esp + 0x15]
lea edx, [esp + 0x14]
push ecx
mov ecx, dword [ebp + 4]
lea eax, [esp + 0x44]
push edx
push eax
mov dword [esp + 0x84], 0
mov byte [esp + 0x20], bl
call fcn.00506990
mov eax, dword [esp + 0x54]
mov byte [esp + 0x78], 1
test eax, eax
jne 0x509a55
mov eax, 0x861d5c
mov ecx, dword [esp + 0x58]
mov edx, dword [esp + 0x48]
push ecx
push eax
push edx
push 0
lea ecx, [esp + 0x50]
call fcn.004fbc40
test eax, eax
jl 0x509bed
mov edi, dword [esp + 0x18]
xor ebx, ebx
lea eax, [esp + 0x15]
lea ecx, [esp + 0x14]
push eax
lea edx, [esp + 0x64]
push ecx
mov ecx, dword [ebp + 4]
push edx
mov byte [esp + 0x20], bl
call fcn.00506990
mov eax, dword [esp + 0x54]
mov byte [esp + 0x78], 2
test eax, eax
jne 0x509aa6
mov eax, 0x861d5c
mov ecx, dword [esp + 0x58]
mov edx, dword [esp + 0x68]
push ecx
push eax
push edx
push 0
lea ecx, [esp + 0x70]
call fcn.004fbc40
test eax, eax
jl 0x509aec
mov eax, dword [esp + 0x64]
test eax, eax
jne 0x509acd
mov eax, 0x861d5c
mov ecx, dword [esp + 0x68]
mov edx, dword [esp + 0x48]
push ecx
push eax
push edx
push 0
lea ecx, [esp + 0x50]
call fcn.004fbc40
test eax, eax
jl 0x509aec
mov byte [edi + ebx + 8], 1
push 1
lea ecx, [esp + 0x64]
mov byte [esp + 0x7c], 1
call fcn.004fb8b1
inc ebx
cmp ebx, 0x100
jb 0x509a79
push 1
lea ecx, [esp + 0x44]
call fcn.004fb8b1
push 1
lea ecx, [esp + 0x54]
mov dword [esp + 0x7c], 0xffffffff
call fcn.004fb8b1
jmp 0x509b63
cmp bl, cl
jb 0x509ec0
mov edx, dword [esp + 0x24]
mov ecx, dword [esp + 0x28]
mov edi, dword [esp + 0x18]
and edx, 0xff
and ecx, 0xff
mov eax, 0x1010101
sub ecx, edx
lea edi, [edx + edi + 8]
inc ecx
mov edx, ecx
shr ecx, 2
rep stosd dword es:[edi], eax
mov ecx, edx
and ecx, 3
rep stosb byte es:[edi], al
cmp esi, dword [esp + 0x2c]
jne 0x50999b
mov ecx, dword [ebp]
mov edx, dword [esp + 0x80]
mov ecx, dword [ecx + 8]
mov eax, dword [edx + 0x24]
test ecx, 0x100000
je 0x509b9e
mov ecx, dword [ebp + 0x30]
mov esi, ecx
and esi, eax
cmp esi, ecx
je 0x509b9b
mov ecx, dword [ebp + 0x34]
mov esi, ecx
and esi, eax
cmp esi, ecx
jne 0x509b9e
or eax, dword [ebp + 0x38]
test eax, eax
je 0x509c0a
mov esi, dword [esp + 0x18]
mov edi, eax
xor ecx, ecx
and edi, 0x3ff
test edi, edi
je 0x509bd3
mov edx, dword [ebp + 4]
mov ebx, ecx
and ebx, 0xff
mov edx, dword [edx]
mov dx, word [edx + ebx*2 + 0x204]
and edx, eax
test edx, 0x3ff
jne 0x509bdd
test ah, 4
je 0x509be2
cmp cl, 0x5f
jne 0x509be2
mov byte [esi + ecx + 8], 1
inc ecx
cmp ecx, 0x100
jb 0x509bb0
jmp 0x509c10
push 1
lea ecx, [esp + 0x44]
call fcn.004fb8b1
push 1
lea ecx, [esp + 0x54]
call fcn.004fb8b1
xor eax, eax
jmp 0x509e85
mov esi, dword [esp + 0x18]
jmp 0x509c17
mov edx, dword [esp + 0x80]
mov eax, dword [ebp]
mov ecx, dword [edx + 0x28]
test dword [eax + 8], 0x100000
je 0x509c3f
mov eax, dword [ebp + 0x30]
mov edi, eax
and edi, ecx
cmp edi, eax
je 0x509c3c
mov eax, dword [ebp + 0x34]
mov edi, eax
and edi, ecx
cmp edi, eax
jne 0x509c3f
or ecx, dword [ebp + 0x38]
test ecx, ecx
je 0x509c8d
mov edi, ecx
xor eax, eax
and edi, 0x3ff
test edi, edi
je 0x509c70
mov edx, dword [ebp + 4]
mov ebx, eax
and ebx, 0xff
mov edx, dword [edx]
mov dx, word [edx + ebx*2 + 0x204]
and edx, ecx
test edx, 0x3ff
jne 0x509c7e
test ch, 4
je 0x509c79
cmp al, 0x5f
je 0x509c7e
mov byte [esi + eax + 8], 1
inc eax
cmp eax, 0x100
jb 0x509c4d
mov edx, dword [esp + 0x80]
mov edi, dword [edx + 0x34]
mov eax, dword [edx + 0x38]
cmp edi, eax
mov dword [esp + 0x1c], edi
mov dword [esp + 0x2c], eax
je 0x509e5d
jmp 0x509ca9
mov edi, dword [esp + 0x1c]
mov al, byte [esp + 0x80]
xor esi, esi
push esi
lea ecx, [esp + 0x34]
mov byte [esp + 0x34], al
call fcn.004fb8b1
lea ecx, [edi + 1]
lea edx, [esp + 0x50]
push ecx
mov ecx, dword [ebp + 4]
push edi
push edx
mov dword [esp + 0x84], 3
call fcn.005069c0
mov ecx, dword [0x861d58]
mov byte [esp + 0x78], 4
push ecx
push esi
push eax
lea ecx, [esp + 0x3c]
call fcn.004fb7e3
mov eax, dword [esp + 0x54]
mov byte [esp + 0x78], 3
cmp eax, esi
je 0x509d1e
lea ecx, [eax - 1]
mov al, byte [eax - 1]
test al, al
je 0x509d15
cmp al, 0xff
je 0x509d15
dec al
mov byte [ecx], al
jmp 0x509d1e
push ecx
call fcn.0050fefc
add esp, 4
mov eax, dword [esp + 0x38]
mov dword [esp + 0x54], esi
cmp eax, esi
mov dword [esp + 0x58], esi
mov dword [esp + 0x5c], esi
je 0x509e9a
mov dword [esp + 0x14], esi
mov dl, byte [esp + 0x14]
lea eax, [esp + 0x81]
mov byte [esp + 0x80], dl
lea ecx, [esp + 0x80]
push eax
lea edx, [esp + 0x64]
push ecx
mov ecx, dword [ebp + 4]
push edx
mov byte [esp + 0x8d], 0
call fcn.005069c0
mov eax, dword [esp + 0x64]
test eax, eax
jne 0x509d77
mov eax, 0x861d5c
mov edx, dword [esp + 0x38]
mov ebx, dword [esp + 0x68]
cmp edx, ebx
mov ecx, edx
jb 0x509d87
mov ecx, ebx
mov esi, dword [esp + 0x34]
mov edi, eax
xor eax, eax
repe cmpsb byte [esi], byte es:[edi]
je 0x509d98
sbb eax, eax
sbb eax, 0xffffffff
xor esi, esi
cmp eax, esi
jne 0x509dbc
cmp edx, ebx
jb 0x509dbc
xor eax, eax
cmp edx, ebx
setne al
cmp eax, esi
jne 0x509dbc
mov eax, dword [esp + 0x18]
mov ecx, dword [esp + 0x14]
add eax, 8
mov byte [eax + ecx], 1
mov ecx, dword [esp + 0x64]
mov byte [esp + 0x78], 3
cmp ecx, esi
je 0x509de4
mov al, byte [ecx - 1]
dec ecx
test al, al
je 0x509ddb
cmp al, 0xff
je 0x509ddb
dec al
mov byte [ecx], al
jmp 0x509de4
push ecx
call fcn.0050fefc
add esp, 4
mov eax, dword [esp + 0x14]
mov dword [esp + 0x64], esi
inc eax
mov dword [esp + 0x68], esi
cmp eax, 0x100
mov dword [esp + 0x6c], esi
mov dword [esp + 0x14], eax
jb 0x509d3a
mov ecx, dword [esp + 0x1c]
xor esi, esi
add ecx, 2
mov dword [esp + 0x78], 0xffffffff
mov dword [esp + 0x1c], ecx
mov ecx, dword [esp + 0x34]
cmp ecx, esi
je 0x509e3d
mov al, byte [ecx - 1]
test al, al
je 0x509e33
cmp al, 0xff
je 0x509e33
dec al
mov byte [ecx - 1], al
jmp 0x509e3d
dec ecx
push ecx
call fcn.0050fefc
add esp, 4
mov edx, dword [esp + 0x1c]
mov eax, dword [esp + 0x2c]
cmp edx, eax
mov dword [esp + 0x34], esi
mov dword [esp + 0x38], esi
mov dword [esp + 0x3c], esi
jne 0x509ca5
mov esi, dword [esp + 0x18]
mov al, byte [esp + 0x13]
test al, al
je 0x509e83
mov ecx, 0xfffffff8
lea eax, [esi + 8]
sub ecx, esi
cmp byte [eax], 0
sete dl
mov byte [eax], dl
inc eax
lea edx, [ecx + eax]
cmp edx, 0x100
jb 0x509e6f
mov eax, esi
mov ecx, dword [esp + 0x70]
pop edi
pop esi
pop ebp
pop ebx
mov dword fs:[0], ecx
add esp, 0x6c
ret 8
mov ecx, dword [esp + 0x34]
cmp ecx, esi
je 0x509ec0
mov al, byte [ecx - 1]
test al, al
je 0x509eb6
cmp al, 0xff
je 0x509eb6
dec al
mov byte [ecx - 1], al
xor eax, eax
jmp 0x509e85
dec ecx
push ecx
call fcn.0050fefc
add esp, 4
xor eax, eax
jmp 0x509e85