Function at 0x5869a8
Capabilities:
Encrypt data using rc4 prga

Disassembly:
push ebp
push edi
push esi
push ebx
sub esp, 0x4c
mov dword [esp + 0x38], eax
mov dword [esp + 0x3c], edx
mov dword [esp + 0x34], ecx
mov ebx, dword [esp + 0x60]
cmp dword [eax + 0x1c], ebx
je 0x586bb4
add ebx, 2
mov dword [esp + 0x2c], ebx
mov edx, dword [esp + 0x3c]
mov ebp, dword [edx + 0x2c]
mov ecx, dword [esp + 0x34]
mov eax, dword [esp + 0x38]
call fcn.00585f20
mov esi, dword [esp + 0x64]
test esi, esi
je 0x5869f5
mov ebx, dword [esp + 0x64]
mov dword [ebx], 0
mov ecx, dword [esp + 0x34]
mov edx, dword [esp + 0x38]
cmp ecx, dword [edx + 0x18]
je 0x586bc4
mov ecx, dword [esp + 0x34]
mov cx, word [ecx - 2]
mov word [esp + 0x10], cx
movzx edx, ch
mov edx, dword [ebp + edx*4 + 0xe0]
movzx ecx, byte [esp + 0x10]
movsx edx, word [edx + ecx*2]
mov ecx, dword [esp + 0x34]
mov dword [esp + 8], ecx
mov dword [esp + 4], ecx
mov dword [esp], edx
mov ecx, eax
mov edx, dword [esp + 0x3c]
mov eax, dword [esp + 0x38]
call fcn.005862cc
mov esi, eax
test eax, eax
je 0x586c58
mov ecx, dword [esp + 0x34]
mov dword [eax + 0x14], ecx
mov eax, dword [esp + 0x38]
test byte [eax + 8], 8
je 0x586b30
mov ecx, dword [esp + 0x34]
cmp dword [esp + 0x2c], ecx
jbe 0x586c5f
mov ebx, ecx
add ebx, 2
jmp 0x586a86
mov dword [eax + 0x14], ebx
add ebx, 2
mov esi, eax
cmp dword [esp + 0x2c], edi
jbe 0x586ad8
lea eax, [ebx - 2]
mov dword [esp + 0x30], eax
mov edi, ebx
mov dx, word [ebx - 2]
movzx eax, dh
mov eax, dword [ebp + eax*4 + 0xe0]
movzx edx, byte [ebx - 2]
movsx edx, word [eax + edx*2]
mov eax, dword [esi + 0x18]
mov eax, dword [eax + edx*4]
test eax, eax
jne 0x586a78
mov ecx, dword [esp + 0x34]
mov dword [esp + 8], ecx
mov dword [esp + 4], ebx
mov dword [esp], edx
mov ecx, esi
mov edx, dword [esp + 0x3c]
mov eax, dword [esp + 0x38]
call fcn.005862cc
test eax, eax
jne 0x586a78
mov edi, dword [esp + 0x30]
lea esi, [esi]
mov eax, dword [esp + 0x38]
cmp dword [eax + 0x1c], edi
je 0x586be8
mov edx, dword [esp + 0x3c]
mov eax, dword [edx + 0x30]
mov ecx, edx
mov edx, dword [edx + 0x14]
mov ecx, dword [ecx + 4]
test ecx, ecx
jle 0x586b1b
test byte [edx + 8], 2
je 0x586b15
mov ebx, dword [edx + 0x14]
cmp ebx, eax
je 0x586b15
test eax, eax
je 0x586ba0
cmp eax, ebx
jb 0x586ba0
add edx, 0x20
dec ecx
jne 0x586af8
test eax, eax
je 0x586c58
sub eax, 2
add esp, 0x4c
pop ebx
pop esi
pop edi
pop ebp
ret
mov ebx, ecx
add ebx, 2
mov edi, ecx
cmp dword [esp + 0x2c], ecx
ja 0x586b4e
jmp 0x586ad8
mov dword [eax + 0x14], ebx
add ebx, 2
mov esi, eax
cmp dword [esp + 0x2c], edi
jbe 0x586ad8
lea eax, [ebx - 2]
mov dword [esp + 0x30], eax
mov edi, ebx
mov dx, word [ebx - 2]
movzx eax, dh
mov eax, dword [ebp + eax*4 + 0xe0]
movzx edx, byte [ebx - 2]
movsx edx, word [eax + edx*2]
mov eax, dword [esi + 0x18]
mov eax, dword [eax + edx*4]
test eax, eax
jne 0x586b40
mov ecx, dword [esp + 0x34]
mov dword [esp + 8], ecx
mov dword [esp + 4], ebx
mov dword [esp], edx
mov ecx, esi
mov edx, dword [esp + 0x3c]
mov eax, dword [esp + 0x38]
call fcn.005862cc
test eax, eax
jne 0x586b40
jmp 0x586ad1
mov eax, ebx
add edx, 0x20
dec ecx
jne 0x586af8
jmp 0x586b1b
mov ebx, dword [esp + 0x60]
mov dword [esp + 0x2c], ebx
jmp 0x5869cf
mov edx, dword [esp + 0x3c]
mov ecx, dword [edx + 0x28]
mov ebx, dword [esp + 0x38]
mov edx, dword [ebx + 8]
and edx, 1
xor edx, 1
add edx, 8
movsx edx, word [ecx + edx*2 + 4]
jmp 0x586a26
cmp dword [esp + 0x60], edi
jne 0x586ae5
mov ebx, dword [esp + 0x64]
test ebx, ebx
je 0x586c04
mov ebx, dword [esp + 0x64]
mov dword [ebx], 1
mov ecx, dword [esp + 0x34]
mov dword [esp + 8], ecx
mov ebx, dword [esp + 0x60]
mov dword [esp + 4], ebx
mov edx, dword [esp + 0x3c]
mov eax, dword [edx + 0x28]
mov ecx, dword [esp + 0x38]
xor edx, edx
test byte [ecx + 8], 2
sete dl
add edx, 8
movsx eax, word [eax + edx*2 + 8]
mov dword [esp], eax
mov ecx, esi
mov edx, dword [esp + 0x3c]
mov eax, dword [esp + 0x38]
call fcn.005862cc
test eax, eax
je 0x586ae5
test byte [eax + 8], 2
jne 0x586c68
mov dword [eax + 0x14], ebx
jmp 0x586ae5
xor eax, eax
jmp 0x586b26
mov edi, dword [esp + 0x34]
jmp 0x586ad8
mov eax, dword [esp + 0x60]
jmp 0x586b26