// File: /workspace/github_cpp_makefile_star2_O2/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 0x18259(%rip), %rsi     # 0x2153c
leaq 0x48(%rsp), %rdi
leaq 0x28(%rsp), %rdx
callq 0x9c50
leaq 0x48(%rsp), %rdx
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rcx
callq 0x7ef8
movl %eax, %ebp
leaq 0x48(%rsp), %rdi
callq 0x4170
testb %bpl, %bpl
je 0x953c
pushq $0x68
popq %rdi
callq 0x4320
movq %rax, %r12
movq %rax, %rdi
callq 0x56d4
leaq 0x18(%r14), %rdi
movq %r15, %rsi
callq 0x9a8c
movq %r12, (%rax)
movq %r12, %rdi
addq $0x8, %rdi
movq %r15, %rsi
callq 0x41c0
pushq $0x38
popq %rdi
callq 0x4320
movq %rax, %r15
movq %rax, %rdi
callq 0x9d70
movq %r12, 0x8(%rsp)
movq %r15, 0x50(%r12)
leaq 0x68(%rsp), %r13
leaq 0x28(%rsp), %r15
leaq 0x10(%rsp), %r12
movq %r14, %rdi
movq %rbx, %rsi
callq 0x71d2
testl %eax, %eax
jne 0x9540
leaq 0x38(%rsp), %rax
movq %rax, 0x28(%rsp)
andq $0x0, 0x30(%rsp)
movb $0x0, 0x38(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
andq $0x0, 0x20(%rsp)
movq %r13, %rdi
leaq 0x1818c(%rip), %rsi     # 0x21543
leaq 0x7(%rsp), %rdx
callq 0x9c50
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x7050
testb %al, %al
je 0x951f
movq %r15, %rdi
leaq 0x18169(%rip), %rsi     # 0x2154a
callq 0x4d52
testb %al, %al
je 0x9424
movq %r14, %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0x7388
testl %eax, %eax
jle 0x9493
movq %r12, %rsi
pushq $0x1
popq %rdx
callq 0x76d4
movq 0x10(%rsp), %rax
movq (%rax), %rax
movq 0x8(%rsp), %rcx
movq 0x50(%rcx), %rcx
movq %rax, (%rcx)
jmp 0x9517
cmpq $0x1, 0x30(%rsp)
jne 0x944f
movq %r13, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x4660
movq %rax, %rbp
shlq $0x20, %rax
movabsq $-0x100000000, %rcx     # imm = 0xFFFFFFFF00000000
cmpq %rcx, %rax
jne 0x94ba
movq 0x90(%r14), %rdi
leaq 0x17ed5(%rip), %rsi     # 0x21332
callq 0x4300
movq %rax, %rdi
movq %r15, %rsi
callq 0x42e0
movq %rax, %rdi
leaq 0x17ecb(%rip), %rsi     # 0x21342
callq 0x4300
movq %rbx, %rdi
callq 0x45a0
movq %r14, %rdi
movl %eax, %esi
callq 0x76b4
jmp 0x9517
movq 0x90(%r14), %rdi
leaq 0x180b5(%rip), %rsi     # 0x21556
callq 0x4300
movq %rbx, %rdi
callq 0x45a0
movq %r14, %rdi
movl %eax, %esi
callq 0x76b4
jmp 0x9517
movq %r14, %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0x7388
testl %eax, %eax
jle 0x94f2
movslq %ebp, %rbp
movq %r12, %rsi
pushq $0x1
popq %rdx
callq 0x76d4
movq 0x10(%rsp), %rax
movq (%rax), %rax
movq 0x8(%rsp), %rcx
movq 0x50(%rcx), %rcx
movq %rax, 0x8(%rcx,%rbp,8)
jmp 0x9517
movq 0x90(%r14), %rdi
leaq 0x18079(%rip), %rsi     # 0x21579
callq 0x4300
movq %rbx, %rdi
callq 0x45a0
movq %r14, %rdi
movl %eax, %esi
callq 0x76b4
movq %rbx, %rsi
callq 0x72de
movq %r13, %rdi
callq 0x4170
movq %r12, %rdi
callq 0xa7f0
movq %r15, %rdi
callq 0x4170
jmp 0x9377
xorl %ebx, %ebx
jmp 0x9555
cmpl $0x1, %eax
jne 0x9549
movb $0x1, %bl
jmp 0x954b
xorl %ebx, %ebx
movq 0x8(%rsp), %rsi
callq 0x917c
movl %ebx, %eax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x9593
movq %rax, %rbx
pushq $0x68
popq %rsi
movq %r12, %rdi
callq 0x4330
jmp 0x95b4
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
jmp 0x95af
movq %rax, %rbx
jmp 0x95b4
jmp 0x9593
jmp 0x9593
movq %rax, %rbx
jmp 0x95a0
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
callq 0x4170
leaq 0x10(%rsp), %rdi
callq 0xa7f0
leaq 0x28(%rsp), %rdi
callq 0x4170
movq %rbx, %rdi
callq 0x45c0