// File: /workspace/github_cpp_makefile_star2_O2/iannisdezwart[P]forcefield-visualiser/./motion.hpp
// Function: motion::three_body()
void three_body()
	{
		// The center of the image

		Vector<2> image_centre({ WIDTH / 2, HEIGHT / 2 });

		// Set the planets and their rotation vectors

		// Planet 1

		Mass planet_1(200, 0, 3);
		masses.push_back(planet_1);

		double rotation_1 = 0.003333 * 2 * M_PI;

		Matrix<2, 2> rotation_matrix_1({
			{ cos(rotation_1), -sin(rotation_1) },
			{ sin(rotation_1), cos(rotation_1) },
		});

		// Planet 2

		Mass planet_2(-150, 261, 2);
		masses.push_back(planet_2);

		double rotation_2 = 0.006666 * 2 * M_PI;

		Matrix<2, 2> rotation_matrix_2({
			{ cos(rotation_2), -sin(rotation_2) },
			{ sin(rotation_2), cos(rotation_2) },
		});

		// Planet 3

		Mass planet_3(-200, 348, 1);
		masses.push_back(planet_3);

		double rotation_3 = 0.01 * 2 * M_PI;

		Matrix<2, 2> rotation_matrix_3({
			{ cos(rotation_3), -sin(rotation_3) },
			{ sin(rotation_3), cos(rotation_3) },
		});

		// Render 300 frames

		for (int i = 0; i < 300; i++) {
			string frame_number = to_string(i);

			if (frame_number.length() != 4) {
				frame_number = string(4 - frame_number.length(), '0') + frame_number;
			}

			// Move the planets

			// Planet 1

			planet_1.position = rotation_matrix_1 * planet_1.position;
			masses[0].position = planet_1.position + image_centre;

			// Planet 2

			planet_2.position = rotation_matrix_2 * planet_2.position;
			masses[1].position = planet_2.position + image_centre;

			// Planet 3

			planet_3.position = rotation_matrix_3 * planet_3.position;
			masses[2].position = planet_3.position + image_centre;

			// Render the frame

			render_image("output/" + frame_number + ".png", MULTI_THREADED);

			cout << "Rendered frame " << i << "/" << "300\n";
		}
	}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x138, %rsp            # imm = 0x138
leaq 0x38(%rsp), %rbx
xorl %ebp, %ebp
pushq $0x3
popq %rcx
movq %rbx, %rdi
movl $0xc8, %esi
xorl %edx, %edx
callq 0x472c
leaq 0x7403(%rip), %r14      # 0xb290
movq %r14, %rdi
movq %rbx, %rsi
callq 0x476a
movaps 0x31f1(%rip), %xmm0     # 0x7090
leaq 0x90(%rsp), %r15
movaps %xmm0, (%r15)
leaq 0xb0(%rsp), %rsi
movq %r15, (%rsi)
pushq $0x2
popq %rbx
movq %rbx, 0x8(%rsi)
movaps 0x31dc(%rip), %xmm0     # 0x70a0
leaq 0x70(%rsp), %r12
movaps %xmm0, (%r12)
movq %r12, 0x10(%rsi)
movq %rbx, 0x18(%rsi)
leaq 0x118(%rsp), %rdi
movq %rbx, %rdx
callq 0x49b6
leaq 0x20(%rsp), %r13
pushq $0x2
popq %rcx
movq %r13, %rdi
movl $0xffffff6a, %esi       # imm = 0xFFFFFF6A
movl $0x105, %edx            # imm = 0x105
callq 0x472c
movq %r14, %rdi
movq %r13, %rsi
callq 0x476a
movaps 0x319e(%rip), %xmm0     # 0x70b0
movaps %xmm0, (%r12)
movq %r12, (%r15)
movq %rbx, 0x8(%r15)
movaps 0x319b(%rip), %xmm0     # 0x70c0
leaq 0xd0(%rsp), %r13
movaps %xmm0, (%r13)
movq %r13, 0x10(%r15)
movq %rbx, 0x18(%r15)
leaq 0xb0(%rsp), %rdi
leaq 0x90(%rsp), %rsi
movq %rbx, %rdx
callq 0x49b6
leaq 0x8(%rsp), %r15
pushq $0x1
popq %rcx
movq %r15, %rdi
movl $0xffffff38, %esi       # imm = 0xFFFFFF38
movl $0x15c, %edx            # imm = 0x15C
callq 0x472c
movq %r14, %rdi
movq %r15, %rsi
callq 0x476a
movaps 0x30f2(%rip), %xmm0     # 0x7070
movaps %xmm0, (%r13)
movq %r13, (%r12)
movq %rbx, 0x8(%r12)
movaps 0x30ed(%rip), %xmm0     # 0x7080
leaq 0x50(%rsp), %r14
movaps %xmm0, (%r14)
movq %r14, 0x10(%r12)
movq %rbx, 0x18(%r12)
leaq 0x90(%rsp), %rdi
leaq 0x70(%rsp), %rsi
movq %rbx, %rdx
callq 0x49b6
leaq 0xf8(%rsp), %r15
leaq 0x31b3(%rip), %rbx      # 0x717d
cmpl $0x12c, %ebp            # imm = 0x12C
je 0x41a3
movq %r12, %rdi
movl %ebp, %esi
callq 0x4a2c
movq 0x78(%rsp), %rax
cmpq $0x4, %rax
je 0x402f
pushq $0x4
popq %rsi
subq %rax, %rsi
leaq 0x60(%rsp), %rax
movq %rax, 0x50(%rsp)
movq %r14, %rdi
pushq $0x30
popq %rdx
callq 0x32c0
movq %r13, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x4a85
movq %r12, %rdi
movq %r13, %rsi
callq 0x32d0
movq %r13, %rdi
callq 0x3120
movq %r14, %rdi
callq 0x3120
movsd 0x38(%rsp), %xmm0
movsd 0x40(%rsp), %xmm1
leaq 0x118(%rsp), %rdi
callq 0x4aa4
movsd %xmm0, 0x38(%rsp)
movsd %xmm1, 0x40(%rsp)
leaq 0x38(%rsp), %rdi
movsd 0x2fe7(%rip), %xmm0     # 0x7048
movsd 0x2fe7(%rip), %xmm1     # 0x7050
callq 0x4b18
movq 0x721b(%rip), %rax      # 0xb290
movsd %xmm0, (%rax)
movsd %xmm1, 0x8(%rax)
movsd 0x20(%rsp), %xmm0
movsd 0x28(%rsp), %xmm1
leaq 0xb0(%rsp), %rdi
callq 0x4aa4
movsd %xmm0, 0x20(%rsp)
movsd %xmm1, 0x28(%rsp)
leaq 0x20(%rsp), %rdi
movsd 0x2f98(%rip), %xmm0     # 0x7048
movsd 0x2f98(%rip), %xmm1     # 0x7050
callq 0x4b18
movq 0x71cc(%rip), %rax      # 0xb290
movsd %xmm0, 0x18(%rax)
movsd %xmm1, 0x20(%rax)
movsd 0x8(%rsp), %xmm0
movsd 0x10(%rsp), %xmm1
leaq 0x90(%rsp), %rdi
callq 0x4aa4
movsd %xmm0, 0x8(%rsp)
movsd %xmm1, 0x10(%rsp)
leaq 0x8(%rsp), %rdi
movsd 0x2f48(%rip), %xmm0     # 0x7048
movsd 0x2f48(%rip), %xmm1     # 0x7050
callq 0x4b18
movq 0x717c(%rip), %rax      # 0xb290
movsd %xmm0, 0x30(%rax)
movsd %xmm1, 0x38(%rax)
movq %r13, %rdi
leaq 0x3038(%rip), %rsi      # 0x7160
movq %r12, %rdx
callq 0x4b91
movq %r15, %rdi
movq %r13, %rsi
leaq 0x3053(%rip), %rdx      # 0x7190
callq 0x4b72
movq %r15, %rdi
pushq $0x1
popq %rsi
callq 0x3ad2
movq %r15, %rdi
callq 0x3120
movq %r13, %rdi
callq 0x3120
movq 0x6e6c(%rip), %rdi      # 0xafd0
leaq 0x2ffd(%rip), %rsi      # 0x7168
callq 0x3260
movq %rax, %rdi
movl %ebp, %esi
callq 0x3400
movq %rax, %rdi
leaq 0x2fe2(%rip), %rsi      # 0x7166
callq 0x3260
movq %rax, %rdi
movq %rbx, %rsi
callq 0x3260
movq %r12, %rdi
callq 0x3120
incl %ebp
jmp 0x3fca
addq $0x138, %rsp            # imm = 0x138
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
jmp 0x41ea
jmp 0x41f3
jmp 0x41f3
jmp 0x41f3
jmp 0x41f3
jmp 0x41f3
jmp 0x41f3
jmp 0x41f3
movq %rax, %rbx
jmp 0x41e2
movq %rax, %rbx
leaq 0xf8(%rsp), %rdi
callq 0x3120
leaq 0xd0(%rsp), %rdi
callq 0x3120
jmp 0x41f6
jmp 0x41f3
movq %rax, %rbx
leaq 0x70(%rsp), %rdi
callq 0x3120
movq %rbx, %rdi
callq 0x3420