Function at 0x408a78
Capabilities:
Encode data using xor

Disassembly:
mov edi, dword [ebp + 0xc]
mov eax, dword [esi + 0x74]
cmp eax, 0x106
jae 0x40885d
mov ecx, esi
call fcn.004084b0
mov eax, dword [esi + 0x74]
cmp eax, 0x106
jae 0x408855
test edi, edi
je 0x408bac
test eax, eax
je 0x408b03
cmp eax, 3
jb 0x4088ac
mov edi, dword [esi + 0x6c]
mov edx, dword [esi + 0x48]
mov ecx, dword [esi + 0x58]
mov eax, dword [esi + 0x38]
shl edx, cl
movzx eax, byte [eax + edi + 2]
and edi, dword [esi + 0x34]
mov ecx, dword [esi + 0x40]
xor edx, eax
and edx, dword [esi + 0x54]
mov eax, dword [esi + 0x44]
mov dword [esi + 0x48], edx
movzx eax, word [eax + edx*2]
mov word [ecx + edi*2], ax
mov ecx, dword [esi + 0x6c]
and ecx, dword [esi + 0x34]
mov eax, dword [esi + 0x40]
mov edx, dword [esi + 0x48]
movzx ebx, word [eax + ecx*2]
movzx eax, word [esi + 0x6c]
mov ecx, dword [esi + 0x44]
mov dword [ebp - 4], ebx
mov word [ecx + edx*2], ax
test ebx, ebx
je 0x4088f2
mov ecx, dword [esi + 0x6c]
mov eax, dword [esi + 0x2c]
sub ecx, ebx
sub eax, 0x106
cmp ecx, eax
ja 0x4088f2
mov eax, dword [esi + 0x88]
cmp eax, 2
je 0x4088dc
cmp eax, 3
je 0x4088e1
mov edx, ebx
mov ecx, esi
call fcn.00408280
jmp 0x4088ef
cmp eax, 3
jne 0x4088f2
cmp ecx, 1
jne 0x4088f2
mov edx, ebx
mov ecx, esi
call fcn.00408400
mov dword [esi + 0x60], eax
cmp dword [esi + 0x60], 3
jb 0x408a23
mov ax, word [esi + 0x6c]
sub ax, word [esi + 0x70]
mov ecx, dword [esi + 0x16a0]
mov dl, byte [esi + 0x60]
movzx edi, ax
mov eax, dword [esi + 0x16a4]
sub dl, 3
mov word [eax + ecx*2], di
mov eax, dword [esi + 0x16a0]
mov ecx, dword [esi + 0x1698]
add edi, 0xffff
mov byte [ecx + eax], dl
inc dword [esi + 0x16a0]
movzx eax, dl
movzx eax, byte [eax + 0x4a9218]
inc word [esi + eax*4 + 0x498]
mov eax, 0x100
cmp di, ax
movzx eax, di
jae 0x408960
movzx eax, byte [eax + 0x4a9018]
jmp 0x40896a
shr eax, 7
movzx eax, byte [eax + 0x4a9118]
inc word [esi + eax*4 + 0x988]
mov eax, dword [esi + 0x169c]
dec eax
xor ecx, ecx
cmp dword [esi + 0x16a0], eax
mov eax, dword [esi + 0x60]
sete cl
sub dword [esi + 0x74], eax
mov dword [ebp + 8], ecx
cmp eax, dword [esi + 0x80]
ja 0x4089f7
cmp dword [esi + 0x74], 3
jb 0x4089f7
dec eax
mov dword [esi + 0x60], eax
nop
inc dword [esi + 0x6c]
mov edi, dword [esi + 0x6c]
mov eax, dword [esi + 0x38]
mov ecx, dword [esi + 0x58]
movzx edx, byte [edi + eax + 2]
mov eax, dword [esi + 0x48]
and edi, dword [esi + 0x34]
shl eax, cl
mov ecx, dword [esi + 0x40]
xor edx, eax
and edx, dword [esi + 0x54]
mov eax, dword [esi + 0x44]
mov dword [esi + 0x48], edx
movzx eax, word [eax + edx*2]
mov word [ecx + edi*2], ax
mov ecx, dword [esi + 0x6c]
and ecx, dword [esi + 0x34]
mov eax, dword [esi + 0x40]
mov edx, dword [esi + 0x48]
movzx ebx, word [eax + ecx*2]
movzx eax, word [esi + 0x6c]
mov ecx, dword [esi + 0x44]
mov dword [ebp - 4], ebx
mov word [ecx + edx*2], ax
dec dword [esi + 0x60]
jne 0x4089a0
mov ecx, dword [ebp + 8]
jmp 0x408a73
add dword [esi + 0x6c], eax
mov eax, dword [esi + 0x38]
add eax, dword [esi + 0x6c]
mov ecx, dword [esi + 0x58]
mov dword [esi + 0x60], 0
movzx edx, byte [eax]
mov dword [esi + 0x48], edx
movzx eax, byte [eax + 1]
shl edx, cl
mov ecx, dword [ebp + 8]
xor edx, eax
and edx, dword [esi + 0x54]
mov dword [esi + 0x48], edx
jmp 0x408a76
mov ecx, dword [esi + 0x6c]
mov eax, dword [esi + 0x38]
xor edi, edi
mov dl, byte [ecx + eax]
mov ecx, dword [esi + 0x16a0]
mov eax, dword [esi + 0x16a4]
mov word [eax + ecx*2], di
mov eax, dword [esi + 0x16a0]
mov ecx, dword [esi + 0x1698]
mov byte [ecx + eax], dl
inc dword [esi + 0x16a0]
movzx eax, dl
xor ecx, ecx
inc word [esi + eax*4 + 0x94]
mov eax, dword [esi + 0x169c]
dec eax
cmp dword [esi + 0x16a0], eax
sete cl
dec dword [esi + 0x74]
inc dword [esi + 0x6c]
mov edi, dword [ebp + 0xc]
test ecx, ecx
or al, 0x85
leave
je 0x408832
mov ecx, dword [esi + 0x5c]
test ecx, ecx
js 0x408a8f
mov edx, dword [esi + 0x38]
add edx, ecx
jmp 0x408a91
xor edx, edx
mov eax, dword [esi + 0x6c]
sub eax, ecx
push 0
push eax
mov ecx, esi
call fcn.0040aee0
mov edi, dword [esi]
mov eax, dword [esi + 0x6c]
mov dword [esi + 0x5c], eax
mov ecx, dword [edi + 0x1c]
add esp, 8
mov ebx, dword [ecx + 0x14]
cmp ebx, dword [edi + 0x10]
cmova ebx, dword [edi + 0x10]
test ebx, ebx
je 0x408aef
push ebx
push dword [ecx + 0x10]
push dword [edi + 0xc]
call fcn.00453e40
mov eax, dword [edi + 0x1c]
add dword [edi + 0xc], ebx
add dword [eax + 0x10], ebx
mov eax, dword [edi + 0x1c]
add dword [edi + 0x14], ebx
sub dword [edi + 0x10], ebx
sub dword [eax + 0x14], ebx
mov ecx, dword [edi + 0x1c]
add esp, 0xc
cmp dword [ecx + 0x14], 0
jne 0x408aef
mov eax, dword [ecx + 8]
mov dword [ecx + 0x10], eax
mov eax, dword [esi]
cmp dword [eax + 0x10], 0
je 0x408bac
mov ebx, dword [ebp - 4]
invalid
sub al, 0xfd