Function at 0x51635e
Capabilities:
Encrypt data using rc4 prga

Disassembly:
sub esp, 0x18
mov ecx, dword [esp + 0x28]
xor eax, eax
push ebx
push ebp
push esi
push edi
push 4
pop ebx
mov ebp, ecx
mov dword [esp + 0x10], eax
mov dword [esp + 0x24], eax
cmp dword [esp + 0x3c], ebx
jb 0x5165de
push ecx
call fcn.0050707e
pop ecx
mov esi, eax
mov ecx, esi
and ecx, 0xf
add ecx, 5
cmp ecx, 0xf
jbe 0x51639f
push 0xffffffffffffffd4
jmp 0x5165e0
mov eax, dword [esp + 0x34]
xor edi, edi
inc edi
shr esi, 4
shl edi, cl
mov dword [esp + 0x1c], edi
mov dword [eax], ecx
inc ecx
mov dword [esp + 0x18], ecx
lea eax, [edi + 1]
mov dword [esp + 0x14], eax
cmp eax, 1
jle 0x5165bd
mov edx, dword [esp + 0x30]
mov ecx, dword [esp + 0x10]
cmp ecx, dword [edx]
ja 0x5165af
cmp dword [esp + 0x24], 0
je 0x5164b4
mov edi, ecx
cmp si, 0xffff
jne 0x516436
mov eax, dword [esp + 0x3c]
add eax, 0xfffffffb
add eax, dword [esp + 0x38]
mov dword [esp + 0x24], eax
add edi, 0x18
cmp ebp, eax
jae 0x516412
add ebp, 2
push ebp
call fcn.0050707e
pop ecx
mov esi, eax
mov ecx, ebx
shr esi, cl
jmp 0x516418
shr esi, 0x10
add ebx, 0x10
mov eax, dword [esp + 0x24]
cmp si, 0xffff
je 0x5163f9
mov ecx, dword [esp + 0x10]
mov edx, dword [esp + 0x30]
jmp 0x516436
add edi, 3
shr esi, 2
add ebx, 2
mov eax, esi
and eax, 3
cmp al, 3
je 0x51642d
mov eax, esi
add ebx, 2
and eax, 3
add edi, eax
cmp edi, dword [edx]
ja 0x5165b9
cmp ecx, edi
jae 0x516473
mov edx, ecx
xor eax, eax
mov ecx, edi
sub ecx, dword [esp + 0x10]
mov dword [esp + 0x10], edi
mov edi, dword [esp + 0x2c]
shr ecx, 1
lea edi, [edi + edx*2]
rep stosd dword es:[edi], eax
adc ecx, ecx
rep stosw word es:[edi], ax
mov edi, dword [esp + 0x3c]
mov edx, dword [esp + 0x38]
lea eax, [edi - 7]
add eax, edx
cmp ebp, eax
jbe 0x516499
mov ecx, ebx
lea eax, [edi - 4]
sar ecx, 3
add eax, edx
add ecx, ebp
cmp ecx, eax
jbe 0x516499
shr esi, 2
jmp 0x5164b0
mov eax, ebx
and ebx, 7
sar eax, 3
add ebp, eax
push ebp
call fcn.0050707e
pop ecx
mov esi, eax
mov ecx, ebx
shr esi, cl
mov edi, dword [esp + 0x1c]
add ebx, dword [esp + 0x18]
lea ecx, [edi - 1]
movzx edx, di
and ecx, esi
lea eax, [edx + edx]
sub eax, dword [esp + 0x14]
dec eax
movzx eax, ax
mov dword [esp + 0x24], eax
movzx eax, si
mov dword [esp + 0x20], eax
mov eax, dword [esp + 0x24]
cwde
cmp ecx, eax
jae 0x5164ec
lea eax, [edx - 1]
and eax, dword [esp + 0x20]
dec ebx
movzx ecx, ax
jmp 0x51650f
lea esi, [edx*2 - 1]
and esi, dword [esp + 0x20]
movzx eax, si
movsx edx, ax
sub eax, dword [esp + 0x24]
cmp edx, edi
movzx ecx, ax
movzx eax, si
cmovl ecx, eax
movzx ecx, cx
mov esi, dword [esp + 0x2c]
dec ecx
movsx eax, cx
cdq
xor eax, edx
sub eax, edx
mov edx, dword [esp + 0x14]
cwde
sub edx, eax
mov eax, dword [esp + 0x10]
mov dword [esp + 0x14], edx
mov word [esi + eax*2], cx
inc eax
mov dword [esp + 0x10], eax
xor eax, eax
test cx, cx
sete al
mov dword [esp + 0x24], eax
cmp edx, edi
jge 0x516557
mov eax, dword [esp + 0x18]
sar edi, 1
dec eax
cmp edx, edi
jl 0x516548
mov dword [esp + 0x18], eax
mov dword [esp + 0x1c], edi
mov edx, dword [esp + 0x38]
add edx, dword [esp + 0x3c]
lea eax, [edx - 7]
cmp ebp, eax
jbe 0x516580
mov eax, ebx
lea ecx, [edx - 4]
sar eax, 3
add eax, ebp
cmp eax, ecx
jbe 0x516580
sub ebp, edx
lea ebx, [ebx + ebp*8]
mov ebp, ecx
add ebx, 0x20
jmp 0x51658a
mov eax, ebx
sar eax, 3
add ebp, eax
and ebx, 7
push ebp
call fcn.0050707e
pop ecx
mov ecx, ebx
mov esi, eax
mov eax, dword [esp + 0x14]
and ecx, 0x1f
shr esi, cl
cmp eax, 1
jg 0x5163c6
mov ecx, dword [esp + 0x10]
mov edx, dword [esp + 0x30]
cmp eax, 1
je 0x5165c1
or eax, 0xffffffff
jmp 0x5165e1
push 0xffffffffffffffd0
jmp 0x5165e0
xor ecx, ecx
jmp 0x5165ab
lea eax, [ecx - 1]
mov dword [edx], eax
lea eax, [ebx + 7]
sar eax, 3
sub eax, dword [esp + 0x38]
add eax, ebp
cmp eax, dword [esp + 0x3c]
push 0xffffffffffffffb8
pop ecx
cmova eax, ecx
jmp 0x5165e1
push 0xffffffffffffffb8
pop eax
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x18
ret