Function at 0x406540
Capabilities:
Encrypt data using rc4 prga

Disassembly:
push ebp
push ebx
push edi
push esi
sub esp, 0x10
mov esi, ecx
test edx, edx
je 0x406555
push esi
call fcn.00406870
jmp 0x40655b
push esi
call fcn.00406d00
add esp, 4
lea edi, [esi + 0x9272]
cmp edi, dword [esi + 0x28]
jae 0x4067ed
mov ebx, 1
jmp 0x40658f
mov ebx, dword [esp + 8]
shr ebx, 1
cmp edi, dword [esi + 0x28]
jae 0x4067f3
cmp ebx, 1
jne 0x40659e
movzx ebx, byte [edi]
inc edi
or ebx, 0x100
test bl, 1
jne 0x406610
movzx edx, byte [edi]
movzx ebp, word [esi + edx*2 + 0x8852]
mov eax, dword [esi + 0x44]
mov ecx, eax
shl ebp, cl
inc edi
movzx ecx, byte [esi + edx + 0x8f12]
mov edx, ebp
or edx, dword [esi + 0x48]
mov dword [esi + 0x48], edx
add ecx, eax
mov dword [esi + 0x44], ecx
cmp ecx, 8
jae 0x4065f1
jmp 0x406584
shr edx, 8
mov dword [esi + 0x48], edx
add ecx, 0xfffffff8
mov dword [esi + 0x44], ecx
cmp ecx, 7
jbe 0x406584
mov eax, dword [esi + 0x30]
cmp eax, dword [esi + 0x34]
jae 0x4065e0
lea ecx, [eax + 1]
mov dword [esi + 0x30], ecx
mov byte [eax], dl
mov ecx, dword [esi + 0x44]
mov edx, dword [esi + 0x48]
jmp 0x4065e0
mov dword [esp + 8], ebx
movzx ebx, byte [edi]
movzx eax, byte [edi + 1]
mov dword [esp], eax
movzx eax, word [ebx + ebx + 0x442bea]
movzx edx, word [esi + eax*2 + 0x8852]
mov ecx, dword [esi + 0x44]
shl edx, cl
movzx eax, byte [esi + eax + 0x8f12]
or edx, dword [esi + 0x48]
add eax, ecx
movzx ebp, byte [edi + 2]
mov dword [esi + 0x48], edx
mov dword [esi + 0x44], eax
cmp eax, 8
jae 0x4066d5
mov dword [esp + 4], ebp
movzx ebp, byte [ebx + 0x442e44]
mov ecx, ebx
not ecx
or ecx, dword [ebp*4 + 0x442e00]
add ebx, ecx
inc ebx
mov ecx, eax
shl ebx, cl
or ebx, edx
mov dword [esi + 0x48], ebx
add eax, ebp
mov dword [esi + 0x44], eax
cmp eax, 8
jb 0x4066f0
mov ebp, dword [esp + 4]
jmp 0x4066a1
shr ebx, 8
mov dword [esi + 0x48], ebx
add eax, 0xfffffff8
mov dword [esi + 0x44], eax
cmp eax, 7
jbe 0x4066f4
mov ecx, dword [esi + 0x30]
cmp ecx, dword [esi + 0x34]
jae 0x406690
lea eax, [ecx + 1]
mov dword [esi + 0x30], eax
mov byte [ecx], bl
mov eax, dword [esi + 0x44]
mov ebx, dword [esi + 0x48]
jmp 0x406690
shr edx, 8
mov dword [esi + 0x48], edx
add eax, 0xfffffff8
mov dword [esi + 0x44], eax
cmp eax, 7
jbe 0x406653
mov ecx, dword [esi + 0x30]
cmp ecx, dword [esi + 0x34]
jae 0x4066c0
lea eax, [ecx + 1]
mov dword [esi + 0x30], eax
mov byte [ecx], dl
mov eax, dword [esi + 0x44]
mov edx, dword [esi + 0x48]
jmp 0x4066c0
mov ebp, dword [esp + 4]
mov edx, ebp
shl edx, 8
add edx, dword [esp]
cmp edx, 0x200
mov dword [esp + 0xc], edi
mov dword [esp], edx
jb 0x406720
lea ecx, [ebp + 0x442b6a]
lea ebp, [ebp + 0x443144]
jmp 0x40672c
lea ecx, [edx + 0x44296a]
lea ebp, [edx + 0x442f44]
movzx edi, byte [ecx]
movzx edx, word [esi + edi*2 + 0x8a92]
mov ecx, eax
shl edx, cl
or edx, ebx
movzx ecx, byte [esi + edi + 0x9032]
add ecx, eax
movzx eax, byte [ebp]
mov dword [esi + 0x48], edx
mov dword [esi + 0x44], ecx
cmp ecx, 8
jb 0x406790
mov edi, dword [esp + 0xc]
jmp 0x406771
shr edx, 8
mov dword [esi + 0x48], edx
add ecx, 0xfffffff8
mov dword [esi + 0x44], ecx
cmp ecx, 7
jbe 0x406794
mov ebx, dword [esi + 0x30]
cmp ebx, dword [esi + 0x34]
jae 0x406760
lea ecx, [ebx + 1]
mov dword [esi + 0x30], ecx
mov byte [ebx], dl
mov ecx, dword [esi + 0x44]
mov edx, dword [esi + 0x48]
jmp 0x406760
mov edi, dword [esp + 0xc]
add edi, 3
mov ebx, dword [esp]
and ebx, dword [eax*4 + 0x442e00]
shl ebx, cl
or ebx, edx
mov edx, ebx
mov dword [esi + 0x48], ebx
add ecx, eax
mov dword [esi + 0x44], ecx
cmp ecx, 8
jb 0x406580
mov ebx, dword [esp + 8]
jmp 0x4067d5
shr edx, 8
mov dword [esi + 0x48], edx
add ecx, 0xfffffff8
mov dword [esi + 0x44], ecx
cmp ecx, 7
jbe 0x406584
mov eax, dword [esi + 0x30]
cmp eax, dword [esi + 0x34]
jae 0x4067c0
lea ecx, [eax + 1]
mov dword [esi + 0x30], ecx
mov byte [eax], dl
mov ecx, dword [esi + 0x44]
mov edx, dword [esi + 0x48]
jmp 0x4067c0
mov ecx, dword [esi + 0x44]
mov edx, dword [esi + 0x48]
movzx eax, word [esi + 0x8a52]
mov edi, edx
movzx edx, byte [esi + 0x9012]
shl eax, cl
or eax, edi
mov dword [esi + 0x48], eax
add edx, ecx
mov dword [esi + 0x44], edx
cmp edx, 8
jae 0x40684a
mov ecx, dword [esi + 0x30]
xor eax, eax
cmp ecx, dword [esi + 0x34]
setb al
add esp, 0x10
pop esi
pop edi
pop ebx
pop ebp
ret
shr eax, 8
mov dword [esi + 0x48], eax
mov ecx, edx
xor ecx, 8
and edx, 0xfffffff7
add edx, edx
sub edx, ecx
mov dword [esi + 0x44], edx
cmp edx, 7
jbe 0x406814
mov ecx, dword [esi + 0x30]
cmp ecx, dword [esi + 0x34]
jae 0x406830
lea edx, [ecx + 1]
mov dword [esi + 0x30], edx
mov byte [ecx], al
mov edx, dword [esi + 0x44]
mov eax, dword [esi + 0x48]
jmp 0x406830