Function at 0x402fa0
Capabilities:
Encode data using xor

Disassembly:
sub esp, 4
push ebx
push esi
push edi
xor ebx, ebx
mov word [0x40f5a0], bx
push ebp
xor esi, esi
xor ebp, ebp
mov si, word [0x40f544]
cmp dword [0x40f59c], ebx
je 0x403270
mov ecx, dword [0x40f5f8]
xor eax, eax
shl esi, 5
mov edx, dword [0x40f680]
mov al, byte [edx + ecx + 2]
mov edx, dword [0x40f670]
xor eax, esi
xor ecx, ecx
and eax, 0x7fff
mov cx, word [edx + eax*2]
mov esi, eax
mov edx, dword [0x40f5f8]
mov eax, dword [0x40f54c]
and edx, 0x7fff
mov word [eax + edx*2], cx
mov edx, dword [0x40f670]
mov edi, dword [0x40f5f8]
mov word [edx + esi*2], di
xor edi, edi
mov di, word [0x40f5a0]
test ecx, ecx
mov word [0x40f5e8], bp
mov ebp, 2
je 0x403084
xor edx, edx
movsx eax, word [0x40f66c]
mov dx, word [0x40f5e8]
cmp eax, edx
jle 0x403084
mov eax, dword [0x40f5f8]
sub eax, ecx
cmp eax, 0x7efa
ja 0x403084
push ecx
call fcn.00402e00
add esp, 4
mov ebp, eax
mov eax, dword [0x40f59c]
cmp ebp, eax
jbe 0x403067
mov ebp, eax
cmp ebp, 3
jne 0x403084
mov eax, dword [0x40f5f8]
xor ecx, ecx
mov cx, word [0x40f5a0]
sub eax, ecx
cmp eax, 0x1000
jle 0x403084
dec ebp
cmp word [0x40f5e8], 3
jb 0x4031ac
xor eax, eax
mov ax, word [0x40f5e8]
cmp eax, ebp
jb 0x4031ac
lea eax, [esp + 0x10]
push eax
mov ax, word [0x40f5e8]
sub ax, 3
push eax
mov eax, dword [0x40f5f8]
sub ax, di
dec ax
push eax
call fcn.00404a30
add esp, 0xc
cmp eax, 1
sbb eax, eax
neg eax
test eax, eax
jne 0x4032ac
mov eax, 1
xor ecx, ecx
mov cx, word [0x40f5e8]
sub word [0x40f5e8], 2
sub eax, ecx
add dword [0x40f59c], eax
xor edx, edx
inc dword [0x40f5f8]
mov eax, dword [0x40f5f8]
shl esi, 5
mov ecx, dword [0x40f680]
mov dl, byte [ecx + eax + 2]
mov eax, dword [0x40f670]
xor edx, esi
and edx, 0x7fff
mov cx, word [eax + edx*2]
mov esi, edx
mov edx, dword [0x40f5f8]
mov eax, dword [0x40f54c]
and edx, 0x7fff
mov word [eax + edx*2], cx
mov edx, dword [0x40f5f8]
mov ecx, dword [0x40f670]
mov word [ecx + esi*2], dx
dec word [0x40f5e8]
jne 0x4030f2
xor ebx, ebx
mov ebp, 2
inc dword [0x40f5f8]
cmp dword [esp + 0x10], ebx
je 0x403249
mov eax, 0
cmp dword [0x40f598], ebx
jl 0x40317c
mov eax, dword [0x40f680]
add eax, dword [0x40f598]
push 0
mov ecx, dword [0x40f5f8]
sub ecx, dword [0x40f598]
push ecx
push eax
call fcn.004058f0
add esp, 0xc
test ax, ax
jne 0x4032ed
mov eax, dword [0x40f5f8]
mov dword [0x40f598], eax
jmp 0x403249
test ebx, ebx
je 0x403238
lea eax, [esp + 0x10]
mov ecx, dword [0x40f680]
push eax
mov edx, dword [0x40f5f8]
movzx ax, byte [ecx + edx - 1]
push eax
push 0
call fcn.00404a30
add esp, 0xc
cmp eax, 1
sbb eax, eax
neg eax
test eax, eax
jne 0x4032b8
cmp dword [esp + 0x10], 0
je 0x403230
cmp dword [0x40f598], 0
mov eax, 0
jl 0x403205
mov eax, dword [0x40f680]
add eax, dword [0x40f598]
push 0
mov ecx, dword [0x40f5f8]
sub ecx, dword [0x40f598]
push ecx
push eax
call fcn.004058f0
add esp, 0xc
test ax, ax
jne 0x4032ed
mov eax, dword [0x40f5f8]
mov dword [0x40f598], eax
inc dword [0x40f5f8]
jmp 0x403243
mov ebx, 1
add dword [0x40f5f8], ebx
dec dword [0x40f59c]
cmp dword [0x40f59c], 0x106
jge 0x403263
cmp dword [0x40f5b8], 0
jne 0x403263
call fcn.00402a60
cmp dword [0x40f59c], 0
jne 0x402fc7
test ebx, ebx
je 0x403296
lea eax, [esp + 0x10]
mov edx, dword [0x40f680]
push eax
mov ecx, dword [0x40f5f8]
movzx ax, byte [edx + ecx - 1]
push eax
push 0
call fcn.00404a30
add esp, 0xc
cmp dword [0x40f598], 0
jl 0x4032c4
mov eax, dword [0x40f680]
add eax, dword [0x40f598]
jmp 0x4032c6
mov ax, 0xfff5
pop ebp
pop edi
pop esi
pop ebx
add esp, 4
ret
mov ax, 0xfff5
pop ebp
pop edi
pop esi
pop ebx
add esp, 4
ret
xor eax, eax
push 1
mov ecx, dword [0x40f5f8]
sub ecx, dword [0x40f598]
push ecx
push eax
call fcn.004058f0
add esp, 0xc
test ax, ax
jne 0x4032ed
xor ax, ax
mov word [0x40f544], si
pop ebp
pop edi
pop esi
pop ebx
add esp, 4
ret