Function at 0x5123e0
Capabilities:
Encode data using xor
Encrypt data using rc4 prga

Disassembly:
push ebp
mov ebp, esp
push ebx
mov ebx, dword [ebp + 0x10]
push esi
mov esi, dword [ebp + 8]
push edi
mov eax, dword [esi + 0x1e4]
mov edi, dword [esi + 0xa94]
add eax, 0x355
and edi, dword [ebp + 0x18]
shl eax, 4
add eax, edi
mov dword [ebp + 8], edi
lea ecx, [esi + eax*2]
mov eax, dword [esi + 0x20]
cmp ebx, 0xffffffff
jne 0x512541
mov ebx, dword [ebp + 0xc]
mov dword [esi + eax*4 + 0x28], 0
mov eax, dword [esi + 0x20]
mov dword [esi + eax*4 + 0xfc], ecx
inc dword [esi + 0x20]
mov edi, dword [ebx]
mov eax, edi
mov edx, dword [ebx + 0x18]
sub eax, edx
mov ecx, dword [ebx + 0x14]
mov dword [ebp + 8], edx
movzx edx, byte [eax + ecx - 1]
mov ecx, 8
sub cl, byte [esi + 0xa98]
mov eax, dword [esi + 0xa9c]
and eax, dword [ebp + 0x18]
shr edx, cl
mov ecx, dword [esi + 0xa98]
shl eax, cl
lea ecx, [esi + 0xaa0]
add edx, eax
imul eax, edx, 0x600
mov edx, dword [ebx + 0x14]
add ecx, eax
mov eax, edi
sub eax, dword [ebx + 0x18]
cmp dword [esi + 0x1e4], 7
mov dword [ebp + 0x18], ecx
movzx edx, byte [eax + edx]
jge 0x512498
push edx
push 8
push ecx
push esi
call fcn.005138d0
add esp, 0x10
jmp 0x5124f6
sub edi, dword [esi + 0x1e8]
sub edi, dword [ebp + 8]
mov eax, dword [ebx + 0x14]
mov ebx, 0x100
add edx, ebx
movzx edi, byte [edi + eax - 1]
mov eax, dword [esi + 0x20]
mov ecx, edx
shr ecx, 7
add edi, edi
and ecx, 1
mov dword [esi + eax*4 + 0x28], ecx
mov ecx, ebx
and ecx, edi
mov eax, edx
shr eax, 8
add ecx, ebx
add eax, ecx
add edx, edx
mov ecx, dword [ebp + 0x18]
lea ecx, [ecx + eax*2]
mov eax, dword [esi + 0x20]
mov dword [esi + eax*4 + 0xfc], ecx
mov eax, edi
inc dword [esi + 0x20]
xor eax, edx
not eax
and ebx, eax
cmp edx, 0x10000
jb 0x5124b0
mov ebx, dword [ebp + 0xc]
mov eax, dword [esi + 0x1e4]
cmp eax, 3
jg 0x512514
xor eax, eax
mov dword [esi + 0x1e4], eax
mov eax, dword [ebp + 0x14]
sub dword [ebx + 0x18], eax
pop edi
pop esi
pop ebx
pop ebp
ret
cmp eax, 9
jg 0x51252d
add eax, 0xfffffffd
mov dword [esi + 0x1e4], eax
mov eax, dword [ebp + 0x14]
sub dword [ebx + 0x18], eax
pop edi
pop esi
pop ebx
pop ebp
ret
add eax, 0xfffffffa
mov dword [esi + 0x1e4], eax
mov eax, dword [ebp + 0x14]
sub dword [ebx + 0x18], eax
pop edi
pop esi
pop ebx
pop ebp
ret
mov dword [esi + eax*4 + 0x28], 1
mov eax, dword [esi + 0x20]
mov dword [esi + eax*4 + 0xfc], ecx
inc dword [esi + 0x20]
mov edx, dword [esi + 0x1e4]
mov eax, dword [esi + 0x20]
add edx, 0x3610
lea ecx, [esi + eax*4]
lea edx, [esi + edx*2]
cmp ebx, 4
jae 0x512719
mov dword [ecx + 0x28], 1
mov eax, dword [esi + 0x20]
mov dword [esi + eax*4 + 0xfc], edx
inc dword [esi + 0x20]
mov eax, dword [esi + 0x20]
lea edx, [esi + eax*4]
test ebx, ebx
jne 0x5125e7
mov eax, dword [esi + 0x1e4]
add eax, 0x361c
mov dword [edx + 0x28], ebx
mov ebx, dword [ebp + 0x14]
lea ecx, [esi + eax*2]
mov eax, dword [esi + 0x20]
mov dword [esi + eax*4 + 0xfc], ecx
inc dword [esi + 0x20]
mov eax, dword [esi + 0x1e4]
mov edx, dword [esi + 0x20]
add eax, 0x364
shl eax, 4
add eax, edi
lea ecx, [esi + eax*2]
xor eax, eax
cmp ebx, 1
setne al
mov dword [esi + edx*4 + 0x28], eax
mov eax, dword [esi + 0x20]
mov dword [esi + eax*4 + 0xfc], ecx
inc dword [esi + 0x20]
jmp 0x5126b1
mov eax, dword [esi + ebx*4 + 0x1e8]
mov dword [ebp + 0x18], eax
mov eax, dword [esi + 0x1e4]
add eax, 0x361c
mov dword [edx + 0x28], 1
lea ecx, [esi + eax*2]
mov eax, dword [esi + 0x20]
mov dword [esi + eax*4 + 0xfc], ecx
inc dword [esi + 0x20]
mov edx, dword [esi + 0x1e4]
mov eax, dword [esi + 0x20]
add edx, 0x3628
lea ecx, [esi + eax*4]
lea edx, [esi + edx*2]
cmp ebx, 1
jne 0x512643
mov dword [ecx + 0x28], 0
mov eax, dword [esi + 0x20]
mov dword [esi + eax*4 + 0xfc], edx
inc dword [esi + 0x20]
jmp 0x512699
mov dword [ecx + 0x28], 1
mov eax, dword [esi + 0x20]
mov dword [esi + eax*4 + 0xfc], edx
inc dword [esi + 0x20]
mov eax, dword [esi + 0x1e4]
mov ecx, dword [esi + 0x20]
add eax, 0x3634
lea edx, [esi + eax*2]
lea eax, [ebx - 2]
mov dword [esi + ecx*4 + 0x28], eax
mov eax, dword [esi + 0x20]
mov dword [esi + eax*4 + 0xfc], edx
inc dword [esi + 0x20]
cmp ebx, 3
jne 0x51268d
mov eax, dword [esi + 0x1f0]
mov dword [esi + 0x1f4], eax
mov eax, dword [esi + 0x1ec]
mov dword [esi + 0x1f0], eax
mov eax, dword [esi + 0x1e8]
mov ebx, dword [ebp + 0x14]
mov dword [esi + 0x1ec], eax
mov eax, dword [ebp + 0x18]
mov dword [esi + 0x1e8], eax
cmp ebx, 1
jne 0x5126da
xor eax, eax
cmp dword [esi + 0x1e4], 7
pop edi
setge al
lea eax, [eax*2 + 9]
mov dword [esi + 0x1e4], eax
mov eax, dword [ebp + 0xc]
pop esi
sub dword [eax + 0x18], ebx
pop ebx
pop ebp
ret
movzx eax, byte [esi + 0xa90]
push eax
push ebx
push edi
lea eax, [esi + 0xb94c]
push eax
push esi
call fcn.00512750
add esp, 0x14
mov eax, 0xb
cmp dword [esi + 0x1e4], 7
mov ecx, 8
cmovl eax, ecx
mov dword [esi + 0x1e4], eax
mov eax, dword [ebp + 0xc]
pop edi
pop esi
sub dword [eax + 0x18], ebx
pop ebx
pop ebp
ret
mov edi, dword [ebp + 0x14]
mov dword [ecx + 0x28], 0
mov eax, dword [esi + 0x20]
push edi
mov dword [esi + eax*4 + 0xfc], edx
lea eax, [ebx - 4]
inc dword [esi + 0x20]
push eax
push dword [ebp + 8]
push esi
call fcn.00513780
mov eax, dword [ebp + 0xc]
add esp, 0x10
sub dword [eax + 0x18], edi
pop edi
pop esi
pop ebx
pop ebp
ret