Function at 0x40af84
Capabilities:
Encode data using xor

Disassembly:
push ebp
mov ebp, esp
add esp, 0xfffffff0
push ebx
push esi
push edi
mov dword [ebp - 4], ecx
mov ebx, edx
mov edi, eax
mov esi, dword [ebp + 8]
xor eax, eax
mov dword [edi + 4], eax
mov dword [edi], eax
cmp dword [ebp - 4], 0x8000
jge 0x40afac
mov ecx, dword [ebp - 4]
jmp 0x40afb1
mov ecx, 0x8000
mov eax, dword [edi + 8]
mov edx, ebx
call fcn.0040eaac
mov byte [ebp - 5], 0
mov eax, 1
cmp eax, dword [ebp - 4]
jge 0x40afd5
mov dl, byte [ebx + eax]
xor byte [ebp - 5], dl
inc eax
cmp eax, dword [ebp - 4]
jl 0x40afc9
mov edx, 8
mov eax, edi
call fcn.0040e070
xor ecx, ecx
mov dword [esi + 0x10], ecx
mov al, byte [ebx]
cmp al, byte [ebp - 5]
jne 0x40b1c2
mov ecx, dword [ebp - 4]
mov edx, ebx
mov eax, edi
call fcn.0040b4a4
mov ebx, eax
test ebx, ebx
je 0x40b03b
mov edx, 1
mov eax, esi
call fcn.0040b228
mov eax, dword [esi + 0x10]
inc dword [esi + 0x10]
mov edx, eax
shl edx, 3
lea edx, [edx + edx*4]
add edx, dword [esi]
mov eax, edx
mov dword [eax], 0x28
mov dword [eax + 0xc], ebx
lea ecx, [eax + 0xc]
mov dword [eax + 0x14], ecx
lea edx, [eax + 0x1c]
mov dword [eax + 0x24], edx
xor eax, eax
mov dword [ebp - 4], eax
mov eax, edi
call fcn.0040e084
mov ebx, eax
mov edx, 1
mov eax, edi
call fcn.0040e070
test bh, 0x80
je 0x40b1b7
mov eax, edi
call fcn.0040b384
inc eax
mov dword [ebp - 0xc], eax
xor ebx, ebx
jmp 0x40b092
lea eax, [esi + 0x20]
mov edx, 1
call fcn.00406bd0
mov eax, edi
call fcn.0040e084
shr eax, 8
mov edx, dword [esi + 0x20]
mov byte [edx + ebx], al
mov edx, 8
mov eax, edi
call fcn.0040e070
inc ebx
mov ecx, dword [edi]
cmp ecx, dword [ebp - 4]
jge 0x40b1b7
cmp ebx, dword [ebp - 0xc]
jl 0x40b068
jmp 0x40b1b7
mov edx, 1
mov eax, esi
call fcn.0040b228
mov ebx, dword [esi + 0x10]
mov eax, edi
shl ebx, 3
lea ebx, [ebx + ebx*4]
add ebx, dword [esi]
call fcn.0040e084
test ah, 0x80
jne 0x40b0dd
shr eax, 0xc
mov dword [ebx], eax
mov edx, 4
mov eax, edi
call fcn.0040e070
jmp 0x40b0f1
shr eax, 0xa
sub eax, 0x18
mov dword [ebx], eax
mov edx, 6
mov eax, edi
call fcn.0040e070
mov edx, dword [ebx]
test byte [edx + 0x413670], 4
je 0x40b11d
mov eax, edi
call fcn.0040e084
shr eax, 0xf
setne dl
and edx, 1
mov byte [ebx + 4], dl
mov edx, 1
mov eax, edi
call fcn.0040e070
jmp 0x40b121
mov byte [ebx + 4], 0
mov ecx, 3
mov dword [ebx + 0x18], ecx
mov dword [ebx + 8], ecx
mov eax, dword [ebx]
xor edx, edx
mov dl, byte [eax + 0x413670]
and edx, 3
mov dword [ebp - 0x10], edx
xor eax, eax
mov dword [ebx + 0x24], eax
mov dword [ebx + 0x14], eax
cmp dword [ebp - 0x10], 0
jle 0x40b1b4
lea edx, [ebx + 8]
mov cl, byte [ebx + 4]
mov eax, edi
call fcn.0040b280
cmp dword [ebp - 0x10], 2
jne 0x40b16c
lea edx, [ebx + 0x18]
mov cl, byte [ebx + 4]
mov eax, edi
call fcn.0040b280
jmp 0x40b1b4
cmp dword [ebx + 8], 1
jne 0x40b1b4
mov edx, dword [ebx]
test byte [edx + 0x413670], 0x18
je 0x40b1b4
mov eax, dword [ebx + 0xc]
cmp eax, 0x100
jl 0x40b18e
sub eax, 0x100
jmp 0x40b1b1
cmp eax, 0x88
jl 0x40b19c
sub eax, 0x108
jmp 0x40b1ae
cmp eax, 0x10
jl 0x40b1a6
sub eax, 8
jmp 0x40b1ae
cmp eax, 8
jl 0x40b1ae
sub eax, 0x10
add eax, dword [esi + 0x10]
mov dword [ebx + 0xc], eax
inc dword [esi + 0x10]
mov edx, dword [edi]
cmp edx, dword [ebp - 4]
jl 0x40b0a7
mov edx, 1
mov eax, esi
call fcn.0040b228
mov eax, dword [esi + 0x10]
inc dword [esi + 0x10]
mov edx, eax
shl edx, 3
lea edx, [edx + edx*4]
add edx, dword [esi]
mov eax, edx
mov dword [eax], 0x16
lea ecx, [eax + 0xc]
mov dword [eax + 0x14], ecx
lea edx, [eax + 0x1c]
mov dword [eax + 0x24], edx
xor edx, edx
jmp 0x40b219
mov eax, edx
shl eax, 3
lea eax, [eax + eax*4]
add eax, dword [esi]
cmp dword [eax + 0x14], 0
jne 0x40b20c
lea ecx, [eax + 0xc]
mov dword [eax + 0x14], ecx
cmp dword [eax + 0x24], 0
jne 0x40b218
lea ecx, [eax + 0x1c]
mov dword [eax + 0x24], ecx
inc edx
cmp edx, dword [esi + 0x10]
jl 0x40b1f6
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret 4