Function at 0x10046160
Capabilities:
Encode data using xor

Disassembly:
sub esp, 8
push ebx
mov ebx, dword [esp + 0x14]
mov eax, ebx
push ebp
push esi
push edi
mov edi, dword [esp + 0x1c]
sub eax, edi
and eax, 0xfffffffc
cmp eax, 0x80
jle 0x100461f1
mov ecx, dword [esp + 0x28]
mov esi, dword [esp + 0x24]
test esi, esi
jle 0x1004624c
push ecx
push ebx
lea eax, [esp + 0x18]
push edi
push eax
call fcn.10044730
mov edx, dword [esp + 0x20]
mov eax, esi
mov ebp, dword [esp + 0x24]
mov ecx, ebx
sar eax, 2
add esp, 0x10
sar esi, 1
sub ecx, ebp
add esi, eax
and ecx, 0xfffffffc
mov eax, edx
sub eax, edi
and eax, 0xfffffffc
cmp eax, ecx
mov eax, dword [esp + 0x28]
push eax
push esi
jge 0x100461d1
push edx
push edi
call fcn.10046160
mov edi, ebp
jmp 0x100461dc
push ebx
push ebp
call fcn.10046160
mov ebx, dword [esp + 0x20]
mov ecx, dword [esp + 0x38]
mov eax, ebx
sub eax, edi
add esp, 0x10
and eax, 0xfffffffc
cmp eax, 0x80
jg 0x10046185
cmp edi, ebx
je 0x1004639d
lea esi, [edi + 4]
cmp esi, ebx
je 0x1004639d
mov eax, 4
sub eax, edi
mov dword [esp + 0x20], eax
nop
mov ebp, dword [esi]
mov edx, esi
movd xmm0, dword [edi]
cvtdq2pd xmm0, xmm0
movd xmm1, ebp
cvtdq2pd xmm1, xmm1
comisd xmm1, xmm0
jbe 0x10046360
lea ecx, [eax - 4]
mov eax, esi
add ecx, esi
push ecx
sub eax, ecx
add eax, 4
push edi
push eax
call fcn.1008bd50
add esp, 0xc
mov dword [edi], ebp
jmp 0x1004638e
sub ebx, edi
mov eax, ebx
mov dword [esp + 0x20], ebx
sar eax, 2
mov esi, eax
mov dword [esp + 0x10], eax
sar esi, 1
test esi, esi
jle 0x10046318
mov ebx, eax
lea ebp, [ebx - 1]
sar ebp, 1
nop
mov eax, dword [edi + esi*4 - 4]
dec esi
mov dword [esp + 0x1c], eax
mov edx, esi
mov ecx, esi
cmp esi, ebp
jge 0x100462b2
add ecx, ecx
xor eax, eax
movd xmm1, dword [edi + ecx*4 + 8]
movd xmm0, dword [edi + ecx*4 + 4]
cvtdq2pd xmm1, xmm1
cvtdq2pd xmm0, xmm0
comisd xmm1, xmm0
seta al
xor eax, 1
inc eax
add ecx, eax
mov eax, dword [edi + ecx*4]
mov dword [edi + edx*4], eax
mov edx, ecx
cmp ecx, ebp
jl 0x10046281
cmp edx, ebp
jne 0x100462c5
test bl, 1
jne 0x100462c5
mov eax, dword [edi + ebx*4 - 4]
mov dword [edi + edx*4], eax
lea edx, [ebx - 1]
lea eax, [edx - 1]
sar eax, 1
cmp esi, edx
jge 0x100462fd
movd xmm1, dword [esp + 0x1c]
cvtdq2pd xmm1, xmm1
nop dword [eax + eax]
mov ecx, dword [edi + eax*4]
movd xmm0, ecx
cvtdq2pd xmm0, xmm0
comisd xmm0, xmm1
jbe 0x100462fd
mov dword [edi + edx*4], ecx
mov edx, eax
dec eax
sar eax, 1
cmp esi, edx
jl 0x100462e0
mov eax, dword [esp + 0x1c]
mov dword [edi + edx*4], eax
test esi, esi
jg 0x10046270
mov ebx, dword [esp + 0x20]
mov ecx, dword [esp + 0x28]
mov eax, dword [esp + 0x10]
cmp eax, 2
jl 0x1004639d
mov eax, dword [edi + ebx - 4]
mov dword [esp + 0x20], eax
mov eax, dword [edi]
mov dword [edi + ebx - 4], eax
lea eax, [esp + 0x20]
push ecx
push eax
lea eax, [ebx - 4]
sar eax, 2
push eax
push 0
push edi
call fcn.10044ea0
mov ecx, dword [esp + 0x3c]
add ebx, 0xfffffffc
mov eax, ebx
add esp, 0x14
and eax, 0xfffffffc
cmp eax, 8
jge 0x10046321
pop edi
pop esi
pop ebp
pop ebx
add esp, 8
ret
mov ecx, dword [esi - 4]
lea eax, [esi - 4]
movd xmm0, ecx
cvtdq2pd xmm0, xmm0
comisd xmm1, xmm0
jbe 0x1004638c
mov dword [edx], ecx
mov edx, eax
mov ecx, dword [eax - 4]
sub eax, 4
movd xmm0, ecx
cvtdq2pd xmm0, xmm0
comisd xmm1, xmm0
ja 0x10046374
mov dword [edx], ebp
mov eax, dword [esp + 0x20]
add esi, 4
cmp esi, ebx
jne 0x10046210
pop edi
pop esi
pop ebp
pop ebx
add esp, 8
ret