Function at 0x522d90
Capabilities:
Encrypt data using rc4 prga

Disassembly:
sub esp, 0x34
mov eax, dword [esp + 0x40]
mov ecx, dword [esp + 0x48]
mov edx, dword [esp + 0x44]
push ebx
push ebp
lea ecx, [ecx + eax*2]
mov dword [esp + 0x18], edx
add ecx, 2
lea ebx, [eax*2 + 2]
mov dword [esp + 0x14], ecx
lea ecx, [eax + 1]
mov dword [esp + 8], ecx
xor eax, eax
xor ecx, ecx
bts eax, edx
push esi
push edi
xor esi, esi
lea edi, [ecx + 1]
mov ecx, edx
shl edi, cl
mov dword [esp + 0x14], edi
lea ecx, [edi - 1]
mov dword [esp + 0x54], ecx
mov ebp, ecx
xor ecx, ecx
cmp edx, 0x20
cmovae ecx, eax
xor eax, ecx
cmp edx, 0x40
cmovae ecx, eax
add ebx, eax
adc esi, ecx
add ebx, 8
adc esi, 0
test esi, esi
ja 0x523092
jb 0x522e0a
cmp ebx, dword [esp + 0x5c]
ja 0x523092
cmp dword [esp + 0x50], 0xff
ja 0x523092
mov eax, dword [esp + 0x20]
cmp eax, 0xc
jbe 0x522e28
push 0xffffffffffffffd4
jmp 0x523094
or dword [esp + 0x5c], 0xffffffff
lea ecx, [eax - 1]
mov esi, dword [esp + 0x10]
xor edx, edx
mov ebx, dword [esp + 0x4c]
inc edx
mov word [esp + 0x50], ax
mov eax, edx
shl ax, cl
mov word [esp + 0x52], dx
xor edx, edx
movzx eax, ax
mov dword [esp + 0x18], eax
test esi, esi
je 0x522eac
mov esi, dword [esp + 0x48]
mov edi, ebx
mov eax, dword [esp + 0x58]
add esi, 6
mov ebx, dword [esp + 0x10]
sub edi, eax
lea esi, [esi + ebp*4]
movzx ecx, word [edi + eax]
cmp cx, word [esp + 0x5c]
jne 0x522e83
mov byte [esi], dl
xor ecx, ecx
dec ebp
sub esi, 4
inc ecx
jmp 0x522e95
cmp cx, word [esp + 0x18]
jl 0x522e95
xor ebx, ebx
mov word [esp + 0x52], bx
mov ebx, dword [esp + 0x10]
mov word [eax], cx
inc edx
add eax, 2
cmp edx, ebx
jb 0x522e6d
mov edi, dword [esp + 0x14]
mov ebx, dword [esp + 0x4c]
mov esi, dword [esp + 0x10]
push 4
lea eax, [esp + 0x54]
push eax
push dword [esp + 0x50]
call fcn.00527800
lea eax, [edi - 1]
mov ecx, edi
add esp, 0xc
shr ecx, 3
cmp ebp, eax
mov eax, edi
jne 0x522ff1
shr eax, 1
xor ebp, ebp
add eax, 3
mov dword [esp + 0x18], ebp
add eax, ecx
xorps xmm0, xmm0
mov dword [esp + 0x30], eax
xor eax, eax
mov dword [esp + 0x5c], eax
movlpd qword [esp + 0x28], xmm0
test esi, esi
je 0x522f9b
mov esi, dword [esp + 0x2c]
mov ebx, dword [esp + 0x28]
mov edi, dword [esp + 0x4c]
movsx ecx, word [edi + ebp*2]
add eax, dword [esp + 0x1c]
mov dword [esp + 0x50], ecx
lea ecx, [esp + 0x34]
push 8
push ecx
push eax
mov dword [esp + 0x40], ebx
mov dword [esp + 0x44], esi
mov dword [esp + 0x34], eax
call fcn.00527800
mov ecx, dword [esp + 0x5c]
add esp, 0xc
mov dword [esp + 0x24], 8
cmp ecx, 8
jle 0x522f75
mov edi, dword [esp + 0x24]
mov ebp, ecx
push 8
lea eax, [esp + 0x40]
mov dword [esp + 0x40], ebx
push eax
mov eax, dword [esp + 0x30]
add eax, edi
mov dword [esp + 0x48], esi
push eax
call fcn.00527800
add edi, 8
add esp, 0xc
cmp edi, ebp
jl 0x522f44
mov ebp, dword [esp + 0x18]
mov edi, dword [esp + 0x4c]
mov ecx, dword [esp + 0x50]
mov eax, dword [esp + 0x5c]
add eax, ecx
inc ebp
mov ecx, 0x1010101
mov dword [esp + 0x5c], eax
add ebx, ecx
mov dword [esp + 0x18], ebp
adc esi, ecx
cmp ebp, dword [esp + 0x10]
jb 0x522f05
mov edi, dword [esp + 0x14]
xor edx, edx
xor esi, esi
mov dword [esp + 0x50], edx
test edi, edi
je 0x52308e
mov ebp, edx
xor ebx, ebx
mov edx, dword [esp + 0x54]
mov edi, dword [esp + 0x1c]
lea eax, [ebx + esi]
mov ecx, edx
and ecx, ebp
inc ebx
mov al, byte [eax + edi]
mov edi, dword [esp + 0x48]
mov byte [edi + ecx*4 + 6], al
mov edi, dword [esp + 0x30]
add ebp, edi
cmp ebx, 2
jb 0x522fb3
mov edx, dword [esp + 0x50]
add esi, 2
lea edx, [edx + edi*2]
mov edi, dword [esp + 0x14]
and edx, dword [esp + 0x54]
mov dword [esp + 0x50], edx
cmp esi, edi
jb 0x522fab
jmp 0x523050
add ecx, 3
shr eax, 1
add eax, ecx
xor edx, edx
xor ecx, ecx
mov dword [esp + 0x50], eax
test esi, esi
je 0x52304c
mov edi, dword [esp + 0x10]
xor eax, eax
xor esi, esi
cmp ax, word [ebx]
mov eax, dword [esp + 0x50]
jge 0x523037
mov edi, dword [esp + 0x48]
mov byte [edi + ecx*4 + 6], dl
add ecx, eax
and ecx, dword [esp + 0x54]
cmp ecx, ebp
ja 0x52301d
movsx eax, word [ebx]
inc esi
cmp esi, eax
mov eax, dword [esp + 0x50]
jl 0x523019
mov edi, dword [esp + 0x10]
inc edx
add ebx, 2
cmp edx, edi
jb 0x523008
mov edi, dword [esp + 0x14]
test ecx, ecx
je 0x52304c
or eax, 0xffffffff
jmp 0x523095
test edi, edi
je 0x52308e
mov esi, dword [esp + 0x48]
mov ebp, dword [esp + 0x58]
add esi, 7
movzx ebx, di
movzx ecx, byte [esi - 1]
movzx edx, word [ebp + ecx*2]
lea eax, [edx + 1]
mov word [ebp + ecx*2], ax
mov eax, edx
mov cl, byte [esp + 0x20]
bsr eax, eax
sub cl, al
shl dx, cl
sub dx, bx
mov byte [esi], cl
mov word [esi - 3], dx
lea esi, [esi + 4]
sub edi, 1
jne 0x52305e
xor eax, eax
jmp 0x523095
push 0xffffffffffffffd2
pop eax
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x34
ret