Function at 0x51dbac
Capabilities:
Encrypt data using rc4 prga

Disassembly:
add esp, 0xffffffe8
mov dword [esp], eax
mov eax, dword [esp]
mov edx, dword [eax + 0x1e]
mov dword [esp + 0x14], edx
mov ecx, dword [esp]
mov edx, dword [esp]
mov eax, dword [ecx + 0x2e]
mov ecx, dword [esp]
sub eax, dword [edx + 0x66]
sub eax, dword [ecx + 0x5e]
mov dword [esp + 0x10], eax
cmp dword [esp + 0x10], 0
jne 0x51dbf8
mov eax, dword [esp]
cmp dword [eax + 0x5e], 0
jne 0x51dbf8
mov edx, dword [esp]
cmp dword [edx + 0x66], 0
jne 0x51dbf8
mov ecx, dword [esp + 0x14]
mov dword [esp + 0x10], ecx
jmp 0x51dd07
cmp dword [esp + 0x10], 0xffffffff
jne 0x51dc08
dec dword [esp + 0x10]
jmp 0x51dd07
mov eax, dword [esp]
mov ecx, dword [esp]
mov edx, dword [eax + 0x1e]
sub edx, 0x106
add edx, dword [esp + 0x14]
cmp edx, dword [ecx + 0x5e]
ja 0x51dd07
mov eax, dword [esp + 0x14]
push eax
mov edx, dword [esp + 4]
mov ecx, dword [edx + 0x2a]
add ecx, dword [esp + 0x18]
push ecx
mov eax, dword [esp + 8]
mov edx, dword [eax + 0x2a]
push edx
call fcn.0051c580
add esp, 0xc
mov eax, dword [esp]
mov ecx, dword [esp + 0x14]
sub dword [eax + 0x62], ecx
mov ecx, dword [esp]
mov edx, dword [esp + 0x14]
sub dword [ecx + 0x5e], edx
mov edx, dword [esp]
mov eax, dword [esp + 0x14]
sub dword [edx + 0x4e], eax
mov ecx, dword [esp]
mov eax, dword [ecx + 0x3e]
mov dword [esp + 4], eax
mov ecx, dword [esp]
mov edx, dword [esp + 4]
add edx, edx
add edx, dword [ecx + 0x36]
mov dword [esp + 0xc], edx
sub dword [esp + 0xc], 2
mov eax, dword [esp + 0xc]
movzx edx, word [eax]
mov dword [esp + 8], edx
mov ecx, dword [esp + 8]
cmp ecx, dword [esp + 0x14]
jb 0x51dca3
mov ax, word [esp + 8]
sub ax, word [esp + 0x14]
jmp 0x51dca5
xor eax, eax
mov edx, dword [esp + 0xc]
mov word [edx], ax
dec dword [esp + 4]
jne 0x51dc7d
mov ecx, dword [esp + 0x14]
mov dword [esp + 4], ecx
mov edx, dword [esp]
mov eax, dword [esp + 4]
add eax, eax
add eax, dword [edx + 0x32]
mov dword [esp + 0xc], eax
sub dword [esp + 0xc], 2
mov ecx, dword [esp + 0xc]
movzx eax, word [ecx]
mov dword [esp + 8], eax
mov edx, dword [esp + 8]
cmp edx, dword [esp + 0x14]
jb 0x51dcf0
mov cx, word [esp + 8]
sub cx, word [esp + 0x14]
jmp 0x51dcf2
xor ecx, ecx
mov eax, dword [esp + 0xc]
mov word [eax], cx
dec dword [esp + 4]
jne 0x51dcca
mov edx, dword [esp + 0x14]
add dword [esp + 0x10], edx
mov eax, dword [esp]
mov edx, dword [eax]
cmp dword [edx + 4], 0
je 0x51ddab
mov ecx, dword [esp]
mov eax, dword [esp]
mov edx, dword [ecx + 0x2a]
mov ecx, dword [esp]
add edx, dword [eax + 0x5e]
mov eax, dword [esp]
add edx, dword [ecx + 0x66]
mov ecx, dword [esp + 0x10]
mov eax, dword [eax]
call fcn.0051d780
mov dword [esp + 4], eax
mov edx, dword [esp + 4]
mov ecx, dword [esp]
add dword [ecx + 0x66], edx
mov eax, dword [esp]
cmp dword [eax + 0x66], 3
jb 0x51dd90
mov edx, dword [esp]
mov eax, dword [esp]
mov ecx, dword [edx + 0x2a]
mov edx, dword [eax + 0x5e]
mov eax, dword [esp]
movzx ecx, byte [ecx + edx]
mov dword [eax + 0x3a], ecx
mov edx, dword [esp]
mov eax, dword [esp]
mov ecx, dword [edx + 0x4a]
mov edx, dword [eax + 0x3a]
shl edx, cl
mov ecx, dword [esp]
mov eax, dword [ecx + 0x2a]
mov ecx, dword [esp]
mov ecx, dword [ecx + 0x5e]
movzx eax, byte [eax + ecx + 1]
xor edx, eax
mov eax, dword [esp]
mov ecx, dword [esp]
and edx, dword [eax + 0x46]
mov dword [ecx + 0x3a], edx
mov edx, dword [esp]
cmp dword [edx + 0x66], 0x106
jae 0x51ddab
mov eax, dword [esp]
mov edx, dword [eax]
cmp dword [edx + 4], 0
jne 0x51dbbc
add esp, 0x18
ret