Function at 0x5846f0
Capabilities:
Encrypt data using rc4 prga

Disassembly:
mov ecx, dword fs:[0x14]
mov ecx, dword [ecx]
cmp esp, dword [ecx + 8]
jbe 0x584a3f
sub esp, 0x40
movzx eax, byte [esp + 0x44]
lea edx, [eax - 1]
cmp dl, 7
ja 0x584a26
mov edx, dword [esp + 0x4c]
test edx, edx
je 0x5849ea
mov ebx, dword [esp + 0x48]
movzx ebp, byte [ebx]
cmp al, 8
jae 0x584748
movzx ecx, al
cmp ecx, 0x20
sbb esi, esi
mov edi, 1
shl edi, cl
and edi, esi
add edi, 0xffffffff
and ebp, edi
movzx ecx, al
cmp ecx, 0x20
sbb eax, eax
mov esi, 1
shl esi, cl
and esi, eax
mov eax, esi
add esi, 0xffffffff
add ecx, 0xffffffe0
mov dword [esp + 0x30], ecx
cmp ecx, 0x20
sbb edi, edi
neg ecx
mov dword [esp + 0x2c], ecx
cmp ecx, 0x20
sbb edx, edx
mov ecx, dword [esp + 0x30]
mov ebx, 1
shl ebx, cl
and ebx, edi
mov ecx, dword [esp + 0x2c]
mov edi, 1
shr edi, cl
and edx, edi
or ebx, edx
add eax, 0xffffffff
adc ebx, 0xffffffff
test ebx, ebx
seta al
sete dl
cmp ebp, esi
setb bl
and ebx, edx
or ebx, eax
test bl, bl
jne 0x5849a4
mov eax, dword [esp + 0x50]
lea edx, [eax - 1]
mov ebx, edx
neg edx
sar edx, 0x1f
and edx, 1
mov esi, dword [esp + 0x48]
add edx, esi
mov edi, dword [esp + 0x4c]
mov ecx, eax
lea eax, [edi - 1]
mov dword [esp + 0x34], eax
xor eax, eax
mov dword [esp + 0x30], eax
xor eax, eax
mov dword [esp + 0x14], eax
xor eax, eax
mov dword [esp + 0x18], eax
mov eax, dword [esp + 0x34]
jmp 0x584818
mov eax, dword [esp + 0x1c]
mov ebx, dword [esp + 0x24]
mov edx, dword [esp + 0x28]
mov eax, edx
mov edx, ecx
mov dword [esp + 0x30], ebp
mov dword [esp + 0x14], esi
mov dword [esp + 0x18], edi
mov ecx, dword [esp + 0x50]
mov esi, dword [esp + 0x48]
mov edi, dword [esp + 0x4c]
mov ebp, dword [esp + 0x1c]
test eax, eax
jle 0x584970
mov dword [esp + 0x28], ebx
mov dword [esp + 0x2c], ebp
mov dword [esp + 0x24], eax
mov dword [esp + 0x3c], edx
mov edi, dword [esp + 0x18]
cmp edi, 1
sbb esi, esi
xor esi, 0xffffffff
mov edi, dword [esp + 0x14]
or esi, edi
cmp esi, 0x20
sbb edi, edi
movzx eax, byte [edx]
mov byte [esp + 0x13], al
and eax, 0x7f
mov dword [esp + 0x20], eax
mov ecx, esi
shl eax, cl
and eax, edi
mov edi, eax
add eax, ebp
mov dword [esp + 0x1c], eax
add ecx, 0xffffffe0
mov esi, ecx
neg ecx
cmp ecx, 0x20
sbb eax, eax
cmp esi, 0x20
sbb edx, edx
mov ebx, dword [esp + 0x20]
shr ebx, cl
mov ecx, esi
mov ebp, dword [esp + 0x20]
shl ebp, cl
and ebx, eax
and ebp, edx
or ebp, ebx
mov eax, dword [esp + 0x2c]
add edi, eax
mov eax, dword [esp + 0x30]
adc ebp, eax
mov eax, dword [esp + 0x28]
dec eax
mov edx, eax
neg eax
sar eax, 0x1f
and eax, 1
mov ebx, dword [esp + 0x3c]
add eax, ebx
mov ebx, dword [esp + 0x24]
dec ebx
movzx esi, byte [esp + 0x13]
xchg esi, eax
test al, 0x80
xchg esi, eax
je 0x584944
mov dword [esp + 0x28], ebx
mov dword [esp + 0x24], edx
mov esi, dword [esp + 0x14]
add esi, 7
mov edi, dword [esp + 0x18]
adc edi, 0
test edi, edi
mov ecx, eax
seta al
sete dl
cmp esi, 0x3f
setae bl
and ebx, edx
or ebx, eax
test bl, bl
je 0x5847ec
lea eax, [0x65f02c]
mov dword [esp], eax
lea eax, [0x783508]
mov dword [esp + 4], eax
call fcn.004092a0
mov eax, dword [esp + 8]
mov ecx, dword [esp + 0xc]
mov dword [esp + 0x54], 0
mov dword [esp + 0x58], 0
mov edx, dword [esp + 0x48]
mov dword [esp + 0x5c], edx
mov edx, dword [esp + 0x4c]
mov dword [esp + 0x60], edx
mov edx, dword [esp + 0x50]
mov dword [esp + 0x64], edx
mov dword [esp + 0x68], eax
mov dword [esp + 0x6c], ecx
add esp, 0x40
ret
mov ecx, dword [esp + 0x1c]
mov dword [esp + 0x54], ecx
mov dword [esp + 0x58], ebp
mov dword [esp + 0x5c], eax
mov dword [esp + 0x60], ebx
mov dword [esp + 0x64], edx
mov dword [esp + 0x68], 0
mov dword [esp + 0x6c], 0
add esp, 0x40
ret
mov eax, dword [0x783500]
mov edx, dword [0x783504]
mov dword [esp + 0x54], 0
mov dword [esp + 0x58], 0
mov dword [esp + 0x5c], esi
mov dword [esp + 0x60], edi
mov dword [esp + 0x64], ecx
mov dword [esp + 0x68], eax
mov dword [esp + 0x6c], edx
add esp, 0x40
ret
mov dword [esp + 0x54], ebp
mov dword [esp + 0x58], 0
mov eax, dword [esp + 0x50]
dec eax
mov ecx, eax
neg eax
sar eax, 0x1f
and eax, 1
mov edx, dword [esp + 0x48]
add eax, edx
mov dword [esp + 0x5c], eax
mov eax, dword [esp + 0x4c]
dec eax
mov dword [esp + 0x60], eax
mov dword [esp + 0x64], ecx
mov dword [esp + 0x68], 0
mov dword [esp + 0x6c], 0
add esp, 0x40
ret
mov eax, dword [0x783500]
mov ecx, dword [0x783504]
mov dword [esp + 0x54], 0
mov dword [esp + 0x58], 0
mov ebx, dword [esp + 0x48]
mov dword [esp + 0x5c], ebx
mov dword [esp + 0x60], edx
mov edx, dword [esp + 0x50]
mov dword [esp + 0x64], edx
mov dword [esp + 0x68], eax
mov dword [esp + 0x6c], ecx
add esp, 0x40
ret
lea eax, [0x5db180]
mov dword [esp], eax
lea eax, [0x65c280]
mov dword [esp + 4], eax
call fcn.00431a30
nop
call fcn.0045c8b0
jmp fcn.005846f0