// File: /workspace/github_cpp_makefile_star2_O1/srajangarg[P]raytracer/src/core/SceneLoader.cpp
// Function: SceneLoader::doInclude(std::istream&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&)
bool SceneLoader::doInclude(istream & str, string & name)
{
  if (!getName(str, "include", name))
    return false;

  SceneGroup * n = new SceneGroup();
  groups[name] = n;
  n->name_ = name;
  string file = getQuoted(str);
  n->mesh_ = new TriangleMesh(file);

  do
  {
    int state = findOpenOrClosedParen(str);

    if (state == ERROR)
    {
      if (n->meshMaterial_ == NULL)
      {
        n->meshMaterial_ = new ParametricMaterial();
        setMaterialDefaults(n->meshMaterial_);
      }

      return false;
    }
    else if (state == CLOSED)
    {
      if (n->meshMaterial_ == NULL)
      {
        n->meshMaterial_ = new ParametricMaterial();
        setMaterialDefaults(n->meshMaterial_);
      }

      return true;
    }
    else if (state == OPEN)
    {
      string cmd;

      if (readCommand(str, cmd))
      {
        if (cmd == "material")
        {
          string matName = getString(str);

          if (matName.empty())
          {
            *err << "No material name after material command at ";
            errLine(str.tellg());
          }
          else if (materials[matName] == NULL)
          {
            *err << "Unknown material " << matName << " referenced at ";
            errLine(str.tellg());
          }
          else
          {
            n->meshMaterial_ = materials[matName];
          }
        }
        else
        {
          *err << "Error: command " << cmd << " not recognized at ";
          errLine(str.tellg());
        }

        findCloseParen(str);
      }
    }
  }
  while (true);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rdx, %r12
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x78(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0x22b08(%rip), %rsi     # 0x2c3fc
leaq 0x22b08(%rip), %rdx     # 0x2c403
leaq 0x68(%rsp), %r15
movq %r15, %rdi
callq 0xc09a
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
movq %r12, %rcx
callq 0x8ff8
movl %eax, %ebp
movq 0x68(%rsp), %rdi
cmpq %r13, %rdi
je 0x9932
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x4320
testb %bpl, %bpl
je 0x9bf5
movl $0x68, %edi
callq 0x4310
movq %rax, %r15
movq %rax, %rdi
callq 0x5c38
leaq 0x18(%r14), %rdi
movq %r12, %rsi
callq 0xb4a0
movq %r15, (%rax)
movq %r15, %rdi
addq $0x8, %rdi
movq %r12, %rsi
callq 0x41c0
leaq 0x48(%rsp), %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x7a2e
movl $0x30, %edi
callq 0x4310
movq %rax, %r12
leaq 0x48(%rsp), %rsi
movq %rax, %rdi
callq 0xb6ce
movq %r12, 0x58(%r15)
leaq 0x38(%rsp), %r13
leaq 0x48(%r14), %rax
movq %rax, (%rsp)
movq %r14, %rdi
movq %rbx, %rsi
callq 0x7d48
testl %eax, %eax
je 0x99fc
cmpl $0x1, %eax
jne 0x9a98
movb $0x1, %r12b
cmpq $0x0, 0x60(%r15)
jne 0x9aca
movl $0x40, %edi
callq 0x4310
xorps %xmm0, %xmm0
movups %xmm0, 0x30(%rax)
movups %xmm0, 0x20(%rax)
movups %xmm0, 0x10(%rax)
movups %xmm0, (%rax)
movq %rax, 0x60(%r15)
movq %rax, %rsi
callq 0x9104
jmp 0x9aca
movq %r13, 0x28(%rsp)
movq $0x0, 0x30(%rsp)
movb $0x0, 0x38(%rsp)
movq %r14, %rdi
movq %rbx, %rsi
leaq 0x28(%rsp), %rdx
callq 0x7b10
testb %al, %al
je 0x9bb7
leaq 0x28(%rsp), %rdi
leaq 0x229d1(%rip), %rsi     # 0x2c404
callq 0x4110
testl %eax, %eax
je 0x9ad1
movq 0x90(%r14), %rbp
movl $0xf, %edx
movq %rbp, %rdi
leaq 0x228fc(%rip), %rsi     # 0x2c352
callq 0x4370
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %rdx
movq %rbp, %rdi
callq 0x4370
movl $0x13, %edx
movq %rax, %rdi
leaq 0x228e6(%rip), %rsi     # 0x2c362
callq 0x4370
movq %rbx, %rdi
callq 0x4590
movq %r14, %rdi
movl %eax, %esi
callq 0x8418
jmp 0x9baf
cmpq $0x0, 0x60(%r15)
jne 0x9ac7
movl $0x40, %edi
callq 0x4310
xorps %xmm0, %xmm0
movups %xmm0, 0x30(%rax)
movups %xmm0, 0x20(%rax)
movups %xmm0, 0x10(%rax)
movups %xmm0, (%rax)
movq %rax, 0x60(%r15)
movq %rax, %rsi
callq 0x9104
xorl %r12d, %r12d
xorl %eax, %eax
jmp 0x9bd0
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x7820
cmpq $0x0, 0x10(%rsp)
je 0x9b14
movq (%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0xb51c
cmpq $0x0, (%rax)
je 0x9b40
movq (%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0xb51c
movq (%rax), %rax
movq %rax, 0x60(%r15)
jmp 0x9b93
movq 0x90(%r14), %rdi
movl $0x2b, %edx
leaq 0x228e6(%rip), %rsi     # 0x2c40d
callq 0x4370
movq %rbx, %rdi
callq 0x4590
movq %r14, %rdi
movl %eax, %esi
callq 0x8418
jmp 0x9b93
movq 0x90(%r14), %rbp
movl $0x11, %edx
movq %rbp, %rdi
leaq 0x228e3(%rip), %rsi     # 0x2c439
callq 0x4370
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq %rbp, %rdi
callq 0x4370
movl $0xf, %edx
movq %rax, %rdi
leaq 0x228cf(%rip), %rsi     # 0x2c44b
callq 0x4370
movq %rbx, %rdi
callq 0x4590
movq %r14, %rdi
movl %eax, %esi
callq 0x8418
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x9baf
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x4320
movq %rbx, %rsi
callq 0x7ed0
movq 0x28(%rsp), %rdi
cmpq %r13, %rdi
je 0x9bce
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x4320
movb $0x1, %al
testb %al, %al
jne 0x99a9
leaq 0x58(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x9bf8
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x4320
jmp 0x9bf8
xorl %r12d, %r12d
andb $0x1, %r12b
movl %r12d, %eax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x9c47
movq %rax, %rbx
movl $0x30, %esi
movq %r12, %rdi
jmp 0x9c7f
jmp 0x9c86
movq %rax, %rbx
movl $0x68, %esi
movq %r15, %rdi
jmp 0x9c9f
jmp 0x9c47
jmp 0x9c6a
movq %rax, %rbx
movq 0x68(%rsp), %rdi
cmpq %r13, %rdi
je 0x9ca4
movq 0x78(%rsp), %rsi
jmp 0x9c9c
movq %rax, %rbx
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x9c6d
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x4320
jmp 0x9c6d
jmp 0x9c6a
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %r13, %rdi
je 0x9c89
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x4320
jmp 0x9c89
movq %rax, %rbx
leaq 0x58(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x9ca4
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x4320
movq %rbx, %rdi
callq 0x45c0