Function at 0x581bf4
Capabilities:
Encrypt data using rc4 prga

Disassembly:
sub esp, 0x10
push ebx
push ebp
push esi
mov esi, dword [esp + 0x20]
mov ebp, ecx
push edi
mov ebx, dword [esi + 8]
xor ecx, ecx
mov cx, word [ebp + 8]
mov edi, dword [esi + 4]
lea eax, [ebx + 1]
xor edx, edx
imul eax, ecx
dec eax
mov dword [esp + 0x18], ebp
div edi
lea edx, [ebp + 0xa]
xor edi, edi
mov dword [esp + 0x24], 1
mov di, word [edx]
cmp edi, eax
jbe 0x581c45
mov edi, dword [esp + 0x24]
add edx, 2
inc edi
mov dword [esp + 0x24], edi
xor edi, edi
mov di, word [edx]
cmp edi, eax
ja 0x581c30
mov edx, dword [esp + 0x24]
xor eax, eax
mov edi, dword [esi]
mov ax, word [ebp + edx*2 + 6]
xor edx, edx
imul eax, dword [esi + 4]
div ecx
mov edx, dword [esp + 0x24]
lea edi, [eax + edi - 1]
xor eax, eax
mov ax, word [ebp + edx*2 + 8]
xor edx, edx
imul eax, dword [esi + 4]
div ecx
mov ecx, dword [esi]
sub ebx, eax
add ecx, eax
mov dword [esi + 8], ebx
mov dword [esi], ecx
mov ebx, 0x10000
mov eax, dword [esi]
mov ecx, eax
xor ecx, edi
test ch, 0x80
je 0x581caa
test ah, 0x40
je 0x581d17
test edi, 0x4000
jne 0x581d17
and eax, 0x3fff
or edi, 0x4000
mov dword [esi], eax
mov edx, dword [esi]
and edi, 0x7fff
and edx, 0x7fff
shl edx, 1
mov dword [esi], edx
mov eax, dword [esi + 0x10]
shl edi, 1
or edi, 1
cmp eax, ebx
jb 0x581cf8
mov eax, dword [esi + 0x18]
mov edx, dword [esi + 0x1c]
lea ecx, [esi + 0x18]
cmp eax, edx
jb 0x581ce0
call fcn.0053bf84
mov byte [esp + 0x10], al
jmp 0x581ce9
mov dl, byte [eax]
inc eax
mov byte [esp + 0x10], dl
mov dword [ecx], eax
mov eax, dword [esp + 0x10]
and eax, 0xff
or ah, 1
mov dword [esi + 0x10], eax
mov ecx, dword [esi + 0x10]
mov eax, ecx
add ecx, ecx
mov dword [esi + 0x10], ecx
mov edx, dword [esi + 8]
shr eax, 7
and eax, 1
shl edx, 1
or edx, eax
mov dword [esi + 8], edx
jmp 0x581c81
mov edx, dword [esi]
mov ecx, dword [esp + 0x24]
sub edi, edx
inc edi
dec ecx
xor eax, eax
mov dword [esi + 4], edi
mov al, byte [ecx + ebp + 0x8a]
mov esi, eax
lea eax, [ebp + ecx*2 + 8]
mov dword [esp + 0x1c], esi
add word [eax], 8
mov edx, ecx
dec ecx
sub eax, 2
test edx, edx
jne 0x581d37
cmp word [ebp + 8], 0xed8
lea eax, [ebp + 8]
jbe 0x581e65
mov ecx, dword [ebp + 4]
dec ecx
mov dword [ebp + 4], ecx
jne 0x581e3d
mov edx, dword [ebp]
xor ecx, ecx
test edx, edx
mov dword [ebp + 4], 0x32
jbe 0x581d90
xor edx, edx
xor edi, edi
mov dx, word [eax + 2]
mov di, word [eax]
sub edi, edx
add eax, 2
inc edi
sar edi, 1
mov word [eax - 2], di
mov edx, dword [ebp]
inc ecx
cmp ecx, edx
jb 0x581d71
mov eax, dword [ebp]
xor edx, edx
mov dword [esp + 0x24], edx
lea ecx, [eax - 1]
test ecx, ecx
jbe 0x581e1b
mov ecx, 1
lea ebx, [ebp + 8]
mov dword [esp + 0x10], ecx
lea esi, [ebp + 0x8a]
mov dword [esp + 0x14], ebx
cmp ecx, eax
jae 0x581dfb
lea edx, [ebx + 2]
mov di, word [ebx]
cmp di, word [edx]
jae 0x581de8
mov bp, word [edx]
mov al, byte [esi]
mov word [ebx], bp
mov ebp, dword [esp + 0x18]
mov bl, byte [ecx + ebp + 0x8a]
mov byte [esi], bl
mov ebx, dword [esp + 0x14]
mov word [edx], di
mov byte [ecx + ebp + 0x8a], al
mov eax, dword [ebp]
inc ecx
add edx, 2
cmp ecx, eax
jb 0x581dbd
mov ecx, dword [esp + 0x10]
mov edx, dword [esp + 0x24]
mov eax, dword [ebp]
inc edx
inc ecx
add ebx, 2
lea edi, [eax - 1]
inc esi
cmp edx, edi
mov dword [esp + 0x24], edx
mov dword [esp + 0x10], ecx
mov dword [esp + 0x14], ebx
jb 0x581db6
mov esi, dword [esp + 0x1c]
lea ebp, [ebp + edx*2 + 8]
mov ax, word [ebp + 2]
mov ecx, edx
add word [ebp], ax
dec edx
sub ebp, 2
test ecx, ecx
jne 0x581e1f
mov eax, esi
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x10
ret 4
mov eax, dword [ebp]
dec eax
lea ebp, [ebp + eax*2 + 8]
shr word [ebp], 1
mov dx, word [ebp]
mov cx, word [ebp + 2]
cmp dx, cx
ja 0x581e5b
inc ecx
mov word [ebp], cx
mov edx, eax
dec eax
sub ebp, 2
test edx, edx
jne 0x581e45
mov eax, esi
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x10
ret 4