Function at 0x51fac0
Capabilities:
Encrypt data using rc4 ksa

Disassembly:
push ebp
mov ebp, esp
add esp, 0xffffffc0
push ebx
push esi
push edi
mov dword [ebp - 0xc], ecx
mov dword [ebp - 8], edx
mov dword [ebp - 4], eax
cmp dword [ebp - 8], 0
je 0x51fafb
mov edx, dword [ebp - 8]
cmp byte [edx], 0
jne 0x51fafb
mov eax, dword [ebp - 8]
mov eax, dword [eax + 1]
cmp eax, 0x80
je 0x51fb05
cmp eax, 0xc0
je 0x51fb05
cmp eax, 0x100
je 0x51fb05
mov eax, 0xfffffffe
jmp 0x51fd76
cmp dword [ebp - 4], 0
je 0x51fb3a
mov eax, dword [ebp - 4]
mov al, byte [eax]
cmp al, 1
je 0x51fb1c
cmp al, 2
je 0x51fb1c
cmp al, 3
jne 0x51fb3a
mov eax, dword [ebp - 4]
mov edx, dword [eax + 0x11]
cmp edx, 0x80
je 0x51fb44
cmp edx, 0xc0
je 0x51fb44
cmp edx, 0x100
je 0x51fb44
mov eax, 0xfffffffb
jmp 0x51fd76
mov eax, dword [ebp - 4]
mov ecx, dword [eax + 0x11]
mov eax, dword [ebp + 0xc]
cdq
idiv ecx
mov dword [ebp - 0x10], eax
mov eax, dword [ebp - 4]
mov al, byte [eax]
dec al
je 0x51fb69
dec al
je 0x51fc2b
jmp 0x51fd66
mov eax, dword [ebp - 0x10]
dec eax
test eax, eax
jl 0x51fd6d
inc eax
mov dword [ebp - 0x14], eax
mov eax, dword [ebp - 4]
mov eax, dword [eax + 0x11]
test eax, eax
jns 0x51fb86
add eax, 0x1f
sar eax, 5
dec eax
test eax, eax
jl 0x51fbbd
inc eax
mov dword [ebp - 0x18], eax
xor edx, edx
lea esi, [ebp - 0x40]
xor eax, eax
mov ecx, esi
mov ebx, edx
shl ebx, 2
add ebx, eax
mov edi, dword [ebp - 0xc]
mov bl, byte [edi + ebx]
and bl, 0xff
mov byte [ecx], bl
inc eax
add ecx, 8
cmp eax, 4
jne 0x51fb9b
inc edx
inc esi
dec dword [ebp - 0x18]
jne 0x51fb97
mov eax, dword [ebp - 8]
add eax, 0x4a
push eax
mov eax, dword [ebp - 4]
mov ecx, dword [eax + 0x11]
mov eax, dword [ebp - 8]
mov edx, dword [eax + 1]
lea eax, [ebp - 0x40]
call fcn.0051f6a4
mov eax, dword [ebp - 4]
mov eax, dword [eax + 0x11]
test eax, eax
jns 0x51fbe5
add eax, 0x1f
sar eax, 5
dec eax
test eax, eax
jl 0x51fc1d
inc eax
mov dword [ebp - 0x18], eax
xor edx, edx
lea esi, [ebp - 0x40]
xor eax, eax
mov ecx, esi
mov ebx, edx
shl ebx, 2
add ebx, eax
mov edi, dword [ebp + 8]
lea ebx, [edi + ebx]
push ebx
mov bl, byte [ecx]
pop edi
mov byte [edi], bl
inc eax
add ecx, 8
cmp eax, 4
jne 0x51fbfa
inc edx
inc esi
dec dword [ebp - 0x18]
jne 0x51fbf6
dec dword [ebp - 0x14]
jne 0x51fb79
jmp 0x51fd6d
test ecx, ecx
jns 0x51fc32
add ecx, 0x1f
sar ecx, 5
dec ecx
test ecx, ecx
jl 0x51fc6a
inc ecx
mov dword [ebp - 0x14], ecx
xor edx, edx
lea esi, [ebp - 0x40]
xor eax, eax
mov ecx, esi
mov ebx, edx
shl ebx, 2
add ebx, eax
mov edi, dword [ebp - 4]
mov bl, byte [edi + ebx + 1]
and bl, 0xff
mov byte [ecx], bl
inc eax
add ecx, 8
cmp eax, 4
jne 0x51fc47
inc edx
inc esi
dec dword [ebp - 0x14]
jne 0x51fc43
mov eax, dword [ebp - 0x10]
dec eax
test eax, eax
jl 0x51fd6d
inc eax
mov dword [ebp - 0x14], eax
xor ebx, ebx
mov eax, dword [ebp - 4]
mov eax, dword [eax + 0x11]
test eax, eax
jns 0x51fc89
add eax, 0x1f
sar eax, 5
dec eax
test eax, eax
jl 0x51fcdd
inc eax
mov dword [ebp - 0x18], eax
xor edx, edx
lea eax, [ebp - 0x40]
mov dword [ebp - 0x1c], eax
xor eax, eax
mov ecx, dword [ebp - 0x1c]
mov esi, ecx
mov ecx, dword [ebp - 4]
mov ecx, dword [ecx + 0x11]
test ecx, ecx
jns 0x51fcb1
add ecx, 7
sar ecx, 3
imul ecx, ebx
mov edi, edx
shl edi, 2
add ecx, edi
add ecx, eax
mov edi, dword [ebp - 0xc]
mov cl, byte [edi + ecx]
and cl, 0xff
xor byte [esi], cl
inc eax
add esi, 8
cmp eax, 4
jne 0x51fca4
inc edx
inc dword [ebp - 0x1c]
dec dword [ebp - 0x18]
jne 0x51fc9d
mov eax, dword [ebp - 8]
add eax, 0x4a
push eax
mov eax, dword [ebp - 4]
mov ecx, dword [eax + 0x11]
mov eax, dword [ebp - 8]
mov edx, dword [eax + 1]
lea eax, [ebp - 0x40]
call fcn.0051f6a4
mov eax, dword [ebp - 4]
mov eax, dword [eax + 0x11]
test eax, eax
jns 0x51fd05
add eax, 0x1f
sar eax, 5
dec eax
test eax, eax
jl 0x51fd5a
inc eax
mov dword [ebp - 0x18], eax
xor edx, edx
lea eax, [ebp - 0x40]
mov dword [ebp - 0x20], eax
xor eax, eax
mov ecx, dword [ebp - 0x20]
mov esi, ecx
mov ecx, dword [ebp - 4]
mov ecx, dword [ecx + 0x11]
test ecx, ecx
jns 0x51fd2d
add ecx, 7
sar ecx, 3
imul ecx, ebx
mov edi, edx
shl edi, 2
add ecx, edi
add ecx, eax
mov edi, dword [ebp + 8]
lea ecx, [edi + ecx]
push ecx
mov cl, byte [esi]
pop edi
mov byte [edi], cl
inc eax
add esi, 8
cmp eax, 4
jne 0x51fd20
inc edx
inc dword [ebp - 0x20]
dec dword [ebp - 0x18]
jne 0x51fd19
inc ebx
dec dword [ebp - 0x14]
jne 0x51fc7c
jmp 0x51fd6d
mov eax, 0xfffffffb
jmp 0x51fd76
mov eax, dword [ebp - 4]
mov eax, dword [eax + 0x11]
imul dword [ebp - 0x10]
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret 8