Function at 0x51f7e0
Capabilities:
Encrypt data using rc4 prga

Disassembly:
push ebp
push ebx
push edi
push esi
sub esp, 0x1c
cmp dword [esp + 0x30], 0
mov dword [esp + 0x10], edx
js 0x51fdbb
mov eax, dword [esp + 0x10]
mov dword [esp], ecx
mov esi, 0x8a
mov ecx, 7
mov edx, 4
mov edi, 0xffffffff
movzx ebp, word [eax + 2]
xor eax, eax
test bp, bp
sete al
cmove ecx, esi
xor esi, esi
sub edx, eax
mov eax, dword [esp]
mov dword [esp + 4], edx
xor edx, edx
jmp 0x51f858
xor ecx, ecx
cmp ebx, ebp
mov edx, 4
sete cl
sub edx, ecx
xor ecx, 7
mov dword [esp + 4], edx
mov edi, ebx
mov edx, dword [esp + 0x18]
cmp edx, dword [esp + 0x30]
lea edx, [edx + 1]
je 0x51fdbb
mov ebx, ebp
mov ebp, dword [esp + 0x10]
mov dword [esp + 8], esi
inc esi
mov dword [esp + 0x18], edx
cmp esi, ecx
movzx ebp, word [ebp + edx*4 + 6]
jge 0x51f874
cmp ebx, ebp
je 0x51f847
cmp esi, dword [esp + 4]
mov dword [esp + 0x14], ebp
mov dword [esp + 0xc], ebx
jge 0x51f940
mov ecx, dword [eax + 0x170c]
jmp 0x51f8a3
add ecx, edx
mov ebx, dword [esp + 0xc]
dec esi
mov dword [eax + 0x170c], ecx
je 0x51fd9a
movzx edi, word [eax + ebx*4 + 0xacc]
movzx edx, word [eax + ebx*4 + 0xace]
mov ebp, 0x10
mov ebx, edi
sub ebp, edx
shl ebx, cl
or bx, word [eax + 0x1708]
cmp ecx, ebp
mov word [eax + 0x1708], bx
jle 0x51f890
mov ecx, dword [eax + 8]
mov ebp, dword [eax + 0x14]
mov dword [esp + 8], ecx
mov ecx, dword [esp]
lea eax, [ebp + 1]
mov dword [ecx + 0x14], eax
mov eax, dword [esp + 8]
mov ecx, dword [esp]
mov byte [eax + ebp], bl
mov eax, dword [esp]
mov ebx, dword [esp]
mov ecx, dword [ecx + 8]
movzx eax, byte [eax + 0x1709]
mov ebx, dword [ebx + 0x14]
mov byte [esp + 8], al
mov eax, dword [esp]
lea ebp, [ebx + 1]
mov dword [eax + 0x14], ebp
movzx eax, byte [esp + 8]
mov byte [ecx + ebx], al
mov eax, dword [esp]
mov cl, 0x10
mov ebx, dword [eax + 0x170c]
sub cl, bl
shr edi, cl
lea ecx, [edx + ebx - 0x10]
mov word [eax + 0x1708], di
jmp 0x51f892
test ebx, ebx
je 0x51f957
cmp ebx, edi
jne 0x51fa0a
mov edx, dword [eax + 0x170c]
jmp 0x51fb5a
mov esi, dword [esp + 8]
cmp esi, 9
jg 0x51faa4
mov ecx, dword [esp]
mov edx, dword [eax + 0x170c]
movzx ebp, word [eax + 0xb12]
mov eax, 0x10
movzx edi, word [ecx + 0xb10]
mov ecx, edx
sub eax, ebp
mov ebx, edi
shl ebx, cl
mov ecx, dword [esp]
or bx, word [ecx + 0x1708]
cmp edx, eax
mov eax, dword [esp]
mov word [eax + 0x1708], bx
jle 0x51fc82
mov ecx, dword [esp]
mov eax, dword [esp]
mov edx, dword [esp]
mov dword [esp + 4], ebp
mov esi, dword [esp + 8]
mov ecx, dword [ecx + 0x14]
mov eax, dword [eax + 8]
lea ebp, [ecx + 1]
mov dword [edx + 0x14], ebp
mov edx, dword [esp]
mov byte [eax + ecx], bl
mov eax, dword [esp]
mov ecx, dword [esp]
mov ebx, dword [edx + 0x14]
mov al, byte [eax + 0x1709]
mov ecx, dword [ecx + 8]
mov edx, dword [esp]
lea ebp, [ebx + 1]
mov dword [edx + 0x14], ebp
mov byte [ecx + ebx], al
mov eax, dword [esp]
mov cl, 0x10
mov ebx, dword [eax + 0x170c]
sub cl, bl
shr edi, cl
mov ecx, dword [esp + 4]
mov word [eax + 0x1708], di
lea ecx, [ecx + ebx - 0x10]
mov ebx, edi
jmp 0x51fc86
mov ecx, dword [esp]
mov edx, dword [eax + 0x170c]
movzx esi, word [eax + ebx*4 + 0xace]
mov ebp, dword [esp]
mov eax, 0x10
movzx edi, word [ecx + ebx*4 + 0xacc]
mov ecx, edx
sub eax, esi
mov ebx, edi
shl ebx, cl
or bx, word [ebp + 0x1708]
cmp edx, eax
mov eax, dword [esp]
mov word [eax + 0x1708], bx
jle 0x51fb4a
mov ecx, dword [esp]
mov eax, dword [esp]
mov edx, dword [esp]
mov ecx, dword [ecx + 0x14]
mov eax, dword [eax + 8]
lea ebp, [ecx + 1]
mov dword [edx + 0x14], ebp
mov edx, dword [esp]
mov byte [eax + ecx], bl
mov eax, dword [esp]
mov ecx, dword [esp]
mov ebx, dword [edx + 0x14]
mov al, byte [eax + 0x1709]
mov ecx, dword [ecx + 8]
mov edx, dword [esp]
lea ebp, [ebx + 1]
mov dword [edx + 0x14], ebp
mov byte [ecx + ebx], al
mov eax, dword [esp]
mov cl, 0x10
mov ebx, dword [eax + 0x170c]
sub cl, bl
shr edi, cl
lea ecx, [esi + ebx - 0x10]
mov word [eax + 0x1708], di
jmp 0x51fb4e
movzx ecx, word [eax + 0xb16]
mov edx, dword [eax + 0x170c]
mov eax, 0x10
mov ebp, dword [esp]
mov dword [esp + 4], ecx
sub eax, ecx
mov ecx, dword [esp]
movzx edi, word [ecx + 0xb14]
mov ecx, edx
mov ebx, edi
shl ebx, cl
or bx, word [ebp + 0x1708]
cmp edx, eax
mov eax, dword [esp]
mov word [eax + 0x1708], bx
jle 0x51fd07
mov ecx, dword [esp]
mov eax, dword [esp]
mov edx, dword [esp]
mov esi, dword [esp + 8]
mov ecx, dword [ecx + 0x14]
mov eax, dword [eax + 8]
lea ebp, [ecx + 1]
mov dword [edx + 0x14], ebp
mov edx, dword [esp]
mov byte [eax + ecx], bl
mov eax, dword [esp]
mov ecx, dword [esp]
mov ebx, dword [edx + 0x14]
mov al, byte [eax + 0x1709]
mov ecx, dword [ecx + 8]
mov edx, dword [esp]
lea ebp, [ebx + 1]
mov dword [edx + 0x14], ebp
mov byte [ecx + ebx], al
mov eax, dword [esp]
mov cl, 0x10
mov ebx, dword [eax + 0x170c]
sub cl, bl
shr edi, cl
mov ecx, dword [esp + 4]
mov word [eax + 0x1708], di
lea ecx, [ecx + ebx - 0x10]
mov ebx, edi
jmp 0x51fd0d
mov ecx, edx
add ecx, esi
mov esi, dword [esp + 8]
mov edx, ecx
mov dword [eax + 0x170c], ecx
movzx ecx, word [eax + 0xb0e]
mov eax, 0x10
mov ebp, dword [esp]
mov dword [esp + 4], ecx
sub eax, ecx
mov ecx, dword [esp]
movzx edi, word [ecx + 0xb0c]
mov ecx, edx
mov ebx, edi
shl ebx, cl
or bx, word [ebp + 0x1708]
cmp edx, eax
mov eax, dword [esp]
mov word [eax + 0x1708], bx
jle 0x51fbf7
mov ecx, dword [esp]
mov eax, dword [esp]
mov edx, dword [esp]
mov dword [esp + 8], esi
mov esi, dword [esp + 8]
mov ecx, dword [ecx + 0x14]
mov eax, dword [eax + 8]
lea ebp, [ecx + 1]
mov dword [edx + 0x14], ebp
mov edx, dword [esp]
mov byte [eax + ecx], bl
mov eax, dword [esp]
mov ecx, dword [esp]
mov ebx, dword [edx + 0x14]
mov al, byte [eax + 0x1709]
mov ecx, dword [ecx + 8]
mov edx, dword [esp]
lea ebp, [ebx + 1]
mov dword [edx + 0x14], ebp
mov byte [ecx + ebx], al
mov eax, dword [esp]
mov cl, 0x10
mov ebx, dword [eax + 0x170c]
sub cl, bl
shr edi, cl
mov ecx, dword [esp + 4]
mov word [eax + 0x1708], di
lea ecx, [ecx + ebx - 0x10]
mov ebx, edi
jmp 0x51fbfd
mov ecx, edx
add ecx, dword [esp + 4]
add esi, 0xfffd
mov dword [eax + 0x170c], ecx
movzx edx, si
mov eax, edx
shl eax, cl
or ebx, eax
mov eax, dword [esp]
cmp ecx, 0xf
mov word [eax + 0x1708], bx
jl 0x51fc7a
mov ecx, dword [esp]
mov eax, dword [esp]
mov edi, dword [esp]
mov ecx, dword [ecx + 0x14]
mov eax, dword [eax + 8]
lea esi, [ecx + 1]
mov dword [edi + 0x14], esi
mov esi, dword [esp]
mov byte [eax + ecx], bl
mov eax, dword [esp]
mov ecx, dword [esp]
mov ebx, dword [esp]
mov esi, dword [esi + 0x14]
mov al, byte [eax + 0x1709]
mov ecx, dword [ecx + 8]
lea edi, [esi + 1]
mov dword [ebx + 0x14], edi
mov byte [ecx + esi], al
mov eax, dword [esp]
mov cl, 0x10
mov ebx, dword [eax + 0x170c]
sub cl, bl
shr edx, cl
mov ecx, ebx
mov word [eax + 0x1708], dx
add ecx, 0xfffffff2
jmp 0x51fd90
add ecx, 2
jmp 0x51fd90
mov ecx, edx
add ecx, ebp
add esi, 0xfffe
mov dword [eax + 0x170c], ecx
movzx edx, si
mov eax, edx
shl eax, cl
or ebx, eax
mov eax, dword [esp]
cmp ecx, 0xe
mov word [eax + 0x1708], bx
jl 0x51fd87
mov ecx, dword [esp]
mov eax, dword [esp]
mov edi, dword [esp]
mov ecx, dword [ecx + 0x14]
mov eax, dword [eax + 8]
lea esi, [ecx + 1]
mov dword [edi + 0x14], esi
mov esi, dword [esp]
mov byte [eax + ecx], bl
mov eax, dword [esp]
mov ecx, dword [esp]
mov ebx, dword [esp]
mov esi, dword [esi + 0x14]
mov al, byte [eax + 0x1709]
mov ecx, dword [ecx + 8]
lea edi, [esi + 1]
mov dword [ebx + 0x14], edi
mov byte [ecx + esi], al
mov eax, dword [esp]
mov cl, 0x10
mov ebx, dword [eax + 0x170c]
sub cl, bl
shr edx, cl
mov ecx, ebx
mov word [eax + 0x1708], dx
add ecx, 0xfffffff3
jmp 0x51fd90
mov ecx, edx
add ecx, dword [esp + 4]
add esi, 0xfff6
mov dword [eax + 0x170c], ecx
movzx edx, si
mov eax, edx
shl eax, cl
or ebx, eax
mov eax, dword [esp]
cmp ecx, 0xa
mov word [eax + 0x1708], bx
jl 0x51fd8c
mov ecx, dword [esp]
mov eax, dword [esp]
mov edi, dword [esp]
mov ecx, dword [ecx + 0x14]
mov eax, dword [eax + 8]
lea esi, [ecx + 1]
mov dword [edi + 0x14], esi
mov esi, dword [esp]
mov byte [eax + ecx], bl
mov eax, dword [esp]
mov ecx, dword [esp]
mov ebx, dword [esp]
mov esi, dword [esi + 0x14]
mov al, byte [eax + 0x1709]
mov ecx, dword [ecx + 8]
lea edi, [esi + 1]
mov dword [ebx + 0x14], edi
mov byte [ecx + esi], al
mov eax, dword [esp]
mov cl, 0x10
mov ebx, dword [eax + 0x170c]
sub cl, bl
shr edx, cl
mov ecx, ebx
mov word [eax + 0x1708], dx
add ecx, 0xfffffff7
jmp 0x51fd90
add ecx, 3
jmp 0x51fd90
add ecx, 7
nop
mov ebx, dword [esp + 0xc]
mov dword [eax + 0x170c], ecx
mov ebp, dword [esp + 0x14]
xor esi, esi
test bp, bp
jne 0x51f830
mov ecx, 0x8a
mov dword [esp + 4], 3
jmp 0x51f845
add esp, 0x1c
pop esi
pop edi
pop ebx
pop ebp
ret