Function at 0x1005afdc
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 0x1005b21c
push edi
mov edi, 0x7fff
cmp eax, 3
jb 0x1005b05c
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 0x1005b09d
mov eax, dword [esi + 0x6af84]
sub eax, dword [ebp - 4]
cmp eax, 0x7efa
ja 0x1005b09d
mov ecx, dword [esi + 0x6af90]
lea eax, [esi + 0x6afa0]
cmp dword [eax], ecx
jbe 0x1005b084
mov dword [eax], ecx
push dword [ebp - 4]
push esi
call fcn.1005ac7f
mov ebx, eax
mov eax, dword [esi + 0x6af90]
pop ecx
cmp ebx, eax
pop ecx
jbe 0x1005b09d
mov ebx, eax
cmp ebx, 3
jb 0x1005b195
lea eax, [ebx - 3]
push eax
mov eax, dword [esi + 0x6af84]
sub eax, dword [esi + 0x6af88]
push eax
push esi
call fcn.1005a405
sub dword [esi + 0x6af90], ebx
add esp, 0xc
cmp ebx, dword [esi + 0x6af98]
mov dword [ebp + 8], eax
mov eax, dword [esi + 0x6af90]
ja 0x1005b138
cmp eax, 3
jb 0x1005b138
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 0x1005b0dd
jmp 0x1005b1b8
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.100510b4
pop ecx
mov ecx, eax
call fcn.10001b9f
push eax
push 1
push esi
call fcn.1005931f
add esp, 0xc
lea ecx, [ebp - 0x14]
call fcn.10001b7f
jmp 0x1005b1be
mov eax, dword [esi + 0x6af84]
movzx eax, byte [eax + esi + 0x1af70]
push eax
push 0
push esi
call fcn.1005a405
add esp, 0xc
dec dword [esi + 0x6af90]
mov dword [ebp + 8], eax
inc dword [esi + 0x6af84]
cmp dword [ebp + 8], 0
je 0x1005b1fa
mov eax, dword [esi + 0x6af74]
test eax, eax
jl 0x1005b1d7
lea ecx, [eax + esi + 0x1af70]
jmp 0x1005b1d9
xor ecx, ecx
mov edx, dword [esi + 0x6af84]
push 0
sub edx, eax
push edx
push ecx
push esi
call fcn.1005a152
mov eax, dword [esi + 0x6af84]
add esp, 0x10
mov dword [esi + 0x6af74], eax
cmp dword [esi + 0x6af90], 0x106
jae 0x1005b20d
push esi
call fcn.1005ae99
pop ecx
mov eax, dword [esi + 0x6af90]
test eax, eax
jne 0x1005b00a
pop edi
mov eax, dword [esi + 0x6af74]
test eax, eax
jl 0x1005b22f
lea ecx, [eax + esi + 0x1af70]
jmp 0x1005b231
xor ecx, ecx
mov edx, dword [esi + 0x6af84]
push 1
sub edx, eax
push edx
push ecx
push esi
call fcn.1005a152
add esp, 0x10
pop esi
pop ebx
leave
ret