Function at 0x406860
Capabilities:
Encode data using xor

Disassembly:
push ebp
push ebx
push edi
push esi
sub esp, 0x34
mov esi, ecx
mov eax, dword [ecx + 0x2c]
mov edx, dword [ecx + 0x74]
lea ecx, [eax - 0x106]
mov dword [esp + 0x18], ecx
mov dword [esp + 0x10], eax
movd xmm0, eax
pshufd xmm0, xmm0, 0x50
movdqu xmmword [esp + 0x24], xmm0
nop dword [eax]
mov ebx, dword [esi + 0x3c]
mov ebp, dword [esi + 0x6c]
add edx, ebp
sub ebx, edx
mov eax, dword [esi + 0x2c]
add eax, dword [esp + 0x18]
cmp ebp, eax
jb 0x406aa0
mov eax, dword [esi + 0x38]
mov edi, dword [esp + 0x10]
lea ecx, [eax + edi]
mov edx, edi
sub edx, ebx
push edx
push ecx
push eax
call sub.msvcrt.dll_memcpy
add esp, 0xc
movq xmm0, qword [esi + 0x6c]
movdqu xmm1, xmmword [esp + 0x24]
psubd xmm0, xmm1
movq qword [esi + 0x6c], xmm0
sub dword [esi + 0x5c], edi
movd eax, xmm0
cmp dword [esi + 0x16b4], eax
jbe 0x4068eb
mov dword [esi + 0x16b4], eax
mov dword [esp + 8], eax
mov dword [esp + 0xc], ebx
mov eax, dword [esi + 0x2c]
mov edi, dword [esi + 0x4c]
lea ebp, [edi + edi]
add ebp, dword [esi + 0x44]
movd xmm0, eax
cmp edi, 8
movdqa xmm5, xmmword [0x6b0f40]
movdqa xmm6, xmmword [0x6b0f50]
pcmpeqd xmm7, xmm7
jae 0x406930
mov ecx, ebp
mov edx, edi
xor ebp, ebp
jmp 0x4069bd
mov ebx, edi
and ebx, 0xfffffff8
mov ecx, ebp
sub ecx, ebx
sub ecx, ebx
mov dword [esp], edi
mov edx, edi
and edx, 7
pshufd xmm1, xmm0, 0
mov dword [esp + 4], ebx
mov edi, ebx
neg edi
xor ebx, ebx
nop word cs:[eax + eax]
movdqu xmm2, xmmword [ebp + ebx*2 - 0x10]
movdqa xmm3, xmm1
pxor xmm3, xmm5
movdqa xmm4, xmm6
pcmpgtd xmm4, xmm3
movdqa xmm3, xmm1
pand xmm3, xmm4
pxor xmm4, xmm7
por xmm4, xmm3
pslld xmm4, 0x10
psrad xmm4, 0x10
packssdw xmm4, xmm4
pshuflw xmm3, xmm4, 0x1b
pshufhw xmm3, xmm3, 0x1b
psubusw xmm2, xmm3
movdqu xmmword [ebp + ebx*2 - 0x10], xmm2
add ebx, 0xfffffff8
cmp edi, ebx
jne 0x406960
mov edi, dword [esp + 4]
cmp dword [esp], edi
mov ebp, 0
je 0x4069e4
neg edx
xor edi, edi
nop word cs:[eax + eax]
movzx ebx, word [ecx + edi*2 - 2]
sub ebx, eax
cmovb ebx, ebp
mov word [ecx + edi*2 - 2], bx
dec edi
cmp edx, edi
jne 0x4069d0
lea edi, [eax + eax]
add edi, dword [esi + 0x40]
cmp eax, 8
jae 0x406a00
mov ecx, edi
mov edx, eax
jmp 0x406a79
mov ebp, eax
and ebp, 0xfffffff8
mov ecx, edi
sub ecx, ebp
sub ecx, ebp
mov edx, eax
and edx, 7
pshufd xmm0, xmm0, 0
mov dword [esp], ebp
neg ebp
xor ebx, ebx
nop dword [eax]
movdqu xmm1, xmmword [edi + ebx*2 - 0x10]
movdqa xmm2, xmm0
pxor xmm2, xmm5
movdqa xmm3, xmm6
pcmpgtd xmm3, xmm2
movdqa xmm2, xmm0
pand xmm2, xmm3
pxor xmm3, xmm7
por xmm3, xmm2
pslld xmm3, 0x10
psrad xmm3, 0x10
packssdw xmm3, xmm3
pshuflw xmm2, xmm3, 0x1b
pshufhw xmm2, xmm2, 0x1b
psubusw xmm1, xmm2
movdqu xmmword [edi + ebx*2 - 0x10], xmm1
add ebx, 0xfffffff8
cmp ebp, ebx
jne 0x406a20
cmp eax, dword [esp]
mov ebp, 0
je 0x406a94
neg edx
xor edi, edi
nop dword [eax]
movzx ebx, word [ecx + edi*2 - 2]
sub ebx, eax
cmovb ebx, ebp
mov word [ecx + edi*2 - 2], bx
dec edi
cmp edx, edi
jne 0x406a80
mov ebx, dword [esp + 0xc]
add ebx, dword [esp + 0x10]
mov ebp, dword [esp + 8]
mov edi, dword [esi]
mov ecx, dword [edi + 4]
test ecx, ecx
je 0x406bd8
mov eax, dword [esi + 0x74]
cmp ecx, ebx
cmovb ebx, ecx
test ebx, ebx
je 0x406b08
add ebp, dword [esi + 0x38]
add ebp, eax
sub ecx, ebx
mov dword [edi + 4], ecx
push ebx
push dword [edi]
push ebp
call sub.msvcrt.dll_memcpy
add esp, 0xc
mov eax, dword [edi + 0x1c]
mov eax, dword [eax + 0x18]
cmp eax, 2
je 0x406af0
cmp eax, 1
jne 0x406b00
push ebx
push ebp
push dword [edi + 0x30]
call fcn.004b3460
jmp 0x406afa
push ebx
push ebp
push dword [edi + 0x30]
call fcn.00405ea0
add esp, 0xc
mov dword [edi + 0x30], eax
add dword [edi], ebx
add dword [edi + 8], ebx
mov eax, dword [esi + 0x74]
add eax, ebx
mov dword [esi + 0x74], eax
mov edx, dword [esi + 0x16b4]
mov dword [esp + 4], eax
lea ecx, [edx + eax]
cmp ecx, 3
jb 0x406bc0
mov edi, dword [esi + 0x6c]
sub edi, edx
mov eax, dword [esi + 0x38]
mov ecx, dword [esi + 0x54]
mov dword [esp + 0x14], ecx
movzx ebp, byte [eax + edi]
mov dword [esi + 0x48], ebp
mov ecx, dword [esi + 0x58]
mov dword [esp + 0x1c], ecx
shl ebp, cl
mov dword [esp + 0x20], eax
movzx ebx, byte [eax + edi + 1]
xor ebx, ebp
and ebx, dword [esp + 0x14]
mov dword [esi + 0x48], ebx
nop word cs:[eax + eax]
sub edx, 1
jb 0x406bc0
mov ecx, dword [esp + 0x1c]
shl ebx, cl
mov eax, dword [esp + 0x20]
movzx ebp, byte [eax + edi + 2]
xor ebp, ebx
and ebp, dword [esp + 0x14]
mov dword [esi + 0x48], ebp
mov eax, dword [esi + 0x40]
mov dword [esp + 0xc], eax
mov eax, dword [esi + 0x44]
movzx ecx, word [eax + ebp*2]
mov word [esp + 8], cx
mov ebx, dword [esi + 0x34]
and ebx, edi
mov ecx, dword [esp + 0xc]
mov dword [esp], edx
movzx edx, word [esp + 8]
mov word [ecx + ebx*2], dx
mov edx, dword [esp]
mov word [eax + ebp*2], di
inc edi
mov dword [esi + 0x16b4], edx
mov eax, dword [esp + 4]
add eax, edx
mov ebx, ebp
cmp eax, 2
ja 0x406b60
mov edx, dword [esp + 4]
cmp edx, 0x105
ja 0x406bd8
mov eax, dword [esi]
cmp dword [eax + 4], 0
jne 0x406890
mov eax, dword [esi + 0x16c0]
mov ecx, dword [esi + 0x3c]
mov edi, ecx
sub edi, eax
jbe 0x406c40
mov ebx, dword [esi + 0x74]
add ebx, dword [esi + 0x6c]
cmp eax, ebx
jae 0x406c16
sub ecx, ebx
cmp ecx, 0x102
mov edi, 0x102
cmovb edi, ecx
mov eax, dword [esi + 0x38]
add eax, ebx
push edi
push 0
push eax
call sub.msvcrt.dll_memset
add esp, 0xc
add edi, ebx
jmp 0x406c3a
add ebx, 0x102
sub ebx, eax
jbe 0x406c40
cmp ebx, edi
cmovb edi, ebx
add eax, dword [esi + 0x38]
push edi
push 0
push eax
call sub.msvcrt.dll_memset
add esp, 0xc
add edi, dword [esi + 0x16c0]
mov dword [esi + 0x16c0], edi
add esp, 0x34
pop esi
pop edi
pop ebx
pop ebp
ret