Function at 0x401690
Capabilities:
Encode data using xor

Disassembly:
push ecx
mov eax, dword [0x413388]
push ebp
cmp eax, 3
mov dword [esp + 4], 0
mov ebp, 2
jg 0x4016b1
call fcn.004019a0
pop ebp
pop ecx
ret
mov eax, dword [0x41338c]
test eax, eax
je 0x40195b
mov edx, dword [0x413380]
mov ecx, dword [0x4831c4]
push ebx
push esi
push edi
xor eax, eax
and edx, 0x3ff
mov al, byte [ecx + 0x463042]
mov esi, ecx
and eax, 0x7fff
mov edi, dword [0x4831d4]
shl edx, 5
xor edx, eax
xor eax, eax
and esi, 0x7fff
mov dword [0x413380], edx
mov ax, word [edx*2 + 0x453020]
mov word [esi*2 + 0x443020], ax
mov esi, ebp
test eax, eax
mov word [edx*2 + 0x453020], cx
mov dword [0x4831c0], esi
mov ebp, 2
je 0x401780
cmp esi, dword [0x41337c]
jae 0x401780
mov ebx, ecx
sub ebx, eax
cmp ebx, 0x7efa
ja 0x401780
push eax
call fcn.00401440
mov ebp, eax
mov eax, dword [0x41338c]
add esp, 4
cmp ebp, eax
jbe 0x40174e
mov ebp, eax
cmp ebp, 3
jne 0x401840
mov ecx, dword [0x4831c4]
mov esi, dword [0x4831d4]
mov edx, ecx
sub edx, esi
cmp edx, 0x1000
jbe 0x401774
mov ebp, 2
mov edx, dword [0x413380]
mov esi, dword [0x4831c0]
cmp esi, 3
jb 0x401878
cmp ebp, esi
ja 0x401878
sub ecx, edi
add esi, 0xfffffffd
dec ecx
push esi
push ecx
call fcn.0040a140
mov esi, dword [0x4831c0]
mov ecx, dword [0x41338c]
mov edi, eax
mov edx, dword [0x413380]
mov eax, 1
add esp, 8
sub eax, esi
add ecx, eax
sub esi, 2
mov dword [0x41338c], ecx
mov ecx, dword [0x4831c4]
inc ecx
xor eax, eax
and edx, 0x3ff
mov al, byte [ecx + 0x463042]
and eax, 0x7fff
shl edx, 5
xor edx, eax
mov eax, ecx
and eax, 0x7fff
dec esi
mov bx, word [edx*2 + 0x453020]
mov word [eax*2 + 0x443020], bx
mov word [edx*2 + 0x453020], cx
jne 0x4017cd
mov dword [0x4831c0], esi
xor esi, esi
inc ecx
mov dword [0x413380], edx
test edi, edi
mov dword [esp + 0x10], esi
mov ebp, 2
mov dword [0x4831c4], ecx
je 0x401908
mov edx, dword [0x4831d8]
test edx, edx
jl 0x401851
lea eax, [edx + 0x463040]
jmp 0x401853
mov edx, dword [0x413380]
mov ecx, dword [0x4831c4]
jmp 0x40177a
xor eax, eax
sub ecx, edx
push 0
push ecx
push eax
call fcn.00409830
mov ecx, dword [0x4831c4]
mov edx, dword [0x413380]
add esp, 0xc
mov dword [0x4831d8], ecx
jmp 0x401908
mov esi, dword [esp + 0x10]
test esi, esi
je 0x4018ed
xor edx, edx
mov dl, byte [ecx + 0x46303f]
push edx
push 0
call fcn.0040a140
add esp, 8
test eax, eax
je 0x4018cd
mov ecx, dword [0x4831d8]
test ecx, ecx
jl 0x4018a9
lea eax, [ecx + 0x463040]
jmp 0x4018ab
xor eax, eax
mov edx, dword [0x4831c4]
push 0
sub edx, ecx
push edx
push eax
call fcn.00409830
mov ecx, dword [0x4831c4]
add esp, 0xc
mov dword [0x4831d8], ecx
jmp 0x4018d3
mov ecx, dword [0x4831c4]
mov eax, dword [0x41338c]
mov edx, dword [0x413380]
inc ecx
dec eax
mov dword [0x4831c4], ecx
mov dword [0x41338c], eax
jmp 0x401908
mov eax, dword [0x41338c]
inc ecx
mov esi, 1
dec eax
mov dword [esp + 0x10], esi
mov dword [0x4831c4], ecx
mov dword [0x41338c], eax
mov eax, dword [0x41338c]
cmp eax, 0x106
jae 0x40193b
mov edi, dword [0x413384]
test edi, edi
jne 0x40193b
call fcn.00401590
mov eax, dword [0x41338c]
mov edx, dword [0x413380]
mov ecx, dword [0x4831c4]
cmp eax, 0x106
jb 0x401914
test eax, eax
jne 0x4016cd
pop edi
test esi, esi
pop esi
pop ebx
je 0x401961
mov al, byte [ecx + 0x46303f]
push eax
push 0
call fcn.0040a140
add esp, 8
mov ecx, dword [0x4831c4]
mov edx, dword [0x4831d8]
test edx, edx
jl 0x401982
sub ecx, edx
lea eax, [edx + 0x463040]
push 1
push ecx
push eax
call fcn.00409830
add esp, 0xc
pop ebp
pop ecx
ret
sub ecx, edx
xor eax, eax
push 1
push ecx
push eax
call fcn.00409830
add esp, 0xc
pop ebp
pop ecx
ret