Function at 0x4af920
Capabilities:
Encode data using xor

Disassembly:
push ebx
mov ebx, esp
sub esp, 8
and esp, 0xfffffff8
add esp, 4
push ebp
mov ebp, dword [ebx + 4]
mov dword [esp + 4], ebp
mov ebp, esp
push 0xffffffffffffffff
push 0x570168
mov eax, dword fs:[0]
push eax
push ebx
sub esp, 0x40
push esi
push edi
mov eax, dword [0x5c524c]
xor eax, ebp
push eax
lea eax, [ebp - 0xc]
mov dword fs:[0], eax
xor eax, eax
cmp dword [ebx + 0x14], eax
je 0x4afb51
mov edi, dword [ebx + 8]
test edi, edi
jle 0x4afb51
mov ecx, dword [ebx + 0xc]
test ecx, ecx
jle 0x4afb51
mov edx, dword [ebx + 0x10]
test edx, edx
jle 0x4afb51
lea eax, [ecx*4]
xor ecx, ecx
mov dword [ebp - 0x20], eax
lea esi, [edi*2 + 1]
imul eax, edx
mov edx, 8
mov dword [ebp - 0x34], eax
mov eax, esi
mul edx
seto cl
neg ecx
or ecx, eax
push ecx
call fcn.00474ac5
add esp, 4
mov dword [ebp - 0x48], 0
lea ecx, [ebp - 0x48]
mov dword [ebp - 0x44], 0
push dword [ebp - 0x3c]
push eax
call fcn.004ac1e0
lea eax, [edi*2 + 8]
mov dword [ebp - 4], 0
push eax
push 0
push dword [ebp - 0x48]
call fcn.0051e890
mov eax, dword [0x5d1918]
add esp, 0xc
test al, 1
jne 0x4afa1a
movsd xmm0, qword [0x5894a0]
or eax, 1
mov dword [0x5d1918], eax
call fcn.00537680
movaps xmm1, xmm0
movsd qword [0x5d1910], xmm1
jmp 0x4afa22
movsd xmm1, qword [0x5d1910]
movd xmm0, edi
mov eax, edi
cvtdq2pd xmm0, xmm0
neg eax
mov dword [ebp - 0x14], eax
mov dword [ebp - 0x38], eax
divsd xmm0, qword [0x589498]
mulsd xmm1, xmm0
movaps xmm2, xmm0
addsd xmm2, xmm0
movsd qword [ebp - 0x40], xmm1
mulsd xmm2, xmm0
movsd qword [ebp - 0x30], xmm2
cmp eax, edi
jg 0x4afaa2
mov eax, dword [ebp - 0x48]
mov esi, dword [ebp - 0x38]
mov dword [ebp - 0x1c], eax
mov eax, esi
imul eax, esi
movd xmm0, eax
cvtdq2pd xmm0, xmm0
divsd xmm0, xmm2
xorps xmm0, xmmword [0x5894b0]
call fcn.005373a0
divsd xmm0, qword [ebp - 0x40]
mov eax, dword [ebp - 0x1c]
inc esi
movsd xmm2, qword [ebp - 0x30]
movsd qword [eax], xmm0
add eax, 8
mov dword [ebp - 0x1c], eax
cmp esi, edi
jle 0x4afa62
lea esi, [edi*2 + 1]
xorps xmm2, xmm2
xor ecx, ecx
movsd qword [ebp - 0x50], xmm2
cmp esi, 4
jl 0x4afaeb
mov eax, dword [ebp - 0x48]
lea edx, [esi - 4]
shr edx, 2
add eax, 0x10
inc edx
lea ecx, [edx*4]
nop word [eax + eax]
addsd xmm2, qword [eax - 0x10]
addsd xmm2, qword [eax - 8]
addsd xmm2, qword [eax]
addsd xmm2, qword [eax + 8]
add eax, 0x20
sub edx, 1
jne 0x4afad0
cmp ecx, esi
jge 0x4afafc
mov eax, dword [ebp - 0x48]
addsd xmm2, qword [eax + ecx*8]
inc ecx
cmp ecx, esi
jl 0x4afaf2
movsd xmm0, qword [0x589490]
unpcklpd xmm2, xmm2
movaps xmm1, xmm2
movaps xmm3, xmm2
subsd xmm1, qword [0x57ea70]
unpcklpd xmm3, xmm3
andps xmm1, xmmword [0x57aac0]
comisd xmm0, xmm1
jbe 0x4afb65
mov esi, dword [ebp - 0x44]
test esi, esi
je 0x4afb4f
or edi, 0xffffffff
mov eax, edi
lock xadd dword [esi + 4], eax
jne 0x4afb4f
mov eax, dword [esi]
mov ecx, esi
call dword [eax]
lock xadd dword [esi + 8], edi
dec edi
jne 0x4afb4f
mov eax, dword [esi]
mov ecx, esi
call dword [eax + 4]
xor eax, eax
mov ecx, dword [ebp - 0xc]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
mov esp, ebp
pop ebp
mov esp, ebx
pop ebx
ret
xor ecx, ecx
test esi, esi
jle 0x4afc33
cmp esi, 8
jb 0x4afbca
mov eax, esi
and eax, 0x80000007
jns 0x4afb82
dec eax
or eax, 0xfffffff8
inc eax
mov edx, esi
sub edx, eax
mov eax, dword [ebp - 0x48]
add eax, 0x20
nop dword [eax]
movups xmm0, xmmword [eax - 0x20]
add ecx, 8
lea eax, [eax + 0x40]
divpd xmm0, xmm3
movups xmmword [eax - 0x60], xmm0
movups xmm0, xmmword [eax - 0x50]
divpd xmm0, xmm3
movups xmmword [eax - 0x50], xmm0
movups xmm0, xmmword [eax - 0x40]
divpd xmm0, xmm3
movups xmmword [eax - 0x40], xmm0
movups xmm0, xmmword [eax - 0x30]
divpd xmm0, xmm3
movups xmmword [eax - 0x30], xmm0
cmp ecx, edx
jl 0x4afb90
cmp ecx, esi
jge 0x4afc33
mov eax, esi
sub eax, ecx
cmp eax, 4
jl 0x4afc10
mov eax, dword [ebp - 0x48]
mov edx, esi
sub edx, ecx
sub edx, 4
shr edx, 2
lea eax, [eax + ecx*8]
add eax, 0x10
inc edx
lea ecx, [ecx + edx*4]
nop
lea eax, [eax + 0x20]
movups xmm0, xmmword [eax - 0x30]
divpd xmm0, xmm2
movups xmmword [eax - 0x30], xmm0
movups xmm0, xmmword [eax - 0x20]
divpd xmm0, xmm2
movups xmmword [eax - 0x20], xmm0
sub edx, 1
jne 0x4afbf0
cmp ecx, esi
jge 0x4afc33
mov eax, dword [ebp - 0x48]
nop word [eax + eax]
movsd xmm0, qword [eax + ecx*8]
divsd xmm0, xmm2
movsd qword [eax + ecx*8], xmm0
inc ecx
cmp ecx, esi
jl 0x4afc20
mov eax, dword [ebp - 0x34]
lea eax, [eax + eax*2]
shl eax, 3
push eax
mov dword [ebp - 0x38], eax
call fcn.004e0540
mov esi, eax
add esp, 4
mov dword [ebp - 0x3c], esi
test esi, esi
je 0x4afb27
push dword [ebp - 0x38]
push 0
push esi
call fcn.0051e890
mov eax, dword [ebx + 0x10]
add esp, 0xc
xor edx, edx
mov dword [ebp - 0x38], eax
mov eax, dword [ebp - 0x14]
mov dword [ebp - 0x28], edx
mov dword [ebp - 0x18], edx
mov edi, dword [ebx + 0xc]
mov ecx, eax
mov dword [ebp - 0x34], edi
mov edi, dword [ebx + 8]
mov dword [ebp - 0x2c], ecx
cmp eax, edi
jg 0x4afd3f
mov edi, dword [ebp - 0x48]
mov eax, edx
shr eax, 2
mov dword [ebp - 0x1c], ecx
lea edx, [eax + eax*2]
mov eax, dword [ebx + 8]
sub eax, dword [ebp - 0x14]
inc eax
mov dword [ebp - 0x24], eax
xor eax, eax
mov esi, dword [ebp - 0x3c]
test ecx, ecx
cmovns eax, ecx
mov ecx, dword [ebx + 0xc]
dec ecx
cmp eax, ecx
cmovge eax, ecx
mov ecx, dword [ebp - 0x18]
lea ecx, [ecx + eax*4]
mov eax, dword [ebx + 0x14]
shr ecx, 2
movzx eax, byte [eax + ecx*4 + 2]
movd xmm0, eax
mov eax, dword [ebx + 0x14]
cvtdq2pd xmm0, xmm0
mulsd xmm0, qword [edi]
addsd xmm0, qword [esi + edx*8]
movsd qword [esi + edx*8], xmm0
mov eax, dword [eax + ecx*4]
shr eax, 8
movzx eax, al
movd xmm0, eax
mov eax, dword [ebx + 0x14]
cvtdq2pd xmm0, xmm0
mulsd xmm0, qword [edi]
addsd xmm0, qword [esi + edx*8 + 8]
movsd qword [esi + edx*8 + 8], xmm0
movzx eax, byte [eax + ecx*4]
mov ecx, dword [ebp - 0x1c]
inc ecx
mov dword [ebp - 0x1c], ecx
movd xmm0, eax
cvtdq2pd xmm0, xmm0
mulsd xmm0, qword [edi]
add edi, 8
sub dword [ebp - 0x24], 1
addsd xmm0, qword [esi + edx*8 + 0x10]
movsd qword [esi + edx*8 + 0x10], xmm0
jne 0x4afca2
mov eax, dword [ebp - 0x14]
mov ecx, dword [ebp - 0x2c]
mov edx, dword [ebp - 0x28]
mov edi, dword [ebx + 8]
add edx, 4
inc ecx
sub dword [ebp - 0x34], 1
mov dword [ebp - 0x28], edx
mov dword [ebp - 0x2c], ecx
jne 0x4afc82
mov ecx, dword [ebp - 0x20]
add dword [ebp - 0x18], ecx
sub dword [ebp - 0x38], 1
jne 0x4afc74
movsd xmm5, qword [0x5894a8]
xor edx, edx
mov dword [ebp - 0x1c], 0
mov dword [ebp - 0x18], edx
nop word [eax + eax]
xor ecx, ecx
mov dword [ebp - 0x34], ecx
movsd xmm0, qword [ebp - 0x50]
shl ecx, 2
movaps xmm2, xmm0
add edx, ecx
mov dword [ebp - 0x3c], ecx
mov dword [ebp - 0x2c], edx
movaps xmm3, xmm0
movaps xmm4, xmm0
cmp eax, edi
jg 0x4afe0e
mov ecx, dword [ebx + 0x10]
mov edx, dword [ebp - 0x1c]
dec ecx
mov edi, dword [ebp - 0x48]
add edx, eax
mov dword [ebp - 0x38], ecx
mov ecx, dword [ebx + 8]
sub ecx, eax
inc ecx
movsd xmm1, qword [edi]
xor eax, eax
test edx, edx
cmovns eax, edx
cmp eax, dword [ebp - 0x38]
cmovge eax, dword [ebp - 0x38]
add edi, 8
imul eax, dword [ebp - 0x20]
inc edx
add eax, dword [ebp - 0x3c]
shr eax, 2
lea eax, [eax + eax*2]
movsd xmm0, qword [esi + eax*8]
mulsd xmm0, xmm1
addsd xmm2, xmm0
movsd xmm0, qword [esi + eax*8 + 8]
mulsd xmm0, xmm1
addsd xmm3, xmm0
movsd xmm0, qword [esi + eax*8 + 0x10]
mulsd xmm0, xmm1
addsd xmm4, xmm0
sub ecx, 1
jne 0x4afdb7
mov edi, dword [ebx + 8]
mov edx, dword [ebp - 0x2c]
movaps xmm0, xmm5
shr edx, 2
minsd xmm0, xmm2
movaps xmm1, xmm5
minsd xmm1, xmm3
movaps xmm2, xmm5
minsd xmm2, xmm4
cvttsd2si eax, xmm0
movzx ecx, al
cvttsd2si eax, xmm1
shl ecx, 8
movzx eax, al
or ecx, eax
cvttsd2si eax, xmm2
shl ecx, 8
movzx eax, al
or ecx, eax
mov eax, dword [ebx + 0x14]
mov dword [eax + edx*4], ecx
mov ecx, dword [ebp - 0x34]
mov eax, dword [ebp - 0x14]
inc ecx
mov edx, dword [ebp - 0x18]
mov dword [ebp - 0x34], ecx
cmp ecx, dword [ebx + 0xc]
jl 0x4afd85
mov edx, dword [ebp - 0x1c]
mov eax, dword [ebp - 0x20]
inc edx
add dword [ebp - 0x18], eax
cmp edx, dword [ebx + 0x10]
mov eax, dword [ebp - 0x14]
mov dword [ebp - 0x1c], edx
mov edx, dword [ebp - 0x18]
jl 0x4afd80
mov ecx, dword [ebp - 0x44]
mov dword [ebp - 0x3c], 1
mov dword [ebp - 4], 0xffffffff
test ecx, ecx
je 0x4afeb2
or edi, 0xffffffff
mov eax, edi
lock xadd dword [ecx + 4], eax
jne 0x4afeb2
mov eax, dword [ecx]
call dword [eax]
mov ecx, dword [ebp - 0x44]
lock xadd dword [ecx + 8], edi
dec edi
jne 0x4afeb2
mov edx, dword [ecx]
call dword [edx + 4]
push esi
call fcn.004e0560
mov eax, dword [ebp - 0x3c]
add esp, 4
mov ecx, dword [ebp - 0xc]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
mov esp, ebp
pop ebp
mov esp, ebx
pop ebx
ret