// File: /workspace/github_cpp_makefile_star2_O1/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, %r15
movl $0x398, %edi            # imm = 0x398
callq 0x52d0
xorl %ecx, %ecx
movl %ecx, (%rax)
movl %ecx, 0x328(%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x380(%rax)
movq $0x0, 0x390(%rax)
movq %rax, (%r15)
leaq -0x318(%rbp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
movl $0x8, %edx
callq 0x5590
movq (%rbx), %rax
movq -0x18(%rax), %rax
testb $0x5, -0x2f8(%rbp,%rax)
je 0x19c67
movq 0x223c5(%rip), %rbx     # 0x3bff0
leaq 0x178c8(%rip), %rsi     # 0x314fa
movl $0x16, %edx
movq %rbx, %rdi
callq 0x5360
testq %r14, %r14
je 0x19e35
movq %r14, %rdi
callq 0x5120
movq 0x22399(%rip), %rdi     # 0x3bff0
movq %r14, %rsi
movq %rax, %rdx
callq 0x5360
jmp 0x19e4c
movq %r15, -0x50(%rbp)
leaq -0xb8(%rbp), %rdi
leaq -0x318(%rbp), %rsi
callq 0x28fc4
leaq -0xb8(%rbp), %rdi
callq 0x290be
testb %al, %al
je 0x1a025
leaq -0x110(%rbp), %rdi
callq 0x280a8
leaq -0xb8(%rbp), %rdi
leaq -0x110(%rbp), %rsi
callq 0x290ce
movq -0x50(%rbp), %rax
movq (%rax), %r14
leaq -0x38(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x17858(%rip), %rsi     # 0x3151f
leaq 0x17854(%rip), %rdx     # 0x31522
leaq -0x48(%rbp), %rdi
callq 0x1a774
leaq -0x110(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x1a420
movq %rax, %r15
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x19d03
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x52e0
leaq -0x78(%rbp), %rdi
movq %r15, %rsi
callq 0x193f4
movq -0x68(%rbp), %rax
movq %rax, 0x10(%rsp)
movups -0x78(%rbp), %xmm0
movups %xmm0, (%rsp)
movq %r14, %rdi
callq 0x25dda
leaq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
movq %rax, (%rdi)
leaq 0x177e9(%rip), %rsi     # 0x31523
leaq 0x177e9(%rip), %rdx     # 0x3152a
callq 0x1a774
leaq -0x110(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x1a420
movq %rax, %r14
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x19d72
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x52e0
movq %r14, %rdi
callq 0x288f0
cmpl $0x2, %eax
jne 0x19e99
leaq -0x48(%rbp), %rdi
movq %r14, %rsi
callq 0x28944
leaq -0x58(%rbp), %r15
leaq -0x48(%rbp), %r12
movq 0x22252(%rip), %r13     # 0x3bff0
movq %r15, %rdi
movq %r14, %rsi
callq 0x289f4
movq %r12, %rdi
movq %r15, %rsi
callq 0x27117
movl %eax, %ebx
movq %r15, %rdi
callq 0x26eca
testb %bl, %bl
je 0x19ef0
movq %r12, %rdi
callq 0x26f76
movq %rax, %rsi
callq 0x197c4
testq %rax, %rax
je 0x19dec
movq -0x50(%rbp), %rcx
movq (%rcx), %rdi
movq %rax, %rsi
callq 0x25dac
jmp 0x19e28
movl $0x2f, %edx
movq %r13, %rdi
leaq 0x17757(%rip), %rsi     # 0x31552
callq 0x5360
movq (%r13), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x52b0
movsbl %al, %esi
movq %r13, %rdi
callq 0x5050
movq %rax, %rdi
callq 0x51e0
movq %r12, %rdi
callq 0x26ee4
jmp 0x19d9e
movq (%rbx), %rax
movq -0x18(%rax), %rax
leaq (%rbx,%rax), %rdi
movl 0x20(%rbx,%rax), %esi
orl $0x1, %esi
callq 0x5510
movq 0x2219d(%rip), %rbx     # 0x3bff0
leaq 0x176b7(%rip), %rsi     # 0x31511
movl $0xd, %edx
movq %rbx, %rdi
callq 0x5360
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x52b0
movsbl %al, %esi
movq 0x2216b(%rip), %rdi     # 0x3bff0
callq 0x5050
movq %rax, %rdi
callq 0x51e0
xorl %ebx, %ebx
jmp 0x1a0f4
movq 0x22150(%rip), %rbx     # 0x3bff0
leaq 0x17684(%rip), %rsi     # 0x3152b
movl $0x26, %edx
movq %rbx, %rdi
callq 0x5360
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x52b0
movsbl %al, %esi
movq 0x2211e(%rip), %rdi     # 0x3bff0
callq 0x5050
movq %rax, %rdi
callq 0x51e0
leaq -0x110(%rbp), %rdi
callq 0x280d6
jmp 0x1a114
leaq -0x48(%rbp), %rbx
movq %rbx, %rdi
callq 0x26eca
leaq -0x38(%rbp), %rax
movq %rax, (%rbx)
leaq 0x17678(%rip), %rsi     # 0x31582
leaq 0x17677(%rip), %rdx     # 0x31588
leaq -0x48(%rbp), %rdi
callq 0x1a774
leaq -0x110(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x1a420
movq %rax, %r15
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x19f46
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x52e0
movq %r14, %rdi
callq 0x288f0
movl %eax, %ebx
cmpl $0x2, %eax
jne 0x19fbc
movl %ebx, -0x5c(%rbp)
leaq -0x48(%rbp), %rdi
movq %r15, %rsi
callq 0x28944
leaq -0x58(%rbp), %r12
leaq -0x48(%rbp), %r13
movq %r12, %rdi
movq %r15, %rsi
callq 0x289f4
movq %r13, %rdi
movq %r12, %rsi
callq 0x27117
movl %eax, %ebx
movq %r12, %rdi
callq 0x26eca
testb %bl, %bl
je 0x1a004
movq -0x50(%rbp), %rax
movq (%rax), %r14
movq %r13, %rdi
callq 0x26f76
movq %rax, %rsi
callq 0x19a92
movq %r14, %rdi
movq %rax, %rsi
callq 0x25dbe
movq %r13, %rdi
callq 0x26ee4
jmp 0x19f6c
movq 0x2202d(%rip), %r14     # 0x3bff0
leaq 0x175bf(%rip), %rsi     # 0x31589
movl $0x25, %edx
movq %r14, %rdi
callq 0x5360
movq (%r14), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x52b0
movsbl %al, %esi
movq 0x21ffb(%rip), %rdi     # 0x3bff0
callq 0x5050
movq %rax, %rdi
callq 0x51e0
jmp 0x1a010
leaq -0x48(%rbp), %rdi
callq 0x26eca
movl -0x5c(%rbp), %ebx
leaq -0x110(%rbp), %rdi
callq 0x280d6
cmpl $0x2, %ebx
jne 0x1a114
leaq -0xb8(%rbp), %rdi
callq 0x290be
testb %al, %al
je 0x1a07b
movq 0x21fb4(%rip), %r14     # 0x3bff0
leaq 0x1756c(%rip), %rsi     # 0x315af
movl $0x2b, %edx
movq %r14, %rdi
callq 0x5360
movq (%r14), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x52b0
movsbl %al, %esi
movq 0x21f82(%rip), %rdi     # 0x3bff0
callq 0x5050
movq %rax, %rdi
callq 0x51e0
leaq -0xb8(%rbp), %rdi
callq 0x29086
movq 0x21f42(%rip), %rdi     # 0x3bfd0
leaq 0x1755c(%rip), %rsi     # 0x315f1
movl $0x16, %edx
callq 0x5360
movq -0x50(%rbp), %rax
movq (%rax), %rax
movl (%rax), %esi
movq 0x21f21(%rip), %rdi     # 0x3bfd0
callq 0x51d0
movq %rax, %rbx
leaq 0x1754a(%rip), %rsi     # 0x31608
movl $0xe, %edx
movq %rax, %rdi
callq 0x5360
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x52b0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x5050
movb $0x1, %bl
movq %rax, %rdi
callq 0x51e0
leaq -0x318(%rbp), %rdi
callq 0x50a0
movl %ebx, %eax
addq $0x308, %rsp            # imm = 0x308
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq -0xb8(%rbp), %rdi
callq 0x29086
jmp 0x19e92
jmp 0x1a15c
jmp 0x1a12d
jmp 0x1a15c
jmp 0x1a12d
movq %rdx, %r14
movq %rax, %rbx
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x1a1ad
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x52e0
jmp 0x1a1ad
jmp 0x1a164
jmp 0x1a15c
movq %rdx, %r14
movq %rax, %rbx
jmp 0x1a1c5
jmp 0x1a15c
movq %rdx, %r14
movq %rax, %rbx
jmp 0x1a1ad
movq %rdx, %r14
movq %rax, %rbx
jmp 0x1a1b9
jmp 0x1a19e
jmp 0x1a174
jmp 0x1a19e
jmp 0x1a19e
movq %rdx, %r14
movq %rax, %rbx
leaq -0x58(%rbp), %rdi
callq 0x26eca
jmp 0x1a1a4
movq %rax, %rbx
leaq -0x318(%rbp), %rdi
callq 0x50a0
movq %rbx, %rdi
callq 0x5560
jmp 0x1a19e
movq %rdx, %r14
movq %rax, %rbx
leaq -0x48(%rbp), %rdi
callq 0x26eca
leaq -0x110(%rbp), %rdi
callq 0x280d6
leaq -0xb8(%rbp), %rdi
callq 0x29086
cmpl $0x1, %r14d
jne 0x1a188
movq %rbx, %rdi
callq 0x5110
movq %rax, %rbx
movq 0x21e13(%rip), %rdi     # 0x3bff0
leaq 0x173f7(%rip), %rsi     # 0x315db
movl $0xe, %edx
callq 0x5360
movl 0x8(%rbx), %esi
incl %esi
movq 0x21df6(%rip), %rdi     # 0x3bff0
callq 0x5530
movq %rax, %r14
leaq 0x173e1(%rip), %rsi     # 0x315ea
movl $0x6, %edx
movq %rax, %rdi
callq 0x5360
movl 0xc(%rbx), %esi
incl %esi
movq %r14, %rdi
callq 0x5530
movq %rax, %r14
leaq 0x16fc8(%rip), %rsi     # 0x311f5
movl $0x2, %edx
movq %rax, %rdi
callq 0x5360
movq 0x10(%rbx), %rsi
movq 0x18(%rbx), %rdx
movq %r14, %rdi
callq 0x5360
movq %rax, %rdi
callq 0x5130
callq 0x54f0
jmp 0x19e92
jmp 0x1a185
movq %rax, %rbx
callq 0x54f0
jmp 0x1a188
movq %rax, %rdi
callq 0x1a412