Function at 0x5e5940
Capabilities:
Encrypt data using rc4 prga

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x24
mov ecx, dword [ebp + 0x14]
xor eax, eax
cmp dword [ebp + 0x18], 4
push ebx
push esi
mov esi, ecx
mov dword [ebp - 8], eax
push edi
mov dword [ebp - 0xc], esi
mov dword [ebp - 0x1c], eax
jb 0x5e5bbf
mov edx, dword [ecx]
mov edi, edx
and edi, 0xf
add edi, 5
mov dword [ebp - 0x10], edi
cmp edi, 0xf
jbe 0x5e5981
pop edi
pop esi
mov eax, 0xfffffffe
pop ebx
mov esp, ebp
pop ebp
ret
mov eax, dword [ebp + 0x10]
mov ebx, 4
shr edx, 4
mov dword [eax], edi
mov edi, 1
mov eax, dword [ebp - 0x10]
mov ecx, eax
shl edi, cl
inc eax
mov dword [ebp - 0x10], eax
mov dword [ebp - 4], edi
lea ecx, [edi + 1]
mov eax, ecx
mov dword [ebp - 0x14], ecx
cmp eax, 1
jle 0x5e5ba3
mov edi, dword [ebp + 0xc]
mov ecx, dword [ebp - 8]
cmp ecx, dword [edi]
mov edi, dword [ebp - 4]
ja 0x5e5b88
cmp dword [ebp - 0x1c], 0
je 0x5e5a98
mov edi, ecx
cmp dx, 0xffff
jne 0x5e5a0b
mov eax, dword [ebp + 0x14]
add eax, 0xfffffffb
add eax, dword [ebp + 0x18]
mov dword [ebp - 0x1c], eax
add edi, 0x18
cmp esi, eax
jae 0x5e59f5
mov edx, dword [esi + 2]
add esi, 2
mov ecx, ebx
shr edx, cl
jmp 0x5e59fb
shr edx, 0x10
add ebx, 0x10
mov eax, dword [ebp - 0x1c]
cmp dx, 0xffff
je 0x5e59e2
mov ecx, dword [ebp - 8]
mov dword [ebp - 0xc], esi
mov eax, edx
and eax, 3
cmp al, 3
jne 0x5e5a26
shr edx, 2
add edi, 3
mov eax, edx
add ebx, 2
and eax, 3
cmp al, 3
je 0x5e5a14
mov eax, edx
add ebx, 2
and eax, 3
add edi, eax
mov eax, dword [ebp + 0xc]
cmp edi, dword [eax]
ja 0x5e5b97
cmp ecx, edi
jae 0x5e5a5d
mov esi, ecx
xor eax, eax
mov ecx, edi
sub ecx, dword [ebp - 8]
mov dword [ebp - 8], edi
mov edi, dword [ebp + 8]
shr ecx, 1
lea edi, [edi + esi*2]
mov esi, dword [ebp - 0xc]
rep stosd dword es:[edi], eax
adc ecx, ecx
rep stosw word es:[edi], ax
mov eax, dword [ebp + 0x14]
mov edi, ebx
add eax, 0xfffffff9
sar edi, 3
add eax, dword [ebp + 0x18]
cmp esi, eax
jbe 0x5e5a86
mov ecx, dword [ebp + 0x18]
mov eax, dword [ebp + 0x14]
add ecx, 0xfffffffc
add eax, ecx
lea ecx, [edi + esi]
cmp ecx, eax
jbe 0x5e5a86
shr edx, 2
jmp 0x5e5a95
mov edx, dword [esi + edi]
add esi, edi
and ebx, 7
mov dword [ebp - 0xc], esi
mov ecx, ebx
shr edx, cl
mov edi, dword [ebp - 4]
add ebx, dword [ebp - 0x10]
lea ecx, [edi - 1]
movzx eax, di
and ecx, edx
mov dword [ebp - 0x20], eax
add eax, eax
mov dword [ebp - 0x24], eax
sub eax, dword [ebp - 0x14]
dec eax
movzx eax, ax
mov dword [ebp - 0x1c], eax
movzx eax, dx
mov dword [ebp - 0x18], eax
mov eax, dword [ebp - 0x1c]
cwde
cmp ecx, eax
jae 0x5e5ad0
mov eax, dword [ebp - 0x20]
dec eax
and eax, dword [ebp - 0x18]
dec ebx
movzx ecx, ax
jmp 0x5e5af1
mov esi, dword [ebp - 0x24]
dec esi
and esi, dword [ebp - 0x18]
movzx eax, si
movsx edx, ax
sub eax, dword [ebp - 0x1c]
cmp edx, edi
movzx ecx, ax
movzx eax, si
mov esi, dword [ebp - 0xc]
cmovl ecx, eax
movzx ecx, cx
mov edi, dword [ebp + 8]
dec ecx
movsx eax, cx
cdq
xor eax, edx
sub eax, edx
mov edx, dword [ebp - 0x14]
cwde
sub edx, eax
mov eax, dword [ebp - 8]
mov dword [ebp - 0x14], edx
mov word [edi + eax*2], cx
inc eax
mov edi, dword [ebp - 4]
mov dword [ebp - 8], eax
xor eax, eax
test cx, cx
sete al
mov dword [ebp - 0x1c], eax
cmp edx, edi
jge 0x5e5b33
mov eax, dword [ebp - 0x10]
sar edi, 1
dec eax
cmp edx, edi
jl 0x5e5b26
mov dword [ebp - 0x10], eax
mov dword [ebp - 4], edi
mov eax, dword [ebp + 0x18]
mov edx, ebx
add eax, 0xfffffff9
sar edx, 3
add eax, dword [ebp + 0x14]
cmp esi, eax
jbe 0x5e5b68
mov eax, dword [ebp + 0x18]
lea ecx, [edx + esi]
add eax, 0xfffffffc
add eax, dword [ebp + 0x14]
cmp ecx, eax
jbe 0x5e5b68
mov eax, dword [ebp + 0x14]
add eax, dword [ebp + 0x18]
sub esi, eax
lea ebx, [ebx + esi*8]
add ebx, 0x20
lea esi, [eax - 4]
jmp 0x5e5b6d
add esi, edx
and ebx, 7
mov edx, dword [esi]
mov ecx, ebx
mov eax, dword [ebp - 0x14]
and ecx, 0x1f
shr edx, cl
mov dword [ebp - 0xc], esi
cmp eax, 1
jg 0x5e59b2
mov ecx, dword [ebp - 8]
cmp eax, 1
je 0x5e5ba7
pop edi
pop esi
or eax, 0xffffffff
pop ebx
mov esp, ebp
pop ebp
ret
pop edi
pop esi
mov eax, 0xfffffffc
pop ebx
mov esp, ebp
pop ebp
ret
xor ecx, ecx
jmp 0x5e5b88
mov eax, dword [ebp + 0xc]
dec ecx
mov dword [eax], ecx
lea ecx, [ebx + 7]
sar ecx, 3
add esi, ecx
sub esi, dword [ebp + 0x14]
mov eax, esi
cmp esi, dword [ebp + 0x18]
jbe 0x5e5bc4
mov eax, 0xfffffffa
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret