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

  SceneGroup * n = new SceneGroup();
  groups[name] = n;
  n->name_ = name;
  n->sphere_ = new ParametricSphere();

  do
  {
    int state = findOpenOrClosedParen(str);

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

      if (readCommand(str, cmd))
      {
        if (cmd == "radius")
        {
          if (getValues(str, values) < 1)
          {
            *err << "Type with no parameters at ";
            errLine(str.tellg());
          }
          else
          {
            cleanAfter(values, 1);
            n->sphere_->radius_ = values[0];
          }
        }
        else if (cmd == "material")
        {
          string matName = getString(str);

          if (matName.empty())
          {
            *err << "No material name after material command at ";
            errLine(str.tellg());
          }
          else if (materials[matName] == NULL)
          {
            *err << "Unknown material " << matName << " referenced at ";
            errLine(str.tellg());
          }
          else
          {
            n->sphere_->material_ = materials[matName];
          }
        }
        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 $0x98, %rsp
movq %rdx, %r12
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x88(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0x21ad8(%rip), %rsi     # 0x2b46b
leaq 0x21ad7(%rip), %rdx     # 0x2b471
leaq 0x78(%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 0x78(%rsp), %rdi
cmpq %r13, %rdi
je 0x99d4
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x4310
testb %bpl, %bpl
je 0x9cdb
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 $0x10, %edi
callq 0x4300
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movq %r15, 0x8(%rsp)
movq %rax, 0x40(%r15)
leaq 0x68(%rsp), %rbp
leaq 0x48(%r14), %rax
movq %rax, 0x30(%rsp)
xorl %r15d, %r15d
leaq 0x58(%rsp), %r13
movq %r14, %rdi
movq %rbx, %rsi
callq 0x7aaa
testl %eax, %eax
jne 0x9cdf
movq %rbp, 0x58(%rsp)
movq %r15, 0x60(%rsp)
movb $0x0, 0x68(%rsp)
movq %r15, 0x20(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq %r14, %rdi
movq %rbx, %rsi
movq %r13, %rdx
callq 0x7872
testb %al, %al
je 0x9ca4
movq %r13, %rdi
leaq 0x219e4(%rip), %rsi     # 0x2b472
callq 0x4110
testl %eax, %eax
je 0x9b06
movq %r13, %rdi
leaq 0x21973(%rip), %rsi     # 0x2b414
callq 0x4110
testl %eax, %eax
je 0x9b81
movq 0x90(%r14), %r12
movl $0xf, %edx
movq %r12, %rdi
leaq 0x2189e(%rip), %rsi     # 0x2b362
callq 0x4360
movq 0x58(%rsp), %rsi
movq 0x60(%rsp), %rdx
movq %r12, %rdi
callq 0x4360
movl $0x13, %edx
movq %rax, %rdi
leaq 0x21888(%rip), %rsi     # 0x2b372
callq 0x4360
movq %rbx, %rdi
callq 0x4580
movq %r14, %rdi
movl %eax, %esi
callq 0x8180
jmp 0x9c9c
movq %r14, %rdi
movq %rbx, %rsi
leaq 0x10(%rsp), %rdx
callq 0x7d18
testl %eax, %eax
jle 0x9bd2
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rcx
movq %rcx, %rdx
subq %rax, %rdx
cmpq $0x9, %rdx
jb 0x9b6d
movl $0x1, %edx
movl $0x2, %r12d
movq (%rax,%rdx,8), %rdi
testq %rdi, %rdi
je 0x9b58
movq (%rdi), %rax
callq *0x20(%rax)
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rcx
movl %r12d, %edx
movq %rcx, %rsi
subq %rax, %rsi
sarq $0x3, %rsi
incl %r12d
cmpq %rdx, %rsi
ja 0x9b3f
movq (%rax), %rax
movq 0x8(%rsp), %rcx
movq 0x40(%rcx), %rcx
movq %rax, (%rcx)
jmp 0x9c9c
leaq 0x38(%rsp), %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x75a0
cmpq $0x0, 0x40(%rsp)
je 0x9c01
movq 0x30(%rsp), %rdi
leaq 0x38(%rsp), %rsi
callq 0xb19a
cmpq $0x0, (%rax)
je 0x9c2d
movq 0x30(%rsp), %rdi
leaq 0x38(%rsp), %rsi
callq 0xb19a
movq (%rax), %rax
movq 0x8(%rsp), %rcx
movq 0x40(%rcx), %rcx
movq %rax, 0x8(%rcx)
jmp 0x9c80
movq 0x90(%r14), %rdi
movl $0x1b, %edx
leaq 0x21894(%rip), %rsi     # 0x2b479
callq 0x4360
movq %rbx, %rdi
callq 0x4580
movq %r14, %rdi
movl %eax, %esi
callq 0x8180
jmp 0x9c9c
movq 0x90(%r14), %rdi
movl $0x2b, %edx
leaq 0x21809(%rip), %rsi     # 0x2b41d
callq 0x4360
movq %rbx, %rdi
callq 0x4580
movq %r14, %rdi
movl %eax, %esi
callq 0x8180
jmp 0x9c80
movq 0x90(%r14), %r12
movl $0x11, %edx
movq %r12, %rdi
leaq 0x21806(%rip), %rsi     # 0x2b449
callq 0x4360
movq 0x38(%rsp), %rsi
movq 0x40(%rsp), %rdx
movq %r12, %rdi
callq 0x4360
movl $0xf, %edx
movq %rax, %rdi
leaq 0x217f2(%rip), %rsi     # 0x2b45b
callq 0x4360
movq %rbx, %rdi
callq 0x4580
movq %r14, %rdi
movl %eax, %esi
callq 0x8180
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0x9c9c
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x4310
movq %rbx, %rsi
callq 0x7c34
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x9cbb
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x4310
movq 0x58(%rsp), %rdi
cmpq %rbp, %rdi
je 0x9a3f
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x4310
jmp 0x9a3f
xorl %ebx, %ebx
jmp 0x9cf4
cmpl $0x1, %eax
jne 0x9ce8
movb $0x1, %bl
jmp 0x9cea
xorl %ebx, %ebx
movq 0x8(%rsp), %rsi
callq 0x9526
movl %ebx, %eax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x9d34
movq %rax, %rbx
movl $0x68, %esi
movq %r15, %rdi
jmp 0x9d83
jmp 0x9d34
jmp 0x9d57
movq %rax, %rbx
movq 0x78(%rsp), %rdi
cmpq %r13, %rdi
je 0x9d88
movq 0x88(%rsp), %rsi
jmp 0x9d80
jmp 0x9d57
movq %rax, %rbx
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0x9d5a
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x4310
jmp 0x9d5a
jmp 0x9d57
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x9d71
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x4310
movq 0x58(%rsp), %rdi
cmpq %rbp, %rdi
je 0x9d88
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x4310
movq %rbx, %rdi
callq 0x45b0