// File: /workspace/github_cpp_makefile_star2_O2/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 0x18767(%rip), %rsi     # 0x21465
leaq 0x48(%rsp), %rdi
leaq 0x28(%rsp), %rdx
callq 0x9c50
leaq 0x48(%rsp), %rdx
movq %r14, %rdi
movq %rbx, %rsi
movq %r12, %rcx
callq 0x7ef8
movl %eax, %ebp
leaq 0x48(%rsp), %rdi
callq 0x4170
testb %bpl, %bpl
je 0x910a
pushq $0x68
popq %rdi
callq 0x4320
movq %rax, %r15
movq %rax, %rdi
callq 0x56d4
leaq 0x18(%r14), %rdi
movq %r12, %rsi
callq 0x9a8c
movq %r15, (%rax)
movq %r15, %rdi
addq $0x8, %rdi
movq %r12, %rsi
callq 0x41c0
pushq $0x30
popq %rdi
callq 0x4320
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movups %xmm0, 0x10(%rax)
movups %xmm0, 0x20(%rax)
movq %rax, 0x48(%r15)
leaq 0x38(%rsp), %r13
leaq 0x28(%rsp), %r12
movq %rsp, %rbp
movq %r14, %rdi
movq %rbx, %rsi
callq 0x71d2
testl %eax, %eax
jne 0x910e
movq %r13, 0x28(%rsp)
andq $0x0, 0x30(%rsp)
movb $0x0, 0x38(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
andq $0x0, 0x10(%rsp)
movq %r14, %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0x7050
testb %al, %al
je 0x90a1
movq %r12, %rdi
leaq 0x19347(%rip), %rsi     # 0x22124
callq 0x4d52
testb %al, %al
je 0x8e1a
movq %r14, %rdi
movq %rbx, %rsi
movq %rbp, %rdx
callq 0x7388
testl %eax, %eax
jle 0x8eaa
movq %rbp, %rsi
pushq $0x1
popq %rdx
callq 0x76d4
movq (%rsp), %rax
movq (%rax), %rax
movq 0x48(%r15), %rcx
movq %rax, (%rcx)
jmp 0x9099
movq %r12, %rdi
leaq 0x186c3(%rip), %rsi     # 0x214e7
callq 0x4d52
testb %al, %al
je 0x8e62
movq %r14, %rdi
movq %rbx, %rsi
movq %rbp, %rdx
callq 0x7388
testl %eax, %eax
jle 0x8f1c
movq %rbp, %rsi
pushq $0x1
popq %rdx
callq 0x76d4
movq (%rsp), %rax
movq (%rax), %rax
movq 0x48(%r15), %rcx
movq %rax, 0x10(%rcx)
jmp 0x9099
movq %r12, %rdi
leaq 0x1861e(%rip), %rsi     # 0x2148a
callq 0x4d52
testb %al, %al
je 0x8ed4
movq %r14, %rdi
movq %rbx, %rsi
movq %rbp, %rdx
callq 0x7388
testl %eax, %eax
jle 0x8f8e
movq %rbp, %rsi
pushq $0x1
popq %rdx
callq 0x76d4
movq (%rsp), %rax
movq (%rax), %rax
movq 0x48(%r15), %rcx
movq %rax, 0x20(%rcx)
jmp 0x9099
movq 0x90(%r14), %rdi
leaq 0x18591(%rip), %rsi     # 0x21449
callq 0x4300
movq %rbx, %rdi
callq 0x45a0
movq %r14, %rdi
movl %eax, %esi
callq 0x76b4
jmp 0x9099
movq %r12, %rdi
leaq 0x185dd(%rip), %rsi     # 0x214bb
callq 0x4d52
testb %al, %al
je 0x8f46
movq %r14, %rdi
movq %rbx, %rsi
movq %rbp, %rdx
callq 0x7388
testl %eax, %eax
jle 0x900c
movq %rbp, %rsi
pushq $0x1
popq %rdx
callq 0x76d4
movq (%rsp), %rax
movq (%rax), %rax
movq 0x48(%r15), %rcx
movq %rax, 0x28(%rcx)
jmp 0x9099
movq 0x90(%r14), %rdi
leaq 0x18541(%rip), %rsi     # 0x2146b
callq 0x4300
movq %rbx, %rdi
callq 0x45a0
movq %r14, %rdi
movl %eax, %esi
callq 0x76b4
jmp 0x9099
movq %r12, %rdi
leaq 0x18590(%rip), %rsi     # 0x214e0
callq 0x4d52
testb %al, %al
je 0x8fb8
movq %r14, %rdi
movq %rbx, %rsi
movq %rbp, %rdx
callq 0x7388
testl %eax, %eax
jle 0x9074
movq %rbp, %rsi
pushq $0x1
popq %rdx
callq 0x76d4
movq (%rsp), %rax
movq (%rax), %rax
movq 0x48(%r15), %rcx
movq %rax, 0x18(%rcx)
jmp 0x9099
movq 0x90(%r14), %rdi
leaq 0x184fb(%rip), %rsi     # 0x21497
callq 0x4300
movq %rbx, %rdi
callq 0x45a0
movq %r14, %rdi
movl %eax, %esi
callq 0x76b4
jmp 0x9099
movq %r12, %rdi
leaq 0x18329(%rip), %rsi     # 0x212eb
callq 0x4d52
testb %al, %al
je 0x9033
movq %r14, %rdi
movq %rbx, %rsi
movq %rbp, %rdx
callq 0x7388
cmpl $0x2, %eax
jg 0x90b6
movq 0x90(%r14), %rdi
leaq 0x18525(%rip), %rsi     # 0x21515
callq 0x4300
movq %rbx, %rdi
callq 0x45a0
movq %r14, %rdi
movl %eax, %esi
callq 0x76b4
jmp 0x9099
movq 0x90(%r14), %rdi
leaq 0x184a8(%rip), %rsi     # 0x214c2
callq 0x4300
movq %rbx, %rdi
callq 0x45a0
movq %r14, %rdi
movl %eax, %esi
callq 0x76b4
jmp 0x9099
movq 0x90(%r14), %rdi
leaq 0x182f1(%rip), %rsi     # 0x21332
callq 0x4300
movq %rax, %rdi
movq %r12, %rsi
callq 0x42e0
movq %rax, %rdi
leaq 0x182e7(%rip), %rsi     # 0x21342
callq 0x4300
movq %rbx, %rdi
callq 0x45a0
movq %r14, %rdi
movl %eax, %esi
callq 0x76b4
jmp 0x9099
movq 0x90(%r14), %rdi
leaq 0x1846d(%rip), %rsi     # 0x214ef
callq 0x4300
movq %rbx, %rdi
callq 0x45a0
movq %r14, %rdi
movl %eax, %esi
callq 0x76b4
movq %rbx, %rsi
callq 0x72de
movq %rbp, %rdi
callq 0xa7f0
movq %r12, %rdi
callq 0x4170
jmp 0x8d8d
movq %rbp, %rsi
pushq $0x3
popq %rdx
callq 0x76d4
pushq $0x18
popq %rdi
callq 0x4320
movq %rax, %rdi
movq %rax, 0x20(%rsp)
callq 0x9b70
movq 0x48(%r15), %rax
movq 0x20(%rsp), %rsi
movq %rsi, 0x8(%rax)
movq (%rsp), %rcx
movq (%rcx), %rdx
movq %rdx, (%rsi)
movq 0x8(%rcx), %rdx
movq 0x8(%rax), %rax
movq %rdx, 0x8(%rax)
movq 0x10(%rcx), %rax
movq 0x48(%r15), %rcx
movq 0x8(%rcx), %rcx
jmp 0x8e59
xorl %ebx, %ebx
jmp 0x9121
cmpl $0x1, %eax
jne 0x9117
movb $0x1, %bl
jmp 0x9119
xorl %ebx, %ebx
movq %r15, %rsi
callq 0x8b92
movl %ebx, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x915f
jmp 0x915f
jmp 0x915f
jmp 0x915f
jmp 0x915f
movq %rax, %rbx
pushq $0x68
popq %rsi
movq %r15, %rdi
callq 0x4330
jmp 0x9174
jmp 0x915f
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
jmp 0x916f
movq %rax, %rbx
jmp 0x9174
jmp 0x915f
movq %rax, %rbx
movq %rsp, %rdi
callq 0xa7f0
leaq 0x28(%rsp), %rdi
callq 0x4170
movq %rbx, %rdi
callq 0x45c0