Function at 0x4067c0
Capabilities:
Encrypt data using rc4 prga

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x4c
push ebx
mov ebx, dword [ebp + 8]
test ebx, ebx
je 0x406a6b
test edx, edx
je 0x406a6b
push edi
mov edi, dword [ebx]
cmp edi, 1
jl 0x406a6a
xor eax, eax
inc eax
cmp dword [ebx + 4], eax
jl 0x406a6a
mov ecx, dword [edx]
cmp ecx, eax
jle 0x406a6a
push esi
mov esi, dword [edx + 4]
cmp esi, eax
jle 0x406a69
test byte [ebp + 0xc], al
mov dword [ebp - 0x28], esi
jne 0x4df18e
and dword [ebp + 8], 0
mov dword [ebp - 0x20], eax
test byte [ebp + 0xc], 2
mov ecx, dword [edx + 0x10]
jne 0x4df19d
xor eax, eax
mov dword [ebp - 0x10], ecx
imul ecx, eax
mov eax, dword [edx + 0x14]
add ecx, dword [ebp + 8]
mov esi, dword [ebx + 0x10]
lea eax, [eax + ecx*4]
mov dword [ebp - 0x1c], eax
mov eax, dword [edx]
shl eax, 8
mov ecx, 0x100
sub eax, ecx
cdq
idiv dword [ebx]
sub esi, edi
mov edi, dword [ebx + 0x14]
mov dword [ebp - 8], edi
mov edi, dword [ebx + 4]
mov dword [ebp - 0x44], eax
mov eax, dword [ebp - 0x28]
shl eax, 8
sub eax, ecx
cdq
idiv edi
mov dword [ebp - 0x48], eax
xor eax, eax
cmp edi, eax
jle 0x406a67
mov edx, esi
shl edx, 2
mov dword [ebp - 0x18], eax
mov dword [ebp - 0x4c], edx
mov esi, dword [ebp - 0x1c]
mov edx, eax
sar edx, 8
imul edx, dword [ebp - 0x10]
and eax, 0xff
mov dword [ebp - 0xc], eax
xor eax, eax
cmp dword [ebx], eax
lea edx, [esi + edx*4]
mov dword [ebp - 0x1c], edx
jle 0x406a4c
mov dword [ebp + 8], eax
mov dword [ebp - 0x14], eax
mov esi, dword [ebp + 8]
mov eax, dword [ebp - 0x20]
and dword [ebp + 8], 0xff
sar esi, 8
imul esi, eax
lea edx, [edx + esi*4]
mov esi, dword [ebp - 0x10]
lea edi, [edx + eax*4]
lea esi, [edx + esi*4]
lea eax, [esi + eax*4]
mov dword [ebp - 0x28], eax
mov al, byte [eax + 3]
or al, byte [edi + 3]
or al, byte [esi + 3]
or al, byte [edx + 3]
jbe 0x406a34
mov eax, dword [ebp + 8]
imul eax, dword [ebp - 0xc]
sar eax, 8
mov dword [ebp - 0x30], esi
mov dword [ebp - 0x24], eax
mov esi, ecx
sub esi, dword [ebp - 0xc]
mov eax, ecx
sub eax, dword [ebp + 8]
imul esi, dword [ebp + 8]
imul eax, dword [ebp - 0xc]
mov dword [ebp - 0x3c], edi
sar esi, 8
mov edi, 0x101
sar eax, 8
sub edi, esi
sub edi, eax
sub edi, dword [ebp - 0x24]
mov dword [ebp - 0x40], edx
mov dword [ebp - 0x2c], eax
mov dword [ebp - 0x34], esi
mov dword [ebp - 0x38], edi
pxor mm0, mm0
mov esi, dword [ebp - 0x40]
mov edi, dword [ebp - 0x3c]
movd mm1, dword [esi]
movd mm3, dword [edi]
punpcklbw mm1, mm0
punpcklbw mm3, mm0
movd mm2, dword [ebp - 0x38]
movd mm4, dword [ebp - 0x34]
punpcklwd mm2, mm2
punpcklwd mm4, mm4
punpcklwd mm2, mm2
punpcklwd mm4, mm4
pmullw mm1, mm2
pmullw mm3, mm4
movq mm5, mm1
paddw mm5, mm3
mov esi, dword [ebp - 0x30]
mov edi, dword [ebp - 0x28]
movd mm1, dword [esi]
movd mm3, dword [edi]
punpcklbw mm1, mm0
punpcklbw mm3, mm0
movd mm2, dword [ebp - 0x2c]
movd mm4, dword [ebp - 0x24]
punpcklwd mm2, mm2
punpcklwd mm4, mm4
punpcklwd mm2, mm2
punpcklwd mm4, mm4
pmullw mm1, mm2
pmullw mm3, mm4
paddw mm5, mm1
paddw mm5, mm3
psrlw mm5, 8
packuswb mm5, mm0
movd dword [ebp - 4], mm5
cmp byte [ebp - 1], 0
je 0x406a34
lea eax, [ebp - 4]
mov dword [ebp - 0x38], eax
mov eax, dword [ebp + 0x10]
mov esi, dword [eax + 4]
mov dword [ebp - 0x3c], eax
mov eax, dword [0x5ab9e4]
inc dword [eax + 0x164]
mov dword [ebp - 0x40], esi
pxor mm5, mm5
mov eax, dword [ebp - 0x38]
movd mm4, dword [eax]
punpcklbw mm4, mm5
mov eax, dword [ebp - 0x3c]
movd mm2, dword [eax]
punpcklbw mm2, mm5
pmullw mm2, mm4
paddw mm2, qword [0x5aa998]
movq mm4, mm2
psrlw mm4, 8
paddw mm4, mm2
psrlw mm4, 8
mov eax, dword [ebp - 8]
movd mm1, dword [eax]
punpcklbw mm1, mm5
movd mm2, dword [ebp - 0x40]
punpcklwd mm2, mm2
punpcklwd mm2, mm2
pmullw mm4, mm2
psrlw mm4, 8
movq mm0, mm4
punpckhwd mm0, mm0
punpckhwd mm0, mm0
pxor mm0, qword [0x5aa9a0]
pmullw mm1, mm0
paddw mm1, qword [0x5aa998]
movq mm0, mm1
psrlw mm0, 8
paddw mm0, mm1
psrlw mm0, 8
paddusb mm0, mm4
packuswb mm0, mm5
movd dword [eax], mm0
mov eax, dword [ebp - 0x44]
inc dword [ebp - 0x14]
add dword [ebp + 8], eax
mov eax, dword [ebp - 0x14]
add dword [ebp - 8], 4
cmp eax, dword [ebx]
jl 0x4068a9
mov edx, dword [ebp - 0x4c]
inc dword [ebp - 0x18]
add dword [ebp - 8], edx
mov eax, dword [ebp - 0xc]
mov edx, dword [ebp - 0x18]
add eax, dword [ebp - 0x48]
cmp edx, dword [ebx + 4]
jl 0x40687f
emms
pop esi
pop edi
pop ebx
leave
ret
mov eax, ecx
dec eax
or dword [ebp - 0x20], 0xffffffff
mov dword [ebp + 8], eax
jmp 0x40681b
lea eax, [esi - 1]
mov esi, ecx
neg esi
mov dword [ebp - 0x10], esi
jmp 0x40682d