Function at 0x514178
Capabilities:
Encrypt data using rc4 prga

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x4c
cmp dword [ebp + 0xc], 0
push ebx
push esi
push edi
push 0xb
pop edi
cmovne edi, dword [ebp + 0xc]
cmp edi, 5
jb 0x514375
cmp edi, 0xc
jbe 0x5141a2
push 0xffffffffffffffd4
pop eax
jmp 0x514378
mov esi, dword [ebp + 0x14]
xor edx, edx
mov dword [ebp + 0xc], edx
mov dword [ebp + 0xc], edx
lea eax, [esi - 1]
bsr ecx, eax
mov eax, dword [ebp + 0x18]
bsr eax, eax
inc ecx
add eax, 2
cmp ecx, eax
cmovb eax, ecx
cmp edi, eax
jb 0x514375
push 0x3e
pop ebx
push edx
push esi
push 0x40000000
sub ebx, edi
mov dword [ebp - 0x4c], edx
push edx
mov dword [ebp - 0x48], 0x7386b
mov dword [ebp - 0x44], 0x7b20d
mov dword [ebp - 0x40], 0x7f29c
mov dword [ebp - 0x3c], 0x86470
mov dword [ebp - 0x38], 0xaae60
mov dword [ebp - 0x34], 0xb71b0
mov dword [ebp - 0x30], 0xcaa30
mov dword [ebp - 0x10], ebx
call fcn.0050b07c
xor ecx, ecx
mov dword [ebp - 0x20], eax
lea eax, [ebx - 0x14]
mov dword [ebp - 0x1c], edx
bts ecx, eax
xor edx, edx
cmp eax, 0x20
cmovae edx, ecx
xor ecx, edx
cmp eax, 0x40
mov dword [ebp - 0x28], ecx
mov eax, esi
cmovae edx, ecx
and dword [ebp - 8], 0
and dword [ebp - 4], 0
xor ebx, ebx
mov ecx, edi
mov dword [ebp - 0x24], edx
mov edx, dword [ebp + 0x14]
inc ebx
shr eax, cl
shl ebx, cl
xor esi, esi
mov ecx, dword [ebp + 0x10]
mov dword [ebp - 0x18], eax
mov eax, dword [ebp + 8]
mov dword [ebp - 0x14], esi
mov ecx, dword [ecx + esi*4]
cmp ecx, edx
je 0x514371
test ecx, ecx
je 0x514320
cmp ecx, dword [ebp - 0x18]
ja 0x51427c
dec ebx
or ecx, 0xffffffff
jmp 0x514320
mov eax, dword [ebp - 0x1c]
mul ecx
mov dword [ebp + 0xc], eax
mov eax, dword [ebp - 0x20]
mul ecx
mov ecx, dword [ebp + 0xc]
add ecx, edx
mov dword [ebp - 0xc], eax
mov dword [ebp + 0xc], ecx
mov edx, ecx
mov ecx, dword [ebp - 0x10]
call fcn.00518484
movzx edx, ax
mov dword [ebp - 0x2c], edx
cmp dx, 8
jge 0x5142ed
mov ecx, dword [ebp - 0x10]
movsx esi, dx
mov eax, esi
cdq
call fcn.005afcec
sub dword [ebp - 0xc], eax
mov eax, dword [ebp - 0x24]
sbb dword [ebp + 0xc], edx
mul dword [ebp + esi*4 - 0x4c]
mov ecx, eax
mov eax, dword [ebp - 0x28]
mul dword [ebp + esi*4 - 0x4c]
add ecx, edx
mov edx, eax
cmp dword [ebp + 0xc], ecx
jb 0x5142e3
ja 0x5142de
cmp dword [ebp - 0xc], edx
jbe 0x5142e3
xor eax, eax
inc eax
jmp 0x5142e5
xor eax, eax
mov edx, dword [ebp - 0x2c]
mov esi, dword [ebp - 0x14]
add edx, eax
movsx eax, dx
sub ebx, eax
movzx ecx, dx
cmp dx, word [ebp - 4]
movzx eax, dx
mov edx, dword [ebp + 0x14]
mov dword [ebp + 0xc], eax
mov eax, esi
cmovle eax, dword [ebp - 8]
mov dword [ebp - 8], eax
mov eax, dword [ebp - 4]
movzx eax, ax
cmovle ecx, eax
movzx eax, cx
mov ecx, dword [ebp + 0xc]
mov dword [ebp - 4], eax
mov eax, dword [ebp + 8]
mov word [eax + esi*2], cx
inc esi
mov ecx, dword [ebp + 0x10]
mov dword [ebp - 0x14], esi
cmp esi, dword [ebp + 0x18]
jbe 0x51425b
mov ecx, dword [ebp - 8]
movzx esi, word [eax + ecx*2]
mov eax, ebx
movsx ecx, si
neg eax
sar ecx, 1
cmp eax, ecx
mov eax, dword [ebp + 8]
jl 0x514363
push dword [ebp + 0x18]
push edx
push dword [ebp + 0x10]
push edi
push eax
call fcn.005083e4
add esp, 0x14
cmp eax, 0xffffff88
jbe 0x51436d
jmp 0x514378
mov edx, dword [ebp - 8]
lea ecx, [esi + ebx]
mov word [eax + edx*2], cx
mov eax, edi
jmp 0x514378
xor eax, eax
jmp 0x514378
or eax, 0xffffffff
pop edi
pop esi
pop ebx
leave
ret