Function at 0x513c30
Capabilities:
Encrypt data using rc4 ksa

Disassembly:
mov eax, 0x126c
call fcn.00526b50
mov ecx, dword [0x7aa470]
push ebx
push ebp
xor eax, eax
push esi
push edi
test ecx, ecx
je 0x513ea7
mov eax, dword [esp + 0x1280]
test eax, eax
je 0x513ccb
mov esi, dword [eax + 0x80]
mov eax, dword [eax + 0x88]
cmp eax, 8
mov dword [esp + 0x14], esi
jne 0x513d2c
mov eax, dword [esp + 0x1288]
cdq
idiv esi
mov ebx, eax
test ebx, ebx
jle 0x513e95
mov ebp, dword [esp + 0x1284]
cmp ebx, 0x24c
mov edi, 0x24c
jg 0x513c9c
mov edi, ebx
mov esi, edi
xor ecx, ecx
imul esi, dword [esp + 0x14]
test esi, esi
jbe 0x513cf6
lea edx, [esp + 0x1c]
mov al, byte [ecx + ebp]
add al, 0x80
test al, 0x80
mov byte [esp + 0x10], al
je 0x513cd9
mov byte [esp + 0x13], 0xff
mov byte [esp + 0x12], 0xff
mov byte [esp + 0x11], 0xff
jmp 0x513ce8
mov dword [esp + 0x14], 2
mov esi, dword [esp + 0x14]
jmp 0x513d35
mov byte [esp + 0x13], 0
mov byte [esp + 0x12], 0
mov byte [esp + 0x11], 0
mov eax, dword [esp + 0x10]
inc ecx
mov dword [edx], eax
add edx, 4
cmp ecx, esi
jb 0x513cad
mov edx, dword [0x7aa470]
lea ecx, [esp + 0x1c]
push edi
push ecx
push edx
call dword [0x7aa448]
add esp, 0xc
cmp eax, 1
jne 0x513ea5
sub ebx, edi
add ebp, esi
test ebx, ebx
jg 0x513c8d
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x126c
ret
cmp eax, 0x10
jne 0x513ddb
mov eax, dword [esp + 0x1288]
lea ecx, [esi + esi]
cdq
idiv ecx
mov ebp, eax
test ebp, ebp
jle 0x513e95
cmp ebp, 0x24c
mov esi, 0x24c
jg 0x513d5b
mov esi, ebp
mov edx, esi
imul edx, dword [esp + 0x14]
test edx, edx
jbe 0x513d8c
mov eax, dword [esp + 0x1284]
lea ecx, [esp + 0x1c]
mov edi, edx
movsx edx, byte [eax + 1]
xor ebx, ebx
add ecx, 4
mov bl, byte [eax]
add eax, 2
shl edx, 8
or edx, ebx
dec edi
mov dword [ecx - 4], edx
jne 0x513d73
mov ecx, dword [0x7aa470]
lea eax, [esp + 0x1c]
push esi
push eax
push ecx
call dword [0x7aa448]
add esp, 0xc
cmp eax, 1
jne 0x513ea5
mov edx, dword [esp + 0x14]
sub ebp, esi
mov ecx, dword [esp + 0x1284]
lea eax, [edx + edx]
imul esi, eax
add ecx, esi
test ebp, ebp
mov dword [esp + 0x1284], ecx
jg 0x513d4c
pop edi
pop esi
pop ebp
mov eax, 1
pop ebx
add esp, 0x126c
ret
cmp eax, 0x18
jne 0x513e95
mov eax, dword [esp + 0x1288]
lea ecx, [esi + esi*2]
cdq
idiv ecx
mov dword [esp + 0x18], ecx
mov ebx, eax
test ebx, ebx
jle 0x513e95
cmp ebx, 0x24c
mov ebp, 0x24c
jg 0x513e0e
mov ebp, ebx
mov edi, ebp
imul edi, esi
test edi, edi
jbe 0x513e5b
mov eax, dword [esp + 0x1284]
lea esi, [esp + 0x1c]
lea ecx, [eax + 1]
mov al, byte [ecx + 1]
mov dl, byte [ecx]
mov byte [esp + 0x12], al
and al, 0x80
neg al
sbb al, al
mov byte [esp + 0x11], dl
mov dl, byte [ecx - 1]
and eax, 0xff
mov byte [esp + 0x10], dl
mov byte [esp + 0x13], al
mov eax, dword [esp + 0x10]
add ecx, 3
mov dword [esi], eax
add esi, 4
dec edi
jne 0x513e25
mov esi, dword [esp + 0x14]
mov edx, dword [0x7aa470]
lea ecx, [esp + 0x1c]
push ebp
push ecx
push edx
call dword [0x7aa448]
add esp, 0xc
cmp eax, 1
jne 0x513ea5
sub ebx, ebp
imul ebp, dword [esp + 0x18]
mov ecx, dword [esp + 0x1284]
add ecx, ebp
test ebx, ebx
mov dword [esp + 0x1284], ecx
jg 0x513dff
pop edi
pop esi
pop ebp
mov eax, 1
pop ebx
add esp, 0x126c
ret
xor eax, eax
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x126c
ret