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

Disassembly:
push ebp
mov ebp, esp
add esp, 0xffffffc8
push ebx
push esi
push edi
mov byte [ebp - 5], dl
mov dword [ebp - 4], eax
cmp byte [ebp - 5], 2
jne 0x516a36
mov eax, dword [ebp - 4]
cmp byte [eax + 0x20], 3
jae 0x516a36
mov byte [ebp - 5], 0
movzx eax, byte [ebp - 5]
mov edx, dword [ebp - 4]
mov ebx, dword [edx + eax*4 + 0xc]
cmp ebx, 0xffffffff
jne 0x516fdc
mov eax, dword [ebp - 4]
mov eax, dword [eax + 4]
mov edx, dword [eax]
call dword [edx + 0x30]
mov esi, eax
mov eax, dword [ebp - 4]
mov eax, dword [eax + 4]
mov edx, dword [eax]
call dword [edx + 0x24]
or esi, eax
je 0x516fdc
mov eax, dword [ebp - 4]
mov eax, dword [eax + 4]
mov edx, dword [eax]
call dword [edx + 0x30]
mov edx, dword [ebp - 4]
movzx edx, byte [edx + 0x20]
mov ecx, edx
cdq
idiv ecx
mov edi, eax
mov eax, dword [ebp - 4]
mov eax, dword [eax + 4]
mov edx, dword [eax]
call dword [edx + 0x24]
mov esi, eax
mov eax, dword [ebp - 4]
cmp dword [eax + 8], 0
jne 0x516ac7
cmp dword [0x5d50bc], 0
jne 0x516ab3
mov dl, 1
mov eax, dword [0x516510]
call fcn.00516708
mov dword [0x5d50bc], eax
mov ecx, esi
mov edx, edi
mov eax, dword [0x5d50bc]
call fcn.0051677c
mov edx, dword [ebp - 4]
mov dword [edx + 8], eax
mov dl, 1
mov eax, dword [0x49c7b8]
call fcn.004a35dc
mov dword [ebp - 0xc], eax
xor eax, eax
push ebp
push 0x516fbf
push dword fs:[eax]
mov dword fs:[eax], esp
mov edx, edi
mov eax, dword [ebp - 0xc]
mov ecx, dword [eax]
call dword [ecx + 0x44]
mov edx, esi
mov eax, dword [ebp - 0xc]
mov ecx, dword [eax]
call dword [ecx + 0x38]
push esi
lea eax, [ebp - 0x28]
push eax
mov ecx, edi
xor edx, edx
xor eax, eax
call fcn.0048750c
mov eax, dword [ebp - 0xc]
call fcn.004a3ef4
mov eax, dword [eax + 0x14]
mov edx, 0xff00000f
call fcn.0049e884
mov eax, dword [ebp - 4]
mov eax, dword [eax + 4]
mov edx, dword [eax]
call dword [edx + 0x28]
call fcn.004a336c
mov edx, eax
mov eax, dword [ebp - 0xc]
mov ecx, dword [eax]
call dword [ecx + 0x3c]
movzx ebx, byte [ebp - 5]
mov eax, dword [ebp - 4]
cmp bl, byte [eax + 0x20]
jl 0x516b45
xor ebx, ebx
push esi
lea eax, [ebp - 0x38]
push eax
movzx ecx, bl
inc ecx
imul ecx, edi
movzx eax, bl
imul edi
xor edx, edx
call fcn.0048750c
movzx eax, byte [ebp - 5]
sub al, 1
jb 0x516b70
je 0x516be4
dec eax
sub al, 2
jae 0x516fa9
lea eax, [ebp - 0x38]
push eax
mov eax, dword [ebp - 4]
mov eax, dword [eax + 4]
call fcn.004a3ef4
push eax
mov eax, dword [ebp - 0xc]
call fcn.004a3ef4
lea edx, [ebp - 0x28]
pop ecx
call fcn.0049eb58
mov eax, dword [ebp - 4]
mov eax, dword [eax + 4]
cmp byte [eax + 0x38], 1
jne 0x516bc1
mov eax, dword [ebp - 4]
mov ecx, dword [eax + 0x1c]
mov eax, dword [ebp - 4]
mov eax, dword [eax + 8]
mov edx, dword [ebp - 0xc]
call fcn.005166ac
movzx edx, byte [ebp - 5]
mov ecx, dword [ebp - 4]
mov dword [ecx + edx*4 + 0xc], eax
jmp 0x516fa9
mov eax, dword [ebp - 4]
mov eax, dword [eax + 8]
mov ecx, 0x20000000
mov edx, dword [ebp - 0xc]
call fcn.005166ac
movzx edx, byte [ebp - 5]
mov ecx, dword [ebp - 4]
mov dword [ecx + edx*4 + 0xc], eax
jmp 0x516fa9
xor eax, eax
mov dword [ebp - 0x14], eax
xor eax, eax
mov dword [ebp - 0x10], eax
xor eax, eax
push ebp
push 0x516f84
push dword fs:[eax]
mov dword fs:[eax], esp
mov dl, 1
mov eax, dword [0x49c7b8]
call fcn.004a35dc
mov dword [ebp - 0x14], eax
mov dl, 1
mov eax, dword [0x49c7b8]
call fcn.004a35dc
mov dword [ebp - 0x10], eax
mov eax, dword [ebp - 4]
mov edx, dword [eax + 4]
mov eax, dword [ebp - 0x10]
mov ecx, dword [eax]
call dword [ecx + 8]
mov dl, 1
mov eax, dword [ebp - 0x10]
mov ecx, dword [eax]
call dword [ecx + 0x78]
mov eax, dword [ebp - 4]
cmp byte [eax + 0x20], 1
jbe 0x516e17
mov eax, dword [ebp - 0xc]
call fcn.004a3ef4
mov dword [ebp - 0x18], eax
lea eax, [ebp - 0x38]
push eax
mov eax, dword [ebp - 0x10]
call fcn.004a3ef4
mov ecx, eax
lea edx, [ebp - 0x28]
mov eax, dword [ebp - 0x18]
call fcn.0049eb58
mov dl, 1
mov eax, dword [ebp - 0x14]
call fcn.004a4eac
mov edx, edi
mov eax, dword [ebp - 0x14]
mov ecx, dword [eax]
call dword [ecx + 0x44]
mov edx, esi
mov eax, dword [ebp - 0x14]
mov ecx, dword [eax]
call dword [ecx + 0x38]
mov eax, dword [ebp - 0x10]
call fcn.004a3ef4
mov eax, dword [eax + 0x14]
mov edx, 0xffffff
call fcn.0049e884
lea eax, [ebp - 0x38]
push eax
mov eax, dword [ebp - 0x10]
call fcn.004a3ef4
push eax
mov eax, dword [ebp - 0x14]
call fcn.004a3ef4
lea edx, [ebp - 0x28]
pop ecx
call fcn.0049eb58
mov eax, dword [ebp - 0x18]
mov eax, dword [eax + 0x14]
mov edx, 0xff000014
call fcn.0049e884
mov eax, dword [ebp - 0x18]
call fcn.0049f2c8
mov ebx, eax
push 0
push ebx
call fcn.0040a3e4
push 0xffffff
push ebx
call fcn.0040a384
push 0xe20746
push 0
push 0
mov eax, dword [ebp - 0x14]
call fcn.004a3ef4
call fcn.0049f2c8
push eax
push esi
push edi
push 0
push 0
push ebx
call fcn.0040a0e4
mov eax, dword [ebp - 0x10]
call fcn.004a3ef4
mov eax, dword [eax + 0x14]
mov edx, 0x808080
call fcn.0049e884
lea eax, [ebp - 0x38]
push eax
mov eax, dword [ebp - 0x10]
call fcn.004a3ef4
push eax
mov eax, dword [ebp - 0x14]
call fcn.004a3ef4
lea edx, [ebp - 0x28]
pop ecx
call fcn.0049eb58
mov eax, dword [ebp - 0x18]
mov eax, dword [eax + 0x14]
mov edx, 0xff000010
call fcn.0049e884
mov eax, dword [ebp - 0x18]
call fcn.0049f2c8
mov ebx, eax
push 0
push ebx
call fcn.0040a3e4
push 0xffffff
push ebx
call fcn.0040a384
push 0xe20746
push 0
push 0
mov eax, dword [ebp - 0x14]
call fcn.004a3ef4
call fcn.0049f2c8
push eax
push esi
push edi
push 0
push 0
push ebx
call fcn.0040a0e4
mov eax, dword [ebp - 4]
mov eax, dword [eax + 0x1c]
call fcn.0049d6ac
push eax
mov eax, dword [ebp - 0x10]
call fcn.004a3ef4
mov eax, dword [eax + 0x14]
pop edx
call fcn.0049e884
lea eax, [ebp - 0x38]
push eax
mov eax, dword [ebp - 0x10]
call fcn.004a3ef4
push eax
mov eax, dword [ebp - 0x14]
call fcn.004a3ef4
lea edx, [ebp - 0x28]
pop ecx
call fcn.0049eb58
mov eax, dword [ebp - 0x18]
mov eax, dword [eax + 0x14]
mov edx, 0xff00000f
call fcn.0049e884
mov eax, dword [ebp - 0x18]
call fcn.0049f2c8
mov ebx, eax
push 0
push ebx
call fcn.0040a3e4
push 0xffffff
push ebx
call fcn.0040a384
push 0xe20746
push 0
push 0
mov eax, dword [ebp - 0x14]
call fcn.004a3ef4
call fcn.0049f2c8
push eax
push esi
push edi
push 0
push 0
push ebx
call fcn.0040a0e4
jmp 0x516f66
mov eax, dword [ebp - 4]
mov edx, dword [eax + 4]
mov eax, dword [ebp - 0x14]
mov ecx, dword [eax]
call dword [ecx + 8]
mov dl, 1
mov eax, dword [ebp - 0x14]
mov ecx, dword [eax]
call dword [ecx + 0x78]
mov eax, dword [ebp - 0x14]
call fcn.004a3ef4
mov eax, dword [eax + 0x14]
xor edx, edx
call fcn.0049e884
mov edx, edi
mov eax, dword [ebp - 0x14]
mov ecx, dword [eax]
call dword [ecx + 0x44]
mov eax, dword [ebp - 0x14]
call fcn.004a3fb0
test al, al
je 0x516e8b
mov eax, dword [ebp - 0x14]
call fcn.004a3ef4
mov eax, dword [eax + 0xc]
mov edx, 0xffffff
call fcn.0049dd58
xor edx, edx
mov eax, dword [ebp - 0x14]
call fcn.004a4eac
mov eax, dword [ebp - 0x14]
call fcn.004a3ef4
mov eax, dword [eax + 0x14]
mov edx, 0xffffff
call fcn.0049e884
mov dl, 1
mov eax, dword [ebp - 0x14]
call fcn.004a4eac
mov eax, dword [ebp - 0xc]
call fcn.004a3ef4
mov ebx, eax
mov eax, dword [ebx + 0x14]
mov edx, 0xff00000f
call fcn.0049e884
lea edx, [ebp - 0x28]
mov eax, ebx
call fcn.0049ec8c
mov eax, dword [ebx + 0x14]
mov edx, 0xff000014
call fcn.0049e884
push 0
mov eax, ebx
call fcn.0049f2c8
push eax
call fcn.0040a3e4
push 0xffffff
mov eax, ebx
call fcn.0049f2c8
push eax
call fcn.0040a384
push 0xe20746
push 0
push 0
mov eax, dword [ebp - 0x14]
call fcn.004a3ef4
call fcn.0049f2c8
push eax
push esi
push edi
push 1
push 1
mov eax, ebx
call fcn.0049f2c8
push eax
call fcn.0040a0e4
mov eax, dword [ebx + 0x14]
mov edx, 0xff000010
call fcn.0049e884
push 0
mov eax, ebx
call fcn.0049f2c8
push eax
call fcn.0040a3e4
push 0xffffff
mov eax, ebx
call fcn.0049f2c8
push eax
call fcn.0040a384
push 0xe20746
push 0
push 0
mov eax, dword [ebp - 0x14]
call fcn.004a3ef4
call fcn.0049f2c8
push eax
push esi
push edi
push 0
push 0
mov eax, ebx
call fcn.0049f2c8
push eax
call fcn.0040a0e4
xor eax, eax
pop edx
pop ecx
pop ecx
mov dword fs:[eax], edx
push 0x516f8b
mov eax, dword [ebp - 0x10]
call fcn.0040432c
mov eax, dword [ebp - 0x14]
call fcn.0040432c
ret
xor eax, eax
pop edx
pop ecx
pop ecx
mov dword fs:[eax], edx
push 0x516fc6
mov eax, dword [ebp - 0xc]
call fcn.0040432c
ret
mov eax, ebx
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret