Function at 0x503180
Capabilities:
Encrypt data using rc4 prga

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x3c
push ebx
test edx, edx
mov dword [ebp - 0x18], ecx
mov ebx, 0xb
cmovne ebx, edx
mov dword [ebp - 0x24], ebx
push esi
push edi
cmp ebx, 5
jb 0x50337c
cmp ebx, 0xc
jbe 0x5031b3
mov eax, 0xffffffd4
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
mov eax, dword [ebp + 0x10]
mov esi, dword [ebp + 0xc]
bsr eax, eax
bsr ecx, esi
add eax, 2
inc ecx
cmp ecx, eax
cmovb eax, ecx
cmp ebx, eax
jb 0x50337c
xor eax, eax
mov edi, 0x3e
cmp dword [ebp + 0x14], eax
push 0
sete al
sub edi, ebx
push esi
push 0x40000000
push 0
lea eax, [eax*2 - 1]
mov dword [ebp - 0x1c], edi
movzx eax, ax
mov dword [ebp - 0x20], eax
call fcn.005462a0
xor ecx, ecx
mov dword [ebp - 0x28], edx
xor edx, edx
mov dword [ebp - 0x2c], eax
lea eax, [edi - 0x14]
mov dword [ebp - 0x14], 0
bts ecx, eax
mov dword [ebp - 4], 0
cmp eax, 0x20
mov edi, 1
cmovae edx, ecx
xor ecx, edx
cmp eax, 0x40
mov eax, dword [ebp - 0x18]
cmovae edx, ecx
mov dword [ebp - 0x34], ecx
mov ecx, ebx
mov dword [ebp - 0x30], edx
shl edi, cl
mov edx, esi
shr edx, cl
xor ebx, ebx
mov ecx, dword [ebp + 8]
mov dword [ebp - 0x10], edi
mov dword [ebp - 0x38], edx
nop dword [eax + eax]
mov ecx, dword [ecx + ebx*4]
cmp ecx, esi
je 0x503373
test ecx, ecx
jne 0x503266
xor edx, edx
jmp 0x503310
cmp ecx, edx
ja 0x503276
mov ecx, dword [ebp - 0x20]
dec edi
movzx edx, cx
jmp 0x50330d
mov eax, dword [ebp - 0x28]
mul ecx
mov esi, eax
mov eax, dword [ebp - 0x2c]
mul ecx
mov ecx, dword [ebp - 0x1c]
add esi, edx
mov dword [ebp - 0xc], eax
mov edx, esi
mov dword [ebp - 8], esi
call fcn.00519040
movzx esi, ax
cmp si, 8
jge 0x5032e0
mov ecx, dword [ebp - 0x1c]
movsx edi, si
mov eax, edi
cdq
call fcn.00519060
sub dword [ebp - 0xc], eax
mov ecx, dword [edi*4 + 0x5954a0]
sbb dword [ebp - 8], edx
mov eax, dword [ebp - 0x30]
mul ecx
mov edi, eax
mov eax, dword [ebp - 0x34]
mul ecx
add edi, edx
cmp dword [ebp - 8], edi
jb 0x5032d9
ja 0x5032d2
cmp dword [ebp - 0xc], eax
jbe 0x5032d9
mov eax, 1
jmp 0x5032db
xor eax, eax
mov edi, dword [ebp - 0x10]
add esi, eax
movsx eax, si
sub edi, eax
movzx ecx, si
cmp si, word [ebp - 4]
mov eax, ebx
movzx edx, si
cmovle eax, dword [ebp - 0x14]
mov esi, dword [ebp + 0xc]
mov dword [ebp - 0x14], eax
mov eax, dword [ebp - 4]
movzx eax, ax
cmovle ecx, eax
movzx eax, cx
mov dword [ebp - 4], eax
mov eax, dword [ebp - 0x18]
mov dword [ebp - 0x10], edi
mov ecx, dword [ebp + 8]
mov word [eax + ebx*2], dx
inc ebx
mov edx, dword [ebp - 0x38]
cmp ebx, dword [ebp + 0x10]
jbe 0x503250
mov ecx, dword [ebp - 0x14]
movzx ebx, word [eax + ecx*2]
lea edx, [eax + ecx*2]
movsx ecx, bx
mov eax, edi
sar ecx, 1
neg eax
cmp eax, ecx
jl 0x503361
push dword [ebp - 0x20]
mov ecx, dword [ebp - 0x18]
push dword [ebp + 0x10]
push esi
push dword [ebp + 8]
mov esi, dword [ebp - 0x24]
mov edx, esi
call fcn.00502f20
add esp, 0x10
cmp eax, 0xffffff88
jbe 0x50336a
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
mov esi, dword [ebp - 0x24]
lea ecx, [ebx + edi]
mov word [edx], cx
mov eax, esi
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
xor eax, eax
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
pop edi
pop esi
or eax, 0xffffffff
pop ebx
mov esp, ebp
pop ebp
ret