Function at 0x408161
Capabilities:
Encode data using xor

Disassembly:
push ebp
mov ebp, esp
and esp, 0xfffffff8
sub esp, 0x64
push ebx
push esi
mov esi, dword [ebp + 0x10]
push edi
mov edi, dword [ebp + 8]
lea ecx, [esi + 1]
shr ecx, 1
mov eax, dword [edi]
mov dword [esp + 0x10], eax
call fcn.00403d60
mov ebx, eax
movaps xmm0, xmmword [0x4b4c30]
xor edx, edx
mov dword [esp + 0x14], ebx
mov eax, esi
movups xmmword [esp + 0x24], xmm0
lea ecx, [ebx + ebx]
div ecx
inc eax
mov dword [esp + 0x18], eax
lea ecx, [ebx + eax*2]
mov eax, dword [ebp + 0xc]
lea ebx, [esi + 0x20]
mov esi, dword [esp + 0x10]
add ebx, ecx
mov dword [esp + 0x20], esi
mov ecx, dword [eax + 8]
cmp ecx, 1
mov dword [esp + 0x1c], ecx
lea ecx, [esp + 0x20]
jl 0x4081ea
push 0
push 1
call fcn.00401d22
push 0x4038fb
push 0
push ebx
push dword [ebp + 0xc]
lea edx, [esp + 0x38]
mov ecx, edx
call fcn.00404315
add esp, 0x18
jmp 0x4081f1
mov edx, eax
call fcn.00401e7e
movaps xmm0, xmmword [0x4b4c30]
mov eax, dword [esp + 0x14]
mov dword [esp + 0x34], esi
mov dword [esp + 0x48], esi
mov dword [esp + 0x5c], esi
movups xmmword [esp + 0x38], xmm0
movaps xmm0, xmmword [0x4b4c30]
movups xmmword [esp + 0x4c], xmm0
movaps xmm0, xmmword [0x4b4c30]
movups xmmword [esp + 0x60], xmm0
test eax, eax
jle 0x408295
mov esi, eax
push 0
lea eax, [esp + 0x24]
push ebx
push eax
mov edx, eax
lea ecx, [esp + 0x40]
call fcn.0040363f
add esp, 0xc
lea edx, [esp + 0x34]
mov ecx, edx
push 0
push ebx
push 0
push 1
call fcn.00404481
push 0
push ebx
lea edx, [esp + 0x4c]
lea ecx, [esp + 0x60]
call fcn.00404103
push 0
push ebx
lea edx, [esp + 0x68]
push 0
push 1
mov ecx, edx
call fcn.00404481
push 0x4038fb
push 0
lea eax, [esp + 0x78]
lea edx, [esp + 0x50]
push ebx
push eax
mov ecx, edx
call fcn.00404315
add esp, 0x38
sub esi, 1
jne 0x40822b
xor esi, esi
lea eax, [esp + 0x20]
push esi
push ebx
push eax
mov edx, eax
lea ecx, [esp + 0x68]
call fcn.0040363f
add esp, 0xc
mov ecx, edi
push esi
push esi
call fcn.00401d22
mov esi, dword [esp + 0x20]
pop ecx
pop ecx
cmp esi, 1
jl 0x40833b
lea eax, [esi*2 + 1]
mov dword [esp + 0x10], eax
push 0
push 1
lea ecx, [esp + 0x3c]
call fcn.00401d22
mov eax, dword [esp + 0x18]
lea ecx, [esp + 0x50]
cdq
push edx
push eax
call fcn.00401d22
push 0x4038fb
push 0
lea eax, [esp + 0x60]
lea edx, [esp + 0x4c]
push ebx
push eax
mov ecx, edx
call fcn.00404315
xor dword [edi + 4], 1
lea eax, [esp + 0x54]
push 0x402b42
push 0
push ebx
push eax
mov edx, edi
mov ecx, edi
call fcn.00404315
push 0
lea eax, [esp + 0x90]
mov edx, edi
push ebx
push eax
mov ecx, edi
call fcn.0040363f
sub dword [esp + 0x4c], 2
add esp, 0x3c
sub esi, 1
jne 0x4082cb
xor dword [edi + 4], 1
xor esi, esi
push esi
push ebx
push esi
push 1
mov edx, edi
mov ecx, edi
call fcn.00404481
push esi
lea eax, [esp + 0x34]
mov edx, edi
push ebx
push eax
mov ecx, edi
call fcn.0040363f
mov edx, dword [esp + 0x30]
add esp, 0x1c
mov ecx, edi
push 1
push 0x3fffffff
call fcn.004037f4
pop ecx
pop ecx
lea ecx, [esp + 0x34]
call fcn.00401c92
lea ecx, [esp + 0x48]
call fcn.00401c92
lea ecx, [esp + 0x5c]
call fcn.00401c92
cmp dword [esp + 0x1c], 1
mov esi, dword [ebp + 0x14]
jl 0x4083aa
mov eax, dword [ebp + 0xc]
xor dword [edi + 4], 1
mov eax, dword [eax + 4]
add eax, eax
sub esi, eax
inc esi
test esi, esi
je 0x4083f4
push 6
mov edx, ebx
lea ecx, [esp + 0x24]
call fcn.00406c2c
pop ecx
cmp esi, 2
je 0x4083d6
push 1
push 0x3fffffff
or edx, 0xffffffff
lea ecx, [esp + 0x28]
call fcn.004037f4
pop ecx
pop ecx
push 0x402b42
push 0
push ebx
shr esi, 0x1f
lea edx, [esp + 0x2c]
push edi
mov ecx, edi
mov dword [esp + 0x34], esi
call fcn.00404315
add esp, 0x10
lea ecx, [esp + 0x20]
call fcn.00401c92
push 0x10
pop eax
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret