Function at 0x406510
Capabilities:
Encrypt data using rc4 prga

Disassembly:
push ebp
push ebx
push edi
push esi
sub esp, 0xc
mov esi, ecx
test edx, edx
je 0x406525
push esi
call fcn.00406840
jmp 0x40652b
push esi
call fcn.00406cd0
add esp, 4
lea ebp, [esi + 0x9272]
cmp ebp, dword [esi + 0x28]
jae 0x4067c9
mov ebx, 1
jmp 0x406562
mov ebp, dword [esp]
mov ebx, dword [esp + 8]
shr ebx, 1
cmp ebp, dword [esi + 0x28]
jae 0x4067cf
cmp ebx, 1
jne 0x406572
movzx ebx, byte [ebp]
inc ebp
or ebx, 0x100
test bl, 1
jne 0x4065e0
movzx edi, byte [ebp]
movzx edx, word [esi + edi*2 + 0x8852]
mov eax, dword [esi + 0x44]
mov ecx, eax
shl edx, cl
inc ebp
movzx ecx, byte [esi + edi + 0x8f12]
or edx, dword [esi + 0x48]
mov dword [esi + 0x48], edx
add ecx, eax
mov dword [esi + 0x44], ecx
cmp ecx, 8
jae 0x4065c1
jmp 0x406557
shr edx, 8
mov dword [esi + 0x48], edx
add ecx, 0xfffffff8
mov dword [esi + 0x44], ecx
cmp ecx, 7
jbe 0x406557
mov eax, dword [esi + 0x30]
cmp eax, dword [esi + 0x34]
jae 0x4065b0
lea ecx, [eax + 1]
mov dword [esi + 0x30], ecx
mov byte [eax], dl
mov ecx, dword [esi + 0x44]
mov edx, dword [esi + 0x48]
jmp 0x4065b0
mov dword [esp + 8], ebx
movzx edx, byte [ebp]
movzx edi, word [edx + edx + 0x442bea]
movzx ebx, word [esi + edi*2 + 0x8852]
mov eax, dword [esi + 0x44]
mov ecx, eax
shl ebx, cl
movzx ecx, byte [esi + edi + 0x8f12]
add ecx, eax
movzx eax, byte [ebp + 1]
mov dword [esp + 4], eax
or ebx, dword [esi + 0x48]
movzx edi, byte [ebp + 2]
mov dword [esi + 0x48], ebx
mov dword [esi + 0x44], ecx
cmp ecx, 8
jae 0x4066ae
mov dword [esp], edi
movzx eax, byte [edx + 0x442e44]
and edx, dword [eax*4 + 0x442e00]
shl edx, cl
or edx, ebx
mov dword [esi + 0x48], edx
mov edi, ecx
and edi, eax
xor ecx, eax
lea eax, [ecx + edi*2]
mov dword [esi + 0x44], eax
cmp eax, 8
jb 0x4066d0
mov edi, dword [esp]
jmp 0x406671
shr edx, 8
mov dword [esi + 0x48], edx
add eax, 0xfffffff8
mov dword [esi + 0x44], eax
cmp eax, 7
jbe 0x4066d3
mov ecx, dword [esi + 0x30]
cmp ecx, dword [esi + 0x34]
jae 0x406660
lea eax, [ecx + 1]
mov dword [esi + 0x30], eax
mov byte [ecx], dl
mov eax, dword [esi + 0x44]
mov edx, dword [esi + 0x48]
jmp 0x406660
shr ebx, 8
mov dword [esi + 0x48], ebx
mov eax, ecx
not eax
and eax, 8
and ecx, 0xfffffff7
sub ecx, eax
mov dword [esi + 0x44], ecx
cmp ecx, 7
jbe 0x406627
mov eax, dword [esi + 0x30]
cmp eax, dword [esi + 0x34]
jae 0x406690
lea ecx, [eax + 1]
mov dword [esi + 0x30], ecx
mov byte [eax], bl
mov ecx, dword [esi + 0x44]
mov ebx, dword [esi + 0x48]
jmp 0x406690
mov edi, dword [esp]
mov dword [esp], ebp
mov ebp, edi
shl ebp, 8
add ebp, dword [esp + 4]
cmp ebp, 0x200
jb 0x406700
lea ecx, [edi + 0x442b6a]
lea edi, [edi + 0x443144]
jmp 0x40670c
lea ecx, [ebp + 0x44296a]
lea edi, [ebp + 0x442f44]
mov dword [esp + 4], edi
movzx edi, byte [ecx]
movzx ebx, word [esi + edi*2 + 0x8a92]
mov ecx, eax
shl ebx, cl
or ebx, edx
movzx ecx, byte [esi + edi + 0x9032]
add ecx, eax
mov eax, dword [esp + 4]
movzx eax, byte [eax]
mov dword [esi + 0x48], ebx
mov dword [esi + 0x44], ecx
cmp ecx, 8
jae 0x4067b1
add dword [esp], 3
mov edx, ebp
not edx
or edx, dword [eax*4 + 0x442e00]
add edx, ebp
inc edx
shl edx, cl
or edx, ebx
mov dword [esi + 0x48], edx
add ecx, eax
mov dword [esi + 0x44], ecx
cmp ecx, 8
jb 0x406550
mov ebp, dword [esp]
mov ebx, dword [esp + 8]
jmp 0x406785
shr edx, 8
mov dword [esi + 0x48], edx
add ecx, 0xfffffff8
mov dword [esi + 0x44], ecx
cmp ecx, 7
jbe 0x406557
mov eax, dword [esi + 0x30]
cmp eax, dword [esi + 0x34]
jae 0x406770
lea ecx, [eax + 1]
mov dword [esi + 0x30], ecx
mov byte [eax], dl
mov ecx, dword [esi + 0x44]
mov edx, dword [esi + 0x48]
jmp 0x406770
shr ebx, 8
mov dword [esi + 0x48], ebx
add ecx, 0xfffffff8
mov dword [esi + 0x44], ecx
cmp ecx, 7
jbe 0x40673d
mov edx, dword [esi + 0x30]
cmp edx, dword [esi + 0x34]
jae 0x4067a0
lea ecx, [edx + 1]
mov dword [esi + 0x30], ecx
mov byte [edx], bl
mov ecx, dword [esi + 0x44]
mov ebx, dword [esi + 0x48]
jmp 0x4067a0
mov ecx, dword [esi + 0x44]
mov edx, dword [esi + 0x48]
movzx eax, word [esi + 0x8a52]
movzx edi, byte [esi + 0x9012]
shl eax, cl
or eax, edx
mov dword [esi + 0x48], eax
add edi, ecx
mov dword [esi + 0x44], edi
cmp edi, 8
jae 0x406821
mov ecx, dword [esi + 0x30]
xor eax, eax
cmp ecx, dword [esi + 0x34]
setb al
add esp, 0xc
pop esi
pop edi
pop ebx
pop ebp
ret
shr eax, 8
mov dword [esi + 0x48], eax
add edi, 0xfffffff8
mov dword [esi + 0x44], edi
cmp edi, 7
jbe 0x4067ee
mov ecx, dword [esi + 0x30]
cmp ecx, dword [esi + 0x34]
jae 0x406810
lea edx, [ecx + 1]
mov dword [esi + 0x30], edx
mov byte [ecx], al
mov edi, dword [esi + 0x44]
mov eax, dword [esi + 0x48]
jmp 0x406810