Function at 0x508e30
Capabilities:
Terminate process

Disassembly:
sub esp, 0xd38
push ebx
push ebp
mov ebp, dword [esp + 0xd48]
mov ebx, dword [ebp + 0x504]
mov edx, dword [ebp + 0x508]
xor eax, eax
cmp ebx, eax
push esi
mov esi, dword [ebp + 0x510]
push edi
mov dword [esp + 0x20], esi
mov dword [esp + 0x24], ebx
mov dword [esp + 0x10], eax
mov dword [esp + 0x14], eax
jle 0x508e79
mov ecx, ebx
mov eax, 0xffffff38
lea edi, [esp + 0x138]
rep stosd dword es:[edi], eax
test ebx, ebx
jle 0x508ebb
mov eax, 0xffffff38
mov ecx, ebx
lea edi, [esp + 0x34]
rep stosd dword es:[edi], eax
xor eax, eax
test ebx, ebx
mov ecx, ebx
lea edi, [esp + 0x23c]
rep stosd dword es:[edi], eax
jle 0x508ebb
mov eax, 1
mov ecx, ebx
lea edi, [esp + 0x340]
rep stosd dword es:[edi], eax
or eax, 0xffffffff
mov ecx, ebx
lea edi, [esp + 0x444]
rep stosd dword es:[edi], eax
test ebx, ebx
jne 0x508ee4
mov eax, dword [esp + 0xd54]
mov ecx, dword [esp + 0xd58]
push esi
push edx
push eax
push ecx
mov eax, edx
lea edi, [esp + 0x558]
xor ecx, ecx
call fcn.005087e0
add esp, 0x10
jmp 0x508f43
lea eax, [ebx - 1]
xor esi, esi
test eax, eax
jle 0x5092ee
lea edi, [esp + 0x548]
jmp 0x508f00
mov edx, dword [esp + 0x20]
mov eax, dword [ebp + esi*4 + 4]
mov ecx, dword [esp + 0xd54]
push edx
mov edx, dword [esp + 0xd5c]
push eax
mov eax, dword [ebp + 0x508]
push ecx
mov ecx, dword [ebp + esi*4]
push edx
call fcn.005087e0
mov ecx, dword [esp + 0x20]
add ecx, eax
add esp, 0x10
inc esi
lea eax, [ebx - 1]
add edi, 0x20
cmp esi, eax
mov dword [esp + 0x10], ecx
jl 0x508f00
mov eax, ecx
test eax, eax
je 0x5092ee
mov eax, 0xffffff38
mov dword [esp + 0x14], eax
mov dword [esp + 0x18], eax
lea eax, [esp + 0x18]
push eax
lea ecx, [esp + 0x18]
push ecx
lea edx, [ebx - 1]
push edx
lea eax, [esp + 0x554]
push eax
call fcn.005089e0
mov eax, dword [esp + 0x24]
mov esi, eax
mov edi, eax
mov eax, dword [esp + 0x28]
add esp, 0x10
cmp ebx, 2
mov dword [esp + 0x138], esi
mov dword [esp + 0x34], edi
mov dword [esp + 0x38], eax
mov dword [esp + 0x13c], eax
mov dword [esp + 0x10], 2
jle 0x5091ad
lea ecx, [ebp + 0x210]
mov dword [esp + 0x1c], ecx
mov edx, dword [esp + 0x1c]
mov eax, dword [edx]
mov edi, dword [esp + eax*4 + 0x23c]
mov esi, dword [esp + eax*4 + 0x340]
mov dword [esp + 0x14], eax
cmp dword [esp + edi*4 + 0x444], esi
je 0x509186
mov eax, dword [esp + 0x20]
mov ecx, dword [eax + edi*4 + 0x344]
mov edx, dword [eax + esi*4 + 0x344]
mov ebx, dword [ebp + edi*4 + 0x208]
mov ebp, dword [ebp + esi*4 + 0x208]
mov dword [esp + 0x28], ecx
mov ecx, dword [esp + edi*4 + 0x138]
test ecx, ecx
mov dword [esp + 0x2c], edx
mov edx, dword [esp + edi*4 + 0x34]
mov dword [esp + edi*4 + 0x444], esi
jl 0x509022
test edx, edx
jge 0x50901e
mov edx, ecx
jmp 0x509022
add edx, ecx
sar edx, 1
mov ecx, dword [esp + esi*4 + 0x138]
test ecx, ecx
jge 0x509033
mov ecx, dword [esp + esi*4 + 0x34]
jmp 0x50903f
mov eax, dword [esp + esi*4 + 0x34]
test eax, eax
jl 0x50903f
add ecx, eax
sar ecx, 1
cmp edx, 0xffffffff
je 0x5091d1
cmp ecx, 0xffffffff
je 0x5091d1
mov eax, dword [esp + 0x20]
push eax
mov eax, dword [esp + 0xd58]
push eax
mov eax, dword [esp + 0xd60]
push eax
mov eax, dword [esp + 0x34]
push edx
mov edx, dword [esp + 0x3c]
push edx
call fcn.00508bd0
add esp, 0x14
test eax, eax
je 0x509167
mov edx, dword [esp + 0x14]
mov eax, 0xffffff38
mov dword [esp + 0x18], eax
mov dword [esp + 0x30], eax
mov dword [esp + 0x28], eax
mov dword [esp + 0x2c], eax
lea eax, [esp + 0x30]
push eax
lea ecx, [esp + 0x1c]
sub edx, ebx
push ecx
shl ebx, 5
push edx
lea eax, [esp + ebx + 0x554]
push eax
call fcn.005089e0
mov ebx, dword [esp + 0x24]
lea ecx, [esp + 0x3c]
push ecx
lea edx, [esp + 0x3c]
push edx
mov eax, ebx
shl eax, 5
sub ebp, ebx
lea ecx, [esp + eax + 0x560]
push ebp
push ecx
call fcn.005089e0
mov eax, dword [esp + 0x38]
add esp, 0x20
test edi, edi
mov dword [esp + edi*4 + 0x34], eax
jne 0x5090ef
mov dword [esp + 0x138], eax
cmp esi, 1
mov ecx, dword [esp + 0x10]
mov edx, dword [esp + 0x30]
mov ebp, dword [esp + 0x28]
mov eax, dword [esp + 0x2c]
mov dword [esp + ecx*4 + 0x138], edx
mov dword [esp + ecx*4 + 0x34], ebp
mov dword [esp + esi*4 + 0x138], eax
jne 0x50911a
mov dword [esp + 0x38], eax
test edx, edx
jge 0x509122
test ebp, ebp
jl 0x50917b
lea eax, [ebx - 1]
test eax, eax
jl 0x509143
lea esp, [esp]
cmp dword [esp + eax*4 + 0x340], esi
jne 0x509143
dec eax
mov dword [esp + eax*4 + 0x344], ecx
jns 0x509130
mov edx, dword [esp + 0x24]
lea eax, [ebx + 1]
cmp eax, edx
jge 0x50917b
mov edi, edi
cmp dword [esp + eax*4 + 0x23c], edi
jne 0x50917b
mov dword [esp + eax*4 + 0x23c], ecx
inc eax
cmp eax, edx
jl 0x509150
jmp 0x50917b
mov eax, dword [esp + 0x10]
mov ecx, 0xffffff38
mov dword [esp + eax*4 + 0x138], ecx
mov dword [esp + eax*4 + 0x34], ecx
mov ebp, dword [esp + 0xd50]
mov ebx, dword [esp + 0x24]
mov eax, dword [esp + 0x10]
mov edx, dword [esp + 0x1c]
inc eax
add edx, 4
cmp eax, ebx
mov dword [esp + 0x10], eax
mov dword [esp + 0x1c], edx
jl 0x508fb3
mov edi, dword [esp + 0x34]
mov esi, dword [esp + 0x138]
mov eax, dword [esp + 0xd4c]
lea edx, [ebx*4]
push edx
push eax
call fcn.004fbd30
add esp, 8
test esi, esi
mov dword [esp + 0x14], eax
jge 0x5091d8
mov esi, edi
jmp 0x5091e0
push 1
call fcn.004e0dd9
test edi, edi
jl 0x5091e0
add esi, edi
sar esi, 1
mov ecx, dword [esp + 0x13c]
test ecx, ecx
mov dword [eax], esi
jge 0x5091f3
mov ecx, dword [esp + 0x38]
jmp 0x5091ff
mov edx, dword [esp + 0x38]
test edx, edx
jl 0x5091ff
add ecx, edx
sar ecx, 1
cmp ebx, 2
mov dword [eax + 4], ecx
mov dword [esp + 0x10], 2
jle 0x5092ee
mov ecx, dword [esp + 0x20]
add ecx, 0x34c
add ebp, 0x30c
mov dword [esp + 0x18], ecx
mov dword [esp + 0x1c], ebp
jmp 0x509231
mov ebp, dword [esp + 0x1c]
mov eax, dword [ebp + 0xfc]
mov edi, dword [ebp]
mov ebp, dword [esp + 0x14]
mov esi, dword [ebp + eax*4]
mov ecx, dword [ebp + edi*4]
mov edx, dword [esp + 0x20]
mov ebx, dword [edx + eax*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 + 0x18]
mov edx, dword [edx]
sub edx, ebx
imul eax, edx
mov edx, dword [esp + 0x20]
mov edi, dword [edx + edi*4 + 0x344]
sub edi, ebx
cdq
idiv edi
test ecx, ecx
jge 0x509289
sub esi, eax
jmp 0x50928b
add esi, eax
mov ecx, dword [esp + 0x10]
mov eax, dword [esp + ecx*4 + 0x138]
test eax, eax
jge 0x5092a0
mov eax, dword [esp + ecx*4 + 0x34]
jmp 0x5092ac
mov edx, dword [esp + ecx*4 + 0x34]
test edx, edx
jl 0x5092ac
add eax, edx
sar eax, 1
test eax, eax
jl 0x5092ba
cmp esi, eax
je 0x5092ba
mov dword [ebp + ecx*4], eax
jmp 0x5092c4
or esi, 0x8000
mov dword [ebp + ecx*4], esi
mov esi, dword [esp + 0x1c]
mov edx, dword [esp + 0x18]
mov eax, 4
add esi, eax
add edx, eax
mov eax, dword [esp + 0x24]
inc ecx
cmp ecx, eax
mov dword [esp + 0x10], ecx
mov dword [esp + 0x1c], esi
mov dword [esp + 0x18], edx
jl 0x50922d
mov eax, dword [esp + 0x14]
pop edi
pop esi
pop ebp
pop ebx
add esp, 0xd38
ret