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

Disassembly:
sub esp, 0x16c
mov eax, dword [esp + 0x178]
mov edx, dword [eax + 0x504]
push ebx
mov ebx, dword [eax + 0x510]
push esi
mov esi, dword [esp + 0x17c]
mov ecx, dword [esi + 0x40]
mov ecx, dword [ecx + 4]
mov ecx, dword [ecx + 0x1c]
push edi
mov edi, dword [esp + 0x188]
test edi, edi
mov dword [esp + 0x30], ecx
mov ecx, dword [ecx + 0xb20]
mov dword [esp + 0x18], ebx
mov dword [esp + 0x20], edx
mov dword [esp + 0x2c], ecx
je 0x487641
push ebp
xor ebp, ebp
test edx, edx
jle 0x48717a
jmp 0x487120
mov esi, dword [edi + ebp*4]
mov eax, dword [ebx + 0x340]
mov ecx, esi
and ecx, 0x7fff
dec eax
cmp eax, 3
ja case.default.0x487137
jmp dword [eax*4 + 0x487690]
sar ecx, 2
jmp case.default.0x487137
sar ecx, 3
jmp case.default.0x487137
mov eax, 0x2aaaaaab
imul ecx
sar edx, 1
mov eax, edx
shr eax, 0x1f
add eax, edx
mov edx, dword [esp + 0x24]
mov ecx, eax
jmp case.default.0x487137
sar ecx, 4
and esi, 0x8000
or esi, ecx
mov dword [edi + ebp*4], esi
inc ebp
cmp ebp, edx
jl 0x487120
mov eax, dword [esp + 0x188]
cmp edx, 2
mov ecx, dword [edi]
mov dword [esp + 0x78], ecx
mov ecx, dword [edi + 4]
mov dword [esp + 0x7c], ecx
jle 0x4872c5
lea ecx, [edi + 8]
mov dword [esp + 0x28], ecx
lea ecx, [ebx + 0x34c]
mov dword [esp + 0x10], ecx
lea ecx, [esp + 0x78]
add eax, 0x30c
sub ecx, edi
add edx, 0xfffffffe
mov dword [esp + 0x18], eax
mov dword [esp + 0x14], ecx
mov dword [esp + 0x20], edx
jmp 0x4871c1
mov eax, dword [esp + 0x18]
mov ebp, dword [eax + 0xfc]
mov edi, dword [eax]
mov eax, dword [esp + 0x18c]
mov esi, dword [eax + ebp*4]
mov ecx, dword [eax + edi*4]
mov ebx, dword [ebx + ebp*4 + 0x344]
and esi, 0x7fff
and ecx, 0x7fff
sub ecx, esi
mov eax, ecx
cdq
xor eax, edx
sub eax, edx
mov edx, dword [esp + 0x10]
mov edx, dword [edx]
sub edx, ebx
imul eax, edx
mov edx, dword [esp + 0x1c]
mov edx, dword [edx + edi*4 + 0x344]
sub edx, ebx
mov ebx, edx
cdq
idiv ebx
test ecx, ecx
jge 0x487219
mov ecx, esi
sub ecx, eax
jmp 0x48721c
lea ecx, [eax + esi]
mov ebx, dword [esp + 0x28]
mov eax, dword [ebx]
test ah, ah
js 0x487280
cmp ecx, eax
je 0x487280
mov edx, dword [esp + 0x188]
mov edx, dword [edx + 0x50c]
sub edx, ecx
cmp edx, ecx
jl 0x48723f
mov edx, ecx
sub eax, ecx
jns 0x48725c
mov ecx, edx
neg ecx
cmp eax, ecx
jge 0x487252
sub edx, eax
dec edx
mov eax, edx
jmp 0x487266
lea edx, [eax + eax]
or eax, 0xffffffff
sub eax, edx
jmp 0x487266
cmp eax, edx
jl 0x487264
add eax, edx
jmp 0x487266
shl eax, 1
mov ecx, dword [esp + 0x14]
mov dword [ecx + ebx], eax
mov eax, dword [esp + 0x18c]
mov dword [eax + ebp*4], esi
and dword [eax + edi*4], 0x7fff
jmp 0x487293
mov edx, dword [esp + 0x14]
or ecx, 0x8000
mov dword [ebx], ecx
mov dword [edx + ebx], 0
mov esi, dword [esp + 0x18]
mov edx, dword [esp + 0x10]
mov eax, 4
add ebx, eax
add esi, eax
add edx, eax
mov eax, dword [esp + 0x20]
dec eax
mov dword [esp + 0x28], ebx
mov ebx, dword [esp + 0x1c]
mov dword [esp + 0x18], esi
mov dword [esp + 0x10], edx
mov dword [esp + 0x20], eax
jne 0x4871bd
mov edi, dword [esp + 0x180]
push 1
push 1
push edi
call fcn.004cc640
mov esi, dword [esp + 0x194]
mov eax, dword [esi + 0x51c]
add esp, 0xc
inc eax
mov dword [esi + 0x51c], eax
mov eax, dword [esi + 0x50c]
lea edx, [eax - 1]
mov eax, edx
xor ecx, ecx
test eax, eax
je 0x487307
mov edi, edi
shr eax, 1
inc ecx
test eax, eax
jne 0x487300
mov ebp, dword [esi + 0x518]
lea eax, [ecx + ecx]
add ebp, eax
mov eax, edx
xor ecx, ecx
test eax, eax
mov dword [esi + 0x518], ebp
je 0x487327
shr eax, 1
inc ecx
test eax, eax
jne 0x487320
push ecx
mov ecx, dword [esp + 0x7c]
push ecx
push edi
call fcn.004cc640
mov eax, dword [esi + 0x50c]
add esp, 0xc
dec eax
mov ecx, 0
je 0x48734b
shr eax, 1
inc ecx
test eax, eax
jne 0x487344
mov edx, dword [esp + 0x7c]
push ecx
push edx
push edi
call fcn.004cc640
mov eax, dword [ebx]
add esp, 0xc
test eax, eax
mov dword [esp + 0x24], 0
mov dword [esp + 0x10], 2
jle 0x48755c
lea eax, [ebx + 4]
mov dword [esp + 0x14], eax
jmp 0x487380
mov ecx, dword [esp + 0x14]
mov edx, dword [ecx]
mov ebp, dword [ebx + edx*4 + 0xc0]
mov eax, dword [ebx + edx*4 + 0x80]
xor edi, edi
mov esi, 1
mov ecx, ebp
shl esi, cl
cmp ebp, edi
mov dword [esp + 0x28], edx
mov dword [esp + 0x18], eax
mov dword [esp + 0x38], edi
mov dword [esp + 0x3c], edi
mov dword [esp + 0x40], edi
mov dword [esp + 0x44], edi
mov dword [esp + 0x48], edi
mov dword [esp + 0x4c], edi
mov dword [esp + 0x50], edi
mov dword [esp + 0x54], edi
mov dword [esp + 0x20], edi
mov dword [esp + 0x1c], edi
je 0x4874c0
xor eax, eax
cmp esi, edi
jle 0x487415
add edx, 0xa
shl edx, 5
add edx, ebx
mov edi, dword [edx]
test edi, edi
jge 0x4873f5
mov dword [esp + eax*4 + 0x58], 1
jmp 0x487407
mov ecx, dword [esp + 0x34]
mov ecx, dword [ecx + edi*4 + 0x720]
mov ecx, dword [ecx + 4]
mov dword [esp + eax*4 + 0x58], ecx
inc eax
add edx, 4
cmp eax, esi
jl 0x4873e5
mov edx, dword [esp + 0x28]
xor edi, edi
mov ecx, dword [esp + 0x18]
xor eax, eax
cmp ecx, edi
jle 0x487481
mov edx, dword [esp + 0x10]
lea ecx, [esp + edx*4 + 0x78]
mov dword [esp + 0x2c], ecx
jmp 0x487430
xor edx, edx
cmp esi, edi
jle 0x487451
mov ecx, dword [esp + 0x2c]
mov ecx, dword [ecx]
lea esp, [esp]
cmp ecx, dword [esp + edx*4 + 0x58]
jl 0x48744d
inc edx
cmp edx, esi
jl 0x487440
jmp 0x487451
mov dword [esp + eax*4 + 0x38], edx
mov ecx, dword [esp + 0x1c]
mov edx, dword [esp + eax*4 + 0x38]
shl edx, cl
mov ecx, dword [esp + 0x20]
or ecx, edx
add dword [esp + 0x1c], ebp
mov edx, dword [esp + 0x2c]
mov dword [esp + 0x20], ecx
mov ecx, dword [esp + 0x18]
inc eax
add edx, 4
cmp eax, ecx
mov dword [esp + 0x2c], edx
jl 0x487430
mov edx, dword [esp + 0x28]
mov edx, dword [ebx + edx*4 + 0x100]
mov eax, dword [esp + 0x180]
imul edx, edx, 0x2c
mov ecx, dword [esp + 0x20]
push eax
mov eax, dword [esp + 0x34]
push ecx
add edx, eax
push edx
call fcn.0047f050
mov ecx, dword [esp + 0x194]
mov edx, dword [ecx + 0x514]
add esp, 0xc
add edx, eax
mov dword [ecx + 0x514], edx
mov edx, dword [esp + 0x28]
mov eax, dword [esp + 0x18]
xor esi, esi
cmp eax, edi
jle 0x487530
mov edi, dword [esp + 0x10]
lea ebp, [edx*8 + 0x50]
lea edi, [esp + edi*4 + 0x78]
lea esp, [esp]
mov eax, dword [esp + esi*4 + 0x38]
add eax, ebp
mov eax, dword [ebx + eax*4]
test eax, eax
jl 0x487524
mov edx, dword [esp + 0x30]
imul eax, eax, 0x2c
mov ecx, dword [edi]
add eax, edx
cmp ecx, dword [eax + 4]
jge 0x487524
mov edx, dword [esp + 0x180]
push edx
push ecx
push eax
call fcn.0047f050
mov ecx, dword [esp + 0x194]
mov edx, dword [ecx + 0x518]
add esp, 0xc
add edx, eax
mov dword [ecx + 0x518], edx
mov eax, dword [esp + 0x18]
inc esi
add edi, 4
cmp esi, eax
jl 0x4874e0
mov eax, dword [esp + 0x18]
mov edi, dword [esp + 0x10]
mov edx, dword [esp + 0x14]
mov ecx, dword [ebx]
add edi, eax
mov eax, dword [esp + 0x24]
inc eax
add edx, 4
cmp eax, ecx
mov dword [esp + 0x10], edi
mov dword [esp + 0x24], eax
mov dword [esp + 0x14], edx
jl 0x487380
mov edx, dword [esp + 0x18c]
mov ecx, dword [ebx + 0x340]
imul ecx, dword [edx]
mov eax, dword [esp + 0x188]
mov esi, dword [eax + 0x504]
mov edx, 1
xor edi, edi
xor ebp, ebp
cmp esi, edx
mov dword [esp + 0x10], edx
jle 0x4875fb
add eax, 0x108
mov dword [esp + 0x14], eax
mov eax, dword [esp + 0x14]
mov edx, dword [eax]
mov eax, dword [esp + 0x18c]
mov esi, dword [eax + edx*4]
mov eax, esi
and eax, 0x7fff
cmp eax, esi
jne 0x4875d6
mov esi, dword [ebx + 0x340]
mov edi, dword [ebx + edx*4 + 0x344]
imul esi, eax
mov edx, dword [esp + 0x190]
push edx
push edi
push ebp
mov eax, esi
call fcn.00486460
add esp, 0xc
mov ebp, edi
mov ecx, esi
mov edx, dword [esp + 0x14]
mov eax, dword [esp + 0x10]
add edx, 4
mov dword [esp + 0x14], edx
mov edx, dword [esp + 0x188]
mov esi, dword [edx + 0x504]
inc eax
cmp eax, esi
mov dword [esp + 0x10], eax
jl 0x487593
mov esi, dword [esp + 0x184]
mov eax, dword [esi + 0x24]
cdq
sub eax, edx
sar eax, 1
cmp edi, eax
pop ebp
jge 0x487627
nop
mov eax, dword [esp + 0x18c]
mov dword [eax + edi*4], ecx
mov eax, dword [esi + 0x24]
cdq
sub eax, edx
inc edi
sar eax, 1
cmp edi, eax
jl 0x487610
mov eax, dword [0x51bf78]
pop edi
inc eax
pop esi
mov dword [0x51bf78], eax
mov eax, 1
pop ebx
add esp, 0x16c
ret
mov ecx, dword [esp + 0x17c]
push 1
push 0
push ecx
call fcn.004cc640
mov eax, dword [esi + 0x24]
mov edi, dword [esp + 0x198]
cdq
sub eax, edx
mov ecx, eax
sar ecx, 1
shl ecx, 2
mov edx, ecx
shr ecx, 2
xor eax, eax
rep stosd dword es:[edi], eax
add esp, 0xc
mov ecx, edx
and ecx, 3
rep stosb byte es:[edi], al
mov eax, dword [0x51bf78]
pop edi
inc eax
pop esi
mov dword [0x51bf78], eax
xor eax, eax
pop ebx
add esp, 0x16c
ret