Function at 0x406b00
Capabilities:
Encrypt data using rc4 ksa

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x30
mov ecx, dword [ebp + 0x1c]
mov eax, 0xff
mov word [ebp - 0x18], ax
mov word [ebp - 0x16], ax
mov word [ebp - 0x14], ax
mov word [ebp - 0x12], ax
push ebx
mov ebx, dword [ebp + 0x34]
mov eax, 1
mov dword [ebp - 0x10], eax
mov dword [ebp - 0xc], eax
mov eax, dword [ebp + 0x30]
push esi
mov esi, dword [ebp + 0x18]
sub eax, esi
cdq
push edi
mov edi, eax
xor edi, edx
mov eax, ebx
sub eax, ecx
sub edi, edx
cdq
xor eax, edx
sub eax, edx
cmp esi, 0x13e
jle 0x406b56
mov esi, 0x13e
jmp 0x406b60
cmp esi, 2
jge 0x406b63
mov esi, 2
mov dword [ebp + 0x18], esi
mov edx, dword [ebp + 0x30]
cmp edx, 0x13e
jle 0x406b77
mov dword [ebp + 0x30], 0x13e
jmp 0x406b83
cmp edx, 2
jge 0x406b86
mov dword [ebp + 0x30], 2
mov edx, dword [ebp + 0x30]
cmp ecx, 0xee
jle 0x406b95
mov ecx, 0xee
jmp 0x406b9f
cmp ecx, 2
jge 0x406ba2
mov ecx, 2
mov dword [ebp + 0x1c], ecx
cmp ebx, 0xee
jle 0x406bb1
mov ebx, 0xee
jmp 0x406bbb
cmp ebx, 2
jge 0x406bbe
mov ebx, 2
mov dword [ebp + 0x34], ebx
emms
pxor mm5, mm5
cmp edi, eax
jle 0x406cee
cmp esi, edx
jle 0x406c02
mov ecx, 6
lea esi, [ebp + 0x10]
lea edi, [ebp - 0x30]
rep movsd dword es:[edi], dword [esi]
mov ecx, 6
lea esi, [ebp + 0x28]
lea edi, [ebp + 0x10]
rep movsd dword es:[edi], dword [esi]
mov ecx, 6
lea esi, [ebp - 0x30]
lea edi, [ebp + 0x28]
rep movsd dword es:[edi], dword [esi]
mov ebx, dword [ebp + 0x34]
mov ecx, dword [ebp + 0x1c]
mov esi, dword [ebp + 0x18]
mov edx, dword [ebp + 0x30]
sub edx, esi
mov edi, edx
mov dword [ebp + 0x3c], 0
je 0x406c1c
mov eax, ebx
sub eax, ecx
shl eax, 8
cdq
idiv edi
mov dword [ebp + 0x3c], eax
lea eax, [ecx + ecx*4]
mov ecx, dword [ebp + 8]
shl eax, 6
add eax, esi
lea ecx, [ecx + eax*4 - 4]
lea eax, [edi + 1]
xor edx, edx
test eax, eax
je 0x406e03
xor esi, esi
mov edi, eax
mov eax, edx
and eax, 0xff
mov dword [ebp + 8], eax
mov eax, dword [ecx]
mov dword [ebp + 0x20], eax
mov eax, dword [ecx + 0x500]
mov dword [ebp - 8], eax
mov eax, dword [ebp + 8]
movzx bx, al
shl ebx, 0x10
add eax, ebx
mov dword [ebp - 0x10], eax
mov dword [ebp - 0xc], eax
movq mm3, qword [ebp - 0x10]
movq mm4, qword [ebp - 0x18]
psubusw mm4, mm3
movd mm0, dword [ebp + 0x40]
punpcklbw mm0, mm5
movd mm1, dword [ebp + 0x20]
punpcklbw mm1, mm5
psubw mm1, mm0
pmullw mm1, mm3
psllw mm0, 8
paddw mm1, mm0
psrlw mm0, 8
psrlw mm1, 8
packuswb mm1, mm1
movd dword [ebp + 0x20], mm1
movd mm1, dword [ebp - 8]
punpcklbw mm1, mm5
psubw mm1, mm0
pmullw mm1, mm4
psllw mm0, 8
paddw mm1, mm0
psrlw mm0, 8
psrlw mm1, 8
packuswb mm1, mm1
movd dword [ebp - 8], mm1
mov eax, dword [ebp + 0x20]
mov ebx, dword [ebp + 0x3c]
mov dword [ecx], eax
mov eax, dword [ebp - 8]
mov dword [ecx + 0x500], eax
add edx, ebx
sub ecx, esi
mov eax, edx
sar eax, 8
lea esi, [eax + eax*4]
shl esi, 8
dec edi
lea ecx, [ecx + esi + 4]
jne 0x406c3c
jmp 0x406e03
cmp ecx, ebx
jle 0x406d25
mov ecx, 6
lea esi, [ebp + 0x10]
lea edi, [ebp - 0x30]
rep movsd dword es:[edi], dword [esi]
mov ecx, 6
lea esi, [ebp + 0x28]
lea edi, [ebp + 0x10]
rep movsd dword es:[edi], dword [esi]
mov ecx, 6
lea esi, [ebp - 0x30]
lea edi, [ebp + 0x28]
rep movsd dword es:[edi], dword [esi]
mov ebx, dword [ebp + 0x34]
mov ecx, dword [ebp + 0x1c]
mov esi, dword [ebp + 0x18]
mov edx, dword [ebp + 0x30]
sub ebx, ecx
mov dword [ebp + 0x3c], 0
je 0x406d3d
mov eax, edx
sub eax, esi
shl eax, 8
cdq
idiv ebx
mov dword [ebp + 0x3c], eax
mov edx, dword [ebp + 8]
lea ecx, [ecx + ecx*4]
shl ecx, 6
add ecx, esi
lea eax, [ebx + 1]
xor esi, esi
test eax, eax
lea ecx, [edx + ecx*4 - 4]
je 0x406e03
xor edx, edx
mov edi, eax
mov eax, esi
and eax, 0xff
mov dword [ebp + 8], eax
mov eax, dword [ecx]
mov dword [ebp + 0x20], eax
mov eax, dword [ecx + 4]
mov dword [ebp - 8], eax
mov eax, dword [ebp + 8]
movzx bx, al
shl ebx, 0x10
add eax, ebx
mov dword [ebp - 0x10], eax
mov dword [ebp - 0xc], eax
movq mm3, qword [ebp - 0x10]
movq mm4, qword [ebp - 0x18]
psubusw mm4, mm3
movd mm0, dword [ebp + 0x40]
punpcklbw mm0, mm5
movd mm1, dword [ebp + 0x20]
punpcklbw mm1, mm5
psubw mm1, mm0
pmullw mm1, mm3
psllw mm0, 8
paddw mm1, mm0
psrlw mm0, 8
psrlw mm1, 8
packuswb mm1, mm1
movd dword [ebp + 0x20], mm1
movd mm1, dword [ebp - 8]
punpcklbw mm1, mm5
psubw mm1, mm0
pmullw mm1, mm4
psllw mm0, 8
paddw mm1, mm0
psrlw mm0, 8
psrlw mm1, 8
packuswb mm1, mm1
movd dword [ebp - 8], mm1
mov eax, dword [ebp + 0x20]
mov dword [ecx], eax
mov eax, dword [ebp - 8]
mov dword [ecx + 4], eax
mov eax, 0x140
sub eax, edx
add esi, dword [ebp + 0x3c]
mov edx, esi
sar edx, 8
dec edi
lea eax, [ecx + eax*4]
lea ecx, [eax + edx*4]
jne 0x406d5d
emms
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret