// File: Reputeless[P]PerlinNoise/example.cpp
// Function: Test()
void Test()
{
	siv::PerlinNoise perlinA{ std::random_device{} };
	siv::PerlinNoise perlinB;

	perlinB.deserialize(perlinA.serialize());

	assert(perlinA.octave3D(0.1, 0.2, 0.3, 4)
		== perlinB.octave3D(0.1, 0.2, 0.3, 4));

	perlinA.reseed(12345u);
	perlinB.reseed(12345u);

	assert(perlinA.octave3D(0.1, 0.2, 0.3, 4)
		== perlinB.octave3D(0.1, 0.2, 0.3, 4));

	perlinA.reseed(std::mt19937{ 67890u });
	perlinB.reseed(std::mt19937{ 67890u });

	assert(perlinA.octave3D(0.1, 0.2, 0.3, 4)
		== perlinB.octave3D(0.1, 0.2, 0.3, 4));

	for (std::int32_t y = 0; y < 20; ++y)
	{
		for (std::int32_t x = 0; x < 20; ++x)
		{
			const double noise = perlinA.octave2D_01(x * 0.1, y * 0.1, 6);
			std::cout << static_cast<int>(std::floor(noise * 10) - 0.5);
		}
		std::cout << '\n';
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x3ce0, %rsp           # imm = 0x3CE0
leaq -0x1488(%rbp), %rdi
movq %rdi, -0x3cc0(%rbp)
callq 0x2e00
movq -0x3cc0(%rbp), %rsi
leaq -0x100(%rbp), %rdi
callq 0x2ea0
jmp 0x24d3
leaq -0x1488(%rbp), %rdi
callq 0x2ed0
leaq -0x1594(%rbp), %rdi
callq 0x2f00
leaq -0x100(%rbp), %rdi
callq 0x2f60
movq %rax, %rsi
leaq -0x1594(%rbp), %rdi
callq 0x2f30
leaq -0x100(%rbp), %rdi
movsd 0x3af3(%rip), %xmm0     # 0x6008
movsd 0x3af3(%rip), %xmm1     # 0x6010
movsd 0x3af3(%rip), %xmm2     # 0x6018
movl $0x4, %esi
movsd 0x3aee(%rip), %xmm3     # 0x6020
callq 0x2f70
movsd %xmm0, -0x3cc8(%rbp)
leaq -0x1594(%rbp), %rdi
movsd 0x3aba(%rip), %xmm0     # 0x6008
movsd 0x3aba(%rip), %xmm1     # 0x6010
movsd 0x3aba(%rip), %xmm2     # 0x6018
movl $0x4, %esi
movsd 0x3ab5(%rip), %xmm3     # 0x6020
callq 0x2f70
movaps %xmm0, %xmm1
movsd -0x3cc8(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jne 0x2585
jp 0x2585
jmp 0x25c7
leaq 0x3adc(%rip), %rdi      # 0x6068
leaq 0x3b1e(%rip), %rsi      # 0x60b1
movl $0x86, %edx
leaq 0x3b1e(%rip), %rcx      # 0x60bd
callq 0x20d0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1490(%rbp)
movl %eax, -0x1494(%rbp)
leaq -0x1488(%rbp), %rdi
callq 0x2ed0
jmp 0x2857
leaq -0x100(%rbp), %rdi
movl $0x3039, %esi           # imm = 0x3039
callq 0x2fc0
leaq -0x1594(%rbp), %rdi
movl $0x3039, %esi           # imm = 0x3039
callq 0x2fc0
leaq -0x100(%rbp), %rdi
movsd 0x3a10(%rip), %xmm0     # 0x6008
movsd 0x3a10(%rip), %xmm1     # 0x6010
movsd 0x3a10(%rip), %xmm2     # 0x6018
movl $0x4, %esi
movsd 0x3a0b(%rip), %xmm3     # 0x6020
callq 0x2f70
movsd %xmm0, -0x3cd0(%rbp)
leaq -0x1594(%rbp), %rdi
movsd 0x39d7(%rip), %xmm0     # 0x6008
movsd 0x39d7(%rip), %xmm1     # 0x6010
movsd 0x39d7(%rip), %xmm2     # 0x6018
movl $0x4, %esi
movsd 0x39d2(%rip), %xmm3     # 0x6020
callq 0x2f70
movaps %xmm0, %xmm1
movsd -0x3cd0(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jne 0x2668
jp 0x2668
jmp 0x2687
leaq 0x39f9(%rip), %rdi      # 0x6068
leaq 0x3a3b(%rip), %rsi      # 0x60b1
movl $0x8c, %edx
leaq 0x3a3b(%rip), %rcx      # 0x60bd
callq 0x20d0
leaq -0x2920(%rbp), %rdi
movl $0x10932, %esi          # imm = 0x10932
callq 0x3080
leaq -0x100(%rbp), %rdi
leaq -0x2920(%rbp), %rsi
callq 0x3010
leaq -0x3ca8(%rbp), %rdi
movl $0x10932, %esi          # imm = 0x10932
callq 0x3080
leaq -0x1594(%rbp), %rdi
leaq -0x3ca8(%rbp), %rsi
callq 0x3010
leaq -0x100(%rbp), %rdi
movsd 0x392a(%rip), %xmm0     # 0x6008
movsd 0x392a(%rip), %xmm1     # 0x6010
movsd 0x392a(%rip), %xmm2     # 0x6018
movl $0x4, %esi
movsd 0x3925(%rip), %xmm3     # 0x6020
callq 0x2f70
movsd %xmm0, -0x3cd8(%rbp)
leaq -0x1594(%rbp), %rdi
movsd 0x38f1(%rip), %xmm0     # 0x6008
movsd 0x38f1(%rip), %xmm1     # 0x6010
movsd 0x38f1(%rip), %xmm2     # 0x6018
movl $0x4, %esi
movsd 0x38ec(%rip), %xmm3     # 0x6020
callq 0x2f70
movaps %xmm0, %xmm1
movsd -0x3cd8(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jne 0x274e
jp 0x274e
jmp 0x276d
leaq 0x3913(%rip), %rdi      # 0x6068
leaq 0x3955(%rip), %rsi      # 0x60b1
movl $0x92, %edx
leaq 0x3955(%rip), %rcx      # 0x60bd
callq 0x20d0
movl $0x0, -0x3cac(%rbp)
cmpl $0x14, -0x3cac(%rbp)
jge 0x284e
movl $0x0, -0x3cb0(%rbp)
cmpl $0x14, -0x3cb0(%rbp)
jge 0x2829
cvtsi2sdl -0x3cb0(%rbp), %xmm0
movsd 0x385d(%rip), %xmm1     # 0x6008
mulsd %xmm1, %xmm0
cvtsi2sdl -0x3cac(%rbp), %xmm1
movsd 0x3849(%rip), %xmm2     # 0x6008
mulsd %xmm2, %xmm1
leaq -0x100(%rbp), %rdi
movl $0x6, %esi
movsd 0x3849(%rip), %xmm2     # 0x6020
callq 0x30b0
movsd %xmm0, -0x3cb8(%rbp)
movsd 0x383c(%rip), %xmm0     # 0x6028
mulsd -0x3cb8(%rbp), %xmm0
callq 0x22d0
movsd 0x381f(%rip), %xmm1     # 0x6020
subsd %xmm1, %xmm0
cvttsd2si %xmm0, %esi
movq 0x67c0(%rip), %rdi      # 0x8fd0
callq 0x22f0
movl -0x3cb0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3cb0(%rbp)
jmp 0x278e
movq 0x67a0(%rip), %rdi      # 0x8fd0
movl $0xa, %esi
callq 0x2220
movl -0x3cac(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3cac(%rbp)
jmp 0x2777
addq $0x3ce0, %rsp           # imm = 0x3CE0
popq %rbp
retq
movq -0x1490(%rbp), %rdi
callq 0x2300
nopw %cs:(%rax,%rax)