Function at 0x517253
Capabilities:
Encrypt data using rc4 ksa

Disassembly:
mov eax, 0x618e56
call fcn.005d261c
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 0x51729e
mov dword [edi], 1
jmp 0x517591
lea eax, [esi + 4]
push 0x400
push ebx
push eax
call fcn.005d2a00
lea ebx, [esi + 0x428]
push ebx
push dword [ebp + 8]
call fcn.0052f14f
add esp, 0x14
test eax, eax
je 0x517584
push ebx
call fcn.0052f3fe
movzx eax, ax
push ebx
mov dword [esi + 0x41c], eax
call fcn.0052f416
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 0x517584
cmp eax, 0x20
jg 0x517584
cmp dword [esi + 0x41c], 0
je 0x517584
test ecx, ecx
je 0x517584
cmp byte [ebp + 0x1f], 0
mov edx, dword [ebp + 0x18]
jne 0x517347
mov eax, dword [edx]
dec eax
je 0x517349
sub eax, 7
je 0x517349
sub eax, 0x10
je 0x517349
mov dword [edi], 5
jmp 0x517591
mov dword [edx], eax
mov eax, dword [edx]
mov ecx, dword [esi + 0x404]
mov dword [esi], eax
cmp ecx, dword [edx]
jbe 0x517362
mov dword [edi], 0x1c
jmp 0x517591
xor edi, edi
cmp ecx, 0x18
jl 0x51736f
and dword [ebp + 0x18], edi
inc edi
jmp 0x517377
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.0052f42e
test eax, eax
pop ecx
je 0x5173ac
lea eax, [esi + 4]
push eax
push ebx
push dword [ebp + 8]
call fcn.0052f2f4
add esp, 0xc
test eax, eax
jne 0x5173c5
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 0x5173b1
cmp dword [esi + 0x404], 8
jge 0x51745f
cmp byte [esi + 0x469], 1
jne 0x517401
cmp byte [esi + 0x42b], 1
jne 0x517401
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 0x51743b
mov edi, dword [ebp + 0x18]
xor edx, edx
test edi, edi
jle 0x51743b
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 0x517418
cmp edi, 0x100
jge 0x51745c
mov edi, 0x100
lea ebx, [esi + edx*4 + 4]
sub edi, edx
lea eax, [esi + 4]
push 4
push eax
push ebx
call dword [0x6a2224]
add esp, 0xc
add ebx, 4
dec edi
jne 0x517446
xor edi, edi
inc edi
cmp dword [esi], 8
ja 0x517479
lea eax, [esi + 4]
push 0x400
push eax
push dword [ebp + 0x14]
call dword [0x6a2224]
add esp, 0xc
mov eax, dword [esi + 0x41c]
lea eax, [eax + eax*2]
push eax
call fcn.005eb722
test eax, eax
pop ecx
mov dword [esi + 0x418], eax
jne 0x51749a
mov eax, dword [ebp - 0x10]
mov dword [eax], edi
jmp 0x5174f4
lea eax, [esi + 0x428]
push eax
call fcn.0052f664
push eax
call fcn.005eb722
pop ecx
mov dword [esi + 0x414], eax
test eax, eax
pop ecx
jne 0x5174ca
mov eax, dword [ebp - 0x10]
mov dword [eax], edi
push dword [esi + 0x418]
call fcn.005eb74b
jmp 0x5174f3
push dword [ebp + 8]
call fcn.0052f458
test eax, eax
pop ecx
jne 0x517500
mov eax, dword [ebp - 0x10]
mov dword [eax], edi
push dword [esi + 0x418]
call fcn.005eb74b
push dword [esi + 0x414]
call fcn.005eb74b
pop ecx
pop ecx
push esi
call dword [sym.imp.KERNEL32.dll_GlobalFree]
jmp 0x517591
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 0x51753a
lea edx, [ecx - 1]
test edx, edx
jle 0x51753a
mov eax, edi
dec edx
lea eax, [eax + eax + 1]
jne 0x51752d
mov dword [esi + 0x408], eax
cmp ecx, edi
jne 0x517556
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.005eb722
pop ecx
mov dword [ebp + 0x18], eax
and dword [ebp - 4], 0
test eax, eax
je 0x517578
push dword [ebp + 8]
mov ecx, eax
call fcn.0050faf7
jmp 0x51757a
xor eax, eax
mov dword [esi + 0x410], eax
mov eax, esi
jmp 0x517593
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