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

  SceneGroup * n = new SceneGroup();
  groups[name] = n;
  n->name_ = name;
  n->camera_ = new ParametricCamera();

  do
  {
    int state = findOpenOrClosedParen(str);

    if (state == ERROR)
    {
      setCameraDefaults(n);
      return false;
    }
    else if (state == CLOSED)
    {
      setCameraDefaults(n);
      return true;
    }
    else if (state == OPEN)
    {
      string cmd;
      vector<ParametricValue *> values;
      string sides = "lrbtnf";
      int side = 0;

      if (readCommand(str, cmd))
      {
        if (cmd == "perspective")
        {
          if (getValues(str, values) < 1)
          {
            *err << "Perspective with no parameters at ";
            errLine(str.tellg());
          }
          else
          {
            cleanAfter(values, 1);
            n->camera_->perspective_ = values[0];
          }
        }
        else if (cmd.size() == 1 && (side = (int)sides.find(cmd)) != string::npos)
        {
          if (getValues(str, values) < 1)
          {
            *err << "l with no parameters at ";
            errLine(str.tellg());
          }
          else
          {
            cleanAfter(values, 1);
            n->camera_->frustum_[side] = values[0];
          }
        }
        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, %r15
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x78(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0x20e34(%rip), %rsi     # 0x2b56c
leaq 0x20e33(%rip), %rdx     # 0x2b572
leaq 0x68(%rsp), %r12
movq %r12, %rdi
callq 0xbcb6
movq %r14, %rdi
movq %rbx, %rsi
movq %r12, %rdx
movq %r15, %rcx
callq 0x8cda
movl %eax, %ebp
movq 0x68(%rsp), %rdi
cmpq %r13, %rdi
je 0xa776
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x4310
testb %bpl, %bpl
je 0xaa95
movl $0x68, %edi
callq 0x4300
movq %rax, %r12
movq %rax, %rdi
callq 0x5c1c
leaq 0x18(%r14), %rdi
movq %r15, %rsi
callq 0xb11e
movq %r12, (%rax)
movq %r12, %rdi
addq $0x8, %rdi
movq %r15, %rsi
callq 0x41b0
movl $0x38, %edi
callq 0x4300
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movups %xmm0, 0x10(%rax)
movups %xmm0, 0x20(%rax)
movq $0x0, 0x30(%rax)
movq %r12, 0x20(%rsp)
movq %rax, 0x50(%r12)
leaq 0x38(%rsp), %r13
leaq 0x58(%rsp), %rbp
xorl %r15d, %r15d
movq %r14, %rdi
movq %rbx, %rsi
callq 0x7aaa
testl %eax, %eax
jne 0xaa99
movq %r13, 0x28(%rsp)
movq %r15, 0x30(%rsp)
movb $0x0, 0x38(%rsp)
movq %r15, 0x10(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
movq %rbp, 0x48(%rsp)
leaq 0x48(%rsp), %rdi
leaq 0x20d4b(%rip), %rsi     # 0x2b573
leaq 0x20d4a(%rip), %rdx     # 0x2b579
callq 0xbcb6
movq %r14, %rdi
movq %rbx, %rsi
leaq 0x28(%rsp), %rdx
callq 0x7872
testb %al, %al
je 0xaa48
leaq 0x28(%rsp), %rdi
leaq 0x20d22(%rip), %rsi     # 0x2b57a
callq 0x4110
testl %eax, %eax
je 0xa8f5
cmpq $0x1, 0x30(%rsp)
jne 0xa89d
movq 0x28(%rsp), %rsi
movl $0x1, %ecx
leaq 0x48(%rsp), %rdi
xorl %edx, %edx
callq 0x4590
movq %rax, %r12
shlq $0x20, %rax
movabsq $-0x100000000, %rcx     # imm = 0xFFFFFFFF00000000
cmpq %rcx, %rax
jne 0xa96c
movq 0x90(%r14), %r12
movl $0xf, %edx
movq %r12, %rdi
leaq 0x20aaf(%rip), %rsi     # 0x2b362
callq 0x4360
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %rdx
movq %r12, %rdi
callq 0x4360
movl $0x13, %edx
movq %rax, %rdi
leaq 0x20a99(%rip), %rsi     # 0x2b372
callq 0x4360
movq %rbx, %rdi
callq 0x4580
movq %r14, %rdi
movl %eax, %esi
callq 0x8180
jmp 0xaa40
movq %r14, %rdi
movq %rbx, %rsi
movq %rsp, %rdx
callq 0x7d18
testl %eax, %eax
jle 0xa9ea
movq (%rsp), %rax
movq 0x8(%rsp), %rcx
movq %rcx, %rdx
subq %rax, %rdx
cmpq $0x9, %rdx
jb 0xa958
movl $0x1, %edx
movl $0x2, %r12d
movq (%rax,%rdx,8), %rdi
testq %rdi, %rdi
je 0xa943
movq (%rdi), %rax
callq *0x20(%rax)
movq (%rsp), %rax
movq 0x8(%rsp), %rcx
movl %r12d, %edx
movq %rcx, %rsi
subq %rax, %rsi
sarq $0x3, %rsi
incl %r12d
cmpq %rdx, %rsi
ja 0xa92b
movq (%rax), %rax
movq 0x20(%rsp), %rcx
movq 0x50(%rcx), %rcx
movq %rax, (%rcx)
jmp 0xaa40
movq %r14, %rdi
movq %rbx, %rsi
movq %rsp, %rdx
callq 0x7d18
testl %eax, %eax
jle 0xaa16
movq (%rsp), %rax
movq 0x8(%rsp), %rcx
movq %rcx, %rdx
subq %rax, %rdx
cmpq $0x9, %rdx
jb 0xa9cf
movl $0x1, %edx
movl $0x2, %r13d
movq (%rax,%rdx,8), %rdi
testq %rdi, %rdi
je 0xa9ba
movq (%rdi), %rax
callq *0x20(%rax)
movq (%rsp), %rax
movq 0x8(%rsp), %rcx
movl %r13d, %edx
movq %rcx, %rsi
subq %rax, %rsi
sarq $0x3, %rsi
incl %r13d
cmpq %rdx, %rsi
ja 0xa9a2
movslq %r12d, %rcx
movq (%rax), %rax
movq 0x20(%rsp), %rdx
movq 0x50(%rdx), %rdx
movq %rax, 0x8(%rdx,%rcx,8)
leaq 0x38(%rsp), %r13
jmp 0xaa40
movq 0x90(%r14), %rdi
movl $0x22, %edx
leaq 0x20b89(%rip), %rsi     # 0x2b586
callq 0x4360
movq %rbx, %rdi
callq 0x4580
movq %r14, %rdi
movl %eax, %esi
callq 0x8180
jmp 0xaa40
movq 0x90(%r14), %rdi
movl $0x18, %edx
leaq 0x20b80(%rip), %rsi     # 0x2b5a9
callq 0x4360
movq %rbx, %rdi
callq 0x4580
movq %r14, %rdi
movl %eax, %esi
callq 0x8180
movq %rbx, %rsi
callq 0x7c34
movq 0x48(%rsp), %rdi
cmpq %rbp, %rdi
je 0xaa5f
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x4310
movq (%rsp), %rdi
testq %rdi, %rdi
je 0xaa75
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x4310
movq 0x28(%rsp), %rdi
cmpq %r13, %rdi
je 0xa7e9
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x4310
jmp 0xa7e9
xorl %ebx, %ebx
jmp 0xaaae
cmpl $0x1, %eax
jne 0xaaa2
movb $0x1, %bl
jmp 0xaaa4
xorl %ebx, %ebx
movq 0x20(%rsp), %rsi
callq 0xa5ae
movl %ebx, %eax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xaaee
movq %rax, %rbx
movl $0x68, %esi
movq %r12, %rdi
jmp 0xab30
movq %rax, %rbx
movq 0x68(%rsp), %rdi
cmpq %r13, %rdi
je 0xab35
movq 0x78(%rsp), %rsi
jmp 0xab2d
jmp 0xaaee
jmp 0xaaee
movq %rax, %rbx
jmp 0xab08
movq %rax, %rbx
movq 0x48(%rsp), %rdi
cmpq %rbp, %rdi
je 0xab08
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x4310
movq (%rsp), %rdi
testq %rdi, %rdi
je 0xab1e
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x4310
movq 0x28(%rsp), %rdi
cmpq %r13, %rdi
je 0xab35
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x4310
movq %rbx, %rdi
callq 0x45b0
nop