Function at 0x523870
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 0x523b72
jb 0x5238ea
cmp ebx, dword [esp + 0x5c]
ja 0x523b72
cmp dword [esp + 0x50], 0xff
ja 0x523b72
mov eax, dword [esp + 0x20]
cmp eax, 0xc
jbe 0x523908
push 0xffffffffffffffd4
jmp 0x523b74
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 0x52398c
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 0x523963
mov byte [esi], dl
xor ecx, ecx
dec ebp
sub esi, 4
inc ecx
jmp 0x523975
cmp cx, word [esp + 0x18]
jl 0x523975
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 0x52394d
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.005282e0
lea eax, [edi - 1]
mov ecx, edi
add esp, 0xc
shr ecx, 3
cmp ebp, eax
mov eax, edi
jne 0x523ad1
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 0x523a7b
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.005282e0
mov ecx, dword [esp + 0x5c]
add esp, 0xc
mov dword [esp + 0x24], 8
cmp ecx, 8
jle 0x523a55
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.005282e0
add edi, 8
add esp, 0xc
cmp edi, ebp
jl 0x523a24
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 0x5239e5
mov edi, dword [esp + 0x14]
xor edx, edx
xor esi, esi
mov dword [esp + 0x50], edx
test edi, edi
je 0x523b6e
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 0x523a93
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 0x523a8b
jmp 0x523b30
add ecx, 3
shr eax, 1
add eax, ecx
xor edx, edx
xor ecx, ecx
mov dword [esp + 0x50], eax
test esi, esi
je 0x523b2c
mov edi, dword [esp + 0x10]
xor eax, eax
xor esi, esi
cmp ax, word [ebx]
mov eax, dword [esp + 0x50]
jge 0x523b17
mov edi, dword [esp + 0x48]
mov byte [edi + ecx*4 + 6], dl
add ecx, eax
and ecx, dword [esp + 0x54]
cmp ecx, ebp
ja 0x523afd
movsx eax, word [ebx]
inc esi
cmp esi, eax
mov eax, dword [esp + 0x50]
jl 0x523af9
mov edi, dword [esp + 0x10]
inc edx
add ebx, 2
cmp edx, edi
jb 0x523ae8
mov edi, dword [esp + 0x14]
test ecx, ecx
je 0x523b2c
or eax, 0xffffffff
jmp 0x523b75
test edi, edi
je 0x523b6e
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 0x523b3e
xor eax, eax
jmp 0x523b75
push 0xffffffffffffffd2
pop eax
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x34
ret