Function at 0x585d40
Capabilities:
Encrypt data using rc4 prga

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x48
push ebx
push esi
mov esi, ecx
push edi
mov edi, edx
mov dword [ebp - 0x28], esi
mov dword [ebp - 0x48], edi
mov ebx, dword [esi + 0x10]
cmp ebx, 3
jae 0x585d67
call fcn.00586e73
xor eax, eax
jmp 0x585f0a
mov ecx, dword [esi]
and dword [ebp - 0x34], 0
and dword [ebp - 0x18], 0
mov dword [ebp - 0x30], 2
movzx edx, byte [ecx]
movzx eax, byte [ecx + 2]
shl edx, 8
or edx, eax
movzx eax, byte [ecx + 1]
mov ecx, dword [esi + 0x24]
xor edx, dword [esi + eax*4 + 0x60]
movzx edx, dx
mov eax, dword [ecx + edx*4]
mov dword [ebp - 0x14], eax
mov eax, dword [esi + 4]
mov dword [ecx + edx*4], eax
mov eax, dword [esi + 0x18]
mov ecx, dword [esi + 0x14]
mov edx, dword [esi + 0x30]
mov dword [ebp - 0x3c], eax
mov eax, dword [esi + 0x28]
mov dword [ebp - 0x24], eax
mov eax, dword [esi]
mov dword [ebp - 8], eax
mov eax, dword [esi + 4]
mov dword [ebp - 0x38], eax
mov eax, dword [ebp - 0x24]
mov dword [ebp - 0x40], ecx
mov dword [ebp - 0x1c], edx
lea ecx, [eax + ecx*8]
mov dword [ebp - 4], ecx
lea eax, [ecx + 4]
mov dword [ebp - 0xc], eax
test edx, edx
je 0x585ee5
mov eax, dword [ebp - 0x14]
mov edx, dword [ebp - 0x38]
mov ecx, dword [ebp - 0x3c]
sub edx, eax
dec dword [ebp - 0x1c]
mov dword [ebp - 0x2c], edx
cmp edx, ecx
jae 0x585edf
cmp dword [ebp - 0x40], edx
mov esi, dword [ebp - 0x34]
sbb eax, eax
and eax, ecx
mov ecx, dword [ebp - 0x24]
sub eax, edx
add eax, dword [ebp - 0x40]
lea eax, [ecx + eax*8]
mov ecx, dword [ebp - 8]
sub ecx, edx
mov dword [ebp - 0x20], eax
mov eax, dword [eax]
mov dword [ebp - 0x10], ecx
mov ecx, dword [ebp - 0x18]
cmp esi, ecx
mov dword [ebp - 0x44], eax
mov eax, dword [ebp - 0x10]
cmovb ecx, esi
mov esi, dword [ebp - 8]
mov al, byte [ecx + eax]
cmp al, byte [ecx + esi]
mov esi, dword [ebp - 0x28]
jne 0x585e7f
inc ecx
cmp ecx, ebx
je 0x585e68
mov eax, dword [ebp - 0x10]
mov edx, dword [ebp - 8]
mov al, byte [ecx + eax]
cmp al, byte [ecx + edx]
mov edx, dword [ebp - 0x2c]
jne 0x585e68
inc ecx
cmp ecx, ebx
je 0x585e68
mov eax, dword [ebp - 8]
mov edx, dword [ebp - 0x10]
sub edx, eax
lea esi, [ecx + eax]
mov al, byte [edx + esi]
cmp al, byte [esi]
jne 0x585e62
inc ecx
inc esi
cmp ecx, ebx
jne 0x585e55
mov esi, dword [ebp - 0x28]
mov edx, dword [ebp - 0x2c]
cmp dword [ebp - 0x30], ecx
jae 0x585e7f
mov dword [edi], ecx
lea eax, [edx - 1]
mov dword [edi + 4], eax
add edi, 8
mov dword [ebp - 0x30], ecx
cmp ecx, ebx
je 0x585eca
mov eax, dword [ebp - 0x10]
mov edx, dword [ebp - 8]
mov al, byte [ecx + eax]
cmp al, byte [ecx + edx]
jae 0x585ea5
mov eax, dword [ebp - 4]
mov edx, dword [ebp - 0x14]
mov dword [ebp - 0x18], ecx
mov dword [eax], edx
mov eax, dword [ebp - 0x20]
add eax, 4
mov dword [ebp - 4], eax
mov ecx, eax
jmp 0x585eb9
mov edx, dword [ebp - 0xc]
mov eax, dword [ebp - 0x14]
mov dword [ebp - 0x34], ecx
mov ecx, dword [ebp - 4]
mov dword [edx], eax
mov eax, dword [ebp - 0x20]
mov dword [ebp - 0xc], eax
cmp dword [ebp - 0x1c], 0
mov eax, dword [eax]
mov dword [ebp - 0x14], eax
jne 0x585ddb
jmp 0x585ee2
mov eax, dword [ebp - 4]
mov ecx, dword [ebp - 0x44]
mov edx, dword [ebp - 0xc]
mov dword [eax], ecx
mov eax, dword [ebp - 0x20]
mov eax, dword [eax + 4]
mov dword [edx], eax
jmp 0x585eeb
mov ecx, dword [ebp - 4]
mov eax, dword [ebp - 0xc]
and dword [ecx], 0
and dword [eax], 0
sub edi, dword [ebp - 0x48]
sar edi, 2
inc dword [esi + 0x14]
inc dword [esi]
inc dword [esi + 4]
mov ecx, dword [esi + 4]
cmp ecx, dword [esi + 8]
jne 0x585f08
mov ecx, esi
call fcn.00586afd
mov eax, edi
pop edi
pop esi
pop ebx
leave
ret