Function at 0x4066d0
Capabilities:
Encode data using xor

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x18
push ebx
mov ebx, dword [ebp + 0x10]
push esi
mov esi, dword [ebp + 8]
test ebx, ebx
je 0x4068fa
mov ecx, dword [esi + 0x80c]
push edi
nop dword [eax]
cmp ebx, ecx
mov edi, ecx
mov eax, esi
cmovbe edi, ebx
sub eax, ecx
push edi
add eax, 0x800
push eax
push dword [ebp + 0xc]
call fcn.0040aac0
mov ecx, dword [esi + 0x80c]
sub ebx, edi
add dword [ebp + 0xc], edi
sub ecx, edi
add esp, 0xc
mov dword [esi + 0x80c], ecx
mov dword [ebp + 0x10], ebx
test ecx, ecx
jne 0x4068f1
mov eax, dword [esi + 0x808]
lea edi, [esi + 0x402]
mov edx, dword [esi + 0x804]
inc eax
mov ebx, dword [esi + 0x800]
add edx, eax
mov dword [ebp - 0x18], eax
lea eax, [esi + 8]
mov dword [ebp - 0xc], ebx
mov dword [ebp - 8], 0xffffff81
mov dword [ebp - 4], eax
mov dword [ebp - 0x10], edi
mov dword [ebp - 0x14], 0x40
mov ecx, dword [eax - 8]
mov eax, dword [ebp - 8]
dec eax
rol ebx, 0xd
xor ebx, dword [ebp - 0xc]
movzx eax, al
add ebx, dword [esi + eax*4]
mov eax, ecx
shr eax, 2
xor edx, ebx
movzx eax, al
add edx, dword [esi + eax*4]
mov eax, dword [ebp - 4]
mov dword [eax - 8], edx
shr edx, 0xa
movzx eax, dl
lea edx, [ecx + ebx]
xor edx, dword [esi + eax*4]
mov eax, edx
mov byte [edi - 2], dl
shr eax, 8
mov byte [edi - 1], al
mov eax, edx
shr eax, 0x10
mov byte [edi], al
mov eax, edx
shr eax, 0x18
mov byte [edi + 1], al
mov edi, ebx
mov eax, dword [ebp - 4]
ror edi, 6
xor edi, ebx
mov ebx, dword [ebp - 4]
mov ecx, dword [eax - 4]
mov eax, dword [ebp - 8]
movzx eax, al
add edi, dword [esi + eax*4]
mov eax, ecx
shr eax, 2
xor edx, edi
movzx eax, al
add edx, dword [esi + eax*4]
mov dword [ebx - 4], edx
shr edx, 0xa
movzx eax, dl
lea edx, [ecx + edi]
mov ecx, dword [ebp - 0x10]
xor edx, dword [esi + eax*4]
mov eax, edx
mov byte [ecx + 2], dl
shr eax, 8
mov byte [ecx + 3], al
mov eax, edx
shr eax, 0x10
mov byte [ecx + 4], al
mov eax, edx
shr eax, 0x18
mov byte [ecx + 5], al
mov ecx, dword [ebx]
mov ebx, edi
mov eax, dword [ebp - 8]
inc eax
rol ebx, 2
movzx eax, al
xor ebx, edi
mov edi, dword [ebp - 0x10]
add ebx, dword [esi + eax*4]
mov eax, ecx
shr eax, 2
xor edx, ebx
movzx eax, al
add edx, dword [esi + eax*4]
mov eax, dword [ebp - 4]
mov dword [eax], edx
shr edx, 0xa
movzx eax, dl
lea edx, [ecx + ebx]
xor edx, dword [esi + eax*4]
mov eax, edx
mov byte [edi + 6], dl
shr eax, 8
mov byte [edi + 7], al
mov eax, edx
shr eax, 0x10
mov byte [edi + 8], al
mov eax, edx
shr eax, 0x18
mov byte [edi + 9], al
mov eax, dword [ebp - 4]
mov ecx, dword [eax + 4]
mov eax, ebx
ror eax, 0x10
xor eax, ebx
mov dword [ebp - 0xc], eax
mov eax, dword [ebp - 8]
mov ebx, dword [ebp - 0xc]
add eax, 2
movzx eax, al
add dword [ebp - 8], 4
add ebx, dword [esi + eax*4]
mov eax, ecx
shr eax, 2
xor edx, ebx
movzx eax, al
mov dword [ebp - 0xc], ebx
add edx, dword [esi + eax*4]
mov eax, dword [ebp - 4]
mov dword [eax + 4], edx
shr edx, 0xa
movzx eax, dl
lea edx, [ecx + ebx]
xor edx, dword [esi + eax*4]
mov eax, edx
mov byte [edi + 0xa], dl
shr eax, 8
mov byte [edi + 0xb], al
mov eax, edx
shr eax, 0x10
mov byte [edi + 0xc], al
mov eax, edx
shr eax, 0x18
mov byte [edi + 0xd], al
add edi, 0x10
mov eax, dword [ebp - 4]
add eax, 0x10
mov dword [ebp - 0x10], edi
sub dword [ebp - 0x14], 1
mov dword [ebp - 4], eax
jne 0x406763
mov eax, dword [ebp - 0x18]
mov ecx, 0x400
mov dword [esi + 0x800], ebx
mov ebx, dword [ebp + 0x10]
mov dword [esi + 0x804], edx
mov dword [esi + 0x808], eax
mov dword [esi + 0x80c], 0x400
test ebx, ebx
jne 0x4066f0
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret