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

  SceneGroup * n = new SceneGroup();
  groups[name] = n;
  n->name_ = name;
  n->light_ = new ParametricLight();

  do
  {
    int state = findOpenOrClosedParen(str);

    if (state == ERROR)
    {
      setLightDefaults(n);
      return false;
    }
    else if (state == CLOSED)
    {
      setLightDefaults(n);
      return true;
    }
    else if (state == OPEN)
    {
      string cmd;
      vector<ParametricValue *> values;

      if (readCommand(str, cmd))
      {
        if (cmd == "type")
        {
          if (getValues(str, values) < 1)
          {
            *err << "Type with no parameters at ";
            errLine(str.tellg());
          }
          else
          {
            cleanAfter(values, 1);
            n->light_->type_ = values[0];
          }
        }
        else if (cmd == "falloff")
        {
          if (getValues(str, values) < 1)
          {
            *err << "Falloff with no parameters at ";
            errLine(str.tellg());
          }
          else
          {
            cleanAfter(values, 1);
            n->light_->falloff_ = values[0];
          }
        }
        else if (cmd == "deaddistance")
        {
          if (getValues(str, values) < 1)
          {
            *err << "deaddistance with no parameters at ";
            errLine(str.tellg());
          }
          else
          {
            cleanAfter(values, 1);
            n->light_->deadDistance_ = values[0];
          }
        }
        else if (cmd == "offset")
        {
          if (getValues(str, values) < 1)
          {
            *err << "offset with no parameters at ";
            errLine(str.tellg());
          }
          else
          {
            cleanAfter(values, 1);
            n->light_->offset_ = values[0];
          }
        }
        else if (cmd == "angularfalloff")
        {
          if (getValues(str, values) < 1)
          {
            *err << "angularfalloff with no parameters at ";
            errLine(str.tellg());
          }
          else
          {
            cleanAfter(values, 1);
            n->light_->angularFalloff_ = values[0];
          }
        }
        else if (cmd == "color")
        {
          if (getValues(str, values) < 3)
          {
            *err << "color with insufficient parameters at ";
            errLine(str.tellg());
          }
          else
          {
            cleanAfter(values, 3);
            n->light_->color_ = new ParametricColor();
            n->light_->color_->color_[0] = values[0];
            n->light_->color_->color_[1] = values[1];
            n->light_->color_->color_[2] = values[2];
          }
        }
        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 $0x68, %rsp
movq %rdx, %r12
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x58(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0x2158e(%rip), %rsi     # 0x2b495
leaq 0x2158c(%rip), %rdx     # 0x2b49a
leaq 0x48(%rsp), %r15
movq %r15, %rdi
callq 0xbcb6
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
movq %r12, %rcx
callq 0x8cda
movl %eax, %ebp
movq 0x48(%rsp), %rdi
cmpq %r13, %rdi
je 0x9f45
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x4310
testb %bpl, %bpl
je 0xa51d
movl $0x68, %edi
callq 0x4300
movq %rax, %r15
movq %rax, %rdi
callq 0x5c1c
leaq 0x18(%r14), %rdi
movq %r12, %rsi
callq 0xb11e
movq %r15, (%rax)
movq %r15, %rdi
addq $0x8, %rdi
movq %r12, %rsi
callq 0x41b0
movl $0x30, %edi
callq 0x4300
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movups %xmm0, 0x10(%rax)
movups %xmm0, 0x20(%rax)
movq %r15, 0x20(%rsp)
movq %rax, 0x48(%r15)
leaq 0x38(%rsp), %r13
xorl %r15d, %r15d
leaq 0x28(%rsp), %r12
movq %r14, %rdi
movq %rbx, %rsi
callq 0x7aaa
testl %eax, %eax
jne 0xa521
movq %r13, 0x28(%rsp)
movq %r15, 0x30(%rsp)
movb $0x0, 0x38(%rsp)
movq %r15, 0x10(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
movq %r14, %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0x7872
testb %al, %al
je 0xa44b
movq %r12, %rdi
leaq 0x22227(%rip), %rsi     # 0x2c224
callq 0x4110
testl %eax, %eax
je 0xa0d5
movq %r12, %rdi
leaq 0x21503(%rip), %rsi     # 0x2b517
callq 0x4110
testl %eax, %eax
je 0xa149
movq %r12, %rdi
leaq 0x2148f(%rip), %rsi     # 0x2b4ba
callq 0x4110
testl %eax, %eax
je 0xa1be
movq %r12, %rdi
leaq 0x214a9(%rip), %rsi     # 0x2b4eb
callq 0x4110
testl %eax, %eax
je 0xa262
movq %r12, %rdi
leaq 0x214b7(%rip), %rsi     # 0x2b510
callq 0x4110
testl %eax, %eax
je 0xa306
movq %r12, %rdi
leaq 0x212ab(%rip), %rsi     # 0x2b31b
callq 0x4110
testl %eax, %eax
je 0xa3aa
movq 0x90(%r14), %rbp
movl $0xf, %edx
movq %rbp, %rdi
leaq 0x212cf(%rip), %rsi     # 0x2b362
callq 0x4360
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %rdx
movq %rbp, %rdi
callq 0x4360
movl $0x13, %edx
movq %rax, %rdi
leaq 0x212b9(%rip), %rsi     # 0x2b372
callq 0x4360
movq %rbx, %rdi
callq 0x4580
movq %r14, %rdi
movl %eax, %esi
callq 0x8180
jmp 0xa443
movq %r14, %rdi
movq %rbx, %rsi
movq %rsp, %rdx
callq 0x7d18
testl %eax, %eax
jle 0xa233
movq (%rsp), %rax
movq 0x8(%rsp), %rcx
movq %rcx, %rdx
subq %rax, %rdx
cmpq $0x9, %rdx
jb 0xa135
movl $0x1, %edx
movl $0x2, %ebp
movq (%rax,%rdx,8), %rdi
testq %rdi, %rdi
je 0xa122
movq (%rdi), %rax
callq *0x20(%rax)
movq (%rsp), %rax
movq 0x8(%rsp), %rcx
movl %ebp, %edx
movq %rcx, %rsi
subq %rax, %rsi
sarq $0x3, %rsi
incl %ebp
cmpq %rdx, %rsi
ja 0xa10a
movq (%rax), %rax
movq 0x20(%rsp), %rcx
movq 0x48(%rcx), %rcx
movq %rax, (%rcx)
jmp 0xa443
movq %r14, %rdi
movq %rbx, %rsi
movq %rsp, %rdx
callq 0x7d18
testl %eax, %eax
jle 0xa2d7
movq (%rsp), %rax
movq 0x8(%rsp), %rcx
movq %rcx, %rdx
subq %rax, %rdx
cmpq $0x9, %rdx
jb 0xa1a9
movl $0x1, %edx
movl $0x2, %ebp
movq (%rax,%rdx,8), %rdi
testq %rdi, %rdi
je 0xa196
movq (%rdi), %rax
callq *0x20(%rax)
movq (%rsp), %rax
movq 0x8(%rsp), %rcx
movl %ebp, %edx
movq %rcx, %rsi
subq %rax, %rsi
sarq $0x3, %rsi
incl %ebp
cmpq %rdx, %rsi
ja 0xa17e
movq (%rax), %rax
movq 0x20(%rsp), %rcx
movq 0x48(%rcx), %rcx
movq %rax, 0x10(%rcx)
jmp 0xa443
movq %r14, %rdi
movq %rbx, %rsi
movq %rsp, %rdx
callq 0x7d18
testl %eax, %eax
jle 0xa37b
movq (%rsp), %rax
movq 0x8(%rsp), %rcx
movq %rcx, %rdx
subq %rax, %rdx
cmpq $0x9, %rdx
jb 0xa21e
movl $0x1, %edx
movl $0x2, %ebp
movq (%rax,%rdx,8), %rdi
testq %rdi, %rdi
je 0xa20b
movq (%rdi), %rax
callq *0x20(%rax)
movq (%rsp), %rax
movq 0x8(%rsp), %rcx
movl %ebp, %edx
movq %rcx, %rsi
subq %rax, %rsi
sarq $0x3, %rsi
incl %ebp
cmpq %rdx, %rsi
ja 0xa1f3
movq (%rax), %rax
movq 0x20(%rsp), %rcx
movq 0x48(%rcx), %rcx
movq %rax, 0x20(%rcx)
jmp 0xa443
movq 0x90(%r14), %rdi
movl $0x1b, %edx
leaq 0x21233(%rip), %rsi     # 0x2b479
callq 0x4360
movq %rbx, %rdi
callq 0x4580
movq %r14, %rdi
movl %eax, %esi
callq 0x8180
jmp 0xa443
movq %r14, %rdi
movq %rbx, %rsi
movq %rsp, %rdx
callq 0x7d18
testl %eax, %eax
jle 0xa3ed
movq (%rsp), %rax
movq 0x8(%rsp), %rcx
movq %rcx, %rdx
subq %rax, %rdx
cmpq $0x9, %rdx
jb 0xa2c2
movl $0x1, %edx
movl $0x2, %ebp
movq (%rax,%rdx,8), %rdi
testq %rdi, %rdi
je 0xa2af
movq (%rdi), %rax
callq *0x20(%rax)
movq (%rsp), %rax
movq 0x8(%rsp), %rcx
movl %ebp, %edx
movq %rcx, %rsi
subq %rax, %rsi
sarq $0x3, %rsi
incl %ebp
cmpq %rdx, %rsi
ja 0xa297
movq (%rax), %rax
movq 0x20(%rsp), %rcx
movq 0x48(%rcx), %rcx
movq %rax, 0x28(%rcx)
jmp 0xa443
movq 0x90(%r14), %rdi
movl $0x1e, %edx
leaq 0x211b1(%rip), %rsi     # 0x2b49b
callq 0x4360
movq %rbx, %rdi
callq 0x4580
movq %r14, %rdi
movl %eax, %esi
callq 0x8180
jmp 0xa443
movq %r14, %rdi
movq %rbx, %rsi
movq %rsp, %rdx
callq 0x7d18
testl %eax, %eax
jle 0xa419
movq (%rsp), %rax
movq 0x8(%rsp), %rcx
movq %rcx, %rdx
subq %rax, %rdx
cmpq $0x9, %rdx
jb 0xa366
movl $0x1, %edx
movl $0x2, %ebp
movq (%rax,%rdx,8), %rdi
testq %rdi, %rdi
je 0xa353
movq (%rdi), %rax
callq *0x20(%rax)
movq (%rsp), %rax
movq 0x8(%rsp), %rcx
movl %ebp, %edx
movq %rcx, %rsi
subq %rax, %rsi
sarq $0x3, %rsi
incl %ebp
cmpq %rdx, %rsi
ja 0xa33b
movq (%rax), %rax
movq 0x20(%rsp), %rcx
movq 0x48(%rcx), %rcx
movq %rax, 0x18(%rcx)
jmp 0xa443
movq 0x90(%r14), %rdi
movl $0x23, %edx
leaq 0x21139(%rip), %rsi     # 0x2b4c7
callq 0x4360
movq %rbx, %rdi
callq 0x4580
movq %r14, %rdi
movl %eax, %esi
callq 0x8180
jmp 0xa443
movq %r14, %rdi
movq %rbx, %rsi
movq %rsp, %rdx
callq 0x7d18
cmpl $0x2, %eax
jg 0xa481
movq 0x90(%r14), %rdi
movl $0x26, %edx
leaq 0x21171(%rip), %rsi     # 0x2b545
callq 0x4360
movq %rbx, %rdi
callq 0x4580
movq %r14, %rdi
movl %eax, %esi
callq 0x8180
jmp 0xa443
movq 0x90(%r14), %rdi
movl $0x1d, %edx
leaq 0x210f2(%rip), %rsi     # 0x2b4f2
callq 0x4360
movq %rbx, %rdi
callq 0x4580
movq %r14, %rdi
movl %eax, %esi
callq 0x8180
jmp 0xa443
movq 0x90(%r14), %rdi
movl $0x25, %edx
leaq 0x210f3(%rip), %rsi     # 0x2b51f
callq 0x4360
movq %rbx, %rdi
callq 0x4580
movq %r14, %rdi
movl %eax, %esi
callq 0x8180
movq %rbx, %rsi
callq 0x7c34
movq (%rsp), %rdi
testq %rdi, %rdi
je 0xa461
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x4310
movq 0x28(%rsp), %rdi
cmpq %r13, %rdi
je 0x9faf
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x4310
jmp 0x9faf
movq (%rsp), %rbp
movq 0x8(%rsp), %rax
movq %rax, %rcx
subq %rbp, %rcx
cmpq $0x19, %rcx
jb 0xa4cf
movl $0x3, %ecx
movl $0x4, %r13d
movq (%rbp,%rcx,8), %rdi
testq %rdi, %rdi
je 0xa4ba
movq (%rdi), %rax
callq *0x20(%rax)
movq (%rsp), %rbp
movq 0x8(%rsp), %rax
movl %r13d, %ecx
movq %rax, %rdx
subq %rbp, %rdx
sarq $0x3, %rdx
incl %r13d
cmpq %rcx, %rdx
ja 0xa4a1
movl $0x18, %edi
leaq 0x38(%rsp), %r13
callq 0x4300
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movq $0x0, 0x10(%rax)
movq 0x20(%rsp), %rsi
movq 0x48(%rsi), %rcx
movq %rax, 0x8(%rcx)
movq (%rbp), %rdx
movq %rdx, (%rax)
movq 0x8(%rbp), %rax
movq 0x8(%rcx), %rcx
movq %rax, 0x8(%rcx)
movq 0x10(%rbp), %rax
movq 0x48(%rsi), %rcx
movq 0x8(%rcx), %rcx
jmp 0xa1b5
xorl %ebx, %ebx
jmp 0xa536
cmpl $0x1, %eax
jne 0xa52a
movb $0x1, %bl
jmp 0xa52c
xorl %ebx, %ebx
movq 0x20(%rsp), %rsi
callq 0x9d90
movl %ebx, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xa576
jmp 0xa576
jmp 0xa576
jmp 0xa576
jmp 0xa576
movq %rax, %rbx
movl $0x68, %esi
movq %r15, %rdi
jmp 0xa5a1
jmp 0xa576
movq %rax, %rbx
movq 0x48(%rsp), %rdi
cmpq %r13, %rdi
je 0xa5a6
movq 0x58(%rsp), %rsi
jmp 0xa59e
jmp 0xa576
movq %rax, %rbx
movq (%rsp), %rdi
testq %rdi, %rdi
je 0xa58f
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x4310
movq 0x28(%rsp), %rdi
cmpq %r13, %rdi
je 0xa5a6
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x4310
movq %rbx, %rdi
callq 0x45b0