Function at 0x4396a0
Capabilities:
Encrypt data using rc4 ksa

Disassembly:
pushfd
pushal
xor eax, eax
cmp dword [esp + 0x48], eax
je 0x4396c2
mov eax, dword [0x492eb0]
cmp eax, 0xffffffff
jne 0x4396be
call fcn.00439d44
mov eax, dword [0x492eb0]
mov dword [esp + 0x48], eax
mov eax, dword [esp + 0x3c]
mov edx, dword [esp + 0x44]
lea eax, [eax + eax*2]
mov dword [0x492eac], edx
mov dword [0x492ea8], eax
cmp dword [esp + 0x30], 0x100
jae 0x4399c0
cmp dword [esp + 0x48], 1
je 0x439830
mov eax, dword [esp + 0x30]
mov ecx, dword [esp + 0x38]
mul ecx
mov ebx, eax
mov ebp, edx
add ecx, dword [esp + 0x34]
xor edi, edi
mov eax, dword [esp + 0x34]
mul edi
add eax, ebx
adc edx, ebp
div ecx
mov esi, eax
shl eax, 8
mov dword [edi*4 + 0x490ea0], esi
shl esi, 0x10
mov dword [edi*4 + 0x4912a0], eax
shl eax, 0x10
mov dword [edi*4 + 0x4916a0], esi
mov dword [edi*4 + 0x491aa0], eax
inc edi
cmp edi, 0x100
jne 0x439705
mov edi, dword [esp + 0x28]
mov esi, dword [esp + 0x2c]
sub edi, esi
mov ebp, dword [0x492ea8]
mov ecx, esi
mov ebx, esi
and ecx, 3
and ebx, 0xfffffffc
add ecx, ebp
mov edx, dword [ebx]
add ecx, 0x1f
shr ecx, 6
je 0x439779
sbb edx, edx
and edx, 0x20
add ebx, edx
mov eax, dword [ebx]
mov edx, dword [ebx + 0x20]
add ebx, 0x40
dec ecx
jne 0x43976e
sub ecx, edi
push esi
sub ecx, esi
and ecx, 3
je 0x439799
xor edx, edx
mov dl, byte [esi]
inc esi
mov al, byte [edx*4 + 0x490ea0]
dec ebp
mov byte [esi + edi - 1], al
je 0x439809
dec ecx
jne 0x439785
mov ecx, ebp
shr ebp, 2
je 0x4397f1
push ecx
mov eax, dword [esi]
add esi, 4
mov ebx, eax
mov ecx, eax
shr ebx, 0x10
mov edx, eax
shr eax, 0x18
and ebx, 0xff
shr ecx, 8
and edx, 0xff
mov eax, dword [eax*4 + 0x491aa0]
and ecx, 0xff
mov ebx, dword [ebx*4 + 0x4916a0]
mov edx, dword [edx*4 + 0x490ea0]
mov ecx, dword [ecx*4 + 0x4912a0]
or eax, ebx
or ecx, edx
or eax, ecx
dec ebp
mov dword [esi + edi - 4], eax
jne 0x4397a1
pop ecx
and ecx, 3
je 0x439809
xor edx, edx
mov dl, byte [esi]
inc esi
mov al, byte [edx*4 + 0x490ea0]
dec ecx
mov byte [esi + edi - 1], al
jne 0x4397f8
pop esi
mov edx, dword [0x492eac]
mov eax, dword [esp + 0x40]
add esi, edx
dec eax
mov dword [esp + 0x40], eax
jne 0x43974b
popal
popfd
ret
mov eax, dword [esp + 0x30]
mov ecx, dword [esp + 0x38]
mul ecx
mov ebx, eax
mov ebp, edx
add ecx, dword [esp + 0x34]
xor edi, edi
mov eax, dword [esp + 0x34]
mul edi
add eax, ebx
adc edx, ebp
div ecx
mov dword [edi*4 + 0x490ea0], eax
inc edi
cmp edi, 0x100
jne 0x439844
mov eax, dword [esp + 0x34]
mov ebx, dword [esp + 0x38]
add ebx, eax
mov ecx, 0x100
mul ecx
div ebx
movd mm4, eax
punpcklwd mm4, mm4
punpckldq mm4, mm4
mov eax, dword [esp + 0x38]
mov ebx, dword [esp + 0x34]
add ebx, eax
mul dword [esp + 0x30]
div ebx
movd mm5, eax
punpcklwd mm5, mm5
punpckldq mm5, mm5
pxor mm6, mm6
mov edi, dword [esp + 0x28]
mov esi, dword [esp + 0x2c]
sub edi, esi
mov ebp, dword [0x492ea8]
mov ecx, esi
mov ebx, esi
and ecx, 3
and ebx, 0xfffffffc
add ecx, ebp
mov edx, dword [ebx]
add ecx, 0x1f
shr ecx, 6
je 0x4398d0
sbb edx, edx
and edx, 0x20
add ebx, edx
mov eax, dword [ebx]
mov edx, dword [ebx + 0x20]
add ebx, 0x40
dec ecx
jne 0x4398c5
sub ecx, edi
push esi
sub ecx, esi
and ecx, 7
je 0x439929
mov eax, ecx
and ecx, 3
je 0x4398fb
xor edx, edx
mov dl, byte [esi]
inc esi
mov dl, byte [edx*4 + 0x490ea0]
dec ebp
mov byte [esi + edi - 1], dl
je 0x43999a
dec ecx
jne 0x4398e3
cmp ebp, 4
jb 0x439987
test eax, 4
je 0x439929
movd mm0, dword [esi]
punpcklbw mm0, mm6
pmullw mm0, mm4
add esi, 4
sub ebp, 4
psrlw mm0, 8
paddw mm0, mm5
packuswb mm0, mm6
movd dword [esi + edi - 4], mm0
mov ecx, ebp
shr ecx, 3
je 0x43995e
movq mm0, qword [esi]
movq mm2, mm0
punpckhbw mm0, mm6
pmullw mm0, mm4
punpcklbw mm2, mm6
pmullw mm2, mm4
add esi, 8
dec ecx
psrlw mm0, 8
psrlw mm2, 8
paddw mm0, mm5
paddw mm2, mm5
packuswb mm2, mm0
movq qword [esi + edi - 8], mm2
jne 0x439930
and ebp, 7
je 0x43999a
sub ebp, 4
jb 0x439984
movd mm0, dword [esi]
punpcklbw mm0, mm6
pmullw mm0, mm4
psrlw mm0, 8
paddw mm0, mm5
packuswb mm0, mm6
movd dword [esi + edi], mm0
je 0x43999a
add esi, 4
and ebp, 3
xor edx, edx
mov dl, byte [esi]
inc esi
mov al, byte [edx*4 + 0x490ea0]
dec ebp
mov byte [esi + edi - 1], al
jne 0x439989
pop esi
mov edx, dword [0x492eac]
mov eax, dword [esp + 0x40]
add esi, edx
dec eax
mov dword [esp + 0x40], eax
jne 0x4398a2
emms
popal
popfd
ret
cmp dword [esp + 0x48], 1
je 0x439b70
mov edx, dword [esp + 0x34]
mov ebx, dword [esp + 0x38]
add ebx, edx
je 0x439b6d
mov edi, 0x490ea0
call fcn.00439604
mov ebx, dword [esp + 0x34]
mov edx, dword [esp + 0x38]
add ebx, edx
mov edi, 0x491ea0
call fcn.00439604
mov edi, dword [esp + 0x28]
mov esi, dword [esp + 0x2c]
mov ebx, dword [esp + 0x30]
sub edi, esi
sub ebx, esi
mov dword [0x492ea4], edi
mov dword [0x492ea0], ebx
mov ebp, dword [0x492ea8]
add ebx, esi
mov ecx, esi
mov edi, esi
and ecx, 3
and edi, 0xfffffffc
and ebx, 0xfffffffc
add ecx, ebp
add ecx, 0x1f
sub ebx, edi
shr ecx, 5
mov eax, dword [edi]
mov edx, dword [edi + ebx]
add edi, 0x20
dec ecx
jne 0x439a34
sub ecx, esi
mov edi, dword [0x492ea4]
mov ebx, dword [0x492ea0]
push esi
sub ecx, edi
and ecx, 3
je 0x439a7d
xor eax, eax
xor edx, edx
mov al, byte [esi]
mov dl, byte [esi + ebx]
inc esi
mov eax, dword [eax*4 + 0x490ea0]
mov edx, dword [edx*4 + 0x491ea0]
add eax, edx
dec ebp
mov byte [esi + edi - 1], al
je 0x439b55
dec ecx
jne 0x439a59
mov ecx, ebp
shr ebp, 2
je 0x439b2f
push ecx
mov eax, dword [esi + ebx]
add esi, 4
mov ebx, eax
and eax, 0xff
mov edx, ebx
and ebx, 0xff00
mov ecx, dword [eax*4 + 0x491ea0]
shr ebx, 8
mov eax, edx
shr edx, 0x18
mov ebx, dword [ebx*4 + 0x4922a0]
and eax, 0xff0000
mov edx, dword [edx*4 + 0x492aa0]
shr eax, 0x10
mov edi, dword [esi - 4]
add ecx, ebx
mov ebx, dword [eax*4 + 0x4926a0]
add ecx, edx
mov edx, edi
and edi, 0xff
mov eax, edx
and edx, 0xff00
mov edi, dword [edi*4 + 0x490ea0]
shr edx, 8
add ecx, ebx
mov ebx, eax
mov edx, dword [edx*4 + 0x4912a0]
shr ebx, 0x18
add ecx, edi
and eax, 0xff0000
shr eax, 0x10
mov ebx, dword [ebx*4 + 0x491aa0]
mov edi, dword [0x492ea4]
add ecx, edx
mov eax, dword [eax*4 + 0x4916a0]
add ecx, ebx
mov ebx, dword [0x492ea0]
add ecx, eax
mov dword [esi + edi - 4], ecx
dec ebp
jne 0x439a89
pop ecx
and ecx, 3
je 0x439b55
xor eax, eax
xor edx, edx
mov al, byte [esi]
mov dl, byte [esi + ebx]
inc esi
mov eax, dword [eax*4 + 0x490ea0]
mov edx, dword [edx*4 + 0x491ea0]
add eax, edx
dec ecx
mov byte [esi + edi - 1], al
jne 0x439b38
pop esi
mov edx, dword [0x492eac]
mov eax, dword [esp + 0x40]
add esi, edx
dec eax
mov dword [esp + 0x40], eax
jne 0x439a15
popal
popfd
ret
mov edx, dword [esp + 0x34]
mov ebx, dword [esp + 0x38]
add ebx, edx
je 0x439d41
mov edi, 0x490ea0
call fcn.00439664
mov ebx, dword [esp + 0x34]
mov edx, dword [esp + 0x38]
add ebx, edx
mov edi, 0x491ea0
call fcn.00439664
mov eax, dword [esp + 0x34]
mov ebx, dword [esp + 0x38]
add ebx, eax
mov ecx, 0x100
mul ecx
div ebx
sub ecx, eax
movd mm4, eax
movd mm5, ecx
punpcklwd mm4, mm4
punpcklwd mm5, mm5
punpckldq mm4, mm4
punpckldq mm5, mm5
pxor mm6, mm6
mov edi, dword [esp + 0x28]
mov esi, dword [esp + 0x2c]
mov ebx, dword [esp + 0x30]
sub edi, esi
sub ebx, esi
mov dword [0x492ea4], edi
mov dword [0x492ea0], ebx
mov ebp, dword [0x492ea8]
add ebx, esi
mov ecx, esi
mov edi, esi
and ecx, 3
and edi, 0xfffffffc
and ebx, 0xfffffffc
add ecx, ebp
add ecx, 0x1f
sub ebx, edi
shr ecx, 5
mov eax, dword [edi]
mov edx, dword [edi + ebx]
add edi, 0x20
dec ecx
jne 0x439c03
sub ecx, esi
mov edi, dword [0x492ea4]
push esi
sub ecx, edi
mov ebx, dword [0x492ea0]
and ecx, 7
je 0x439c8b
mov eax, ecx
and ecx, 3
je 0x439c53
xor eax, eax
xor edx, edx
mov al, byte [esi]
mov dl, byte [esi + ebx]
inc esi
mov eax, dword [eax*4 + 0x490ea0]
mov edx, dword [edx*4 + 0x491ea0]
add eax, edx
dec ebp
mov byte [esi + edi - 1], al
je 0x439d27
dec ecx
jne 0x439c2f
cmp ebp, 4
jb 0x439d06
test eax, 4
je 0x439c8b
movd mm0, dword [esi]
movd mm1, dword [esi + ebx]
punpcklbw mm0, mm6
pmullw mm0, mm4
punpcklbw mm1, mm6
pmullw mm1, mm5
add esi, 4
sub ebp, 4
paddw mm0, mm1
psrlw mm0, 8
packuswb mm0, mm6
movd dword [esi + edi - 4], mm0
mov ecx, ebp
shr ecx, 3
je 0x439cd3
movq mm0, qword [esi]
movq mm1, qword [esi + ebx]
movq mm2, mm0
punpckhbw mm0, mm6
movq mm3, mm1
pmullw mm0, mm4
punpckhbw mm1, mm6
pmullw mm1, mm5
punpcklbw mm2, mm6
pmullw mm2, mm4
punpcklbw mm3, mm6
pmullw mm3, mm5
add esi, 8
paddw mm0, mm1
dec ecx
psrlw mm0, 8
paddw mm2, mm3
psrlw mm2, 8
packuswb mm2, mm0
movq qword [esi + edi - 8], mm2
jne 0x439c92
and ebp, 7
je 0x439d27
sub ebp, 4
jb 0x439d03
movd mm0, dword [esi]
movd mm1, dword [esi + ebx]
punpcklbw mm0, mm6
pmullw mm0, mm4
punpcklbw mm1, mm6
pmullw mm1, mm5
paddw mm0, mm1
psrlw mm0, 8
packuswb mm0, mm6
movd dword [esi + edi], mm0
je 0x439d27
add esi, 4
and ebp, 3
xor eax, eax
xor edx, edx
mov al, byte [esi]
mov dl, byte [esi + ebx]
inc esi
mov eax, dword [eax*4 + 0x490ea0]
mov edx, dword [edx*4 + 0x491ea0]
add eax, edx
dec ebp
mov byte [esi + edi - 1], al
jne 0x439d0a
pop esi
mov edx, dword [0x492eac]
mov eax, dword [esp + 0x40]
add esi, edx
dec eax
mov dword [esp + 0x40], eax
jne 0x439be4
emms
popal
popfd
ret