Function at 0x516772
Capabilities:
Encrypt data using rc4 ksa

Disassembly:
mov eax, 0x6182b6
call fcn.005d1d1c
push ecx
mov eax, dword [ebp + 0xc]
push ebx
xor ebx, ebx
push esi
mov dword [eax], ebx
mov eax, dword [ebp + 0x10]
push edi
mov edi, ecx
mov dword [eax], ebx
mov eax, dword [ebp + 0x1c]
and eax, 2
push 0x4a8
cmp al, 2
push 0x40
mov dword [ebp - 0x10], edi
mov dword [edi], ebx
sete byte [ebp + 0x1f]
call dword [sym.imp.KERNEL32.dll_GlobalAlloc]
mov esi, eax
cmp esi, ebx
jne 0x5167bd
mov dword [edi], 1
jmp 0x516ab0
lea eax, [esi + 4]
push 0x400
push ebx
push eax
call fcn.005d2100
lea ebx, [esi + 0x428]
push ebx
push dword [ebp + 8]
call fcn.0052e840
add esp, 0x14
test eax, eax
je 0x516aa3
push ebx
call fcn.0052eaef
movzx eax, ax
push ebx
mov dword [esi + 0x41c], eax
call fcn.0052eb07
movsx edx, byte [esi + 0x42b]
pop ecx
pop ecx
movzx ecx, ax
movsx eax, byte [esi + 0x469]
imul eax, edx
test eax, eax
mov dword [esi + 0x420], ecx
mov dword [esi + 0x404], eax
je 0x516aa3
cmp eax, 0x20
jg 0x516aa3
cmp dword [esi + 0x41c], 0
je 0x516aa3
test ecx, ecx
je 0x516aa3
cmp byte [ebp + 0x1f], 0
mov edx, dword [ebp + 0x18]
jne 0x516866
mov eax, dword [edx]
dec eax
je 0x516868
sub eax, 7
je 0x516868
sub eax, 0x10
je 0x516868
mov dword [edi], 5
jmp 0x516ab0
mov dword [edx], eax
mov eax, dword [edx]
mov ecx, dword [esi + 0x404]
mov dword [esi], eax
cmp ecx, dword [edx]
jbe 0x516881
mov dword [edi], 0x1c
jmp 0x516ab0
xor edi, edi
cmp ecx, 0x18
jl 0x51688e
and dword [ebp + 0x18], edi
inc edi
jmp 0x516896
inc edi
mov eax, edi
shl eax, cl
mov dword [ebp + 0x18], eax
mov ecx, dword [ebp + 0xc]
mov eax, dword [esi + 0x41c]
push ebx
mov dword [ecx], eax
mov ecx, dword [ebp + 0x10]
mov eax, dword [esi + 0x420]
mov dword [ecx], eax
call fcn.0052eb1f
test eax, eax
pop ecx
je 0x5168cb
lea eax, [esi + 4]
push eax
push ebx
push dword [ebp + 8]
call fcn.0052e9e5
add esp, 0xc
test eax, eax
jne 0x5168e4
xor ecx, ecx
lea eax, [esi + 5]
mov byte [eax + 1], cl
mov byte [eax], cl
mov byte [eax - 1], cl
inc ecx
add eax, 4
cmp ecx, 0x100
jl 0x5168d0
cmp dword [esi + 0x404], 8
jge 0x51697e
cmp byte [esi + 0x469], 1
jne 0x516920
cmp byte [esi + 0x42b], 1
jne 0x516920
and byte [esi + 4], 0
and byte [esi + 5], 0
and byte [esi + 6], 0
or byte [esi + 8], 0xff
or byte [esi + 9], 0xff
or byte [esi + 0xa], 0xff
push 2
pop edx
jmp 0x51695a
mov edi, dword [ebp + 0x18]
xor edx, edx
test edi, edi
jle 0x51695a
lea ecx, [esi + 5]
lea eax, [esi + 0x439]
mov dword [ebp + 0x18], edi
mov edx, edi
mov bl, byte [eax + 1]
mov byte [ecx + 1], bl
mov bl, byte [eax]
mov byte [ecx], bl
mov bl, byte [eax - 1]
mov byte [ecx - 1], bl
add eax, 3
add ecx, 4
dec dword [ebp + 0x18]
jne 0x516937
cmp edi, 0x100
jge 0x51697b
mov edi, 0x100
lea ebx, [esi + edx*4 + 4]
sub edi, edx
lea eax, [esi + 4]
push 4
push eax
push ebx
call dword [0x6a1344]
add esp, 0xc
add ebx, 4
dec edi
jne 0x516965
xor edi, edi
inc edi
cmp dword [esi], 8
ja 0x516998
lea eax, [esi + 4]
push 0x400
push eax
push dword [ebp + 0x14]
call dword [0x6a1344]
add esp, 0xc
mov eax, dword [esi + 0x41c]
lea eax, [eax + eax*2]
push eax
call fcn.005eae36
test eax, eax
pop ecx
mov dword [esi + 0x418], eax
jne 0x5169b9
mov eax, dword [ebp - 0x10]
mov dword [eax], edi
jmp 0x516a13
lea eax, [esi + 0x428]
push eax
call fcn.0052ed55
push eax
call fcn.005eae36
pop ecx
mov dword [esi + 0x414], eax
test eax, eax
pop ecx
jne 0x5169e9
mov eax, dword [ebp - 0x10]
mov dword [eax], edi
push dword [esi + 0x418]
call fcn.005eae5f
jmp 0x516a12
push dword [ebp + 8]
call fcn.0052eb49
test eax, eax
pop ecx
jne 0x516a1f
mov eax, dword [ebp - 0x10]
mov dword [eax], edi
push dword [esi + 0x418]
call fcn.005eae5f
push dword [esi + 0x414]
call fcn.005eae5f
pop ecx
pop ecx
push esi
call dword [sym.imp.KERNEL32.dll_GlobalFree]
jmp 0x516ab0
mov ecx, dword [esi + 0x404]
push 8
pop eax
and dword [esi + 0x424], 0
cdq
idiv ecx
cmp ecx, 0x18
mov dword [esi + 0x408], edi
mov dword [esi + 0x40c], eax
je 0x516a59
lea edx, [ecx - 1]
test edx, edx
jle 0x516a59
mov eax, edi
dec edx
lea eax, [eax + eax + 1]
jne 0x516a4c
mov dword [esi + 0x408], eax
cmp ecx, edi
jne 0x516a75
and byte [esi + 4], 0
and byte [esi + 5], 0
and byte [esi + 6], 0
or byte [esi + 8], 0xff
or byte [esi + 9], 0xff
or byte [esi + 0xa], 0xff
push 0x15c
call fcn.005eae36
pop ecx
mov dword [ebp + 0x18], eax
and dword [ebp - 4], 0
test eax, eax
je 0x516a97
push dword [ebp + 8]
mov ecx, eax
call fcn.0050f22a
jmp 0x516a99
xor eax, eax
mov dword [esi + 0x410], eax
mov eax, esi
jmp 0x516ab2
push esi
call dword [sym.imp.KERNEL32.dll_GlobalFree]
mov dword [edi], 0x16
xor eax, eax
mov ecx, dword [ebp - 0xc]
pop edi
pop esi
pop ebx
mov dword fs:[0], ecx
leave
ret 0x18