// File: GUI-Graphics[P]cpuraytracing/main.cpp
// Function: initScene(gui::Scene&)
void initScene(Scene& scene) {
	auto& shapes = scene.shapes;
	for(int i = -11; i < 11; ++i) {
		for(int j = -11; j < 11; ++j) {
			Vector3 c(i + 0.9f * Math::random(), 0.2f, j + 0.9f * Math::random());
			float p = Math::random();
			if(p < 0.8f) {
				shapes.push_back(new Sphere(c, 0.2f, new Diffuse(Vector3(Math::random(), Math::random(), Math::random()))));
			} else if(p < 0.95f) {
				float r = 0.5f * (1 + Math::random());
				float g = 0.5f * (1 + Math::random());
				float b = 0.5f * (1 + Math::random());
				shapes.push_back(new Sphere(c, 0.2f, new Metal(Vector3(r, g, b), 0.5f * Math::random())));
			} else {
				shapes.push_back(new Sphere(c, 0.2f, new Dielectric(1.5f)));
			}
		}
	}
	shapes.push_back(new Sphere(Vector3(0, 1, 0), 1, new Dielectric(1.5f)));
	shapes.push_back(new Sphere(Vector3(-4, 1, 0), 1, new Diffuse(Vector3(0.4f, 0.2f, 0.1f))));
	shapes.push_back(new Sphere(Vector3(4, 1, 0), 1, new Metal(Vector3(0.7f, 0.6f, 0.5f))));
	shapes.push_back(new Sphere(Vector3(0, -1000, 0), 1000, new Diffuse(Vector3(0.5f))));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1d0, %rsp            # imm = 0x1D0
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x10(%rbp)
movl $0xfffffff5, -0x14(%rbp) # imm = 0xFFFFFFF5
cmpl $0xb, -0x14(%rbp)
jge 0x2922
movl $0xfffffff5, -0x18(%rbp) # imm = 0xFFFFFFF5
cmpl $0xb, -0x18(%rbp)
jge 0x2912
cvtsi2ssl -0x14(%rbp), %xmm0
movss %xmm0, -0xfc(%rbp)
callq 0x2e90
movss -0xfc(%rbp), %xmm1
movss 0x5b09(%rip), %xmm2     # 0x8038
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
movss %xmm0, -0xf4(%rbp)
cvtsi2ssl -0x18(%rbp), %xmm0
movss %xmm0, -0xf8(%rbp)
callq 0x2e90
movss -0xf8(%rbp), %xmm1
movaps %xmm0, %xmm2
movss -0xf4(%rbp), %xmm0
movss 0x5acc(%rip), %xmm3     # 0x8038
mulss %xmm3, %xmm2
addss %xmm1, %xmm2
leaq -0x24(%rbp), %rdi
movss 0x5a94(%rip), %xmm1     # 0x8014
callq 0x2eb0
callq 0x2e90
movss %xmm0, -0x28(%rbp)
movss 0x5a9d(%rip), %xmm0     # 0x8034
ucomiss -0x28(%rbp), %xmm0
jbe 0x26b4
movq -0x10(%rbp), %rax
movq %rax, -0x118(%rbp)
movl $0x20, %edi
callq 0x2180
movq %rax, -0x110(%rbp)
movl $0x18, %edi
callq 0x2180
movq %rax, -0x108(%rbp)
jmp 0x25d0
callq 0x2e90
movss %xmm0, -0x11c(%rbp)
jmp 0x25df
callq 0x2e90
movss %xmm0, -0x120(%rbp)
jmp 0x25ee
callq 0x2e90
movss %xmm0, -0x124(%rbp)
jmp 0x25fd
movss -0x124(%rbp), %xmm2
movss -0x120(%rbp), %xmm1
movss -0x11c(%rbp), %xmm0
leaq -0x48(%rbp), %rdi
callq 0x2eb0
jmp 0x2620
movq -0x108(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x2f20
jmp 0x2632
movq -0x108(%rbp), %rdx
movq -0x110(%rbp), %rdi
leaq -0x24(%rbp), %rsi
movss 0x59c8(%rip), %xmm0     # 0x8014
callq 0x2f70
jmp 0x2653
movq -0x118(%rbp), %rdi
movq -0x110(%rbp), %rax
movq %rax, -0x30(%rbp)
leaq -0x30(%rbp), %rsi
callq 0x2ef0
jmp 0x2902
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x269e
movq -0x108(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
movl $0x18, %esi
callq 0x2190
movq -0x110(%rbp), %rdi
movl $0x20, %esi
callq 0x2190
jmp 0x2d22
movss 0x5980(%rip), %xmm0     # 0x803c
ucomiss -0x28(%rbp), %xmm0
jbe 0x283c
callq 0x2e90
movss 0x5931(%rip), %xmm1     # 0x8004
movss %xmm1, -0x148(%rbp)
addss %xmm1, %xmm0
movss 0x5941(%rip), %xmm1     # 0x8028
movss %xmm1, -0x144(%rbp)
mulss %xmm1, %xmm0
movss %xmm0, -0x4c(%rbp)
callq 0x2e90
movss -0x148(%rbp), %xmm2
movss -0x144(%rbp), %xmm1
addss %xmm2, %xmm0
mulss %xmm1, %xmm0
movss %xmm0, -0x50(%rbp)
callq 0x2e90
movss -0x148(%rbp), %xmm2
movss -0x144(%rbp), %xmm1
addss %xmm2, %xmm0
mulss %xmm1, %xmm0
movss %xmm0, -0x54(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x140(%rbp)
movl $0x20, %edi
callq 0x2180
movq %rax, -0x138(%rbp)
movl $0x18, %edi
callq 0x2180
movq %rax, -0x130(%rbp)
jmp 0x276b
movss -0x4c(%rbp), %xmm0
movss -0x50(%rbp), %xmm1
movss -0x54(%rbp), %xmm2
leaq -0x6c(%rbp), %rdi
callq 0x2eb0
jmp 0x2785
callq 0x2e90
movss %xmm0, -0x14c(%rbp)
jmp 0x2794
movq -0x130(%rbp), %rdi
movss -0x14c(%rbp), %xmm0
movss 0x587d(%rip), %xmm1     # 0x8028
mulss %xmm1, %xmm0
leaq -0x6c(%rbp), %rsi
callq 0x2fd0
jmp 0x27ba
movq -0x130(%rbp), %rdx
movq -0x138(%rbp), %rdi
leaq -0x24(%rbp), %rsi
movss 0x5840(%rip), %xmm0     # 0x8014
callq 0x2f70
jmp 0x27db
movq -0x140(%rbp), %rdi
movq -0x138(%rbp), %rax
movq %rax, -0x60(%rbp)
leaq -0x60(%rbp), %rsi
callq 0x2ef0
jmp 0x2900
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x2826
movq -0x130(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
movl $0x18, %esi
callq 0x2190
movq -0x138(%rbp), %rdi
movl $0x20, %esi
callq 0x2190
jmp 0x2d22
movq -0x10(%rbp), %rax
movq %rax, -0x168(%rbp)
movl $0x20, %edi
callq 0x2180
movq %rax, -0x160(%rbp)
movl $0x10, %edi
callq 0x2180
movq %rax, -0x158(%rbp)
jmp 0x286b
movq -0x158(%rbp), %rdi
movss 0x578e(%rip), %xmm0     # 0x8008
callq 0x3030
jmp 0x2881
movq -0x158(%rbp), %rdx
movq -0x160(%rbp), %rdi
leaq -0x24(%rbp), %rsi
movss 0x5779(%rip), %xmm0     # 0x8014
callq 0x2f70
jmp 0x28a2
movq -0x168(%rbp), %rdi
movq -0x160(%rbp), %rax
movq %rax, -0x78(%rbp)
leaq -0x78(%rbp), %rsi
callq 0x2ef0
jmp 0x2900
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x28ea
movq -0x158(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
movl $0x10, %esi
callq 0x2190
movq -0x160(%rbp), %rdi
movl $0x20, %esi
callq 0x2190
jmp 0x2d22
jmp 0x2902
jmp 0x2904
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x2503
jmp 0x2914
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x24f2
movq -0x10(%rbp), %rax
movq %rax, -0x178(%rbp)
movl $0x20, %edi
callq 0x2180
movq %rax, -0x170(%rbp)
leaq -0x8c(%rbp), %rdi
movss 0x56b7(%rip), %xmm1     # 0x8004
xorps %xmm2, %xmm2
movaps %xmm2, %xmm0
callq 0x2eb0
jmp 0x295a
movl $0x10, %edi
callq 0x2180
movq %rax, -0x180(%rbp)
jmp 0x296d
movq -0x180(%rbp), %rdi
movss 0x568c(%rip), %xmm0     # 0x8008
callq 0x3030
jmp 0x2983
movq -0x180(%rbp), %rdx
movq -0x170(%rbp), %rdi
leaq -0x8c(%rbp), %rsi
movss 0x5664(%rip), %xmm0     # 0x8004
callq 0x2f70
jmp 0x29a7
movq -0x178(%rbp), %rdi
movq -0x170(%rbp), %rax
movq %rax, -0x80(%rbp)
leaq -0x80(%rbp), %rsi
callq 0x2ef0
movq -0x10(%rbp), %rax
movq %rax, -0x190(%rbp)
movl $0x20, %edi
callq 0x2180
movq %rax, -0x188(%rbp)
leaq -0xa4(%rbp), %rdi
movss 0x561f(%rip), %xmm0     # 0x800c
movss 0x560f(%rip), %xmm1     # 0x8004
xorps %xmm2, %xmm2
callq 0x2eb0
jmp 0x29ff
movl $0x18, %edi
callq 0x2180
movq %rax, -0x198(%rbp)
jmp 0x2a12
leaq -0xb0(%rbp), %rdi
movss 0x55ef(%rip), %xmm0     # 0x8010
movss 0x55eb(%rip), %xmm1     # 0x8014
movss 0x55e7(%rip), %xmm2     # 0x8018
callq 0x2eb0
jmp 0x2a38
movq -0x198(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0x2f20
jmp 0x2a4d
movq -0x198(%rbp), %rdx
movq -0x188(%rbp), %rdi
leaq -0xa4(%rbp), %rsi
movss 0x559a(%rip), %xmm0     # 0x8004
callq 0x2f70
jmp 0x2a71
movq -0x190(%rbp), %rdi
movq -0x188(%rbp), %rax
movq %rax, -0x98(%rbp)
leaq -0x98(%rbp), %rsi
callq 0x2ef0
movq -0x10(%rbp), %rax
movq %rax, -0x1a8(%rbp)
movl $0x20, %edi
callq 0x2180
movq %rax, -0x1a0(%rbp)
leaq -0xc4(%rbp), %rdi
movss 0x555f(%rip), %xmm0     # 0x801c
movss 0x553f(%rip), %xmm1     # 0x8004
xorps %xmm2, %xmm2
callq 0x2eb0
jmp 0x2acf
movl $0x18, %edi
callq 0x2180
movq %rax, -0x1b0(%rbp)
jmp 0x2ae2
leaq -0xd0(%rbp), %rdi
movss 0x552f(%rip), %xmm0     # 0x8020
movss 0x552b(%rip), %xmm1     # 0x8024
movss 0x5527(%rip), %xmm2     # 0x8028
callq 0x2eb0
jmp 0x2b08
movq -0x1b0(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
xorps %xmm0, %xmm0
callq 0x2fd0
jmp 0x2b20
movq -0x1b0(%rbp), %rdx
movq -0x1a0(%rbp), %rdi
leaq -0xc4(%rbp), %rsi
movss 0x54c7(%rip), %xmm0     # 0x8004
callq 0x2f70
jmp 0x2b44
movq -0x1a8(%rbp), %rdi
movq -0x1a0(%rbp), %rax
movq %rax, -0xb8(%rbp)
leaq -0xb8(%rbp), %rsi
callq 0x2ef0
movq -0x10(%rbp), %rax
movq %rax, -0x1c0(%rbp)
movl $0x20, %edi
callq 0x2180
movq %rax, -0x1b8(%rbp)
leaq -0xe4(%rbp), %rdi
movss 0x549c(%rip), %xmm1     # 0x802c
xorps %xmm2, %xmm2
movaps %xmm2, %xmm0
callq 0x2eb0
jmp 0x2b9d
movl $0x18, %edi
callq 0x2180
movq %rax, -0x1c8(%rbp)
jmp 0x2bb0
leaq -0xf0(%rbp), %rdi
movss 0x5469(%rip), %xmm0     # 0x8028
callq 0x3070
jmp 0x2bc6
movq -0x1c8(%rbp), %rdi
leaq -0xf0(%rbp), %rsi
callq 0x2f20
jmp 0x2bdb
movq -0x1c8(%rbp), %rdx
movq -0x1b8(%rbp), %rdi
leaq -0xe4(%rbp), %rsi
movss 0x5438(%rip), %xmm0     # 0x8030
callq 0x2f70
jmp 0x2bff
movq -0x1c0(%rbp), %rdi
movq -0x1b8(%rbp), %rax
movq %rax, -0xd8(%rbp)
leaq -0xd8(%rbp), %rsi
callq 0x2ef0
addq $0x1d0, %rsp            # imm = 0x1D0
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x2c54
movq -0x180(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
movl $0x10, %esi
callq 0x2190
movq -0x170(%rbp), %rdi
movl $0x20, %esi
callq 0x2190
jmp 0x2d22
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x2c95
movq -0x198(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
movl $0x18, %esi
callq 0x2190
movq -0x188(%rbp), %rdi
movl $0x20, %esi
callq 0x2190
jmp 0x2d22
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x2cd3
movq -0x1b0(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
movl $0x18, %esi
callq 0x2190
movq -0x1a0(%rbp), %rdi
movl $0x20, %esi
callq 0x2190
jmp 0x2d22
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x2d11
movq -0x1c8(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
movl $0x18, %esi
callq 0x2190
movq -0x1b8(%rbp), %rdi
movl $0x20, %esi
callq 0x2190
movq -0x38(%rbp), %rdi
callq 0x22d0
nopl (%rax,%rax)