// File: iannisdezwart[P]forcefield-visualiser/./rendering.hpp
// Function: render_image(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, RenderingMode)
void render_image(string file_name, RenderingMode rendering_mode)
{
	// If we're doing multithreading ...

	if (rendering_mode == MULTI_THREADED) {
		// ... store the threads in an array, ...

		thread thread_pool[number_of_threads];

		// ... start each thread ...

		for (int i = 0; i < number_of_threads; i++) {
			thread_pool[i] = thread(render_rows, i, number_of_threads);
		}

		// ... and wait until all threads finished.

		for (int i = 0; i < number_of_threads; i++) {
			thread_pool[i].join();
		}
	} else {
		// Else, let the main thread render the whole image

		render_rows(0, 1);
	}

	// Write the image

	image.write(file_name);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x48(%rbp)
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
cmpl $0x1, -0xc(%rbp)
jne 0x4119
movl 0x11412(%rip), %eax     # 0x15378
movq %rax, -0x58(%rbp)
movq %rsp, %rcx
movq %rcx, -0x18(%rbp)
leaq 0xf(,%rax,8), %rdx
andq $-0x10, %rdx
movq %rsp, %rcx
subq %rdx, %rcx
movq %rcx, -0x50(%rbp)
movq %rcx, %rsp
movq %rax, -0x20(%rbp)
cmpq $0x0, %rax
je 0x3fd0
movq -0x50(%rbp), %rax
movq -0x58(%rbp), %rdx
shlq $0x3, %rdx
movq %rax, %rcx
addq %rdx, %rcx
movq %rcx, -0x68(%rbp)
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rdi
movq %rdi, -0x70(%rbp)
callq 0x6280
movq -0x70(%rbp), %rax
movq -0x68(%rbp), %rcx
addq $0x8, %rax
cmpq %rcx, %rax
movq %rax, -0x60(%rbp)
jne 0x3fae
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl 0x11398(%rip), %eax     # 0x15378
jge 0x4068
leaq -0x19d(%rip), %rsi      # 0x3e50
leaq 0x11384(%rip), %rcx     # 0x15378
leaq -0x30(%rbp), %rdi
leaq -0x24(%rbp), %rdx
callq 0x6290
jmp 0x4003
movq -0x50(%rbp), %rdi
movslq -0x24(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rdi
leaq -0x30(%rbp), %rsi
callq 0x6370
leaq -0x30(%rbp), %rdi
callq 0x63b0
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x3fd7
movq -0x50(%rbp), %rcx
movq %rdx, %rsi
movq -0x58(%rbp), %rdx
movq %rsi, -0x80(%rbp)
movq %rax, %rsi
movq -0x80(%rbp), %rax
movq %rsi, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
shlq $0x3, %rdx
movq %rcx, %rax
addq %rdx, %rax
cmpq %rax, %rcx
movq %rax, -0x78(%rbp)
je 0x4117
jmp 0x40ef
movl $0x0, -0x40(%rbp)
movl -0x40(%rbp), %eax
cmpl 0x11300(%rip), %eax     # 0x15378
jge 0x409a
movq -0x50(%rbp), %rax
movslq -0x40(%rbp), %rcx
leaq (%rax,%rcx,8), %rdi
callq 0x3530
jmp 0x408d
jmp 0x408f
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x406f
movq -0x50(%rbp), %rcx
movq -0x58(%rbp), %rdx
shlq $0x3, %rdx
movq %rcx, %rax
addq %rdx, %rax
cmpq %rax, %rcx
movq %rax, -0x88(%rbp)
je 0x40e6
movq -0x88(%rbp), %rdi
addq $-0x8, %rdi
movq %rdi, -0x90(%rbp)
callq 0x63b0
movq -0x50(%rbp), %rcx
movq -0x90(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x88(%rbp)
jne 0x40b8
movq -0x18(%rbp), %rax
movq %rax, %rsp
jmp 0x4125
movq -0x78(%rbp), %rdi
addq $-0x8, %rdi
movq %rdi, -0x98(%rbp)
callq 0x63b0
movq -0x50(%rbp), %rcx
movq -0x98(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x78(%rbp)
jne 0x40ef
jmp 0x413a
xorl %edi, %edi
movl $0x1, %esi
callq 0x3e50
movq -0x48(%rbp), %rsi
leaq 0x11250(%rip), %rdi     # 0x15380
callq 0x63d0
movq %rbp, %rsp
popq %rbp
retq
movq -0x38(%rbp), %rdi
callq 0x3590
nopw %cs:(%rax,%rax)