Function at 0x418690
Capabilities:
Encode data using xor
Encrypt data using rc4 ksa

Disassembly:
sub esp, 0x30
push ebx
push ebp
mov ebp, ecx
push esi
push edi
mov al, byte [ebp + 0x3a84]
test al, al
jne 0x4186c1
push 0x437724
lea ecx, [esp + 0x38]
call dword [sym.imp.MSVCRT.dll_public:_void___thiscall_exception::constructor_char_const__const_const__]
lea eax, [esp + 0x34]
push 0x431328
push eax
call sub.MSVCRT.dll__CxxThrowException
mov eax, dword [ebp + 0x3e4c]
cmp eax, 0x10
jne 0x4186e7
mov ecx, dword [esp + 0x48]
mov edx, dword [esp + 0x44]
push ecx
push edx
mov ecx, ebp
call fcn.00417f90
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x30
ret 8
cdq
and edx, 3
add eax, edx
mov ebx, eax
sar ebx, 2
cmp ebx, 4
jne 0x4186fb
xor esi, esi
jmp 0x418706
xor eax, eax
cmp ebx, 6
setne al
inc eax
mov esi, eax
mov ecx, esi
add esi, 0x1d2
shl ecx, 5
shl esi, 5
mov edx, dword [ecx + ebp + 0x3a30]
lea eax, [ecx + ebp]
test ebx, ebx
mov ecx, dword [eax + 0x3a38]
mov eax, dword [esi + ebp]
mov dword [esp + 0x20], eax
mov dword [esp + 0x30], edx
mov dword [esp + 0x14], ecx
lea eax, [ebp + 0x3ed4]
jle 0x41879e
mov esi, dword [esp + 0x44]
lea ecx, [ebp + 0x3c68]
mov dword [esp + 0x10], ecx
mov dword [esp + 0x18], ebx
xor ecx, ecx
mov cl, byte [esi]
shl ecx, 0x18
mov dword [eax], ecx
mov edi, dword [eax]
inc esi
xor ecx, ecx
mov cl, byte [esi]
shl ecx, 0x10
or edi, ecx
inc esi
xor ecx, ecx
mov dword [eax], edi
mov ch, byte [esi]
or edi, ecx
inc esi
xor ecx, ecx
mov dword [eax], edi
mov cl, byte [esi]
mov edi, eax
or dword [eax], ecx
mov ecx, dword [esp + 0x10]
inc esi
add eax, 4
mov ecx, dword [ecx]
xor dword [edi], ecx
mov edi, dword [esp + 0x10]
mov ecx, dword [esp + 0x18]
add edi, 4
dec ecx
mov dword [esp + 0x10], edi
mov dword [esp + 0x18], ecx
jne 0x41874f
mov ecx, dword [esp + 0x14]
mov esi, dword [ebp + 0x3e50]
mov eax, 1
cmp esi, eax
mov dword [esp + 0x1c], eax
jle 0x4188b5
lea eax, [ebp + 0x3c88]
mov dword [esp + 0x44], eax
test ebx, ebx
jle 0x41887f
mov eax, dword [esp + 0x44]
mov esi, edx
mov dword [esp + 0x18], eax
mov eax, ecx
mov ecx, dword [esp + 0x20]
sub eax, edx
sub ecx, edx
lea edi, [ebp + 0x3eb4]
mov dword [esp + 0x28], eax
mov dword [esp + 0x24], ecx
mov dword [esp + 0x10], ebx
jmp 0x4187f7
mov ecx, dword [esp + 0x24]
mov eax, dword [esp + 0x28]
add eax, esi
add edi, 4
cdq
idiv ebx
mov eax, edx
xor edx, edx
mov dl, byte [ebp + eax*4 + 0x3ed5]
lea eax, [ecx + esi]
mov dword [esp + 0x2c], edx
cdq
idiv ebx
mov eax, dword [ebp + edx*4 + 0x3ed4]
mov edx, dword [esp + 0x2c]
and eax, 0xff
mov ecx, dword [ebp + edx*4 + 0x2204]
mov edx, dword [ebp + eax*4 + 0x2604]
mov eax, esi
xor ecx, edx
cdq
idiv ebx
xor eax, eax
mov al, byte [ebp + edx*4 + 0x3ed6]
mov edx, dword [ebp + eax*4 + 0x1e04]
xor ecx, edx
xor edx, edx
mov dl, byte [edi + 0x1f]
mov eax, dword [ebp + edx*4 + 0x1a04]
xor ecx, eax
mov eax, dword [esp + 0x18]
mov edx, dword [eax]
add eax, 4
xor ecx, edx
mov dword [esp + 0x18], eax
mov eax, dword [esp + 0x10]
mov dword [edi - 4], ecx
inc esi
dec eax
mov dword [esp + 0x10], eax
jne 0x4187ef
mov edx, dword [esp + 0x30]
mov eax, dword [esp + 0x1c]
mov ecx, ebx
lea esi, [ebp + 0x3eb4]
lea edi, [ebp + 0x3ed4]
rep movsd dword es:[edi], dword [esi]
mov esi, dword [esp + 0x44]
mov ecx, dword [ebp + 0x3e50]
inc eax
add esi, 0x20
cmp eax, ecx
mov ecx, dword [esp + 0x14]
mov dword [esp + 0x1c], eax
mov dword [esp + 0x44], esi
jl 0x4187bf
test ebx, ebx
mov dword [esp + 0x44], 0
jle 0x418995
mov esi, dword [esp + 0x48]
lea eax, [ebp + 0x3ed4]
mov dword [esp + 0x48], eax
mov eax, dword [esp + 0x20]
sub edx, ecx
sub eax, ecx
mov edi, ecx
mov dword [esp + 0x30], edx
mov dword [esp + 0x2c], eax
mov eax, dword [ebp + 0x3e50]
mov ecx, dword [esp + 0x44]
lea edx, [ecx + eax*8]
xor eax, eax
mov ecx, dword [ebp + edx*4 + 0x3c68]
mov edx, dword [esp + 0x48]
mov al, byte [edx + 3]
mov edx, ecx
sar edx, 0x18
mov al, byte [eax + ebp + 0x904]
xor al, dl
mov edx, dword [esp + 0x30]
mov byte [esi], al
inc esi
lea eax, [edi + edx]
cdq
idiv ebx
xor eax, eax
mov al, byte [ebp + edx*4 + 0x3ed6]
mov edx, ecx
sar edx, 0x10
mov al, byte [eax + ebp + 0x904]
xor al, dl
mov byte [esi], al
mov eax, edi
cdq
idiv ebx
xor eax, eax
inc esi
mov al, byte [ebp + edx*4 + 0x3ed5]
mov edx, ecx
sar edx, 8
mov al, byte [eax + ebp + 0x904]
xor al, dl
mov edx, dword [esp + 0x2c]
mov byte [esi], al
inc esi
lea eax, [edi + edx]
cdq
idiv ebx
mov eax, dword [ebp + edx*4 + 0x3ed4]
and eax, 0xff
mov dl, byte [eax + ebp + 0x904]
mov eax, dword [esp + 0x44]
xor dl, cl
mov ecx, dword [esp + 0x48]
mov byte [esi], dl
inc esi
inc eax
add ecx, 4
inc edi
cmp eax, ebx
mov dword [esp + 0x44], eax
mov dword [esp + 0x48], ecx
jl 0x4188e5
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x30
ret 8