Function at 0x1005122c
Capabilities:
Encrypt data using rc4 prga

Disassembly:
sub esp, 0x48
cmp dword [esp + 0x50], 0
push ebx
push ebp
push esi
push edi
push 0xb
pop edi
cmovne edi, dword [esp + 0x60]
cmp edi, 5
jb 0x1005144f
cmp edi, 0xc
jbe 0x10051256
push 0xffffffffffffffd4
pop eax
jmp 0x10051452
mov ebp, dword [esp + 0x68]
xor esi, esi
mov dword [esp + 0x60], esi
mov dword [esp + 0x60], esi
lea eax, [ebp - 1]
bsr ecx, eax
mov eax, dword [esp + 0x6c]
bsr eax, eax
inc ecx
add eax, 2
cmp ecx, eax
cmovb eax, ecx
cmp edi, eax
jb 0x1005144f
push 0x3e
pop ebx
push esi
push ebp
push 0x40000000
sub ebx, edi
mov dword [esp + 0x44], esi
push esi
mov dword [esp + 0x4c], 0x7386b
mov dword [esp + 0x50], 0x7b20d
mov dword [esp + 0x54], 0x7f29c
mov dword [esp + 0x58], 0x86470
mov dword [esp + 0x5c], 0xaae60
mov dword [esp + 0x60], 0xb71b0
mov dword [esp + 0x64], 0xcaa30
mov dword [esp + 0x28], ebx
call fcn.1007ada4
mov dword [esp + 0x28], eax
xor ecx, ecx
mov dword [esp + 0x24], edx
lea eax, [esi - 0x14]
add eax, ebx
mov dword [esp + 0x60], esi
bts ecx, eax
mov dword [esp + 0x20], esi
xor edx, edx
cmp eax, 0x20
cmovae edx, ecx
xor ecx, edx
cmp eax, 0x40
mov eax, esi
mov dword [esp + 0x30], ecx
cmovae edx, ecx
mov dword [esp + 0x1c], eax
xor ebx, ebx
mov dword [esp + 0x2c], edx
mov edx, dword [esp + 0x5c]
mov ecx, edi
inc ebx
mov eax, ebp
shl ebx, cl
shr eax, cl
mov ecx, dword [esp + 0x64]
mov dword [esp + 0x34], eax
mov ecx, dword [ecx + esi*4]
cmp ecx, ebp
je 0x1005144b
test ecx, ecx
jne 0x10051339
xor eax, eax
jmp 0x100513f2
cmp ecx, eax
ja 0x10051346
dec ebx
or eax, 0xffffffff
jmp 0x100513f2
mov eax, dword [esp + 0x24]
mul ecx
mov ebp, eax
mov eax, dword [esp + 0x28]
mul ecx
mov ecx, dword [esp + 0x18]
add ebp, edx
mov dword [esp + 0x14], eax
mov edx, ebp
mov dword [esp + 0x10], ebp
call fcn.100927e0
movzx ebp, ax
cmp bp, 8
jge 0x100513b8
mov ecx, dword [esp + 0x18]
movsx esi, bp
mov eax, esi
cdq
call fcn.1008bcac
sub dword [esp + 0x14], eax
mov eax, dword [esp + 0x2c]
sbb dword [esp + 0x10], edx
mul dword [esp + esi*4 + 0x38]
mov ecx, eax
mov eax, dword [esp + 0x30]
mul dword [esp + esi*4 + 0x38]
add ecx, edx
cmp dword [esp + 0x10], ecx
jb 0x100513b0
ja 0x100513ab
cmp dword [esp + 0x14], eax
jbe 0x100513b0
xor eax, eax
inc eax
jmp 0x100513b2
xor eax, eax
mov esi, dword [esp + 0x20]
add ebp, eax
mov edx, dword [esp + 0x1c]
movsx eax, bp
sub ebx, eax
movzx ecx, bp
movzx eax, bp
cmp bp, dx
mov ebp, dword [esp + 0x68]
mov dword [esp + 0x20], eax
mov eax, esi
cmovle eax, dword [esp + 0x60]
mov dword [esp + 0x60], eax
movzx eax, dx
mov edx, dword [esp + 0x5c]
cmovle ecx, eax
movzx eax, cx
mov dword [esp + 0x1c], eax
mov eax, dword [esp + 0x20]
mov ecx, dword [esp + 0x64]
mov word [edx + esi*2], ax
inc esi
mov eax, dword [esp + 0x34]
mov dword [esp + 0x20], esi
cmp esi, dword [esp + 0x6c]
jbe 0x10051323
mov ecx, dword [esp + 0x60]
mov eax, ebx
neg eax
movzx esi, word [edx + ecx*2]
movsx ecx, si
sar ecx, 1
cmp eax, ecx
jl 0x1005143c
push dword [esp + 0x6c]
push ebp
push dword [esp + 0x6c]
push edi
push edx
call fcn.10081b10
add esp, 0x14
cmp eax, 0xffffff88
jbe 0x10051447
jmp 0x10051452
mov eax, dword [esp + 0x60]
lea ecx, [esi + ebx]
mov word [edx + eax*2], cx
mov eax, edi
jmp 0x10051452
xor eax, eax
jmp 0x10051452
or eax, 0xffffffff
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x48
ret