Function at 0x1005af86
Capabilities:
Encode data using xor

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x14
push ebx
push esi
mov esi, dword [ebp + 8]
xor ebx, ebx
mov dword [ebp - 4], ebx
mov eax, dword [esi + 0x6af90]
mov dword [esi + 0x6af80], 2
cmp eax, ebx
je 0x1005b1c6
push edi
mov edi, 0x7fff
cmp eax, 3
jb 0x1005b006
mov ecx, dword [esi + 0x6af84]
mov edx, dword [esi + 0x6af7c]
and edx, 0x3ff
movzx eax, byte [ecx + esi + 0x1af72]
and eax, edi
shl edx, 5
xor eax, edx
and ecx, edi
mov dword [esi + 0x6af7c], eax
mov eax, dword [esi + eax*4 + 0x4af70]
mov dword [ebp - 4], eax
mov dword [esi + ecx*4 + 0x2af70], eax
mov eax, dword [esi + 0x6af7c]
mov ecx, dword [esi + 0x6af84]
mov dword [esi + eax*4 + 0x4af70], ecx
cmp dword [ebp - 4], 0
je 0x1005b047
mov eax, dword [esi + 0x6af84]
sub eax, dword [ebp - 4]
cmp eax, 0x7efa
ja 0x1005b047
mov ecx, dword [esi + 0x6af90]
lea eax, [esi + 0x6afa0]
cmp dword [eax], ecx
jbe 0x1005b02e
mov dword [eax], ecx
push dword [ebp - 4]
push esi
call fcn.1005ac29
mov ebx, eax
mov eax, dword [esi + 0x6af90]
pop ecx
cmp ebx, eax
pop ecx
jbe 0x1005b047
mov ebx, eax
cmp ebx, 3
jb 0x1005b13f
lea eax, [ebx - 3]
push eax
mov eax, dword [esi + 0x6af84]
sub eax, dword [esi + 0x6af88]
push eax
push esi
call fcn.1005a3af
sub dword [esi + 0x6af90], ebx
add esp, 0xc
cmp ebx, dword [esi + 0x6af98]
mov dword [ebp + 8], eax
mov eax, dword [esi + 0x6af90]
ja 0x1005b0e2
cmp eax, 3
jb 0x1005b0e2
dec ebx
inc dword [esi + 0x6af84]
mov ecx, dword [esi + 0x6af84]
mov edx, dword [esi + 0x6af7c]
movzx eax, byte [esi + ecx + 0x1af72]
and edx, 0x3ff
and eax, edi
shl edx, 5
xor eax, edx
and ecx, edi
mov dword [esi + 0x6af7c], eax
dec ebx
mov eax, dword [esi + eax*4 + 0x4af70]
mov dword [ebp - 4], eax
mov dword [esi + ecx*4 + 0x2af70], eax
mov eax, dword [esi + 0x6af7c]
mov ecx, dword [esi + 0x6af84]
mov dword [esi + eax*4 + 0x4af70], ecx
jne 0x1005b087
jmp 0x1005b162
add dword [esi + 0x6af84], ebx
mov eax, dword [esi + 0x6af84]
lea edx, [esi + 0x6af7c]
xor ebx, ebx
lea ecx, [eax + esi]
movzx eax, byte [eax + esi + 0x1af70]
mov dword [edx], eax
and eax, 0x3ff
movzx ecx, byte [ecx + 0x1af71]
and ecx, edi
shl eax, 5
xor ecx, eax
lea eax, [ebp - 0x14]
push eax
mov dword [edx], ecx
call fcn.1005105e
pop ecx
mov ecx, eax
call fcn.10001b9f
push eax
push 1
push esi
call fcn.100592c9
add esp, 0xc
lea ecx, [ebp - 0x14]
call fcn.10001b7f
jmp 0x1005b168
mov eax, dword [esi + 0x6af84]
movzx eax, byte [eax + esi + 0x1af70]
push eax
push 0
push esi
call fcn.1005a3af
add esp, 0xc
dec dword [esi + 0x6af90]
mov dword [ebp + 8], eax
inc dword [esi + 0x6af84]
cmp dword [ebp + 8], 0
je 0x1005b1a4
mov eax, dword [esi + 0x6af74]
test eax, eax
jl 0x1005b181
lea ecx, [eax + esi + 0x1af70]
jmp 0x1005b183
xor ecx, ecx
mov edx, dword [esi + 0x6af84]
push 0
sub edx, eax
push edx
push ecx
push esi
call fcn.1005a0fc
mov eax, dword [esi + 0x6af84]
add esp, 0x10
mov dword [esi + 0x6af74], eax
cmp dword [esi + 0x6af90], 0x106
jae 0x1005b1b7
push esi
call fcn.1005ae43
pop ecx
mov eax, dword [esi + 0x6af90]
test eax, eax
jne 0x1005afb4
pop edi
mov eax, dword [esi + 0x6af74]
test eax, eax
jl 0x1005b1d9
lea ecx, [eax + esi + 0x1af70]
jmp 0x1005b1db
xor ecx, ecx
mov edx, dword [esi + 0x6af84]
push 1
sub edx, eax
push edx
push ecx
push esi
call fcn.1005a0fc
add esp, 0x10
pop esi
pop ebx
leave
ret