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

Disassembly:
mov eax, dword [ebp + 0x30]
test eax, eax
je 0x5068ea
mov esi, dword [edi + 0x9c]
mov eax, dword [esp + 0x88]
mov ecx, dword [ebp + 0xc]
cmp esi, eax
jae 0x5063e7
mov eax, ecx
mov dword [esp + 0x60], 0
mov dword [esp + 0x10], eax
add eax, eax
jmp 0x506406
mov eax, dword [ebp + 0x20]
xor edx, edx
div ecx
test edx, edx
mov dword [esp + 0x10], edx
jne 0x5063fc
mov dword [esp + 0x10], ecx
mov edx, ecx
mov eax, edx
mov dword [esp + 0x60], 1
test esi, esi
jbe 0x506435
add eax, ecx
dec esi
imul esi, ecx
mov edx, dword [edi + 4]
push 0
push eax
mov eax, dword [ebx]
push esi
push eax
push edi
call dword [edx + 0x20]
mov ecx, dword [ebp + 0xc]
add esp, 0x14
mov dword [esp + 0x78], 0
lea esi, [eax + ecx*4]
mov dword [esp + 0x4c], esi
jmp 0x506455
mov edx, dword [edi + 4]
push 0
push eax
mov eax, dword [ebx]
push 0
push eax
push edi
call dword [edx + 0x20]
add esp, 0x14
mov dword [esp + 0x4c], eax
mov dword [esp + 0x78], 1
mov esi, eax
mov ecx, dword [esp + 0x94]
mov edx, dword [edi + 0x1bc]
mov eax, dword [ecx + 0x70]
mov ecx, dword [esp + 0x54]
add eax, ecx
xor ecx, ecx
mov dword [esp + 0x14], eax
mov eax, dword [ebp + 0x4c]
mov cx, word [eax]
mov dword [esp + 0x18], ecx
xor ecx, ecx
mov cx, word [eax + 2]
mov dword [esp + 0x6c], ecx
xor ecx, ecx
mov cx, word [eax + 0x10]
mov dword [esp + 0x7c], ecx
xor ecx, ecx
mov cx, word [eax + 0x20]
mov dword [esp + 0x74], ecx
xor ecx, ecx
mov cx, word [eax + 0x12]
mov dword [esp + 0x84], ecx
xor ecx, ecx
mov cx, word [eax + 4]
mov eax, dword [esp + 0x8c]
mov dword [esp + 0x80], ecx
mov ecx, dword [esp + 0x5c]
add edx, eax
mov eax, dword [edx + ebx]
mov edx, dword [ecx]
mov ecx, dword [esp + 0x10]
mov dword [esp + 0x90], eax
xor eax, eax
mov dword [esp + 0x44], edx
test ecx, ecx
mov dword [esp + 0x30], eax
jle 0x5068ea
jmp 0x5064ec
mov eax, dword [esp + 0x30]
mov esi, dword [esp + 0x4c]
mov ecx, dword [esp + 0x78]
mov edx, dword [esi + eax*4]
test ecx, ecx
mov dword [esp + 0x24], edx
je 0x506501
test eax, eax
mov ecx, edx
je 0x506505
mov ecx, dword [esi + eax*4 - 4]
mov edi, dword [esp + 0x60]
test edi, edi
je 0x50651a
mov edi, dword [esp + 0x10]
dec edi
cmp eax, edi
jne 0x50651a
mov eax, edx
jmp 0x50651e
mov eax, dword [esi + eax*4 + 4]
movsx esi, word [edx]
mov edx, dword [ebp + 0x1c]
mov dword [esp + 0x28], esi
movsx edi, word [ecx]
movsx ebx, word [eax]
dec edx
add eax, 0x80
add ecx, 0x80
mov dword [esp + 0x38], edi
mov dword [esp + 0x1c], edi
mov dword [esp + 0x58], esi
mov dword [esp + 0x40], ebx
mov dword [esp + 0x20], ebx
mov dword [esp + 0x34], 0
mov dword [esp + 0x64], edx
mov dword fs:[esp + 0x3c], 0
mov dword fs:[esp + 0x3c], 0
mov dword [esp + 0x48], eax
mov dword [esp + 0x50], ecx
mov ecx, dword [esp + 0x24]
lea eax, [esp + 0x98]
push 1
push eax
push ecx
call fcn.00505200
mov edx, dword [esp + 0x70]
mov eax, dword [esp + 0x48]
add esp, 0xc
cmp eax, edx
jae 0x5065ae
mov eax, dword [esp + 0x50]
mov edx, dword [esp + 0x24]
movsx ecx, word [eax]
mov eax, dword [esp + 0x48]
mov dword [esp + 0x38], ecx
movsx esi, word [edx + 0x80]
movsx ecx, word [eax]
mov dword [esp + 0x40], ecx
mov edx, dword [esp + 0x14]
mov ecx, dword [edx + 4]
test ecx, ecx
je 0x506627
cmp word [esp + 0x9a], 0
jne 0x506627
mov eax, dword [esp + 0x58]
mov ebp, dword [esp + 0x6c]
sub eax, esi
imul eax, dword [esp + 0x18]
lea edx, [eax + eax*8]
mov eax, ebp
shl edx, 2
js 0x5065fc
shl eax, 7
add eax, edx
cdq
shl ebp, 8
idiv ebp
test ecx, ecx
jle 0x50661b
mov edx, 1
shl edx, cl
cmp eax, edx
jl 0x50661b
lea eax, [edx - 1]
jmp 0x50661b
shl eax, 7
sub eax, edx
cdq
shl ebp, 8
idiv ebp
test ecx, ecx
jle 0x506619
mov edx, 1
shl edx, cl
cmp eax, edx
jl 0x506619
lea eax, [edx - 1]
neg eax
mov ebp, dword [esp + 0x2c]
mov word [esp + 0x9a], ax
mov eax, dword [esp + 0x14]
mov ecx, dword [eax + 8]
test ecx, ecx
je 0x5066a4
cmp word [esp + 0xa8], 0
jne 0x5066a4
mov eax, dword [esp + 0x1c]
mov edx, dword [esp + 0x20]
sub eax, edx
mov ebp, dword [esp + 0x7c]
imul eax, dword [esp + 0x18]
lea edx, [eax + eax*8]
mov eax, ebp
shl edx, 2
js 0x506679
shl eax, 7
add eax, edx
cdq
shl ebp, 8
idiv ebp
test ecx, ecx
jle 0x506698
mov edx, 1
shl edx, cl
cmp eax, edx
jl 0x506698
lea eax, [edx - 1]
jmp 0x506698
shl eax, 7
sub eax, edx
cdq
shl ebp, 8
idiv ebp
test ecx, ecx
jle 0x506696
mov edx, 1
shl edx, cl
cmp eax, edx
jl 0x506696
lea eax, [edx - 1]
neg eax
mov ebp, dword [esp + 0x2c]
mov word [esp + 0xa8], ax
mov ecx, dword [esp + 0x14]
mov ecx, dword [ecx + 0xc]
test ecx, ecx
je 0x50672b
cmp word [esp + 0xb8], 0
jne 0x50672b
mov edx, dword [esp + 0x28]
mov ebp, dword [esp + 0x74]
lea eax, [edx + edx]
mov edx, eax
mov eax, dword [esp + 0x20]
sub eax, edx
mov edx, dword [esp + 0x1c]
add eax, edx
imul eax, dword [esp + 0x18]
lea edx, [eax + eax*8]
mov eax, ebp
test edx, edx
jl 0x506700
shl eax, 7
add eax, edx
cdq
shl ebp, 8
idiv ebp
test ecx, ecx
jle 0x50671f
mov edx, 1
shl edx, cl
cmp eax, edx
jl 0x50671f
lea eax, [edx - 1]
jmp 0x50671f
shl eax, 7
sub eax, edx
cdq
shl ebp, 8
idiv ebp
test ecx, ecx
jle 0x50671d
mov edx, 1
shl edx, cl
cmp eax, edx
jl 0x50671d
lea eax, [edx - 1]
neg eax
mov ebp, dword [esp + 0x2c]
mov word [esp + 0xb8], ax
mov eax, dword [esp + 0x14]
mov ecx, dword [eax + 0x10]
test ecx, ecx
je 0x5067aa
cmp word [esp + 0xaa], 0
jne 0x5067aa
mov eax, dword [esp + 0x40]
sub eax, ebx
mov ebx, dword [esp + 0x38]
sub eax, ebx
add eax, edi
mov edi, dword [esp + 0x84]
imul eax, dword [esp + 0x18]
lea edx, [eax + eax*4]
mov eax, edi
test edx, edx
jl 0x506783
shl eax, 7
add eax, edx
cdq
shl edi, 8
idiv edi
test ecx, ecx
jle 0x5067a2
mov edx, 1
shl edx, cl
cmp eax, edx
jl 0x5067a2
lea eax, [edx - 1]
jmp 0x5067a2
shl eax, 7
sub eax, edx
cdq
shl edi, 8
idiv edi
test ecx, ecx
jle 0x5067a0
mov edx, 1
shl edx, cl
cmp eax, edx
jl 0x5067a0
lea eax, [edx - 1]
neg eax
mov word [esp + 0xaa], ax
mov ecx, dword [esp + 0x14]
mov ecx, dword [ecx + 0x14]
test ecx, ecx
je 0x50682e
cmp word [esp + 0x9c], 0
jne 0x50682e
mov edx, dword [esp + 0x28]
mov edi, dword [esp + 0x80]
lea eax, [edx + edx]
mov edx, eax
mov eax, esi
sub eax, edx
mov edx, dword [esp + 0x58]
add eax, edx
imul eax, dword [esp + 0x18]
lea edx, [eax + eax*8]
mov eax, edi
test edx, edx
jl 0x506807
shl eax, 7
add eax, edx
cdq
shl edi, 8
idiv edi
test ecx, ecx
jle 0x506826
mov edx, 1
shl edx, cl
cmp eax, edx
jl 0x506826
lea eax, [edx - 1]
jmp 0x506826
shl eax, 7
sub eax, edx
cdq
shl edi, 8
idiv edi
test ecx, ecx
jle 0x506824
mov edx, 1
shl edx, cl
cmp eax, edx
jl 0x506824
lea eax, [edx - 1]
neg eax
mov word [esp + 0x9c], ax
mov eax, dword [esp + 0x34]
mov ecx, dword [esp + 0x44]
push eax
mov eax, dword [esp + 0x120]
lea edx, [esp + 0x9c]
push ecx
push edx
push ebp
push eax
call dword [esp + 0xa4]
mov ecx, dword [esp + 0x4c]
mov eax, dword [esp + 0x54]
mov edi, dword [esp + 0x30]
mov ebx, dword [esp + 0x34]
mov edx, dword [esp + 0x3c]
mov dword [esp + 0x30], ecx
mov ecx, dword [esp + 0x38]
mov dword [esp + 0x34], eax
mov eax, 0x80
mov dword [esp + 0x6c], edx
mov edx, dword [esp + 0x64]
add ecx, eax
mov dword [esp + 0x38], ecx
mov ecx, dword [esp + 0x5c]
add ecx, eax
add edx, eax
mov eax, dword [esp + 0x48]
mov dword [esp + 0x5c], ecx
mov ecx, dword [ebp + 0x24]
add esp, 0x14
add eax, ecx
mov ecx, dword [esp + 0x64]
mov dword [esp + 0x34], eax
mov eax, dword [esp + 0x3c]
inc eax
mov dword [esp + 0x28], esi
cmp eax, ecx
mov dword [esp + 0x50], edx
mov dword [esp + 0x3c], eax
jbe 0x50656a
mov edx, dword [ebp + 0x24]
mov eax, dword [esp + 0x44]
lea ecx, [eax + edx*4]
mov eax, dword [esp + 0x30]
mov dword [esp + 0x44], ecx
mov ecx, dword [esp + 0x10]
inc eax
cmp eax, ecx
mov dword [esp + 0x30], eax
jl 0x5064e4
mov ebx, dword [esp + 0x70]
mov edi, dword [esp + 0x11c]
mov eax, dword [esp + 0x68]
mov edx, dword [esp + 0x54]
mov esi, dword [esp + 0x5c]
mov ecx, dword [edi + 0x20]
inc eax
add edx, 0x18
add ebx, 4
add esi, 4
add ebp, 0x54
cmp eax, ecx
mov dword [esp + 0x68], eax
mov dword [esp + 0x54], edx
mov dword [esp + 0x70], ebx
mov dword [esp + 0x5c], esi
mov dword [esp + 0x2c], ebp
jl 0x5063a9
mov esi, dword [edi + 0x9c]
mov edx, dword [edi + 0x13c]
inc esi
mov eax, esi
mov dword [edi + 0x9c], esi
cmp eax, edx
pop edi
sbb eax, eax
pop esi
pop ebp
add eax, 4
pop ebx
add esp, 0x108
ret