// File: /workspace/github_cpp_makefile_star2_O1/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 $0x58, %rsp
movq %rdx, %r12
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x48(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0x22226(%rip), %rsi     # 0x2c485
leaq 0x22224(%rip), %rdx     # 0x2c48a
leaq 0x38(%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 0x38(%rsp), %rdi
cmpq %r13, %rdi
je 0xa29d
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x4320
testb %bpl, %bpl
je 0xa87e
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
movl $0x30, %edi
callq 0x4310
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movups %xmm0, 0x10(%rax)
movups %xmm0, 0x20(%rax)
movq %rax, 0x48(%r15)
leaq 0x28(%rsp), %r13
movq %r14, %rdi
movq %rbx, %rsi
callq 0x7d48
testl %eax, %eax
je 0xa322
movq %r15, %rsi
cmpl $0x1, %eax
jne 0xa441
callq 0xa0d0
movb $0x1, %bpl
jmp 0xa448
movq %r13, %r12
movq %r13, 0x18(%rsp)
xorl %eax, %eax
movq %rax, 0x20(%rsp)
movb $0x0, 0x28(%rsp)
movq %rax, 0x10(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
movq %r14, %rdi
movq %rbx, %rsi
leaq 0x18(%rsp), %rdx
callq 0x7b10
testb %al, %al
je 0xa7b1
leaq 0x18(%rsp), %r13
movq %r13, %rdi
leaq 0x22dfb(%rip), %rsi     # 0x2d164
callq 0x4110
testl %eax, %eax
je 0xa44f
movq %r13, %rdi
leaq 0x22187(%rip), %rsi     # 0x2c507
callq 0x4110
testl %eax, %eax
je 0xa4bf
movq %r13, %rdi
leaq 0x22113(%rip), %rsi     # 0x2c4aa
callq 0x4110
testl %eax, %eax
je 0xa530
movq %r13, %rdi
leaq 0x2212d(%rip), %rsi     # 0x2c4db
callq 0x4110
testl %eax, %eax
je 0xa5d0
movq %r13, %rdi
leaq 0x2213b(%rip), %rsi     # 0x2c500
callq 0x4110
testl %eax, %eax
je 0xa670
movq %r13, %rdi
leaq 0x21f2f(%rip), %rsi     # 0x2c30b
callq 0x4110
testl %eax, %eax
je 0xa710
movq 0x90(%r14), %r13
movl $0xf, %edx
movq %r13, %rdi
leaq 0x21f53(%rip), %rsi     # 0x2c352
callq 0x4370
movq 0x18(%rsp), %rsi
movq 0x20(%rsp), %rdx
movq %r13, %rdi
callq 0x4370
movl $0x13, %edx
movq %rax, %rdi
leaq 0x21f3d(%rip), %rsi     # 0x2c362
callq 0x4370
movq %rbx, %rdi
callq 0x4590
movq %r14, %rdi
movl %eax, %esi
callq 0x8418
jmp 0xa7a9
callq 0xa0d0
xorl %ebp, %ebp
xorl %eax, %eax
jmp 0xa7e3
movq %r14, %rdi
movq %rbx, %rsi
movq %rsp, %rdx
callq 0x7fb2
testl %eax, %eax
jle 0xa5a1
movq (%rsp), %rax
movq 0x8(%rsp), %rcx
subq %rax, %rcx
cmpq $0x9, %rcx
jb 0xa4ac
movl $0x1, %ecx
movl $0x2, %r13d
movq (%rax,%rcx,8), %rdi
testq %rdi, %rdi
je 0xa491
movq (%rdi), %rax
callq *0x20(%rax)
movl %r13d, %ecx
movq (%rsp), %rax
movq 0x8(%rsp), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
incl %r13d
cmpq %rcx, %rdx
ja 0xa482
movq (%rsp), %rax
movq (%rax), %rax
movq 0x48(%r15), %rcx
movq %rax, (%rcx)
jmp 0xa7a9
movq %r14, %rdi
movq %rbx, %rsi
movq %rsp, %rdx
callq 0x7fb2
testl %eax, %eax
jle 0xa641
movq (%rsp), %rax
movq 0x8(%rsp), %rcx
subq %rax, %rcx
cmpq $0x9, %rcx
jb 0xa51c
movl $0x1, %ecx
movl $0x2, %r13d
movq (%rax,%rcx,8), %rdi
testq %rdi, %rdi
je 0xa501
movq (%rdi), %rax
callq *0x20(%rax)
movl %r13d, %ecx
movq (%rsp), %rax
movq 0x8(%rsp), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
incl %r13d
cmpq %rcx, %rdx
ja 0xa4f2
movq (%rsp), %rax
movq (%rax), %rax
movq 0x48(%r15), %rcx
movq %rax, 0x10(%rcx)
jmp 0xa7a9
movq %r14, %rdi
movq %rbx, %rsi
movq %rsp, %rdx
callq 0x7fb2
testl %eax, %eax
jle 0xa6e1
movq (%rsp), %rax
movq 0x8(%rsp), %rcx
subq %rax, %rcx
cmpq $0x9, %rcx
jb 0xa58d
movl $0x1, %ecx
movl $0x2, %r13d
movq (%rax,%rcx,8), %rdi
testq %rdi, %rdi
je 0xa572
movq (%rdi), %rax
callq *0x20(%rax)
movl %r13d, %ecx
movq (%rsp), %rax
movq 0x8(%rsp), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
incl %r13d
cmpq %rcx, %rdx
ja 0xa563
movq (%rsp), %rax
movq (%rax), %rax
movq 0x48(%r15), %rcx
movq %rax, 0x20(%rcx)
jmp 0xa7a9
movq 0x90(%r14), %rdi
movl $0x1b, %edx
leaq 0x21eb5(%rip), %rsi     # 0x2c469
callq 0x4370
movq %rbx, %rdi
callq 0x4590
movq %r14, %rdi
movl %eax, %esi
callq 0x8418
jmp 0xa7a9
movq %r14, %rdi
movq %rbx, %rsi
movq %rsp, %rdx
callq 0x7fb2
testl %eax, %eax
jle 0xa753
movq (%rsp), %rax
movq 0x8(%rsp), %rcx
subq %rax, %rcx
cmpq $0x9, %rcx
jb 0xa62d
movl $0x1, %ecx
movl $0x2, %r13d
movq (%rax,%rcx,8), %rdi
testq %rdi, %rdi
je 0xa612
movq (%rdi), %rax
callq *0x20(%rax)
movl %r13d, %ecx
movq (%rsp), %rax
movq 0x8(%rsp), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
incl %r13d
cmpq %rcx, %rdx
ja 0xa603
movq (%rsp), %rax
movq (%rax), %rax
movq 0x48(%r15), %rcx
movq %rax, 0x28(%rcx)
jmp 0xa7a9
movq 0x90(%r14), %rdi
movl $0x1e, %edx
leaq 0x21e37(%rip), %rsi     # 0x2c48b
callq 0x4370
movq %rbx, %rdi
callq 0x4590
movq %r14, %rdi
movl %eax, %esi
callq 0x8418
jmp 0xa7a9
movq %r14, %rdi
movq %rbx, %rsi
movq %rsp, %rdx
callq 0x7fb2
testl %eax, %eax
jle 0xa77f
movq (%rsp), %rax
movq 0x8(%rsp), %rcx
subq %rax, %rcx
cmpq $0x9, %rcx
jb 0xa6cd
movl $0x1, %ecx
movl $0x2, %r13d
movq (%rax,%rcx,8), %rdi
testq %rdi, %rdi
je 0xa6b2
movq (%rdi), %rax
callq *0x20(%rax)
movl %r13d, %ecx
movq (%rsp), %rax
movq 0x8(%rsp), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
incl %r13d
cmpq %rcx, %rdx
ja 0xa6a3
movq (%rsp), %rax
movq (%rax), %rax
movq 0x48(%r15), %rcx
movq %rax, 0x18(%rcx)
jmp 0xa7a9
movq 0x90(%r14), %rdi
movl $0x23, %edx
leaq 0x21dc3(%rip), %rsi     # 0x2c4b7
callq 0x4370
movq %rbx, %rdi
callq 0x4590
movq %r14, %rdi
movl %eax, %esi
callq 0x8418
jmp 0xa7a9
movq %r14, %rdi
movq %rbx, %rsi
movq %rsp, %rdx
callq 0x7fb2
cmpl $0x2, %eax
jg 0xa7f0
movq 0x90(%r14), %rdi
movl $0x26, %edx
leaq 0x21dfb(%rip), %rsi     # 0x2c535
callq 0x4370
movq %rbx, %rdi
callq 0x4590
movq %r14, %rdi
movl %eax, %esi
callq 0x8418
jmp 0xa7a9
movq 0x90(%r14), %rdi
movl $0x1d, %edx
leaq 0x21d7c(%rip), %rsi     # 0x2c4e2
callq 0x4370
movq %rbx, %rdi
callq 0x4590
movq %r14, %rdi
movl %eax, %esi
callq 0x8418
jmp 0xa7a9
movq 0x90(%r14), %rdi
movl $0x25, %edx
leaq 0x21d7d(%rip), %rsi     # 0x2c50f
callq 0x4370
movq %rbx, %rdi
callq 0x4590
movq %r14, %rdi
movl %eax, %esi
callq 0x8418
movq %rbx, %rsi
callq 0x7ed0
movq (%rsp), %rdi
testq %rdi, %rdi
je 0xa7c7
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x4320
movq 0x18(%rsp), %rdi
movq %r12, %r13
cmpq %r12, %rdi
je 0xa7e1
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x4320
movb $0x1, %al
testb %al, %al
jne 0xa2fa
jmp 0xa880
movq (%rsp), %rax
movq 0x8(%rsp), %rcx
subq %rax, %rcx
cmpq $0x19, %rcx
jb 0xa837
movl $0x3, %ecx
movl $0x4, %r13d
movq (%rax,%rcx,8), %rdi
testq %rdi, %rdi
je 0xa81c
movq (%rdi), %rax
callq *0x20(%rax)
movl %r13d, %ecx
movq (%rsp), %rax
movq 0x8(%rsp), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
incl %r13d
cmpq %rcx, %rdx
ja 0xa80d
movl $0x18, %edi
callq 0x4310
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movq $0x0, 0x10(%rax)
movq 0x48(%r15), %rcx
movq %rax, 0x8(%rcx)
movq (%rsp), %rdx
movq (%rdx), %rsi
movq %rsi, (%rax)
movq 0x8(%rdx), %rax
movq 0x8(%rcx), %rcx
movq %rax, 0x8(%rcx)
movq 0x10(%rdx), %rax
movq 0x48(%r15), %rcx
movq 0x8(%rcx), %rcx
jmp 0xa527
xorl %ebp, %ebp
andb $0x1, %bpl
movl %ebp, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xa8c4
jmp 0xa8c4
jmp 0xa8c4
jmp 0xa8c4
jmp 0xa8c4
jmp 0xa8c4
movq %rax, %rbx
movl $0x68, %esi
movq %r15, %rdi
jmp 0xa8ef
jmp 0xa8c4
movq %rax, %rbx
movq 0x38(%rsp), %rdi
cmpq %r13, %rdi
je 0xa8f4
movq 0x48(%rsp), %rsi
jmp 0xa8ec
movq %rax, %rbx
movq (%rsp), %rdi
testq %rdi, %rdi
je 0xa8dd
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x4320
movq 0x18(%rsp), %rdi
cmpq %r12, %rdi
je 0xa8f4
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x4320
movq %rbx, %rdi
callq 0x45c0