Function at 0x501700
Capabilities:
Encode data using xor

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x30
mov eax, dword [ebp + 0xc]
cdq
and edx, 3
add eax, edx
sar eax, 2
push esi
mov esi, dword [sym.imp.api_ms_win_crt_heap_l1_1_0.dll_malloc]
push edi
lea ecx, [eax*4]
mov dword [ebp - 0xc], eax
push ecx
call esi
mov ecx, dword [ebp - 0xc]
mov edi, eax
add ecx, dword [ebp + 0xc]
shl ecx, 2
push ecx
mov dword [ebp - 0x18], edi
call esi
mov esi, dword [ebp + 0xc]
mov dword [ebp - 4], eax
mov eax, esi
sar eax, 1
mov dword [ebp - 0x1c], eax
movd xmm0, esi
cvtdq2ps xmm0, xmm0
movss dword [ebp - 0x10], xmm0
cvtps2pd xmm0, xmm0
call sub.api_ms_win_crt_math_l1_1_0.dll__libm_sse2_log_precise
movsd qword [ebp - 0x30], xmm0
movsd xmm0, qword [0x53b330]
call sub.api_ms_win_crt_math_l1_1_0.dll__libm_sse2_log_precise
movsd xmm1, qword [ebp - 0x30]
divsd xmm1, xmm0
addsd xmm1, qword [0x514588]
movsd qword [ebp - 0x30], xmm1
fld qword [ebp - 0x30]
fstp qword [esp]
call sub.api_ms_win_crt_math_l1_1_0.dll_floor
add esp, 8
call fcn.0050a180
mov edx, dword [ebp + 8]
mov ecx, dword [ebp - 4]
movss xmm1, dword [0x546234]
mov dword [ebp - 0x2c], eax
mov dword [edx], esi
xor esi, esi
mov dword [edx + 4], eax
mov dword [edx + 8], ecx
mov dword [edx + 0xc], edi
cmp dword [ebp - 0xc], esi
jle 0x501897
mov eax, dword [ebp + 0xc]
movaps xmm2, xmm1
divss xmm2, dword [ebp - 0x10]
add eax, eax
mov edx, dword [ebp - 0x1c]
mov dword [ebp - 8], 1
lea edi, [ecx + edx*4]
movd xmm0, eax
xor eax, eax
cvtdq2ps xmm0, xmm0
mov dword [ebp - 0x14], eax
movss dword [ebp - 0x28], xmm2
divss xmm1, xmm0
movss dword [ebp - 0x24], xmm1
nop
movd xmm0, eax
cvtdq2ps xmm0, xmm0
mulss xmm0, xmm2
cvtps2pd xmm0, xmm0
movsd qword [ebp - 0x20], xmm0
call sub.api_ms_win_crt_math_l1_1_0.dll__libm_sse2_cos_precise
mov eax, dword [ebp - 4]
xorps xmm1, xmm1
cvtsd2ss xmm1, xmm0
movsd xmm0, qword [ebp - 0x20]
movss dword [eax + esi*8], xmm1
call sub.api_ms_win_crt_math_l1_1_0.dll__libm_sse2_sin_precise
xorps xmm0, xmmword [0x515ce0]
mov eax, dword [ebp - 4]
cvtsd2ss xmm0, xmm0
movss dword [eax + esi*8 + 4], xmm0
movd xmm0, dword [ebp - 8]
cvtdq2ps xmm0, xmm0
mulss xmm0, dword [ebp - 0x24]
cvtps2pd xmm0, xmm0
movsd qword [ebp - 0x20], xmm0
call sub.api_ms_win_crt_math_l1_1_0.dll__libm_sse2_cos_precise
xorps xmm1, xmm1
cvtsd2ss xmm1, xmm0
movsd xmm0, qword [ebp - 0x20]
movss dword [edi], xmm1
call sub.api_ms_win_crt_math_l1_1_0.dll__libm_sse2_sin_precise
mov eax, dword [ebp - 0x14]
lea edi, [edi + 8]
add dword [ebp - 8], 2
inc esi
movss xmm2, dword [ebp - 0x28]
add eax, 4
cvtsd2ss xmm0, xmm0
mov dword [ebp - 0x14], eax
movss dword [edi - 4], xmm0
cmp esi, dword [ebp - 0xc]
jl 0x5017f0
movss xmm1, dword [0x546234]
mov ecx, dword [ebp - 4]
mov esi, dword [ebp + 0xc]
mov eax, esi
cdq
and edx, 7
add eax, edx
sar eax, 3
mov dword [ebp - 0x24], eax
test eax, eax
jle 0x50199f
divss xmm1, dword [ebp - 0x10]
mov edi, 2
mov dword [ebp + 0xc], eax
lea esi, [ecx + esi*4]
movss dword [ebp - 0x28], xmm1
xorps xmm0, xmm0
cvtsi2ss xmm0, edi
mulss xmm0, xmm1
cvtps2pd xmm0, xmm0
movsd qword [ebp - 0x20], xmm0
call sub.api_ms_win_crt_math_l1_1_0.dll__libm_sse2_cos_precise
mulsd xmm0, qword [0x514588]
xorps xmm1, xmm1
cvtsd2ss xmm1, xmm0
movsd xmm0, qword [ebp - 0x20]
movss dword [esi], xmm1
call sub.api_ms_win_crt_math_l1_1_0.dll__libm_sse2_sin_precise
xorps xmm0, xmmword [0x515ce0]
lea esi, [esi + 8]
mulsd xmm0, qword [0x514588]
add edi, 4
sub dword [ebp + 0xc], 1
movss xmm1, dword [ebp - 0x28]
cvtsd2ss xmm0, xmm0
movss dword [esi - 4], xmm0
jne 0x5018c5
mov eax, dword [ebp - 0x2c]
mov edi, 1
mov esi, edi
mov dword [ebp - 0xc], 0
lea ecx, [eax - 2]
shl esi, cl
lea ecx, [eax - 1]
shl edi, cl
mov eax, esi
mov dword [ebp - 8], esi
dec edi
mov dword [ebp + 0xc], eax
xor ecx, ecx
xor edx, edx
mov dword [ebp - 0x14], ecx
test eax, eax
je 0x50197a
mov eax, esi
mov ecx, dword [ebp + 0xc]
mov dword [ebp + 0xc], ecx
mov ecx, dword [ebp - 0x14]
test dword [ebp - 0xc], eax
je 0x501965
bts edx, ecx
inc ecx
mov eax, esi
sar eax, cl
mov dword [ebp - 0x14], ecx
test eax, eax
jne 0x501954
mov eax, dword [ebp + 0xc]
mov dword [ebp + 0xc], eax
mov dword [ebp - 8], esi
mov ecx, dword [ebp - 0xc]
mov eax, edx
mov esi, dword [ebp - 0x18]
not eax
and eax, edi
dec eax
mov dword [esi + ecx*8], eax
mov eax, esi
mov esi, dword [ebp - 8]
mov dword [eax + ecx*8 + 4], edx
inc ecx
mov eax, dword [ebp + 0xc]
mov dword [ebp - 0xc], ecx
cmp ecx, dword [ebp - 0x24]
jl 0x501947
movss xmm0, dword [0x546238]
divss xmm0, dword [ebp - 0x10]
mov eax, dword [ebp + 8]
pop edi
pop esi
movss dword [eax + 0x10], xmm0
mov esp, ebp
pop ebp
ret