Function at 0x51fa98
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 0x51fad3
mov edx, dword [ebp - 8]
cmp byte [edx], 0
jne 0x51fad3
mov eax, dword [ebp - 8]
mov eax, dword [eax + 1]
cmp eax, 0x80
je 0x51fadd
cmp eax, 0xc0
je 0x51fadd
cmp eax, 0x100
je 0x51fadd
mov eax, 0xfffffffe
jmp 0x51fd4e
cmp dword [ebp - 4], 0
je 0x51fb12
mov eax, dword [ebp - 4]
mov al, byte [eax]
cmp al, 1
je 0x51faf4
cmp al, 2
je 0x51faf4
cmp al, 3
jne 0x51fb12
mov eax, dword [ebp - 4]
mov edx, dword [eax + 0x11]
cmp edx, 0x80
je 0x51fb1c
cmp edx, 0xc0
je 0x51fb1c
cmp edx, 0x100
je 0x51fb1c
mov eax, 0xfffffffb
jmp 0x51fd4e
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 0x51fb41
dec al
je 0x51fc03
jmp 0x51fd3e
mov eax, dword [ebp - 0x10]
dec eax
test eax, eax
jl 0x51fd45
inc eax
mov dword [ebp - 0x14], eax
mov eax, dword [ebp - 4]
mov eax, dword [eax + 0x11]
test eax, eax
jns 0x51fb5e
add eax, 0x1f
sar eax, 5
dec eax
test eax, eax
jl 0x51fb95
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 0x51fb73
inc edx
inc esi
dec dword [ebp - 0x18]
jne 0x51fb6f
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.0051f67c
mov eax, dword [ebp - 4]
mov eax, dword [eax + 0x11]
test eax, eax
jns 0x51fbbd
add eax, 0x1f
sar eax, 5
dec eax
test eax, eax
jl 0x51fbf5
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 0x51fbd2
inc edx
inc esi
dec dword [ebp - 0x18]
jne 0x51fbce
dec dword [ebp - 0x14]
jne 0x51fb51
jmp 0x51fd45
test ecx, ecx
jns 0x51fc0a
add ecx, 0x1f
sar ecx, 5
dec ecx
test ecx, ecx
jl 0x51fc42
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 0x51fc1f
inc edx
inc esi
dec dword [ebp - 0x14]
jne 0x51fc1b
mov eax, dword [ebp - 0x10]
dec eax
test eax, eax
jl 0x51fd45
inc eax
mov dword [ebp - 0x14], eax
xor ebx, ebx
mov eax, dword [ebp - 4]
mov eax, dword [eax + 0x11]
test eax, eax
jns 0x51fc61
add eax, 0x1f
sar eax, 5
dec eax
test eax, eax
jl 0x51fcb5
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 0x51fc89
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 0x51fc7c
inc edx
inc dword [ebp - 0x1c]
dec dword [ebp - 0x18]
jne 0x51fc75
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.0051f67c
mov eax, dword [ebp - 4]
mov eax, dword [eax + 0x11]
test eax, eax
jns 0x51fcdd
add eax, 0x1f
sar eax, 5
dec eax
test eax, eax
jl 0x51fd32
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 0x51fd05
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 0x51fcf8
inc edx
inc dword [ebp - 0x20]
dec dword [ebp - 0x18]
jne 0x51fcf1
inc ebx
dec dword [ebp - 0x14]
jne 0x51fc54
jmp 0x51fd45
mov eax, 0xfffffffb
jmp 0x51fd4e
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