Function at 0x50873a
Capabilities:
Encrypt data using rc4 ksa

Disassembly:
push ebp
mov ebp, esp
mov eax, dword [edi]
sub esp, 0xb8
push ebx
mov ebx, dword [ebp + 0x14]
push esi
xor esi, esi
mov dword [eax + 8], esi
cmp ebx, 4
ja 0x508d20
mov eax, edi
call fcn.00507e49
test eax, eax
jne 0x50876f
mov eax, edi
call fcn.00508714
jmp 0x508d2a
cmp ebx, esi
je 0x508778
mov dword [ebp - 0xc], ebx
jmp 0x50878a
mov eax, dword [edi]
xor ecx, ecx
cmp dword [eax + 8], 3
setge cl
lea ecx, [ecx + ecx + 1]
mov dword [ebp - 0xc], ecx
mov eax, dword [edi]
mov eax, dword [eax + 8]
xor edx, edx
push 3
pop ecx
inc edx
cmp eax, ecx
jne 0x5087b6
cmp dword [edi + 0x47ec], ecx
je 0x5087b1
cmp dword [edi + 0x47e8], esi
jne 0x5087b6
cmp dword [edi + 0x47e4], esi
jne 0x5087b6
mov dword [ebp - 0x28], edx
jmp 0x5087b9
mov dword [ebp - 0x28], esi
cmp eax, ecx
jne 0x5087ca
cmp dword [ebp - 0xc], ecx
jge 0x5087ca
mov dword [ebp - 0x10], edx
cmp dword [ebp - 0x28], esi
je 0x5087cd
mov dword [ebp - 0x10], eax
cmp dword [ebp - 0x10], esi
mov dword [ebp - 0x20], esi
mov dword [ebp - 0x1c], esi
mov dword [ebp - 0x18], esi
mov dword [ebp - 0x14], esi
mov dword [ebp + 0x14], esi
jle 0x5088b0
lea esi, [ebp - 0xa8]
lea ebx, [edi + 0x46a0]
mov eax, dword [edi]
mov eax, dword [eax]
add eax, 3
push eax
call fcn.00503ecc
pop ecx
mov dword [ebx + 0x34], eax
test eax, eax
je 0x50891b
mov eax, dword [edi + 0x4684]
cdq
idiv dword [ebx]
and dword [esi + 0xc], 0
mov ecx, eax
mov eax, dword [edi + 0x4688]
cdq
idiv dword [ebx + 4]
xor edx, edx
mov dword [esi - 4], ecx
mov dword [ebp - 8], eax
mov dword [esi], eax
sar eax, 1
mov dword [esi + 8], eax
mov eax, dword [edi]
mov eax, dword [eax]
lea eax, [eax + ecx - 1]
div ecx
mov dword [esi + 4], eax
mov eax, dword [ebx + 0x28]
mov dword [esi - 8], eax
mov dword [esi - 0xc], eax
cmp ecx, 1
jne 0x50886a
cmp dword [ebp - 8], ecx
jne 0x50885b
mov dword [esi - 0x10], 0x507fc6
jmp 0x508896
cmp dword [ebp - 8], 2
jne 0x50886a
mov dword [esi - 0x10], 0x507fce
jmp 0x508896
cmp ecx, 2
jne 0x50888f
cmp dword [ebp - 8], 1
jne 0x50887e
mov dword [esi - 0x10], 0x508008
jmp 0x508896
cmp dword [ebp - 8], 2
jne 0x50888f
mov eax, dword [edi + 0x4814]
mov dword [esi - 0x10], eax
jmp 0x508896
mov dword [esi - 0x10], 0x508312
inc dword [ebp + 0x14]
mov eax, dword [ebp + 0x14]
add esi, 0x20
add ebx, 0x48
cmp eax, dword [ebp - 0x10]
jl 0x5087f1
xor edx, edx
xor esi, esi
inc edx
mov eax, dword [edi]
push edx
push dword [eax + 4]
push dword [eax]
mov eax, dword [ebp - 0xc]
call fcn.0050401a
add esp, 0xc
mov dword [ebp - 0x30], eax
cmp eax, esi
je 0x50891b
mov eax, dword [edi]
mov dword [ebp - 0x24], esi
cmp dword [eax + 4], esi
jbe 0x508ce9
mov esi, dword [eax]
imul esi, dword [ebp - 0x24]
imul esi, dword [ebp - 0xc]
add esi, dword [ebp - 0x30]
and dword [ebp + 0x14], 0
cmp dword [ebp - 0x10], 0
jle 0x508994
lea eax, [edi + 0x46bc]
mov dword [ebp - 8], eax
lea ebx, [ebp - 0xa0]
mov eax, dword [ebx - 8]
mov ecx, dword [ebx]
sar eax, 1
xor edx, edx
cmp ecx, eax
setge dl
mov eax, edx
test eax, eax
je 0x50892c
mov ecx, dword [ebx - 0x14]
jmp 0x50892f
mov eax, edi
call fcn.00508714
mov eax, 0x567ce8
jmp 0x508d25
mov ecx, dword [ebx - 0x10]
test eax, eax
je 0x508938
mov eax, dword [ebx - 0x10]
jmp 0x50893b
mov eax, dword [ebx - 0x14]
push dword [ebx - 0xc]
push dword [ebx - 4]
push ecx
push eax
mov eax, dword [ebp - 8]
push dword [eax + 0x18]
call dword [ebx - 0x18]
mov ecx, dword [ebp + 0x14]
mov dword [ebp + ecx*4 - 0x20], eax
mov eax, dword [ebx]
add esp, 0x14
inc eax
cmp eax, dword [ebx - 8]
mov dword [ebx], eax
jl 0x50897e
and dword [ebx], 0
inc dword [ebx + 4]
mov ecx, dword [ebx + 4]
mov edx, dword [ebp - 8]
cmp ecx, dword [edx]
mov eax, dword [ebx - 0x10]
mov dword [ebx - 0x14], eax
jge 0x50897e
mov ecx, dword [edx + 4]
add ecx, eax
mov dword [ebx - 0x10], ecx
inc dword [ebp + 0x14]
mov eax, dword [ebp + 0x14]
add dword [ebp - 8], 0x48
add ebx, 0x20
cmp eax, dword [ebp - 0x10]
jl 0x508902
cmp dword [ebp - 0xc], 3
mov edx, dword [ebp - 0x20]
mov ecx, dword [ebp - 0x1c]
mov eax, dword [edi]
jl 0x508b26
mov ebx, dword [eax + 8]
cmp ebx, 3
jne 0x508a14
cmp dword [ebp - 0x28], 0
je 0x5089fb
and dword [ebp - 4], 0
cmp dword [eax], 0
jbe 0x508cd6
mov ebx, dword [ebp - 0x18]
sub edx, ecx
sub ebx, ecx
mov eax, ecx
mov dword [ebp - 8], ebx
jmp 0x5089d2
mov ebx, dword [ebp - 8]
mov cl, byte [edx + eax]
mov byte [esi], cl
mov cl, byte [eax]
mov byte [esi + 1], cl
mov cl, byte [ebx + eax]
mov byte [esi + 2], cl
mov byte [esi + 3], 0xff
add esi, dword [ebp - 0xc]
inc dword [ebp - 4]
mov ecx, dword [edi]
mov ebx, dword [ebp - 4]
inc eax
cmp ebx, dword [ecx]
jb 0x5089cf
jmp 0x508cd6
push dword [ebp - 0xc]
push dword [eax]
push dword [ebp - 0x18]
push ecx
push edx
push esi
call dword [edi + 0x4810]
add esp, 0x18
jmp 0x508cd6
cmp ebx, 4
jne 0x508afe
mov ebx, dword [edi + 0x47e8]
test ebx, ebx
jne 0x508a92
and dword [ebp - 4], ebx
cmp dword [eax], ebx
jbe 0x508cd6
mov eax, dword [ebp - 0x14]
sub eax, edx
mov dword [ebp - 8], eax
mov eax, dword [ebp - 0x18]
mov dword [ebp + 0x14], ecx
sub dword [ebp + 0x14], edx
sub eax, edx
mov dword [ebp - 0x2c], eax
mov eax, dword [ebp - 8]
mov bl, byte [eax + edx]
mov cl, byte [edx]
mov al, bl
call fcn.00508723
mov ecx, dword [ebp + 0x14]
mov byte [esi], al
mov cl, byte [ecx + edx]
mov al, bl
call fcn.00508723
mov ecx, dword [ebp - 0x2c]
mov byte [esi + 1], al
mov cl, byte [ecx + edx]
mov al, bl
call fcn.00508723
mov byte [esi + 2], al
mov byte [esi + 3], 0xff
add esi, dword [ebp - 0xc]
inc dword [ebp - 4]
mov eax, dword [edi]
mov ecx, dword [ebp - 4]
inc edx
cmp ecx, dword [eax]
jb 0x508a48
jmp 0x508cd6
push dword [ebp - 0xc]
push dword [eax]
push dword [ebp - 0x18]
push ecx
push edx
push esi
call dword [edi + 0x4810]
add esp, 0x18
cmp ebx, 2
jne 0x508cd6
mov eax, dword [edi]
xor edx, edx
cmp dword [eax], edx
jbe 0x508cd6
mov eax, dword [ebp - 0x14]
mov bl, byte [edx + eax]
or cl, 0xff
sub cl, byte [esi]
mov al, bl
call fcn.00508723
or cl, 0xff
sub cl, byte [esi + 1]
mov byte [esi], al
mov al, bl
call fcn.00508723
or cl, 0xff
sub cl, byte [esi + 2]
mov byte [esi + 1], al
mov al, bl
call fcn.00508723
mov byte [esi + 2], al
add esi, dword [ebp - 0xc]
mov eax, dword [edi]
inc edx
cmp edx, dword [eax]
jb 0x508abb
jmp 0x508cd6
xor ecx, ecx
cmp dword [eax], ecx
jbe 0x508cd6
mov al, byte [ecx + edx]
mov byte [esi + 2], al
mov byte [esi + 1], al
mov byte [esi], al
mov byte [esi + 3], 0xff
add esi, dword [ebp - 0xc]
mov eax, dword [edi]
inc ecx
cmp ecx, dword [eax]
jb 0x508b08
jmp 0x508cd6
xor ebx, ebx
cmp dword [ebp - 0x28], ebx
je 0x508bc9
cmp dword [ebp - 0xc], 1
mov dword [ebp - 4], ebx
jne 0x508b7f
cmp dword [eax], ebx
jbe 0x508cd6
mov eax, dword [ebp - 0x18]
sub eax, ecx
mov dword [ebp + 0x14], edx
sub dword [ebp + 0x14], ecx
mov ebx, ecx
mov dword [ebp - 8], eax
mov eax, dword [ebp - 8]
movzx ecx, byte [ebx + eax]
movzx eax, byte [ebx]
push eax
mov eax, dword [ebp + 0x14]
movzx edx, byte [ebx + eax]
call fcn.005043dd
mov byte [esi], al
mov eax, dword [edi]
inc esi
inc dword [ebp - 4]
pop ecx
mov ecx, dword [ebp - 4]
inc ebx
cmp ecx, dword [eax]
jb 0x508b52
jmp 0x508cd6
cmp dword [eax], ebx
jbe 0x508cd6
mov eax, dword [ebp - 0x18]
sub eax, ecx
mov dword [ebp + 0x14], edx
sub dword [ebp + 0x14], ecx
mov ebx, ecx
mov dword [ebp - 8], eax
mov eax, dword [ebp - 8]
movzx ecx, byte [ebx + eax]
movzx eax, byte [ebx]
push eax
mov eax, dword [ebp + 0x14]
movzx edx, byte [ebx + eax]
call fcn.005043dd
inc dword [ebp - 4]
mov byte [esi], al
mov byte [esi + 1], 0xff
mov eax, dword [edi]
inc ebx
inc esi
pop ecx
mov ecx, dword [ebp - 4]
inc esi
cmp ecx, dword [eax]
jb 0x508b97
jmp 0x508cd6
mov ecx, dword [eax + 8]
cmp ecx, 4
jne 0x508ca4
cmp dword [edi + 0x47e8], ebx
jne 0x508c65
mov dword [ebp - 4], ebx
cmp dword [eax], ebx
jbe 0x508cd6
mov ebx, dword [ebp - 0x18]
mov ecx, dword [ebp - 0x1c]
mov eax, dword [ebp - 0x14]
sub ecx, ebx
mov dword [ebp - 8], ecx
mov ecx, dword [ebp - 0x20]
sub eax, ebx
sub ecx, ebx
mov dword [ebp - 0x2c], eax
mov dword [ebp - 0x34], ecx
jmp 0x508c0c
mov eax, dword [ebp - 0x2c]
mov dl, byte [ebx + eax]
mov cl, byte [ebx]
mov al, dl
mov byte [ebp + 0x17], dl
call fcn.00508723
mov ecx, dword [ebp - 8]
mov cl, byte [ebx + ecx]
movzx eax, al
mov dword [ebp - 0x38], eax
mov al, dl
call fcn.00508723
mov ecx, dword [ebp - 0x34]
mov cl, byte [ebx + ecx]
movzx eax, al
push eax
mov al, dl
call fcn.00508723
movzx edx, al
mov eax, dword [ebp - 0x38]
mov ecx, eax
call fcn.005043dd
mov byte [esi], al
mov byte [esi + 1], 0xff
add esi, dword [ebp - 0xc]
inc dword [ebp - 4]
mov eax, dword [edi]
pop ecx
mov ecx, dword [ebp - 4]
inc ebx
cmp ecx, dword [eax]
jb 0x508c09
jmp 0x508cd6
cmp ecx, 4
jne 0x508ca4
cmp dword [edi + 0x47e8], 2
jne 0x508ca4
mov dword [ebp - 4], ebx
cmp dword [eax], ebx
jbe 0x508cd6
mov ebx, dword [ebp - 0x14]
sub ebx, edx
mov al, byte [ebx + edx]
or cl, 0xff
sub cl, byte [edx]
call fcn.00508723
mov byte [esi], al
mov byte [esi + 1], 0xff
add esi, dword [ebp - 0xc]
inc dword [ebp - 4]
mov eax, dword [edi]
mov ecx, dword [ebp - 4]
inc edx
cmp ecx, dword [eax]
jb 0x508c7f
jmp 0x508cd6
xor ecx, ecx
cmp dword [ebp - 0xc], 1
jne 0x508cc1
cmp dword [eax], ebx
jbe 0x508cd6
sub edx, esi
mov al, byte [edx + esi]
mov byte [esi], al
mov eax, dword [edi]
inc ecx
inc esi
cmp ecx, dword [eax]
jb 0x508cb2
jmp 0x508cd6
cmp dword [eax], ebx
jbe 0x508cd6
mov al, byte [ecx + edx]
mov byte [esi], al
inc esi
mov byte [esi], 0xff
mov eax, dword [edi]
inc esi
inc ecx
cmp ecx, dword [eax]
jb 0x508cc5
inc dword [ebp - 0x24]
mov eax, dword [edi]
mov ecx, dword [ebp - 0x24]
cmp ecx, dword [eax + 4]
jb 0x5088d8
xor esi, esi
mov eax, edi
call fcn.00508714
mov eax, dword [edi]
mov eax, dword [eax]
mov ecx, dword [ebp + 8]
mov dword [ecx], eax
mov eax, dword [edi]
mov eax, dword [eax + 4]
mov ecx, dword [ebp + 0xc]
mov dword [ecx], eax
mov eax, dword [ebp + 0x10]
cmp eax, esi
je 0x508d1b
mov ecx, dword [edi]
xor edx, edx
cmp dword [ecx + 8], 3
setge dl
lea edx, [edx + edx + 1]
mov dword [eax], edx
mov eax, dword [ebp - 0x30]
jmp 0x508d2c
mov eax, 0x567ebc
call fcn.00503ec4
xor eax, eax
pop esi
pop ebx
leave
ret