// File: /workspace/github_cpp_makefile_star2_O2/srajangarg[P]raytracer/src/core/SceneLoader.cpp
// Function: SceneLoader::getValue(std::istream&)
ParametricValue * SceneLoader::getValue(istream & str)
{
  char temp;
  str >> temp;

  if (temp == '{') // time-varying expression
  {
    int start = str.tellg();
    string expr;

    while (str.get(temp))
    {
      if (temp == '}') // completed expr
      {
        ParametricValue * v = new ExprValue(expr.c_str());

        if (!v->good())
        {
          *err << "Error: couldn't parse expression \"" << expr << "\" at ";
          curPos(*err, str.tellg());
          *err << endl;
          delete v;
          return NULL;
        }
        else
        {
          return v;
        }
      }
      else if (temp == '#')
      {
        string no;
        getline(str, no);
      }
      else
      {
        expr += temp;
      }
    }

    *err << "Error: No closing brace for expr at ";
    curPos(*err, start);
    *err << endl;
    return NULL;
  }
  else if (temp == ')')
  {
    str.putback(temp);
    return NULL;
  }
  else if (temp == '#')
  {
    string no;
    getline(str, no);
    return getValue(str);
  }
  else
  {
    str.putback(temp);
    double val;
    str.peek();
    str >> val;

    if (str.fail())
    {
      str.clear();
      *err << "Failed to extract a numeric value at ";
      curPos(*err, str.tellg());
      *err << endl;
      str.peek();
      return NULL;
    }
    else
    {
      return new ConstValue(val);
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0xf(%rsp), %r15
movq %rsi, %rdi
movq %r15, %rsi
callq 0x4400
movzbl (%r15), %eax
cmpl $0x23, %eax
je 0x74be
cmpl $0x29, %eax
je 0x74ab
cmpl $0x7b, %eax
jne 0x74ef
movq %r14, %rdi
callq 0x45a0
movq %rax, 0x30(%rsp)
leaq 0x20(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x48(%rsp), %r15
leaq 0xf(%rsp), %r12
leaq 0x38(%rsp), %r13
leaq 0x10(%rsp), %rbp
movq %r14, %rdi
movq %r12, %rsi
callq 0x4460
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x7574
movzbl 0xf(%rsp), %eax
cmpl $0x23, %eax
je 0x7486
cmpl $0x7d, %eax
je 0x75e9
movsbl %al, %esi
movq %rbp, %rdi
callq 0x42c0
jmp 0x7449
movq %r15, 0x38(%rsp)
andq $0x0, 0x40(%rsp)
movb $0x0, 0x48(%rsp)
movq %r14, %rdi
movq %r13, %rsi
callq 0x40b0
movq %r13, %rdi
callq 0x4170
jmp 0x7449
pushq $0x29
popq %rsi
movq %r14, %rdi
callq 0x4620
xorl %r15d, %r15d
jmp 0x75b4
leaq 0x20(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x10(%rsp), %rsi
movq %r14, %rdi
callq 0x40b0
movq %rbx, %rdi
movq %r14, %rsi
callq 0x73d4
movq %rax, %r15
jmp 0x75aa
movsbl %al, %esi
movq %r14, %rdi
callq 0x4620
movq %r14, %rdi
callq 0x4130
leaq 0x10(%rsp), %rsi
movq %r14, %rdi
callq 0x4220
movq (%r14), %rax
movq -0x18(%rax), %rdi
testb $0x5, 0x20(%r14,%rdi)
je 0x75c6
addq %r14, %rdi
xorl %r15d, %r15d
xorl %esi, %esi
callq 0x4570
movq 0x90(%rbx), %rdi
leaq 0x19cc3(%rip), %rsi     # 0x21200
callq 0x4300
movq 0x90(%rbx), %r12
movq %r14, %rdi
callq 0x45a0
movq %rbx, %rdi
movq %r12, %rsi
movl %eax, %edx
callq 0x6d66
movq 0x90(%rbx), %rdi
callq 0x4190
movq %r14, %rdi
callq 0x4130
jmp 0x75b4
movq 0x90(%rbx), %rdi
leaq 0x19c59(%rip), %rsi     # 0x211db
callq 0x4300
movq 0x90(%rbx), %rsi
movq %rbx, %rdi
movq 0x30(%rsp), %rdx
callq 0x6d66
movq 0x90(%rbx), %rdi
callq 0x4190
xorl %r15d, %r15d
leaq 0x10(%rsp), %rdi
callq 0x4170
movq %r15, %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x10
popq %rdi
callq 0x4320
movq %rax, %r15
movsd 0x10(%rsp), %xmm0
leaq 0x2736a(%rip), %rax     # 0x2e948
movq %rax, (%r15)
movsd %xmm0, 0x8(%r15)
jmp 0x75b4
movl $0xc0, %edi
callq 0x4320
movq %rax, %r15
movq 0x10(%rsp), %rsi
movq %rax, %rdi
callq 0x996c
movq (%r15), %rax
movq %r15, %rdi
callq *0x10(%rax)
testb %al, %al
jne 0x75aa
movq 0x90(%rbx), %rdi
leaq 0x19b9a(%rip), %rsi     # 0x211b8
callq 0x4300
leaq 0x10(%rsp), %rsi
movq %rax, %rdi
callq 0x42e0
leaq 0x19b32(%rip), %rsi     # 0x21169
movq %rax, %rdi
callq 0x4300
movq 0x90(%rbx), %r12
movq %r14, %rdi
callq 0x45a0
movq %rbx, %rdi
movq %r12, %rsi
movl %eax, %edx
callq 0x6d66
movq 0x90(%rbx), %rdi
callq 0x4190
movq (%r15), %rax
movq %r15, %rdi
callq *0x20(%rax)
jmp 0x75a7
jmp 0x769e
movq %rax, %rbx
movl $0xc0, %esi
movq %r15, %rdi
callq 0x4330
jmp 0x76a1
jmp 0x769e
jmp 0x769e
jmp 0x769e
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
callq 0x4170
jmp 0x76a1
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x4170
movq %rbx, %rdi
callq 0x45c0
nop