Function at 0x402810
Capabilities:
Encrypt data using rc4 prga

Disassembly:
sub esp, 8
cmp dword [esp + 0x10], 0
mov eax, dword [esp + 0x14]
mov cl, byte [eax]
mov dl, byte [eax + 1]
mov dword [esp + 4], 0
jle 0x402a5d
push ebx
push ebp
push esi
push edi
movzx ebp, cl
movzx ebx, dl
lea esp, [esp]
lea eax, [ebp + 1]
cdq
mov ecx, 0x21e
idiv ecx
mov esi, dword [0x489d14]
mov edi, 0x21e
movzx ebp, dl
movzx eax, byte [esi + ebp]
lea ecx, [esi + ebp]
add eax, ebx
mov byte [esp + 0x12], dl
cdq
idiv edi
movzx ebx, dl
lea eax, [ebx + esi]
mov byte [esp + 0x13], dl
call fcn.00401190
mov ecx, dword [0x489d14]
movzx edx, byte [ecx + ebp]
movzx eax, byte [ebx + ecx]
add eax, edx
cdq
mov ecx, edi
idiv ecx
push 0x46eb71
push 0x48c788
mov byte [esp + 0x19], dl
call fcn.004024b0
add esp, 8
mov esi, eax
push 0xa
mov ecx, esi
call fcn.004026c0
mov edx, dword [esi]
mov eax, dword [edx + 4]
add eax, esi
xor edi, edi
test byte [eax + 8], 6
jne 0x4028d3
mov eax, dword [eax + 0x28]
mov edx, dword [eax]
mov ecx, eax
mov eax, dword [edx + 0x30]
call eax
cmp eax, 0xffffffff
jne 0x4028d3
mov edi, 4
mov ecx, dword [esi]
mov ecx, dword [ecx + 4]
add ecx, esi
test edi, edi
je 0x4028f4
mov eax, dword [ecx + 8]
or eax, edi
cmp dword [ecx + 0x28], 0
jne 0x4028ec
or eax, 4
push 0
push eax
call fcn.004020e0
push 0x46eb71
push 0x48c788
call fcn.004024b0
add esp, 8
mov esi, eax
push 0xa
mov ecx, esi
call fcn.004026c0
mov edx, dword [esi]
mov eax, dword [edx + 4]
add eax, esi
xor edi, edi
test byte [eax + 8], 6
jne 0x402936
mov eax, dword [eax + 0x28]
mov edx, dword [eax]
mov ecx, eax
mov eax, dword [edx + 0x30]
call eax
cmp eax, 0xffffffff
jne 0x402936
mov edi, 4
mov ecx, dword [esi]
mov ecx, dword [ecx + 4]
add ecx, esi
test edi, edi
je 0x402957
mov eax, dword [ecx + 8]
or eax, edi
cmp dword [ecx + 0x28], 0
jne 0x40294f
or eax, 4
push 0
push eax
call fcn.004020e0
push 0x46eb71
push 0x48c788
call fcn.004024b0
add esp, 8
mov esi, eax
push 0xa
mov ecx, esi
call fcn.004026c0
mov edx, dword [esi]
mov eax, dword [edx + 4]
add eax, esi
xor edi, edi
test byte [eax + 8], 6
jne 0x402999
mov eax, dword [eax + 0x28]
mov edx, dword [eax]
mov ecx, eax
mov eax, dword [edx + 0x30]
call eax
cmp eax, 0xffffffff
jne 0x402999
mov edi, 4
mov ecx, dword [esi]
mov ecx, dword [ecx + 4]
add ecx, esi
test edi, edi
je 0x4029ba
mov eax, dword [ecx + 8]
or eax, edi
cmp dword [ecx + 0x28], 0
jne 0x4029b2
or eax, 4
push 0
push eax
call fcn.004020e0
push 0x46eb71
push 0x48c788
call fcn.004024b0
add esp, 8
mov esi, eax
push 0xa
mov ecx, esi
call fcn.004026c0
mov edx, dword [esi]
mov eax, dword [edx + 4]
add eax, esi
xor edi, edi
test byte [eax + 8], 6
jne 0x4029fc
mov eax, dword [eax + 0x28]
mov edx, dword [eax]
mov ecx, eax
mov eax, dword [edx + 0x30]
call eax
cmp eax, 0xffffffff
jne 0x4029fc
mov edi, 4
mov ecx, dword [esi]
mov ecx, dword [ecx + 4]
add ecx, esi
test edi, edi
je 0x402a1d
mov eax, dword [ecx + 8]
or eax, edi
cmp dword [ecx + 0x28], 0
jne 0x402a15
or eax, 4
push 0
push eax
call fcn.004020e0
movzx edx, byte [esp + 0x11]
mov eax, dword [0x489d14]
mov cl, byte [edx + eax]
mov eax, dword [esp + 0x14]
mov esi, dword [esp + 0x1c]
xor byte [eax + esi], cl
inc eax
cmp eax, dword [esp + 0x20]
mov dword [esp + 0x14], eax
jl 0x402840
mov eax, dword [esp + 0x24]
mov dl, byte [esp + 0x12]
mov cl, byte [esp + 0x13]
pop edi
pop esi
pop ebp
mov byte [eax], dl
mov byte [eax + 1], cl
pop ebx
add esp, 8
ret
mov byte [eax], cl
mov byte [eax + 1], dl
add esp, 8
ret