Function at 0x541770
Capabilities:
Encrypt data using rc4 ksa

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x38
mov eax, dword [0x6a4108]
xor eax, ebp
mov dword [ebp - 4], eax
mov eax, dword [ecx + 0x10]
push ebx
mov ebx, dword [ebp + 8]
and eax, 0xffff
push esi
push edi
mov dword [ebp - 0x30], ecx
mov dword [ebp - 0x28], ebx
cmp eax, 5
ja case.0x541799.1
jmp dword [eax*4 + 0x541a84]
mov dword [ebp - 0x18], 4
jmp 0x5417cb
mov dword [ebp - 0x18], 2
jmp 0x5417cb
mov dword [ebp - 0x18], 8
jmp 0x5417cb
mov dword [ebp - 0x18], 0x10
jmp 0x5417cb
mov dword [ebp - 0x18], 0
cmp dword [ebp + 0x10], 0
mov eax, dword [ebp + 0x14]
mov edi, dword [ebp + 0x18]
mov esi, dword [ebp + 0x1c]
jne 0x5417ef
test eax, eax
jne 0x5417ef
cmp edi, dword [ecx + 0x14]
jne 0x5417ef
mov dword [ebp - 0x1c], 1
cmp esi, dword [ecx + 0x18]
je 0x5417f6
mov dword [ebp - 0x1c], 0
cmp dword [ebp - 0x1c], 0
mov ebx, 0x2000
mov edx, 0x1000
cmovne edx, ebx
mov ebx, dword [ebp + 0x10]
mov dword [ebp - 0x10], eax
mov eax, ebx
add eax, edi
mov dword [ebp - 0xc], eax
mov eax, dword [ebp + 0x14]
or edx, 0x800
add eax, esi
cmp dword [ecx + 0x48], 0
mov dword [ebp - 0x14], ebx
mov ebx, dword [ebp - 0x28]
mov dword [ebp - 0x20], edx
mov dword [ebp - 8], eax
jne 0x54184b
push dword [ecx + 0x10]
push dword [ecx + 0x18]
push dword [ecx + 0x14]
call fcn.00541f90
mov ecx, dword [ebp - 0x30]
mov edx, dword [ebp - 0x20]
add esp, 0xc
mov dword [ecx + 0x48], eax
mov eax, dword [ecx + 0x48]
mov dword [ebp - 0x20], eax
test eax, eax
je 0x541a6e
mov ecx, dword [eax]
push edx
xor edx, edx
cmp dword [ebp - 0x1c], edx
lea eax, [ebp - 0x14]
cmovne eax, edx
push eax
lea eax, [ebp - 0x38]
push eax
push dword [ebp + 0xc]
push dword [ebp - 0x20]
call dword [ecx + 0x4c]
test eax, eax
js 0x541a6e
mov eax, dword [ebp - 0x38]
cdq
and edx, 3
add edx, eax
sar edx, 2
cmp dword [ebp + 0x20], 0
mov dword [ebp - 0x20], edx
je 0x5419c1
test esi, esi
je 0x541a28
xor ecx, ecx
lea eax, [edx*4]
mov dword [ebp - 0x24], ecx
mov dword [ebp - 0x2c], eax
lea ecx, [ecx]
mov eax, dword [ebp - 0x34]
add eax, ecx
mov ecx, dword [ebp - 0x18]
mov esi, ebx
cmp ecx, 4
jne 0x541993
xor edx, edx
test edi, edi
je 0x5419a1
cmp edi, ecx
jb 0x54195d
lea ecx, [edi - 1]
lea ecx, [ebx + ecx*4]
cmp eax, ecx
ja 0x5418e9
lea ecx, [edi - 1]
lea ecx, [eax + ecx*4]
cmp ecx, ebx
jae 0x54195d
movdqa xmm4, xmmword [0x6345c0]
movdqa xmm5, xmmword [0x6345e0]
movdqa xmm6, xmmword [0x6345d0]
mov ecx, edi
and ecx, 3
mov dword [ebp - 0x1c], edi
sub dword [ebp - 0x1c], ecx
mov ecx, 0x10
movd xmm3, ecx
mov ecx, dword [ebp - 0x1c]
jmp 0x541920
movdqu xmm2, xmmword [esi]
movdqa xmm1, xmm4
pand xmm1, xmm2
pslld xmm1, xmm3
movdqa xmm0, xmm5
pand xmm0, xmm2
por xmm1, xmm0
movdqa xmm0, xmm6
pand xmm0, xmm2
psrld xmm0, xmm3
add edx, 4
por xmm1, xmm0
movdqu xmmword [eax], xmm1
add esi, 0x10
add eax, 0x10
cmp edx, ecx
jb 0x541920
cmp edx, edi
jae 0x5419a1
sub edi, edx
mov ebx, dword [esi]
mov edx, ebx
shr edx, 0x10
movzx ecx, bl
and edx, 0xff
shl ecx, 0x10
or edx, ecx
and ebx, 0xff00ff00
or edx, ebx
mov dword [eax], edx
lea esi, [esi + 4]
lea eax, [eax + 4]
dec edi
jne 0x541963
mov ebx, dword [ebp - 0x28]
mov edi, dword [ebp + 0x18]
jmp 0x5419a1
imul ecx, edi
push ecx
push ebx
push eax
call fcn.005c7580
add esp, 0xc
mov ecx, dword [ebp - 0x24]
add ecx, dword [ebp - 0x2c]
lea eax, [edi*4]
add ebx, eax
dec dword [ebp + 0x1c]
mov dword [ebp - 0x28], ebx
mov dword [ebp - 0x24], ecx
jne 0x5418b0
jmp 0x541a28
cmp edi, edx
jne 0x5419dd
mov eax, dword [ebp - 0x18]
imul eax, edi
imul eax, esi
push eax
push ebx
push dword [ebp - 0x34]
call fcn.005c7580
add esp, 0xc
jmp 0x541a28
test esi, esi
je 0x541a28
mov eax, dword [ebp - 0x18]
imul eax, edi
lea ecx, [edi*4]
mov edi, dword [ebp + 0x1c]
mov dword [ebp - 0x24], eax
xor esi, esi
mov dword [ebp - 0x2c], ecx
lea esp, [esp]
push eax
mov eax, dword [ebp - 0x34]
add eax, esi
push ebx
push eax
call fcn.005c7580
mov ecx, dword [ebp - 0x20]
add ebx, dword [ebp - 0x2c]
lea eax, [ecx*4]
add esi, eax
mov eax, dword [ebp - 0x24]
add esp, 0xc
dec edi
jne 0x541a00
mov edi, dword [ebp + 0x18]
mov esi, dword [ebp - 0x30]
push dword [ebp + 0xc]
mov ecx, dword [esi + 0x48]
push ecx
mov edx, dword [ecx]
call dword [edx + 0x50]
cmp edi, dword [esi + 0x14]
jne 0x541a47
mov eax, dword [ebp - 0x20]
xor edx, edx
div dword [ebp - 0x18]
mov dword [esi + 0x1c], eax
push dword [esi + 0x44]
mov eax, dword [esi + 0x40]
push dword [esi + 0x48]
mov ecx, dword [eax]
push eax
call dword [ecx + 0x7c]
pop edi
pop esi
mov eax, 1
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.005c7124
mov esp, ebp
pop ebp
ret 0x1c
mov ecx, dword [ebp - 4]
pop edi
pop esi
xor ecx, ebp
xor eax, eax
pop ebx
call fcn.005c7124
mov esp, ebp
pop ebp
ret 0x1c