Function at 0x40be40
Capabilities:
Encrypt data using rc4 prga

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x20
mov edx, dword [ebp + 0x114]
mov eax, dword [ebp + 0x24]
mov ecx, dword [ebp + 0x11c]
sub eax, edx
sub eax, ecx
push ebx
mov ebx, dword [ebp + 0x110]
push esi
mov esi, dword [ebp + 0x20]
imul eax, esi
add eax, ebx
push edi
mov edi, dword [ebp + 0x18]
lea edi, [edi + eax*2]
add eax, edi
mov edi, dword [ebp + 0x9c]
mov dword [ebp - 4], eax
mov eax, dword [ebp + 0xa8]
sub eax, edx
sub eax, ecx
mov ecx, dword [ebp + 0xa4]
imul eax, ecx
add eax, ebx
lea edi, [edi + eax*2]
add eax, edi
mov edi, dword [ebp + 0x120]
mov dword [ebp - 8], eax
xor eax, eax
cmp edi, eax
jne 0x40bef5
push eax
mov eax, dword [ebp + 0x11c]
push edx
push ebx
sub esp, 0x84
mov edi, esp
push eax
mov ecx, 0x21
lea esi, [ebp + 0x8c]
rep movsd dword es:[edi], dword [esi]
mov ecx, dword [ebp + 0x118]
push ecx
push edx
push ebx
sub esp, 0x84
mov ecx, 0x21
lea esi, [ebp + 8]
mov edi, esp
rep movsd dword es:[edi], dword [esi]
call fcn.00412f20
add esp, 0x124
mov eax, 1
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
jle 0x40c080
cmp dword [ebp + 0x11c], eax
mov dword [ebp + 0x114], eax
jle 0x40c074
mov eax, dword [ebp + 0x118]
cdq
and edx, 7
add eax, edx
lea edx, [ecx + ecx*2]
mov dword [ebp - 0x20], edx
lea edx, [esi + esi*2]
mov dword [ebp - 0x1c], edx
mov edx, dword [ebp - 8]
mov dword [ebp - 0x10], edx
mov edx, dword [ebp - 4]
sar eax, 3
mov dword [ebp - 0xc], eax
mov dword [ebp + 0x110], edx
lea ebx, [ebx]
test eax, eax
mov edx, dword [ebp + 0x110]
mov ebx, dword [ebp - 0x10]
mov dword [ebp - 0x18], edx
mov dword [ebp - 0x14], ebx
je 0x40bfcc
mov eax, dword [ebp - 0xc]
mov ebx, dword [ebp - 0x18]
mov ecx, dword [ebp - 0x14]
pxor mm6, mm6
movd mm7, dword [ebp + 0x120]
punpcklwd mm7, mm7
punpckldq mm7, mm7
movq mm0, qword [ecx]
movq mm2, qword [ecx + 8]
movq mm4, qword [ecx + 0x10]
add ecx, 0x18
movq mm1, mm0
movq mm3, mm2
movq mm5, mm4
punpckhbw mm0, mm6
punpcklbw mm1, mm6
punpckhbw mm2, mm6
punpcklbw mm3, mm6
punpckhbw mm4, mm6
punpcklbw mm5, mm6
paddw mm0, mm7
paddw mm1, mm7
paddw mm2, mm7
paddw mm3, mm7
paddw mm4, mm7
paddw mm5, mm7
packuswb mm1, mm0
packuswb mm3, mm2
packuswb mm5, mm4
movq qword [ebx], mm1
movq qword [ebx + 8], mm3
movq qword [ebx + 0x10], mm5
add ebx, 0x18
dec eax
jne 0x40bf6c
emms
mov eax, dword [ebp - 0xc]
mov ecx, dword [ebp + 0xa4]
lea ebx, [eax*8]
mov dword [ebp - 0x14], ebx
mov ebx, dword [ebp + 0x118]
cmp dword [ebp - 0x14], ebx
jge 0x40c04a
mov eax, ecx
mov ecx, dword [ebp + 0x110]
sub eax, esi
imul eax, dword [ebp + 0x114]
mov esi, dword [ebp - 4]
lea eax, [eax + eax*2]
sub eax, esi
add eax, ecx
mov ecx, dword [ebp - 8]
lea ecx, [eax + ecx + 2]
mov eax, dword [ebp - 0x14]
mov esi, ebx
sub esi, eax
lea ebx, [ebx]
movzx eax, byte [ecx - 2]
add eax, edi
jns 0x40c01a
xor eax, eax
mov byte [edx], al
movzx eax, byte [ecx - 1]
add eax, edi
jns 0x40c026
xor eax, eax
mov byte [edx + 1], al
movzx eax, byte [ecx]
add eax, edi
jns 0x40c032
xor eax, eax
mov byte [edx + 2], al
add edx, 3
add ecx, 3
dec esi
jne 0x40c010
mov esi, dword [ebp + 0x20]
mov eax, dword [ebp - 0xc]
mov ecx, dword [ebp + 0xa4]
mov ebx, dword [ebp - 0x1c]
add dword [ebp + 0x110], ebx
mov ebx, dword [ebp - 0x20]
mov edx, dword [ebp + 0x114]
add dword [ebp - 0x10], ebx
mov ebx, dword [ebp + 0x11c]
inc edx
cmp edx, ebx
mov dword [ebp + 0x114], edx
jl 0x40bf40
mov eax, 1
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
cmp edi, eax
jge 0x40c1ff
cmp dword [ebp + 0x11c], eax
mov dword [ebp + 0x114], eax
jle 0x40c1f3
mov eax, dword [ebp + 0x118]
cdq
and edx, 7
add eax, edx
mov ebx, eax
lea edx, [ecx + ecx*2]
mov ecx, dword [ebp - 8]
lea eax, [esi + esi*2]
mov esi, dword [ebp - 4]
sar ebx, 3
mov dword [ebp + 0x110], ebx
mov dword [ebp - 0xc], edx
mov dword [ebp - 0x18], eax
mov dword [ebp - 0x14], ecx
mov dword [ebp - 0x10], esi
jmp 0x40c0d1
mov ebx, dword [ebp + 0x110]
mov eax, edi
cdq
xor eax, edx
sub eax, edx
test ebx, ebx
mov edi, eax
mov dword [ebp - 0x1c], esi
mov dword [ebp - 0x20], ecx
mov dword [ebp + 0x120], edi
je 0x40c163
mov eax, dword [ebp + 0x110]
mov ebx, dword [ebp - 0x1c]
mov ecx, dword [ebp - 0x20]
pxor mm6, mm6
movd mm7, dword [ebp + 0x120]
punpcklwd mm7, mm7
punpckldq mm7, mm7
movq mm0, qword [ecx]
movq mm2, qword [ecx + 8]
movq mm4, qword [ecx + 0x10]
add ecx, 0x18
movq mm1, mm0
movq mm3, mm2
movq mm5, mm4
punpckhbw mm0, mm6
punpcklbw mm1, mm6
punpckhbw mm2, mm6
punpcklbw mm3, mm6
punpckhbw mm4, mm6
punpcklbw mm5, mm6
psubw mm0, mm7
psubw mm1, mm7
psubw mm2, mm7
psubw mm3, mm7
psubw mm4, mm7
psubw mm5, mm7
packuswb mm1, mm0
packuswb mm3, mm2
packuswb mm5, mm4
movq qword [ebx], mm1
movq qword [ebx + 8], mm3
movq qword [ebx + 0x10], mm5
add ebx, 0x18
dec eax
jne 0x40c106
emms
mov ebx, dword [ebp + 0x110]
mov edx, dword [ebp + 0x118]
shl ebx, 3
cmp ebx, edx
jge 0x40c1c2
mov ecx, dword [ebp + 0x20]
mov eax, dword [ebp + 0xa4]
sub eax, ecx
imul eax, dword [ebp + 0x114]
lea ecx, [eax + eax*2]
sub ecx, dword [ebp - 4]
add ecx, dword [ebp - 0x10]
mov eax, dword [ebp - 8]
lea ecx, [ecx + eax + 2]
sub edx, ebx
movzx eax, byte [ecx - 2]
add eax, edi
jns 0x40c19e
xor eax, eax
mov byte [esi], al
movzx eax, byte [ecx - 1]
add eax, edi
jns 0x40c1aa
xor eax, eax
mov byte [esi + 1], al
movzx eax, byte [ecx]
add eax, edi
jns 0x40c1b6
xor eax, eax
mov byte [esi + 2], al
add esi, 3
add ecx, 3
dec edx
jne 0x40c194
mov esi, dword [ebp - 0x10]
mov ecx, dword [ebp - 0x18]
mov eax, dword [ebp + 0x114]
mov ebx, dword [ebp - 0xc]
mov edx, dword [ebp + 0x11c]
add esi, ecx
mov ecx, dword [ebp - 0x14]
inc eax
add ecx, ebx
cmp eax, edx
mov dword [ebp + 0x114], eax
mov dword [ebp - 0x10], esi
mov dword [ebp - 0x14], ecx
jl 0x40c0cb
mov eax, 1
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
pop edi
pop esi
xor eax, eax
pop ebx
mov esp, ebp
pop ebp
ret