// File: GUI-Graphics[P]cpuraytracing/renderer.cpp
// Function: gui::Renderer::render(gui::Scene const&, gui::Camera&) const
void Renderer::render(const Scene& scene, Camera& camera) const {
		float r = 1.0f / samples;
		for(int i = 0; i < camera.film.height; ++i) {
			printf("\rrendering %5.2f%%", 100.0f * (i + 1) / camera.film.height);
			fflush(stdout);
			for(int j = 0; j < camera.film.width; ++j) {
				for (int k = 0; k < samples; ++k) {
					Ray ray = camera.getRay(j + Math::random(), i + Math::random());
					camera.film.pixels[i][j] += radiance(ray, scene, 0);
				}
				camera.film.pixels[i][j] *= r;
			}
		}

		printf("\nstatistical data:\n");
		printf("num intersects: %lld\n", nIntersects);

		camera.film.gammaCorrection();
		camera.film.writePPM();
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x68(%rbp)
cvtsi2ssl (%rax), %xmm1
movss 0xfc9(%rip), %xmm0      # 0x8004
divss %xmm1, %xmm0
movss %xmm0, -0x1c(%rbp)
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
movq -0x18(%rbp), %rcx
movq (%rcx), %rcx
cmpl 0x4(%rcx), %eax
jge 0x71df
movl -0x20(%rbp), %eax
addl $0x1, %eax
cvtsi2ss %eax, %xmm1
movss 0x10f0(%rip), %xmm0     # 0x8160
mulss %xmm1, %xmm0
movq -0x18(%rbp), %rax
movq (%rax), %rax
cvtsi2ssl 0x4(%rax), %xmm1
divss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x10d9(%rip), %rdi      # 0x8168
movb $0x1, %al
callq 0x2040
movq 0x4f33(%rip), %rax      # 0xbfd0
movq (%rax), %rdi
callq 0x21f0
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
movq -0x18(%rbp), %rcx
movq (%rcx), %rcx
cmpl (%rcx), %eax
jge 0x71cf
movl $0x0, -0x28(%rbp)
movq -0x68(%rbp), %rcx
movl -0x28(%rbp), %eax
cmpl (%rcx), %eax
jge 0x7199
movq -0x18(%rbp), %rax
movq %rax, -0x80(%rbp)
cvtsi2ssl -0x24(%rbp), %xmm0
movss %xmm0, -0x88(%rbp)
callq 0x2e90
movaps %xmm0, %xmm1
movss -0x88(%rbp), %xmm0
addss %xmm1, %xmm0
movss %xmm0, -0x74(%rbp)
cvtsi2ssl -0x20(%rbp), %xmm0
movss %xmm0, -0x84(%rbp)
callq 0x2e90
movss -0x84(%rbp), %xmm1
movq -0x80(%rbp), %rsi
movaps %xmm0, %xmm2
movss -0x74(%rbp), %xmm0
addss %xmm2, %xmm1
leaq -0x40(%rbp), %rdi
movq %rdi, -0x70(%rbp)
callq 0x54c0
movq -0x68(%rbp), %rdi
movq -0x70(%rbp), %rsi
movq -0x10(%rbp), %rdx
xorl %ecx, %ecx
callq 0x6d50
movss %xmm1, -0x58(%rbp)
movlpd %xmm0, -0x60(%rbp)
movq -0x60(%rbp), %rax
movq %rax, -0x4c(%rbp)
movl -0x58(%rbp), %eax
movl %eax, -0x44(%rbp)
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq 0x8(%rax), %rax
movslq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movslq -0x24(%rbp), %rax
imulq $0xc, %rax, %rax
addq %rax, %rdi
leaq -0x4c(%rbp), %rsi
callq 0x7310
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x70c5
movss -0x1c(%rbp), %xmm0
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq 0x8(%rax), %rax
movslq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movslq -0x24(%rbp), %rax
imulq $0xc, %rax, %rax
addq %rax, %rdi
callq 0x5b70
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x70ac
jmp 0x71d1
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x704b
leaq 0xf95(%rip), %rdi       # 0x817b
movb $0x0, %al
callq 0x2040
movq 0x76dc(%rip), %rsi      # 0xe8d0
leaq 0xf94(%rip), %rdi       # 0x818f
movb $0x0, %al
callq 0x2040
movq -0x18(%rbp), %rax
movq (%rax), %rdi
callq 0x5010
movq -0x18(%rbp), %rax
movq (%rax), %rdi
callq 0x50d0
addq $0x90, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax)