// File: /workspace/github_cpp_makefile_star2_O1/srajangarg[P]raytracer/src/core/SceneLoader.cpp
// Function: SceneLoader::buildScene(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
bool SceneLoader::buildScene(string filename)
{
  buildEndlineTable(filename);
  ifstream file(filename.c_str());
  string line;

  while (findOpenParen(file))
  {
    file.tellg();

    if (readCommand(file, line))
    {
      if (line == "Include")
      {
        string instName;

        if (doInclude(file, instName))
        {
          cout << "included " << instName << endl;
        }
        else
        {
          cout << "mangled include at ";
          curPos(cout, file.tellg());
          cout << endl;
        }
      }
      else if (line == "Sphere")
      {
        string gname;

        if (doSphere(file, gname))
        {
          cout << "read sphere " << gname << endl;
        }
        else
        {
          *err << "mangled sphere command at ";
          errLine(file.tellg());
        }
      }
      else if (line == "Material")
      {
        string gname;

        if (doMaterial(file, gname))
        {
          cout << "read material " << gname << endl;
        }
        else
        {
          *err << "mangled material command at ";
          errLine(file.tellg());
        }
      }
      else if (line == "Light")
      {
        string gname;

        if (doLight(file, gname))
        {
          cout << "read light " << gname << endl;
        }
        else
        {
          *err << "mangled light command at ";
          errLine(file.tellg());
        }
      }
      else if (line == "Camera")
      {
        string gname;

        if (doCamera(file, gname))
        {
          cout << "read camera " << gname << endl;
        }
        else
        {
          *err << "mangled camera command at ";
          errLine(file.tellg());
        }
      }
      else if (line == "I")
      {
        *err << "Error: Instance commands must belong to a group, but I found in global scope at ";
        errLine(file.tellg());
        /*string iname; // code to handle I at global scope (doesn't make much sense now that instance names skip the names table)
        if (doI(file, iname))
        {
            cout << "got an instance named " << iname << endl;
        }*/
      }
      else if (line == "G")
      {
        string iname;

        if (doG(file, iname))
        {
          cout << "got a group named " << iname << endl;
        }
      }
      else if (line == "Render")
      {
        string iname;

        if (doRender(file, iname))
        {
          cout << "did render " << iname << endl;
        }
      }
      else
      {
        *err << "command not recognized: " << line << endl;
      }

      findCloseParen(file);
    }
    else
    {
    }
  }

  return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x268, %rsp            # imm = 0x268
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x50(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%rsi), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
leaq 0x40(%rsp), %r15
movq %r15, %rdi
callq 0x5012
movq %rbx, %rdi
movq %r15, %rsi
callq 0x7602
movq 0x40(%rsp), %rdi
cmpq %r12, %rdi
je 0x6e32
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x4320
movq (%r14), %rsi
leaq 0x60(%rsp), %r14
movq %r14, %rdi
movl $0x8, %edx
callq 0x45f0
leaq 0x30(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x10(%rsp), %r12
leaq 0x20(%rsp), %r15
movq 0x31164(%rip), %r13     # 0x37fd0
movq %rbx, %rdi
movq %r14, %rsi
callq 0x7bda
testb %al, %al
je 0x7459
movq %r14, %rdi
callq 0x4590
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x7b10
testb %al, %al
je 0x6e6c
movq %r15, %rdi
leaq 0x257c3(%rip), %rsi     # 0x2c666
callq 0x4110
testl %eax, %eax
je 0x6fad
movq %r15, %rdi
leaq 0x257d2(%rip), %rsi     # 0x2c68c
callq 0x4110
testl %eax, %eax
je 0x7016
movq %r15, %rdi
leaq 0x257ea(%rip), %rsi     # 0x2c6bb
callq 0x4110
testl %eax, %eax
je 0x70eb
movq %r15, %rdi
leaq 0x25808(%rip), %rsi     # 0x2c6f0
callq 0x4110
testl %eax, %eax
je 0x7196
movq %r15, %rdi
leaq 0x2581d(%rip), %rsi     # 0x2c71c
callq 0x4110
testl %eax, %eax
je 0x7241
movq %r15, %rdi
leaq 0x26221(%rip), %rsi     # 0x2d137
callq 0x4110
testl %eax, %eax
je 0x72ec
movq %r15, %rdi
leaq 0x25b80(%rip), %rsi     # 0x2caad
callq 0x4110
testl %eax, %eax
je 0x734a
movq %r15, %rdi
leaq 0x2586b(%rip), %rsi     # 0x2c7af
callq 0x4110
testl %eax, %eax
je 0x73c3
movq 0x90(%rbx), %rbp
movl $0x18, %edx
movq %rbp, %rdi
leaq 0x2585b(%rip), %rsi     # 0x2c7c2
callq 0x4370
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdx
movq %rbp, %rdi
callq 0x4370
movq %rax, %rbp
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbp, %rdi
movl $0xa, %esi
callq 0x42f0
movsbl %al, %esi
movq %rbp, %rdi
callq 0x4050
movq %rax, %rdi
callq 0x4230
jmp 0x744c
movq %r12, (%rsp)
movq $0x0, 0x8(%rsp)
movb $0x0, 0x10(%rsp)
movq %rbx, %rdi
movq %r14, %rsi
movq %rsp, %rdx
callq 0x98ca
testb %al, %al
je 0x7092
movl $0x9, %edx
movq %r13, %rdi
leaq 0x2568a(%rip), %rsi     # 0x2c66e
callq 0x4370
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq %r13, %rdi
callq 0x4370
movq %rax, %rbp
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbp, %rdi
movl $0xa, %esi
callq 0x42f0
jmp 0x70d3
movq %r12, (%rsp)
movq $0x0, 0x8(%rsp)
movb $0x0, 0x10(%rsp)
movq %rbx, %rdi
movq %r14, %rsi
movq %rsp, %rdx
callq 0x9cac
testb %al, %al
je 0x7167
movl $0xc, %edx
movq %r13, %rdi
leaq 0x25646(%rip), %rsi     # 0x2c693
callq 0x4370
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq %r13, %rdi
callq 0x4370
movq %rax, %rbp
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbp, %rdi
movl $0xa, %esi
callq 0x42f0
movsbl %al, %esi
movq %rbp, %rdi
callq 0x4050
movq %rax, %rdi
callq 0x4230
jmp 0x7436
movl $0x13, %edx
movq %r13, %rdi
leaq 0x255d7(%rip), %rsi     # 0x2c678
callq 0x4370
movq %r14, %rdi
callq 0x4590
movq %rbx, %rdi
movq %r13, %rsi
movl %eax, %edx
callq 0x773e
movq (%r13), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x42f0
movq %r13, %rbp
movsbl %al, %esi
movq %rbp, %rdi
callq 0x4050
movq %rax, %rdi
callq 0x4230
jmp 0x7436
movq %r12, (%rsp)
movq $0x0, 0x8(%rsp)
movb $0x0, 0x10(%rsp)
movq %rbx, %rdi
movq %r14, %rsi
movq %rsp, %rdx
callq 0x91ba
testb %al, %al
je 0x7212
movl $0xe, %edx
movq %r13, %rdi
leaq 0x255a2(%rip), %rsi     # 0x2c6c4
callq 0x4370
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq %r13, %rdi
callq 0x4370
movq %rax, %rbp
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbp, %rdi
movl $0xa, %esi
callq 0x42f0
movsbl %al, %esi
movq %rbp, %rdi
callq 0x4050
movq %rax, %rdi
callq 0x4230
jmp 0x7436
movq 0x90(%rbx), %rdi
movl $0x1a, %edx
leaq 0x25526(%rip), %rsi     # 0x2c6a0
callq 0x4370
movq %r14, %rdi
callq 0x4590
movq %rbx, %rdi
movl %eax, %esi
callq 0x8418
jmp 0x7436
movq %r12, (%rsp)
movq $0x0, 0x8(%rsp)
movb $0x0, 0x10(%rsp)
movq %rbx, %rdi
movq %r14, %rsi
movq %rsp, %rdx
callq 0xa238
testb %al, %al
je 0x72bd
movl $0xb, %edx
movq %r13, %rdi
leaq 0x25529(%rip), %rsi     # 0x2c6f6
callq 0x4370
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq %r13, %rdi
callq 0x4370
movq %rax, %rbp
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbp, %rdi
movl $0xa, %esi
callq 0x42f0
movsbl %al, %esi
movq %rbp, %rdi
callq 0x4050
movq %rax, %rdi
callq 0x4230
jmp 0x7436
movq 0x90(%rbx), %rdi
movl $0x1c, %edx
leaq 0x254ae(%rip), %rsi     # 0x2c6d3
callq 0x4370
movq %r14, %rdi
callq 0x4590
movq %rbx, %rdi
movl %eax, %esi
callq 0x8418
jmp 0x7436
movq %r12, (%rsp)
movq $0x0, 0x8(%rsp)
movb $0x0, 0x10(%rsp)
movq %rbx, %rdi
movq %r14, %rsi
movq %rsp, %rdx
callq 0xaa5c
testb %al, %al
je 0x731b
movl $0xc, %edx
movq %r13, %rdi
leaq 0x254ab(%rip), %rsi     # 0x2c723
callq 0x4370
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq %r13, %rdi
callq 0x4370
movq %rax, %rbp
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbp, %rdi
movl $0xa, %esi
callq 0x42f0
movsbl %al, %esi
movq %rbp, %rdi
callq 0x4050
movq %rax, %rdi
callq 0x4230
jmp 0x7436
movq 0x90(%rbx), %rdi
movl $0x19, %edx
leaq 0x25432(%rip), %rsi     # 0x2c702
callq 0x4370
movq %r14, %rdi
callq 0x4590
movq %rbx, %rdi
movl %eax, %esi
callq 0x8418
jmp 0x7436
movq 0x90(%rbx), %rdi
movl $0x50, %edx
leaq 0x2544c(%rip), %rsi     # 0x2c74b
callq 0x4370
movq %r14, %rdi
callq 0x4590
movq %rbx, %rdi
movl %eax, %esi
callq 0x8418
jmp 0x744c
movq 0x90(%rbx), %rdi
movl $0x1a, %edx
leaq 0x25402(%rip), %rsi     # 0x2c730
callq 0x4370
movq %r14, %rdi
callq 0x4590
movq %rbx, %rdi
movl %eax, %esi
callq 0x8418
jmp 0x7436
movq %r12, (%rsp)
movq $0x0, 0x8(%rsp)
movb $0x0, 0x10(%rsp)
movq %rbx, %rdi
movq %r14, %rsi
movq %rsp, %rdx
callq 0xae8c
testb %al, %al
je 0x7436
movl $0x12, %edx
movq %r13, %rdi
leaq 0x2541b(%rip), %rsi     # 0x2c79c
callq 0x4370
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq %r13, %rdi
callq 0x4370
movq %rax, %rbp
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbp, %rdi
movl $0xa, %esi
callq 0x42f0
movsbl %al, %esi
movq %rbp, %rdi
callq 0x4050
movq %rax, %rdi
callq 0x4230
jmp 0x7436
movq %r12, (%rsp)
movq $0x0, 0x8(%rsp)
movb $0x0, 0x10(%rsp)
movq %rbx, %rdi
movq %r14, %rsi
movq %rsp, %rdx
callq 0xb1d2
testb %al, %al
je 0x7436
movl $0xb, %edx
movq %r13, %rdi
leaq 0x253c0(%rip), %rsi     # 0x2c7b6
callq 0x4370
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq %r13, %rdi
callq 0x4370
movq %rax, %rbp
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbp, %rdi
movl $0xa, %esi
callq 0x42f0
movsbl %al, %esi
movq %rbp, %rdi
callq 0x4050
movq %rax, %rdi
callq 0x4230
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x744c
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x4320
movq %r14, %rsi
callq 0x7ed0
jmp 0x6e6c
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x7475
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x4320
leaq 0x60(%rsp), %rdi
callq 0x40e0
movb $0x1, %al
addq $0x268, %rsp            # imm = 0x268
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x74c7
jmp 0x74c7
movq %rax, %rbx
movq 0x40(%rsp), %rdi
cmpq %r12, %rdi
je 0x750b
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x4320
jmp 0x750b
jmp 0x74e2
jmp 0x74c7
jmp 0x74c7
jmp 0x74c7
jmp 0x74c7
jmp 0x74c7
jmp 0x74c7
jmp 0x74c7
jmp 0x74c7
jmp 0x74c7
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r12, %rdi
je 0x74e5
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x4320
jmp 0x74e5
movq %rax, %rbx
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x7501
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x4320
leaq 0x60(%rsp), %rdi
callq 0x40e0
movq %rbx, %rdi
callq 0x45c0
nop