Function at 0x525810
Capabilities:
Encrypt data using rc4 prga

Disassembly:
sub esp, 0x20
mov ecx, dword [esp + 0x30]
xor eax, eax
cmp dword [esp + 0x34], 4
push ebp
mov ebp, ecx
mov dword [esp + 8], eax
mov dword [esp + 0x18], eax
jb 0x525aad
mov edx, dword [ecx]
push edi
mov edi, edx
and edi, 0xf
add edi, 5
cmp edi, 0xf
jbe 0x52584a
pop edi
mov eax, 0xffffffd4
pop ebp
add esp, 0x20
ret
mov eax, dword [esp + 0x34]
mov ecx, edi
push ebx
push esi
mov esi, 1
shr edx, 4
shl esi, cl
mov ebx, 4
mov dword [eax], edi
inc edi
mov dword [esp + 0x10], esi
mov dword [esp + 0x1c], edi
lea eax, [esi + 1]
mov dword [esp + 0x18], eax
cmp eax, 1
jle 0x525a80
nop dword [eax]
mov esi, dword [esp + 0x38]
mov ecx, dword [esp + 0x14]
cmp ecx, dword [esi]
mov esi, dword [esp + 0x10]
ja 0x525a63
cmp dword [esp + 0x24], 0
je 0x52596c
mov edi, ecx
cmp dx, 0xffff
jne 0x5258db
mov esi, dword [esp + 0x44]
add esi, 0xfffffffb
add esi, dword [esp + 0x40]
add edi, 0x18
cmp ebp, esi
jae 0x5258c6
mov edx, dword [ebp + 2]
add ebp, 2
mov ecx, ebx
shr edx, cl
jmp 0x5258cc
shr edx, 0x10
add ebx, 0x10
cmp dx, 0xffff
je 0x5258b3
mov esi, dword [esp + 0x10]
mov ecx, dword [esp + 0x14]
mov eax, edx
and eax, 3
cmp al, 3
jne 0x5258f6
shr edx, 2
add edi, 3
mov eax, edx
add ebx, 2
and eax, 3
cmp al, 3
je 0x5258e4
mov eax, edx
add ebx, 2
and eax, 3
add edi, eax
mov eax, dword [esp + 0x38]
cmp edi, dword [eax]
ja 0x525a73
cmp ecx, edi
jae 0x525932
mov esi, ecx
xor eax, eax
mov ecx, edi
sub ecx, dword [esp + 0x14]
mov dword [esp + 0x14], edi
mov edi, dword [esp + 0x34]
shr ecx, 1
lea edi, [edi + esi*2]
mov esi, dword [esp + 0x10]
rep stosd dword es:[edi], eax
adc ecx, ecx
rep stosw word es:[edi], ax
mov eax, dword [esp + 0x44]
mov ecx, ebx
mov edi, dword [esp + 0x40]
add eax, 0xfffffff9
sar ecx, 3
add eax, edi
add ecx, ebp
cmp ebp, eax
jbe 0x52595c
mov eax, dword [esp + 0x44]
add eax, 0xfffffffc
add eax, edi
cmp ecx, eax
jbe 0x52595c
shr edx, 2
jmp 0x525968
mov ebp, ecx
and ebx, 7
mov ecx, ebx
mov edx, dword [ebp]
shr edx, cl
mov edi, dword [esp + 0x1c]
movzx eax, si
lea ecx, [esi - 1]
mov dword [esp + 0x28], eax
and ecx, edx
add eax, eax
add ebx, edi
mov dword [esp + 0x2c], eax
sub eax, dword [esp + 0x18]
dec eax
movzx eax, ax
mov dword [esp + 0x24], eax
movzx eax, dx
mov dword [esp + 0x20], eax
mov eax, dword [esp + 0x24]
cwde
cmp ecx, eax
jae 0x5259ab
mov eax, dword [esp + 0x28]
dec eax
and eax, dword [esp + 0x20]
dec ebx
movzx ecx, ax
jmp 0x5259ce
mov esi, dword [esp + 0x2c]
dec esi
and esi, dword [esp + 0x20]
movzx eax, si
movsx edx, ax
sub eax, dword [esp + 0x24]
cmp edx, dword [esp + 0x10]
movzx ecx, ax
movzx eax, si
cmovl ecx, eax
movzx ecx, cx
mov esi, dword [esp + 0x34]
dec ecx
movsx eax, cx
cdq
xor eax, edx
sub eax, edx
mov edx, dword [esp + 0x18]
cwde
sub edx, eax
mov eax, dword [esp + 0x14]
mov dword [esp + 0x18], edx
mov word [esi + eax*2], cx
inc eax
mov esi, dword [esp + 0x10]
mov dword [esp + 0x14], eax
xor eax, eax
test cx, cx
sete al
mov dword [esp + 0x24], eax
cmp edx, esi
jge 0x525a16
sar esi, 1
dec edi
cmp edx, esi
jl 0x525a07
mov dword [esp + 0x1c], edi
mov dword [esp + 0x10], esi
mov edx, dword [esp + 0x40]
mov ecx, ebx
add edx, dword [esp + 0x44]
sar ecx, 3
lea eax, [edx - 7]
cmp ebp, eax
jbe 0x525a40
lea eax, [ecx + ebp]
lea ecx, [edx - 4]
cmp eax, ecx
jbe 0x525a43
sub ebp, edx
lea ebx, [ebx + ebp*8]
mov ebp, ecx
add ebx, 0x20
jmp 0x525a48
lea eax, [ecx + ebp]
mov ebp, eax
and ebx, 7
mov edx, dword [ebp]
mov ecx, ebx
mov eax, dword [esp + 0x18]
and ecx, 0x1f
shr edx, cl
cmp eax, 1
jg 0x525880
mov ecx, dword [esp + 0x14]
cmp eax, 1
je 0x525a84
pop esi
pop ebx
pop edi
or eax, 0xffffffff
pop ebp
add esp, 0x20
ret
pop esi
pop ebx
pop edi
mov eax, 0xffffffd0
pop ebp
add esp, 0x20
ret
xor ecx, ecx
jmp 0x525a63
lea eax, [ecx - 1]
mov ecx, dword [esp + 0x38]
pop esi
mov dword [ecx], eax
lea eax, [ebx + 7]
sar eax, 3
mov ecx, 0xffffffb8
sub eax, dword [esp + 0x3c]
add eax, ebp
cmp eax, dword [esp + 0x40]
pop ebx
pop edi
cmova eax, ecx
pop ebp
add esp, 0x20
ret
mov eax, 0xffffffb8
pop ebp
add esp, 0x20
ret