// File: /workspace/github_cpp_makefile_star2_O3/mhe[P]raytracerframework_cpp/raytracer.cpp
// Function: Raytracer::readScene(char*)
bool Raytracer::readScene(char* inputFilename)
{
	// Initialize a new scene
	scene = new Scene();

	// Open file stream for reading and have the YAML module parse it
	std::ifstream fin(inputFilename);
	if (!fin) {
		cerr << "Error: unable to open " << inputFilename << " for reading." << endl;;
		return false;
	}
	try {
		YAML::Parser parser(fin);
		if (parser) {
	        YAML::Node doc;
	        parser.GetNextDocument(doc);
		
			// Read scene configuration options
			scene->setEye(parseTriple(doc["Eye"]));
		
			// Read and parse the scene objects
			const YAML::Node& sceneObjects = doc["Objects"];
			if (sceneObjects.GetType() != YAML::CT_SEQUENCE) {
				cerr << "Error: expected a sequence of objects." << endl;
				return false;
			}
			for(YAML::Iterator it=sceneObjects.begin();it!=sceneObjects.end();++it) {
				Object *obj = parseObject(*it);
				// Only add object if it is recognized
				if (obj) {
					scene->addObject(obj);
				} else {
					cerr << "Warning: found object of unknown type, ignored." << endl;
				}
			}
		
			// Read and parse light definitions
			const YAML::Node& sceneLights = doc["Lights"];
			if (sceneObjects.GetType() != YAML::CT_SEQUENCE) {
				cerr << "Error: expected a sequence of lights." << endl;
				return false;
			}
			for(YAML::Iterator it=sceneLights.begin();it!=sceneLights.end();++it) {
				scene->addLight(parseLight(*it));
			}
	    }
		if (parser) {
			cerr << "Warning: unexpected YAML document, ignored." << endl;
		}
	} catch(YAML::ParserException& e) {
	    std::cerr << "Error at line " << e.line + 1 << ", col " << e.column + 1 << ": " << e.msg << std::endl;
		return false;
	}

	cout << "YAML parsing results: " << scene->getNumObjects() << " objects read." << endl;
	return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x308, %rsp            # imm = 0x308
movq %rsi, %r14
movq %rdi, %r12
movl $0x398, %edi            # imm = 0x398
callq 0x42c0
xorl %ecx, %ecx
movl %ecx, (%rax)
movl %ecx, 0x328(%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x380(%rax)
movq $0x0, 0x390(%rax)
movq %rax, (%r12)
leaq -0x310(%rbp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
movl $0x8, %edx
callq 0x4580
movq (%rbx), %rax
movq -0x18(%rax), %rax
testb $0x5, -0x2f0(%rbp,%rax)
je 0x18c42
movq 0x223ea(%rip), %rbx     # 0x3aff0
leaq 0x178ed(%rip), %rsi     # 0x304fa
movl $0x16, %edx
movq %rbx, %rdi
callq 0x4350
testq %r14, %r14
je 0x18e0d
movq %r14, %rdi
callq 0x4120
movq 0x223be(%rip), %rdi     # 0x3aff0
movq %r14, %rsi
movq %rax, %rdx
callq 0x4350
jmp 0x18e24
leaq -0xb0(%rbp), %rdi
leaq -0x310(%rbp), %rsi
callq 0x279fc
leaq -0xb0(%rbp), %rdi
callq 0x27af6
testb %al, %al
je 0x19003
leaq -0x108(%rbp), %rdi
callq 0x26b08
leaq -0xb0(%rbp), %rdi
leaq -0x108(%rbp), %rsi
callq 0x27b06
movq (%r12), %r14
leaq -0x38(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x17884(%rip), %rsi     # 0x3051f
leaq 0x17880(%rip), %rdx     # 0x30522
leaq -0x48(%rbp), %rdi
callq 0x1973e
leaq -0x108(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x193ea
movq %rax, %r15
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x18cd7
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x42d0
leaq -0x70(%rbp), %rdi
movq %r15, %rsi
callq 0x183d4
movq -0x60(%rbp), %rax
movq %rax, 0x10(%rsp)
movups -0x70(%rbp), %xmm0
movups %xmm0, (%rsp)
movq %r14, %rdi
callq 0x24878
leaq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
movq %rax, (%rdi)
leaq 0x17815(%rip), %rsi     # 0x30523
leaq 0x17815(%rip), %rdx     # 0x3052a
callq 0x1973e
leaq -0x108(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x193ea
movq %rax, %r14
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x18d46
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x42d0
movq %r14, %rdi
callq 0x27344
cmpl $0x2, %eax
jne 0x18e71
movq %r12, -0x50(%rbp)
leaq -0x48(%rbp), %rdi
movq %r14, %rsi
callq 0x27398
leaq -0x58(%rbp), %r15
leaq -0x48(%rbp), %r12
movq 0x2227a(%rip), %r13     # 0x3aff0
movq %r15, %rdi
movq %r14, %rsi
callq 0x27448
movq %r12, %rdi
movq %r15, %rsi
callq 0x25b95
movl %eax, %ebx
movq %r15, %rdi
callq 0x25956
testb %bl, %bl
je 0x18ebc
movq %r12, %rdi
callq 0x259f4
movq %rax, %rsi
callq 0x187a4
testq %rax, %rax
je 0x18dc4
movq -0x50(%rbp), %rcx
movq (%rcx), %rdi
movq %rax, %rsi
callq 0x2484a
jmp 0x18e00
movl $0x2f, %edx
movq %r13, %rdi
leaq 0x1777f(%rip), %rsi     # 0x30552
callq 0x4350
movq (%r13), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x42a0
movsbl %al, %esi
movq %r13, %rdi
callq 0x4050
movq %rax, %rdi
callq 0x41e0
movq %r12, %rdi
callq 0x25968
jmp 0x18d76
movq (%rbx), %rax
movq -0x18(%rax), %rax
leaq (%rbx,%rax), %rdi
movl 0x20(%rbx,%rax), %esi
orl $0x1, %esi
callq 0x4500
movq 0x221c5(%rip), %rbx     # 0x3aff0
leaq 0x176df(%rip), %rsi     # 0x30511
movl $0xd, %edx
movq %rbx, %rdi
callq 0x4350
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x42a0
movsbl %al, %esi
movq 0x22193(%rip), %rdi     # 0x3aff0
callq 0x4050
movq %rax, %rdi
callq 0x41e0
xorl %ebx, %ebx
jmp 0x190cf
movq 0x22178(%rip), %rbx     # 0x3aff0
leaq 0x176ac(%rip), %rsi     # 0x3052b
movl $0x26, %edx
movq %rbx, %rdi
callq 0x4350
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x42a0
movsbl %al, %esi
movq 0x22146(%rip), %rdi     # 0x3aff0
callq 0x4050
movq %rax, %rdi
callq 0x41e0
jmp 0x18fcd
leaq -0x48(%rbp), %rbx
movq %rbx, %rdi
callq 0x25956
leaq -0x38(%rbp), %rax
movq %rax, (%rbx)
leaq 0x176ac(%rip), %rsi     # 0x30582
leaq 0x176ab(%rip), %rdx     # 0x30588
leaq -0x48(%rbp), %rdi
callq 0x1973e
leaq -0x108(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x193ea
movq %rax, %r15
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x18f12
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x42d0
movq %r14, %rdi
callq 0x27344
cmpl $0x2, %eax
jne 0x18f87
leaq -0x48(%rbp), %rdi
movq %r15, %rsi
callq 0x27398
leaq -0x58(%rbp), %r14
leaq -0x48(%rbp), %r12
movq %r14, %rdi
movq %r15, %rsi
callq 0x27448
movq %r12, %rdi
movq %r14, %rsi
callq 0x25b95
movl %eax, %ebx
movq %r14, %rdi
callq 0x25956
testb %bl, %bl
je 0x18fea
movq -0x50(%rbp), %rax
movq (%rax), %r13
movq %r12, %rdi
callq 0x259f4
movq %rax, %rsi
callq 0x18a6c
movq %r13, %rdi
movq %rax, %rsi
callq 0x2485c
movq %r12, %rdi
callq 0x25968
jmp 0x18f33
movq 0x22062(%rip), %rbx     # 0x3aff0
leaq 0x175f4(%rip), %rsi     # 0x30589
movl $0x25, %edx
movq %rbx, %rdi
callq 0x4350
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x42a0
movsbl %al, %esi
movq 0x22030(%rip), %rdi     # 0x3aff0
callq 0x4050
movq %rax, %rdi
callq 0x41e0
leaq -0x108(%rbp), %rdi
callq 0x26b36
leaq -0xb0(%rbp), %rdi
callq 0x27abe
jmp 0x18e6a
leaq -0x48(%rbp), %rdi
callq 0x25956
leaq -0x108(%rbp), %rdi
callq 0x26b36
movq -0x50(%rbp), %r12
leaq -0xb0(%rbp), %rdi
callq 0x27af6
testb %al, %al
je 0x19059
movq 0x21fd6(%rip), %r14     # 0x3aff0
leaq 0x1758e(%rip), %rsi     # 0x305af
movl $0x2b, %edx
movq %r14, %rdi
callq 0x4350
movq (%r14), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x42a0
movsbl %al, %esi
movq 0x21fa4(%rip), %rdi     # 0x3aff0
callq 0x4050
movq %rax, %rdi
callq 0x41e0
leaq -0xb0(%rbp), %rdi
callq 0x27abe
movq 0x21f64(%rip), %rdi     # 0x3afd0
leaq 0x1757e(%rip), %rsi     # 0x305f1
movl $0x16, %edx
callq 0x4350
movq (%r12), %rax
movl (%rax), %esi
movq 0x21f46(%rip), %rdi     # 0x3afd0
callq 0x41d0
movq %rax, %rbx
leaq 0x1756f(%rip), %rsi     # 0x30608
movl $0xe, %edx
movq %rax, %rdi
callq 0x4350
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x42a0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x4050
movb $0x1, %bl
movq %rax, %rdi
callq 0x41e0
leaq -0x310(%rbp), %rdi
callq 0x40a0
movl %ebx, %eax
addq $0x308, %rsp            # imm = 0x308
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x19126
jmp 0x190f7
jmp 0x19126
jmp 0x190f7
movq %rdx, %r14
movq %rax, %rbx
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x19177
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x42d0
jmp 0x19177
jmp 0x1912e
jmp 0x19126
movq %rdx, %r14
movq %rax, %rbx
jmp 0x1918f
jmp 0x19126
movq %rdx, %r14
movq %rax, %rbx
jmp 0x19177
movq %rdx, %r14
movq %rax, %rbx
jmp 0x19183
jmp 0x19168
jmp 0x1913e
jmp 0x19168
jmp 0x19168
movq %rdx, %r14
movq %rax, %rbx
leaq -0x58(%rbp), %rdi
callq 0x25956
jmp 0x1916e
movq %rax, %rbx
leaq -0x310(%rbp), %rdi
callq 0x40a0
movq %rbx, %rdi
callq 0x4550
jmp 0x19168
movq %rdx, %r14
movq %rax, %rbx
leaq -0x48(%rbp), %rdi
callq 0x25956
leaq -0x108(%rbp), %rdi
callq 0x26b36
leaq -0xb0(%rbp), %rdi
callq 0x27abe
cmpl $0x1, %r14d
jne 0x19152
movq %rbx, %rdi
callq 0x4110
movq %rax, %rbx
movq 0x21e49(%rip), %rdi     # 0x3aff0
leaq 0x1742d(%rip), %rsi     # 0x305db
movl $0xe, %edx
callq 0x4350
movl 0x8(%rbx), %esi
incl %esi
movq 0x21e2c(%rip), %rdi     # 0x3aff0
callq 0x4520
movq %rax, %r14
leaq 0x17417(%rip), %rsi     # 0x305ea
movl $0x6, %edx
movq %rax, %rdi
callq 0x4350
movl 0xc(%rbx), %esi
incl %esi
movq %r14, %rdi
callq 0x4520
movq %rax, %r14
leaq 0x16ffe(%rip), %rsi     # 0x301f5
movl $0x2, %edx
movq %rax, %rdi
callq 0x4350
movq 0x10(%rbx), %rsi
movq 0x18(%rbx), %rdx
movq %r14, %rdi
callq 0x4350
movq %rax, %rdi
callq 0x4130
callq 0x44e0
jmp 0x18e6a
jmp 0x1914f
movq %rax, %rbx
callq 0x44e0
jmp 0x19152
movq %rax, %rdi
callq 0x193dc