// File: /workspace/github_cpp_makefile_star2_O2/iannisdezwart[P]forcefield-visualiser/./motion.hpp
// Function: motion::four_body()
void four_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, 4);
		masses.push_back(planet_1);

		double rotation_1 = 0.000625 * 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(0, 300, 3);
		masses.push_back(planet_2);

		double rotation_2 = 0.00125 * 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(-400, 0, 2);
		masses.push_back(planet_3);

		double rotation_3 = 0.001875 * 2 * M_PI;

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

		// Planet 4

		Mass planet_4(0, -500, 1);
		masses.push_back(planet_4);

		double rotation_4 = 0.0025 * 2 * M_PI;

		Matrix<2, 2> rotation_matrix_4({
			{ cos(rotation_4), -sin(rotation_4) },
			{ sin(rotation_4), cos(rotation_4) },
		});

		// Render 1600 frames

		for (int i = 0; i < 1600; 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;

			// Planet 4

			planet_4.position = rotation_matrix_4 * planet_4.position;
			masses[3].position = planet_4.position + image_centre;

			// Render the frame

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

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

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x168, %rsp            # imm = 0x168
leaq 0x48(%rsp), %rbx
xorl %ebp, %ebp
pushq $0x4
popq %rcx
movq %rbx, %rdi
movl $0xc8, %esi
xorl %edx, %edx
callq 0x472c
leaq 0x7057(%rip), %r14      # 0xb290
movq %r14, %rdi
movq %rbx, %rsi
callq 0x476a
movaps 0x2e85(%rip), %xmm0     # 0x70d0
leaq 0xc0(%rsp), %r15
movaps %xmm0, (%r15)
leaq 0xe0(%rsp), %rsi
movq %r15, (%rsi)
pushq $0x2
popq %rbx
movq %rbx, 0x8(%rsi)
movaps 0x2e70(%rip), %xmm0     # 0x70e0
leaq 0xa0(%rsp), %r12
movaps %xmm0, (%r12)
movq %r12, 0x10(%rsi)
movq %rbx, 0x18(%rsi)
leaq 0x148(%rsp), %rdi
movq %rbx, %rdx
callq 0x49b6
leaq 0x30(%rsp), %r13
pushq $0x3
popq %rcx
movq %r13, %rdi
xorl %esi, %esi
movl $0x12c, %edx            # imm = 0x12C
callq 0x472c
movq %r14, %rdi
movq %r13, %rsi
callq 0x476a
movaps 0x2e32(%rip), %xmm0     # 0x70f0
movaps %xmm0, (%r12)
movq %r12, (%r15)
movq %rbx, 0x8(%r15)
movaps 0x2e2f(%rip), %xmm0     # 0x7100
leaq 0x80(%rsp), %r13
movaps %xmm0, (%r13)
movq %r13, 0x10(%r15)
movq %rbx, 0x18(%r15)
leaq 0xe0(%rsp), %rdi
leaq 0xc0(%rsp), %rsi
movq %rbx, %rdx
callq 0x49b6
leaq 0x18(%rsp), %r15
pushq $0x2
popq %rcx
movq %r15, %rdi
movl $0xfffffe70, %esi       # imm = 0xFFFFFE70
xorl %edx, %edx
callq 0x472c
movq %r14, %rdi
movq %r15, %rsi
callq 0x476a
movaps 0x2de9(%rip), %xmm0     # 0x7110
movaps %xmm0, (%r13)
movq %r13, (%r12)
movq %rbx, 0x8(%r12)
movaps 0x2de4(%rip), %xmm0     # 0x7120
leaq 0x100(%rsp), %r15
movaps %xmm0, (%r15)
movq %r15, 0x10(%r12)
movq %rbx, 0x18(%r12)
leaq 0xc0(%rsp), %rdi
leaq 0xa0(%rsp), %rsi
movq %rbx, %rdx
callq 0x49b6
movq %rsp, %r12
pushq $0x1
popq %rcx
movq %r12, %rdi
xorl %esi, %esi
movl $0xfffffe0c, %edx       # imm = 0xFFFFFE0C
callq 0x472c
movq %r14, %rdi
movq %r12, %rsi
callq 0x476a
movaps 0x2d9f(%rip), %xmm0     # 0x7130
movaps %xmm0, (%r15)
movq %r15, (%r13)
movq %rbx, 0x8(%r13)
movaps 0x2d9c(%rip), %xmm0     # 0x7140
leaq 0x60(%rsp), %r12
movaps %xmm0, (%r12)
movq %r12, 0x10(%r13)
movq %rbx, 0x18(%r13)
leaq 0xa0(%rsp), %rdi
leaq 0x80(%rsp), %rsi
movq %rbx, %rdx
callq 0x49b6
leaq 0x128(%rsp), %rbx
leaq 0x2da5(%rip), %r14      # 0x7182
cmpl $0x640, %ebp            # imm = 0x640
je 0x4605
movq %r13, %rdi
movl %ebp, %esi
callq 0x4a2c
movq 0x88(%rsp), %rax
cmpq $0x4, %rax
je 0x4445
pushq $0x4
popq %rsi
subq %rax, %rsi
leaq 0x70(%rsp), %rax
movq %rax, 0x60(%rsp)
movq %r12, %rdi
pushq $0x30
popq %rdx
callq 0x32c0
movq %r15, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x4a85
movq %r13, %rdi
movq %r15, %rsi
callq 0x32d0
movq %r15, %rdi
callq 0x3120
movq %r12, %rdi
callq 0x3120
movsd 0x48(%rsp), %xmm0
movsd 0x50(%rsp), %xmm1
leaq 0x148(%rsp), %rdi
callq 0x4aa4
movsd %xmm0, 0x48(%rsp)
movsd %xmm1, 0x50(%rsp)
leaq 0x48(%rsp), %rdi
movsd 0x2bd1(%rip), %xmm0     # 0x7048
movsd 0x2bd1(%rip), %xmm1     # 0x7050
callq 0x4b18
movq 0x6e05(%rip), %rax      # 0xb290
movsd %xmm0, (%rax)
movsd %xmm1, 0x8(%rax)
movsd 0x30(%rsp), %xmm0
movsd 0x38(%rsp), %xmm1
leaq 0xe0(%rsp), %rdi
callq 0x4aa4
movsd %xmm0, 0x30(%rsp)
movsd %xmm1, 0x38(%rsp)
leaq 0x30(%rsp), %rdi
movsd 0x2b82(%rip), %xmm0     # 0x7048
movsd 0x2b82(%rip), %xmm1     # 0x7050
callq 0x4b18
movq 0x6db6(%rip), %rax      # 0xb290
movsd %xmm0, 0x18(%rax)
movsd %xmm1, 0x20(%rax)
movsd 0x18(%rsp), %xmm0
movsd 0x20(%rsp), %xmm1
leaq 0xc0(%rsp), %rdi
callq 0x4aa4
movsd %xmm0, 0x18(%rsp)
movsd %xmm1, 0x20(%rsp)
leaq 0x18(%rsp), %rdi
movsd 0x2b32(%rip), %xmm0     # 0x7048
movsd 0x2b32(%rip), %xmm1     # 0x7050
callq 0x4b18
movq 0x6d66(%rip), %rax      # 0xb290
movsd %xmm0, 0x30(%rax)
movsd %xmm1, 0x38(%rax)
movsd (%rsp), %xmm0
movsd 0x8(%rsp), %xmm1
leaq 0xa0(%rsp), %rdi
callq 0x4aa4
movsd %xmm0, (%rsp)
movsd %xmm1, 0x8(%rsp)
movq %rsp, %rdi
movsd 0x2ae6(%rip), %xmm0     # 0x7048
movsd 0x2ae6(%rip), %xmm1     # 0x7050
callq 0x4b18
movq 0x6d1a(%rip), %rax      # 0xb290
movsd %xmm0, 0x48(%rax)
movsd %xmm1, 0x50(%rax)
movq %r15, %rdi
leaq 0x2bd6(%rip), %rsi      # 0x7160
movq %r13, %rdx
callq 0x4b91
movq %rbx, %rdi
movq %r15, %rsi
leaq 0x2bf1(%rip), %rdx      # 0x7190
callq 0x4b72
movq %rbx, %rdi
pushq $0x1
popq %rsi
callq 0x3ad2
movq %rbx, %rdi
callq 0x3120
movq %r15, %rdi
callq 0x3120
movq 0x6a0a(%rip), %rdi      # 0xafd0
leaq 0x2b9b(%rip), %rsi      # 0x7168
callq 0x3260
movq %rax, %rdi
movl %ebp, %esi
callq 0x3400
movq %rax, %rdi
leaq 0x2b80(%rip), %rsi      # 0x7166
callq 0x3260
movq %rax, %rdi
movq %r14, %rsi
callq 0x3260
movq %r13, %rdi
callq 0x3120
incl %ebp
jmp 0x43dd
addq $0x168, %rsp            # imm = 0x168
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
jmp 0x4650
jmp 0x4659
jmp 0x4659
jmp 0x4659
jmp 0x4659
jmp 0x4659
jmp 0x4659
jmp 0x4659
jmp 0x4659
movq %rax, %rbx
jmp 0x4648
jmp 0x4659
movq %rax, %rbx
leaq 0x128(%rsp), %rdi
callq 0x3120
leaq 0x100(%rsp), %rdi
callq 0x3120
jmp 0x465c
jmp 0x4659
movq %rax, %rbx
leaq 0x80(%rsp), %rdi
callq 0x3120
movq %rbx, %rdi
callq 0x3420