Function at 0x10046cc0
Capabilities:
Encode data using xor
Encrypt data using aes
Encrypt data using rc4 ksa
Reference aes constants

Disassembly:
sub esp, 0x30
push ebp
mov ebp, ecx
cmp byte [ebp + 4], 0
je 0x10046f6d
mov eax, dword [ebp + 0x3cc]
cmp eax, 0x10
jne 0x10046cef
push dword [esp + 0x3c]
push dword [esp + 0x3c]
call fcn.100464c0
pop ebp
add esp, 0x30
ret 8
cdq
and edx, 3
push edi
lea edi, [edx + eax]
sar edi, 2
xor eax, eax
mov dword [esp + 0x20], edi
cmp edi, 4
je 0x10046d0c
cmp edi, 6
setne al
inc eax
shl eax, 5
push ebx
mov ecx, dword [eax + 0x1005b258]
mov ebx, dword [eax + 0x1005b260]
mov eax, dword [eax + 0x1005b268]
mov dword [esp + 0x14], eax
lea eax, [ebp + 0x454]
push esi
mov dword [esp + 0x14], ecx
mov dword [esp + 0x10], ebx
mov dword [esp + 0x1c], eax
mov esi, eax
test edi, edi
jle 0x10046d84
mov eax, dword [esp + 0x44]
lea ebx, [ebp + 8]
movzx ecx, byte [eax]
shl ecx, 0x18
mov dword [esi], ecx
movzx ecx, byte [eax + 1]
shl ecx, 0x10
or dword [esi], ecx
movzx ecx, byte [eax + 2]
shl ecx, 8
or dword [esi], ecx
movzx ecx, byte [eax + 3]
or dword [esi], ecx
mov ecx, dword [ebx]
mov edx, esi
add esi, 4
xor dword [edx], ecx
lea eax, [eax + 4]
lea ebx, [ebx + 4]
dec edi
jne 0x10046d46
mov edi, dword [esp + 0x28]
mov ecx, dword [esp + 0x14]
mov ebx, dword [esp + 0x10]
cmp dword [ebp + 0x3d0], 1
mov dword [esp + 0x28], 1
jle 0x10046e90
lea edx, [ebp + 0x28]
lea eax, [ebp + 0x434]
mov dword [esp + 0x2c], edx
test edi, edi
jle 0x10046e4a
mov dword [esp + 0x20], eax
mov eax, dword [esp + 0x18]
sub ebx, ecx
sub eax, ecx
mov esi, ecx
mov dword [esp + 0x44], edx
mov dword [esp + 0x30], eax
mov dword [esp + 0x24], edi
lea eax, [ebx + esi]
cdq
idiv edi
mov eax, dword [esp + 0x30]
add eax, esi
mov ecx, dword [ebp + edx*4 + 0x454]
cdq
idiv edi
sar ecx, 8
and ecx, 0xff
mov ecx, dword [ecx*4 + 0x10058a30]
movzx eax, byte [ebp + edx*4 + 0x454]
xor ecx, dword [eax*4 + 0x10058e30]
mov eax, esi
cdq
idiv edi
inc esi
movsx eax, word [ebp + edx*4 + 0x456]
mov edx, dword [esp + 0x20]
and eax, 0xff
add edx, 4
xor ecx, dword [eax*4 + 0x10058630]
movzx eax, byte [edx + 0x1f]
mov dword [esp + 0x20], edx
xor ecx, dword [eax*4 + 0x10058230]
mov eax, dword [esp + 0x44]
add eax, 4
xor ecx, dword [eax - 4]
dec dword [esp + 0x24]
mov dword [edx - 4], ecx
mov dword [esp + 0x44], eax
jne 0x10046dc8
lea eax, [ebp + 0x434]
lea ecx, [edi*4]
push ecx
push eax
lea eax, [ebp + 0x454]
push eax
call fcn.10026f60
mov eax, dword [esp + 0x34]
mov edx, dword [esp + 0x38]
mov ecx, dword [esp + 0x20]
mov ebx, dword [esp + 0x1c]
inc eax
add edx, 0x20
add esp, 0xc
cmp eax, dword [ebp + 0x3d0]
mov dword [esp + 0x28], eax
mov dword [esp + 0x2c], edx
lea eax, [ebp + 0x434]
jl 0x10046da6
xor ebx, ebx
mov dword [esp + 0x44], ebx
test edi, edi
jle 0x10046f63
mov edx, dword [esp + 0x14]
mov eax, dword [esp + 0x10]
mov esi, dword [esp + 0x48]
sub edx, eax
sub dword [esp + 0x18], eax
mov dword [esp + 0x14], edx
mov eax, dword [ebp + 0x3d0]
lea esi, [esi + 4]
lea eax, [ebx + eax*8]
mov ebx, dword [ebp + eax*4 + 8]
mov eax, dword [esp + 0x1c]
mov ecx, ebx
movzx eax, byte [eax + 3]
sar ecx, 0x18
xor cl, byte [eax + str.cw]
mov eax, dword [esp + 0x10]
add eax, edx
cdq
idiv edi
mov byte [esi - 4], cl
mov eax, ebx
sar eax, 0x10
add dword [esp + 0x1c], 4
movsx ecx, word [ebp + edx*4 + 0x456]
and ecx, 0xff
xor al, byte [ecx + str.cw]
mov byte [esi - 3], al
mov eax, dword [esp + 0x10]
cdq
idiv edi
mov eax, ebx
sar eax, 8
mov ecx, dword [ebp + edx*4 + 0x454]
sar ecx, 8
and ecx, 0xff
xor al, byte [ecx + str.cw]
mov ecx, dword [esp + 0x10]
mov byte [esi - 2], al
mov eax, dword [esp + 0x18]
add eax, ecx
cdq
idiv edi
inc ecx
mov dword [esp + 0x10], ecx
movzx eax, byte [ebp + edx*4 + 0x454]
mov edx, dword [esp + 0x14]
mov al, byte [eax + str.cw]
xor al, bl
mov ebx, dword [esp + 0x44]
inc ebx
mov byte [esi - 1], al
mov dword [esp + 0x44], ebx
cmp ebx, edi
jl 0x10046eb4
pop esi
pop ebx
pop edi
pop ebp
add esp, 0x30
ret 8
push 0x100692f8
lea ecx, [esp + 0x2c]
call fcn.100266f4
push 0x10065018
lea eax, [esp + 0x2c]
push eax
call fcn.10026abe
int3