Function at 0x406bc0
Capabilities:
Encode data using xor
Encrypt data using rc4 prga

Disassembly:
mov eax, dword [esp + 4]
sub esp, 0xc
test eax, eax
push ebx
push ebp
push esi
je 0x406dff
mov eax, dword [esp + 0x24]
test eax, eax
je 0x406dff
mov ebx, dword [esp + 0x28]
mov eax, dword [esp + 0x20]
and ebx, 0xff
and eax, 0xff
lea esi, [eax + ebx]
cmp esi, 2
jl 0x406dff
cmp esi, 0xff
jg 0x406dff
push esi
call fcn.0040747f
mov ebp, eax
add esp, 4
test ebp, ebp
mov dword [esp + 0x10], ebp
je 0x406dff
xor eax, eax
test esi, esi
jbe 0x406c2e
mov byte [eax + ebp], al
inc eax
cmp eax, esi
jb 0x406c26
mov al, byte [esp + 0x28]
push edi
test al, al
mov esi, 0xd
mov dword [esp + 0x10], 0x15
je 0x406ca3
mov edi, dword [esp + 0x30]
mov dword [esp + 0x2c], ebx
and edi, 0xffff
mov ecx, dword [esp + 0x24]
lea eax, [edi + esi]
and ecx, 0xff
xor edx, edx
div ecx
mov eax, edx
xor edx, edx
add eax, edi
div ecx
mov eax, ecx
cmp eax, edx
jbe 0x406c7d
mov cl, byte [eax + ebp - 1]
mov byte [eax + ebp], cl
dec eax
cmp eax, edx
ja 0x406c71
mov ecx, dword [esp + 0x10]
mov al, byte [esp + 0x24]
add ecx, esi
mov byte [edx + ebp], al
mov dword [esp + 0x10], ecx
sub ecx, esi
inc al
mov esi, ecx
mov byte [esp + 0x24], al
mov eax, dword [esp + 0x2c]
dec eax
mov dword [esp + 0x2c], eax
jne 0x406c52
mov cl, byte [esp + 0x24]
xor dl, dl
sub cl, bl
and ebx, 0xff
mov byte [esp + 0x24], cl
xor esi, esi
mov edi, dword [esp + 0x24]
and edi, 0xff
add ebx, edi
mov dword [esp + 0x18], edi
cmp edi, ebx
mov dword [esp + 0x2c], ebx
jae 0x406d36
xor eax, eax
test ebx, ebx
jbe 0x406d27
xor ecx, ecx
mov cl, byte [eax + ebp]
cmp edi, ecx
je 0x406ce5
inc eax
cmp eax, ebx
jb 0x406cd5
jmp 0x406d27
mov bl, al
mov cl, 7
and bl, 7
sub cl, bl
mov ebx, dword [esp + 0x20]
shr eax, 3
mov al, byte [eax + ebx]
shr al, cl
mov ecx, 7
sub ecx, esi
and al, 1
shl al, cl
mov ecx, esi
and ecx, 7
or dl, al
cmp cl, 7
jne 0x406d22
mov eax, dword [esp + 0x28]
mov byte [eax], dl
inc eax
xor dl, dl
mov dword [esp + 0x28], eax
xor esi, esi
jmp 0x406d23
inc esi
mov ebx, dword [esp + 0x2c]
inc edi
cmp edi, ebx
jb 0x406ccf
test esi, esi
je 0x406d36
mov eax, dword [esp + 0x28]
mov byte [eax], dl
xor cl, cl
xor eax, eax
xor edx, edx
mov byte [esp + 0x28], cl
test ebx, ebx
mov dword [esp + 0x10], eax
jbe 0x406db8
mov esi, dword [esp + 0x14]
mov bl, byte [esp + 0x24]
cmp byte [edx + esi], bl
jae 0x406da3
mov esi, dword [esp + 0x20]
mov bl, dl
mov edi, edx
and bl, 7
mov cl, 7
and eax, 7
shr edi, 3
sub cl, bl
mov bl, byte [edi + esi]
shr bl, cl
mov ecx, 7
sub ecx, eax
and bl, 1
shl bl, cl
mov cl, byte [esp + 0x28]
or cl, bl
cmp eax, 7
mov eax, dword [esp + 0x10]
mov byte [esp + 0x28], cl
jne 0x406d9c
mov edi, eax
shr edi, 3
mov byte [edi + esi], cl
xor cl, cl
mov byte [esp + 0x28], cl
inc eax
mov dword [esp + 0x10], eax
jmp 0x406da7
mov esi, dword [esp + 0x20]
mov edi, dword [esp + 0x2c]
inc edx
cmp edx, edi
jb 0x406d48
mov ebp, dword [esp + 0x14]
mov ebx, edi
jmp 0x406dbc
mov esi, dword [esp + 0x20]
test al, 7
pop edi
je 0x406dc7
shr eax, 3
mov byte [eax + esi], cl
mov ecx, dword [esp + 0x14]
lea eax, [ecx - 1]
mov ecx, 0
cdq
and edx, 7
add eax, edx
sar eax, 3
inc eax
je 0x406ded
mov dl, byte [esp + 0x2c]
xor byte [ecx + esi], dl
add ecx, 2
cmp ecx, eax
jb 0x406ddf
push ebp
call fcn.004072d0
add esp, 4
mov eax, ebx
pop esi
pop ebp
pop ebx
add esp, 0xc
ret
pop esi
pop ebp
or eax, 0xffffffff
pop ebx
add esp, 0xc
ret