Function at 0x408222
Capabilities:
Encode data using xor

Disassembly:
push ebp
mov ebp, esp
push ebx
push esi
mov esi, dword [ebp + 0xc]
mov ebx, ecx
and dword [ebx + 4], 0
and dword [ebx], 0
mov eax, 0x8000
push edi
cmp esi, eax
jae 0x40823f
mov eax, esi
mov edi, dword [ebp + 8]
push eax
push edi
push dword [ebx + 8]
call fcn.00409284
xor ecx, ecx
xor al, al
inc ecx
mov byte [ebp + 0xb], al
cmp esi, ecx
jbe 0x408263
xor al, byte [ecx + edi]
inc ecx
cmp ecx, esi
jb 0x408258
mov byte [ebp + 0xb], al
push 8
mov ecx, ebx
call fcn.00405c4e
mov esi, dword [ebp + 0x10]
mov al, byte [ebp + 0xb]
and dword [esi + 0x10], 0
cmp al, byte [edi]
jne 0x40844b
push dword [ebp + 0xc]
mov ecx, ebx
push edi
call fcn.00407ac1
mov edi, eax
test edi, edi
je 0x4082c7
push 1
mov ecx, esi
call fcn.00407bab
mov eax, dword [esi + 0x10]
lea ecx, [eax + 1]
imul eax, eax, 0x28
add eax, dword [esi]
and dword [ebp + 0xc], 0
mov dword [esi + 0x10], ecx
lea ecx, [eax + 0xc]
mov dword [ecx], edi
mov dword [eax + 0x14], ecx
lea ecx, [eax + 0x1c]
push 3
mov dword [eax + 0x24], ecx
pop ecx
mov dword [eax], 0x28
mov dword [eax + 0x18], ecx
mov dword [eax + 8], ecx
mov ecx, ebx
call fcn.00405c65
push 1
mov ecx, ebx
mov edi, eax
call fcn.00405c4e
test edi, 0x8000
je 0x408440
push ebx
call fcn.004079f2
mov ecx, dword [ebx]
and dword [ebp + 8], 0
inc eax
mov dword [ebp + 0x10], eax
cmp ecx, dword [ebp + 0xc]
jae 0x40844b
jmp 0x408303
mov eax, dword [ebp + 0x10]
cmp dword [ebp + 8], eax
jae 0x408440
lea edi, [esi + 0x20]
push 1
mov ecx, edi
call fcn.0040c93b
mov edi, dword [edi]
add edi, dword [ebp + 8]
mov ecx, ebx
call fcn.00405c65
shr eax, 8
push 8
mov ecx, ebx
mov byte [edi], al
call fcn.00405c4e
mov eax, dword [ebp + 0xc]
inc dword [ebp + 8]
cmp dword [ebx], eax
jb 0x408300
jmp 0x408440
push 1
mov ecx, esi
call fcn.00407bab
mov edi, dword [esi + 0x10]
imul edi, edi, 0x28
add edi, dword [esi]
mov ecx, ebx
call fcn.00405c65
mov ecx, ebx
test eax, 0x8000
jne 0x408369
shr eax, 0xc
push 4
jmp 0x408371
shr eax, 0xa
sub eax, 0x18
push 6
mov dword [edi], eax
call fcn.00405c4e
mov eax, dword [edi]
test byte [eax + 0x413010], 4
je 0x4083a0
mov ecx, ebx
call fcn.00405c65
test eax, 0xffff8000
setne al
push 1
mov ecx, ebx
mov byte [edi + 4], al
call fcn.00405c4e
jmp 0x4083a4
mov byte [edi + 4], 0
lea eax, [edi + 0x18]
push 3
pop ecx
mov dword [ebp + 0x10], eax
mov dword [eax], ecx
mov eax, dword [edi]
lea edx, [edi + 8]
mov dword [edx], ecx
movzx eax, byte [eax + 0x413010]
and eax, ecx
mov dword [ebp + 8], eax
mov dword [edi + 0x24], 0
mov dword [edi + 0x14], 0
jle 0x40843d
movzx eax, byte [edi + 4]
push eax
push edx
mov ecx, ebx
call fcn.00407bf4
cmp dword [ebp + 8], 2
jne 0x4083f6
movzx eax, byte [edi + 4]
push eax
push dword [ebp + 0x10]
mov ecx, ebx
call fcn.00407bf4
jmp 0x40843d
cmp dword [edi + 8], 1
jne 0x40843d
mov eax, dword [edi]
test byte [eax + 0x413010], 0x18
je 0x40843d
mov eax, dword [edi + 0xc]
mov ecx, 0x100
cmp eax, ecx
jl 0x408417
sub eax, ecx
jmp 0x40843a
cmp eax, 0x88
jl 0x408425
sub eax, 0x108
jmp 0x408437
cmp eax, 0x10
jl 0x40842f
sub eax, 8
jmp 0x408437
cmp eax, 8
jl 0x408437
sub eax, 0x10
add eax, dword [esi + 0x10]
mov dword [edi + 0xc], eax
inc dword [esi + 0x10]
mov eax, dword [ebp + 0xc]
cmp dword [ebx], eax
jb 0x408341
push 1
mov ecx, esi
call fcn.00407bab
mov eax, dword [esi + 0x10]
lea ecx, [eax + 1]
imul eax, eax, 0x28
add eax, dword [esi]
mov dword [esi + 0x10], ecx
lea ecx, [eax + 0xc]
mov dword [eax + 0x14], ecx
lea ecx, [eax + 0x1c]
mov dword [eax + 0x24], ecx
push 3
pop ecx
mov dword [eax + 0x18], ecx
mov dword [eax + 8], ecx
xor edx, edx
mov dword [eax], 0x16
xor ecx, ecx
cmp dword [esi + 0x10], edx
jle 0x4084ab
xor edi, edi
mov eax, dword [esi]
add eax, edi
cmp dword [eax + 0x14], edx
jne 0x408497
lea ebx, [eax + 0xc]
mov dword [eax + 0x14], ebx
cmp dword [eax + 0x24], edx
jne 0x4084a2
lea ebx, [eax + 0x1c]
mov dword [eax + 0x24], ebx
inc ecx
add edi, 0x28
cmp ecx, dword [esi + 0x10]
jl 0x408488
pop edi
pop esi
pop ebx
pop ebp
ret 0xc