Function at 0x490697
Capabilities:
Encrypt data using rc4 ksa

Disassembly:
push ebp
mov eax, 0x1018
lea ebp, [esp - 0xc88]
call fcn.006021b0
mov eax, dword [0x6b55d0]
push esi
push edi
mov edi, 0x400
push edi
mov dword [ebp + 0xc84], eax
lea eax, [ebp + 0x884]
push 0
push eax
call fcn.006007e0
movzx esi, byte [ebp + 0xc98]
movzx eax, word [ebp + 0xc96]
add esp, 0xc
xor edx, edx
mov ecx, edx
shl ecx, 2
inc edx
cmp edx, 0xff
mov byte [ebp + ecx + 0x484], 0
mov byte [ebp + ecx + 0x485], 0
mov byte [ebp + ecx + 0x486], 0
mov byte [ebp + ecx + 0x487], 0xff
jl 0x4906dd
imul eax, esi
push 8
pop ecx
cdq
idiv ecx
push eax
lea eax, [ebp + 0x484]
push eax
push dword [ebp + 0xca4]
call fcn.005a6990
add esp, 0xc
cmp esi, 0x18
jne 0x49076e
mov esi, 0xff
lea ecx, [ebp + 0x782]
mov dl, byte [ecx - 1]
mov eax, esi
shl eax, 2
mov byte [ebp + eax + 0x884], dl
mov dl, byte [ecx]
mov byte [ebp + eax + 0x885], dl
mov dl, byte [ecx + 1]
dec esi
sub ecx, 3
test esi, esi
mov byte [ebp + eax + 0x886], dl
mov byte [ebp + eax + 0x887], 0xff
jge 0x49073a
jmp 0x490785
push edi
lea eax, [ebp + 0x484]
push eax
lea eax, [ebp + 0x884]
push eax
call fcn.006004a0
add esp, 0xc
movzx esi, word [ebp + 0xc9e]
push ebx
movzx ebx, word [ebp + 0xca0]
mov eax, esi
imul eax, ebx
push eax
call fcn.0042392e
test ebx, ebx
pop ecx
mov dword [ebp + 0x70], eax
jle 0x4907d0
mov dword [ebp + 0x80], eax
mov dword [ebp + 0x78], ebx
push esi
push dword [ebp + 0x80]
push dword [ebp + 0xca4]
call fcn.005a6990
add dword [ebp + 0x80], esi
add esp, 0xc
dec dword [ebp + 0x78]
jne 0x4907b0
test byte [ebp + 0xca3], 0x20
jne 0x49084e
mov dword [ebp + 0x80], ebx
shr dword [ebp + 0x80], 1
cmp dword [ebp + 0x80], 0
jle 0x49084e
mov edx, dword [ebp + 0x70]
lea eax, [ebx - 1]
imul eax, esi
mov ecx, esi
neg ecx
mov dword [ebp + 0x7c], edx
add eax, edx
mov edx, dword [ebp + 0x80]
mov dword [ebp + 0x80], edx
test esi, esi
jle 0x49083a
movzx edx, word [ebp + 0xc9e]
mov esi, dword [ebp + 0x7c]
mov edi, eax
mov dword [ebp + 0x78], edx
movzx edx, byte [esi]
mov dword [ebp + 0x74], edx
mov dl, byte [edi]
mov byte [esi], dl
mov dl, byte [ebp + 0x74]
inc esi
mov byte [edi], dl
inc edi
dec dword [ebp + 0x78]
jne 0x49081f
mov edi, 0x400
movzx esi, word [ebp + 0xc9e]
add dword [ebp + 0x7c], esi
add eax, ecx
dec dword [ebp + 0x80]
jne 0x49080c
push edi
lea eax, [ebp + 0x84]
push 0
push eax
mov dword [ebp + 0x78], 8
call fcn.006007e0
or eax, 0xffffffff
mov ecx, 0x100
lea edi, [ebp - 0x390]
rep stosd dword es:[edi], eax
add esp, 0xc
xor edi, edi
test ebx, ebx
jle 0x490917
mov eax, dword [ebp + 0x70]
mov dword [ebp + 0x7c], eax
mov dword [ebp + 0x74], ebx
and dword [ebp + 0x80], 0
test esi, esi
jle 0x490906
mov ecx, dword [ebp + 0x80]
mov eax, dword [ebp + 0x7c]
movzx eax, byte [eax + ecx]
shl eax, 2
lea ecx, [ebp + eax - 0x390]
cmp dword [ecx], 0xffffffff
jne 0x4908f1
mov dl, byte [ebp + eax + 0x884]
mov dword [ecx], edi
mov ecx, edi
shl ecx, 2
mov byte [ebp + ecx + 0x84], dl
mov dl, byte [ebp + eax + 0x885]
mov byte [ebp + ecx + 0x85], dl
mov dl, byte [ebp + eax + 0x886]
mov al, byte [ebp + eax + 0x887]
mov byte [ebp + ecx + 0x86], dl
mov byte [ebp + ecx + 0x87], al
inc edi
movzx esi, word [ebp + 0xc9e]
inc dword [ebp + 0x80]
cmp dword [ebp + 0x80], esi
jl 0x490895
add dword [ebp + 0x7c], esi
dec dword [ebp + 0x74]
jne 0x49088a
cmp edi, 0x10
jg 0x490964
push 0x400
lea eax, [ebp + 0x84]
push eax
lea eax, [ebp + 0x884]
push eax
mov dword [ebp + 0x78], 4
call fcn.006004a0
add esp, 0xc
test ebx, ebx
jle 0x490964
mov edi, dword [ebp + 0x70]
mov ecx, ebx
test esi, esi
jle 0x490958
mov eax, edi
movzx edx, byte [eax]
mov dl, byte [ebp + edx*4 - 0x390]
mov byte [eax], dl
inc eax
dec esi
jne 0x490948
movzx esi, word [ebp + 0xc9e]
add edi, esi
dec ecx
jne 0x490942
push dword [ebp + 0x78]
push ebx
push esi
call fcn.0059e590
mov esi, eax
push esi
call fcn.0059e650
mov ecx, dword [esi + 0x18]
add esp, 0x10
cmp dword [ebp + 0x78], 4
mov dword [ebp + 0x7c], 0x100
jne 0x490990
mov dword [ebp + 0x7c], 0x10
and dword [ebp + 0x80], 0
cmp dword [ebp + 0x7c], 0
jle 0x4909ef
lea edx, [ebp + 0x884]
lea edi, [ebp + 0x885]
sub edx, ecx
lea eax, [ecx + 2]
sub edi, ecx
mov cl, byte [edx + eax]
mov byte [eax - 2], cl
mov ecx, dword [ebp + 0x80]
mov cl, byte [ebp + ecx*4 + 0x885]
mov byte [eax - 1], cl
mov ecx, dword [ebp + 0x80]
mov cl, byte [ebp + ecx*4 + 0x884]
inc dword [ebp + 0x80]
mov byte [eax], cl
mov cl, byte [edi + eax]
mov byte [eax + 1], cl
mov ecx, dword [ebp + 0x7c]
add eax, 4
cmp dword [ebp + 0x80], ecx
jl 0x4909b0
test ebx, ebx
mov ecx, dword [esi + 0x10]
mov eax, dword [esi + 0x14]
mov dword [ebp + 0x7c], ecx
jle 0x490a26
mov edi, dword [ebp + 0x70]
mov dword [ebp + 0x78], eax
mov dword [ebp + 0x74], ebx
movzx ebx, word [ebp + 0xc9e]
push ebx
push edi
push dword [ebp + 0x78]
call fcn.006004a0
mov eax, dword [ebp + 0x7c]
add dword [ebp + 0x78], eax
add esp, 0xc
add edi, ebx
dec dword [ebp + 0x74]
jne 0x490a05
cmp dword [ebp + 0x70], 0
pop ebx
je 0x490a36
push dword [ebp + 0x70]
call fcn.0042396e
pop ecx
mov ecx, dword [ebp + 0xc84]
pop edi
mov eax, esi
pop esi
call fcn.006009d4
add ebp, 0xc88
leave
ret