Function at 0x4065a4
Capabilities:
Encrypt data using rc4 ksa

Disassembly:
push ebp
mov ebp, esp
add esp, 0xffffffb4
push ebx
push esi
push edi
mov dword [ebp - 8], ecx
mov dword [ebp - 4], edx
mov ebx, eax
cmp dword [ebp - 4], 0
je 0x4065de
mov edx, dword [ebp - 4]
cmp byte [edx], 0
jne 0x4065de
mov eax, dword [ebp - 4]
mov eax, dword [eax + 1]
cmp eax, 0x80
je 0x4065e8
cmp eax, 0xc0
je 0x4065e8
cmp eax, 0x100
je 0x4065e8
mov eax, 0xfffffffe
jmp 0x40687f
test ebx, ebx
je 0x406615
mov al, byte [ebx]
cmp al, 1
je 0x4065fa
cmp al, 2
je 0x4065fa
cmp al, 3
jne 0x406615
mov edx, dword [ebx + 0x11]
cmp edx, 0x80
je 0x40661f
cmp edx, 0xc0
je 0x40661f
cmp edx, 0x100
je 0x40661f
mov eax, 0xfffffffb
jmp 0x40687f
mov eax, dword [ebp + 0xc]
cdq
idiv dword [ebx + 0x11]
mov dword [ebp - 0x10], eax
mov al, byte [ebx]
dec al
je 0x40663c
dec al
je 0x406735
jmp 0x406872
mov eax, dword [ebp - 0x10]
dec eax
test eax, eax
jl 0x406879
inc eax
mov dword [ebp - 0x14], eax
mov dword [ebp - 0xc], 0
mov eax, dword [ebx + 0x11]
test eax, eax
jns 0x40665d
add eax, 0x1f
sar eax, 5
dec eax
test eax, eax
jl 0x4066af
inc eax
mov dword [ebp - 0x18], eax
xor edx, edx
lea eax, [ebp - 0x4c]
mov dword [ebp - 0x1c], eax
xor eax, eax
mov ecx, dword [ebp - 0x1c]
mov esi, ecx
mov ecx, dword [ebx + 0x11]
test ecx, ecx
jns 0x406682
add ecx, 7
sar ecx, 3
imul ecx, dword [ebp - 0xc]
mov edi, edx
shl edi, 2
add ecx, edi
add ecx, eax
mov edi, dword [ebp - 8]
mov cl, byte [edi + ecx]
and cl, 0xff
mov byte [esi], cl
inc eax
add esi, 8
cmp eax, 4
jne 0x406678
inc edx
inc dword [ebp - 0x1c]
dec dword [ebp - 0x18]
jne 0x406671
mov eax, dword [ebp - 4]
add eax, 0x4a
push eax
mov ecx, dword [ebx + 0x11]
mov eax, dword [ebp - 4]
mov edx, dword [eax + 1]
lea eax, [ebp - 0x4c]
call fcn.00405a18
mov eax, dword [ebx + 0x11]
test eax, eax
jns 0x4066d1
add eax, 0x1f
sar eax, 5
dec eax
test eax, eax
jl 0x406724
inc eax
mov dword [ebp - 0x18], eax
xor edx, edx
lea eax, [ebp - 0x4c]
mov dword [ebp - 0x20], eax
xor eax, eax
mov ecx, dword [ebp - 0x20]
mov esi, ecx
mov ecx, dword [ebx + 0x11]
test ecx, ecx
jns 0x4066f6
add ecx, 7
sar ecx, 3
imul ecx, dword [ebp - 0xc]
mov edi, edx
shl edi, 2
add ecx, edi
add ecx, eax
mov edi, dword [ebp + 8]
lea ecx, [edi + ecx]
push ecx
mov cl, byte [esi]
pop edi
mov byte [edi], cl
inc eax
add esi, 8
cmp eax, 4
jne 0x4066ec
inc edx
inc dword [ebp - 0x20]
dec dword [ebp - 0x18]
jne 0x4066e5
inc dword [ebp - 0xc]
dec dword [ebp - 0x14]
jne 0x406653
jmp 0x406879
mov eax, dword [ebx + 0x11]
test eax, eax
jns 0x40673f
add eax, 0x1f
sar eax, 5
dec eax
test eax, eax
jl 0x40677c
inc eax
mov dword [ebp - 0x14], eax
xor edx, edx
lea eax, [ebp - 0x4c]
mov dword [ebp - 0x24], eax
xor eax, eax
mov ecx, dword [ebp - 0x24]
mov esi, ecx
mov ecx, edx
shl ecx, 2
add ecx, eax
mov cl, byte [ebx + ecx + 1]
and cl, 0xff
mov byte [esi], cl
inc eax
add esi, 8
cmp eax, 4
jne 0x40675a
inc edx
inc dword [ebp - 0x24]
dec dword [ebp - 0x14]
jne 0x406753
mov eax, dword [ebp - 0x10]
dec eax
test eax, eax
jl 0x406879
inc eax
mov dword [ebp - 0x14], eax
mov dword [ebp - 0xc], 0
mov eax, dword [ebx + 0x11]
test eax, eax
jns 0x40679d
add eax, 0x1f
sar eax, 5
dec eax
test eax, eax
jl 0x4067ef
inc eax
mov dword [ebp - 0x18], eax
xor edx, edx
lea eax, [ebp - 0x4c]
mov dword [ebp - 0x28], eax
xor eax, eax
mov ecx, dword [ebp - 0x28]
mov esi, ecx
mov ecx, dword [ebx + 0x11]
test ecx, ecx
jns 0x4067c2
add ecx, 7
sar ecx, 3
imul ecx, dword [ebp - 0xc]
mov edi, edx
shl edi, 2
add ecx, edi
add ecx, eax
mov edi, dword [ebp - 8]
mov cl, byte [edi + ecx]
and cl, 0xff
xor byte [esi], cl
inc eax
add esi, 8
cmp eax, 4
jne 0x4067b8
inc edx
inc dword [ebp - 0x28]
dec dword [ebp - 0x18]
jne 0x4067b1
mov eax, dword [ebp - 4]
add eax, 0x4a
push eax
mov ecx, dword [ebx + 0x11]
mov eax, dword [ebp - 4]
mov edx, dword [eax + 1]
lea eax, [ebp - 0x4c]
call fcn.00405a18
mov eax, dword [ebx + 0x11]
test eax, eax
jns 0x406811
add eax, 0x1f
sar eax, 5
dec eax
test eax, eax
jl 0x406864
inc eax
mov dword [ebp - 0x18], eax
xor edx, edx
lea eax, [ebp - 0x4c]
mov dword [ebp - 0x2c], eax
xor eax, eax
mov ecx, dword [ebp - 0x2c]
mov esi, ecx
mov ecx, dword [ebx + 0x11]
test ecx, ecx
jns 0x406836
add ecx, 7
sar ecx, 3
imul ecx, dword [ebp - 0xc]
mov edi, edx
shl edi, 2
add ecx, edi
add ecx, eax
mov edi, dword [ebp + 8]
lea ecx, [edi + ecx]
push ecx
mov cl, byte [esi]
pop edi
mov byte [edi], cl
inc eax
add esi, 8
cmp eax, 4
jne 0x40682c
inc edx
inc dword [ebp - 0x2c]
dec dword [ebp - 0x18]
jne 0x406825
inc dword [ebp - 0xc]
dec dword [ebp - 0x14]
jne 0x406793
jmp 0x406879
mov eax, 0xfffffffb
jmp 0x40687f
mov eax, dword [ebx + 0x11]
imul dword [ebp - 0x10]
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret 8