Function at 0x40f960
Capabilities:
Encrypt data using rc4 prga

Disassembly:
push ebp
mov ebp, esp
push ebx
push edi
push esi
push eax
mov esi, dword [ebp + 8]
mov ebx, dword [ebp + 0x10]
mov eax, dword [esi]
mov ecx, dword [eax + 4]
mov edi, dword [esi + ecx + 0x20]
mov eax, dword [esi + ecx + 0x24]
cmp edi, 1
sbb eax, 0
jl 0x40f98b
cmp edi, ebx
cmovbe edi, ebx
sub edi, ebx
jmp 0x40f98d
xor edi, edi
mov eax, dword [esi + ecx + 0x38]
test eax, eax
je 0x40f9a1
mov edx, dword [eax]
mov ecx, eax
call dword [edx + 4]
mov eax, dword [esi]
mov ecx, dword [eax + 4]
mov eax, dword [esi + ecx + 0xc]
mov edx, 4
test eax, eax
jne 0x40fae9
mov eax, dword [esi + ecx + 0x3c]
test eax, eax
je 0x40f9db
cmp eax, esi
je 0x40f9db
mov ecx, eax
call fcn.004076ce
mov eax, dword [esi]
mov edx, 4
mov ecx, dword [eax + 4]
mov eax, dword [esi + ecx + 0xc]
test eax, eax
jne 0x40fae9
mov eax, 0x1c0
and eax, dword [esi + ecx + 0x14]
cmp eax, 0x40
je 0x40fa3d
test edi, edi
je 0x40fa3b
nop dword [eax]
mov eax, dword [esi + ecx + 0x38]
movzx ecx, byte [esi + ecx + 0x40]
mov edx, dword [eax + 0x20]
cmp dword [edx], 0
je 0x40fa20
mov edx, dword [eax + 0x30]
mov ebx, dword [edx]
test ebx, ebx
jle 0x40fa20
dec ebx
mov dword [edx], ebx
mov eax, dword [eax + 0x20]
mov edx, dword [eax]
lea ebx, [edx + 1]
mov dword [eax], ebx
mov byte [edx], cl
jmp 0x40fa30
mov ebx, dword [eax]
movzx edx, cl
mov ecx, eax
push edx
call dword [ebx + 0xc]
cmp eax, 0xffffffff
je 0x40fa5f
mov eax, dword [esi]
dec edi
mov ecx, dword [eax + 4]
jne 0x40f9f0
mov ebx, dword [ebp + 0x10]
xor edi, edi
mov ecx, dword [esi + ecx + 0x38]
mov eax, dword [ecx]
push 0
push ebx
push dword [ebp + 0xc]
call dword [eax + 0x24]
xor eax, ebx
or eax, edx
mov edx, 4
jne 0x40facb
xor edx, edx
test edi, edi
jne 0x40fa64
jmp 0x40facb
mov edx, 4
mov dword [ebp - 0x10], edx
nop word [eax + eax]
mov eax, dword [esi]
mov eax, dword [eax + 4]
mov ecx, dword [esi + eax + 0x38]
movzx eax, byte [esi + eax + 0x40]
mov edx, dword [ecx + 0x20]
cmp dword [edx], 0
je 0x40fab0
mov edx, dword [ecx + 0x30]
mov ebx, dword [edx]
test ebx, ebx
jle 0x40fab0
dec ebx
mov dword [edx], ebx
mov ecx, dword [ecx + 0x20]
mov edx, dword [ecx]
lea ebx, [edx + 1]
mov dword [ecx], ebx
mov byte [edx], al
dec edi
jne 0x40fa70
jmp 0x40fac1
mov edx, dword [ecx]
movzx eax, al
push eax
call dword [edx + 0xc]
cmp eax, 0xffffffff
je 0x40fac6
dec edi
jne 0x40fa70
mov edx, dword [ebp - 0x10]
jmp 0x40facb
mov edx, 4
mov eax, dword [esi]
mov eax, dword [eax + 4]
mov dword [esi + eax + 0x24], 0
mov dword [esi + eax + 0x20], 0
mov eax, dword [esi]
mov ecx, dword [eax + 4]
mov eax, dword [esi + ecx + 0xc]
or eax, edx
add ecx, esi
push 0
push eax
call fcn.0040fb50
mov eax, dword [esi]
mov eax, dword [eax + 4]
cmp dword [esi + eax + 0xc], 0
jne 0x40fb2d
test byte [esi + eax + 0x14], 2
je 0x40fb2d
mov ecx, dword [esi + eax + 0x38]
mov eax, dword [ecx]
call dword [eax + 0x34]
cmp eax, 0xffffffff
jne 0x40fb2d
mov eax, dword [esi]
mov eax, dword [eax + 4]
lea ecx, [esi + eax]
mov eax, dword [esi + eax + 0xc]
or eax, 4
push 0
push eax
call fcn.0040fb50
mov eax, dword [esi]
mov eax, dword [eax + 4]
mov ecx, dword [esi + eax + 0x38]
test ecx, ecx
je 0x40fb3f
mov eax, dword [ecx]
call dword [eax + 8]
mov eax, esi
add esp, 4
pop esi
pop edi
pop ebx
pop ebp
ret