// File: /workspace/github_cpp_makefile_star2_O1/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 $0x88, %rsp
movq %rdx, %r12
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x78(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0x22785(%rip), %rsi     # 0x2c45b
leaq 0x22784(%rip), %rdx     # 0x2c461
leaq 0x68(%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 0x68(%rsp), %rdi
cmpq %r13, %rdi
je 0x9d14
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x4320
testb %bpl, %bpl
je 0xa02f
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 $0x10, %edi
callq 0x4310
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movq %rax, 0x40(%r15)
leaq 0x58(%rsp), %rbp
leaq 0x48(%r14), %rax
movq %rax, 0x20(%rsp)
movq %r14, %rdi
movq %rbx, %rsi
callq 0x7d48
testl %eax, %eax
je 0x9d9a
movq %r15, %rsi
cmpl $0x1, %eax
jne 0x9e59
callq 0x9858
movb $0x1, %r12b
jmp 0x9e61
movq %rbp, %r13
movq %rbp, 0x48(%rsp)
xorl %eax, %eax
movq %rax, 0x50(%rsp)
movb $0x0, 0x58(%rsp)
movq %rax, 0x10(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
movq %r14, %rdi
movq %rbx, %rsi
leaq 0x48(%rsp), %rdx
callq 0x7b10
testb %al, %al
je 0x9ff3
leaq 0x48(%rsp), %rbp
movq %rbp, %rdi
leaq 0x22681(%rip), %rsi     # 0x2c462
callq 0x4110
testl %eax, %eax
je 0x9e68
movq %rbp, %rdi
leaq 0x22610(%rip), %rsi     # 0x2c404
callq 0x4110
testl %eax, %eax
je 0x9ed5
movq 0x90(%r14), %rbp
movl $0xf, %edx
movq %rbp, %rdi
leaq 0x2253b(%rip), %rsi     # 0x2c352
callq 0x4370
movq 0x48(%rsp), %rsi
movq 0x50(%rsp), %rdx
movq %rbp, %rdi
callq 0x4370
movl $0x13, %edx
movq %rax, %rdi
leaq 0x22525(%rip), %rsi     # 0x2c362
callq 0x4370
movq %rbx, %rdi
callq 0x4590
movq %r14, %rdi
movl %eax, %esi
callq 0x8418
jmp 0x9feb
callq 0x9858
xorl %r12d, %r12d
xorl %eax, %eax
jmp 0xa025
movq %r14, %rdi
movq %rbx, %rsi
movq %rsp, %rdx
callq 0x7fb2
testl %eax, %eax
jle 0x9f21
movq (%rsp), %rax
movq 0x8(%rsp), %rcx
subq %rax, %rcx
cmpq $0x9, %rcx
jb 0x9ec2
movl $0x1, %ecx
movl $0x2, %ebp
movq (%rax,%rcx,8), %rdi
testq %rdi, %rdi
je 0x9ea9
movq (%rdi), %rax
callq *0x20(%rax)
movl %ebp, %ecx
movq (%rsp), %rax
movq 0x8(%rsp), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
incl %ebp
cmpq %rcx, %rdx
ja 0x9e9a
movq (%rsp), %rax
movq (%rax), %rax
movq 0x40(%r15), %rcx
movq %rax, (%rcx)
jmp 0x9feb
leaq 0x28(%rsp), %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x7820
cmpq $0x0, 0x30(%rsp)
je 0x9f50
movq 0x20(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0xb51c
cmpq $0x0, (%rax)
je 0x9f7c
movq 0x20(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0xb51c
movq (%rax), %rax
movq 0x40(%r15), %rcx
movq %rax, 0x8(%rcx)
jmp 0x9fcf
movq 0x90(%r14), %rdi
movl $0x1b, %edx
leaq 0x22535(%rip), %rsi     # 0x2c469
callq 0x4370
movq %rbx, %rdi
callq 0x4590
movq %r14, %rdi
movl %eax, %esi
callq 0x8418
jmp 0x9feb
movq 0x90(%r14), %rdi
movl $0x2b, %edx
leaq 0x224aa(%rip), %rsi     # 0x2c40d
callq 0x4370
movq %rbx, %rdi
callq 0x4590
movq %r14, %rdi
movl %eax, %esi
callq 0x8418
jmp 0x9fcf
movq 0x90(%r14), %rbp
movl $0x11, %edx
movq %rbp, %rdi
leaq 0x224a7(%rip), %rsi     # 0x2c439
callq 0x4370
movq 0x28(%rsp), %rsi
movq 0x30(%rsp), %rdx
movq %rbp, %rdi
callq 0x4370
movl $0xf, %edx
movq %rax, %rdi
leaq 0x22493(%rip), %rsi     # 0x2c44b
callq 0x4370
movq %rbx, %rdi
callq 0x4590
movq %r14, %rdi
movl %eax, %esi
callq 0x8418
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x9feb
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x4320
movq %rbx, %rsi
callq 0x7ed0
movq (%rsp), %rdi
testq %rdi, %rdi
je 0xa009
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x4320
movq 0x48(%rsp), %rdi
movq %r13, %rbp
cmpq %r13, %rdi
je 0xa023
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x4320
movb $0x1, %al
testb %al, %al
jne 0x9d72
jmp 0xa032
xorl %r12d, %r12d
andb $0x1, %r12b
movl %r12d, %eax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xa074
jmp 0xa074
movq %rax, %rbx
movl $0x68, %esi
movq %r15, %rdi
jmp 0xa0c2
jmp 0xa097
jmp 0xa097
movq %rax, %rbx
movq 0x68(%rsp), %rdi
cmpq %r13, %rdi
je 0xa0c7
movq 0x78(%rsp), %rsi
jmp 0xa0bf
movq %rax, %rbx
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0xa09a
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x4320
jmp 0xa09a
jmp 0xa097
movq %rax, %rbx
movq (%rsp), %rdi
testq %rdi, %rdi
je 0xa0b0
movq 0x10(%rsp), %rsi
subq %rdi, %rsi
callq 0x4320
movq 0x48(%rsp), %rdi
cmpq %r13, %rdi
je 0xa0c7
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x4320
movq %rbx, %rdi
callq 0x45c0
nop